<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Chris,<br>
I am just as lazy as you are, but I stuck with it and have a command
line version that works.<br>
Command line in that within the V4 system one can middle mouse on
the line<br>
Eol.Fix inFileName outFileName<br>
and the conversion will happen.<br>
Here is the code<br>
---<br>
MODULE Eol;<br>
<br>
IMPORT<br>
Files,<br>
Oberon,<br>
Out,<br>
Texts;<br>
<br>
VAR<br>
rd: Files.Rider;<br>
wr: Files.Rider;<br>
inFile: Files.File;<br>
outFile: Files.File;<br>
<br>
PROCEDURE Open* (out, in: ARRAY OF CHAR): BOOLEAN;<br>
VAR flag: BOOLEAN;<br>
BEGIN<br>
inFile := Files.Old(in);<br>
flag := (inFile # NIL);<br>
IF flag THEN<br>
Files.Set(rd, inFile, 0);<br>
outFile := Files.New(out);<br>
flag := (outFile # NIL);<br>
IF flag THEN<br>
Files.Set(wr, outFile, 0)<br>
ELSE<br>
Out.String("Could not open output <");
Out.String(out); Out.String(">"); Out.Ln<br>
END<br>
ELSE<br>
Out.String("Could not open input <"); Out.String(in);
Out.String(">"); Out.Ln<br>
END;<br>
RETURN flag<br>
END Open;<br>
<br>
PROCEDURE Strip* ;<br>
VAR c: CHAR;<br>
BEGIN<br>
Files.Read(rd, c);<br>
WHILE ~rd.eof DO<br>
IF (c = 0DX) OR (c = 0AX) THEN c := " " END;<br>
Files.Write(wr, c);<br>
Files.Read(rd, c);<br>
END;<br>
Files.Register(outFile);<br>
Files.Close(inFile)<br>
END Strip;<br>
<br>
PROCEDURE Fix*;<br>
VAR s: Texts.Scanner; inName, outName: ARRAY 256 OF CHAR;<br>
BEGIN<br>
Out.Open;<br>
Texts.OpenScanner(s, Oberon.Par.text, Oberon.Par.pos);<br>
Texts.Scan(s);<br>
IF s.class # Texts.Name THEN <br>
Out.String("input name not found"); Out.Ln ;<br>
Out.Int(s.class,3); Out.String(" = s.class"); Out.Ln<br>
ELSE<br>
COPY(s.s, inName) ;<br>
Texts.Scan(s);<br>
IF s.class # Texts.Name THEN <br>
Out .String("output name not found"); Out.Ln ;<br>
Out.Int(s.class,3); Out.String(" = s.class"); Out.Ln<br>
ELSE<br>
COPY(s.s, outName); <br>
IF Open(outName, inName) THEN <br>
Strip;<br>
Out.String("File converted"); Out.Ln<br>
END<br>
END<br>
END<br>
END Fix;<br>
<br>
END Eol.<br>
---<br>
<br>
<br>
<div class="moz-cite-prefix">On 12/3/2016 10:32 PM, eas lab wrote:<br>
</div>
<blockquote
cite="mid:CAN3-DLF_TEGV6F+BYyii-Aof7tYsO93Rr4fVB7brxXDDyWyBgQ@mail.gmail.com"
type="cite">
<pre wrap="">Douglas G Danforth wrote:-
</pre>
<blockquote type="cite">
<pre wrap="">This V4 code seems to work!
Needing to cast a BYTE using ORD threw me for a while.
You don't need to do that with Component Pascal.
</pre>
</blockquote>
<pre wrap="">
Yes thank, I'm using your code. And I'd like to refine it to syntax:-
ELO.Fix <InFile> <OutFile> ~
Because it's a production tool for me; so I want minimal handling;
but I've also lost the *.Text with the nice tutorial examples of S3
which I believe would also work with V4.
Ie. to scan ahead to fetch "<InFile> <OutFile> ~" .
Yes, I'm lazy and resisiting relearning old stuff.
It's more fruitfull to discuss extensions to Oberon.
That's also why I included the terse examples of *nix script.
.... With hold till later
discussion re. massive power/economy-of-effort from functional/piping
programming style, as demonstrated in this tread's linux snippet.
== Chris Glur.
--
<a class="moz-txt-link-abbreviated" href="mailto:Oberon@lists.inf.ethz.ch">Oberon@lists.inf.ethz.ch</a> mailing list for ETH Oberon and related systems
<a class="moz-txt-link-freetext" href="https://lists.inf.ethz.ch/mailman/listinfo/oberon">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Danforth of the Greenwood</pre>
</body>
</html>