XEROX SPRINT 2 4 1 SPrint 1 4 By: Reid Smith (Unsupported) INTRODUCTION SPRINT is a package containing a number of functions for controlling the format of printed output. The original package was written by Bill VanMelle for the INTERLISP-10 MYCIN environment. It has been extended (with some minor bugs removed) for the INTERLISP-D environment. FUNCTIONS (SPRINT LST DSP PMAR LMAR INDENT LEN LEVEL SEPR INDICATE) [Function] SPRINT prints LST to the stream DSP (defaults to the primary output file), filling each line, and providing PRINTOUT-like functionality. Each line is indented INDENT spaces (defaults to 0). INDENT = T means start a new line at the paragraph indentation; a negative INDENT means start a new line if not on one already. LEN is the length of a line (defaults to the LINELENGTH of DSP). Paragraphs are indented PMAR spaces (defaults to INDENT). New lines forced by line length are indented LMAR spaces (defaults to PMAR). If LST is not a list, it is treated as a one-element list. LST may contain strings, in which case they are broken at spaces and hyphens as needed for line-filling. SPRINT treats punctuation atoms ("( ) [ ] { } < > ~ . , ; :") specially, not spacing before closing punctuation (e.g., ",") or after opening punctuation (e.g., "["). It also does this for strings beginning or ending with punctuation characters, except for one-character strings (this provides a way of overriding the normal handling of punctuation). LEVEL is a printlevel parameterÿÿï%ÿlists at depth greater than LEVEL are printed as "..." (defaults to 100). SEPR is a string or atom to PRIN1 between elements of LST (defaults to " "). T is interpreted as "," and will not be printed after the words "and" and "or." INDICATE is used to make SPRINT look like PRINT: if LST is a list, outer parentheses will be printed, and strings in LST will be enclosed in quotes. Special functions are indicated by the following atoms in the input: $L: Paragraph Break. Start a new line at the PMAR indentation. The EOL character (the value of the atom EOL) and the TAB character will also do this. $I: Indent what follows. Start a new paragraph at the previous indentation + 3. $O: Outdent what follows. Undo a $I. $N: No space. Suppress the space normally appearing between words. $PPV and $PPVTL: Like .PPV and .PPVTL from printout. Font Switching (fontclasses as per PRINTOUT). $DEFAULT or $FONT1: Switch to DEFAULTFONT. $BOLD or $FONT2: Switch to BOLDFONT. $LITTLE or $FONT3: Switch to LITTLEFONT. $BIG or $FONT4: Switch to BIGFONT. $FONT5: Switch to $FONT5. $FONT6: Switch to $FONT6. $FONT7: Switch to $FONT7. $FONT FontDescriptor: Switch to the font specified by FontDescriptor. (SPRINT always resets DSPFONT and DSPLINEFEED to their entering values [for streams that accept these calls].) If the atom SCRIPTFILE has a non-NIL value, then all output produced by SPRINT is echoed to SCRIPTFILE. (SCHANGEFONT FONTCLASS FILE) [Function] CHANGEFONT in FILE to FONTCLASS (with echo to SCRIPTFILE). (SPRINTOUT X DSP) [Function] PRIN1 X to DSP (echo to SCRIPTFILE). (SPRINTTERPRI DSP) [Function] TERPRI to DSP (echo to SCRIPTFILE). (STAB POS MINSPACES FILE) [Function] TAB to POS in FILE by MINSPACES (with echo to SCRIPTFILE). (SPRINT1 LST LEVEL DSP) [Function] SPRINT1 is a recursive subfunction of SPRINT which prints LST to DSP (recurring for any elements which are themselves lists and not in excess of LEVEL levels deep). SPRINT1 dispatches to other subfunctions according to each element of LST. (SPRINTLINELENGTH DSP) [Function] If LEN is given (as an argument to SPRINT) then it is taken as the length of a line in DSP. Otherwise, the current line length of DSP is computed. (SPRINTOPEN CHAR DSP) [Function] SPRINTOPEN is called to print an "open parenthesis" type of character. CHAR is not actually printed, but rather is saved to print just before the next thing printed. This avoids printing an isolated parenthesis at the end of a line. (SPRINTSEPR NEWLINE DONTFORCE DSP) [Function] SPRINTSEPR first prints the separator characters specified by SEPR (see SPRINT for defaults) according to SEPRFLG. It then deals with EOL characters and tabbing to a new margin according to NEWLINE and DONTFORCE. Finally, it prints any backed-up parenthesis as necessary. SEPRFLG = T means "print SEPR as appropriate." SEPRFLG = NIL means don't print SEPR. NEWLINE is set to a number if a new line is desired after separator. DONTFORCE = NIL means print an EOL when a new line is called for and tab to the NEWLINE specified margin. DONTFORCE = T means simply tab to the NEWLINE specified margin. (SPRINTX VAL SHOWQUOTE DSP) [Function] SPRINTX is the major subfunction of SPRINT which prints ordinary atoms or strings. SHOWQUOTE is true if the quotes surrounding VAL should be printed as well. SPRINTX gauges the space available on the current line, and starts a new one and/or splits up VAL as necessary. If VAL starts with a "closing punctuation" character, (e.g., "," or ")"), space is suppressed before it; Similarly, if VAL ends in an "opening punctuation" character, space is suppressed after it. If VAL is a one-character string (rather than an atom), the special punctuation treatment is suppressed (this allows, for example, "<" to be printed as a less-than symbol instead of angle bracket, and "." to be printed as a lisp dotted pair symbol instead of period). (DSPRINTT X) [Function] DSPRINTT calls SPRINT with a single argument, the item to be printed, followed by a TERPRI. MISCELLANEOUS FUNCTIONS (A/AN LST) [Function] A/AN conses "a" or "an" on front of LST, depending on its initial letter. The case of the initial letter in LST is ignored. (PLURALIZE? WORD LST) [Function] PLURALIZE? pluralizes WORD if LST is a list of more than one element, or a number not equal to 1. It returns WORD with an "s" or "es" tacked on the end; otherwise just WORD. PLURALIZE? knows about the exceptions that are on the a-list IRREGULAR.PLURALS. (LIST ((PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC )) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC )) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC )) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC )) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC )) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC )) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL)))))1È ¼È1È È(È (È(ŠŠ8(ŠŠ8DÈÈ PAGEHEADING RUNNINGHEADMODERN MODERN MODERN MODERN MODERNLOGO?1(DEFAULTFONT 1 (GACHA 10) (GACHA 8) (TERMINAL 8))  HRULE.GETFNMODERN  HRULE.GETFNMODERN  HRULE.GETFNMODERN  HRULE.GETFNMODERN  HRULE.GETFNMODERN   0 fE/805Å*2e,>F-fQ&C5.+%)#"oh        ;   :MU Q(  Gž  >(M => G    S #zqN  \ $E   L7R=zº