This procedure interprets characters being sent to the line printer and make various modifications, insertions and deletions. It thus functions as a filter.
The section of code from here to line 8913 is concerned with character translation when the full 96 character set is not available, and a 64 character set is in use.
Since the capabilities of a printer do not usually change with time, the defined variable “CAP” (8840) must be set once and for all (at a particular installation).
The run-time test on (lp11.flag & CAP) could be replaced by a compile-time test on (CAP) and if the compiler has its “druthers”, if CAP turns out to be zero, the whole section of code to line 8913 could be compiled down to nothing.
The present code could be said to plan ahead for a situation where an installation may have two or more printers of different types. Even so there is a basic inconsistency here in the use of “CAP”, “IND” and “EJECT” on the one hand, and “EJLINE” and “MAXCOL” on the other. In fact since forms of different sizes are not uncommonly used on a single printer, the last two should not be constants at all, but should be dynamically settable.
Lower case alphabetics are translated by the addition of a constant, which is conveniently defined as “’A’ – ’a”’;
Certain of the remaining characters are special characters which are printed as a similar character with an overprinted minus sign, e.g. “{” (8889) is printed as “{-”;
The “similiar” character is output via a recursive call on “lpcanon”, which will increment “lp11.ccc” by one as a side effect;
Decrement the current character count (for the same effect as a “back space” character) and ...
Prepare to output a minus sign;
The “switch” statement beginning here extends to line 8963. Certain characters involved in vertical and horizontal spacing are given special interpretations with delayed actions;
For a horizontal tab character, round the current character count up to the next multiple of eight. Do not output any blank characters immediately;
For a “form feed” or “new line” character, if:
(a) the printer does not have a “page restore” capability; or
(b) the current line is not empty; or
(c) some lines have been completed since the last “form feed” character, then ...
reset “lp11.mcc” to zero;
Increment the completed line count;
Convert a “new line” character to a “form feed” if sufficient lines have been completed on the current page, and the printer has a “form feed” capability;
Output the character, and if was a “form feed”, reset number of completed lines zero;
Examination of this code will show that:
Any string of “form feed”s or “new line”s which begins with a “form feed”, will, if sent to a printer with “form feed” capability, be reduced to a single “form feed”;
A “form feed” character sent to a printer without the “form feed” capability, will cause a new line to be started but will be passed on otherwise without comment.
For “carriage return”s, and, note, “form feed”s and “new line”s, reset the current character count to zero or eight, depending on “IND”, and return;
For all other characters ...
If a string of “backspace”s (real or contrived) and/or “carriage returns” has been received, output a single “carriage return” and reset the maximum character count to zero;
Provided the count does not exceed the maximum line length, output blank characters to bring the maximum character count to the current character count. (Perhaps these two variables would be more accurately called the “actual character count” and the “logical character count”.);
Output the actual character.