[Oberon] Text.Buffer usage.

Alexander Ilin ajsoft at yandex.ru
Sat Dec 17 22:58:17 CET 2016


Hi all!

  If I remember correctly, by convention the buffer contents are moved to the text. I.e. after the "copy" operation the phrase.buf should be empty already.

  Here's a quote from the Texts.Mod: "By convention, once a buffer is applied to a text, its contents is emptied." That works for at least Texts.Insert and Texts.Append.

17.12.2016, 22:29, "peter at easthope.ca" <peter at easthope.ca>:
> From: peter at easthope.ca
> Date: Sat, 17 Dec 2016 08:54:25 -0800
>>  SD is appended to DB according to,
>>  "(* Append copy of source buffer SB to destination buffer DB. *)
>>   PROCEDURE Copy (SB, DB: Buffer);"
>>
>>  Then ... empty SD and reset the Writer.
>
> In the following, for example, how can "Reset phrase" be accomplished?
>
> Thanks, ... Lyall E.
>
> VAR
>         ch: CHAR;
>         phrase: Texts.Writer; (* Intermediate storage as ch are read and processed. *)
>         accum: Texts.Buffer; (* Storage where processed phrases are accumulated. *)
> BEGIN
>         ...
>         Texts.OpenWriter(phrase);
>         Texts.OpenBuf(accum);
>         ...
>         Texts.Write(phrase, ch);
>         ...
>         Texts.Write(phrase, ch);
>         ...
>         Texts.Copy(phrase.buf, accum);
>         (* Reset phrase *)
>         ...
>         Texts.Write(phrase, ch);
>         ...
>         Texts.Write(phrase, ch);
>         ...
>         Texts.Copy(phrase.buf, accum);
>         etc.
>
> --
>
> 123456789 123456789 123456789 123456789 123456789 123456789 123456789
> Tel: +1 360 639 0202 Pender Is.: +1 250 629 3757
> http://easthope.ca/Peter.html Bcc: peter at easthope. ca
>
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon

---=====--- 
 Александр


More information about the Oberon mailing list