End-of-line recognition, End-of-line recognition 2 – Apple LaserWriter Select 310 Printer User Manual
Page 55
C H A P T E R 2
LaserWriter Select 310 Software
PostScript Language Changes
43
End-of-Line Recognition
2
In PostScript interpreter versions 40.0 and later, the scanner and the readline operator
recognize all three external forms of end of line (LF alone, CR alone, and CR LF pair) and
treat them uniformly. The PostScript interpreter does not translate data read or written by
any other means.
In the LaserWriter Select 310 printer, end-of-line (EOL) translation occurs at two levels: in
the PostScript interpreter and in the serial communication channel. This section deals
only with the EOL conventions at the level of the PostScript interpreter. The translation
performed by the communication handler is described in Chapter 3, “Communication
Channels.”
The LaserWriter 310 Select printer supports translation by the communication channel to
maintain compatibility with diverse host operating systems and communications
environments. For instance, always sending CR LF for EOL permits use with operating
systems that treat CR alone or LF alone as EOL characters, provided they strip out the
redundant character. In addition, the CR LF convention is essential for use with directly
connected terminals.
The new rules for end-of-line recognition at the level of the PostScript interpreter have
the following consequences.
1. Any of the three forms of EOL appearing in a string are treated as a single newline
(LF) character. For example:
(any text
(any text
(any text
The above examples produce identical string objects, each of which has a single
newline (LF) character separating text and some.
2. Any three forms of EOL appearing immediate after \ in a string are treated as a
continuation. This means that both the \ and the EOL are discarded:
(any text\
(any text\
(any text\
The above examples produce identical string objects.
3. Any of the three forms of EOL appearing outside a string are treated as a single white-
space character. Since the language treats multiple white-space characters in the same
way as a single white-space character, the treatment of EOL is interesting only when a
PostScript language token is followed by data to be read explicitly by one of the file
operators:
currentfile read
currentfile read
currentfile read
The above examples produce identical results. The read operator reads the character x
from the current input files and leaves its character code (an integer) on the stack.
4. The readline operator treats any of the three forms of EOL as the termination
condition.