February 10, 2003:  The RUNOFF source file of  this document has not been located.  This file is the result of scan, OCR, and manual touchup, starting with one of the originally distributed hectograph copies.
CC-244                                         MAC-M-193
           MASSACHUSETTS INSTITUTE OF TECHNOLOGY
                         Project MAC
TO:       CTSS users.
FROM:     J. H. Saltzer
SUBJECT:  TYPSET and RUNOFF, Memorandum editor and  type-out
          commands.
          DATE:     November 6, 1964
     The command TYPSET is used to create  and  edit  12-bit
BCD line-marked files.  This  command  permits  editing  and
revising by context,  rather  than  by  line  number.    The
command RUNOFF will print out a 12-bit BCD line-marked  file
in manuscript  format.    RUNOFF  contains  several  special
features not available with  the  DITTO  command,  including
type-justification.
     These two commands provide an alternative to the  MEMO,
MODIFY, and DITTO commands,  and  are  intended  to  provide
experience with a different  approach  to  editing  symbolic
files.
     This memorandum was prepared with the aid of these  two
commands.
                                                      PAGE 2
                 An Edlt-by-Context Program
Program Name:  TYPSET
Description:
     TYPSET is a command program used to type  in  and  edit
memorandum files of English text.  TYPSET,  along  with  the
command RUNOFF, is an  alternative  to  the  commands  MEMO,
MODIFY, and DITTO.  Editing is specified by context,  rather
than line number, and input is accomplished  at  high  speed
since the program does not respond between  lines.    TYPSET
reads and produces files  in  a  line-marked  format.    The
command program REMEMO will convert a  file  in  MEMO-MODIFY
format to the line-marked format.  After some minor  editing
the file can be used with RUNOFF.
Usage:
                    TYPSET name
"name" specifies the primary name of a file to be edited, or
a file to be created. or it may be absent, in which  case  a
file is to be created and named later by the "FILE" request.
The secondary name of the file is "(MEMO)".
     When TYPSET is ready for  typing  to  begin.  the  word
"Input" or "Edit" is typed, and the user may begin.   If  he
is creating a file, he begins in high-speed input  mode;  if
he is editing a file he begins in edit mode,
High-Speed Input Mode.
     In high speed input mode, the user may type lines of up
to   360   characters    in    length   (e.g.. 120 underlined
                                                      PAGE 3
characters) separated by carriage returns.  He does not wait
for response from the  program  or  the  supervisor  between
lines, but may  type  as  rapidly  as  desired,    The  full
character set of his keyboard may be used.
     The user leaves high-speed Input mode, and enters  edit
mode by typing an extra carriage return,    No  response  is
typed by the program.
Edit mode.
     In edit mode, the program recognizes "requests" of  the
form given below,  Except where a  request  is  expected  to
cause a response. such as "PRINT," successive  requests  may
be entered immediately on successive lines  without  waiting
for a response from the program,  Each separate request must
begin on a separate line,  Any responses  from  the  program
are typed in red
Requests.
     Editing is done line by line.    Conceptually,  we  may
envision a pointer which at  the  beginning  of  editing  is
above the first line of the file.   This  pointer  is  moved
down to  different  lines  by  some  requests,  while  other
requests specify some action to be done to the line next  to
the pointer.  All requests except FILE may be abbreviated by
giving  only  the  first  letter.    Illegal  or  misspelled
requests will be commented upon and ignored.
                                                      PAGE 4
FIND character string
     This request moves the pointer down to the  first  line
which begins with the given character strlng.   Only  enough
of the line need  be  specified  to  uniquely  identify  it.
Since the pointer only  moves  down  through  the  file  the
second occurrance of a line starting with a given  character
string may be located by giving the FIND request twice.
     It is not necessary to count blank characters  exactly.
If one blank character appears at some point in the  request
string, any number  of  blank  characters  or  tabs  at  the
corresponding point in the file will be  deemed  to  satisfy
the request.  If 2 blank characters appear together  in  the
request string, there must be at least two blank  characters
or tabs at the corresponding point in the file, etc.
     If the FIND request falls to locate  a  line  beginning
with the given character string, a message is  printed,  and
the pointer is set to point after the last line in the file,
Any requests which were typed  in  between  the  FIND  which
failed and the message from the program  about  the  failure
are ignored. Another FIND  request  will  move  the  pointer
back to the top of the  file  to  begin  another  scan  down
through the file.
PRINT n
     Starting at the pointer. n lines are printed out.   The
