k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS)...

85
-f\k* /7 73 bwroora umvereny uiufwwo Dept. of Special Cotections con . fr&'fyro nt»e -

Transcript of k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS)...

Page 1: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

-f\k* /7 73

bwroora umvereny uiufwwo

Dept. of Special Cotectionscon . fr&'fyro nt»e —-

Page 2: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

STANFORD ARTIFICIAL INTELLIGENCE PROJECTOPERATING NOTE 70

PUB

The Document Compiler

by

Larry Tesler

ABSTRACT:

PUB is an advanced text justlfier and page formatter intendedprimarily for use by programmers. It can automatically number pages,sections, figures,

footnotes,

etc. and can print their numbers inroman numerals as well as in digit or letter form. It can generatecross

references,

tables of contents, and Indexes. Page layout 1sflexible, and allows multiple column output. Line formattingincludes tabs, underlining, superscripts, subscripts, centering, andjustification. Macros programmed in a SAIL-like string-processinglanguage can generate text to be printed in the document. The outputof the compiler is a file which can be printed on the terminal, onthe line printer, or on microfilm.

ACKNOWLEDGMENTS:

Les Earnest created the concept of. the Document Compiler andspecified most of its capabilities.

Dan Swinehart provided invaluable advice and aid throughout thedevelopment of PUB.

Russ Taylor programmed the FR-80 preprocessor.

This work was supported in part by the Advanced Research ProjectsAgency of the Department of Defense under Contract SD 183.

MARCH 1973

Page 3: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

SAILON 70 PUB Page 1

TABLE OF CONTENTS

SECTION

1 INTRODUCTION

1.1 PURPOSE 11.2 CAPABILITIES 11.3 OPERATION . 21.4 COMPILER OUTPUT 41.5 READING THIS MANUAL 51.6 TUTORIAL FOR BEGINNERS 51.7 SAMPLE COMPILATION 9

2 TEXT CONVENTIONS

2.1 . ILLEGAL CHARACTERS 132.2 COMMAND AND TEXT LINES 132.3 PARAGRAPHING 142.4 FILL MODE 142.5 JUSTIFICATION 142.6 BREAKING AT BLANK LINES 152.7 BREAKING AT TABS 152.8 BREAKING AT CARRIAGE -RETURNS .... 152.9 NOFILL MODE 152.10 HORIZONTAL SPACE COMPACTION .... 162.11 VERTICAL GROUPING 172.12 MOOE AND SWITCH SETTING COMMANDS ... 172.13 WORD BREAKS 182.14 CONTROL FUNCTIONS 182.15 CONTROL CHARACTER ACTIVATION .... 212.16 COMPUTED TEXT 23

3 MACROS

3.1 CALLING A MACRO FROM A COMMAND LINE . . 253.2 CALLING A MACRO FROM A TEXT LINE ... 253.3 TEMPLATES 263.4 MACRO DECLARATION 273.5 MACRO CALLS 273.6 OMISSIONS . . .

;

283.7 RECURSIVE MACROS 29

Page 4: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

TABLE OF CONTENTSPage ii

4 EXPRESSIONS

4.1 DATA TYPE 384.2 VARIABLES 304.3 AUTOMATICALLY DECLARED VARIABLES ... 314.4 SIMPLE EXPRESSIONS . ■. 324.5 GENERAL EXPRESSIONS 334.6 CONSTANTS 34

5 STATEMENTS

5.1 STATEMENT TYPES 355.2 BLOCK 355.3 COMPOUND STATEMENT or CLUMP .... 355.4 ONE PARAGRAPH SCOPE 36

6 DECLARATIONS

6.1 SCOPE 376.2 MODE DECLARATIONS 376.3 TABS DECLARATION 37 «6.4 INDENT DECLARATION 386.5 PREFACE DECLARATION 396.6 DOUBLE SPACING 396.7 AREA DECLARATION 396.8 MARGIN CONTROL . 406.9 PLACE DECLARATION 426.10 TEMPORARY AREAS 426.11 COUNTER DECLARATION . 43

7 IMPERATIVES7.1 ASSIGNMENT STATEMENT 457.2 CONDITIONAL STATEMENT 457 3 NEXT COUNTER VALUE STATEMENT .... 457!4 NEXT PAGE STATEMENT 477 5 HEADINGS AND FOOTINGS 487.6 SECTIONING 487 7 COMMAND CHARACTER STATEMENT .... 497.8 PORTION DEMARCATION . 497.9 SEND STATEMENT 507.10 RECEIVE STATEMENT . 527.11 REQUIRE STATEMENT 537.12 SKIP STATEMENTS 537.13 PAGE FRAME STATEMENT 55

I1

SAILON-70

Page 5: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

SAILON-70 TABLE OF CONTENTS Page iii

7.14 BREAK STATEMENT 557.15 CONTINUE STATEMENT 557.16 DEVICE STATEMENT 557.17 UNIMPLEMENTED STATEMENTS 56

8 COMMENTS

9 LABELS AND CROSS-REFERENCES

9.1 CROSS-REFERENCES 599.2 LABELS 68

10 RESPONSES

18.1 TEXT RESPONSES 6310.2 TRANSITION RESPONSES 64

11 FOOTNOTES

APPENDICES

A THOROUGHLY EXPLAINED EXAMPLES

A.l SECTIONING MACROS 68A. 2 SAMPLE TABLE OF CONTENTS ..... 69A. 3 ONE-LEVEL INDEXES 70A. 4 TWO-LEVEL INDEXES 72A. 5 KWIC INDEXES 74

SUBJECT AND COMMAND INDEX I

Page 6: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

SAILON-70 PUB Page 1

SECTION 1

INTRODUCTION

f

1.1 PURPOSE

PUB Is a compiler which translates a manuscript Intodocument.

A "manuscript" is an SOS file containing the text of apublication interspersed with control characters andcommands. The function of the compiler 1s to arrangethis text on formatted pages under the direction ofthe control characters and commands.

Output is written on a ".DOC" file known as the"document". TYPE, SPOOL or PRINT It. Under certainconditions, the document can be edited with TECO (seeSection 7.16), but it is wiser to make corrections inthe manuscript and then rerun the compiler.

MANUSCRIPT - DOCUMENTCOMPILER

1.2 CAPABILITIES

PUB provides the usual capabilities of a simple text-justifier, including:

>Page numbering>Optional justification to the right margin>Centering of titles>Headlngs and footings>Control of Spacing and Indentation>Underlining

In addition, 1t features advanced documentationcapabilities, such as:

1.1 - 1.2

Page 7: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

INTRODUCTION SAILON-70Page 2

>Columnar output)Footnote placement>Macros>Index Generation>Table of contents generation>Cross-reference to a variable target)Automatic numbering of equations, tables, notes, etcSuperscripts and Subscripts>Mlcrof ilm Output

The command language 1s a dialect of SAIL Algol,providing the user with:

>Block structureConditional command executionConditional text inclusion>Arithmetic and String calculations>Embedded Source Files

1.3 OPERATION

The compiler is "two-pass". The first pass interpretsthe manuscript and outputs several Intermediate fileswith extensions ".PUG", ".PUZ", and ".PUI". Thesecond pass 1s a separate program automatically calledwhich makes one pass through the ".PUI" files andproduces the document. The ".PUG" and ".PUZ" filesare automatically deleted at the end of Pass One. The".PUI" files are read by Pass Two, then deleted(unless deletion 1s waived by a switch setting -- seebelow).

The first pass typically requires 48K of core and runsat the rate of 15 pages per minute. The second passneeds 18K and runs at 50 pages per minute. If thesystem should crash during Pass Two, and you wish torestart without rerunning Pass One, R PUB2. "R PUB2"also gives you an opportunity to specify a differentoutput device than originally requested.

You may run the document compiler with or without RPG.A manuscript file which is ".PUB" or a document fileextension which 1s ".DOC" need not be mentioned.Examples:

1.3

Page 8: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

SAILON-70 INTRODUCTION Page 3

13

command typed input file output file switches

.COM FOO FOO. PUB FOO. DOC

.COM FOO-BAZ BAZ.PUB FOO. DOC

.COM /PUB FOO.OOF-BAZ.ZAB BAZ.ZAB FOO. OOF

.COM /PUB FOO. OOF FOO. OOF FOO. DOC

.COM FOO(DN) FOO. PUB FOO. DOC /D /N

.R PUB*FOO/D/N FOO. PUB FOO. DOC /D /N

Do not specify more than one Input file nor more thanone output file. Multiple input files are handledusing the REQUIRE statement (see Section 7.11).

WARNING (RPG users): If 1n addition to file X.PUB youhave a file X.SAI (or X.FAI, etc.) and if you type"COM X", RPG will do a SAIL (or FAIL) compilation.SOLUTION: Type "COM X.PUB".

FURTHER WARNING (RPG users): If you have a file X.RELwhich is newer than X.PUB, then RPG won't do anycompilation. SOLUTION: Type "COM /COM X.PUB".

Presently available switches are:

nS

T. Terminal output planned (may produce differentoutput than /L)

V Yes! Automatically delete ".PUI" files after Pass2 (Default)

N No! Don't delete them (thus allowing Pass 2 to bere-run with a different DEVICE)

A Ask me whether to delete them when It's time.Z Compiler Debug: see compiler (PUB.SAI[2,TES])

iS Change intra-paragraph line spread: lS»SlngleSpace, 2S=Double Space, etc

B Big Document -- allocates hashed space for 3800identifiers instead of 1000

H Huge Document -r allocates maximum symbol tablespace (8191)

D DEBUG -- prints approximate source file linenumbers alongside the output

L Line Printer output planned (Default)M Microfilm output planned (produces FRBB command

file -- see Section 7.16)

Page 9: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 4 INTRODUCTION SAILON-70

14

1.4 COMPILER OUTPUT

During Pass one, whenever PUB reads a "Page Mark" orForm Feed, it types out the manuscript page number.During Pass Two, whenever PUB writes a Form Feed, ittypes out a count of the number of output pages sofar.

During Pass One, PUB also types out error messages.After each message, an arrow "(-») or a question mark(?) 1s typed out. You may then respond as in SAIL.If you are not familiar with SAIL, here 1s a summaryof responses:

Continue compiling after this error.Continue compiling, and after subsequent errors,

continue automatically.NOTE: The above two responses are not valid after "?"

Edit file <flle>.(RPG only) Edit the manuscript file.Start Over.

In DEBUG mode (the /D switch), some error messages arealso output in the right margin of the document.

Whenever PUB prints a line number in an error messageor in the right margin of the document, it is of theform:

<file idXline no.)/<page no.)[<macro line no.)/<macro page no.)]

If the line 1s from the manuscript, then <flle Id> 1sempty. If it is from another file (such as one ofthose ".PUG" files mentioned above), then <file Id> 1sthe first three letters of the first name of thatfile.

If the file is in SOS format, then the <llne no.) isalways five digits, Including leading zeroes 1fnecessary. If 1t 1s from a TECO or TVEDIT file, thenPUB generates line numbers 1, 2, 3, etc. withoutleading zeroes. If 1t 1s from a ".PUG" file, then the< line no.) is the line number/ page number of arelevant line in your manuscript or. 1n some othersource file.

If a macro was being expanded, the line number and

<CR><LF>

E<flleXCß>E<CR>S<CR>

Page 10: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

SAILON-70 INTRODUCTION Page 5

page number of its definition are noted within squarebrackets. The file that contained the definition isnot noted, so if can't find it in your manuscript, 1tprobably came from PUBSTD.DFS, the PUB standard macrofile, or from one of your REQUIRE files (see Section7.11).

Examples

02380/10 Manuscript file, page 10, line 2300 (SOS)1ND02300/10/1 INDEX. PUG file, page 1, comes from Manuscript 2300/18PUB2S/1 PUB Standard Macro File, Page 1, Line 25 (TVEDIT)

1.5 READING THIS MANUAL

This manual is ordered such that as soon as you havelearned enough of the system to solve your particularproblem, you can skip the rest of the manual. Read atleast through Section 2.3 before making any suchassumption.

In describing the syntax of PUB commands, thefollowing meta-lingulstic symbolism is employed:

<...> These brackets delimit the name of a syntacticentity

[...] These delimit optional components of the command. |... This character separates alternatives for the samecommand component

Cross-references in this document are always tosubsections. Subsection numbers are printed at thebottom of each page.

1.6 TUTORIAL FOR BEGINNERS

PUB 1s a string processing language. Characters canbe formed Into words, words Into lines, lines Intoparagraphs, paragraphs into columns, columns Into"areas" (such as the title areas at the top and bottomof the page),, areas Into pages, pages Into sections,

1.5 - 1.6

Page 11: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

SAILON-70Page 6 INTRODUCTION

PAGE

EVERY

16

sections into "portions" (such as the Table ofContents or the Appendices), and portions into adocument. The methods of bulding larger units fromsmaller ones are flexible and under control of theprogrammer.

