----- Original Message ----- From: "CBFalconer" cbfalconer@yahoo.com To: gpc@gnu.de Sent: Wednesday, March 24, 2004 4:22 AM Subject: Re: ISO 7185 compliance issue for GPC
Frank Heckenbach wrote:
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).
IIRC 'text' is not a reserved word, only a predefined type. Thus the question devolves to "what is that type". If we redefine it, are the text files input and output still available in the affected scopes? Are input and output predefined as text files?
Text is indeed a type. In Wirths original language it was defined to be "file of char", which implied that the compiler be ready to recognize "file of char" as the special file applicable to writeln readln, page, etc.
The standard simply specified that only the (predefined) type text would get such treatment. For example:
type text = file of char;
Appearing in the program would break the association to the original type, and:
var f: text;
...
writeln(f)
Would no longer be valid.
Input and output, only in regards to the header files, are predefined as text.