pointer is left at the last line printed.  If n is absent, 1
line is printed and the  pointer  is  not  moved.    If  the
pointer is not at a line (e.g.. above or below the file,  or
                                                      PAGE 5
at a line just deleted) only a carriage return is typed.
NEXT n
     This request moves the pointer down "n" lines.  If  "n"
is absent, the pointer is moved to the next line.
TOP
     This request moves the pointer back to above the  first
line in a file.
DELETE n
     This request deletes "n" lines, starting with the  line
currently being pointed at.  The pointer is left at the last
deleted line if "n" is absent, the current line  is  deleted
and the pointer not moved.
INSERT
     This request returns the user to high speed input mode.
All lines typed are inserted after the  line  being  pointed
at.  If the very first edit request given is an INSERT,  the
inserted lines are placed at the beginning of the file.   If
an INSERT is given after FIND has run off the bottom of  the
file, the inserted lines are placed at the end of the  file.
When the user returns  to  edit  mode  by  typing  an  extra
return, the pointer is set to the last inserted line.
ERASE c
     The   character   "c"   becomes  the  erase  character.
Normally, the character "#" is the erase  character.    (The
erase character is  used  to  delete  the  previously  typed
                                                      PAGE 6
character or characters.)
KILL c
     The   character   "c"   becomes   the  kill  character,
Normally. the character "#" is  the  kill  character.   (The
kill character is used to delete the entire  line  currently
being typed.)
CHANGE "string 1"strlng 2" G
     In the line being pointed at, the string of  characters
"string 1" is replaced by the strlng of  characters  "string
2".  Any character not  appearing  within  either  character
string may be used in place of the double  quote  character.
If the letter "G" is absent, only the  first  occurrance  of
"strlng 1"  will  be  changed.    If  "G"  is  present,  all
occurrances of "string  1"  will  be  changed.    Blanks  in
CHANGE-request strings must be counted exactly.
     Example:  If the line being pointed at reads:
     it is a nice day in Boston,
     the request
     CHANGE "is"was"
     would cause the line to read:
     it was a nice day in Boston.
     The request
     CHANGE xwasxlsx
     will restore the line to its original state,
     The request
                                                     PAGE 7
     CHANGE ' '.' g
     will change all blanks to periods, and the line reads
     it.is.a.nice.day.in.Boston.
     The request
     CHANGE '.''
     will delete the first period, and the line now reads:
     itis.a.nice.day.in.Boston.
     The line can be restored to its original form by:
     CHANGE "tis"t is"
     CHANGE '.' , G
     CHANGE 'on 'on.'
FILE name
     The edited file is filed as "name (MEMO)".   If  "name"
is absent, the original name will be  used,  and  the  older
file deleted.  If no name was originally given, the  request
is ignored and a comment made.
SPLIT name
     All the lines above the pointer are split into  a  file
named "name (MEMO)".  Any  old  copy  of  "name  (MEMO)"  is
deleted.  The remainder of the file may still be edited, and
filed under another name.  The SPLIT  request  may  be  used
several times during a single edit, if desired.   Unless  at
least one "TOP" request  has  been  given,  "name"  must  be
different from the original name of the file being split.
                                                      PAGE 8
Backspacing.
     The backspace key may be used to  create  overstuck  or
underlined characters.  All overstruck characters are stored
in a standard format, independent of the way they were typed
in.  CHANGE- and FIND-request strings are also converted  to
this standard format, so it is not necessary to remember the
order in which an overstruck character was typed in order to
identify it. For example, suppose the line:
The NØRMAL MØDE statement of MAD
had been  typed  in  by  typing  the  letters  NORMAL,  five
backspaces, a slash, and four forward spaces.  The slashed Ø
can be changed to a normal O by typing
CHANGE 'Ø'O'
Restricted Names and Recovery Procedures.
     Two special names are used for  intermediate  files  by
