Linux Native Oberon : textfile format

As you undoubtedly saw before, in the screendump of the 'less' program, Oberon text files have a different format from both DOS and Unix. In order to be sure you understand what I mean, I have put the screendump in the above picture.

What we see here is:

which poses a small problem since Unix demands a LF to end lines, whereas DOS demands a CR/LF pair. And Oberon is right in between... So it's time to write our own filter, similar to 'fromdos' and 'todos'.

Linux Native Oberon : ob2unix

This is a simple program so it is short too. Here is the source:
MODULE ob2unix;

(*	Convert Oberon format text files to Unix format.
	This is GPL software

version 0.1		5 Jan 2009			*)


VAR	ch		: CHAR;

      InOut.Read (ch);
      IF  InOut.EOF ()  THEN  EXIT  END;
      IF  ch = ASCII.CR  THEN  ch := ASCII.LF  END;
      InOut.Write (ch)
END ob2unix.
And here is the pudding (ob2unix <Hit.Mod >hit.mod) after digestion:

which looks good to me. Now I only need to find out what the rubble is in front of the text.

Linux Native Oberon : fooled again

Minutes after having completed my ob2unix program, the seasoned Modula-2 programmer was once again corrected. Read this: to find out that Linux may not have a tool to convert between Oberon and itself, but Oberon does... In this file, you also read that

But further tests are required.

It turns out, that 'EditTools.OpenUnix' opens a file, as if it were a Unix file. The editor looks just like a display of the less viewer above. And 'EditTools.StoreUnix' only sent the contents of the 'System.Log' file to disk, in Unix format...

So, I might be fooled once more in the fact that I was not fooled at all but assumed to be fooled again, as in previous cases.

Here are some pictures to show what happened:

So there's still some more work to do for the seasoned Modula-2 programmer... ;o)

Page created 5 January 2009,