DEADSOFTWARE

Добавлена утилита TextV4
[dsw-obn.git] / TextV4 / TextV4.obn
1 (** Утилита для ковертирования теггированного текста в ASCII и на оборот **)
2 (** TextV4.ToAscii <input file name> <output file name> **)
3 (** TextV4.ToText <input file name> <output file name> **)
4 (** TextV4.PrintText <input file name> **)
6 MODULE TextV4;
8 IMPORT Oberon, Texts, Files, Out;
10 PROCEDURE ToAscii*;
11 VAR
12 f : Files.File;
13 w : Files.Rider;
14 r : Texts.Reader;
15 s : Texts.Scanner;
16 t : Texts.Text;
17 c : CHAR;
18 BEGIN
19 Texts.OpenScanner(s, Oberon.Par.text, Oberon.Par.pos);
20 Texts.Scan(s); NEW(t); Texts.Open(t, s.s); Texts.OpenReader(r, t, 0);
21 Texts.Scan(s); f := Files.New(s.s); Files.Set(w, f, 0);
22 Texts.Read(r, c);
23 IF ~r.eot THEN
24 IF c # 00X THEN IF c = 0DX THEN c := 0AX END; Files.Write(w, c) END;
25 WHILE ~r.eot DO
26 Texts.Read(r, c);
27 IF c # 00X THEN IF c = 0DX THEN c := 0AX END; Files.Write(w, c) END;
28 END;
29 Files.Register(f); Files.Close(f);
30 END;
31 END ToAscii;
33 PROCEDURE ToText*;
34 VAR
35 s : Texts.Scanner;
36 t : Texts.Text;
37 BEGIN
38 Texts.OpenScanner(s, Oberon.Par.text, Oberon.Par.pos);
39 Texts.Scan(s); NEW(t); Texts.Open(t, s.s);
40 Texts.Scan(s); Texts.Close(t, s.s);
41 END ToText;
43 PROCEDURE Print*;
44 VAR
45 r : Texts.Reader;
46 s : Texts.Scanner;
47 t : Texts.Text;
48 c : CHAR;
49 BEGIN
50 Texts.OpenScanner(s, Oberon.Par.text, Oberon.Par.pos);
51 Texts.Scan(s); NEW(t); Texts.Open(t, s.s); Texts.OpenReader(r, t, 0);
53 Texts.Read(r, c);
54 IF ~r.eot THEN
55 IF c # 00X THEN IF c = 0DX THEN Out.Ln; END; Out.Char(c) END;
56 WHILE ~r.eot DO
57 Texts.Read(r, c);
58 IF c # 00X THEN IF c = 0DX THEN Out.Ln; END; Out.Char(c) END;
59 END;
60 END;
61 END Print;
63 END TextV4.