TYPSET. They are
         (INPUT (MEMO)
         (INPT1 (MEMO)
     Following a quit sequence (or a CTSS system  breakdown)
one of these files may be found. (Whenever a  quit  sequence
has been given, a SAVE command should be issued to save  the
status of all files.)  Since the intermediate file generally
contains a complete copy of the file at the end of the  last
pass, it may be renamed and used as a source file,  and  may
permit recovery of lost requests.    The  original  file  is
never   deleted   until   the  new,  edited  file  has  been
                                                      PAGE 9
successfully written and closed.
     The user's disk status and file directory  are  updated
at the end of each pass through the file, thereby  providing
additional   insurance against   accidental  loss.    If  an
automatic logout occurs during use  of  TYPSET,  the  12-bit
indicator is lost. After resuming  the  logout  saved  file,
press interrupt once; the TYPSET program will  then  restore
the 12-bit mode.  The  program  is  now  in  edit  mode  and
requests may be typed.
                                                     PAGE 10
                   Summary of TYPSET requests
                                              possible
abbreviation       request                    response
D                  DELETE (n)                 end-of-flle
N                  NEXT (n)                   end-of-flle
I                  INSERT                     none
E                  ERASE x                    none
K                  KILL x                     none
F                  FIND string                end-of-flle
P                  PRINT (n)                  printed lines,
                                              end-of-flle
T                  TOP                        none
C                  CHANGE QxxQyyQ (G)         none
                   FILE (name)                no name given
S                  SPLIT name                 no name given
        Optional parameters are shown in parentheses.
                                                     PAGE 11
               A Right-Justifying Type Out Program
Program Name: RUNOFF
Program Description:
     RUNOFF is a command used to type out  memorandum  files
of  English  text  in  manuscript  format.    Control  words
scattered in the text  provide  detailed  control  over  the
format, if desired.  Input files  may  be  prepared  by  the
context editor, TYPSET.
Usage:
                    RUNOFF name
                 or RUNOFF name n
                 or RUNOFF name NOSTOP n
where "name" is the primary name of a file "name (MEMO)"  to
be typed out.  If a number, "n" is  present,  typing  starts
with the page numbered "n",  The optional parameter "NOSTOP"
is explained below, under "Non-Stop Typing."
Control Words:
     Input generally consists of English text, 360 or  fewer
characters to a line.  Control words must begin a new  line,
and begin with a period so that they  may  be  distinguished
from other text.  RUNOFF does not print the  control  words.
.append A
     Take as the next input line the first line of A (MEMO).
                                                     PAGE 12
.line length n
     Set the line length to "n".  The line length is  preset
to 60.
.indent n
     Set  the  number  of  spaces  to  be  inserted  at  the
beginning of each line to "n".  Indent is preset to 0.
.single space
     Copy is to be single spaced.  This  mode  takes  effect
after the next line. (The normal mode is single space.)
.double space
     Copy is to be double spaced.  This  mode  takes  effect
after the next line.
.begin page
     Print out this page, start next line on a new page.
.adjust
     Right adjust lines to the  right  margin  by  inserting
blanks in the  line.    The  next  line  is  the  first  one
affected. (This is the normal mode.)
.nojust
     Do not right-adjust lines.
. fill
     Lengthen short lines by moving words from the following
line; trim long lines by moving words to the following line.
(This is the normal mode.)  A line  beginning  with  one  or
                                                     PAGE 15
more blanks is taken to be a new paragraph, and is  not  run
into the previous line.
.nofill
     Print all lines exactly as they  appear  without  right
adjustment or filling out.
.page n
     Print page numbers. (The first  page  is  not  given  a
page number.  It has instead a two-inch top margin.)  If "n"
is present, print out  the  present  page  immediately,  and
number the next page "n".
.space n
     Insert "n" vertical spaces (carriage  returns)  in  the
copy.  If "n" carries spacing  to  the  bottom  of  a  page,
spacing is stopped.  If "n" is absent or  0,  one  space  is
inserted.
.header xxxxxxxxxxxxxxxx
     All of the line after the first  blank  is  used  as  a
header line, and appears at the top of each page along  with
the page number, if specified.
.break
     The lines before and after the .break control word will
not be run together by the "fill" mode of operation.
.center
                                                     PAGE 13
     The following line is to be centered between  the  left
and right margins.
.literal
     The following line is not a control word,  despite  the
fact that it begins with a period.
     All control words may be typed in either upper case  or
lower case.  Illegal control words are ignored by the RUNOFF
command.  A comment may appear to the  right  of  a  control
word, as long as it is on the same line.
Manuscript Conventions.
     The RUNOFF program assumes a page length of 11  inches,
with 6 vertical lines per inch.  The top and bottom  margins
are 1 inch, except for the first page which has a 2-inch top
margin.  If page numbers are used, they  appear  flush  with
the right margin, 1/2 inch from the top of the page.   If  a
header is used, it will be on the  same  line  as  the  page
number.  The first page is not numbered, or given the header
line unless the control words ".header" and ".page 1" appear
before the first line of text.
     Customary margins are 1 1/2 inches on the  left  and  1
inch on the right, implying a 60-character line.    This  is
the standard line length in the absence  of  margin  control
words.
     The program stops between pages and  before  the  first
page for loading of paper. The paper  should  be  loaded  so
                                                     PAGE 17
that after the first carriage return typing would take place
on line 1 of the  paper.    The  left  margin  stop  of  the
typewriter should be placed at the point typing will  begin,
and the right margin moved as far right as possible.  If you
now  type  the  first  carriage  return,  the  program  will
continue typing.
Tabs.
     Tabs included in the text are faithfully reproduced  in
the final copy. Since there  will  be  interactions  between
inserted tabs and the right-adjust  and  fillout  procedure,
the control word .nofill should precede any use of tabs.  If
you   wish   to  indent,   say,   a  whole  paragraph,  with
right-adjustment and  filling,  change  "indent"  and  "line
length" rather than using a tab at  the  beginning  of  each
line.
     In order to type  out  a  memo  which  uses  tabs,  the
typewriter  tab  stops  and  left  margin  must  be  set  up
properly.  These may be noted within  the  memo  for  future
reference by taking  advantage  of  the  fact  that  illegal
control words are ignored.  One might type, for example,
.tab stops at 6, 11, 16, and 21; left margin at 0.
as the first line of his memo.
Backspacing.
     Underlining or overtyping may be accomplished with  the
aid of the backspace key, even in a line that is subject  to
                                                     PAGE 18
right adjustment.
Non-stop Typing.
     If  continuous  form  paper  is  used,  RUNOFF  can  be
instructed to  not  stop  between  pages  by  inserting  the
parameter "NOSTOP" after  the  file  name  (and  before  any
initial page number) when the command is typed, e.g.
                 RUNOFF ALPHA NOSTOP
Abbreviations.
     All control words may be abbreviated  if  desired.    A
list of abbreviations is given in the  summary.     In  most
cases, a single word is abbreviated by giving its first  two
letters; two words  are  abbreviated  by  giving  the  first
letter of each word.
                                                    PAGE 17
              Summary of RUNOFF Control Words.
abbreviation     control word                automatic break
.ap              .append A                   no
.ll              .line length n              no
.in              .indent n                   no
.ss              .single space               yes
.ds              .double space               yes
.bp              .begin page                 yes
.ad              .adjust                     yes
.fi              .fill                      yes
.nf              .nofill                     yes
.nj              .nojust                     yes
.pa              .page (n)                   yes, if n
.sp              .space (n)                  yes
.he              .header xxxx                no
.br              .break                      yes
.ce              .center                     yes
.li              .literal                    no
     If "automatic break" is yes, the lines before and after
the control  word  will  never  be  run  together,  and  the
previous line will be printed out in its entirety before the
control word takes effect.
                                                     PAGE 18
              A Program to Convert MEMO files.
Program name:  REMEMO SAVED
Usage:
               RESUME REMEMO name1 name2
     REMEMO takes as input  the  binary  file  "name1  MEMO"
which is produced by the commands  MEMO,  and  MODIFY.    It
produces  as  output  a  line-marked  file  "name2  (MEMO)",
suitable for use with the TYPSET and RUNOFF commands.  Since
the secondary names are distinct. the same name may be  used
for "name1" and for "name2" with no danger of  deleting  the
original file.
Restrictions:
     The resulting line-marked file should  be  printed  out
with the PRINT request of the TYPSET command, to  check  for
SPACE and CHANGE TYPE BALL control words,  which  have  been
converted to a code-word by MEMO or MODIFY.   These  control
words must be edited back to their original form.
     Note that RUNOFF does not recognize any  equivalent  of
the following DITTO control words:
                .FOOTNOTE
                .END FOOTNOTE
                .COMMENT
                .CHANGE TYPE BALL
                .END COMMENT