diff --git a/Makefile b/Makefile index a8cdf720..80b33059 100644 --- a/Makefile +++ b/Makefile @@ -10,9 +10,9 @@ SRC = system syseng sysen1 sysen2 sysen3 sysnet kshack dragon channa \ spcwar rwg libmax rat z emaxim rz maxtul aljabr cffk das ell ellen \ jim jm jpg macrak maxdoc maxsrc mrg munfas paulw reh rlb rlb% share \ tensor transl wgd zz graphs lmlib pratt quux scheme gsb ejs mudsys \ - draw wl taa + draw wl taa tj6 DOC = info _info_ sysdoc sysnet syshst kshack _teco_ emacs emacs1 c kcc \ - chprog sail draw wl pc + chprog sail draw wl pc tj6 BIN = sys2 emacs _teco_ lisp liblsp alan inquir sail comlap c decsys moon \ graphs draw datdrw diff --git a/build/misc.tcl b/build/misc.tcl index 63b90af6..8910cff2 100644 --- a/build/misc.tcl +++ b/build/misc.tcl @@ -787,3 +787,13 @@ respond "*" ":load sysbin;xxfile bin\r" respond "*" "ttyop1\033b\033g" expect ":PDUMP SYS2;TS XXFILE" type ":kill\r" + +# TJ6 +respond "*" ":midas sysbin;_tj6;tj6\r" +expect ":KILL" +respond "*" ":job tj6\r" +respond "*" ":load sysbin; tj6 bin\r" +respond "*" "purify\033g" +respond "DSK: SYS; TS NTJ6" "\r" +respond "*" ":kill\r" +respond "*" ":link sys; ts tj6, sys; ts ntj6\r" diff --git a/doc/programs.md b/doc/programs.md index 46123ba7..82750a78 100644 --- a/doc/programs.md +++ b/doc/programs.md @@ -181,6 +181,7 @@ - TIMES, TCP time server. - TIMOON, displays the time and phase of the moon. - TIMSRV, RFC 868 network time protocol. +- TJ6, typesetting software. - TMPKIL, clean out old files in .TEMP.;. - TREK, Star Trek game. - TTLOC, Advertises physical location of logged in users. diff --git a/doc/tj6/-read-.-this- b/doc/tj6/-read-.-this- new file mode 100644 index 00000000..eecd8464 --- /dev/null +++ b/doc/tj6/-read-.-this- @@ -0,0 +1,25 @@ +This directory is maintained by BKPH and JDC. +It contains: + .INSRT'able files for TJ6 users; + TJ6 documentation; + various test programs; + and TJ6 source listings. +-READ- -THIS- This file +.TECO. (INIT) Some random macros for use in writing TJ6MEM > +ERROR > Part of source for ORDER XGP +NNTJ6 > Current NNTJ6 and NTJ6 MIDAS source +NTJ6 142 Old (12/13/73 TJ6 source.) +ORDER > ORDER TJ6 source (.insrts ERROR > and SPACES >) +ORDER MEMO :PRINTable TJ6 ORDER +ORDER XGP XGPable TJ6 ORDER +SPACES > Part of ORDER source +SPTEST > Test File +TABTST > Test File +TJ6 129 Super old TJ6 source (12/13/73). +TJ6 ARCHIV All changes to TJ6 since 6/74. +TJ6 LPT .INSRTable file with LPT page and text sizes +TJ6 TERMIN .INSRTable file with TERMINET page and text sizes +TJ6MEM mumble Sources and outputs for new TJ6 AI MEMO #164B +TJTST 30 Test file +VJTEST 1 Test file + \ No newline at end of file diff --git a/doc/tj6/tj6.archiv b/doc/tj6/tj6.archiv new file mode 100644 index 00000000..a7e3badb --- /dev/null +++ b/doc/tj6/tj6.archiv @@ -0,0 +1,392 @@ +WBA 2/4/78 version 26 + +BUFSIZ increased from 200 to 600 (determines free storage) + +GLS 12/26/77 version 25 + +[1] The maximum number of fonts has been raised + from six to ten. Thus any decimal digit may + follow a ^F character. +[2] One may write ^F*, which means pop the font + to the state before the last ^Fn command. + There is a ring buffer for this, so that + ^Fn ... ^F* may be nested about 64 deep. +[3] .LTRSPC 0 prevents TJ6 from putting extra + space between letters of a word when adjusting + for the XGP. .LTRSPC 1 (the default) reenables + this. +[4] .XGP used to be ignored if the output device + was not DSK. Now it is ignored only if the + output device is LPT or TPL. + +JDC 5/16/75 New NNTJ6 (and NTJ6) fixes some bugs. New features: +.SQUISH causes ;SQUISH to appear on XGP command page +.ASP absolute space. Like .SPACE, but leaves same amount of space when + SINGLE or DOUBLE spacing. +.ABLOCK absolute BLOCK. Like .BLOCK, but not dependent on SINGLE or DOUBLE. + (control G) new in-text command equivalent to .GENNUM 1 1. +TJ6 will soon be identical to NNTJ6 and NTJ6. +Reminder: I'm still ignoring bug reports without source files, and all requests for + features. + +2/25/75 +NTJ6_NNTJ6.7 NNTJ6_NNTJ6.8 +NNTJ6.8 fixes some bugs: .HYPHEN, :JCL mumble P, etc. +Also, as promised, eliminates commands in favor of in-text characters, or command switches: +BSCORE ESCORE HDFONT SELECT SF DATE FNAME CONTEN +       /C + +1/75 +Because of some particularly bad default conditions in NNTJ6.6, +NNTJ6 has been unfrozen and refrozen, and NNTJ6.7 has the following changes: +The default size of a tab and spacing unit has been changed to + the largest character in font 0. The new command TABFNT + can be used to change this. +Tabs and spaces which cause breaks will never be compacted. +TABINC has gone away. +Three command names have been changed to things that can be remembered: + PGN to NOHEAD + PGNRGH to HEADPW + RL to RTW +BLUP and BLDOWN are flushed in favor of SCRIPT. +There are 8 GENNUM counters. +/X makes the output default 2nd file name XGP. +NNTJ6.7 is not restartable and kills itself after one file. +It is one block smaller the block which was flushed was unpure. (Total 6 blocks, + 3 pure.) This is part of President Ford's WIN program. + +For details, XGP TJ6;ORDER MEMO, or :print TJ6;TJ6 ORDER. +This file has a writeup on spaces and tabs, and explains error mesages. + +11/27/74 JDC + +18 November, 1974 +There are many changes, some incompatible, in NNTJ6.6. +The complete list of NNTJ6 commands is TJ6;TJ6 ORDER. (XGP Version -- TJ6;ORDER MEMO) + +1) Contents: TJ6 when asked to do a table of contents, +outputs a file which is suitable for input to TJ6, and is a series of .SPREAD +commands, eg, + .Spread + /First Section Heading//1/ + .Spread + /Second section//2/ +etc. TJ6 will use a / as the field seperator in writing .SPREADs, +unless this is changed with the .STERM command, which takes one character +as an argument (like .DUMMY). +The preferred method of causing a table of contents to be produced is to +type /C in the command line. If one uses the .CONTEN command instead, +it must appear before any text. (This command may go away soon.) +The default output 2nd filename when /C is typed is CONTEN instead of MEMO. + +2) Tabs on the XGP will try to align so that things which line up in TECO will +also line up in TJ6. In order to do this, tabstops will be equal to +8 * the width of the largest character read in all fonts. +Units for .INDENT, .TW, .RLINE, etc., and spaces at the +beginning of a line will all be 1/8th of a tabstop wide. +To change this, (but risk not having TJ6 and TECO be isomorphic with +respect to tab alignment,) use: + .TABINC sets width of a tabstop in inches + .SPW sets the width of the spacing unit in XGP dots (and a tabstop +is 8 times as wide). + +3)  (Control Q) is now the default quoting character. + +4)  (Control D) and (Control N) are two new in-text command +characters which respectively insert the date and file name into the text +(like .DATE and .FNAME). The date is now of the form "November 78, 2965" +instead of MM/DD/YY. The in text characters should be preferred to the +commands as the latter may go away. + +5) Redundant carriage returns will be retained in the output text. To turn this +off use: + .CRCOMP compacts carriage returns. The opposite is: + .CRRETA retains carriage rturns. + +6) The size of a .BLOCK implied by a .SECT can be controlled with + .SBLOCK + +7) Other new commands: +.CRBR all carriage returns break. +.CRSP carriage returns in fill and adjust mode are like spaces (default). +.SPBR leading spaces and tabs cause a break (default). +.SPSP they don't break. +.SPCOMP compact spaces in FILL and ADJUST modes. +.SPRETA retain spaces. These last two commands are affected by + .FILL, .ADJUST, and .HALFAD, the first two of which do an automatic + .SPRETA, and the latter two do a .SPCOMP. +Note that the combination of .SPSP and .SPCOMP will allow input text that +has leading spaces or tabs to be treated as though those tabs or spaces weren't there. + +8) The .TABSET command has died an early death. + +9) -- (dash) will not be broken between the hyphens. + +10) Font files which don't open will have the ERR device message printed. + +11) The commands which should appear before text in the input file: +.XGP, .FONT, and .CONTEN, will have an error message printed if they +appear after text. + +12) PGNRGH will now align headings on both sides with the page boundaries. + +13) The p"pages" message printed by TJ6 is now the actual number of +pages printed, rather than the last page number. + +14) Rubouts in the command string work better from displays. + +15) NNTJ6.6 is now down to 7 core blocks (but just barely). This is one less than NNT6.5, +and in spite gross additions (like variable width hackery) is only one greater than TJ6. +Its small size (and shared pages) is one of the main reasons that TJ6 runs +so much quicker than PUB (which is 54 blocks as soon as you type PUB^K, and gets +bigger faster than Alice in Wonderland.) I aim to keep TJ6 small, and I therefore declare +it frozen, with the possibility of removing some commands. +The commands likely to be flushed, which all can be effected some other way, are: + .FNAME (use ) + .DATE (use ) + .SELECT and .SF (use ) + .BSCORE (use ) + .ESCORE (use ) + One of .BLUP .BLDOWN + .HDFONT (use ) +Also TJ6 may kill itself after printing one file. + +16) I need source files in order to find bugs!!! +A bug which looks easy to recreate often depends on +som special circumstance in the source file, and is next to impossible for me to +duplicate. + +--JDC + + + TJ6 Recent Changes 1_ NNTJ6 3 -- 24 June, 1974 + + or, T_h_e_ _N_e_w_ _R_e_g_i_m_e_ + + There are important new changes to the text justifier. These changes are + incorporated in NNTJ6. After a while, NNTJ6 will become the standard TJ6, + so use NNTJ6 and help get the bugs out. + + Most of these changes are designed to straighten out the mess which is the + insides of TJ6. Changes visible to the user are: + + NNTJ6 is half p_u_r_e_ _c_o_d_e_. Hopefully this will speed it up in certain + circumstances. + + It has some n_e_w_ _c_o_m_m_a_n_d_s_: + ._P_W_I_N_C_H_ _n_ -- sets paper width (.PAPERW) in tenths of an inch. E.G., + .PWINCH 8.5 sets the physical paper width to 8.5 inches. + ._T_W_I_N_C_H_ _n_ -- sets text width (.LINE) + ._P_L_I_N_C_H_ _n_ -- paper length (.PSIZE) + ._T_L_I_N_C_H_ _n_ -- text length (.PAPER) + ._S_I_N_C_H_ _a_,_b_,_c_,_d_,_e_ -- sets paper width, text width, paper length, text + length, and left margin in inches respectively to a,b,c,d, and e. + E.G., + .SINCH 8.5,6.,11,8.0,1.5 sets the physical paper size to 8 1/2x11, + the text size to 6x8, and left margin to 1 1/2 inches. + + ._F_I_N_C_H_ _n_ -- sets figure size in inches. + ._F_I_G_U_R_E_ _n_ nows treats its argument as an absolute number of lines + (irregardless of whether you are single or double spacing). + + ._F_O_N_T_ _n_ _F_i_l_e_ _N_a_m_e_ -- associates font n with the appropriate font file. + This is used to set font height and width, for use by various size + commands, and to set the font name for the XGPLPT command page. + .FONT 1 LGI makes font 1 FONTS;LGI KST. + (This command actually causes the entire font to be read in and + groveled over, so it takes a while to execute. The only legal + device names are AI and DSK.) + + ._V_S_P_ -- sets interline space. Units are XGP raster dots, 1/192nds of an + inch. (Default is 6.) + + ._H_V_W_ _a_,_b_,_c_ -- sets the height of font 0, VSP, and width of a space in font + 0 respectively to a, b, and c. The defaults are 25, 6, and 16 for + the XGP, and 24, 6, and 19 for non-XGP. These data are used by the + commands which set size in inches. .HVW is a quicker way of + reading in this information than .FONT. + + X_G_P_L_P_T_ _c_o_m_m_a_n_d_ _p_a_g_e_ -- If TJ6 thinks it's outputting to the XGP, (i.e., + output device is DSK: and there was either a /X in the command line + or a .XGP command,) it automatically outputs a page of XGPLPT + commands: + + + TJ6 Recent Changes 2_ NNTJ6 3 -- 24 June, 1974 + + ;TOPMAR 0 + ;BOTMAR 0 + ;LFTMAR 0 + ;VSP n + ;KSET any font names you have specified with .FONT + ;SKIP 1 + To prevent TJ6 from doing this, use: + ._N_O_S_P_E_C_ -- turns off automatic output of XGPLPT commands. + + ._U_L_F_O_N_T_ _n_ -- causes printing in font n to be underlined if output is not to + the XGP. Default is .ULFONT 1. (This is helpful if the ulfont is + italicized.) (To turn off, make n <0 or >3.) + + _ _(_c_o_n_t_r_o_l_ _Y_)_ -- in text command character which begins underscore. + _ _(_c_o_n_t_r_o_l_ _X_)_ -- in text command character which ends underscore. + Note that underscoring is treated differently by TJ6 and the XGP than + backspacing and overstriking with underbars. For underscoring, TJ6 + outputs special XGP underscore commands. For overstriking, TJ6 + backspaces and overstrikes. (Complicated, huh?) For most fonts, + the _ character is defined to look like underscoring. For a couple + it isn't. So if you mean underscore, do it, and if you mean + overstruck _, do that. (Backspacing and overstriking of all + characters once again win in .NOFILL mode.) + + All the in text command characters should now work on centered, spread, + etc., lines, and in the header. Those in-text characters which + make sense to non-XGP devices are:  (control Y), begin underscore; +  (control X), end underscore; and  (control F), font switch, + which makes sense because of .ULFONT). Other in-text commands are + ignored if not to the XGP. + + H_i_d_d_e_n_ _h_y_p_h_e_n_s_ work! + + ^^_C_ _(_c_o_n_t_r_o_l_ _C_)_ is now read by TJ6 like any other input character, but TECO + makes these difficult to insert. Also they are not typed out in + block mode .IOTs to teletypes, due to a system "feature". + + Characters which have been quoted (with the quoting character), will be + printed on the XGP in "normal" mode. E.G., quoting character + followed by a backspace will print as lambda, rather than + backspace. To turn this off use: + ._N_O_R_M_A_L_ _n_ -- if no argument or n=0, turns off "normalization" of + quoted characters to the XGP, otherwise turns it on. This command + does not break. + + F_L_U_S_H_E_D_ _C_O_M_M_A_N_D_S_ + The following commands have been noops for a while, and are now gone: + .BSPDIR (Back spacing is always direct.) + + + TJ6 Recent Changes 3_ NNTJ6 3 -- 24 June, 1974 + + .QUICK + .TABS + .TABSET + .C2471 + .K2471 + .S2471 + .T2471 + .CBALL + .KBALL + .SBALL + .TBALL + The following have simply been flushed: + .NJ + .NOJUST + .PAUSE + .STOP + .STPCHR + .TSTOUT + The following "abbreviations" and command names have been flushed in favor + of others: + .BP -- use .BEGIN + .CM -- use .C or .COMMENT + .CO -- use .FI or .FILL + .CP -- use .BLOCK + .RA -- use .RI or .RIGHT + .APPND -- use .AP or .APPEND + .DUMCHR -- use .DUMMY + .TR -- use .TRANS + .QTECHR -- use .QUOTE + .PL, .PAPER -- use .TL + .PS, .PSIZE -- use .PL + .L, .LINE -- use .TW + .PAPERW -- use .PW + The prior four new names are mnemonic for T_ext L_ength, P_aper L_ength, T_ext + W_idth, and P_aper W_idth. + + C_H_A_N_G_E_D_ _C_O_M_M_A_N_D_S_ + The following have been changed: + + ._D_U_M_M_Y_ -- can now be used to specify more than one dummy character by + simply using the command more than once. + + ._F_I_L_L_ -- now causes adjusting to be turned off. + + ._H_E_A_D_E_R_ -- now takes its argument on the next line (just like .HE1, .HE2, + etc.) + + ._P_H_P_1_ -- again takes no argument, and simply causes the header to be + printed on page one. + + + + TJ6 Recent Changes 4_ NNTJ6 3 -- 24 June, 1974 + + ._S_E_C_T_ -- now does a .BLOCK 2, so that a section title will not be the last + line on an output page. + + ._T_R_A_N_S_ -- now works on input instead of output. All text characters may be + translated. Command line characters are not translated. (The + translation occurs before the test for in-text command characters, + therefore, + .TRANS \^F will cause \_ to act as an in-text font switching + character.) + + ._X_G_P_ and /_X_ -- now are equivalent. If output is to DSK, they: do a .SINCH + 8.5,6,11,8; a .HVW 25,6,16; and try to output an XGPLPT command + page. + + Handling of s_p_a_c_e_s_, ?_ _._ _!_, and ;_ _:_ has been changed. In .NOFILL mode, they + continue to get no special treatment. In fill mode, they have two + spaces inserted afterwards only if followed by a carriage return or + line feed. There is a n_e_w_ _m_o_d_e_, .HALFAD, in which the text is + filled, but not adjusted, and in which spaces and ?_._!_:_;_ are treated + the same as in .ADJUST mode. The gist of this treatment is that + two spaces will be inserted after ._!_?_:_;_ at the end of a clause or + sentence, and that more than one space or tab in a row (except at + the start of an input line,) is treated like one space. NNTJ6's + algorithm for determining the end of sentence or clause is: + A_B_._C_D_ + The . is always treated like the end of a clause or sentence if C + is a carriage return or line feed; otherwise, This is n_o_t_ the end + of a sentence or clause if: + 1 B is a number; + 2 B is a letter and A is a space, tab, or one of ._!_?_;_:_; + 3 C is not a space, tab, carriage return, line feed, or one or more + of the following: )_"_'_]_; + 4 C is one or more of )_"_'_]_, and D is not a space, tab, carriage + return, or line feed. + (In cases like A_B_._)_ _, the spaces are inserted after the )_.) + If you don't like the special treatment of some of these + characters, turn one off with: + ._P_E_R_I_O_D_ _n_ _c_h_a_r_a_c_t_e_r_ -- which turns off special treatment of c_h_a_r_a_c_t_e_r_ if + n=0, otherwise, turns it on. + ._P_E_R_I_O_D_ with no argument, still turns off special treatment of all + of ._!_?_;_:_. + + M_E_M_O_ is now the default output name instead of (MEMO). + + V_a_r_i_a_b_l_e_ _w_i_d_t_h_ _f_o_n_t_s_ are now filled and adjusted correctly. + + C_o_h_e_n_'_s_ _L_a_w_: + P=1/C2, i.e., + the probablity of my looking at any bug complaint, without an example of + the source file which caused it, is inversely proportional to the speed of + + + TJ6 Recent Changes 5_ NNTJ6 3 -- 24 June, 1974 + + light squared. + + O_T_H_E_R_ _N_E_W_ _F_E_A_T_U_R_E_S_:_ + In the immediate future, I shall concentrate on continuing to straighten + out the inside of TJ6, and I am unwilling to put in new features. Please + don't waste my time by asking for a .UPSIDEDOWN command, or whatever's your + penchant. However, if you feel you absolutely must have a new feature, you + may go about it as follows: + 1) Obtain three "TJ6 Suggested Improvement Forms" + from Suzin Jabari. (These will be available in a couple of weeks.) + 2) Fill them out, and give one copy to Marvin, one copy to Berthold, and + one copy to me. + Your request will be carefully filed. + + --JDC + diff --git a/doc/tj6/tj6.order b/doc/tj6/tj6.order new file mode 100644 index 00000000..b1432ac2 --- /dev/null +++ b/doc/tj6/tj6.order @@ -0,0 +1,2 @@ + +A description of TJ6 is available as AI Memo #358 diff --git a/doc/tj6/tj6_3.recent b/doc/tj6/tj6_3.recent new file mode 100644 index 00000000..e0ab9214 --- /dev/null +++ b/doc/tj6/tj6_3.recent @@ -0,0 +1,27 @@ +.ALTER + Swap left and right header on even numbered pages. + +.GENSET + GENSET n now sets the counter to n-1, so that the next GENNUM produces n. + +(control-g) + now can take one argument, which is the counter number to increment. +.LS + + no longer exists. Use blank lines instead of .SP if you want the old + LS SP effect. + +/T, typein from tty + In order to get typein from the TTY, you must now use the /T switch + instead of terminating the command line with a LF. TJ6 will accept + command or text input from the tty, with reasonable rubouts, untill + tty input is terminated with a .APPEND, .INSRT, or the new command: + +.ET + which is now used to terminate input from the tty, instead of the + old CR, space. + +.XGP + now has the same effect as the /X switch, i.e., the default second + filename is XGP, not MEMO. + \ No newline at end of file diff --git a/doc/tj6/tj6mem.61 b/doc/tj6/tj6mem.61 new file mode 100644 index 00000000..e339a7ee --- /dev/null +++ b/doc/tj6/tj6mem.61 @@ -0,0 +1,2588 @@ +.xgp +.font 0 25vg +.font 1 25fr +.c 1 used for examples of TJ6 input +.font 2 25vmic +.c 2 used for examples of tj6 output +.font 3 25vri +.c 3 used for italics +.font 4 40vshd +.c 4 used for title page +.squish +.sinch 8.5,6.5,11,9,1.25 +.sidm 50 +.dummy  +.sterm | +.hyphen +.insrt tj6;tj6mem title +.spage +.php1 +.page +.sblock 3 +.adjust +.spsp +.he1 +TJ6 Text Justifier +.he2 +Contents +.rtw 15 +.insrt tj6;tj6mem conten +.rtw -15 +.chap 1 +.he2 +Introduction +.pa +.sect +Introduction + +TJ6 is a compiler which translates a sloppy +input manuscript into a neat output document. +It can justify and fill text; automatically number pages and figures; +control page format and indentation; underline, super and subscript; print a table of contents; +and do a few other strange things. + +TJ6 tries to be a fast, simple program which meets most +documenting needs, rather than a large, complicated, relatively slow program like PUB, +which tries to meet all documenting needs. +In order to achieve speed, small size, and simplicity, TJ6 has naturally sacrificed +the potential for many of PUB's capabilities. TJ6 does not have: +columnar output, macros, footnotes, indices, block structure, +conditional commands, or arithmetic or string calculations. + +This memo tries to be both a reference manual and a user's manual. +Towards the first end, this document is intended to be complete, +even to the point of describing some of TJ6's inner workings. +Towards the second end, this memo describes things +in a manner which an experienced programmer might think too simple or verbose. +This is intended to be useful +to someone who has no programming or TJ6 experience. +(If that description fits you, first have a look at section 20, Sample Input.) + +.sect +Conventions + +This memo also includes examples of the use of most commands, +which should be a help not only to the novice, but to someone trying +to find a mysterious bug in his TJ6 program. +Text which appears in +.crbr +.un -4 + 1fixed width roman type0 +is an example of input text. Text which appears in +.un -4 + 2microgramma type0 +is an example of output text. + +An underbar in examples of input text denotes a space, e.g., +.un -4 + 1foo_0 +means "1foo 0". +.crsp +.chap +.he2 +Commands +.pa +.sect +Commands + +TJ6 input is divided into text and command lines. +Command lines are lines which start with a period. +(Except that the line after SPREAD, HEADER, HE1, and HE2 is +always interpreted as text even if it starts with a period.) +The name of the command is the word following the period. +.crbr +Text lines: +.in 4 EXAMPLE + 1This is a text line. + .This is also a text line. +.un 4 +0Command lines: + 1.INDENT 5 + .GUN0 +.crsp +.in 0 END EXAMPLE +(Even though there's no such command as GUN, the second line +is still a command line because it starts with a period.) +Only the first six letters of the command name are significant. +Any extra stuff on command lines will be ignored. +Some characters: , , ,  , , , , , , and  +have special meaning in text lines. +(They are dealt with in section 16, In-text Character Commands.) + +Many commands are followed by an argument, which will be denoted below by: +.spbr + a decimal integer; + a standard ITS file name like "DSK:TJ6;TJ6 ORDER"; + any ASCII character; + an integer or a psuedo floating point number, with up to three places +to the right of the decimal, e.g., 5, 6., 7.089. +.spsp +.br +Any other argument abbreviations should be read in context. + +Many commands which have no explicit inverse have the inverted effect if given +the argument of 0. + +Many commands have abbreviations. +These are listed on the line following the command. + +Each command is described as follows: + +.of 9 +Long form +.br + B indicates this command causes a break. (Text will not be filled across it.) +.br + Z indicates command can be inverted with an argument of 0. +.un 8 + abbreviation(s) +.un 1 + Description +.sp +.in 0 +.in 0 +.he2 +Page Format +.chap +.pa +.sect +Page Format + +0These commands control which area of the page text may appear in, +and where the heading appears. (See section 10, Headings.) +Commands which give additional control +within the defined text area (such as by indenting) are covered in +section 8, Horizontal Margins. + +.nf + PW  +  TW  + paper PL +text TL + +   +  +.center +Page and text size parameters +.adjust + +Whenever one of these parameters is changed, TJ6 readjusts the margins so that the +proportional size of left to right margin and top to bottom margin stays the same. +(Those proportions can be changed with the SIDM and TOPM commands.) +All of these commands also move the heading. +.sp +.sect +.of 8 +PL B +.br + Set paper length to lines. +.sp +.sect +.un 8 +PLINCH B +.br + Like PL but argument in inches. +.sp +.sect +.un 8 +PW B +.br + Set paper width to "spacing units". +.sp +.sect +.un 8 +PWINCH B +.br + Like PW, but argument in inches. +.sp +.sect +.un 8 +TL B +.br + Set the text length to lines. +.sp +.sect +.un 8 +TLINCH B +.br + Like TL, but argument in inches. +.sp +.sect +.un 8 +TW B +.br + Set text width to "spacing units". (See section 7, Spaces and Tabs.) + (A spacing unit is usually the largest character in FONT 0.) +.sp +.sect +.un 8 +TWINCH B +.br + Like TW but argument in inches. + For example, + +.in 4 EXAMPLE +.crbr + 1.TWINCH 3.5 + "If the past were permitted to weigh on its conscience, + every nation would be compelled to commit hara-kiri."0 +.un -4 + is output as: +.block 3 +.crsp +.in 0 +.rtw 26 + 2"If the past were permitted to weigh on its conscience, + every nation would be compelled to commit hara-kiri."0 +.rtw -26 +.in 8 END EXAMPLE +Note how the percentage of margin on each side is kept constant. +.sp +.sect +.un 8 +SINCH B +.br + Set PWINCH, TWINCH, PLINCH, TLINCH, and left margin in inches, + respectively to , , , , and . + (All the arguments are decimal.) + This memo was produced with a +.in 4 EXAMPLE + 1.SINCH 8.5,6.5,11,9,10 +.in 8 END EXAMPLE + The default for the XGP is SINCH 8.5,6,11,8,1.25. + (When not using the XGP, the defaults are: + PW 85, TW 73, PL 66, and TL 50. + For a typewriter with a character width of 1/10 inch and + line height of 1/6 inch, this works out to + SINCH 8.5,7.3,11,8.333,0.6.) +.sp +.sect +.un 8 +TOPM B +.br + Make the top margin percent of the total. +.in 4 EXAMPLE +.crbr + 1.PLINCH 11 + .TLINCH 9 + .TOPM 600 +.crsp +.in 8 END EXAMPLE + will make the top margin 1.2 inches (60 percent of 11-9) + and the bottom margin 0.8 inches. +.sp +.sect +.un 8 +SIDM B +.br + Make left margin percent of the available margin space. + The setting of SIDM, normally 50%, effects the appearance of lines + whose size has been change by TW, TWINCH, or RTW. + SIDM is kept constant through changes in TW. +.in 0 +.chap +.he2 +Filling, Adjusting, Centering, Aligning +.pa +.sect +Filling, Adjusting, Centering, and Aligning + +This section deals with the basic "justification" operations of TJ6--the +commands which make the output neat, even though the input is ragged. +ADJUST and FILL also affect the treatment of punctuation marks and +redundant spaces in the input text. This is described in section 12, +Periods and Punctuation. + +.sect +.of 8 +ADJUST B +.un 7 + AD +.br + Adjust the output text. + (Align its left and right edges by inserting spaces within the line.) + For example, the input text, +.crbr +.in 4 EXAMPLE + 1.ADJUST + "Lilies that fester smell far worse than weeds: + both India and Japan seem to be spiritually sicker, + more estranged from a living faith than the West. + They are at opposite ends of the Asian spectrum, + whose centre is occupied by the vastness of China, + one of the world's oldest cultures; + yet it proved even less resistant against the impact + of a materialistic ideology."0 +.un -4 + is output as: +.crsp + 2"Lilies that fester smell far + worse than weeds: + both India and Japan + seem to be spiritually sicker, more estranged from a living faith than the West. + They are at opposite ends of the Asian spectrum, + whose centre is occupied by the vastness of China, + one of the world's oldest cultures; + yet it proved even less resistant against the impact of a materialistic ideology."0 +.in 8 END EXAMPLE +.sp +.sect +.un 8 +FILL B +.un 7 + FI +.br + Approximately align right margin by not printing a word which would go + beyond it. + (The default mode.) With .FILL instead of .ADJUST, the previous example + becomes: +.in 4 EXAMPLE +.FILL +.spcomp + 2"Lilies that fester smell far + worse than weeds: + both India and Japan + seem to be spiritually sicker, more estranged from a living faith than the West. + They are at opposite ends of the Asian spectrum, + whose centre is occupied by the vastness of China, + one of the world's oldest cultures; + yet it proved even less resistant against the impact of a materialistic ideology."0 +.in 8 END EXAMPLE +.ad +.sp +.sect +.un 8 +Filling vs. Adjusting +.br + There is some argument as to whether filled or adjusted text looks better. + While the even right margin of adjusted text can be easier on the eye, + there are some problems which can be introduced by the addition of space + in the middle of the line. Typically, all the adjusting is done by putting + additional spaces between words. This can cause "rivers", + where several adjacent + lines have extra space in about the same column. This problem is especially + bad with short lines, as in newspaper columns. + TJ6 tries to avoid rivers by trying to put space between letters before + putting space between words. + TJ6 figures out how much space has to be inserted to adjust the line to + the right margin; puts as much space as possible between letters, while + keeping the space between letters equal; and then puts the remainder of + the space between words. + This can lead to another problem -- the intercharacter space is large compared + to the interword space. + The MIT Press is avoiding these problems by making many publications + filled, not adjusted. +.sp +.sect +.un 8 +NOFILL B +.un 7 + NF +.br + Don't fill text. + (This is not the equivalent of PUB's VERBATIM. + NOFILL simply causes TJ6 to begin a new output line for every new input line.) + Tabs and leading spaces in NOFILL and FILL modes occupy the same + amount of space. (See section 7, Spaces and Tabs.) + A NOFILL line which sticks out past the right margin will + generate an error message, but will be printed anyway. +.sp +.sect +.un 8 +NVRADJ BZ +.br + Never adjust. Ignore future adjust commands. +.sp +.sect +.un 8 +CENTER B +.un 7 + CE +.br + Center the very next input line. +.in 4 EXAMPLE +.block 3 + 1.CENTER +.br + Winnie the Pooh0 +.CENTER +2Winnie the Pooh0 +.in 8 END EXAMPLE +.sp +.sect +.un 8 +RIGHT B +.un 7 + RI +.br + Right justify the next input line. +.in 4 EXAMPLE +.crbr +.block 3 + 1.RIGHT + Winnie the Pooh0 +.crsp +.RIGHT +2Winnie the Pooh0 +.in 8 END EXAMPLE +.sp +.sect +.un 8 +SPREAD B +.br + The next line is three strings, the first will be left justified, + the second centered, and the third right-justified. + The strings are separated by a separator defined as the + very first character on the next line. +.in 4 EXAMPLE +.crbr +.block 3 + 1.SPREAD + /Winnie/the/Pooh/ +.crsp +.SPREAD +/2Winnie/the/Pooh0/ +.in 0 END EXAMPLE +.chap +.in 0 +.he2 +Breaking +.pa +.sect +Breaking + +When TJ6 is filling or adjusting, it runs together lines of input text +in the output. +This section deals with what causes TJ6 to break, i.e., to begin a new output line. + +TJ6 reads characters into an internal buffer untill it finds a word boundary +which sticks past the right margin. Then it goes back through the buffer untill it +finds a word boundary which doesn't stick past the margin. +The output text is broken at that word boundary. +A word boundary can be: +.in 8 +.nf +a space; +a carriage return line feed; +a hypen; +a hidden hypen. (See HYPCHR below.) + +.un 8 +In addition, the user may cause the output text to be broken by: +a breaking command (one which is followed by a B in this memo); +a blank line or lines; +a line with leading spaces and/or tabs; +the BREAK command. +.ad +.sp +.sect +.un 8 +HYPHEN Z +.br + Don't allow - to break a line. + For example, the following text will ordinarily be broken + at the hyphen in "Lao-Tse": +.hyphen 0 +.in 4 EXAMPLE + 2"The nation which held fast for ... millenia to the + teachingofConfucius,Lao-TseandtheBuddha,succumbed to the atheistic doctrine + formulated by the son of a German lawyer, and has become the most accomplished + robot state this side of science fiction."0 +.in 8 + When preceded, by a .HYPHEN, the text will be broken at the space + preceeding the hyphen. +.in 4 +.BR +.HYPHEN + 2"The nation which held fast for ... millenia to the + teaching of Confucius, Lao-TseandtheBuddha,succumbed to the atheistic doctrine + formulated by the son of a German lawyer, and has become the most accomplished + robot state this side of science fiction."0 +.in 8 END EXAMPLE +.sp +.sect +.un 8 +HYPCHR B +.br + Define the "hidden hyphen" character which will not be printed unless used + to break a word, in which case it will be printed as -. + This can be used as a super-stupid syllabification, + or in a special case when there is an extraordinarily long word, which, + when broken at the word boundary, looks awful. + HYPCHR with no argument turns off the current HYPCHR. +.in 4 EXAMPLE +.crbr +.block 3 + 1.HYPCHR  + TolooktoAsiaformysticenlightenmentandspiritual + guidancehasbecomeasmuchofananachronismastothinkof + AmericaastheWildWest.0 +.crsp +.HYPCHR  + 2To look to Asia for mystic enlightenment and spiritual guidance + hasbecomeasmuchofananachronismastothinkof + AmericaastheWildWest.0 +.in 8 END EXAMPLE +.sp +.sect +.un 8 +BREAK B +.un 7 + BR +.br + Don't fill input text across this command. +.block 5 +.in 4 EXAMPLE +.crbr + 1Don't fill text + .BREAK + across the BREAK command.0 +.crsp +.ad + 2Don't fill text +.BREAK + across the BREAK command.0 +.in 8 END EXAMPLE +.sp +.sect +.un 8 +CRBR B +.br + Make every carriage return cause a break. + (Opposite of CRSP.) + This command can be used as a sort of compromise between FILL and NOFILL + mode, where lines are filled, (or adjusted) + but every time you begin a new input line, + TJ6 begins a new output line. +.in 4 EXAMPLE +.crbr + 1.TWINCH 2.5 + .CRBR + This memo, TJ6 Text Justifier, is divided into the following sections: + Introduction, + Commands, + Page Format, + etc. +.sinch 8.5,2.5,11,9,1 + 2This memo, TJ6 Text Justifier, is divided in the following sections: +.BR + Introduction, + Commands, + Page Format, + etc.0 +.crsp +.in 8 END EXAMPLE +.sinch 8.5,6.5,11,9,1 +.sp +.sect +.un 8 +CRSP +.br + When not in NOFILL mode, carriage returns cause spaces, instead of breaks. + (The default. Opposite of CRBR.) +.sp +.sect +.un 8 +SPBR B +.br + Leading spaces or tabs (see section 7, Spaces and Tabs), cause a break. + (The default. Opposite of SPSP.) + Tabs and spaces that cause breaks will appear in the output + text. (They will not be compacted by SPCOMP. See section 12, + Periods and Punctuation.) +.sp +.sect +.un 8 +SPSP +.br + Opposite of SPBR. + This command is useful for allowing text which will be indented in the output + to also be indented in the input, + without worrying about where that text will be broken. +.in 4 EXAMPLE +.crbr + 1.SPSP + As Arthur Koestler has remarked, + .INDENT 4 +.rin 4 + "Asians have a tendency to lay the blame for this decline + on the soul-destroying influence of the West, + and Western intellectuals are inclined to accept the blame." +.rin -4 +.crsp +.SPSP + 2As Arthur Koestler has remarked, +.rin 4 + "Asians have a tendency to lay the blame for this decline + on the soul-destroying influence of the West, + and Western intellectuals are inclined to accept the blame."0 +.in 8 END EXAMPLE +.sp + SPSP works this way because the leading spaces + in the indented lines are compacted in ADJUST mode. To do this in + FILL mode use the SPCOMP command. (See section 12, Periods and Punctuation.) +.in 0 +.chap +.he2 +Blank Lines +.pa +.sect +Blank Lines + +This section deals with how to leave extra spacing (blank lines) in a page. +Extra spacing can be left with the commands described, or by leaving blank lines +in the input text. + +TJ6 is not as clever about blank input lines as it is about the SPACE command. +Consecutive blank input lines may be split across a page boundary in the output. +When in NOFILL mode, blank input lines appear as blank output lines. +This is the default condition in FILL or ADJUST mode, but may be turned off and +on with CRCOMP and CRRETA. + +.sect +.of 8 +SINGLE B +.un 7 + SS +.br + Single space the output text. + (The default spacing.) +.in 4 EXAMPLE +.crbr + 1.SINGLE + These two lines are + single spaced. + 2These two lines are + single spaced.0 +.crsp +.in 8 END EXAMPLE +.sp +.sect +.un 8 +DOUBLE B +.un 7 + DS +.br + Double space output text. +.in 4 EXAMPLE +.crbr + 1.DOUBLE + These two lines are + double spaced.0 +.DOUBLE + 2These two lines are +.ss + double spaced.0 +.crsp +.in 8 END EXAMPLE + SINGLE and DOUBLE take effect when the next line is output, + not immediately. +.in 4 EXAMPLE +.crbr + 1These + .DOUBLE + four + .SINGLE + little + lines. + 2These +.DOUBLE + four +.SINGLE + little + lines.0 +.crsp +.in 8 END EXAMPLE +.sp +.sect +.un 8 +SPACE B +.un 7 + SP +.br + Insert contiguous blank lines in the output text. + (When DOUBLE spacing, leave 2* blank lines.) + (If not enough space at end of page, does a PAGE. + SPACE is slightly cleverer than blank lines in the input text, in that + SPACE 1 is ignored at the top of page.) +.in 4 EXAMPLE +.block 7 +.crbr + 1Blank + .SPACE + Line0 + 2Blank +.SPACE + Line0 +.block 10 +.un -4 + But when double spacing, + 1.DOUBLE + Blank + .SPACE + Line2 + Blank +.DOUBLE +.SPACE +.ss + Line0 +.crsp +.in 8 END EXAMPLE + (Compare this with the next example.) +.sp +.sect +.un 8 +ASP B +.br + Absolute space. Just like SPACE, but + inserts blank lines in the output text regardless of + whether one is SINGLE or DOUBLE spacing. +.in 4 EXAMPLE +.crbr +.block 7 + 1.DOUBLE + Blank + .ASP + Line2 +.DOUBLE + Blank +.ASP +.ss + Line0 +.crsp +.in 8 END EXAMPLE +.ad + (Compare this with the previous example.) +.sp +.sect +.un 8 +FIGURE +.br + Leave contiguous blank lines at the next available break. + If there is room on the current output page, + leave blank lines at the next break; + if no room on the current output page, at the top of the next page. + (The argument is an absolute number of lines and is not affected by SINGLE + or DOUBLE spacing.) + FIGURE is really iterative, i.e., if there is not space + at the top of the next output page, (due to an earlier FIGURE), + leave space at the top of the next available page. +.in 4 EXAMPLE +.crbr + 1This command + .FIGURE 3 + causes three consecutive blank lines to be left somewhere, without + interrupting the output stream at the command.0 +.crsp +.block 6 + 2This command +.FIGURE 3 + causes three consecutive blank lines to be left somewhere, without + interrupting the output stream at the command.0 +.in 8 END EXAMPLE + Another way of leaving room for illustrations is with the BLOCK + command. (See section 9, Pagination.) +.sp +.sect +.un 8 +FINCH +.br + Like FIGURE, but argument in inches. +.in 4 EXAMPLE +.crbr + 1Just as in the previous example, + .FINCH 0.5 + there should be a one half inch figure + somewhere in the middle of this line.0 +.crsp + 2Just as in the previous example, +.FINCH 0.5 + there should be a one half inch figure + somewhere in the middle of this line.0 +.in 8 END EXAMPLE +.sp +.sect +.un 8 +CRRETA B +.br + Retain redundant carriage returns. + (The default. Opposite of CRCOMP.) +.block 8 +.in 4 EXAMPLE +.crbr + 1.CRETA + Blank + + Line + 2Blank + + Line0 +.crsp +.in 8 END EXAMPLE + (Compare this with the next example.) +.sp +.sect +.un 8 +CRCOMP B +.br + When not in NOFILL mode, compact redundant carriage returns. + (Opposite of CRRETA.) +.in 4 EXAMPLE +.block 8 +.crbr + 1.CRCOMP + Blank + + Line0 +.ad +.crsp +.CRCOMP +.un -4 + prints as: +.br + 2Blank + + Line0 +.crreta +.crsp +.in 8 END EXAMPLE + The total effect of carriage returns is determined not only + by CRRETA and CRCOMP, but also by CRBR and CRSP. + (See section 5, Breaking.) +.tabfnt 2 THE TABFNT IS 2 FOR THIS SECTION +.chap +.he2 +Spaces and Tabs +.in 0 +.adjust +.pa +.sect +Leading Spaces and Tabstops + +When using variable width fonts, TJ6 goes to some extra trouble in order to: +.in 8 +.un 2 + 1) Make things which are aligned with tabs in TECO also align in TJ6; +.in 4 EXAMPLE +.crbr + 1.NOFILL + 123456789 + iiiiiitabstop + WWWWWWtabstop0 +.nf +2123456789 +iiiiii tabstop +WWWWWW tabstop0 +.ad +.crsp +.in 8 END EXAMPLE + There is a tab after the i's and W's, so the word "tabstop" is aligned + in both input and output. + +.un 2 + 2) Make spaces at the beginning of a line equivalent to INDENT . +.in 4 EXAMPLE +.crbr + 1_One leading space is the same as + .INDENT 1 + indenting one. + 2_One leading space is the same as +.un -1 + indenting one.0 +.crsp +.in 8 END EXAMPLE + +.un 2 + 3) and since in TECO and ITS generally, there is a tabstop every 8 spaces, + TJ6 makes INDENT equivalent to tabs; +.sp + To accomplish this, the size of a space at the beginning of a line; + the size of indentation units; and the size of the TW and PW unit, + referred to as the "spacing unit", + will not necessarily be equal to the size of a space + in any font. + (In particular, note that the size of a leading space is usually different from + the size of a space in the middle of a line. The former is a spacing unit, + the latter is a space in the appropriate font.) + Compare +.in 4 EXAMPLE +.crbr + 2______six leading spaces with + six imbedded spaces.0 +.crsp +.in 8 END EXAMPLE +.sp + Leading spaces and tabs are tabs which appear at the beginning of a line + with no other characters before them on the line. A line with + in-text characters preceeding spaces does not have leading spaces, e.g., +.in 4 EXAMPLE +.crbr + 1_This line has a leading space. +  This line does not. + 2_This line has a leading space. + This line does not.0 +.crsp +.in 8 END EXAMPLE +.sp + The default size of the spacing unit is + the size of the widest character in FONT 0. + In the 2microgramma0 font, 2W0 is the widest character, + so if FONT 0 is 25VMIC, 2W0 is the spacing unit. Then, +.in 4 EXAMPLE +.crbr + 2_One leading space is the same width as + 1.INDENT 12 +.rin 1 + indenting one, and also the same width as a +.rin -1 + W.0 +.crsp +.in 8 END EXAMPLE +.sp + A tab stop is equal to 8 spacing units. + (Of course, if font 0 is fixed width, the spacing unit is identical to + a FONT 0 space, and a tab equals eight spaces.) + Leading tabs and spaces are all printed in spacing units. + The following commands all use the spacing unit as the unit of their argument: + INDENT, UNDENT, OF, RINDEN, RTW, PW, and TW. + (PW and TW actually are internally translated to TWINCH and + PWINCH, so that changing the size of the spacing unit will not change the + text width or paper width.) +.sp + The default is chosen on the assumption that all the characters to the left of + tabstops are in FONT 0. If this is not true, you should probably use: +.sp +.sect +.un 8 +TABFNT +.br + where is the only or largest font which will always be to the left + of tabs, or =-1 if any font can be to the left of tabs. + Make the spacing unit the largest character in FONT , + or if =-1, make the spacing unit the largest character in all fonts. + The default is TABFNT 0. + For example, the largest character in both 25VMIC and 25VG is W, but in + 25VMIC it's 28 XGP dots wide, while in 25VG it's 23 wide. +.in 4 EXAMPLE +.block 8 +.crbr + 1.FONT 0 25VG + .FONT 2 25VMIC + .TABFNT 2 + Tab in 25VMIC + .TABFNT 0 + Tab in 25VG +.crsp +.nf +.in 0 +.twinch 5.38 UGH!! bad interaction of width change with indents or RTW set +.c old width=28 Old IN 4 indented by 4*28=112 dots so text width +.c must change by 112/100 inch new TW = 6.5-1.12=5.38 +2 Tab in 25VMIC +.TABFNT 0 +0 Tab in 25VG +.TABFNT 2 +.adjust +.twinch 6.5 +.sp +.in 0 +.in 8 END EXAMPLE +.sect +.un 8 +SPW +.br + Set the size of the spacing unit to XGP dots. + For example, + in 25FR, all characters are 17 XGP dots wide. +.in 4 EXAMPLE +.crbr +2WWWWW +_A leading space is normally 28 dots wide, but with +1.SPW 17 +1_2it's 17 dots wide. +WWWWW0 +.ad +.crsp +.in 8 END EXAMPLE +.sp + One of the results of all this is that if the TABFNT is variable width, + tabstops will be much larger than expected, and there will be a gross difference + between leading and imbedded spaces. (Look at the previous examples.) + The spacing unit with 25VMIC is 100% larger than with 25FGB. The large spacing + unit size is necessary to guarantee alignment of tabstops. If there can be + 7 microgramma 2W0's to the left of a tabstop, than a tab obviously in the + worst case should be 8 2W0's wide. + Most of the time, you won't have the worst case (all wide characters within a + tabstop), and you can get away with a SPW 16 (width of 25FG). + This will result in indentations and tabs whose size is intuitively + more expected. +.br +.tabfnt 0 +.in 0 +.chap +.he2 +Horizontal Margins +.pa +.section +Horizontal Margins + +This section deals with changing the margins of text within the area declared +by the page format commands (PW and TW). +.sp +.sect +.of 8 +INDENT B +.un 7 + IN +.br + Indent the text left margin by "spacing units". + (See section 7, Spaces and Tabs.) +.in 4 +.crbr + 1.INDENT 2 + Indents two spaces. +.un -2 + 2Indents two spaces.0 +.crsp +.in 8 +.sp +.sect +.un 8 +RINDEN B +.un 7 + RIN +.br + Increment the indentation by . may be negative. +.in 4 EXAMPLE +.crbr + 1.RINDEN 1 + Indent one. + .RINDEN 1 + Indent one more. +.RINDEN 1 + 2Indent one. +.RINDEN 1 + Indent one more.0 +.crsp +.in 8 END EXAMPLE +.sp +.sect +.un 8 +UNDENT B +.un 7 + UN +.br + Start the next line "spacing units" left of the current INDENTation. + You may not UNDENT past the left margin. + Undent should appear immediately before the line to be UNDENTed. + (See INDENT and section 7, Spaces and Tabs.) +.in 4 EXAMPLE +.crbr + 1Cox's lecture begins, + .UNDENT -8 + "To understand our labor laws one must first understand the genius + of our labor movement." + 2Cox's lecture begins, +.crsp +.UNDENT -8 + "To understand our labor laws one must first understand the genius + of our labor movement."0 +.ad +.in 8 END EXAMPLE +.sp +.sect +.un 8 +OF B +.br + Increase the indentation by after the next line is output. + (Just like +.un -8 + .RIN +.un -8 + .UN .) +.in 4 EXAMPLE +.crbr + 1.OF 4 + "Although negotiation carries its own compulsions, few 'voluntary' + agreements are executed in the absence of economic power." +.crsp +.ad +.of 4 + 2"Although negotiation carries its own compulsions, few 'voluntary' + agreements are executed in the absence of economic power."0 +.in 8 END EXAMPLE +.sp +.sect +.un 8 +RLINE B +.un 7 + RTW +.br + Decrease the text width by without affecting + where the header is printed. This command is really a way of + simultaneously indenting both left and right margin. + The amount of additional indentation which will appear on + either side is determined by SIDM. (See section 3, Page Format.) +.in 4 EXAMPLE +.fi +.spcomp + 1"The only functions of law, it is thought, are: +.br + .RTW 4 +.br + (1) to protect the formation of unions, so that employees may exert + sufficient bargaining power to solve the problems of workers in an industrial + society; and +.br + .BREAK +.br + (2) to provide the framework for negotiations between the employer and employees..." +.ad + 2"The only functions of law, it is thought, are: +.RTW 4 + (1) to protect the formation of unions, so that employees may exert + sufficient bargaining power to solve the problems of workers in an industrial + society; and +.BREAK + (2) to provide the framework for negotiations between the empoyer and employees..."0 +.RTW -4 +.ad +.in 8 END EXAMPLE + Note that is the total increment to the indentation of both + sides. Since, in this memo, SIDM is 50, the total indentation of 4 + is divided equally into 2 for the left margin and 2 for the right. +.in 0 +.chap +.he2 +Pagination +.pa +.sect +Pagination + +This section deals with forcing TJ6 to start a new output page, and with the +page number which appears in the heading. (Also see section 10, Headings.) +The page number is normally an integer, but can be made into a "decimal", +consisting of . through the CHAP command. +The first output page is page number 1. + +.sect +.of 8 +PAGE B +.un 7 + PA +.br + Start a new output page and increment page number by . + If no argument increment by one. + Note that there is a difference between PAGE and n PAGEs. + The former starts a new page with a number higher than the + current page, while the latter actually prints n-1 blank pages. +.sp +.sect +.un 8 +BLOCK B +.br + If there is not room for lines of text on this page, + begin a new output page. + BLOCK takes into account whether you are SINGLE or DOUBLE spacing. + I.E., BLOCK n when DOUBLE spacing leaves twice as much space + as when SINGLE spacing. +.sp +.sect +.un 8 +ABLOCK B +.br + If there are less than lines left on this page, + begin a new output page. + ABLOCK does not take into account SINGLE or DOUBLE spacing. + ABLOCK is useful as a substitute for FIGURE, when you want a diagram + to appear at that spot in the text, e.g., +.in 4 EXAMPLE +.crbr + 1.ABLOCK 3 + .SPACE 30 +.ablock 3 +.space 3 +.crsp +.in 8 END EXAMPLE + (The ABLOCK prevents the SPACE from being split by a page boundary.) +.sp +.sect +.un 8 +SPAGE +.br + Set page number at the next page break to . + (A page break is when TJ6 has too much text to put on a page, + or a new page is forced by a PAGE, BLOCK, or other command.) + (SPAGE with no argument makes the next page number one.) +.sp +.sect +.un 8 +EPAGE +.un 7 + EP +.br + Increment the page number by at the next page boundary. +.sp +.sect +.un 8 +PD B +.br + Odd page force. Do a PAGE, and if the next page number would not + be odd, do an EPAGE to make it odd. +.sp +.sect +.un 8 +PV B +.br + Even page force. Works like PD. +.sp +.sect +.un 8 +CHAP B +.br + Does an SPAGE 1, and + if 0, causes + to be printed before page number in headings (see section 10, Headings). + If there is no argument, the chapter number is incremented. + This page was started with: +.in 4 EXAMPLE +.crbr + 1.CHAP 9 + .PAGE + Pagination0 +.crsp +.in 8 END EXAMPLE +.in 0 +.chap +.he2 +Headings +.pa +.sect +Headings + +This section deals with headings -- where and when they are printed. +The default TJ6 heading is "PAGE " followed by the page number, +all printed in font 0 (see section 14, XGP), +and appearing one line from the top of the +page, aligned with the right margin (set by TW, TWINCH, etc.) +The heading is not normally printed on the first page (page 1). +Even though TJ6 has a default heading, it's a good idea to always +define a heading line, as this gives TJ6 an accurate idea of the +heading width. +(The width is calculated when the heading is defined, but is only +roughly estimated for the deafult heading, since TJ6 doesn't know +in advance what font 0 will look like. Therefore, headings should +always be defined after the fonts are given.) + +.sect +.of 8 +HEADER B +.un 7 + HEADIN +.un 7 + HE +.br + The very next input line will be printed by TJ6 as the heading, + followed immediately by the page number. (TJ6 won't insert + a space between the HEADER and the page number, so make sure + that you do.) In-text character commands (see section 16) + can appear as input in HEADER lines. For instance, +.in 4 EXAMPLE +.crbr + 1.HEADER + Important memo_0 +.un -4 + is output as: +.ri +2Important memo 17760 +.un -4 + but, without the final space + 1.HEADER + Important memo0 +.ri +2Important memo17760 +.crsp +.ad +.in 8 END EXAMPLE + Another common mistake is to try to put a command line between + the HEADER command line and the header. The very next line after + .HEADER will be intrepreted as the desired heading. +.sp +.sect +.un 8 +HE1 B +.br + Make the header a SPREAD line with the page number in the middle, + and the very next input line on the left. + The center field of the heading is the page number, and the + right field is defined with HE2. + This memo's heading was generated with +.in 4 EXAMPLE +.crbr + 1.HE1 + TJ6 Text Justifier0 +.crsp +.in 8 END EXAMPLE +.sp +.sect +.un 8 +HE2 B +.br + Make the header a SPREAD line with the page number in the middle, + and the very next input line on the right. + This section of the memo starts with +.in 4 EXAMPLE +.crbr + 1.CHAP 10 + .HE2 + Headings + .PAGE0 +.crsp +.in 8 END EXAMPLE + Note the interaction between HE1 and HE2. The begin underline () + at the start of the HE1 field is finished with an end underline () + at the end of the HE2 field, so that the whole heading, including + page number, is underscored. +.sp +.sect +.un 8 +NOHEAD BZ +.br + Don't print a heading line. (NOHEAD 0 turns it back on.) +.sp +.sect +.un 8 +PHP1 Z +.br + Print header on page one. + (The default is no heading on page 1 -- PHP1 0.) +.sp +.sect +.un 8 +THESIS B +.br + Print the header inside of the text margins, + instead of 2 lines from the top of the page. + (Make header appear where the first text line normally + would appear.) +.sp +.sect +.un 8 +HEADPW BZ +.block 3 + Align header with full page width (set by PW rather that TW). + For instance, the heading on this page would be +.in 4 EXAMPLE + 1.HEADPW0 +.twinch 8.5 +.spread +/TJ6 Text Justifier/10.2/Headings/ +.twinch 6.5 +.ad +.in 8 END EXAMPLE +.in 0 +.chap +.he2 +Sections and Table of Contents +.pa +.section +Sections and Table of Contents + +This section deals with TJ6's cheap table of contents feature, +and some commands affecting it. +Since TJ6 is a one-pass compiler, the user has to run TJ6 twice +to get a finished table of contents. (Two-pass compilers like +PUB don't have this problem.) The first time, TJ6 is run with +the /C switch. (See section 17, Console Operation.) On that run, TJ6 +outputs a file, suitable for TJ6 input, which contains section titles +and page numbers. +When TJ6 is run on that file, a neat looking +table of contents will result. +The source file for this memo is TJ6;TJ6MEM >. The DDT command line +.un -4 + 1:TJ6 TJ6MEM /C0 +.br +results in the file TJ6;TJ6MEM CONTEN, which looks like this: +.in 4 +.crbr + 1.C TJ6-generated Contents + .Spread + /Introduction//1.1/ + .Spread + /Conventions//1.1/ + .Spread + /Commands//2.1/ + .Spread + /Page Format//3.1/ + .Spread + /PL B//3.1/0 + etc. +.crsp +.in 0 +When fed back to TJ6, TJ6MEM CONTEN results in the table of contents +for this memo. (Actually, TJ6MEM > inserts the file TJ6MEM CONTEN, +as well as the file TJ6MEM INDEX, which is merely the CONTEN file +modified with a simple TECO alphabetizing command.) +.sp +.sect +.of 8 +SECTIO B +.un 7 + SECT +.br + The next output line is a section title which will + be used when TJ6 outputs a table of contents. (See /C.) + SECT also does a BLOCK 2, so that the section title and first line will + not appear on seperate pages. (See SBLOCK.) + This paragraph of this memo starts with +.in 4 EXAMPLE +.crbr + 1.sect + .of 8 + SECTIO B0 +.un -4 + The appropriate line in the CONTENts file is + 1.Spread + /SECTIO B//11.1/0 +.un -4 + which finally appears in the table of contents (page 2) as +.in 0 +.rtw 15 +.spread +/SECTIO B//11.1/ +.rtw -15 +.crsp +.in 8 END EXAMPLE +.sp +.sect +.un 8 +SBLOCK +.br + Set the size of the .BLOCK implied by .SECT to . + (The default is SBLOCK 2, so that a section title + and the first line of the section will appear on the same page.) +.sp +.sect +.un 8 +STERM +.br + Set the .SPREAD separator used by TJ6 in writing a table of contents. + This command is useful when a / must appear in the section title. + For instance +.in 4 EXAMPLE +.crbr + 1.STERM | + .SECTIO + /C0 +.un -4 + appears in the CONTENts file as + 1.Spread + |/C||17.1|0 +.block 4 +.un -4 + but without the .STERM |, would appear as + 1//C//17.1/ +.un -4 + 0which would print as +.ce +2C0 +.crsp +.ad +.in 8 END EXAMPLE +.in 0 +.chap +.he2 +Periods and Punctuation +.pa +.sect +Periods and Punctuation + +The handling of periods and punctuation is one area in which TJ6 tries harder +and has more hair than PUB. When adjusting, TJ6 tries to put two spaces +after each of the following characters at the end of a sentence or clause: +., ?, !, :, and ;. +When justifying, TJ6 will also try to add space at the end of a sentence +before adding space between words. +.rtw 2 + TJ6's algorithm for determining whether one of . ? ! : ; ends a clause or + sentence is, given the following character sequence, with . standing for + all the punctuation characters: +.ce +1AB.CD0, + the . is the end of a clause or sentence if C is a carriage return or line feed; + otherwise, +.crbr + this is not the end of a clause or sentence if: + B is a number; or + B is a letter and A is a space, tab, one of .?!:;; or + C is not a space, tab, carriage return or line feed, or one of )]"'; or + C is one or more of )]"' and D is not a space, tab, carriage return, or line feed. +.crsp + In cases like 11AB.)0, the two spaces and justifying spaces are inserted + after the 1)0. + TJ6 will determine that the following do end clauses: +.in 4 +.crbr +.fi + 1End. End; "End." ("End.") End"]) +.ad + 2End. End; "End." ("End.") End"])0 +.un 2 + and the following do not: +.fi + 1No.end 1.414 !n. J. Cohen .no no!)))o +.ad + 2No.end 1.414 !n. J. Cohen .no no!)))o0, +.un 2 + but beware +.fi + 1Mr. Cohen +.ad + 2Mr. Cohen0 +.crsp +.in 2 + which TJ6 thinks is the end of a sentence. +.rtw -2 +When in ADJUST mode, TJ6 removes any extra spaces between words in order +to make it easier to decide where to put in justifying spaces. Therefore, +in adjust mode, the following all have the same affect as one space: +tab, tabs, spaces, or combinations thereof. +.in 4 + 1One spaceTwoTab +.br + 2One space Two Tab.0 +.in 0 +.sp +.sect +.of 8 +PERIOD , B +.br + Turns off special treatment of if =0, else turns it on. + can be any of .?!:; PERIOD with no arguments turns off + special treatment of all of .!?:; + When special treatment is turned off, TJ6 will no longer try to + insert two spaces after that character. +.sp +.sect +.un 8 +HALFAD B +.br + Fill the text (see FILL), + but flush more than 1 space or tab in a row (SRCOMP), + and insert two spaces after any .!?:; which ends a clause or sentence. + This is a fill mode for people who are sloppy with punctuation. +.in 4 EXAMPLE +.crbr +.fi + 1.HALFAD + See the perceptron! Run, perceptron, run! Both + previous sentences have only one space at the end. +.HALFAD +.crsp + 2See the perceptron! Run, perceptron, run! Both + previous sentences have only one space at the end.0 +.ad +.in 8 END EXAMPLE +.sp +.sect +.un 8 +SPCOMP +.br + When not in NOFILL mode, compact redundant spaces. + ADJUST and HALFAD do an automatic SPCOMP. + Spaces or tabs which cause breaks will not + be compacted. + (Opposite of SPRETA.) +.sp +.sect +.un 8 +SPRETA +.br + Retain redundant spaces. + NOFILL and FILL do an automatic SPRETA. + (Opposite of SPCOMP.) +.in 0 +.chap +.he2 +File Commands +.pa +.sect +File Commands + +0These commands give TJ6 the means to access other files. +The VERSE command and  (see section 16, In-text Character Commands) +allow for insertion of file names. + +.sect +.of 8 +INSRT +.br + Insert into the current input file. + INSRTs may not be nested more than 7 deep. + The source file for this memo is TJ6;TJ6MEM >, which + contains all sections but Contents, Error Messages, + and Index, which are inserted with +.in 4 EXAMPLE +.crbr + 1.INSRT TJ6;TJ6MEM CONTEN + .INSRT TJ6;ERROR > + .INSRT TJ6;TJ6MEM INDEX0 +.crsp +.IN 8 +.sp +.sect +.un 8 +APPEND +.un 7 + AP +.br + Append file to the input file here. +.sp +.sect +.un 8 +END B +.br + Ignore the rest of this file. + (A file need not end with this command. + END is useful when there is stuff at the end of the file + that one doesn't want printed. + This is useful for putting comments at the end of a file.) +.in 4 +.crbr + 1... which proves all the points set forth in this thesis. + .END + Not by a long shot!!! + 2... which proves all the points set forth in this thesis.0 +.crsp +.in 8 +.sp +.sect +.un 8 +VERSE +.br + Insert into the current TJ6 version number into the input stream. + (This is mostly useful as a command for debugging TJ6.) +.in 4 +.crbr + 1This memo was produced using + .VERSE +.crsp +2This memo was produced using +.VERSE +.in 8 + 0(The TJ6 source file is stored on the TJ6 directory. + The portion of VERSE before the period is the file name of the source. + The number after the period represents the number of patches + which have been made (number of bugs killed) since last reassembling. + The impure binary is on the SYSBIN directory, and the pure + binary on the SYS directory.) +.in 0 +.in 0 +.chap +.he2 +XGP Commands +.pa +.sect +XGP + +If you intend to use the XGP, there are special TJ6 commands which take +advantage of XGP and SCRIMP features such as: choice of fonts, super and +subscripts, underscoring. +In order to take advantage of these features, you must use TJ6's "XGP" command. +This also results in an output file in a strange looking format. + +.sect +.of 8 +XGP B +.br + Either this command or the /X switch (see section 17, Console Operation) + must be used to activate all XGP-type features. + If the output device is DSK, TJ6 will output a file + intended for printing on the XGP with a default second file name of XGP, + and will pay attention to other + XGP-only commands and in-text character commands: + FONT, SQUISH, VSP, NORMAL, NOSPEC, SCRIPT, BLADJU, PSCORE, + ,  , , and . + All of these commands will be ignored unless preceeded by XGP or + the /X switch is used. + Since XGP be ignored unless it appears before all input text, + it's a good idea to have this be the very first line of the input file. + (Since the output device must be DSK, you can cause TJ6 to ignore + the XGP command by outputting to TTY, AI, etc.) + The output file created by TJ6 for the XGP is designed to + be used by AI ITS' SCRIMP program, and contains coded data for + the XGP, as well as the output text. + (The XGP character interpretation is described in + AI Working Paper Number 72, XGP Font Catalog.) +.sp +.sect +.un 8 +FONT B +.br + Causes the font file to be associated with font (character set) + number . + When the output file is finally printed on the XGP, it will appear in the + designated fonts. + (The font file must be in KST format. See Working Paper #78 if you want to + design your own font.) + TJ6 has six fonts numbered 0 through 5, and starts printing in + font 0. Fonts are switched with the  in-text command. + (See section 16, In-text Character Commands.) + FONT is ignored if not preceeded by /X switch or XGP command + and must appear before text. + FONT 0 is special in that it is normally used to determine the + size of tabs and leading spaces, (see section 7,) and all fonts are + assumed to be the same height. (I.E., although TJ6 understands + variable width fonts, it assumes all lines of text are equal in height. + This results in a page which is too long if the page contains + lots of super or subscripts, or lots of text in a font which is + taller than FONT 0.) + The default FONT 0 is 25FG. There is no default for higher fonts. + A good place to have the FONT specifications is immediately after + the XGP command. The source file for this memo starts with +.crbr +.in 4 + 1.XGP + .FONT 0 25vg + .FONT 1 25fr + .FONT 2 25vmic + .FONT 3 25vri0 +.crsp +.in 8 +.sp +.sect +.un 8 +SQUISH +.br + This causes a ;SQUISH to appear on the XGP command page. + ;SQUISH causes the XGP program to minimize the number of font + character rasters shipped to the XGP's PDP11 and stored there. + SCRIMP squishes by reading the entire file before sending fonts + to the PDP11. It then sends only the rasters for characters + which appear in the TJ6'ed file. + (Normally, SCRIMP sends to the PDP11 and stores there the raster + for every character in all the FONTs you used. Because of the + limited size of the PDP11's memory, it sometimes does not have room for + all those rasters.) SQUISH is useful when SCRIMP types out a + "CHARACTERS LOST" error message. +.sp +.sect +.un 8 +VSP B +.br + Set XGP interline spacing to scan lines. + This command must appear before all text. + VSP is normally 6, i.e., 1/32 inch. +.sp +.sect +.un 8 +NORMAL +.br + If =0, or no argument, don't print quoted characters on + XGP in normal mode. + (The default is normalized characters -- NORMAL 1.) + Certain characters: +  (null), +  (backspace), +  (tab), +  (linefeed), +  (formfeed), + î (carriage return), and +  (rubout), + are interpreted by SCRIMP and the XGP as commands, + unless they are quoted to the XGP (in which case they are simply printed + as characters). Whenever one of these characters is quoted in + the TJ6 source file, TJ6 will in turn quote it to the XGP. + The quoting of formatting characters to force them to be printing + characters is "normalization". + (To avoid this, use NORMAL 0.) +.block 5 +.in 4 EXAMPLE +.crbr + 1W| + .NORMAL 0 + W| + 2W| +.NORMAL 0 + W|0 +.normal +.crsp +.in 8 END EXAMPLE + The quoted backspace is usually output as a lambda. In non-normal mode, + the quoted backspace is passed on to the XGP as a backspace. +.sp +.sect +.un 8 +NOSPEC B +.br + Don't output an XGP command page. In XGP mode, TJ6 normally outputs + a page of SCRIMP commands which looks like +.in 4 EXAMPLE +.crbr + 1;SIZE 11 + ;VSP 6 + ;TOPMAR 0 + ;BOTMAR 0 + ;LFTMAR 0 + ;SKIP 1 + ;KSET FONTS;25VG KST,FONTS;25FR KST,FONTS;25VMIC KST,,, + AI:JDC;NNTJ6 10.00 +.crsp +.in 8 END EXAMPLE + By making the left margin 0, (SIDM 0), and using NOSPEC, the + user may, for his own perverse reasons, output his own SCRIMP command page. +.sp +.sect +.un 8 +SCRIPT +.br + Set the number of XGP lines that  (superscript) or  (subscript) + will raise or lower the baseline. + (See section 16, In-text Character Commands.) + (The default is SCRIPT 12, 1/16 inch.) +.in 4 EXAMPLE +.crbr + 1.SCRIPT 12 + E=MC 12 + .SCRIPT 6 + MC 6=E +.crsp + 2E=MC 12 +.SCRIPT 6 + MC 6=E0 +.script 12 +.in 8 END EXAMPLE +.sp +.sect +.un 8 +BLADJU +.br + Sets the baseline to amount. + is up. + BLADJU 0 is the same as . + must be between -64 and +63. +.in 4 EXAMPLE +.crbr + 1E=MC + .BLADJU 8 + 8 +.crsp + 2E=MC +.BLADJU 8 + 80 +.in 8 END EXAMPLE +.sp +.sect +.un 8 +PSCORE +.br + Sets the position of underscoring to scan lines below font base line. + (- is up.) Underscoring done with the  and  in-text command characters + is normally 3 XGP scan lines below the font base line (PSCORE 3). +.in 4 EXAMPLE +.crbr + 1Ordinary underline (PSCORE 3) + .PSCORE 0 + Raised underscore +.crsp + 2Ordinary underline (PSCORE 3) +.PSCORE 0 + Raised underscore0 +.pscore 3 +.in 8 END EXAMPLE +.chap +.he2 +Miscellaneous Commands +.pa +.in 0 +.sect +Miscellaneous Commands + +.sect +.of 8 +COMMEN +.un 7 + C +.br + Treat the entire command line as a comment. +.in 4 EXAMPLE +.crbr + 1Winnie + .COMMEN I like Piglet lots. + the Pooh +.crsp + 2Winnie +.COMMEN I like Piglet lots. + the Pooh0 +.in 8 END EXAMPLE + (But remember that excess on any command line is also treated as a comment.) +.in 4 EXAMPLE +.crbr + 1Winnie + .UNDENT -2 I also like Eeyore and Rabbit. + the Pooh +.crsp + 2Winnie +.UNDENT -2 I also like Eeyore and Rabbit. + the Pooh0 +.in 8 END EXAMPLE +.sp +.sect +.un 8 +DUMMY B +.br + If no second argument or 0, + defines a character which will be treated a letter internally, + but print as a space on output. + If =0, turns off DUMMYing for that character. + (There is no default DUMMY character. There may be more than one dummy.) +.in 4 EXAMPLE +.crbr + 1.DUMMY  + 124. +.DUMMY  + 2124.0 +.DUMMY  0 +.crsp +.in 8 END EXAMPLE +.sp +.sect +.un 8 +QUOTE B +.br + becomes the TJ6 quoting character, which is used + in input text to quote the following character. + (Also see section 16, In-text Character Commands.) + To turn off use QUOTE with no argument. + (The default is QUOTE . (control Q)) +.in 4 EXAMPLE +.crbr + 1.QUOTE  +.quote  +  + 20 +.quote  +.crsp +.in 8 END EXAMPLE +.sp +.sect +.un 8 +TRANS ab,cd, . . . +.br + On input, translate character to , to , etc. + Characters are not translated within command lines. + To undo, "translate" the character back to itself. +.in 4 EXAMPLE +.crbr + 1.TRANS WD,eu,lt,sc + Welsh + .TRANS WW,ee,ll,ss + Welsh +.TRANS WD,eu,lt,sc + 2Welsh +.TRANS WW,ee,ll,ss + Welsh0 +.crsp +.in 8 END EXAMPLE + (Since translation occurs before interpretation of in-text commands, + TRANS can be used in the same way as PUB's TURN ON FOR.) +.sp +.sect +.un 8 +GENNUM +.br + Increment GENNUM counter number + by and insert the incremented number. + If no second argument, use counter 1. + If no arguments, increment counter 1 by 1. + TJ6 has eight GENNUM counters numbered 1-8. +.in 4 EXAMPLE +.crbr + 1.GENNUM + .GENNUM 3 + .GENNUM 2 12 +.crsp +.GENNUM 1 8 +.GENNUM 3 8 +.GENNUM 2 8 +.in 8 END EXAMPLE + 0To get GENNUMs without contiguous spaces, use the  in-text + command. (See section 16, In-text Character Commands.) +.sp +.sect +.un 8 +GENSET +.br + Set GENNUM counter number to -1, + so that when the next GENNUM or  is used, will appear. + If no second argument, use counter 1. If no arguments, + reset counter number 1 to 0. +.in 4 EXAMPLE +.crbr + 1.GENSET 1 1 + .GENNUM2 +.GENSET 1 8 +.GENNUM 1 8 +.crsp +.in 8 END EXAMPLE +.sp +.sect +.un 8 +0ULFONT B +.br + If not using the XGP, underscore all characters in font number . + When not using the XGP, + this command is handy for causing an italic XGP font to be replaced + by underscoring. + (Only one font at a time can be the ULFONT.) +.in 4 EXAMPLE +.crbr + 1.ULFONT 3 + Berman's book, 3Talks on American Law0, ...0 +.un -4 + appears on the XGP as, + 2Berman's book, 3Talks on American Law0, ...0 +.un -4 + but appears elsewhere as, + 1Berman's book, T_a_l_k_s__o_n__A_m_e_r_i_c_a_n__L_a_w_, ...0 +.crsp +.in 8 END EXAMPLE +.chap +.he2 +In-text Character Commands +.pa +.in 0 +.sect +In-text Character Commands + +These are characters which appear in text lines, but have the effect of +commands. +(All in-text commands can also appear in HEADING lines.) +(They cannot be turned on and off as in PUB, but since translation +(see TRANS, section 15, Miscellaneous Commands) occurs before in-text +commands are interpreted, TRANS can be used as a sort of TURN ON FOR.) + +.sect +.of 8 +(control Y) +.br + Begin underscore. +.in 4 EXAMPLE +.crbr + 1The House at Pooh Corner + 2The House at Pooh Corner0 +.crsp +.in 8 END EXAMPLE + Don't forget to turn off underscoring with the  command. + TJ6 underscores by printing a backspace and underscore following + each underscored character, except on the XGP where the XGP + underscore commands are used. + (The location of the XGP underscore is controlled by the PSCORE + command. See section 14, XGP Commands.) + This means that on the XGP, an underscore made with the  and  + characters is different than one made by putting backspaces + and underbars in the input text. Compare: +.in 4 EXAMPLE +.crbr + 1The House at Pooh Corner. + T_h_e__H_o_u_s_e__a_t__P_o_o_h__C_o_r_n_e_r_. + 2The House at Pooh Corner. + T_h_e__H_o_u_s_e__a_t__P_o_o_h__C_o_r_n_e_r_.0 +.crsp +.in 8 END EXAMPLE + Use of  and  is preferred because it is: + easier to type in; easier to edit; + takes less space in the source file; + and looks better on the XGP than underbars. +.sp +.sect +.un 8 +(control X) +.br + End underscore. Used to terminate scope of  begin underscore command. +.sp +.sect +.un 8 +(control F) +.br + Select font number . + In this file fonts 0 through 3 are respectively: + 25VG, 25FG, 25VMIC, and 25VRI. +.in 4 EXAMPLE +.crbr + 1Fonts 0zero, 1one, 2two, and 3three. + 2Fonts 0zero, 1one, 2two, and 3three.0 +.crsp +.in 8 END EXAMPLE +.sp +.sect +.un 8 +(control G) +.br + Insert a generated number. This command has exactly the + same effect as GENNUM 1 , or with no argument, is the same + as GENNUM 1 1. It is more flexible than GENNUM, + however, since a GENNUMed number is surrounded by spaces. +.in 4 +.crbr + 1Figure 1. + 2Figure 1.0 +.crsp +.in 8 + If a GENNUM had been used here, there would have been a space + after the period. +.in 4 EXAMPLE +.crbr + 1Figure 1. + .GENNUM2 +.crsp +.GENSET + Figure 1. +.GENNUM +.in 8 END EXAMPLE +.sp +.sect +.un 8 +0 (control K) +.br + Superscript. (Raise baseline by SCRIPT.) + The baseline will continue to be raised untill changed by another +  or , or reset by a . +.in 4 EXAMPLE +.crbr + 1A2  n=Bn  2 + 2A2 n=Bn 20 +.crsp +.in 8 END EXAMPLE +.sp +.sect +.un 8 +(control A) +.br + Subscript. (Lower baseline by SCRIPT.) + See previous example. +.sp +.sect +.un 8 +(control W) +.br + Reset baseline to 0. + See previous example. +.sp +.block 4 +.sect +.un 8 +(control D) +.br + Insert date in format: Month day, Year. +.in 4 EXAMPLE +.crbr + 1Today is . + 2Today is .0 +.crsp +.in 8 END EXAMPLE +.sp +.sect +.un 8 +(control N) +.br + Insert current input file name in standard ITS format + DEV:SYSNAM;FNAM1 FNAM2. +.in 4 EXAMPLE +.crbr + 1The source for this section of the TJ6 memo is . + 2The source for this section of the TJ6 memo is .0 +.crsp +.in 8 END EXAMPLE +.sp +.sect +.un 8 +(control Q) +.br + Default QUOTE character. (See QUOTE.) +.in 4 EXAMPLE +.crbr + 1 + 2 +  + 0 +.crsp +.in 8 END EXAMPLE +.in 0 +.chap +.he2 +Console Operation, Switches +.pa +.adjust +.spsp +.in 0 +Console Operation + +TJ6 console operation is basically like that of most other compilers. +The program is started from DDT in the normal way. It takes two file +names as arguments, first the output name, then the input name. +It compiles the output file, typing out any errors it finds, and when +it is done, TJ6 kills itself. +.br +In this section 3italics0 will be used for all computer generated typeout. +.br +The following command strings will both compile the file JDC;TEST MEMO +from the source file JDC;TEST >: +.in 4 EXAMPLE +.crbr + 1TJ6 3! + NNTJ6 11.1 + _1JDC;TEST MEMO_JDC;TEST >0 +.un -4 + or simply + 1:TJ6 TEST0 +.crsp +.in 8 END EXAMPLE +.sp +.sect +.un 8 +Command Line Switches +.br + There are some special "commands" which can be given as part of + the original TJ6 command line, and which will be ignored when + part of a source file. + They are "command line switches" and consist of a / followed + by a character. +.sp +.sect +.un 8 +/C +.br + Output a table of contents intended for input to TJ6. + Make the output default second file name CONTEN instead of MEMO. + The table of contents will be a series of .SPREADs, + with the left field the .SECTIO section titles, and the right field + the page number. The separator will be / or a character defined by + STERM. + (See section 11, Sections and Table of Contents.) +.sp + Using the TJ6 contents feature requires running two passes of + TJ6, the one to produce the table of contents, the other to + produce the memo. + This memo has both a table of contents and a crude index which are + both INSRTed into the orginal file in order to produce the final + memo. + The DDT command string +.un 4 + 1:TJ6 TJ6;TJ6MEM /X/C0 +.br + uses TJ6;TJ6MEM >, and outputs only a table of contents as the + file TJ6;TJ6MEM CONTEN. TJ6MEM CONTEN is then alphabetized in TECO + to produce the index file TJ6;TJ6MEM INDEX. +.un 4 + 1:TJ6 TJ6;TJ6MEM /X0 +.br + uses TJ6;TJ6MEM > + to produce the final XGPable memo as the file TJ6;TJ6MEM XGP. +.sp + When using the /C command, make sure that TJ6 knows what + device the memo will eventually be output on, otherwise + the page numbers may be incorrect. If the memo is eventually + going to the XGP, make sure to use the /X or XGP command. + If not using the XGP, use neither command, or specify an + output device other than DSK. +.sp +.sect +.un 8 +/X +.br + Output for the XGP. + This command is ignored unless output is to DSK. + This switch is exactly the same as the XGP command. +.sp +.sect +.un 8 +/T +.br + Take input from the teletype before reading the specified + file. + TJ6 will type out the prompt character > and + treat input from the teletype as though it + appears at the beginning of the specified source file. + TJ6 will continue reading from the teletype untill you + type a ET, INSRT, or APPEND command. +.in 4 EXAMPLE +.crbr + 1TJ6 3! + NNTJ6 11.1 + _1TEST /T + 3>1.DS + 3>1.BEGIN 7 + 3>1.ET0 +.crsp +.in 8 END EXAMPLE +.sp +.in 0 +Although the following commands can appear in source files, they are usually +used with the /T command switch. +.in 8 +.sp +.sect +.un 8 +ET +.br + End teletype input, and take input from the file. + This is used to end the scope of the /T console command switch. +.sp +.sect +.un 8 +BEGIN +.br + Begin output with page number . + (This means page number n, not the nth page. For instance + if your text starts with page number 2, and you use + BEGIN 3, the output starts with page number 3, the second + page, not page number 4, the third page. +.sp +.sect +.un 8 +NOWAIT BZ +.br + Don't wait for a space to be typed on input console at start of each output page. + (Default for output to DSK, LPT, TPL, AI, ML, DM.) + +.chap +.he2 +Error Messages +.sp +.insrt tj6;error > +.in 0 +.chap +.he2 +History +.pa +.sect +Historical Note + +TJ6 was written in the late 1960's by Richard Greenblatt to facilitate the writing +of his paper on the chess program, and has since been "improved" by +almost every system programmer, and many other ITS users. This memo replaces one +written by Greenblatt, Horn, and Krakauer, +(AI Memo 164A, The Text-Justifier TJ6, Greenblatt, Horn, Krakauer, June 1970,) +which in turn replaced the first TJ6 memo, +(AI Memo 164, Producing Memos Using TJ6, TECO, and the +Type 37 Teletype, Krakauer, September, 1968). + +Many of the changes introduced to TJ6 have been to satisfy the whim of some +programmer for some formatting trick in his memo, but the major revisions represent +a history of the output hardware of the AI Lab. As seen by the title of the first memo, +TJ6 was first used to output to a model 37 Teletype. The second memo was +contemporary to our IBM Selectrics and had an appendix +entitled "The 'Selectric' output device". +Another appendix on "Inserting lower case letters into the TECO buffer" +was due to the lack of lower case terminals, and the need for a trick +to get lower case into the TECO buffer from our model 33 Teletypes +and GE "bagbiters" (Datanet 760's). + +The latest round of changes, made by +the author, is aimed mostly at the Xerox Graphic Printer. +TJ6 knows about variable width fonts, underlining, and other XGP features, +and much of the code relating to Selectrics has beeen removed. I have also +spent much time trying to straighten out some of the internal workings of the +program, and trying to make TJ6 a bit more human to use (by adding new features, +error messages, and defaults.) + +Another round of changes has been aimed at simplifying and speeding up TJ6, +largely by reducing it in size. This effort has been rewarded. TJ6 has been reduced +from about 14 to 6 pure pages, in spite of the addition of much code needed +to handle variable width fonts and the XGP. + +Although everyone probably has a favorite feature he or she would like added to +TJ6, the program will probably remain frozen. This freeze is a reaction +to the sorry state that TJ6 was once in, when everyone's favorite feature +of the week was added, and it became hard to run TJ6 without exciting +some sort of bug. + +Making changes to TJ6 is ordinarily difficult because of complicated +interactions among variables. This difficulty, plus the desire to keep +TJ6 small and fast militate against most changes. Although some features +will doubtless be added to TJ6, some of the most frequently requested +changes: footnotes, indices, etc., are absolutely out the question, +as they would require total rewriting of TJ6 to be a two pass compiler +like PUB. If that sort of feature is important to you, use PUB. +.sp +.sect +Bugs +.sp +I am glad to fix any TJ6 bugs, but I need a copy (or pointer to) the source +file that produces them. A bug which seems as though it could be +easily reproduced is often caused by some complicated interaction +of commands and text in the source file. It's frustrating to struggle +to reproduce such bugs, when someone should have saved me the trouble +by sending me a file that is know to do so. +.sp +.sect +Overprinting +.sp +Simple overprinting works correctly in TJ6, but overprinting coupled +with underlines, font shifts, or super- or subscripts will probably +not give you the desired output. This is because of TJ6's internal +line storage format. TJ6 stores lines column by column, with each +column stored as a linked list of characters. +When a printing character is read, it is CONSed onto the end of the +current column, and the column number is incremented. +Non-printing characters (n,  , , , , ,) +are CONSed to the end of the column list, but the column number is +not incremented. +Backspacing simply decrements the column number. +TJ6 then prints the line column by column, +centering all the characters in each column. +.in 8 + The input string: +.in 4 EXAMPLE +.crbr + 1ABCD0 +.un -4 + is stored internally as + Column 1: 1A B C0 + Column 2: 1D0 +.un -4 + and will be printed correctly. The input string + 1e3^0tre +.un -4 + 0is stored as + Column 1: 1e ^ 0 + Column 2: 13 0 t 0 + Column 3: 1r 0 + Column 4: 1e 0 +.crbr +.in 8 + Since all the characters in column 1 are printed before those in + column 2, the intended effect will be lost. However, +.crbr +.in 4 + 1e3^0tre +.un -4 + 0is stored as: + Column 1: 1e 3 ^ 0 + Column 2: 10 t 0 + Column 3: 1r 0 + Column 4: 1e 0 +.crsp +.in 8 END EXAMPLE + and prints correctly as +.un 4 + 2e0^2tre.0 +.br + (Since the internal line storage format is convenient for text + justification, and the combination of overstriking and font switching + is rarely used, it hardly seems worth the trouble to change + the internal format.) +.in 0 +.sp +.sect +Sources +.sp +Most of the strange quotations in this memo are from +Koestler's The Lotus and the Robot, and +Berman's Talks on American Law. +.sp +.sect +Files +.sp +Some of the ITS files related to TJ6 are: +.nf +TJ6;TJ6 > source for TJ6 +SYSBIN;TJ6 BIN assembled unpurified binary +SYS;TS TJ6 purified binary (This is what actually runs.) +SYS;TS OTJ6 antique version of TJ6 +TJ6;TJ6MEM > source for this memo +TJ6;TJ6MEM CONTEN contents for this memo +TJ6;ERROR > error messages for this memo +TJ6;TJ6MEM INDEX index of this memo +TJ6;RECENT > recent changes to TJ6 +TJ6;TJTST > TJ6 test file, INSRTs: +TJ6;SPTEST > INSRTed test file +TJ6;TABTST > INSRTed test file +.in 0 +.ad +.chap +.he2 +Sample Input +.pa +.sect +Sample Input + +.nf +1.fill +.center +Simple Sample +.SP +Here is a simple sample of some input and output intended primarily +for people who have never used TJ6. +The TJ6 input file is a mixture of text and command lines. +Command lines start with a period and tell TJ6 what to do with the +text. These lines are filled -- the left edges are aligned, and +the right edges don't go beyond the margin. +.sp +.adjust +These lines are adjusted -- both margins are exactly aligned. +In order to use TJ6, you must start the program from DDT, and +give TJ6 the name of an output and source file, separated by a _. +For instance, (text generated by the computer is underlined) +.nf +.in 8 +:TJ6 +NNTJ6 11.1 +_ TEST OUTPUT_TEST INPUT +.INDENT 0 +.ADJUST +If you don't give TJ6 an output file name, it will use the input first name +and MEMO, and if you don't give it an input second name it will use >. +For instance, the following lines have the same effect: +.nf + :TJ6 TEST + :TJ6 TEST MEMO_TEST >2 +.sp +.he2 +Sample Output +.fill +.center +2Simple Sample +.SP +Here is a simple sample of some input and output intended primarily +for people who have never used TJ6. +The TJ6 input file is a mixture of text and command lines. +Command lines start with a period and tell TJ6 what to do with the +text. These lines are filled -- the left edges are aligned, and +the right edges don't go beyond the margin. +.sp +.adjust +These lines are adjusted -- both margins are exactly aligned. +In order to use TJ6, you must start the program from DDT, and +give TJ6 the name of an output and source file, separated by a _. +For instance, (text generated by the computer is underlined) +.nf +.in 8 +:TJ6 +NNTJ6 11.1 +_ TEST OUTPUT_TEST INPUT +.INDENT 0 +.ADJUST +If you don't give TJ6 an output file name, it will use the input first name +and MEMO, and if you don't give it an input second name it will use >. +For instance, the following lines have the same effect: +.nf + :TJ6 TEST + :TJ6 TEST MEMO_TEST >0 +.ad +.in 0 +.chap +.he2 +Index +.pa +.sect +Index + +Note that this index is simply the TJ6 produced table of contents, as modified +by the TECO alphabetic sort command. +Section Titles are underlined. +.nf +.rtw 15 +.sp +.append TJ6;TJ6MEM INDEX + \ No newline at end of file diff --git a/src/tj6/tj6.28 b/src/tj6/tj6.28 new file mode 100644 index 00000000..6cc45114 --- /dev/null +++ b/src/tj6/tj6.28 @@ -0,0 +1,4512 @@ + +;title nntj6 +;Text justifier and adjuster +;impurities go at the beginning +.MLLIT==1 + +Z=0 ;flag register used in cmd +A=1 ;usually char +B=2 ;sometimes cdtab(character in a), sometimes command routine address +C=3 ;usually points into buff +D=4 ;width of char in a +E=5 +F=6 ;sometimes free storage pntr +G=7 ;xgp horiz pos +H=10 ;jsp to chrc & at xct rltbl(a) +I=11 ;used by chrc as pntr to next char +J=12 ;jsp to scnr1 +K=13 ;temporary in commands from file e.g. +L=14 +M=15 +W=16 ;width of current line in xgp dots + +P=17 ;pdl pointer +.XCREF A,B,C,D,H,K,P,Z +.XCREF CDTAB,LTYI,UTYI,TTYI + +MAXFNT==9 ;highest legal font +CSETSZ==200 ;size of character set +BUFSIZ==600 ;size of buff +SFS==<3*BUFSIZ>/2 ;size of free storage (fs) +HBUFL==120 ;size of header +PDLL==40 ;size of pdl +CMSWL==20 ;size of end-of-line call buffer +OBSIZ==200 ;size of output buffer for block iots +LFNTRNG==100 ;length of ring buffer of font changes + +ERR==1000 ;uuo for printing error comments +EGG==2000 ;print uuo +BUGR==3000 ;like err, but for internal bugs + +TYIC==1 ;type in +TYOC==2 ;type out +UTYIC==3 ;file input +UTYOC==4 ;file output +ERRC==5 ;error device in +FNTC==6 ;font channel in + +SCBIT==200000 ;On in BUFF if single char command +ARGBIT==100000 ;On if arg to single char command +XQUOBT==40000 ;Try to "normalize" quoted char +JUSBIT==1000 ;Prefer for justification (. ? ! at end of sentence) +BKBIT==400 ;Break (.?!:; at end of sentence or clause) +MKBIT==200 ;Marked space + +;On input (ie things in the source file) +BLDCH==^A ;Base line down +BLUCH==^K ;Base line up +BLZCH==^W ;Base line reset +BSCRCH==^Y ;Begin underscore +ESCRCH==^X ;End underscore +SFCH==^F ;Select font n +GENCH==^G ;Generate number (=.GENNUM 1) followed by counter number +FNMCH==^N ;File name +DATCH==^D ;Date +;On output (ie, things TJ6 puts in BUFF) +;BSCRCH +;ESCRCH ;End underscore followed by where it goes +;SFCH ;Followed by fnt # +BLSCH==BLZCH ;Base line set, followed by where +BLICH==BLDCH ;Base line increment, followd by that +ICSPCH==^Z ;Set intercharacter spacing +VSPCH==^_ ;Variable space +TABCH==^I ;Tab (for variable width) + +;XGP information +VRES==192. ;Resolution in dots per inch +HRES==200. ;Horizontal res +ULBUG==3 ;Underline bugger factor. # of dots below baseline + +;Chars sent to XGP +XGPESC==177 ;XGP escape +XRASET==40 ;SP= set raster position +XBASCH==43 ;#= set base line +STRTUL==46 ;&= start underscore +STOPUL==47 ;'= end underscore +XICHSP==50 ;( set intercharacter space + +;Program character dispatch table +;Flags in left half +CDIGF==1_0 ;Digit +CLETF==1_1 ;Letter +CDUMF==1_2 ;Dummy char, treated like letter +CQUOF==1_3 ;Quoting char +CEOLF==1_4 ;End of line char (cr of lf) +CEOSF==1_5 ;End of sentence (.?!) +CEOCF==1_6 ;End of clause (;:) +CSMSF==1_7 ;Space or marked space (240) +CHYPF==1_10 ;On if hyphen allowed to break +CHHYF==1_11 ;Hidden hyphen +CFSPF==1_12 ;Causes forward spacing (sp, tab) +CLOSF==1_13 ;"closing character" can follow super marked . -)]"' +CITCF==1_14 ;In text command   +CNNRF==1_15 ;Usual XGP meaning is not "normal" +CEOFF==1_16 ;Can appear at or past eof (^@ ^C ^L) +;Dispatch index in right half + CCOLX==1 ; : + CSEMX==2 ; ; + CSLSX==3 ; / + CSPCX==4 ; SP + CBKAX==5 ; _ + CCRTX==6 ; CR + CLNFX==7 ; LF + CLETX==10 ; UPPER CASE LETTER + CDIGX==11 ;Digit + CLLTX==12 ;lower case letter + CMINX==13 ; - + CRBOX==14 ;RBO + CFFDX==15 ;^L + CEOFX==16 ;^C + CQUOX==17 ;quote +; CTABX==20 ;tab +; CBLDX==21 ;^A +; CDATX==22 ;^D +; CFNTX==23 ;^F +; CGNMX==24 ;^G +; CFNMX==25 ;^N +; CBLZX==26 ;^W +; CBULX==27 ;^X +; CEULX==30 ;^Y +; CEOSX==31 ;! ? . +; CDUMX==32 ; +; CHHYX==33 ; +; C6BTX==34 ;6 bit but none of above +;CIDXL==35 ;Length of dispatch tables + C6BTX==20 +CIDXL==21 + +;macros +DEFINE PRINT ARG\ ;print error message (no CRLF) + EGG,,[ASCIZ /!ARG!/] +TERMIN +DEFINE BARF ARG\ ;error message+file locations (+CRLF) + ERR,,[ASCIZ /!ARG!/] +TERMIN +DEFINE BUG ARG\ ;TJ6BUG + BUGR,,[ASCIZ /!ARG!/] +TERMIN + +;INTERRUPT LOCATIONS +LOC 41 +JSR ERRH +JSR TSINT +LOC 100 + +;variables and other impurities +RAN: 0 ;-1 if program ran (prevents purification) + +ONAM: 0,,(SIXBIT /DSK/) ;to-file name + 0 + SIXBIT /MEMO/ +OSYSNM: -1 + +RNBLK==.-1 ;for final rename from tj6 output to memo + 0 ;called with .FDELE RNBLK + UTYOC + 0 + 0 + +RANTXT: BLOCK 10 ;for storage of random strings + RANMAX==5*<.-RANTXT> +RANCNT: 0 +RANIPT: 440700,,RANTXT ;for writing into rantxt +RANOPT: 440700,,RANTXT +RSYSNM: 0 ;initial system name +DATE: BLOCK 4 ;asciz date stored here +;these 4 must be in order (are printed like a file name) +ITSNAM: 0 ;machine name (AI,ML, or DM) +JNAME: .FNAM1 ;file name of tj6 + .FNAM2 +UNAME: 0 ;user name +;font stuff +FEOF: 0 ;font eof ptr +TFBLK: SIXBIT / &DSK/ ;font file specs temporarily stored here + SIXBIT /25FG/ ;default font + SIXBIT /KST/ + SIXBIT /FONTS/ + +FNTBLK: +FFDEV==. +FFSYS==.+3 + BLOCK 4 +HEIGHT: -6 ;changed if in xgpmod +BASE: 20 +WIDTHS: ;REPEAT CSETSZ,HRES/10. + REPEAT CSETSZ,16. + FNTBKL==.-FNTBLK ;font block length +BLOCK ;room for other fonts + +PAT: +PATCH: BLOCK 40 + +;variables +INDS: 0 ;amount to indent +NINDS: 0 ;new +NXLSPC: 0 ;number of spaces to add to next line after current output line +NXLC1: 0 ;number of spaces at beginning of line +MXPF: 0 ;max position used in buff so far (see mxpf1 also) +MXPF1: 0 ;length of line up to where we cut off for full line output +PSMX: 0 ;max position used for pstrg +NLFS: 0 ;number line feeds extra after next line +NBRKS: 0 ;number spaces in line +NPRDS: 0 ;number of periods in line +SPN: 0 ;number spaces needed in justifying +SINCR: 0 ;space increment (left half integer) +PGCMFL: 0 ;-1 during .page command +PGSPFL: 0 ;on during .space or .page +JERRF: 0 ;-1 >one space needed per space +C240S: 0 ;# of marked spaces this column +PRNCRS: 0 ;# of printed chrs in a position +PNST: 0 ;0 or page to start with +AUNDT: 0 ;amount to undent +CENTF: 0 ;on during .space & .center +;Following are numbers and variables which can be accessed with GENNUM +GENNUM: BLOCK 10 ;Numbers gened +CHAPNO: 0 ;>0 chapter # +OUTPAG: 0 ;output page #, 1=first +GENWMX==.-GENNUM ;End of writables +OUTLIN: 0 ;text line number on page, 1 = first line +FPGPOS: 0 ;line count on output from very top of page +NPAGES: 0 ;actual # of pages printed +GENMAX==.-GENNUM +DOTPOS: 0 ;. or : or ? stored +DOTPOB: 0 ;cdtab indexed by dotpos +DOTWID: 0 ;width of dotpos +ROTPNT: 0 ;saved pointer to command for error output +BLCKNT: 0 ;.block count +PLACEF: 0 ;-1 print file locations with error msg +BUGF: 0 ;-1 print octal uuo pc +EPGIN: 0 ;epage increment +EPGINN: 0 ;new epage increment +RGHCN: 0 ;0 for center, -1 for right +NWAITF: 0 ;-1 for nowait at top of page +NHEADF: 0 ;-1 for no header +PHP1F: 0 ;-1 print header on pd 1 +THSFLG: 0 ;pg #s inside margins +PWHDF: 0 ;align margin with paper width +NVRADJ: 0 ;non-zero to cause no adjusting at all to happen +JMODE: 0 ;1 justify and fill, 0 fill, -1 do nothing +NJMODE: 0 ;new jmode +SPSPF: 0 ;-1 leadings sp and tab don't break +CRBRF: 0 ;-1 break on all crs +SPFLSF: 0 ;-1 compact spaces +CRCOMF: 0 ;-1 compact cr's +MID.F: 0 ;-1 use smarts about .?!;: +CONTEN: 0 ;-1 table of contents +SLASHC: 0 ;/c in file specs +CONFLG: 0 ;>1 when printing contents line +CNTFL: 0 ;counts number of times we go to rdeol during section title +IOPUSD: 0 ;# of nested inserts +APPFLG: 0 ;0 for insrt, -1 for appnd +HYPOP: 0 ;-1 broke on hidden hyphen +FIGP: 0 ;# lines this fig,,pntr to next +LTLF: 0 ;>1 line too long message typed for this line +COMLF: 0 ;-1 sucessfully read initial command line +SLASHT: 0 ;-1 /t flag in initial line + ;xgp stuff +SLASHX: 0 ;-1 /x typed, ignore user page specs +XGPMOD: 0 ;-1 use xgp (output dev=dsk & .xgp or /x typed) +FONTD: 0 ;desired font +FONTC: 0 ;current font +ULD: 0 ;desired underline state (1=underline) +ULC: 0 ;current underline state +HEDSPT: 0 ;-1 use split headers +BLPOS: 0 ;baseline position +=down +LBLPOS: 0 ;last base line position sent +XSPGF: 0 ;-1 no xgp command pg +SQUISF: 0 ;-1 print ;squish +LTRSPF: -1 ;0 suppress letterspacing (allow .adjust to space only between words) +XNORF: -1 ;-1 to "normalize" quoted characters +IFNT: 0 ;input font +IFNIDX: 0 ;index to input font +RSEFNT: 0 ;ifnt at end of rstrg +HDFONT: 0 ;ifnt at end of .header (font that pg num will appear in) +OFNIDX: 0 ;index to output font +INCHSP: 0 ;intercharacter space +HPCW: 0 ;-hlf previous character width +TABSEF: 0 ;-1 if user specified tab or space width +TABFNT: 0 ;idx of font whose widest char is 1/8 tab. -1 for all fonts + +BLOCKM: 0 ;-1 if output block iots +CMIDX: 0 ;index to cmblk on ouput +CMCNT: 0 ;same on input +RDTXTF: 0 ;-1 if some text has been read +OFN2F: 0 ;-1 user specified output fnm2 + +HYPCHR: -1 ;Character to hide hyphen +NQUOTE: ^Q ;Quote character +STERMC: "/ ;Used as separator in written .spreads +PROMPT: "_ ;Prompt character for tty input + +LNL: 73. ;Line length (=tw-indentation-leading spaces) +XLNL: 73.*16. ;In xgp dots +OPTST: CAMGE C,LNL ;Skip if enough to output line +OPTST1: CAMLE C,LNL ;skip if not too much for one line +TW: 73. ;Text width in chars +PW: 85. ;Full page width +TL: 50. ;Text length in lines +PL: 66. ;Full page length +WIDTH: HRES/10. ;Width of above units in xgp dots +TABW: <10*HRES>/10. ;Width of tab + ;Order of following is important +PWINCH: 8500. ;Paper width in 1000-th of an inch +PLINCH: 11000. ;Length +TWINCH: <73.*16.*1000.>/HRES ;Text width +TLINCH: <50.*<6+25.>*1000.>/VRES ;Text length +LMINCH: 1500. ;Left margin +VSP: 6. ;Xgp vertical spacing +TOPMAR: 50. ;TOPMAR to send to XGP +LFTMAR: 50. ;LFTMAR to send to XGP + +LFMD: 1 ;1= single spacing, 2=double, etc. +OLFMD: 1 ; .. for previous line output +DIRSCN: -1 ;Direction of justifing scan +TYRFL: TYO ;PUSHJ P,@TYRFL to output character +CHARO: BUFOUT ;Output char to file (different for blaock and unit output) +CHARI: TTYI ;Input char (switch among file, tty, rantxt, last char) +CHARI1: TTYI ;Moved to chari after lchar is used +COMTYI: FTYI ;Used by command reader +LCHAR: 0 ;Character to be reread +FFFF: 0 ;-1 supply ff at end of page (not on for lpt and tty) +MARGIN: 6 ;Left (and hopefully right) margin +HBUFC: 5 ;Number columns taken by text in hbuf +HBUFW: 5*16. ;Width of text +HBUFC1: 0 ;number of columns of left header +HBUFW1: 0 ;width of left header +HBUFC2: 0 ;number of columns of right header +HBUFW2: 0 ;width of right header +TPMAR: 8 ;Top margin in lines counting heading (heading takes 3 lines) +TPMAR3: 5 ;top margin-heading space +PRCNT: 60. ;Percent of paging margin which goes at top of page +PRSNT: 50. ;Percent of line margin which goes on left side +TERMC: -1 ;Terminator in RSTRG +CBUF1: 0 ;Count for first field in spread +CBUF2: 0 ;Second field +RNLL: 73. ;"Real" NLL (used for header) +RMARGI: 6 ;"Real" margin +ULBASI: ULBUG ;underline position for input stream +ULBASO: ULBUG ; output +BLAMT: 12. ;Amount ^A or ^K will move base +ULFNT: 1 ;Font to underline if not to XGP +SEPCHR: -1 ;terminator in spread +SBLOCK: 2 ;size of .block implied by .sect +TCTYPE: 0 ;its tctyp variable 0 =printing console +ALTFLG: 0 ;alternates heading 1 & 2 when non-zero (bkph) +SWPFLG: 0 ;zero means he1 on left & he2 on right + +;various buffers & pntrs +COMCAL: 0 ;last call from COMMA1 +CMBLK: BLOCK CMSWL ;commands to do after printing line currently in buff +TRNTBL: REPEAT CSETSZ,.RPCNT ;(Input) translation table +CDTAB: BLOCK CSETSZ ;character bit and dispatch table + +TPNTR: 10700,,TBUF-1 ;tty buffer pntr +TCNT: 0 ;# of chars in tbuf + +DNAM: 'DSK ;from-file name +FNAM1: 0 +FNAM2: SIXBIT />/ +ISYSNM: -1 +IACCES: 0 ;.access pntr + INBLK==. +INPAGN: 1 ;page # in input file +INLINE: 0 ;line count on input file +INPTR: 10700,,RCHBUF-1 +BLKIP: 0 ;.iot pntr after iot +IEOFP: 0 ;possible byte pntr to end of file +RCHBUF: BLOCK 200 ;input buffer + TBUF==RCHBUF ;doubles as tty buffer +RCHBFE: ^C_35 + +IOPDLB: ;inpagn,inline,inptr,ieofp, + 1 buffer wd saved here +PBLKIP==.+BLKIP-INBLK +PIEOFP==.+IEOFP-INBLK +PINWD==PIEOFP+1 +IOBKL==PINWD+1-IOPDLB + BLOCK 7*IOBKL + +OUTFLS: 0 ;-1 flush output (used by contents and begin) +OUTBUF: BLOCK OBSIZ ;buffer for block iots +OUTCNT: OBSIZ ;# of free bytes in outbuf +OUTPTR: 700,,OUTBUF-1 ;byte pntr to outbuf + +HBUF: IRPC C,,[PAGE ] + "C,,0 +TERMIN + LOC HBUF+HBUFL +HBUF1: BLOCK HBUFL/2 ;left header character string +HBUF2: BLOCK HBUFL/2 ;right header character string + +FNTRPT: LFNTRNG-1 ;font ring pointer +FNTRNG: REPEAT LFNTRNG, -1 ;ring buffer of IFNT as of before each ^F command + +FF: .+1 ;pntr to head of fs + REPEAT SFS,.+1 ;fs chain + 0 + FNTBUF==. ;following double for font buffer +BUFF: BLOCK BUFSIZ ;contains chrs, marked chrs and pointers into chains + 0 ;losing crock can run 1 over buffer +COLWID: BLOCK BUFSIZ ;width of columns + FNTBFL==.-FNTBUF + 0 ;losing crock can run 1 over buffer +PDL: -PDLL,,.+1 + BLOCK PDLL+1 + +;start of code +ERRH: 0 ;uuo handler + JRST ERRHAN + + ;interrupt code +TSINTA: 0 ;A saved here +TSINT: 0 ;interupt has to be type in + 0 +PURE==. ;start of pure code + MOVEM A,TSINTA + MOVEI A,TYIC + .ITYIC A, ;int caused by tty? + JRST DINT ;no + CAIN A,^Z + .VALUE ;to replace toplevel TJ6 with DDT + CAIN A,^G + JRST CNTRLG +DINT: MOVE A,TSINTA + .DISMIS TSINT+1 + +CNTRLG: SKIPN FFFF ;user trying to quit + .RESET UTYOC, + .RESET TYIC, + MOVE A,CHARI1 + CAME A,TTYI + JRST ENDAR ;To avoid getting stuck in TYI + JRST DINT + +;4 types of error output routines +ERRHAN: PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,H + PUSH P,K + PUSHJ P,TTYOON + HLRZ B,40 ;uuo + CAIN B,BUGR + JRST BGRH + CAIN B,EGG ;print uuo + JRST EGGH + CAIN B,ERR + JRST ERRH2 + PUSHJ P,PLACET +ILLUUO: .VALUE + JRST ENDAR ;start again if return from ddt + +EGGH: SETZM PLACEF + JRST .+2 +ERRH2: SETOM PLACEF + SETZM BUGF +ERRH3: HRRZ B,40 ;normal error message output routine + HRLI B,440700 + JRST ERRHP + +BGRH: SETOM PLACEF + MOVEI H,[ASCIZ /TJ6BUG /] + PUSHJ P,OPSTH ;print string + HRRZ A,ERRH ;location + SOJ A, + PUSHJ P,OCPT + PUSHJ P,OPSP + SKIPN PURED + SETOM BUGF ;.value if unpure + JRST ERRH3 + + PUSHJ P,@TYRFL +ERRHP: ILDB A,B + JUMPN A,.-2 + SKIPE PLACEF +ERRHPL: PUSHJ P,PLACET ;print file place info + POP P,TYRFL + POP P,K + POP P,H + POP P,C + POP P,B + POP P,A + SKIPN BUGF + SKIPE ERBRK +BUGVAL: .VALUE + JRST 2,@ERRH ;return + +;print IFNAME(page,line)(output page,line) +PLACET: SKIPN BLOCKM + PUSHJ P,PRNTRA ;To avoid top of page hassle + PUSHJ P,OPSP + PUSHJ P,OPINAM ;Print file name + PUSHJ P,OPOPAR ;Input page & line + MOVE A,INPAGN + PUSHJ P,DPT + PUSHJ P,OPCOMA + MOVE A,INLINE + PUSHJ P,DPT + PUSHJ P,OPCPAR + PUSHJ P,OPOPAR ;Output chapter,page and line + PUSHJ P,PGNPT + PUSHJ P,OPCOMA + MOVE A,OUTLIN + AOJ A, + PUSHJ P,DPT + PUSHJ P,OPCPAR + SKIPE BLOCKM + JRST OPCRLF + JRST CRR + ;character input routines +RNCH: MOVE A,CHARI1 ;read next char + MOVEM A,CHARI + JRST @A + +UNCHCR: MOVEI A,^J ;make lf last char +UNCH: MOVEM A,LCHAR + MOVEI A,LTYI ;reread last char + MOVEM A,CHARI + POPJ P, + +RURCH: PUSHJ P,RCH ;read and "unread" char +UNCHA: PUSHJ P,UNCH + MOVE A,LCHAR + POPJ P, + +RCH: PUSHJ P,@CHARI ;Read an untranslated char + MOVE A,TRNTBL(A) ;Translate + MOVE B,CDTAB(A) ;Get char description bits +RWID: MOVE D,A ;Get width + ADD D,IFNIDX + MOVE D,WIDTHS(D) + POPJ P, + +LTYI: MOVE A,CHARI1 ;reread last char + MOVEM A,CHARI ;reset chari + MOVE A,LCHAR + MOVE B,CDTAB(A) + POPJ P, + +RTYI: SOSGE RANCNT ;input from rantxt + JRST RTY1 ;nothing left + ILDB A,RANOPT + POPJ P, +RTY1: SETZM RANCNT ;reset counters + MOVE A,[440700,,RANTXT] + MOVEM A,RANIPT + MOVEM A,RANOPT + PUSHJ P,FTYION + JRST FTYI ;get char from file + +RTYION: SKIPA A,[RTYI] +FTYION: MOVEI A,FTYI +TYION: MOVEM A,CHARI1 ;change CHARI + EXCH A,CHARI ;return old CHARI + POPJ P, +FTYI: ILDB A,INPTR ;read char from file + MOVE B,ICDTAB(A) +FTYI1: XCT FTYITB(B) + POPJ P, + +FTYITB: REPEAT CIDXL,POPJ P, +LOC FTYITB+CEOFX + JRST RDFCC +LOC FTYITB+CLNFX + AOS INLINE +LOC FTYITB+CFFDX + JRST RPAK +LOC FTYITB+CIDXL + +RPAK: AOSN LCHAR + POPJ P, ;quoted ^L + AOS INPAGN ;count input file page # + MOVEI A,1 + MOVEM A,INLINE + JRST FTYI ;Read another char + +RDFCC: MOVE L,INPTR ;read a ^c from file + CAMN L,IEOFP + JRST RCHEOF ;Real end of file + CAME L,[350700,,RCHBFE] + POPJ P, ;Not end of buffer, real ^C +REFILL: MOVE A,[-200,,RCHBUF] + .IOT UTYIC,A + HRRZM A,BLKIP + JUMPL A,REFEOF ;end of file in this block + SETZM IEOFP +REFIL1: MOVE A,[10700,,RCHBUF-1] + MOVEM A,INPTR + JRST FTYI + +REFEOF: HLL A,RCHBFE + HLLZM A,(A) ;make sure of end of file char + MOVE L,A + HRLI L,350700 ;make b byte pointer +REDBP: PUSHJ P,DECBP ;decrement it + CAMN L,[10700,,RCHBUF-1] + JRST REDBP3 ;at start of buffer +REDBP1: LDB A,L + JUMPE A,REDBP ;null + CAIE A,^C + CAIN A,^L + JRST REDBP ;not yet backed past eof +REDBP2: ILDB A,L ;found 1st char before eof, now go back to eof + CAIE A,^C + JRST REDBP2 + MOVEM L,IEOFP + JRST REFIL1 + ;bletch, eof was in previous buffer + PUSH P,H + JSP H,CHRC ;traps if not ^c or ^l + QPEOF +REDBP3: SOJGE C,.-2 + POP P,H + SETZ C, + JRST QPEOF1 + +QPEOF: TLNE B,CEOFF + POPJ P, ;this char can appear at or after eof + POP P, +QPEOF1: MOVEM C,MXPF + MOVEM C,MXPF1 + JRST RCHEOF + +DECBP: ADD L,[70000,,0] ;decrement byte pntr in L + SKIPGE L + SUB L,[430000,,1] + POPJ P, + +;stuff to output to file +DAMBUF: PUSH P,A + MOVE A,[-OBSIZ,,OUTBUF] + .IOT UTYOC,A ;block mode .IOT + MOVEI A,OBSIZ*5 + MOVEM A,OUTCNT + MOVE A,[440700,,OUTBUF] + MOVEM A,OUTPTR + POP P,A +BUFOUT: SOSGE OUTCNT ;block mode + JRST DAMBUF + IDPB A,OUTPTR + POPJ P, + +UNITYO: .IOT UTYOC,A ;unit mode + POPJ P, + + +;Low level printing routines +OPCRLF: MOVEI A,^M + PUSHJ P,@TYRFL + MOVEI A,^J + JRST @TYRFL + +OPFF: SKIPA A,[^L] +OPSP: MOVEI A,40 + JRST @TYRFL + +OPDOT: SKIPA A,[".] +OPCOMA: MOVEI A,", + JRST @TYRFL + +OPOPAR: SKIPA A,["(] +OPCPAR: MOVEI A,") + JRST @TYRFL + +PGNPT: SKIPG A,CHAPNO ;print page & chapter + JRST PGNPT1 ;no chapter + PUSHJ P,DPT ;print it + PUSHJ P,OPDOT +PGNPT1: MOVE A,OUTPAG +DPT: JUMPGE A,DPT2 + MOVNS A + SKIPA B,["- - "0] +DPT2: IDIVI A,10. ;decimal output routine + HRLM B,(P) ;store digits in lefthalf of pdl words + JUMPE A,DPT1 + PUSHJ P,DPT2 ;more digits to come +DPT1: HLRZ A,(P) ;get digits off pdl again + ADDI A,"0 + PUSHJ P,@TYRFL + POPJ P, + +OCPT: IDIVI A,10 ;octal print + HRLM B,(P) + JUMPE A,DPT1 + PUSHJ P,OCPT + JRST DPT1 + +PSTN: PUSHJ P,OPSTH ;print ASCIZ string, number, CRLF + MOVE A,K +PSTN1: PUSHJ P,DPT + JRST OPCRLF + +OPSTH: HRLI H,440700 + JRST .+2 + PUSHJ P,@TYRFL + ILDB A,H + JUMPN A,.-2 + POPJ P, + +OPSTHC: PUSHJ P,OPSTH ;print string, then crlf + JRST OPCRLF + +OPINAM: MOVEI K,DNAM ;input file name +;output file name at k +OPFNM: HRLZ H,(K) ;device + PUSHJ P,OP6BT + MOVEI A,": + PUSHJ P,@TYRFL +OPFNM1: MOVE H,3(K) ;sys name + PUSHJ P,OP6BT + MOVEI A,"; + PUSHJ P,@TYRFL +OPFNM2: MOVE H,1(K) ;1st name + PUSHJ P,OP6BT + MOVEI A,40 + PUSHJ P,@TYRFL + MOVE H,2(K) ;2nd name + JRST OP6BT + +OPFNMA: HRRZ H,(K) ; Output possibly foreign font file name. + CAIE H,(SIXBIT /DM/) + CAIN H,(SIXBIT /MC/) + JRST OPFNM + CAIN H,(SIXBIT /ML/) + JRST OPFNM + JRST OPFNM1 + + LDB A,[360600,,H] + LSH H,6 + ADDI A,40 ;convert to ascii + PUSHJ P,@TYRFL +OP6BT: JUMPN H,.-4 ;output 6bt in h + POPJ P, + +OPDECK: IDIVI K,1000. ;print "decimal" # in k + MOVE A,K + PUSHJ P,DPT ;print to left of decimal + SKIPN K,L + POPJ P, ;nothing to right of . + PUSHJ P,OPDOT ;print . + IDIVI K,10. + PUSH P,L + IDIVI K,10. + MOVEI A,"0(K) + PUSHJ P,@TYRFL + MOVEI A,"0(L) + PUSHJ P,@TYRFL + POP P,A + ADDI A,"0 + JRST @TYRFL + +SPUMPB: ADD B,MARGIN ;sp or underlin +SPUL: JUMPLE B,SPARET + MOVE A,ULFNT + CAME A,FONTD + SKIPE ULD + JRST .+2 + JRST SPAZIG ;space + MOVEI A,"_ + JRST SPAZI2 + +SPMPB1: MOVE G,B ;use real spaces + IDIV G,WIDTH + SKIPA B,G +SPAZIG: PUSHJ P,SPNULF ;insert b spaces +SPAZI1: JUMPLE B,SPARET + MOVEI A,40 +SPAZI2: PUSHJ P,@CHARO + SOJG B,.-1 +SPARET: POPJ P, + +SPMPB: SKIPE CONTEN + JRST SPMPB1 + MOVE G,MARGIN ;space to margin +b raster dots + IMUL G,WIDTH + ADD G,B + JRST OPRAST + +SPMBSP: ADD B,MARGIN ;space to margin + B spaces + JUMPGE B,SPB + SKIPGE MARGIN + BARF TW>PW ;margin is negative + SETZB B,MARGIN +SPB: PUSHJ P,FIXUSE ;turn off underlining +SPB1: SKIPE XGPMOD ;space to b spaces + SKIPE CONTEN + JRST SPAZI1 + MOVE G,B + IMUL G,WIDTH +OPRAST: PUSHJ P,OPESC1 ;tab to raster position in g + MOVEI A,XRASET + PUSHJ P,BUFOUT + LDB A,[70700,,G] + PUSHJ P,BUFOUT + MOVE A,G + JRST BUFOUT + +OPCINC: PUSHJ P,OPESC2 ;output column increment in k + MOVE A,K + ADD G,K + JRST BUFOUT + +;fix underline state and font +SPNULF: PUSHJ P,FIXUSE ;fix underline state +OPFNTZ: TDZA A,A ;space in font 0 +OPFNTD: MOVE A,FONTD +OPFNTA: SKIPE XGPMODE ;output font command, font in a + CAMN A,FONTC + POPJ P, ;not xgp, or right font + SETZM LBLPOS ;font change resets base line + MOVEM A,FONTC ;current font + SKIPE CONTEN + POPJ P, + PUSHJ P,OPES1A ;output escape 1,then a +OPBASE: MOVE A,BLPOS ;output base line position from blpos + SKIPE XGPMOD + CAMN A,LBLPOS + POPJ P, + MOVEM A,LBLPOS + SKIPE CONTEN + POPJ P, + MOVEI A,XBASCH + PUSHJ P,OPES1A + MOVE A,BLPOS + JRST BUFOUT + +;fix underline state +FIXUSE: TDZA A,A ;end uderscore +FIXUS: MOVE A,ULD + EXCH A,ULC + SKIPE XGPMOD + CAMN A,ULC + POPJ P, ;current state is desired one + SKIPN CONTEN +FIXUSP: JRST @FIXUST(A) + POPJ P, + + OPESCR +FIXUST: OPBSCR ;idx by -1 + +;output begin underscore +OPBSCR: MOVEI A,STRTUL + JRST OPES1A + +;end underscore +OPESCR: PUSHJ P,OPSTPU + MOVE A,ULBASO ;where to underline + PUSHJ P,BUFOUT + PUSHJ P,OPSTPU + MOVE A,ULBASO + SOJA A,BUFOUT ;another one one dot down + +OPSTPU: MOVEI A,STOPUL +OPES1A: PUSH P,A + PUSHJ P,OPESC1 ;output escape 1, + JRST OPPA ;then a + +OPESC2: SKIPA A,[2] +OPESC1: MOVEI A,1 ;output xgp escape 1 +OPESCA: PUSH P,A ;output escape then a +OPESPA: MOVEI A,XGPESC ;escape, then pushed a + PUSHJ P,BUFOUT +OPPA: POP P,A ;pushed a + JRST BUFOUT + +;Loop untill fill or adjusted, long enough to output +;Unfilled, centered, etc. untill eol +RLOOPX: XCT RLTBL(A) ;pushj p, jsp h, or jrst + JUMP RLOOPI ;for JRST @(H), noop otherwise +RLOOP: CAMLE C,MXPF + MOVEM C,MXPF ;furthest into buffer we have been + PUSHJ P,RCH ;read char in a, bits in b +RLOOP2: TLNE B,CEOSF+CEOCF+CQUOF+CHHYF+CDUMF+CHYPF + JRST RLOOPS + CAIG A,40 + JRST RLOOPX +RLOOPI: PUSHJ P,BE ;put goodie in a into buffer +RLOOP1: CAIGE C,BUFSIZ-1 + AOJA C,RLOOP + JRST MNBRR ;line too long, print it + +;Here if .!? ;: quote hidden - dummy or hyphen +RLOOPS: TLNE B,CEOSF+CEOCF + JRST RDOT ;!?. or ;: + TLNE B,CDUMF + JRST RDDUM ;dummy + TLNE B,CHYPF + JRST RDHYP ;- + TLNE B,CQUOF + JRST RDQUO ;gobble next unconditionally + JUMPLE C,RLOOP ;hidden hyphen, ignore in 1st col + SOJ C, ;put in previous col + SETZ D, + PUSHJ P,BE ;store + MOVE A,IFNIDX + MOVE A,WIDTHS+"-(A) + ADDI A,ARGBIT ;Store width of - as arg + JRST RLOOPI + +RDHYP: PUSH P,D + PUSHJ P,RURCH + POP P,D + MOVEI A,"- + TLNE B,CHYPF + ADDI A,XQUOBT ;Quote first - to prevent break in middle of dash + JRST RLOOPI + +RDDUM: PUSHJ P,RDUM + JRST RLOOP1 + +RDUM: MOVEI A,40 ;dummy, quoted space + JRST RQUOT1 + +RDQUO: PUSHJ P,RQUOT + JRST RLOOP1 + +;here on quote char +RQUOT: SETOM LCHAR ;kluge so that ^l can be quoted + PUSHJ P,@CHARI ;gobble another guy, untranslated + SETZM LCHAR +RQUOT1: PUSHJ P,RWID + ADDI A,XQUOBT + JRST BE ;store the quoted char + +;DISPATCH TABLE FOR RLOOP, READIN +;Called with XCT RLTBL(A), table contains JSP H, to know who did XCT +;NOTE THIS TABLE INCLUDES SPACE (for RLOOP only) +RLTBL: REPEAT 41,JSP H,RLDEF ;All but following simply default +LOC RLTBL+BLDCH + PUSHJ P,RBLD ;base line down +LOC RLTBL+DATCH + PUSHJ P,ADATE ;date +LOC RLTBL+SFCH + PUSHJ P,RFNT ;select font + PUSHJ P,RDGEN ;^G .GENNUM + PUSHJ P,RDBS ;^H + JSP H,RDTAB ;^I TAB + JSP H,RDLF ;^J Line feed + PUSHJ P,RBLU ;^K Base line up + JSP H,RLDEF + JSP H,RDCR ;^M CR + PUSHJ P,AFNAME ;^N file name +LOC RLTBL+BLZCH + PUSHJ P,RBLZ ;^W Zero base line + PUSHJ P,RESCR ;^X End score + PUSHJ P,R1CMD ;^Y Begin underscore +LOC RLTBL+40 + JRST RDSP ;Space (only called from RLOOPX) + +RLDEF: JRST @(H) ;simply return to where indicated at call + +RDTABF: MOVEI A,40 +RDSP: SKIPE SPFLSF ;Here if char is a space + JUMPE C,RLOOP ;Ignore leading spaces in adjust mode +RDSP1: PUSHJ P,BE ;Stow it +RDSPC: PUSHJ P,RCH ;Here if char we put in buff acts like a space + TLNE B,CFSPF + JRST RDFLSP ;Treat series of spaces and tabs like one +RDSPC1: TLNE B,CEOLF + AOJA C,RLOOPX ;Handle CR&LF now to avoid extra blank lines + PUSHJ P,UNCH +RDOTST: XCT OPTST + JRST RLOOP1 + JRST MNBRR ;Enough for output + +RDFLSP: SKIPE SPFLSF + JRST RDSPC ;Flushing spaces in middle of line + AOJA C,RDSP1 ;Stow it + +;Tab handling routines +RDTAB: HRRZ H,H + CAIE H,RLOOPX+1 + JRST RDTAB1 ;Called from readin + SKIPE SPFLSF + JRST RDTABF ;flushing redundant spacing + SKIPN XGPMOD + JRST RDTAB1 + MOVEI B,10(C) + LSH B,-3 + IMUL B,TABW + CAML B,XLNL + JRST MNBRK ;output the line +RDTAB1: PUSH P,H ;where to popj to + SKIPN XGPMOD + JRST RETAB + ;var width tab +RVTAB: MOVE A,NXLC1 ;size of tab=(10-(c+nxlc1)!7)*width + ADD A,C + ANDI A,7 + MOVEI D,10 + SUB D,A ;# of columns taken by this tab + ADDI C,-1(D) ;put tab in 7'th mod 10 column + CAIL C,BUFSIZ-1 + JRST RVTAB1 ;buffer full + MOVE D,WIDTH + IMULI D,1(C) ;absolute distance from start of text on this line + SUB D,W ;size of tab + JUMPG D,.+3 + ADD D,TABW ;in case user made width too small + JUMPLE D,.-1 + MOVEI A,TABCH+SCBIT + PUSHJ P,BE ;put tab in buf + MOVEI A,ARGBIT+1(C) ;column for next char as arg + PUSHJ P,BE + PUSHJ P,BE3 ;fix column width + AOJA C,RETABP + +RVTAB1: POP P, ;fix stack + MOVEI A,^I ;for unch + JRST MNBRK ;print line + +RETAB1: MOVE A,C + ADD A,NXLC1 +RETABP: POPJ P, +RETAB: PUSHJ P,BESP + AOJA C,RETAB1 + +;read single char subrs + +;change font +RFNT: PUSHJ P,RCH + CAIN A,"* ;^F* means pop ring buffer + JRST RFNT4 + PUSHJ P,TSTFNC ;convert to font & test + POPJ P, ;bad font # + AOS H,FNTRPT ;bump font ring pointer + CAIL H,LFNTRNG + SETZ H, + MOVEM H,FNTRPT + MOVE D,IFNT ;push old font onto ring + MOVEM D,FNTRNG(H) +RFNT2: MOVEM A,IFNT ;install new input font # + MOVE H,A + IMULI H,FNTBKL + MOVEM H,IFNIDX + PUSH P,A + MOVEI A,SFCH +RFNT1: PUSHJ P,R1CMD ;put a in buffer + POP P,A + CAILE A,77 + ANDI A,77 + ANDI A,177 + TROA A,ARGBIT +R1CMD: ADDI A,SCBIT ;single char command, just put in buffer + JRST BE + +RFNT4: MOVE H,FNTRPT ;handle ^F* + SKIPGE A,FNTRNG(H) ;if top entry on ring is -1, + JRST FNOPOP ; then the ring has been overpopped + SETOM FNTRNG(H) ;set vacated entry to -1 + SOSGE H ;decrement ring pointer + MOVEI H,LFNTRNG-1 + MOVEM H,FNTRPT + JRST RFNT2 ;go install new input font # + +FNOPOP: BARF Font overpop + POPJ P, + +;get font # in k, skip if valid, barf if not +GFONTN: PUSHJ P,GNUMAR + JUMPE H,GFONER ;no font # + SKIPA A,K +;test font char in a +TSTFNC: SUBI A,"0 ;convert to # + JUMPL A,.+3 + CAIG A,MAXFNT + AOSA (P) ;skip return +GFONER: BARF Bad font # +POPJP: POPJ P, + +;end underscore, store at end of previous column +RESCR: JUMPLE C,RESCR1 ;jump if no previous column + PUSH P,[RESCR2] ;return to RESCR2 from RESCR1 + SOJA C,RESCR1 ;dec C, and call rescr1 as subr +RESCR2: AOJA C,POPJP + +RBLZ: PUSH P,[0] ;zero base line +RBLS: SKIPA A,[BLSCH] ;here to set base to (p) +RESCR1: PUSH P,ULBASI + JRST RFNT1 + +RBLU: SKIPA A,BLAMT ;read base line up +RBLD: MOVN A,BLAMT ;read base line down + PUSH P,A + MOVEI A,BLICH ;increment base line + JRST RFNT1 + +;^G gennum 1 +RDGEN: PUSHJ P,RDNUM ;read number from text + MOVEI D,1 + JRST AGENN2 + +;read a number, leave in K, skip if there is a number, 0 in K as default +RDNUM: SETZB K,G +RDNUM1: PUSHJ P,@CHARI + CAIL A,"0 + CAILE A,"9 + JRST RDNUM2 + IMULI K,10. + ADDI K,-"0(A) + SOJA G,RDNUM1 + +RDNUM2: JUMPN G,UNCH ;did read a number + AOJA K,UNCH ;return 1 as default + +;this and next page decides if the . is of the type found ending sentences +;if so stores it as .+bkbit, and puts 2 marked spaces afterwards +;if . is .?!, then it is prefered in justification, & stored with jusbit. + +;ab.cd + +;the . will always be the end of clause or sentence +;if c is a cr or lf, otherwise +;the point will not be used in justifying +;and will not have two marked spaces put after it, if: +;0 b is a number +;1 b is a letter and a is a space or . +;2 c is not a sp tab cr lf ) " ' ] +;3 c is a ) ] " ' and d is not a sp, tab cr lf + +;here from slt if a ends a sentence or clause (.?! ;:) +RDOT: MOVEM A,DOTPOS ;save the . or ? or : + MOVEM B,DOTPOB ;type of . + MOVEM D,DOTWID ;width + PUSHJ P,RURCH ;look at next char + TLNE B,CEOLF + JRST RDBK ;. followed by cr or lf + TLNE B,CFSPF+CLOSF + SKIPN MID.F + JRST RDNBK ;in fill mode, or next char not sp or close + SOJL C,RDL4A + JSP H,CHRC ;see what the chr before the . is + QRB. ;trap out on not letter + SOJL C,RDL4C + JSP H,CHRC ;look at chr before that + QRB1. ;trap out on not space or . + ADDI C,2 +RDNBK: PUSHJ P,BEDOT ;here if not a break, just store . + JRST RLOOP1 ;go on as usual + +QRB.: TLNN B,CLETF+CDUMF ;check before . + TRNE A,XQUOBT + POPJ P, ;it's a letter + POP P, + TLNE B,CDIGF + AOJA C,RDNBK +RDL4A: AOJA C,RDAF. ;look after . + +QRB1.: TLNN B,CSMSF+CEOCF+CEOSF ;check 2 before . + TRNE A,MKBIT+BKBIT + POPJ P, ;it's sp or .?!;: + POP P, +RDL4C: AOJA C,RDL4A + +;chars before . ok, look after +RDAF.: PUSHJ P,RURCH + TLNE B,CFSPF+CEOLF + JRST RDBK ;. followed by sp tab cr lf + TLNN B,CLOSF + JRST RDNBK ;not ) +RDAF1: EXCH A,DOTPOS + EXCH D,DOTWID + PUSHJ P,BE + PUSHJ P,RNCH ;read next chr + TLNE B,CLOSF + AOJA C,RDAF1 ;it's another )"] + PUSHJ P,UNCH + TLNN B,CEOLF+CFSPF + AOJA C,RDNBK ;not cr lf sp tb + AOJ C, + +RDBK: MOVE A,DOTPOS ;this . ends a clause or sentence + MOVE B,DOTPOB + MOVE D,DOTWID + ADDI A,BKBIT + TLNE B,CEOSF + ADDI A,JUSBIT ;prefer for justification also + PUSHJ P,BE ;put in . with appropriate bits + AOJ C, + PUSHJ P,BEMIN ;stow marked space + AOJA C,RDSP1 ;pretend we just read a cr + +;this page handles the end of an input line +RDCR: HRRZ H,H + CAIE H,RLOOPX+1 + JRST RECR + SKIPE CRBRF + JRST RDCR2 ;break on all crs + SKIPN CRCOMFL ;here on cr + JUMPE C,MNBRR +RDCR2: PUSHJ P,RCH +RDCR1: CAIE A,^J + PUSHJ P,UNCH ;next char not lf + SKIPE CRBRF + JRST RDEOL2 ;break on all crs +RDLF1: JUMPE C,RDEOL1 ;don't put in space if nothing on line + PUSHJ P,GLC ;get last char in a + CAIE A,40 + CAIN A,40+MKBIT + SOJA C,RDEOL ;marked space or space + PUSHJ P,BESP ;otherwise, put in space + ;C now points to space at end of buffer +RDEOL: XCT OPTST ;here on end of line (also after non-autob command) + JRST RDEOL1 ;not enough for an output line +RDEOL2: MOVEI B,LTYI + CAME B,CHARI + PUSHJ P,UNCHCR + JRST MNBRR ;enough, first finish last line +RDEOL1: SKIPE CONTEN ;here when finished with eol calls + PUSHJ P,CONTES ;listing contents +RD1ST: PUSHJ P,RCH ;first char of next input line + SKIPE CRCOMF + JRST .+3 + CAIN A,^M + JUMPN C,MNBRK + CAIN A,". + JRST RDF. ;it's a command + TLNE B,CFSPF + JRST RDFSP ;first on new line is space +RD1ST1: JUMPN C,RDSPC1 + JRST RLOOP2 + +RDLF: HRRZ H,H + CAIN H,RLOOPX+1 + JRST RDLF1 + JRST REOL + +RDFSP: SKIPE SPSPF ;1st on next line is sp + JRST RDFSNB ;don't break on spaces + PUSHJ P,RDFSPS + JUMPN C,MNBRR + JRST MNLP ;will wipe out .un? + +RDFSNB: SKIPN SPFLSF ;here if not breaking on spaces + JRST RD1ST1 ;jump if not flushing spaces + JUMPN C,RDSPC ;if in middle of line, just go to where space is read + JRST RLOOPX + +RDFSPS: MOVEI K,1 + CAIE A,40 + MOVEI K,10 + ADDB K,NXLSPC ;add in space count + CAML K,TW + PUSHJ P,RDBUST + PUSHJ P,RCH + TLNE B,CFSPF + JRST RDFSPS ;another space next on line + JRST UNCH + +RDBUST: BARF Too many leading spaces + SETZM NXLSPC + POPJ P, + +CONTES: SKIPN OUTFLS + AOSG CNTFL ;flag setomed by commands + POPJ P, ;haven't read text lie + PUSHJ P,UNCHCR ;make cr last char +CONPRN: SETOM CONFLG + JUMPN C,CONPR1 ;output cruft + SETZM CONFLG + JRST SECTN ;put in page number + +CONPR1: POP P, + JRST MNBRR + +RDBS: SOJL C,RDBS1 ;here on bs + JSP H,CHRC ;see if previous chr is space or marked space + QBS + POPJ P, + +RDBS1: BARF Backspaced too far + SETZ C, + POPJ P, + +QBS: TLNE B,CSMSF ;predicate used by rdl1 + BARF Backspaced over space + POPJ P, + +BEDOT: MOVE A,DOTPOS + MOVE D,DOTWID + JRST BE +BEMIN: SKIPA A,[40+MKBIT] +BESP: MOVEI A,40 + MOVE D,IFNIDX + MOVE D,WIDTHS+40(D) + +;put char at end of chain at c +BE: CAILE C,BUFSIZ-1 + JRST BELTL ;no space in line buffer for this char + SKIPE B,BUFF(C) ;put (a) in buffer at c + JRST BE1 ;need to grovel along chain + HRLZM A,BUFF(C) ;space existed, just put it in +BE2: SKIPE XGPMOD + TRNE A,SCBIT+ARGBIT + POPJ P, +BE3: SUB D,COLWID(C) ;difference in column size + JUMPLE D,BER ;this column already as wide as this char + ADDM D,COLWID(C) ;new size of this column + ADD W,D +BER: POPJ P, + +BE1: MOVEI F,BUFF(C) ;pntr to head of chain + MOVE B,F + HRRZ F,(B) ;cdr + JUMPN F,.-2 ;more to chain + PUSHJ P,CONS ;free space pointed to by F + HRRM F,(B) ;add F to end of chain + HRLZM A,(F) ;store char + JRST BE2 + +;trying to put char past end of buffer +BELTL: AOS C,LTLF + CAIG C,1 ;skip if error message already printed for this line + BARF Line too long + MOVE C,BUFSIZ-1 + POPJ P, + +;apply test to character chain at c, called with jsp h, +;(h) ;test predicate (either returns or goes on of its own) +;1(h) ;return +CHRC: SKIPA I,BUFF(C) +CHRC1: MOVE I,(I) ;next word in chain + HLRZ A,I ;char + CAIN A,SCBIT+TABCH + JRST CHRC4 ;variable width tab + TRNE A,SCBIT+ARGBIT + JRST CHRC2 ;command char or argument + SETZ B, + CAIGE A,200 + MOVE B,CDTAB(A) + CAIN A,40+MKBIT + MOVSI B,CSMSF +CHRC3: PUSHJ P,@(H) ;call test function +CHRC2: TRNE I,-1 ;skip if no next char + JRST CHRC1 + JRST 1(H) ;return + +CHRC4: MOVEI B,ICDTAB+^I ;get bits for tab + JRST CHRC3 + +;get last char of column pointed to by c +GLC: SETZ A, + SKIPA B,BUFF-1(C) +GLC1: MOVE B,(B) + TLNN B,ARGBIT+SCBIT + HLRZ A,B ;save char + TRNN B,-1 ;more in chain? + POPJ P, ;no + JRST GLC1 + +;flush chain of characters starting at buff(c) +FLS: HRRZ A,BUFF(C) ;pntr to next char + SETZM BUFF(C) + SKIPN XGPMOD + JRST FLS1 + SUB W,COLWID(C) + SKIPGE W + SETZ W, + SETZM COLWID(C) +FLS1: JUMPE A,FLSR ;jump if no cdr + HRRZ B,(A) ;next entry + EXCH A,FF ;make ff point to this loc + HRRZM A,@FF ;this loc to former ff + MOVE A,B + JRST FLS1 + +;flush line just printed +FLSLIN: SETCM C,MXPF1 ;-c-1 + HRLZ C,C + JRST FLSBU1 +FLSBUF: MOVSI C,-BUFSIZ +FLSBU1: PUSHJ P,FLS + AOBJN C,.-1 +FLSR: POPJ P, + +CONS: MOVE F,FF ;'expand' buffer storage + JUMPE F,SCE + HRRZ E,(F) ;by grabbing tail of free storage chain + MOVEM E,FF + SETZM (F) ;free word pointed to by F + POPJ P, + +SCE: BARF Free storage exceeded + JRST ENDAR + +;main line for nofill mode +;no justification-do this instead of mnchrr, mnlp1, rch,slt,... +NJMN1: PUSHJ P,RCH ;flush previous CR or LF + CAIN A,15 + PUSHJ P,RCH + CAIN A,12 + PUSHJ P,RCH + CAIN A,". + JRST NJMNC ;command + TLNN B,CFSPF + JRST NJMN2 + PUSHJ P,RDFSPS ;increments nxlspc + MOVE A,NXLSPC + MOVEM A,NXLC1 + ADDM A,INDS + SETZM NXLSPC + JRST .+2 +NJMN2: PUSHJ P,UNCH + PUSHJ P,READIT + XCT OPTST1 + PUSHJ P,NJMER + SKIPN CONTEN + JRST MNPRN + SKIPN OUTFLS + AOSE CNTFL + JRST MNPRN + PUSHJ P,PRNTR ;Print contents line + PUSHJ P,SECTN + JRST MNJ6L + +NJMNC: PUSHJ P,COMMAN ;Here on command + JRST MNLPR + +NJMER: PRINT NOFILL +LTWER: BARF line wider than TW + POPJ P, + ;read in .nofill .center or .spread line +READIT: SETOM SEPCHR +READIS: SETZB W,MXPF + SETZB C,MXPF1 + JRST READI1 +READIX: XCT RLTBL(A) + JUMP READIN +READI1: CAMLE C,MXPF1 + MOVEM C,MXPF1 + PUSHJ P,RCH ;get a char + CAMN A,SEPCHR + JRST REOL ;we are done + TLNE B,CQUOF+CDUMF + JRST READI4 + CAIGE A,40 + JRST READIX +READIN: PUSHJ P,BE ;put in buffer + AOJA C,READI1 + +READI4: TLNN B,CDUMF + JRST REQUO + PUSHJ P,RDUM + AOJA C,READI1 +REQUO: PUSHJ P,RQUOT ;quote next char + AOJA C,READI1 + +REOL: PUSHJ P,UNCHA +RECR: MOVEM A,TERMC + MOVEM C,MXPF + POPJ P, + +;If filling, normal path is +;RLOOP untill enough to output +;MNBRR to decide how much to print +;MNPRN to print, and back to MNLPA +;If in NOFILL mode, path is NJMN1, MNPRN, MNLP +MNBEG: .CORE CORSIZ + .VALUE ;couldn't core down +MNLPR: PUSHJ P,UNCHCR ;cause lf to appear as next chr read +MNLP: SETZB C,MXPF ;initialise pointers to beginning of buffer + SETZB W,MXPF1 +MNLPA: SETZM LTLF + SKIPE C,MXPF + SKIPN NXLSPC ;Next line spaces + SKIPA A,TW + SOJA C,MNLPC1 ;some text still in BUFF, finish out rest of line + MOVE B,NJMODE ;move in new flags now + CAME B,JMODE + JRST MNSMOD ;changing output mode +MNLP1: MOVEM B,JMODE + SUB A,NXLSPC ;calculate new line length + SUB A,NINDS + PUSHJ P,LNLCHK ;line length check + PUSHJ P,NINDC ;fix number of indents + SKIPE CMCNT + JRST CMEOL ;do end of line command call + JUMPL B,NJMN1 ;nofill mode + XCT OPTST + JRST RLOOP ;not enough to output + SOJA C,MNLPC + +NINDC: MOVE A,NXLSPC ;number of spaces to add to beginning of line + MOVEM A,NXLC1 ;factor in inds due to nxlspc + SETZM NXLSPC + ADD A,NINDS ;if inds was unlocked + MOVEM A,INDS ;spaces to indent + POPJ P, ;inds=ninds+nxlspc + +MNSMOD: JUMPE C,MNSMO1 ;here on mode change + PUSHJ P,NINDC ;something in buffer + SOJA C,MNLPC ;finish line in old mode + +MNSMO1: JUMPGE B,MNLP1 ;if filling, proceed + PUSHJ P,UNCHCR ;just switched to nofill + MOVE A,TW + JRST MNLP1 + +MNLPC1: MOVN B,NXLC1 ;something in buffer, or leading spaces + ADDM B,INDS + SETZM NXLC1 + JRST MNLPC ;print the line + +LNLCHK: JUMPG A,.+3 ;Check for line length <1 + BARF Line length<1 + MOVE A,TW + MOVEM A,LNL + IMUL A,WIDTH + MOVEM A,XLNL + POPJ P, + +;here when it is time to break +MNBRK: PUSHJ P,UNCH +MNBRR: CAMGE C,MXPF ;here when enough for ouput line + SKIPA C,MXPF +MNLPC: MOVEM C,MXPF + SKIPGE JMODE + JRST MNHEM2 ;nofill mode + XCT OPTST + JRST MNHEM ;not enough for one full line +MNLP3: JUMPE C,MNLP ;move back over spaces which broke-unless line was blank + JSP H,CHRC ;test if last was a space + QSPMS ;jumps to mnlp4a,4e,2d on non-space + SUB W,COLWID(C) + SOJA C,MNLP3 ;search until find non-space + +QSPMS: TLNE B,CSMSF+CFSPF + POPJ P, ;it's a space or marked space + + POP P, ;end of a word + SKIPN XGPMOD + AOJA C,MNLP2T + XCT OPTST1 +MNLP2H: SOJA C,MNLPBU ;too much for line, back up another word + ;have found word to break at +MNLP2A: JSP H,CHRC ;return if no - or hidden - + QNHYP +ADTST: SKIPE XGPMOD + JRST MNLP2E ;we have less than a full line + MOVE D,LNL + CAIE D,1(C) + JRST MNLP2E ;we have less than a full line + JRST MNHEM2 + +MNLP2T: XCT OPTST1 + SOJA C,MNLP2H + SOJA C,MNLP2A + +QNHYP: TLNN B,CHHYF+CHYPF + POPJ P, + TLNE B,CHYPF + JRST BEMIN ;hyphen, add space + + POP P, + SKIPN XGPMOD ;hidden hyhen at end of word we are breaking at + JRST HYPTS1 + HLRZ D,(I) + SUBI D,ARGBIT ;Arg is width of hidden - + ADD D,W + CAMLE D,XLNL ;Room on line for hyphen? + SOJA C,MNLPBU ;No + SETOM HYPOP + MOVE W,D + JRST MNLP2E ;adjust + +HYPTS1: CAIGE D,2(C) ;Room for hidden hyphen? + SOJA C,MNLPBU ;no + SETOM HYPOP ;indicate we broke on hidden hyphen + SOJA D,ADTST + + +;found a non-break char--back-up one and look for break +MNLPBU: SUB W,COLWID+1(C) + JSP H,CHRC ;move back to last space or hyphen + QBRK ;jumps to MNLP3 on break + SOJG C,MNLPBU ;search until find a space or hyphen + + MOVE C,MXPF ;single word wider than TW + PUSHJ P,LTWER + JRST MNHEM2 ;print it anyway + +QBRK: TLNN B,CSMSF+CHYPF+CHHYF+CFSPF + POPJ P, ;not sp, marked sp, - or hidden - + POP P, ;found a break + JRST MNLP3 ;now move back over space + +;no justification needed, eliminate trailing marked spaces & spaces +MNHEM: jUMPLE C,MNHEM2 + MOVEI B,BUFF(C) + JRST MNHEM1 +MNHFSP: HRRZS (B) ;flush sp + SETZM COLWID(C) +MNHEMN: HRRZ B,(B) + JUMPE B,MNHEM3 ;nothing more in column +MNHEM1: HLRZ A,(B) + CAIE A,40 + CAIN A,40+MKBIT + JRST MNHFSP ;sp or marked sp + TRNE A,SCBIT+ARGBIT + JRST MNHEMN ;command, etc, ignore + SKIPN (B) +MNHEM3: SOJG C,MNHEM +MNHEM2: MOVEM C,MXPF1 + JRST MNPRN + +;here to adjust, C