previous next top complete contents complete index framed top this page unframed
keepNul is a bit that specifies that null and carriage return characters are not to be discarded from input operations on a file. It may be passed to $createUniqueFile, open, and $reOpen.
39.1.1. A Note on the Treatment of Carriage Return
On systems where the one-character STRING constant eol is not a
carriage return (that is, all currently supported platforms),
MAINSAIL discards carriage return characters on input for any
text file for which the keepNul bit was not set when the file was
opened. That is, the treatment of carriage return is analogous to
the treatment of the NUL (ASCII 0) character.
(Should MAINSAIL be implemented on a system where the end-of-line
character is carriage return, the carriage return character would of
course not be discarded on that system.)
Carriage returns are discarded by default to deal with the difference between Windows and UNIX end-of-line sequences. On Windows, end-of-line is represented as a carriage return character (ASCII 13) followed by a linefeed character (ASCII 10), whereas on UNIX, the end-of-line sequence is represented by a single linefeed. The situation is made more complicated by the fact that many users share UNIX files on Windows systems.
On UNIX and Windows, MAINSAIL follows the UNIX convention for end-of-line; i.e., eol is a one-character STRING consisting of a linefeed. When a text file is created, eol is written to the file as a linefeed by default; specifying the device prefix CRLF (see Section 22.14.1) causes eol to be written as a carriage return followed by a linefeed.
The PROCEDURE $treatLikeNul can be used to determine whether a given character code is discarded by default on input from a text file; see Section 48.15.
MAINSAIL Language Manual, Section 39.1