The most trivial use of PUB is to create a documentthat is exactly identical to the manuscript, addingonly headings and footings. PUB assumes that theformat of each output page 1s as follows. The firstthree lines are a Heading area of which only the firstis usually used. The next 48 lines (lines 4 to 51)are the Text area. Line 52 is blank and line 53 is aFooting area. The Footing area 1s for page numbersand other reference information, not for footnotes.(Footnotes are placed Inside the Text area, towardsIts bottom) .The width of each page is assumed to be 69 characters.It 1s assumed that there is only one column of textoutput. Therefore, the longest an output line can beis 69 characters.

The number of lines in each area, the number ofcolumns of text, and the number of characters in eachcolumn may be changed by declaration. See Section6.7 and Section 7.13 for details. If all you wantto do is widen the page, e.g., to 75 characters, thenmake the following line the first of the manuscript:HIGH 75 WIDEFRAME 53

The "Dot" in column one indicates that this line 1s aCommand Line for PUB to obey and should not be printedin the document. If you would rather a differentcharacter 1n column one served for this purpose, seeSection 2.2.

PUB assumes that you want no headings and footings.It will leave the heading and footing areas blankunless you specify otherwise. The simplest way tospecify headings and footings is with the standardmacros "EVERY HEADING" and "EVERY FOOTING". Thesemacros can specify a title for the left edge, center,and right edge of the heading area and the footingarea. For example, the macro call:

HEADING( PRELIMINARY REPORT, PARACYBERNETIC PHENOMENA, I972)

Page 12: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

INTRODUCTION Page 7SAILON 78

EVERY

EVERY

NEXT

SKIP

GROUP

will print on the top line of every page the threetitles shown.

To make the top line of every page display the title"PRELIMINARY REPORT" on the left and the current dateon the right, use:

HEADING( PRELIMINARY REPORT, .{DATE})

The consecutive commas indicate that the center isempty. The curly brackets around the word DATEspecify that DATE is not a title to be printed butrather a variable to be evaluated.

To make the number of each page appear bottom center,use:

FOOTINGS {PAGE},)

To learn about fancier headings and footings, you willhave to read most of this document, especially Section7.5 and Section 10.2.

PUB will number your pages 1, 2, 3, etc. unless youdeclare otherwise. To learn how, see Section 6.11.A new page of output will be started for one of tworeasons: the previous page 1s full, or a page-changingcommand is executed. The most common page-changingcommand is:

PAGE

This always starts a new page, even 1f one was juststarted and nothing 1s on 1t yet.. To start a new pageonly if there 1s something on the current page, use:

TO COLUMN I

To leave a few blank lines in the document, useSKIP 10

The SKIP command 1s described 1n Section 7.12.

PUB processes text a paragraph at a time. The usualway to Indicate the end of a paragraph in yourmanuscript 1s by a blank line (that is, just a CR andLF). Oher ways are discussed elsewhere in thismanual, beginning at Section 2.3.

Usually, PUB packs a paragraph as tightly as possibleby filling up each output line with words before

1.6

Page 13: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 8 INTRODUCTION SAILON-70

INDENT 6

Fill, but don't

BEGIN NOJUST

END

beginning a new line. This is called "filling". ThenPUB inserts extra spaces between words to eliminate aragged right edge from the paragraph. This is called"justifying" .PUB will not indent the first line of paragraphsunless an Indent command appears in the manuscript,

9

To learn more about Indentation and related matters,see Section 6.4 through Section 6.7.

PUB assumes you would like your text lines filled outand justified. You can selectively exempt blocks ofyour manuscript from this fate. Each such block mustbe delimited by ".BEGIN" and ".END". After "BEGIN",specify a formatting mode to persist for the durationof the block. Examples:

Justify Don't even fill Copy verbatim

.BEGIN NOFILL .begin verbatim

.end".END

In "NOJUST" mode, lines will be filled but notJustified. In "NOFILL" and "VERBATIM" modes, theywill not even be filled. The difference betweenNOFILL and VERBATIM is that VERBATIM is both fasterand dumber. It 1s faster because it copies the linesof the manuscript to the document without looking atthem, except to see if there 1s a dot in column one.It 1s dumber because it does not recognize textcontrol characters that PUB normally recognizes, andit does not reformat in any way. Thus, VERBATIM 1sused to copy blocks of manuscript that are alreadyformatted perfectly.

Filling allows the manuscript to be quite ragged, agreat convenience 1n editing. Short lines arelengthened and long lines are shortened. Be carefulin NOFILL or VERBATIM mode that no manuscript line 1slonger than 69 characters (or whatever limit you havedeclared), or some of 1t will be lost and an errormessage given.

1.6

Page 14: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

SAILON-70 INTRODUCTION Page 9

1.7 SAMPLE COMPILATION

You now know enough to use PUB for simple purposes.The next three pages show a sample manuscript and thedocument that PUB produced from it.

1.7

Page 15: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 10 INTRODUCTION SAILON

.EVERY HEADING(DAN MATION, PARACYBERNETIC PHENOMENA, {DATE}).EVERY FOOTING(,{PAGE},).INDENT 6.BEGIN VERBATIM.GROUP SKIP 20

PARACYBERNETIC PHENOMENA

DAN MATION" END"NEXT PAGEIt has been observed that the Sigma 3 in Horsetown, Mass, and theCDC 6680 1n Liverless, Cal. tend to have parity errors at the sametime. When records were compared byMiss Minnie Messer, Director of the Horsetown Chamber of CommerceComputation Facility,and Mr. Solomon Crunch of Liverless Hospital's Organ-TransplantInventory Project, it was shown thatthe correlation of parity error occurrences was 0.8, withprobability of random coincidence of <. 00000801.

Miss Messer and Mr. Crunch revealed these discoveries at theUniversal Users Union meeting in Cranchville, Term. after theyarrived two hours late for Mr. Crunch's scheduled talk there.They said that in the excitement of discoverythe meeting slipped their minds.

This report has motivated this au.thor to undertakewider survey to determine if similar

phenomena have occurred elsewhere. The author hassolicited Miss Messer' s assistance in this survey,but without the cooperation of the entire computing community,it 1s unlikely that sufficientdatacan be collected. Therefore, we request that interestedparties tabulate the exact times of occurrence of parityerrors on their computer during the 7 day period1200 April 18 to 1200 April 25 and send it to:.BEGIN NOFILL

Paracybernetic Societyc/o Dan MationBoise Institute of TechnologyBoise, Idaho

.ENDResults of the study will be presented at the next UUU meetingin December.

Page 16: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

DAN MATION PARACYBERNETIC PHENOMENA January 15,1972

.

PARACYBERNETIC PHENOMENA

DAN MATION

" 1

Page 17: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

DAN MATION PARACYBERNETIC PHENOMENA January 15,1972

It has been observed that the Sigma 3 in Horsetown, Mass, andthe CDC 6600 in Liverless, Cal. tend to have parity errors at thesame time. When records were compared by Miss Minnie Messer,Director of the Horsetown Chamber of Commerce Computation Facility,and Mr. Solomon Crunch of Liverless Hospital* s Organ-TransplantInventory Project, it was shown that the correlation of parity erroroccurrences was 0.8, with a probability of random coincidence of<. 00000001.

Miss Messer and Mr. Crunch revealed these discoveries at theUniversal Users Union meeting in Cranchville, Term. after theyarrived two hours late for Mr. Crunch's scheduled talk there. Theysaid that in the excitement of discovery the meeting slipped theirminds.

This report has motivated this author to undertake a widersurvey to determine if similar phenomena have occurred elsewhere.Tho author has solicited Miss Messer' s assistance in this survey, butwithout the cooperation of the entire computing community, 1t 1sunlikely that sufficient data can be collected. Therefore, werequest that interested parties tabulate the exact times ofoccurrence of parity errors on their computer during the 7 day period1200 April. 18 to 1200 April 25 and send it to:

Paracybernetic Societyc/o Dan MationBoise Institute of TechnologyBoise, Idaho

Results of the study will be presented at the next UUU meetingin December.

2

Page 18: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

SAILON-70 PUB Page 13

SECTION 2

TEXT CONVENTIONS

2.1 ILLEGAL CHARACTERS

If the following characters occur 1n the manuscript,they may cause problems:

'177 RuboutAltmode"175

'13 Vertical Tab

These characters are ignored in the manuscript

'0 NullForm Feed (except after LF, where 1t is a page'14

mark)

A manuscript prepared using SOS or TVEDIT 1slegitimate if it has no vertical tabs. If 1t 1sprepared using TECO, be sure as well that every lineends with CR LF.*ITabs are expanded to the appropriate number of spaces,as 1n the line editor.

2.2 COMMAND AND TEXT LINES

Every line with a dot (".") 1n column 1 1s processedas a command line. Every other line 1s processed as atext line.

If you would prefer a different character to Introducecommand lines, e.g., $, use the command:

COMMAND CHARACTER

"$"

;

2.1 - 2.2

Page 19: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 14 TEXT CONVENTIONS SAILON-70

2.3

2.4

2.5

PARAGRAPHING

The text is processed in logical units called"paragraphs". A paragraph is the accumulation ofwords from one or more text lines, terminated, by theoccurrence of a paragraph break.

A paragraph break can be caused by the command BREAKas well as by several other commands. In addition, aparagraph break can be caused by signals in the text.

Paragraphing conventions can be varied by the use ofvarious mode and switch settings.

FILL MODE

In FILL mode, the compiler puts as many words asfit on each output line before beginning a new lineeach line is "filled" with words.

can

For convenience of exposition, names have been givento the parts of the output paragraph in FILL mode.The first line is called the crown, and the rest ofthe lines are called the vest. It is common to Indentthe crown and not the vest, or vice versa, or toIndent them different amounts. The last line of thevest is called the hem. While the other lines of theparagraph can be subject to justification, the hemline is never justified.

JUSTIFICATION

In FILL mode, whether or not output lines arejustified to the right margin 1s determined by thesetting of the "ADJUST-NOJUST" switch; but the hemline 1s never justified in any case.

2.3 - 2.5

Page 20: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

TEXT CONVENTIONS Page 15SAILON-70

2.6 BREAKING AT BLANK LINES

In FILL mode, a BREAK is caused by every blank line(just CR-LF). Redundant blank lines have no effect.To disable this response, see Section 10.1.

2.7 BREAKING AT TABS

Tabs are converted to an appropriate number of spacesby PUB. If you would like a single tab at thebeginning of a text line to cause a paragraph break,put this command at the beginning of your manuscript:. TABBREAK

This makes text lines that are indented exactly 8spaces cause a break. Since an initial TAB isconverted to 8 spaces, it will also break. Theinverse of TABBREAK is TABSPACE.

2.8 BREAKING AT CARRIAGE-RETURNS

In FILL mode, PUB usually converts every carriage-return at the end of a text line to a space. If 1t 1sat the end of a sentence, 1t converts the carriage-return to two spaces. If you would rather that everycarriage-return ending a text line caused a paragraphbreak, use this command:

.CRBREAK

The inverse of CRBREAK is CRSPACE.

2.9 NOFILL MODE

In NOFILL mode, one input line produces one outputline, even if it falls far short of the right margin;1f the line is too long, characters will be lost.Every carriage-return ending a text line in NOFILL

2.6 - 2.9

Page 21: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 16 TEXT CONVENTIONS SAILON-70

mode causes a paragraph break. The commands AOJUST,CRSPACE, and TABBREAK do not affect this mode.

NOFILL mode has several variations, which differmainly in the final treatment of the output line:

NOFILL: (Standard variation) No special treatment.

CENTER: Center the output line between the margins

FLUSH RIGHT: Shove it against the right margin

FLUSH LEFT: Shove it against the left margin.

JUSTJUST: Justify it by the Insertion of spaces

