[Oberon] Text2ASCII at github - was: "all in one git tree"
Joerg
joerg.straube at iaeth.ch
Tue Dec 29 14:31:56 CET 2020
Hi
Attached my version for PO13. I added ET.StoreAscii to my System.Tool. Mark a viewer with the text you wanna store as ASCII file with the star and click on ET.StoreAscii
br
Jörg
MODULE ET; (* jr/3apr19, EditTools *)
IMPORT Files, Viewers, Texts, Oberon, TextFrames, Strings, Out;
CONST
TAB = 9X; LF = 0AX; CR = 0DX;
PROCEDURE StoreAscii*; (* store text in marked viewer as pure ASCII. mark a viewer with CTRL-Z *)
VAR
V: Viewers.Viewer;
S: Texts.Scanner;
name: ARRAY 32 OF CHAR;
F: Files.File;
W: Files.Rider;
R: Texts.Reader;
ch: CHAR;
BEGIN
V := Oberon.MarkedViewer();
IF (V.dsc # NIL) & (V.dsc.next IS TextFrames.Frame) THEN (* the marked viewer is a standard TextFrame *)
(* extract file name *)
Texts.OpenScanner(S, V.dsc(TextFrames.Frame).text, 0); Texts.Scan(S);
name := S.s; Strings.Append(name, ".txt");
Out.String("writing "); Out.String(name); Out.Ln;
F := Files.New(name);
IF F # NIL THEN (* write ASCII chars to file *)
Files.Set(W, F, 0);
Texts.OpenReader(R, V.dsc.next(TextFrames.Frame).text, 0);
Texts.Read(R, ch);
WHILE ~R.eot DO
IF (ch = TAB) OR (ch >= " ") THEN Files.Write(W, ch)
ELSIF ch = CR THEN Files.Write(W, CR); Files.Write(W, LF)
END;
Texts.Read(R, ch)
END;
Files.Register(F);
END
END
END StoreAscii;
END ET.StoreAscii
ORP.Compile jr.ET.Mod ~
System.Free ET ~
Am 29.12.20, 13:34 schrieb "Oberon im Auftrag von Bernhard Treutwein" <oberon-bounces at lists.inf.ethz.ch im Auftrag von oberon at wildwein.de>:
glancing over the discussion about "all in one git tree" I remembered that Pieter Muller had written a tiny program to convert Oberon Text files to pure ASCII, so that these could be savely handled by cvs. I think it might be useful also for svn and git. I recovered it from the sourceforge repo and have created a github repo for it at: https://github.com/btreut/Text2Ascii
--
Bernhard
--
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