At 13:19 +1100 1999/11/03, [EMAIL PROTECTED] wrote:
>I am using Basic Hugs, Jun 20 1999, on Mac OS 8.6.
..
>It appears that Mac Hugs switches \r and \n characters when it reads and
>writes files.
Hugs is merely using the C standard. According to the latter there are two
types of files, text and binary. In text files, line separators are
converted, whereas in binary files they are not.
So under MacOS, which uses \r as text file line separators, they are
converted back and forth to \n, the UNIX and C standard, which is what Hugs
is using internally.
If one is restricting to the use of the MacOS, UNIX and DOS line
separators, then one could treat all files as binary with newline \n when
written. When a file is read, any of \n, \r, \r\n, \n\r is treated as a
single line separator. Then a text file from any of the three OS'es can be
properly read without an conversion.
It's a trend for editors that they can treat all three variations of line
separators, so I think this is something to prefer if no other line
separators will ever be used.
The other alternative is that Haskell or Hugs follows the C standard in
this respect, properly making the distinction between files opened as text
or binary.
>By the way, if Mac Hugs allowed command line editing it would be almost
>>perfect!
I think it does. One just has to make sure that after the editing the
cursor is at the end of the line, otherwise the Hugs will miss what is
after the cursor.
This problem has to do with the console that comes with the Metrowerks
compiler we are using. Such problems can be fixed by writing a wholly new
console package, which would take a considerable amount of time. But if
somebody out there wants to take up the challenge, let's hear from you! --
The Mach based MacOS X is expected to arrive at the end of the next year,
so qualified Mac programming might become interesting again.
Hans Aberg
* Email: Hans Aberg <mailto:[EMAIL PROTECTED]>
* Home Page: <http://www.matematik.su.se/~haberg/>
* AMS member listing: <http://www.ams.org/cml/>