VERBATIM: Copy text lines to output exactly as written,without changingindentations. Ignore all control characters {at[#]&*p\3-eo*-.

Dot in column 1 still signals a command line.This mode speeds text processing

when no formatting is needed.

SUPERIMPOSE [n]: Suppress the LF after each line,except every nth line.

abcdefghi jklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ

2.10 HORIZONTAL SPACE COMPACTION

In COMPACT mode, redundant spaces in the Input lineare discarded. In RETAIN mode, theyIn RETAIN mode, theyare retained.

More precisely, 1n COMPACT mode, a sequence of two ormore spaces is reduced to one space, except at the endof a sentence, where it is only reduced to two spaces,and at the beginning of a text line, where all spacesare discarded. Of course, spaces may be re-insertedduring justification.

2.10

< t< l mc.nzI 1>?/U3.\--

Page 22: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

TEXT CONVENTIONS PageSAILON-70 17

2.11 VERTICAL GROUPING

In GROUP mode, all output lines are forced to appearin an unbroken column. Its inverse is APART mode. Ifthe bottom of the output page is encountered while inGROUP mode, the whole group is moved to the top of thenext column or page.

It is unwise to use GROUP mode for more than a fewlines that must appear undivided in the output.Example:

.GROUPEQUATION 6

m s vt.APART

This would prevent "Equation 6" from appearing at thebottom of one page and "m = vt" at the top of thenext.

2.12 MODE AND SWITCH SETTING COMMANDS

The commands that select the paragraphing mode areFILL, NOFILL, CENTER, FLUSH RIGHT, FLUSH LEFT,JUSTJUST, VERBATIM, and SUPERIMPOSE [n], where n[optional] 1s any "SAIL" expression.

The commands ADJUST and NOJUST set the FILL-modejustification switch. TABBREAK, TABSPACE, CRBREAK,and CRSPACE control the reaction to Initial tabs andto carriage-returns in FILL mode.

The commands RETAIN and COMPACT, GROUP and APARTselect the space compaction and column grouping modes.

At the outset of compilation, the settings in force

.FILL ADJUST' TABSPACE CRSPACE RETAIN APART

WARNING: Switching to NOFILL or to any of Itsvariations automatically switches to RETAIN mode.This can be overridden by following the command byCOMPACT.

2.11 - 2.12

Page 23: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 18 TEXT CONVENTIONS SAILON-70

%

."i'

2.13 WORD BREAKS

The compiler processes the Input paragraph 1n unitscalled words.' A "word" is roughly defined as asequence of consecutive visible characters. Moreprecisely, the compiler concatenates characters Into aword until the occurrence of a word break.

A word break 1s normally signalled by any of thefollowing in a text line:

>A space (or a sequence of spaces)>A carriage-return (the end of an input line)>The control character (3, if activated (as well as some others)

Word breaks serve two functions.

(1) FILLING: In generating an output paragraph, thecompiler puts as many words as can fit on each linebefore beginning a new line. The paragraph will onlybe divided for this purpose at word breaks.(2) JUSTIFYING: During justification, extra spaceswill only be Inserted at word breaks.

2.14 CONTROL FUNCTIONS

Several control functions can be Invoked by controlcharacters in the text line. The user can choose thecharacters he wishes to serve these functions. Forsimplicity of exposition, a suggested character hasbeen designated for each function.

The following control functions are available. If thedescription states: "BLA mode only", then 1n othermodes, the character is treated no differently than analphanumeric.

3 Cause a word (3reak.

Pretend the next character 1s alphanumeric (thislets you slip in control characters);

Same as a<space>; sneaks spaces Into words.

2.13 - 2.14*

Page 24: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

SAILON-70 TEXT CONVENTIONS Page 19

! ? FILL mode only, and only at the end of a word:marks the end of a sentence. This means:

(1) If followed by two or more spaces, COMPACTiononly reduces the spaces to two instead of one.

(2) If followed by a carriage-return, replaces theCR by two spaces instead of one. »

FILL mode only, and not the first character ofword: a hyphen. This means:

(1) If at the end of a line, prevents the wordbreak that usually occurs there.

(2) Otherwise, permits the word to be broken afterthe hyphen 1n case it overfills the output line.

\ TAB. Insert spaces up to the next tab stop set bythe TABS command (see Section 6.3).

MOVE RIGHT. Leave n spaces in the output line.6+n

8-n MOVE LEFT n characters. Create new characters(these due to Jerry Agin): »*00»

> ( - I V.

TAB. Insert spaces up to but not Including thenth character position from the left margin (flushleft 1s n=l). Both kinds of TAB (\ and 6n) Inhibitinsertion of all justification spaces to their left.

3n

For 8n and 3+n, n may be any "SAIL" expressionenclosed 1n parentheses. In the case of a singleletter variable or a one-digit number, the parenthesesmay be omitted. RESTRICTION... B(<expression>) maynot appear as the last thing on a text line.

Right Flush. If a \or 9n occurs later 1n theline, slide the text that 1s between here and thereflush against the column designated by the tab.

Otherwise,

slide the rest of this paragraph againstthe right margin, inhibiting justification.

Center. If a \ or 8n occurs later in the line,center the text that 1s between here and there halfwaybetween the current column and the column designatedby the tab. Otherwise, center the following textbetween the margins, inhibiting justification.

2.14

Page 25: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 20 TEXT CONVENTIONS SAILON-70

%

Repeat, 'x' is any character. If »x precedes \,3+, 9n, -», or «-, then use the character x instead of

»x

spaces as filler to the left of the affected text(i.e., «. \ puts up to the tab column).

coxooywz . . . Use the repeating string xyzxyz... as filler.

♦_..._» Underline. In the text between brackets, everyvisible character is underlined. " " is only a control

"character when paired with "«". If you want spacesunderlined as well 1n a title, simplyreplace each space by an underbar.

v underline one word. The following word(consisting of letters and digits only) 1s underlined.

IT trrint a wlerd character. The line printer and FR80 have these but your terminal doesn't.

To get Write(center dot) n.(gamma) nG or ng(apple delta) nd

T (integral) n~ (tilde)(plus-minus) rt-(circle plus) ir+

(Examples not present in PUB.TES[S,DOC])Switch to Command Processing. To return to text{

processing, use }. See Section 2.16

Subscript. The text x is (an extralowered a line

line is reserved for it). x may be any singlecharacter except "["or " ", or may be a sequence ofcharacters bracketed between [...]. A subscript mustappear all on one line.

tx Superscript. Analogous to Subscript, except x mayalso be the single character " ". Collectively,superscripts

and are called somescrlpts.subscripts

These may combine and nest in interesting ways.Super/subscripts may not nest more deeply than 4.

x&y Align. "&" 1s only considered a control characterif it 1s the first character following a somescrlpt x.

2.14

*x

Page 26: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

TEXT CONVENTIONS PageSAILON-70 21

Its effect is to align the leftmost characters of xand y by backspacing after printing x and beforeprinting y, and to align the rightmost characters byforward spacing to the end of the longer of x and ywhen done, x must be a somescript. y may be anysingle character except "[", "t", or ■*", or may beanother somescript, or may be any sequence ofcharacters enclosed between [...] . Examples:

To get. . .Write To get Write

J 2t &y*[l+j]&t[ 2]x xtj&.i y

i I+J

2.[ t]&[SUM]x x+ it2 SUM

. t

12xtlt23

x*x&3 x

2i

t.&t xt[lt2]t x

2.15 CONTROL CHARACTER ACTIVATION

At the outset of compilation, the only controlcharacters recognized are the punctuators ".", "!".,and "?" when they appear at the end of a word, andhyphen ("-") when 1t appears 1n the middle of a word.NOTE: Not even "{" 1s recognized unless you activateIt. However, "}" 1s permanently active, because 1t 1snot a text control character but really a commandlangauge delimiter.To turn on any control function using its suggestedcharacter ("a" for example), use the command:

.TURN ON "a"

To activate the control function using a differentcharacter, such as "%" or "0", write:

2.15

Page 27: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 22 TEXT CONVENTIONS SAILON-70

%

TURN ONTURN ON

TURN OFFTURN OFF

TURN ONTURN ON

TURN ON

"%" FOR "a""3" FOR "a"

To de-activate a control character, such as "?■ or"X", use:

v 711"%"

One TURN command may have several operands separatedby commas:

""." FOR "a", "8" FOR "«-", "-»», "\"nf 11 «|ii nri »Tn h n no

The latter may be abbreviated:"t .[]_&"

There is a subtle problem that arises when controlcharacters have been turned on inside a macro and themacro wants to turn off only the ones that weren't onpreviously. If it has done a TURN ON "t", forexample, it can not undo 1t with TURN OFF "t", forthat would always TURN it OFF whether or not 1t wasoriginally on. There are two ways to do it right.One 1s to use block structure (see Section 5.2), butsometimes this is Impossible, because blocks causeparagraph breaks. The other way 1s to use the commandTURN ON | OFF without arguments. Its effect is tocancel the previous TURN ON|OFF that had arguments,was in the current block, and has not yet beencancelled.

For purposes of smooth exposition, 1n the rest of thismanual it is assumed that you have turned on all thecontrol functions and used all the suggestedcharacters for them. Remember, though, that only thepunctuators are turned on unless you commandotherwise!

It 1s recommended that you don't turn on anycharacters except in short blocks where you knowyou'll remember they're on. Ideal places are Insidemacro bodies (See Section 3.1).

2.15

Page 28: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

TEXT CONVENTIONS Page 23SAILON-70

2.16 COMPUTED TEXT

The control character "{" will switch to commandprocessing right in the middle of a text line. Thisallows the execution of any PUB commands without firstcausing either a paragraph break or a word break. Ifyou want a word break before the {, force it by meansof a 3 or a space.

The command most commonly executed after "{" 1s theComputed Text Command. A variable, a constant, or aparenthesized expression occurring 1n isolation isevaluated and Its string value is then scanned by thetext scanner as text. Example:

A = {A}, and B = * {(2+2)} *If the value of A was the string "v3M , this wouldoutput:

A = 3, and B = 4.

Caution: If a {...} construct extends onto a secondInput line, be sure to begin the continuation linewith a "." -- or you won't be in the command scanner!

Caution: A string constant following the word BEGIN isconsidered a block name, as 1n SAIL, and not computedtext. If you put computed text after BEGIN, precede1t by a semicolon.

Note that a "}" (which can not be TURNed ON and OFF)switches to text processing from command processing atany time. This allows a Short Text Line to be putright into a command line:

.NOFILL }I am a short text Iine. {BREAK FILL

which is the compact equivalent of:

.NOFILLI am a short text line..FILL

To summarize, there are two ways to switch fromcommand to text processing:

2.16

4

Page 29: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 24 TEXT CONVENTIONS SAILON-70

%

>New line without "." in column 1»and two ways to switch from text processing to commandprocessing:

>New line with "." in column 1>{

#

\

2.16

Page 30: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

PUB Page 25SAILON-70

SECTION 3

MACROS

r

3.1 CALLING A MACRO FROM A COMMAND LINE

It is common to repeat an identical sequence ofcommands many times in a manuscript, e.g.,

.FILL ADJUST COMPACT TURN ON "9{ap"

You could define the following macro.MACRO FAC c FILL ADJUST COMPACT TURN ON "6{a(3" z>

and then whenever you want the whole sequenceexecuted, write simply:

.FAC

The body of the macro enclosed between c and a issubstituted for its name and then scanned by thecommand scanner.A macro may also have arguments

.MACRO T(CHR) c NOFILL TURN ON "CHR" o

which when called by

" T(o)

expands toNOFILL TURN ON "a"

3.2 CALLING A MACRO FROM A TEXT LINE

It is also common to repeat an awkward sequence ofcontrol characters many times in the manuscript, e.g.,

Xtl&i[j,k]

You could define the following macro.MACRO XIJK c"Xtl&*[j,k]N=

but to call it you must get to the command scanner{XIJK}

3.1 - 3.2

Page 31: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 26 MACROS SAILON-70

%

__

When the body is substituted for the name, thisbecomes a string constant inside curly brackets:

{"X.l&.[j,k]B }

so it 1s considered computed text and 1s scanned bythe text scanner, producing the output:

iXj,k

Again, parameters can be used.MACRO S(X,I,J,K) cHXti&.[j,k]"_>

If called by {X(l,j,k)} this would expand to the sameas above, but called by

{S(Y,t,tI,URG)}

it would expand to "YH&.[tI,URG]H which would outputt

VtI,URG

Some macros are declared for you in an automaticallyloaded file PUBSTD.DFS (see Section 7.5). Otheruseful macros are declared in a file PUBMAC.DFS thatyou can REQUIRE (see Section 7.11) to be loaded; theyare described 1n PUBMAC.TES[UP,DOC].

3.3 TEMPLATES

A "template" occurs as a part of several commands,including the macro declaration, and requires someexplanation. Its purpose is to store away a piece ofprogram for later, instead of immediate, execution.

The <piece of program) may Include other templates,and may span several lines. However, several rulesshould be followed:

(1) The template should begin and end on a commandline.

3.3

Syntax:c <plece of program) _>

Page 32: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

.Paga 27MACROSSAILON-70

(2) Every 3 or unpaired c or o must be preceded by3.

(3) People who change COMMAND CHARACTER in mid-manuscript, note: the character beginning commandlines within the template must be the one current atthe time of declaration -- not the one current whenyou invoke it later.

3.4 MACRO DECLARATION

Syntax: . sMACRO <name> [<formal parameters)] [;j (template;

The <name> may be one or two identifiers .The <formalparameters) if present, are 1n the following form.

( [«]<ldentifier> ..)'

Farh oarameter preceded by c 1s a value parameter, anda* ? r r« ar■srr^a«.sr?r,-sevaluated and the vaiue i» »«»Fv«rv other

sees? ;:r -? '"- .s-X -"'parameter is substituted unevaluated. Example.

.MACRO PLUG IN(X, cV) c "X — V" a

If "_! 8d ..1,'... . -n1 .'.-":

._

U?H_Ar.-. t^?r -h^ .... .._..:..%:. o"pr0"prtr.. > .--.:ru

---K.nrI,t 1 ,t,a .)

3.5 MACRO CALLS

A .aero can b. «»* {S"Sr^^7M3"line""Jas well .- insida curly brackTO « „10„ (s9e

o?".?.. fori, (form 2 H recorded):

aAn » "in which every " Inside 1sil) A ZlllTtT^^ It',usinappear all on one line.

(2) A string enclosed in 1 . . .1 j" wh ich no I appears. It

may span several command lines.

3.4 - 3.5

Page 33: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 28 MACROS SAILON-70

%

(3) A string not beginning with " or | and containing nocomma or right parenthesis. It must appear all onone line. Leading spaces are ignored

Thus, all the folowing are equivalent:

PLUG IN ("Peter Pauper", V)PLUG IN (| Peter Pauper |, V)PLUG IN ( Peter Pauper, V)"Peter Pauper — Henrietta"

3.6 OMISSIONS

Any actual parameter may be omitted; its value 1s thenNULL. Furthermore, if all parameters that follow itare also omitted, all their terminal commas may beomitted.

In a macro call -- but not in a macro declarationthe parentheses around the actual parameter list maybe omitted (both -- not just one). However, care mustbe taken if this 1s done. In particular, the commathat follows each parameter must appear on the sameline as the parameter. Also, the third form ofliteral parameter may not contain any of thefol lowing:, ) 3 ; } c crThis convention is useful for macros to generatesection headings; a typical call is

.SEC SPECIAL FEATURES

which is equivalent to.SEC( | SPECIAL FEATURES |)

and would presumably go to a new page, update thesection number, print the heading centered, and sendit to the Table of Contents for inclusion there. Howto do all this will unfold gradually.

3.6

Page 34: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 29MACROSSAILON-70

3.7 RECURSIVE MACROS

If a macro is declared "RECURSIVE MACRO .". thenwhen its call occurs 1n the FALSE part of aconditional, the compiler processes the actualpa^meiers 'as usual, but does notW.ndthjj.cr.body. Instead, the whole call is replaced by NULL.

For macros not declared RECURSIVE, their bodies areror macrus """ FALSE Dart of a conditional,expanded even in tne i-«i_ac y«i <" at.-_.mnts atThis prevents syntactic anoma les, but attempts at

recursion will, create infinite looping.

„_.-,.,. h_r__rs- If you call a RECURSIVE macroa? ..r

S

-Vco:-.t.-..1 1.--..-"', an mV .Ut-nt „t

intervene:.IF A<o THEN B ELSE C ; ; RECMAC(...) .

3.7

Page 35: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 30 PUB SAILON-70

SECTION 4

EXPRESSIONS

4.1 DATA TYPE

PUB has only one data type: String. A string consistsof zero or more ASCII characters.

Strings may participate 1n arithmetic operations. Thestring "764" is automatically converted to the Integer764 for this purpose. The result of the operation 1ssimilarly converted back to a string. Because of thisconvention, the data type Integer exists for allpractical purposes.

4.2 VARIABLES

Variables may be declared by the command:"VARIABLE A, BETA, C

This would make A, BETA, and C local to the Innermostblock in which the declaration occurred. Thevariables are of course type String.

Any variable that 1s assigned but not declared 1sautomatically Global.

All declared variables are Initlallized to NULL, thestring of length zero.

The name of a variable is an identifier. The firstcharacter of an identifier should be a letter Theletter may be followed by letters, digits, , and !.The Identifier is terminated by any other character.Including CR. Before looking up an Identlfer 1n itssymbol table, PUB changes all lower case letters toupper case and changes to ! .In syntactic descriptions in this manual, <Id> will

4.1 - 4.2

Page 36: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

EXPRESSIONS Page 31SAILON-70

denote any identifier, and <v> will denote a variablein particular.

4.3 AUTOMATICALLY DECLARED VARIABLES

Some variables are automatically declared for you by

the compiler, in a block outside your outermost bock.A few of these are read-only -- it 1s not possible toassign them a value by an assignment statement.

CHAR (read-only) The number of characters so farprinted on the current output line, not countingjustification spaces. This is sometimes an

LINE °Ver"ea!-Sniy) Value is zero If the "^.nt outputcolumn is empty. Otherwise, the sequential number ofthe last line output.

COLUMN (read-only) Value 1s zero If page Isempty. Otherwise the sequential number of the lastcolumn 1n which output went. .„„„_,. nMitinn.

CHARS (read-only) The number of character Positionsremaining to be filled on the current output I"..

LINES (read-only) The number of unused lines remaining

in the current output column.COLUMNS (read-only) The number of unused columns remaining

TOPLINE line number on this page thatstarts the current area, (see Section 0./).

FILLINGStaf rea3!onlJ) fALSE

M("0") If 1« " "TftL^od.. TRUE

1f in FILL mode - "1" 1f ADJUST -1 if NOJUST.NULL (read-only) The empty string ( ).TRUE (read-only) "-1"

SPREAD TnTtn^a-paragraph output line spacing. SPREAD-1

is single spacing, SPREAD-2 is double spacing, etc.

Its initial value is 1 unless otherwise specified in

INDENT!, INDENT2?SINDENT3°Pt Control paragraph Indentation (see

LMARG. RMARG^Tlie'lift and right margins (see Section 6.8)DATE Today's date, 1n the form October 16, io*o .

4.3

Page 37: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 32 EXPRESSIONS SAILON-70

32

TIME

FILE

PAGE

SKIP

FOOTSEP

Initial l ized from the system DATE UUO just before yourmanuscript is compiled. Also available individuallyare MONTH, DAY, and YEAR. To fully capitalize themonth or date, use the t operator described in Section4.4 (e.g., .MONTH).

The time your compilation began, 1n the form16:47 .

The first name of your manuscript file. Usefulfor headings.

The current page number, initially NULL. Don'tdeclare this LOCAL!(read-only) May be set by extreme substring

operators (see SAIL manual, 9-43). To examine theleft and right halves, examine SKIPL and SKIPR .

Before the first footnote (if any) 1n each column,a blank line is usually left. This 1s because FOOTSEPis initially NULL. If you assign it another value,then that string will be printed Instead.

4.4 SIMPLE EXPRESSIONS

Most of the SAIL <strlng expression) syntax has beenImplemented. Exceptions: function designators (butthere are macro calls); exponentiation; LOB, ILDB, andLOP; shifts and masks; LEAP operators.

PUB has three unary operators of Us own: "t"capitalizes. Its argument (only lower case letters andunderbar are affected). EVEN and ODD are predicateswhich tell whether the low order bit of the lastcharacter of a string is off or on. They are usedprimarily to distinguish left and right facing pages:

IF ODD PAGE THEN etc.P 8

All the available operators are listed 1n the tablebelow. If operator opl is listed above operator op2then opl 1s performed before op2.

Page 38: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

EXPRESSIONS

([+

)

ABS LENGTH t (this + and - are unary)

* DIV / MOD &EQV s XOR " (this + and - are binary)MIN

+MAXEVEN) <

ODDs. LEO * GEQ * NEQ

AV

NOTANDOR

The identifiers OR, LEO, etc. are not reserved wordsexcept in context. (The same holds for allidentifiers in the language except command names.)

Both division operators (/, DIV) are equivalentthey yield the truncated integer.

= and * compare strings character-by-character; <, >,etc. compare integers algebraically.

If neither TO nor FOR occurs in a substringspecification, FOR 1 is assumed. Note that:

4-5 GENERAL EXPRESSIONS

Assignment expressions and conditional expressions areallowed. If used alone to compute text, enclose themin parentheses, otherwise they will look to thecompiler like assignment statements or conditionalstatements, and the text processor won' t scan theirvalues.

In syntactic descriptions, <e> will denote a generalexpression - simple, assignment, or conditional,while <se> will denote a strictly simple expression.

4.5

SAILON-70 Page 33

7654[»] = 476 & 54 = 7654

Page 39: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 34 EXPRESSIONS SAILON-70

34

4.6 CONSTANTS

PUB recognizes three forms of constants: quoted,decimal, and octal. WARNING: CR will terminate anyform, so don't continue a quoted constant on a newline.

A quoted constant (<qc>) is a sequence of characterssurrounded by quotes ("..."). To include a quote inthe represented string, write two quotes ("") in theconstant.

A decimal constant (<dc)) 1s a sequence of decimaldigits.

An octal constant (<oc)) is an apostrophe (') followedby a sequence of octal digits. The value of the octalnumber is taken modulo 2dd and converted to a one8

character ASCII string. The following octal codes areillegal: '0, '11-'l5, '175, '177.

*

Page 40: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

PageSAILON-70 PUB 35

SECTION 5

STATEMENTS

5.1 STATEMENT TYPES

Syntactically, any command can be a statement(abbreviated <s> in this manual). There are twocategories of commands: declarative and Imperative. Adeclaration is limited 1n its scope by blockstructure, while an imperative isn't.

5.2 BLOCK

Syntax:BEGIN [<qc)] <s> ; ... END [<qc>]

The optional block name [<qc>] should be the same Inboth places. Mismatches will be flagged. MissingEND'S are calamitous to say the least!

Note that declarations don't have to be the firstthing in the block;. The scope of a declaration 1s theremainder of the Innermost block 1n which 1t occurs.

Both BEGIN and END cause a paragraph break. Neitherproduces output, not even a blank line.

The semicolons between statements may be omitted aslong as no ambiguity is presented thereby.

5.3 COMPOUND STATEMENT or CLUMPSyntax:

START [<qc>] <s> ; ... END [<qc>]

Declarations are' not local to clumps, and START andEND never break. Thus:

"IF TRUE THEN START FILL ; ADJUST END ;

5.1 - 5.3

Page 41: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 36 STATEMENTS SAILON-70

%

sets the modes FILL and ADJUST and leaves them setafter END. If BEGIN had been used Instead of START,the scope of the modes would have extended only toEND.

5.4 ONE PARAGRAPH SCOPE

Syntax:ONCE

The command ONCE breaks and begins a local scope whichis Implicitly terminated by the end of the nextparagraph. There must not be an END provided to matchit. If a BEGIN 1s encountered before a paragraphbreaks, then everything that has been declared in theONCE's scope is donated to the scope of the BEGIN* sblock and the ONCE is forgotten. Examples:

.ONCE FLUSH RIGHTGeorge

is equivalent to:

.BEGIN FLUSH RIGHTGeorge.END

and

"ONCE FILL.BEGIN NOJUSTHarry.END

1s equivalent to:

.BEGIN FILL NOJUSTHarry.END

You will find the ONCE construct useful 1n writingmacros and in formatting odd paragraphs here andthere. Note that ONCE is a complete statement, unlikeBEGIN, which introduces a statement that extends tothe matching END. Thus, you can say "IF X THEN ONCEELSE i-1+l" but you can't say "IF X THEN BEGIN ELSE1-1+1".

5.4

h

Page 42: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 37SAILON-70 PUB

SECTION 6

DECLARATIONS

6.1 SCOPE

... e„r.r.S.0 .nn.?..-* in which It occurred(see Section 5.2 through Section 5.4).

\

6.2 MODE DECLARATIONS

_"'. "'t.-ns* ...-.a»ara.r«""^«S, .n.- „_-"_.??.declarations cause ""«"» FIU all th, noFILLs,

I&_M_T 'SB--.' d ART Th. ones that don'tare: CRBREAK, CRSPACE, COMPACT and RETAIN.

6.3 TABS DECLARATION

...«_

enrted 1n algebraic ascendingThe expressions are sorted Jlnat*d# These thenorder and duplicates are 1^ character . Ifbecome the tab stops for the \ co

%^%you tab when the .^J!*;^*^ to the left of theare inserted but j^ l̂o^^ 11b, it InhibitedIZTy P °TaJ tl sistlScesh:re° measured from the left

margin.

6.1 - 6.3

4.

Syntax:TABS <e>,

Page 43: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 38 DECLARATIONS SAILON-70

%

/

6.4 INDENT DECLARATION

This command can change the values of three parametersthat control paragraph format: INDENTI, INDENT2, andINDENT3. They can also be changed directly byassignment statements. Every change is local to thecurrent block.

INDENTI and INDENT 2 specify indentationfrom the left margin.

INDENTI specifies the value of the crownindentation, which affects only thefirst line of output paragraphs.

INDENT2specifies the value of the vestindentation, which affects non-firstlines in FILL mode.

In NOFILL, SUPERIMPOSE, and JUSTJUSTmodes, INDENTI is observed, andINDENT 2is ignored. Old PUB usersnote: this is a change from previousconventions.

INDENT 3 specifies indentation from theright margin in FILL mode. It isignored in NOFILL modes, and in textaffected by the control characters»-,H f «*.!.

t

anc| ".„,»,

Lines 1n VERBATIM, FLUSH LEFT, CENTER,and FLUSH RIGHT modes are neverindented.

If any argument 1s omitted, thecorresponding parameter remainsunchanged.

6.4

Syntax:INDENT [<e>] [ ,<e)] [,<e>]

Page 44: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 39DECLARATIONSSAILON-70

11'

1

6.5 PREFACE DECLARATION

PREFACE N will cause every output paragraph to be

oreceded by an implicit SKIP N. There are actual ly

?wo Preface numbers maintained -- one for FILL mode

anS one f" NOFILL modes. The one you change by this

command depends on the current mode.

Initially, the FILL Preface is 1 and the NOFILLPreface is 0.

You may want to vary the Prefaces according to SPREAD,

e.g., PREFACE I+SPREAD .

6.6 DOUBLE SPACINGSyntax:

SINGLE SPACEDOUBLE SPACETRIPLE SPACE

These are standard macros that sete

SPREADntO

bl,

c 2; and

rest"^ 9SPREAD controls the spacing

Setween lines within a paragraph.

6.7 AREA DECLARATIONSyntax: rrn < >ri [CHAR[S] <e> [TO <c)]]

CTEXTITITLE] AREA <id) [LlNE[s] <e> [JO <">]] I"* I[IN <e> COLUMNS <e> WIDE I APART]

Each page is divided into AreasJ"^?^*for you as follows:

6.5 - 6.7

Syntax:PREFACE <e>

Page 45: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 40 DECLARATIONS SAILON-70

%

.AREA TEXT LINES 4 TO 51 ;

.TITLE AREA HEADING LINES 1 TO 3 ;

.TITLE AREA FOOTING LINE 53 ;

Each area is a rectangle thatmust lie within the bounds setby the last PAGE FRAMEStatement (see Section 7.13).If the CHARS clause of the AREAdeclaration should be omitted(as it 1s 1n the predeclaredareas), then the full width ofthe Page Frame is assumed.Similarly, 1f the LINES clauseshould be omitted, full pageheight 1s assumed.

An area is assumed to be a TEXTAREA unless "TITLE AREA" isstated explicitly. The onlydifference between a TEXT AREAand a TITLE AREA is the actiontaken when so many lines arewritten 1n it that itoverflows. In the case of aTEXT AREA overflow, all areasare "closed", the whole page iswritten out, and a new page is

begun. In the case of a TITLEAREA overflow, an error messageis issued.

An area has one column unlessan IN.. COLUMNS clause 1sincluded, e.g.,

.AREA LISTING LINES 30 TO. 50 IN 2 COLUMNS 7 APART

Either how WIDE each column isor how far APART they are canbe specified.

Associated with each area are aleft and right margin, locatedinitially at the left and rightedges of each column. How theycan be moved Inward and backout 1s explained In Section6.8.

The bottom line of a TEXT AREA 1s not used except toprint the last line of a paragraph. This conventionprevents the appearance of "widows" at the top of apage.

6.8 MARGIN CONTROL

Syntax:NARROW <se> [ ,<e>] paragraphs and statements) WIDEN

NARROW and WIDEN cause paragraph breaks. NARROW L,Rmoves the left and right margins of the current PLACEarea Inward L and R, respectively. Their Initialpositions are determined by the AREA declaration. Land R may be negative. If either 1s omitted, 1t is

6.8

i

y_ A

Page 46: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

II

SAILON-70 DECLARATIONS Page 41II

assumed 8. The matching WIDEN restores the margins totheir former positions. si

IAlternatively, you can have:<se> [ ,<e>] paragraphs and statements) NARROWWIDEN

*which moves the margins outward. Both kinds can nest.

These commands change the automatically declaredvariables LMARG and RMARG (the Left and RightMargins). They can also be changed directly byassignment statements; such changes are local to thecurrent block and to the current NARROW-WIDEN nest ofthe current PLACE area.

IUpon exit from a block, 1f the margin positions aredifferent than they were at the beginning, then theyare restored and instead of the usual Break, ENDcauses a CONTINUE (See Section 7.15), which treatsthe next line as a vest instead of a crown line. tEvery paragraph is output 1n the following format

( P blank lines)- A-l j j*.- ii --.The crown line of the paragraph.! || |, ii -.a vest line |«* 13 -*|I*. L -»| another vest line I |«* R -»lI the hem line. I I It t t t

A Left-margin Right-margin BThe format suggested by the diagram above may beachieved by the following declarations:

1.AREA TEXT CHARS A TO B

;

.NARROW L, R ;"FILL

;

PREFACE P ; INDENT 11, 12, 13 ;

iiThe automatically declared variable CHAR and all tabstops count characters from the left margin; they mayat times be negative. It is possible to produceoutput past the right margin by setting tab stops outthere.

ij

6.8

Page 47: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

T3' —

DECLARATIONS SAILON-70

%

6.9 PLACE DECLARATION

Syntax:PLACE <area id)

This breaks and switches output to the named area.This may be done many times on the same page; outputto each area always picks up where it left off.

If a column of the current Place Area overflows,output continues at the top of the next column. Whenthe last column overflows, either a new page is begun(if a TEXT AREA overflowed) or an error message 1sgiven (1f a TITLE AREA overfowed).

6.10 TEMPORARY AREAS

This section 1s complicated. Only read 1t 1f you needto create temporary areas within a page. To do this,you need to know where you're up to on the page sofar. If there's not enough room for the new area, youwill want to go to a new page. Then a temporary area(local to a block) should be declared, and text placedin It. Finally, you may need to find out where you'reup to on the page again before you exit that block,skip over the temporary area, and resume regularoutput.

1

A more convenient way to handle this may be availablein a future version of PUB in the form of a BOX FRAMEdeclaration. In the meantime, you should be able toget by as follows.

To determine the top line on the whole page that thecurrent PLACE area uses, look at TOPLINE. Within thatarea, lines are numbered starting from 1 -- but 1fTOPLINE 1s 6 that means "line 1" of the area is reallythe 6' th line on the page. We can distinguish P-lines(numbered relative to the whole page) from A-lines(numbered local to the area); A-Ilne 1 might be P-Ilne6.

To determine the column number and A-Ilne number ofthe last line output in this area, look at COLUMN and

6.9 - 6.10

1____

Page 42

Page 48: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

DECLARATIONS Page 43SAILON-70%

LINE. To determine how many empty columns remain inthis area, look at COLUMNS; for how many empty linesremain in this column, look, at LINES. Note thatLINE+LINES can be less than the full height of thearea, because a few lines at the bottom may beoccupied by footnotes. ,

To declare a two-column area 10 lines high for a tablestarting just below the last output line, write:

.IF LINES < 10 THEN NEXT PAGE ;

.BEGIN

.AREA AXE LINES TOPLINE+LINE TO TOPLINE+LINE+9 IN 2 COLUMNS 5 APART

.PLACE AXE<table text)

.END

.GROUP SKIP 10Adding TOPLINE in the AREA declaration 1s necessarybecause it expects P-line numbers.

1

t6.11 COUNTER DECLARATION

Syntax:COUNT <id> [INLINE] [FROM <e>] [TO <e>] [BY <e>] [IN <counter id)]

[PRINTING <e)|<template>]

This is PUB's excuse for a FOR statement. The usercan declare certain Identifiers to be counters, andarrange them in hierarchies. A counter is anythingyou want numbered sequentially. Typical counters areSECTION, APPENDIX, SUBSECTION, PAGE, FOOTNOTE,EQUATION, TABLE, FIGURE, NOTE, and REFERENCE. Acommon hierarchy is:

SECTION/ \

SUBSECTION PAGE

FOOTNOTE

The declarations for this hierarchy might be:

"COUNT SECTION FROM 1 TO 9" COUNT SUBSECTION FROM 1 TO 99 IN SECTION" COUNT PAGE FROM 1 TO 99 IN SECTION" COUNT FOOTNOTE INLINE FROM 1 TO 9 IN PAGE

6.11

i_

Page 49: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 44 DECLARATIONS SAILON-70

%

The "IN" clause specifies the hierarchlal parentcounter; it must have been previously declared.

The range of each counter is specified by the FROM,TO, and BY clauses; if omitted, FROM 1, TO 18, and BY1 are assumed. The counter need not ever attain theTO-value; it is just an upper limit used to determinethe maximum number of characters needed to print thecounter in case it is referred to in a Forward Cross-Reference (see Section 9.1).

The INLINE option suppresses a BREAK which isotherwise automatically generated before each steppingof the counter.

The PRINTING clause is explained in Section 7.3.

j-

6.11

i

Page 50: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

I!

ill'

■■}■

'4.

iii

PUB Page 45SAILON-70

SECTION 7

IMPERATIVESI

The commands 1n this section are non-declarative-.That means that their scope is not limited by blockstructure, an occasional exception to this rule 1sthe assignment statement; when the assigned variableis SPREAD, LMARG, RMARG, INDENTI, INDENT2, or INDENT3,then the change is local to the current block.

7.1 ASSIGNMENT STATEMENT !l

1Syntax:

Example: I.SPREAD «. T ♦" r - 4

Assignment statements don't break.

7.2 CONDITIONAL STATEMENT

Example:

"IF ODD PAGE OR LINES < 10 THEN STARTthis text line i."END ELSE STARTthat text line.END

"IF", "THEN", and "ELSE" don't break.

7.3 NEXT COUNTER VALUE STATEMENTSyntax:

NEXT <counter id)

7.1 - 7.3

<v> - <e>

Svn t_,dx *IF <e> THEN <s> ELSE <s>

Page 51: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

:T».

Page 46 IMPERATIVES SAILON-70

%

This breaks (unless INLINE appeared in the designatedcounter's COUNT declaration), and the counter isstepped to its next value. The first time 1t 1scalled, the counter's value 1s initialised.

Every COUNT declaration automatically declares twovariables with special properties, and Inltlalllzesthem to NULL. The first variable has the same name asthe <counter id), e.g., "SUBSECTION", and its value isalways the decimal integer value of the counter. Theother variable's name is constructed by appending an"!" to the <counter id), e.g., "SUBSECTION!". The twovariables are called the counting or "C-value" and theprinting or "P-value", respectively.

The precise effect, of the statement "NEXT U" 1n termsof these variables 1s as follows.

(1) If U=NULL, then U is set to the FROM value of theCOUNT declaration; otherwise, U 1s Incremented by theBY value of the COUNT declaration.(2) The P-value is computed under control of thePRINTING clause of the COUNT declaration (just howwill be explained shortly). In addition, the P-value1s assigned to the variable "!" as a convenientabbreviation.:..

(3) If the counter has hierarchically subordinatecounters, all their C-values and P-values are set toNULL; thus, when you say NEXT SECTION, SECTION becomesa new number while SUBSECTION, PAGE, and FOOTNOTEbecome NULL (assuming the hierarchy of the recentexample). Exception: If "PAGE" was one of thesubordinate counters, after it is cleared 1t isimmediately initialized.

The computation of the P-value depends on the PRINTINGclause of the COUNT declaration. There, are threecases.

Case One The PRINTING clause 1s omitted. P-value 1s the same as theC-value.

Case Two PRINTING <template>. After each C-value is computed, theexpression Inside the template 1s evaluated, and the resultis the P-value. Thus, the template should contain anexpression which involves the C-value. Examples:

7.3

i

Page 52: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

i■I

U

IPI'

1

SAILON-70 IMPERATIVES Page 47

.COUNT FOOTNOTE TO 9 IN PAGE PRINTING <="*********"[ 1 TO FOOTNOTED ;When FOOTNOTE=I, this sets FOOTNOTED*; when FOOTNOTE=S,this sets FOOTNOTE !=*****.

.COUNT SUBSECTION IN SECTION PRINTING cSECTION! &"." & SUBSECTION:. ;When SECTION! =4 and SUBSECTION is counted to 7, SUBSECTION!becomes 4.7 .

Case ThreePRINTING <e>. The expression 1s evaluated only once, atdeclaration time, and its value serves as a pattern forconversion of the C-value to the P-value. For example, thepattern "(i)" will produce P-values such as (1v) and(xlii), and the pattern "!-A" will produce P-values such as6-A and 33-L. The pattern should evaluate to a string ofthe form:

<prefix> [ ! <middle> ] <format> <suffix>where- <preflx>, .middle), and <sufflx> may be empty, and<format> must be 1, a, A, i, or I. This is roughlyequivalent to the template:

c<prefix>& ! &<middle>& CONVERT(<counter Id),<format>) &<sufflx>_>

Here's what happens. The P-value becomes this patternafter substituting the parent counter's P-value for ■!■ (ifpresent) and after converting the C-value to the specifiedformat and substituting it for <format>. Before explaining

formats,

let's give a simple example:

.COUNT SUBSECTION IN SECTION PRINTING "1.1" ;Here, <preflx> and <suffix) are empty and <mlddle) 1s ".".Format "1" 1s no-conversion, so the C-value is substitutedunchanged for the "1". The P-value of SECTION 1ssubstituted for the "!". Say SECTION! 1s 6 and SUBSECTIONis stepped to 4; then SUBSECTION! becomes 6.4 .The various <format) conversions are:

1 No conversionI Upper case Roman, 1.c., 59 -» LIXi Lower case RomanA Capital letters A, .. .Z.AA.88, .. .ZZ.AAA, .. .a Little letters

7.4 NEXT PAGE STATEMENT

This variety of Next Statement has special properties.Before stepping the PAGE counter, it "closes" and

7.4

i

Page 53: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

■jr~.

Page 48 IMPERATIVES SAILON-70

%

outputs all the areas on the current page and sets upa fresh page frame.

Conversely, when a page 1s closed due to text areaoverflow or "SKIP TO COLUMN 1", etc., the page counteris automatically stepped before the new page isopened, as if the command NEXT PAGE had been given.

7.5 HEADINGS AND FOOTINGS

As soon as the first line is ready to be placed 1n apage, the page is "opened". There are fancy ways youcan create fancy headings and footings at that or atother times (see Section 10.2). For simple cases,the following command (which is actually a call to abuilt-in macro) is provided.

Syntax:.EVEN I OOO I EVERY HEADING| FOOTING ( <text>, <text), <text) )

On left-facing (EVEN), on right-facing (ODD), or onall pages (EVERY); on the top line (HEADING) or thebottom line (FOOTING); the three <text)s will beprinted at the left edge, the center, and the rightedge of the page, respectively. A <text) may notcontain quote ("). Example:

"ODD HEADING({DATE}, MACHINES THAT WONDER, {SUBSECTION!})

This would cause to print on the top line of everyright-facing page something like:

July 14, 1789 MACHINES THAT WONDER VII. 111

7.6 SECTIONING

The correct way to start every new section on a newpage is:

.NEXT PAGE ; NEXT SECTION ;

If the order of these were reversed and if SECTIONwere the parent of PAGE, then NEXT SECTION wouldchange PAGE'S value before the old page got writtenout.

7.5 - 7.6

Page 54: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

SAILON-70 IMPERATIVES Page 49

i.

..

:|

l

_I

7.7 COMMAND CHARACTER STATEMENT

The parameter must evaluate to a single characterstring. That character subsequently assumes thefunction of dot in column 1. Since this command 1snot a declaration, its scope is global; I.c, 1t 1s notaffected by block nesting. Don't omit the semicolon!

7.8 PORTION DEMARCATION

Syntax:PORTION <id>

The manuscript may be (ought to be) divided IntoPortions, such as TITLEPAGE, CONTENTS, THESIS,APPENDICES, NOTES, INDEX, and BIBLIOGRAPHY.

Precede each portion by a Portion Demarcation, e.g.,.PORTION NOTES

The compiler will assure that each portion starts onfresh page and ends with a paragraph break.

In general, the order of appearance of the portions 1nthe manuscript becomes their order of appearance inthe document. However, this 1s not always convenient.For example, the entries for PORTION CONTENTS areusually generated during the processing of the otherportions (see Section 7.9); therefore, PORTIONCONTENTS must appear at the end of the manuscript. Toshow where you would like its output to be Inserted 1nthe document, use the statement:

which is sort of a "forward portion demarcation".Example:

7.7 - 7.8

Syntax:COMMAND CHARACTER <qc)|<v> ;

.INSERT <Id>,

Page 55: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

-rrr

IMPERATIVES SAILON-70Page 50

%

.PORTION TITLEPAGE

.INSERT CONTENTS. COMMENT This is where the table of contents should be printed;

.PORTION THESIS

.COUNT PAGE ; COMMENT Before NEXT SECTION starts a new page;

.NEXT SECTION

.PORTION INDEX

.COUNT PAGE PRINTING "i"; COMMENT Before PORTION starts new page;

.PORTION CONTENTSCOMMENT This is where the table of contents 1s defined ;

7.9 SEND STATEMENT

Syntax:SEND <portion id) [;] <template)

1s associated a file called Itsgenerated file is in manuscriptis that you can avoid manual

With every portiongenerated file. Aformat. The idea

i

preparation of certain portions of your manuscript(such as the table of contents and the index) bymaking PUB prepare them mechanically.itThe generated file of a portion may remain empty, ormay be written on during the processing of portionsthat appear earlier 1n the manuscript. For example,the generated files for PORTION CONTENTS and PORTIONINDEX are usually generated during the processing ofearlier portions.

The SEND statement writes a template onto the end ofthe generated file for the named portion. The portionmust appear later 1n the manuscript. Before sendingthe template, the compiler substitutes for everyoccurrence of:

the (unquoted) value of the variable <v)

Thus, if S=6 and PAGE«26, then the statement:

7.9

{ <v> }

Page 56: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

IMPERATIVES Page 51SAILON-70

"SEND CONTENTS cSection {S} -- Findings ».-» {PAGE}

l" 3 ;would send the following data to the file associatedwith PORTION CONTENTS (CRLF shown here for clarity):

If a similar SEND were performed at the beginning ofevery section and subsection of the manuscript, thenby the time the compiler reached PORTION CONTENTS, itsgenerated file would be in perfect manuscript format,

9

Section 1 -- Introduction ».-» 1

Section 2 -- Remarks <».-» 6

The empty command lines are of course harmless; theirinclusion was caused by the method of conforming withone of the rules of writing templates: a template mustend on a command line. Of course, a templatealternativelycould end with a text line terminated byn

/

h

The subtleties of generated files are discussed 1n theAppendices to this manual. If you would ratherpostpone becoming an expert on the technique, you canstm obtain a table of contents and index by the useof someone else's macros. These macros (STANDARDFRONT and STANDARD BACK) are stored in filePUBMAC.DFS[I,3] and described 1n filePUBMAC.TES[UP,DOC].

7.9

<CRLF>Section 6 -- Findings ».-» 26<CRLF>

(etcetera)Section 6 -- Extraneous Factors «.-" 26

(etcetera)Section 413 -- Conclusions ».-» 864

Page 57: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

4

Page 52 IMPERATIVES SAILON-70

7.10 RECEIVE STATEMENT

This statement substitutes the generated file of thecurrent portion for the statement and causes thecompiler to compile it. Thus, PORTION CONTENTStypically consists of a few mode setting commands, atitle, and then the statement "RECEIVE".

If the optional parameter is present, it shouldevaluate to a string of one or two characters, say "L"or "LR". The presence of the parameter causes thegenerated file to be alphabetized before it 1scompiled. Entries in the file should be in the form

<0 or more characters) L <Key> [R <0 or more characters)]

PUB will alphabetize the entries by the <Key)s usingthe ASCII collating sequence, except lower caseletters and " " are ranked with the correspondingupper case letters and "!". Then 1t will read thealphabetized file, including the L and R characters.

I

i

WARNING: The characters L and R must be chosencarefully. They may not occur in the generated filein any role except as key delimiters. Furthermore,the characters "[", "]", "9" may not be used. It 1slegal for L and R to be the same character.

l

If your Index is very large, PUB may exhaust SAILstring space trying to alphabetize it. The errormessage "STRING SPACE EXHAUSTED" will be typed out.Unfortunately, the only way to get more string spaceis to REEenter the program and go through the ALLOCritual (see SAIL manual 14-22). The originalallocation 1s presently 4000 words; try 7800 or 10000.

I

To generate a . simple index, use SEND statements such

.SEND INDEX ; c3Keyword <»."* {PAGE}" a ;

and the RECEIVE statement:.RECEIVE "3»"

7.10

*

Syntax:RECEIVE [<qc)|<v>]

Page 58: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

IMPERATIVES Page 53SAILON-70

I

t

Keyshmurd 9Keyword 15

7.11 REQUIRE STATEMENT

7.12 SKIP STATEMENTSSyntax:

[GROUP] SKIP [<se>]SKIP TO LINE <c)SKIP TO COLUMN <e>

7.11 - 7.12

The file generated will be quite funny-looking, butwill result in the document:

Rather than all those hideous dots, it is suggestedthat the number immediately follow or precede theword.

To learn how to create two-level and KWIC Indexes, seeAppendix A.3.

The parameter must evaluate to a file name, e.g.,"BRAIN BAZ[H,AHA] M . The file must be 1n manuscriptformat' It will be substituted for the REQUIREstatement and compiled. If the last line of the fileis a text line, PUB will still be scanning for textwhen it resumes the original file, so don't put asemicolon after the REQUIRE statement -- put a CR.

REQUIREd files may REQUIRE other files. You will runout of channels 1f the number of open SOURCE FILEs,generated files (extension ".PUG") and pass one outputfiles (extension ".PUI") exceeds 15.

Syntax:REQUIRE <qc)|<v> SOURCE FILE

Page 59: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 54 IMPERATIVES SAILON-70

fhi

:|

M

!I

SKIP N breaks and leaves N blank lines 1n thedocument. If N is omitted, SKIP 1 is assumed. Notethat N must be a simple expression -- no assignment orconditional expression 1s allowed unless it 1sparenthesized.

Blank lines that would appear at the top of any columnare automatically suppressed; if you want to forcethem to appear (say, to leave space for a drawing),use GROUP SKIP.

If you are going to run off the same document withdifferent values of SPREAD (i.e., sometimes singlespace and sometimes double space), you should writeall your KIP statements with this factor taken Intoaccount, e.g., SKIP 2*SPREAD-1 .SKIP TO LINE N outputs blank lines up to but notincluding the Nt h line (A-line) in the current columnof output text, unless the Nth line has already beenpassed, in which case it goes to the Nth line in thenext column. The most common use of this statement 1sSKIP TO LINE 1, which assures you are at the top of aclean column.

SKIP TO COLUMN N outputs blank lines until 1t reachesthe top of the Nth column of this or the next page.If the compiler 1s already at the top of the Nthcolumn, this statement does nothing. The most commonuse 1s SKIP TO COLUMN 1, which goes to a new pageunless a new page has just been begun. (To go to anew page regardless, use "NEXT PAGE" -- See Section7.3).

7.12

*

Page 60: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 55IMPERATIVESSAILON-70

7.13 PAGE FRAME STATEMENT

Syntax:PAGE FRAME <e> HIGH <e> WIDE

This statement causes a break, goes to a new page, andsets up its size as specified (number of lines, numberof characters). No output can appear outside thebounds set by this statement. Area declarationsnormally follow It.

7.14 BREAK STATEMENT

Syntax:BREAK

If a paragraph has been started, BREAK terminates It.Breaks are Implicitly caused by many other commandsand conditions.

7.15 CONTINUE STATEMENTSyntax:

CONTINUE

Sometimes you would like to insert an IndentedQuotation or equation in the middle of a paragraph ofprose. After the quotation, a paragraph break 1snecessary to terminate it.

Unfortunately, the break also causes thenext output line to be treated as a crownline (in FILL mode). If you would rathercontinue the interrupted paragraph thanstart a new one, use the command CONTINUE.

Tt breaks, but causes the next paragraph to have nocrown as long as no regular breaks intervene.

7.16 DEVICE STATEMENTSyntax:

DEVICE LPT|MIC|TTY

Page 61: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 56 IMPERATIVES SAILON-70

%

This statement is equivalent to setting the /L, /M, or/T switch when starting up PUB. It has no effect onPass One output. However, Pass Two reacts to theswitch setting as follows.;»

DEVICE MIC makes the document file be in FR-80 commandformat. Pass Two will output two temporary files withextension ".RPG" and automatically run a programcalled "TXTFBO", written by Russ Taylor, whichgenerates .the document file. Simply copy this file toa tape and bring- it to the FR-80 operator at Lockheed.

DEVICE LPT and DEVICE TTY produce identical outputunless the page frame is higher than 53 lines. Inthat case, DEVICE LPT uses strange control charactersInstead of line feeds to inhibit page-ejection.DEVICE TTY assures that only line feeds are issued.

Files produced under DEVICE TTY can be edited withTECO. Hardly any document file can be edited with SOSor TVEDIT, which don't like CR's without LF's (usedfor underlining and superimposing).

7.17 UNIMPLEMENTED STATEMENTS

The following commands have not been Implemented, butought to be, so their names are reserved words:

CASE statement -- SAIL-styleALIGN statement -- 1t would align output to side-by-slde areasPACK statement -- it would align the bottoms of parallel columnsBOX FRAME STATEMENT -- to Insert a table in a corner of the pageLOCK statement -- to protect lines from being moved by a BOX FRAMESHOW statement -- to output to the console during compilationNOPRINT mode -- would suppress output

!ii .

PRINT mode — would renew output

LDX output will soon be available. This will requirea few new commands and automatically declaredvariables, probably the following:

7.17

_

Page 62: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

.1

DEVICE LDX

..,.*♦

FONT <font-name> ON <file-name) -- would declare a fontRASTER <e> UNITS PER INCH -- to specify raster densityBELOW, ABOVE, ONLEFT.ONRIGHT -- like LINES,LINE, CHAR, CHARSCHARACTER <name> <font-name> Coordinates) -- define character

?

#

ii

7.17

IMPERATIVES Page 57SAILON-70

Page 63: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

■f—

PUB SAILON-70Page 58

if

"};

f

i

%

SECTION 8

COMMENTS

There are two ways to get comments into a command line-- not in the middle of an identifier or constant,however .

Syntax:COMMENT anything but semicolon ;

This one is probably familiar. The other one is:<< anything but two greater-than-signs in a row »

Comments may extend over several command lines. Ifyou leave out the terminator, you'll lose everythingup to the next text line.

Comments have no effect on the document. Why wouldyou want them? Maybe you could write English commentson a French manuscript to help you find your wayaround. Or maybe you've got complicated macros thatneed explanation. Or you left out a bunch of text andwant to leave a reminder in the manuscript. Don't askme why — I just implemented them.

To get a comment into a text line, use curly bracketsaround a regular comment {<< Like this >>}.Continuation lines must be command lines.

Page 64: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

l\

Page 59PUBSAILON-70

SECTION 9

LABELS AND CROSS-REFERENCES

9.1 CROSS-REFERENCES

A cross-reference is like computed text in that itcauses characters to be processed by the text scanner,and in that it normally appears between curly bracketsin the midst of a text line. First there will be anexample, and then an explanation,

invented by Owsley (See {"Page!" PURE}) ...This might produce output such as:

invented by Owsley (See Page 3-7) ...The identifier PURE is called a label and must bedefined once and only once in the manuscript, eitherbefore or after the cross-reference. Every label hasa value, much like a variable, but the value 1sassigned only once, at the place the label is defined.Several cross-reference statements may reference thesame label. Labels wlllbe explained further 1nSection 9.2.

There is a major problem 1n handling forward-references in a text-justifier. The justifier mustknow how many characters there will be in the valuebefore it can decide where to break off the output

line and how many spaces to insert during

iustificatlon.. PUB solves this problem by twoslightly awkward hacks. One hack is that you muststate or imply an upper limit on the number ofcharacters, so it can leave enough room for 1t and notbreak off the line too soon. The other hack 1s thatPUB has two passes. In the second pass, the actualvalues are substituted, and only then are linesjustified.

To "state or imply" the upper limit, you have a choiceof three forms of cross-reference.

Form 1: [ <c) ] <label Id>

9.1

J_

Page 65: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

*

1

..'

LABELS AND CROSS-REFERENCESPage 60

Those are really square brackets!!!! Write them inthe manuscript, really! The expression evaluates to anumber which is the maximum number of characters, andthe value printed 1s the value of the label <labelid). If this is a backward reference (unless to thecurrent page), the number is ignored, so you can sayjust: {[] <label id)}. You can't just say the labelname.

I

Form 2: <counter id>[!] <label id)Those square Brackets mean the "!" is optional --don't write them in the manuscript! This form meansthat the value of the label will be the C-value (1fthere 1s no "!") or P-value (if there is an "!") ofthe counter <counter id). PUB can compute the upperlimit at declaration time by looking at the TO clauseof the counter's COUNT declaration and at the PRINTINGclause, so you don't have to state it. In case thePRINTING clause used a template, the upper limit 1sdetermined by a not quite foolproof heuristic:suitably large numbers are substituted temporarily forthe C-value of the counter, for both values of itsparent, and for !, and the expression 1s evaluated.

1

Form 3: "<counter id>[!]" <label id)This is identical to form 2, except before sending thevalue of the label to the text scanner, it sends thestring (without the "!") and a space. Thus, thefollowing are exactly equivalent:

See Section {Section! X}See {"Section!" X} . . .

The macro used for cross-references in this manualwas:

.MACRO YON(LBL) c "Section " ; SUBSECTION! LBL oI!which was called like this:

lots of useless words (See {yon someplace}). Lots more

1 9.2 LABELS

The syntax of .label definition) and <label deflner)

are defined (::») as:Syntax:

9.2

SAILON-70

Page 66: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

LABELS AND CROSS-REFERENCES Page 61SAILON-70

<label definition) ::= <label id) : <label definer)

<label definer) ::= [NEXT] .counter id>[ ! ] I <e> I <textline>

Here is an example of each kind of <label definer):

.INTRO: NEXT SECTION

.LAPLACE: IF ODD PAGE THEN PAGE ELSE PAGE+I

ThlS^thlf.ln. that is labelled by the label "EXPLANATION"

The first kind of definer makes the value of the labelbe the current C-value (if there 1s no "!") or P-value(if there is an "!") of the named counter. If NEXT 1spresent, the counter 1s stepped before the assignmentIs made. The second kind makes the value of the labelbe the value of the expression. The third kind makesit be the value of PAGE! for the page that the <textline) begins on.

The first and third kinds of definer both cause aconsistency check between all forward-references tothis label that mention a counter name and the counternamed here. The second kind does not cause aconsistency check. CAUTION: There 1s no consistencycheck on backward-references. There is no check whena cross-reference specifies a P-value (or C-value)that the label definition also specifies a P-value (orC-value). So 1f the output 1s Incorrect, check forsuch Inconsistencies yourself.

}

A label must always be on a command line, or Insidecurly brackets on a text line. If the /D switch wasused to obtain debugging information, then the labelwill be printed on the right side of the document.

There is a slight ambiguity 1f your <label definer)

nvo lves PAGE (or PAGE!). If you use the first orthird kind of definer, the evaluation 1s deferreduntil the next text line is output, i.e., until thenext paragraph break or overflowed FILL Una. Thus,you Say think of a PAGE label as labelling thefollowing text line; even 1f a new page is begun

before that line is output, the label value will bethe Dage on which that line appears. On the otherhand if you use the second kind of definer (1.c., an

9.2

L

Page 67: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

1

LABELS AND CROSS-REFERENCESPage 62

%

expression involving PAGE or PAGE!), the value usedwill be the current one at the time of evaluation --even if the following text line doesn't get outputuntil the next page.

it

Note that L:NEXT PAGE will go to a new page and thenassign L a value when the first line 1s output to thatpage. If the page is blank, the assignment isdeferred another page. All this kludgery 1s to insurethat if you say: See {"Page" X} there will really besomething to see! Be sure to position the label justbefore the text line you want them to see.

SAILON-70

Page 68: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 63PUBSAILON-70

SECTION 18

RESPONSES

?

10.1 TEXT RESPONSES

A Text Response enables you to detect certainconditions in the text, and to call macro-likesubroutines without using {...}. Presently, fourconditions can be responded to:

(1) Page Mark or Form Feed(2) Blank Text .Line(3) Indented Text Line ■

(4) Presence of a one-to-five character signal

SvntBX *

AT Condition) [;] .template)

When the condition is detected, the characters causingit are replaced by:

which is immediately executed.

To dls-declare a response exit the block 1n which 1twas declared, or use a null template:

AT Condition) [;] "The various <condltlon)s available are as follows:

AT PAGEMARK responds to an SOS page mark or a TECO<CR LF FF>. A typical use 1s:

.AT PAGEMARK cSKIP TO COLUMN 1=

AT NULL responds to a blank text line. There 1soredeclared response for this:

.AT NULL cIF FILLING THEN BREAK ELSE SKIP 1=

This is the only reason that blank lines break 1n FILLmode. You can redeclare 1t to treat them otherwise.If you want them ignored, write:

.AT NULL cIF NOT FILLING THEN SKIP 1=

10.1

{ <template> }

Page 69: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 64 RESPONSES SAILON-70

J

II

-4ill

il

%

AT N, where N is a positive integer N, responds toeach text line indented exactly N spaces. Forexample, the standard macro TABBREAK declares:

.AT 8 cIF FILLING THEN BREAK ELSE " "=AT S, where S 1s a string beginning with a non-alphanumeric character, responds to the occurrence ofthat string (up to 5 characters long) appearinguninterrupted in a text line. This one Condition)can be followed by a formal parameter 11st of up tofive arguments, e.g

Each parameter name 1s followed by a string containinga single character called its delimiter. When thesignal (1n the example, XX) 1s spotted in a text line,the compiler continues to scan for actual parameters,terminating each scan at the appropriate delimiter.An actual parameter may span several text lines, buteach carriage-return 1s converted to a space 1f thishappens. No parameters may be omitted. None areevaluated -- they are all literal.

10.2 TRANSITION RESPONSES

A transition response permits the specification of anaction to be taken at the beginning or end of anycounter or at the opening or closing of any area.

Syntax:BEFORE | AFTER Counter id)|<area id) [;] <template)

Here 1s how this response fits Into the NEXT Counter)algorithm. To execute NEXT SECTION, PUB performs sixsteps:

1) If SECTION-iNULL then do AFTER SECTION response (if any)2) Step SECTION using FROM and BY values3) Compute SECTION! using PRINTING clause, and assign it to !4) Do BEFORE SECTION response (1f any)5) For each sub-counter of SECTION, and each of their sub-counters:

a) If C-valuenNULL: AFTER sub-counter response (1f any)b) Clear sub-counter C-value and P-value to NULLc) If it 1s PAGE, inltlallllze PAGE and PAGE!

6) Re-assign SECTION! to ! (steps 4 and 5 may have changed it)

10.2

.AT "XX" A

"$"

B "X" C

"$"

c SEND INDEX c}A B-C{BREAK _> _>

Page 70: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 65SAILON-70 RESPONSES

The END of the block in which any counter is declared(except PAGE) also causes Step 1 to occur.

The most useful transition responses are BEFORE PAGEand AFTER PAGE. The BEFORE PAGE template is executednot immediately after NEXT PAGE is executed, but, alittle later, when the first line of output is readyto be put on the new page. BEFORE <area id) responsesare similarly deferred until the first output 1s readyfor the named area. The AFTER PAGE template 1sexecuted just before the page 1s written out -- 1t hadbetter not place into a text area that is alreadyfull!

One transition response is pre-declared for youSTANDARD TITLES aBEFORE PAGE c

STANDARD TITLES is a pre-declared macro that printsthe headings and footings set up by EVERY HEADING andits friends. You can of course redeclare thisresponse.

Every transition response template is automatically ablock. It is surrounded by BEGIN ! ?03 ... END ! ?®3 orsomething of that sort (which you will occasionallyspot in error messages). It is usually necessary todeclare all the mode settings and formats you want tobe in force inside the < temp late). Consider the caseof BEFORE PAGE. At the time that a page happens tooverflow, it is entirely possible that the compiler isin the midst of a FILL block with INDENT 10,20, allcontrol characters off, and the NOFILL PREFACE set to2. However, the headings and footings should beprocessed in NOFILL mode with preface 0, noindentation, and several control characters activated.You might declare:

.BEFORE PAGE c NOFILL ; INDENT 0 ; PREFACE 0 ; TURN ON »{~"

.PLACE HEADING ,_.„«/.»"n{DATE}~AUTOMATIC VETERINARIAN*{SECTION! }

-{SUBTITLE!}.PLACE FOOTING{IF ODD PAGE THEN "-"}{PAGE!}.3

10.2

Page 71: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 66 PUB SAILON-70

}

Ii

fSi

ilii

i

"

j

il

SECTION 11

FOOTNOTES

Every column of every area has two portions, the calfand the foot. During preparation of the calf,paragraphs can be sent to the foot. A column 1sconsidered full when the sum of the lines in the calfand the foot exceeds the height of the area.

You can not declare Portion FOOT nor do a RECEIVE forit. The compiler automatically declares a FOOT foreach area you declare, and does a RECEIVE for 1t aftereach line is placed in the calf. Your only footholdis the command "SEND FOOT".

Example:

"COUNT FOOTNOTE INLINE IN PAGE PRINTING "(1)".AT "ss" ENTRY "*" c NEXT FOOTNOTE ; ! ;.SEND FOOT c TURN ON "{" PREFACE 1 SPREAD- 1 INDENT 0,0{!} ENTRY"BREAK a a

*An example of the use of the "ss" signal response 1s

...have been shown SSAbelwitz has obtainedsimilar results 1n his experiments withhippopotami.*.

which will print 1n the calf...have been shown (1v).

(1v) Abelwitz has obtained similar resultsin his experiments with hippopotami.

There 1s an Implicit BEGIN FILL ; ... END aroundfootnotes.

*) Thanks are due to Profs. G.I. Wish and O.U. Kidd of Steady StateUniversity for this example.

and 1n the foot:

Page 72: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

A

Page 73: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 68 PUB SAILON-70

il

ii

.

i

%

APPENDIX A

THOROUGHLY EXPLAINED EXAMPLES

A.l SECTIONING MACROS

At the beginning of each section, it is customary toperform the following ritual:

<<!>> Begin a fresh page«2» Count up the section number<<3>> Print the section number and name<<4>> Skip a few lines<<s)> Send the section number, name, and page number to the CONTENTS

See the document PUBMAC.TES[UP,DOC] for a descriptionof the macros STANDARD FRONT and STANDARD BACK, whichdo all these things for you. If you want to defineyour own macros, read on.

A macro to perform all the steps listed above.Commented for reference)) is:

.MACRO SEC (NAME)" <<1» NEXT PAGE.«2» NEXT SECTION.«3» ONCE CENTER* SECTION {!} * -- * NAME *.<<4» SKIP 3~.«5» SEND CONTENTS c{!}\\NAME-{PAGE!}{33

A sample call on this macro is:.SEC SPECIAL FEATURES

I

At the beginning of each subsection, a similar macrocan be called. The one below prints the subsectionname on a line by itself but prints the subsectionnumber at the beginning of the first line of the firstparagraph of the subsection. It makes sure that thereare enough lines for all this to be contiguous; 1fnot, it first goes to a new page. Finally, it allowsthe macro call to specify a label to be used 1n cross-references to this subsection.

A.l

Page 74: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard
Page 75: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 70 THOROUGHLY EXPLAINED EXAMPLES SAILON-70ii

ii

ii

i

%

SECTION Subsection

INTRODUCTIONPURPOSEAPPROACH

BACKGROUNDHISTORYSIMILAR WORKSTATE-OF-THE-ART

Notice that nearly all formatting is accomplished 1nthe SEND template.

Long titles will not be handled by the portiondeclared above. Instead, FILL mode must be used. Thefollowing declarations are approximately what was usedto produce the table of contents of this manual.

.PORTION CONTENTS

.FILL CRBREAK NOJUST

.INDENT 0, 35, 10

.TABS 10, 15, 25

.SKIP 2

.RECEIVE

A. 3 ONE-LEVEL INDEXES

There Is, presently no way to have a phrase indexedautomatically every time it occurs. PUB now requiresthat you mark each phrase to be Indexed at everyoccurrence that you wish to be referenced. The AT.signal characters) response is particularly usefulfor this purpose.

Choose a character or a pair of characters that willnever appear in the text of your manuscript; forexample "X<". This will be your signal that the nextphrase is to be indexed. Then choose a character thatwill never appear 1n such a phrase; for example, ">".This will be your end-of-phrase delimiter. Supposeyou would like the phrase "Simple variables" to beindexed. Find each occurrence of this phrase in yourmanuscript and surround it by your chosen characters:

Nothing warms the heart like /..simple variables). We

A. 3

Page 76: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

__L

Page 77: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

I

i

_1

i

I

.

1

iI'ii

'i

I '

Page 72 THOROUGHLY EXPLAINED EXAMPLES SAILON-70

.PORTION INDEX

.NOFILL

.LETTER - PHR - NULL

"IF "PHRASE" = PHR THEN START },#PGNO{ END.ELSE START COMMENT NEW PHRASE, GO TO A NEW LINE ;. IF .LETTER = t»PHRASE"[I] THEN BREAK

ELSE SKIP 1

;

PHRASE##PGNO{. PHR - "PHRASE"

;

LETTER - "PHRASE"[I] ;. END = ; COMMENT END SIGNAL RESPONSE

;

.RECEIVE "<>"

;

COMMENT ALPHABETIZE BEFORE READING

;

RECEIVE will alphabetize the entries. The "AT" signalresponse will analyze each entry and make a couple ofchecks before outputting it:

(1) If the phrase is the same as the one just printed,it simply appends the page number of the new entry tothe last line printed. For example, 1f thealphabetized file contained:. . .A<Slgns)2.4v{}A<Signs)3.7v. . .then the index would include

Signs 2.4, 3.7

(2) Else, 1f the first letter of this and the previousphrase are the same, it goes to the next line; else,it skips a line. Thus, between the A' s (and a's) andthe B's (and b's) there will be a blank line. Then,it prints both the phrase and the page number.

A. 4 TWO-LEVEL INDEXES

A "two-level index" divides some phrases Into twoparts: a "generic" part and a "specific" part, e.g.:

compi lers,Algol 13, 15Fortran 18LISP 22SAIL 15

computers,analog 29digital 10, 64, 88

consoles 16, 25

A..4

.

.AT "A<" PHRASE ">" PGNO "v" c

Page 78: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard
Page 79: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

'f1

H Page 74 THOROUGHLY EXPLAINED EXAMPLES SAILON-70il -1

.PORTION INDEXl|

IiiIF tWASLfI] * t"L"[l] THEN SKIP 1 ; «IST LETTER DIFFERENT))IF WASL U "L" THEN

START "NEW GENERIC" BREAK

;

L{IF "R"*NULL THEN START "WITH SPECIFIC PART" },\R##{ END "WITH SPECIFIC PART" ; }PGNO{iji

END "NEW GENERIC"ji . START "NEW SPECIFIC" BREAK ;

\R##PGNO{ END "NEW SPECIFIC"ELSE IF WASP n "PGNO" THEN START },PGNO{ END

=> ;s

To create the generated file for PORTION INDEXrequires a signal response such as:

.AT "X<" SPECIFIC "/" GENERIC ">" cIF "SPECIFIC"*NULL THEN START '/SPECIFIC { END ;. }GENERIC{ ; comment print SPECIFIC and GENERIC in the text ;. SEND INDEX c }<GENERIC/SPECIFIC){PAGE! }X{= ;

Every phrase "to be sent to the Index should bebracketed as follows where 1t appears in themanuscript:

I

that there are more %<Algol/compilers) than Algol usersthe world's leading expert on X</consoles).

A. 5 KWIC INDEXES

This one is easy. The desired output 1si Ii j writers of compilers often balk 16

The XYZ compilers 35certain Algol compilers 8

compilers I've known 41IBM computer 72

uses of the computer in government 64

At the end of the manuscript

ii

.WASL - WASR - WASP - NULL ;

.NOFILL ; TABS 6

;

.AT "<" L "/" R ">" PGNO "X" c

ELSE IF WASR * "R" THEN

.RECEIVE "<>" ;

3 ;

Page 80: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard
Page 81: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

zsismsm;

iij;

Page 82: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

SAILON-70 PUB Page I

SUBJECT AND COMMAND INDEX(References are to Page numbers)

ABOVE 57ADJUST 14AFTER 64ALIGN 56alphabetize 52APART 17APPENDICES 49APPENDIX 43AREA DECLARATION 39arithmetic v3OASCII 34, 52Assignment expressions 33assignment statement 45AT N 64AT NULL 63AT PAGEMARK 63AT S 64

BREAKING AT CARRIAGE-RETURNS 15BREAKING AT TABS 15BY 46

C-value 46CALLING A MACRO FROM A COMMAND

LINE 25CALLING A MACRO FROM A TEXT LINE

25CAPABILITIES 1carriage-return 15, 64CASE 56CENTER 16, 19channels 53CHAR 31, 41CHARACTER 57CHARS 31collating sequence 52COLUMN 31COLUMNS 31, 40COMMAND AND TEXT LINES 13COMMAND CHARACTER STATEMENT 49command line 13Command Processing 20, 24COMMENTS 58COMPACT 16COMPILER OUTPUT 4COMPOUNO STATEMENT or CLUMP 35COMPUTED TEXT 23conditional expressions 33

AUTOMATICALLY DECLARED VARIABLES CONDITIONAL STATEMENT 45CONSTANTS 3431CONTENTS 49, 50, 69CONTINUE 41BEFORE 64

BEFORE PAGE 65BEGIN 35

CONTINUE STATEMENT 55CONTROL CHARACTER ACTIVATION 21control characters 18BELOW 57CONTROL FUNCTIONS 18COUNT 43, 46

BIBLIOGRAPHY 49BLOCK 35

COUNTER DECLARATION 43CRBREAK 15

block structure 35, 45BOX FRAME STATEMENT 56BREAK STATEMENT 55BREAKING AT BLANK LINES 15

CROSS-REFERENCES 59crown 14

1

Page 83: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

l.

I.:

i

1,.

l :

;

| .

70Page II INDEX SAILON-

CRSPACE 15 GENERAL EXPRESSIONS 33generated file 50, 52Global 30DATA TYPE 30

DATE 31 GROUP 17decimal 34 GROUP SKIP 54declaration 35DECLARATIONS 37declarative 35DEVICE LDX 57DEVICE LPT 56DEVICE MIC 56

HEADING 39HEADINGS AND FOOTINGS 48hem 14hierarchy 43HORIZONTAL SPACE COMPACTIONhyphen 19

16DEVICE STATEMENT 55DEVICE TTY 56document 1 IF 45dot in column 1 49DOUBLE SPACE 39DOUBLE SPACING 39

ILLEGAL CHARACTERS 13imperative 35IMPERATIVES 45INDENT DECLARATION 38INDENTI 31, 38, 45INDENT 2 31, 38, 45INDENT 3 31, 38, 45INDEX 49, 50, 52, 70INLINE 46

edit 56ELSE 45END 35EQUATION 43error messages 4EVERY HEADING 65EXPRESSIONS 30

INSERT 49integer 38INTRODUCTION 1

FALSE 31FIGURE 43FILE 32

JUSTIFICATION 14, 18, 59justifying 8JUSTJUST 16FILL MODE 14

filling 8, 31, 63FLUSH LEFT 16 KWIC INOEXES 74FLUSH RIGHT 16FONT 57 LABELS 60FOOTING 39FOOTNOTE 43FOOTNOTES 66FOOTSEP 32

LABELS AND CROSS-REFERENCESLDX 56

59

LINE 31LINES 31LMARG 31, 45local 38

Forward Cross-Reference 44forward-references 59

LOCK 56FR-80 56FROM 46

MACRO CALLS 27

\

Page 84: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

Page 111

69

t

SAILON-70 INDEX

MACRO DECLARATION 27MACROS 25manuscript 1MARGIN CONTROL 40MODE AND SWITCH SETTING COMMANDS

17MODE DECLARATIONS 37

NARROW 40NEXT COUNTER VALUE STATEMENT 45NEXT PAGE STATEMENT 47NOFILL 8, 16NOFILL MODE 15NOJUST 8, 14NOPRINT 56NULL 30, 31

octal 34OMISSIONS 28ONCE 36ONE PARAGRAPH SCOPE 36ONE-LEVEL INDEXES 70ONLEFT 57ONRIGHT 57OPERATION 2output past the right margin 41

P-value 46PACK 56PAGE 32, 43PAGE FRAME STATEMENT 55PAGEMARK 63Paracybernetic Society 12paragraph break 14, 37PARAGRAPHING 14PLACE DECLARATION 42PORTION DEMARCATION 49PREFACE DECLARATION 39PRINT 56PRINTING 46, 60PUB 2 2PUBMAC.DFS 26, 51PUBMAC.TES 51

PUBSTD.DFS 26PUG 2PUI 2PURPOSE 1PUZ 2

quotes 34

RASTER 57READING THIS MANUAL 5RECEIVE STATEMENT 52RECURSIVE MACROS 29REFERENCE 43REQUIRE STATEMENT 53reserved words 33RESPONSES 63RETAIN 16Right Flush 19RMARG 31, 45Roman 47RPG 2

SAMPLE COMPILATION 9SAMPLE TABLE OF CONTENTSscope 35, 36, 37SECTION 43SECTIONING 48SECTIONING MACROS 68SEND STATEMENT 58SHOW 56SIMPLE EXPRESSIONS 32SINGLE SPACE 39SKIP N 54SKIP STATEMENTS 53SKIP TO COLUMN N 54SKIP TO LINE N 54SPREAD 31, 39, 45STANDARD BACK 51STANDARD FRONT 51STANDARD TITLES 65START 35STATEMENT TYPES 35STATEMENTS 35'

Page 85: k* - Stanford Universityhp045yn8435/hp045...02380/10 Manuscript file,page 10, line 2300 (SOS) 1ND02300/10/1 INDEX.PUG file,page 1, comes from Manuscript 2300/18 PUB2S/1 PUB Standard

VERBATIM 8string 34STRING SPACE EXHAUSTED 52Strings 30

VERTICAL GROUPING 17vest 14

Subscript 28SUBSECTION 43substring 33

WIDEN 40widows 40

SUPERIMPOSE [n] 16Superscript 20

WORD BREAKS 18

switches 3syntax of PUB commands 5

TAB 19, 41TABBREAK 15TABLE 43table of contents 50TABS DECLARATION 37TABSPACE 15TEMPLATES 26TEMPORARY AREAS 42TEXT 39TEXT AREA 40TEXT CONVENTIONS 13text line 13text processing 23TEXT RESPONSES 63THEN 45THOROUGHLY EXPLAINED EXAMPLES 68TIME 32TITLE AREA 48TITLEPAGE 49TOPLINE 31TRANSITION RESPONSES 64TRIPLE SPACE 39 '

TRUE 31TURN OFF 22TURN ON 21TUTORIAL FOR BEGINNERS 5TWO-LEVEL INDEXES 72

Underline 20UNIMPLEMENTED STATEMENTS 56

VARIABLES 30

INDEX SAILON-70