DEADSOFTWARE

Добавлена утилита TextV4
authorDeaDDooMER <deaddoomer@deadsoftware.ru>
Sat, 16 Sep 2017 15:05:04 +0000 (18:05 +0300)
committerDeaDDooMER <deaddoomer@deadsoftware.ru>
Sat, 16 Sep 2017 15:05:04 +0000 (18:05 +0300)
TextV4/.gitignore [new file with mode: 0644]
TextV4/TextV4 [new file with mode: 0755]
TextV4/TextV4.obn [new file with mode: 0644]
TextV4/make.sh [new file with mode: 0755]
TextV4/voc/.gitignore [new file with mode: 0644]
TextV4/voc/TextV4Print.Mod [new file with mode: 0644]
TextV4/voc/TextV4ToAscii.Mod [new file with mode: 0644]
TextV4/voc/TextV4ToText.Mod [new file with mode: 0644]
TextV4/voc/make.sh [new file with mode: 0755]

diff --git a/TextV4/.gitignore b/TextV4/.gitignore
new file mode 100644 (file)
index 0000000..d9da078
--- /dev/null
@@ -0,0 +1,2 @@
+classes
+tmp
diff --git a/TextV4/TextV4 b/TextV4/TextV4
new file mode 100755 (executable)
index 0000000..6407076
--- /dev/null
@@ -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 (file)
index 0000000..af686f5
--- /dev/null
@@ -0,0 +1,63 @@
+(** Утилита для ковертирования теггированного текста в ASCII и на оборот **)
+(**   TextV4.ToAscii <input file name> <output file name> **)
+(**   TextV4.ToText <input file name> <output file name> **)
+(**   TextV4.PrintText <input file name> **)
+
+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 (executable)
index 0000000..62688d1
--- /dev/null
@@ -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 (file)
index 0000000..94818f5
--- /dev/null
@@ -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 (file)
index 0000000..99b9ab8
--- /dev/null
@@ -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 (file)
index 0000000..80d6654
--- /dev/null
@@ -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 (file)
index 0000000..d7bf851
--- /dev/null
@@ -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 (executable)
index 0000000..fb63176
--- /dev/null
@@ -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