(** Утилита для ковертирования теггированного текста в ASCII и на оборот **) (** TextV4.ToAscii **) (** TextV4.ToText **) (** TextV4.PrintText **) MODULE TextV4; IMPORT Oberon, Texts, Files, Out; PROCEDURE ToAscii*; VAR f : Files.File; w : Files.Rider; r : Texts.Reader; s : Texts.Scanner; t : Texts.Text; c : CHAR; BEGIN Texts.OpenScanner(s, Oberon.Par.text, Oberon.Par.pos); Texts.Scan(s); NEW(t); Texts.Open(t, s.s); Texts.OpenReader(r, t, 0); Texts.Scan(s); f := Files.New(s.s); Files.Set(w, f, 0); Texts.Read(r, c); IF ~r.eot THEN IF c # 00X THEN IF c = 0DX THEN c := 0AX END; Files.Write(w, c) END; WHILE ~r.eot DO Texts.Read(r, c); IF c # 00X THEN IF c = 0DX THEN c := 0AX END; Files.Write(w, c) END; END; Files.Register(f); Files.Close(f); END; END ToAscii; PROCEDURE ToText*; VAR s : Texts.Scanner; t : Texts.Text; BEGIN Texts.OpenScanner(s, Oberon.Par.text, Oberon.Par.pos); Texts.Scan(s); NEW(t); Texts.Open(t, s.s); Texts.Scan(s); Texts.Close(t, s.s); END ToText; PROCEDURE Print*; VAR r : Texts.Reader; s : Texts.Scanner; t : Texts.Text; c : CHAR; BEGIN Texts.OpenScanner(s, Oberon.Par.text, Oberon.Par.pos); Texts.Scan(s); NEW(t); Texts.Open(t, s.s); Texts.OpenReader(r, t, 0); Texts.Read(r, c); IF ~r.eot THEN IF c # 00X THEN IF c = 0DX THEN Out.Ln; END; Out.Char(c) END; WHILE ~r.eot DO Texts.Read(r, c); IF c # 00X THEN IF c = 0DX THEN Out.Ln; END; Out.Char(c) END; END; END; END Print; END TextV4.