From 293e2f9bd316311579a6b324d8b3d7676623ee33 Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Sat, 16 Sep 2017 18:05:04 +0300 Subject: [PATCH] =?utf8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?utf8?q?=D0=B0=20=D1=83=D1=82=D0=B8=D0=BB=D0=B8=D1=82=D0=B0=20TextV4?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- TextV4/.gitignore | 2 ++ TextV4/TextV4 | 8 +++++ TextV4/TextV4.obn | 63 ++++++++++++++++++++++++++++++++++++ TextV4/make.sh | 7 ++++ TextV4/voc/.gitignore | 7 ++++ TextV4/voc/TextV4Print.Mod | 4 +++ TextV4/voc/TextV4ToAscii.Mod | 4 +++ TextV4/voc/TextV4ToText.Mod | 4 +++ TextV4/voc/make.sh | 6 ++++ 9 files changed, 105 insertions(+) create mode 100644 TextV4/.gitignore create mode 100755 TextV4/TextV4 create mode 100644 TextV4/TextV4.obn create mode 100755 TextV4/make.sh create mode 100644 TextV4/voc/.gitignore create mode 100644 TextV4/voc/TextV4Print.Mod create mode 100644 TextV4/voc/TextV4ToAscii.Mod create mode 100644 TextV4/voc/TextV4ToText.Mod create mode 100755 TextV4/voc/make.sh diff --git a/TextV4/.gitignore b/TextV4/.gitignore new file mode 100644 index 0000000..d9da078 --- /dev/null +++ b/TextV4/.gitignore @@ -0,0 +1,2 @@ +classes +tmp diff --git a/TextV4/TextV4 b/TextV4/TextV4 new file mode 100755 index 0000000..6407076 --- /dev/null +++ b/TextV4/TextV4 @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e + +DIR=$(dirname "$0") +PATH="..:$PATH" + +java -ea -cp "$DIR/classes" Launcher TextV4.$* diff --git a/TextV4/TextV4.obn b/TextV4/TextV4.obn new file mode 100644 index 0000000..af686f5 --- /dev/null +++ b/TextV4/TextV4.obn @@ -0,0 +1,63 @@ +(** Утилита для ковертирования теггированного текста в 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. diff --git a/TextV4/make.sh b/TextV4/make.sh new file mode 100755 index 0000000..62688d1 --- /dev/null +++ b/TextV4/make.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +PATH="..:$PATH" + +obn-compile.sh -I TextV4 TextV4 diff --git a/TextV4/voc/.gitignore b/TextV4/voc/.gitignore new file mode 100644 index 0000000..94818f5 --- /dev/null +++ b/TextV4/voc/.gitignore @@ -0,0 +1,7 @@ +TextV4Print +TextV4ToAscii +TextV4ToText +*.o +*.sym +*.h +*.c diff --git a/TextV4/voc/TextV4Print.Mod b/TextV4/voc/TextV4Print.Mod new file mode 100644 index 0000000..99b9ab8 --- /dev/null +++ b/TextV4/voc/TextV4Print.Mod @@ -0,0 +1,4 @@ +MODULE TextV4Print; +IMPORT TextV4; +BEGIN TextV4.Print +END TextV4Print. diff --git a/TextV4/voc/TextV4ToAscii.Mod b/TextV4/voc/TextV4ToAscii.Mod new file mode 100644 index 0000000..80d6654 --- /dev/null +++ b/TextV4/voc/TextV4ToAscii.Mod @@ -0,0 +1,4 @@ +MODULE TextV4ToAscii; +IMPORT TextV4; +BEGIN TextV4.ToAscii +END TextV4ToAscii. diff --git a/TextV4/voc/TextV4ToText.Mod b/TextV4/voc/TextV4ToText.Mod new file mode 100644 index 0000000..d7bf851 --- /dev/null +++ b/TextV4/voc/TextV4ToText.Mod @@ -0,0 +1,4 @@ +MODULE TextV4ToText; +IMPORT TextV4; +BEGIN TextV4.ToText +END TextV4ToText. diff --git a/TextV4/voc/make.sh b/TextV4/voc/make.sh new file mode 100755 index 0000000..fb63176 --- /dev/null +++ b/TextV4/voc/make.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +set -e + +voc -F ../TextV4.obn TextV4ToAscii.Mod -m TextV4ToText.Mod -m TextV4Print.Mod -m +rm -f *.o *.sym *.h *.c -- 2.29.2