----- Original Message ----- From: "Frank Heckenbach" ih8mj@fjf.gnu.de To: gpc@gnu.de Sent: Tuesday, March 23, 2004 2:40 PM Subject: Re: ISO 7185 compliance issue for GPC
Scott Moore wrote:
Well, first I must say that this is a point where I consider the standard broken. (E.g., I have a text editor written in Pascal, and I want it to be able to handle files with or without trailing EOLn's, without appending them either when reading or writing the files.)
I agree, and heartly recommend the method used in IP Pascal for this, which is completely ISO 7185 compatible. The ISO rules only specify the special handling on files of "text". A declaration "file of char" (which text was originally defined to be equivalent to in Wirth prestandard) is, as allowed in the standard, truly a linear file of characters. This gives any program wanting %100 control of its output format that ability.
That's true, but it has some drawbacks. First, you have to deal with different line endings yourself then. Second, it may be less comfortable, and also less efficient (reading a char vs. a line at a time).
Frank
Well, note that ISO 7185 has no construct for reading a line at a time, so its all off the standard in any case. To me that means "file of char", and a whole host of special procedures if that's wanted.
I guess I have become biased. I created the idea of "file of char" bypass because I wanted to "have control", but I have since come to *love* the line ending filtering specified by the standard (and it was very much a creature of the standard, and not the original language). It simplifies code and regularizes line endings, even across multiple operating systems. It should be slow, but the common effect I have observed is that I can dump output much faster to a file than to the screen, which means that GUI output overwhelms the actual serial handling by orders of magnitude.