SUMMARY OF SPECIAL ACTIONS

  :name   Visit how-to called 'name'
  :       Visit last how-to refered to
  ::      Display headings of how-to's in this workspace

  =name   Visit contents of location
  =       Visit last location visited
  ==      Display names of permament locations in this workspace

  >name   Visit workspace 'name'
  >       Visit last workspace visited
  >>      Display list of workspace names

  QUIT    Leave ABC

SUMMARY OF EDITING OPERATIONS

  Name      Default Keys*    Short description

  Accept    [TAB]            Accept suggestion, focus to hole or end of line
  Return    [RETURN]         Add line or decrease indentation

  Widen     f1, [ESC] w      Widen focus
  Extend    f2, [ESC] e      Extend focus (usually to the right)
  First     f3, [ESC] f      Move focus to first contained item
  Last      f4, [ESC] l      Move focus to last contained item

  Previous  f5, [ESC] p      Move focus to previous item
  Next      f6, [ESC] n      Move focus to next item
  Upline    f7, [ESC] u      Move focus to whole line above
  Downline  f8, [ESC] d      Move focus to whole line below

  Up        ^, [ESC] U       Make new hole, move up
  Down      v, [ESC] D       Make new hole, move down
  Left      <-, [ESC] ,      Make new hole, move left
  Right     ->, [ESC] .      Make new hole, move right

  Goto      [ctrl-G], mouseclick  New focus at cursor position

  Undo      [BACKSPACE]      Undo effect of last key pressed (may be repeated)
  Redo      [ctrl-U]         Redo last UNDOne key (may be repeated)

  Copy      f9, [ctrl-C], [ESC]c  Copy buffer to hole, or focus to buffer
  Delete    [ctrl-D]         Delete contents of focus (to buffer if empty)

  Record    [ctrl-R]         Start/stop recording keystrokes
  Play      [ctrl-P]         Play back recorded keystrokes

  Look      [ctrl-L]         Redisplay screen
  Help      f10, [ESC]?      Print summary of editing operations

  Exit      [ctrl-X]         Finish changes or execute command
  Interrupt (as set by 'stty')Interrupt command execution
  Suspend (as set by 'stty') Suspend ABC (only for shell with job control)

  * Notes:

  [Ctrl-D] means: hold the [CTRL] (or [CONTROL]) key down while pressing d.

  [ESC] w means: press the [ESC] key first, then w.

ABC QUICK REFERENCE

  COMMANDS

  WRITE expr                    Write to screen;
                                / before or after expr gives new line
  READ address EG expr          Read expression from terminal to address;
                                expr is example
  READ address RAW              Read line of text
  PUT expr IN address           Put value of expr in address
  SET RANDOM expr               Start random sequence for random and choice
  REMOVE expr FROM list         Remove one element from list
  INSERT expr IN list           Insert in right place
  DELETE address                Delete permanent location or table entry
  PASS                          Do nothing
  KEYWORD expr KEYWORD ...      Execute user-defined command
  KEYWORD                       Execute refined command

  CHECK test                    Check test and stop if it fails
  IF test:                      If test succeeds, execute commands;
     commands                       no ELSE allowed
  SELECT:                       Select one alternative:
      test: commands                 try each test in order
      ...                            (one must succeed;
      test: commands                 the last test may be ELSE)
  WHILE test:                   As long as test succeeds
     commands                       execute commands
  FOR name,... IN train:        Take each element of train in turn
     commands

  HOW-TO's

  HOW TO KEYWORD ...:           Define new command KEYWORD ...
     commands
  HOW TO RETURN f:              Define new function f with no arguments
     commands                      (returns a value)
  HOW TO RETURN f x:            Define new function f with one argument
     commands
  HOW TO RETURN x f y:          Define new function f with two arguments
     commands
  HOW TO REPORT pr:             Define new predicate pr with no arguments
     commands                      (succeeds/fails)
  HOW TO REPORT pr x:           Define new predicate pr with one argument
     commands
  HOW TO REPORT x pr y:         Define new predicate pr with two arguments
     commands

  SHARE name,...                Share permanent locations
                                (before commands of how-to)

  Refinements (after the commands of a how-to)

  KEYWORD : commands            Define command refinement
  name: commands                Define expression- or test-refinement

  Terminating commands

  QUIT                          Leave command how-to or command refinement,
                                or leave ABC
  RETURN expr                   Leave function how-to or expression refinement,
                                return value of expr
  REPORT test                   Leave predicate how-to or test-refinement,
                                report outcome of test
  SUCCEED                       The same, report success
  FAIL                          The same, report failure

  EXPRESSIONS AND ADDRESSES

  666, 3.14, 3.14e-9            Exact constants

  expr,expr,...                 Compound
  name,name,...                 Naming (may also be used as address)

  text@p                        "ABCD"@2 = "BCD" (also address)
  text|q                        "ABCD"|3 = "ABC" (also address)
  text@p|q                      "ABCD"@2|1 = "BCD"|1 = "B"

  table[expr]                   Table selection (also address)

  "Jan", 'Feb', 'Won''t!'       Textual displays (empty: "" or '')
  "value = `expr`;"             Conversion of expr to text

  {1; 2; 2; ...}                List display (empty: {})
  {1..9; ...}, {"a".."z"; ...}  List of consecutive values

  {["Jan"]: 1; ["Feb"]: 2; ...} Table display (empty: {})

  f, f x, x f y                 Result of function f (no permanent effects)
  name                          Result of refinement (no permanent effects)

  TESTS

  x < y, x <= y, x >= y, x > y  Order tests
  x = y, x <> y                      (<> means 'not equals')
  0 <= d < 10

  pr, pr x, x pr y              Outcome of predicate pr (no permanent effects)
  name                          Outcome of refinement (no permanent effects)

  test AND test AND ...         Fails as soon as one of the tests fails
  test OR test OR ...           Succeeds as soon as one of the tests succeeds
  NOT test

  SOME name,... IN train HAS test
                                Sets name, ... on success
  EACH name,... IN train HAS test
                                Sets name, ... on failure
  NO   name,... IN train HAS test
                                Sets name, ... on failure

  PREDEFINED FUNCTIONS AND PREDICATES

  Functions and predicates on numbers

  ~x                            Approximate value of x
  exactly x                     Exact value of x
  exact x                       Test if x is exact
  +x, x+y, x-y, -x, x*y, x/y    Plain arithmetic
  x**y                          x raised to the power y
  root x, n root x              Square root, n-th root
  abs x, sign x                 Absolute value, sign (= -1, 0, or +1)
  round x, floor x, ceiling x   Rounded to whole number
  n round x                     x rounded to n digits after decimal point
  a mod n                       Remainder of a on division by n
  */x                           Numerator of exact number x
  /*x                           Denominator
  random                        Random approximate number r, 0 <= r < 1
  e, exp x                      Base of natural logarithm, exponential function
  log x, b log x                Natural logarithm, logarithm to the base b
  pi, sin x, cos x, tan x, arctan x
                                Trigonometric functions, with x in radians
  angle (x, y), radius (x, y)   Angle of and radius to point (x, y)
  c sin x, c cos x, c tan x     Similar, with the circle divided into c parts
  c arctan x, c angle (x, y)        (e.g. 360 for degrees)
  now                           e.g. (1999, 12, 31, 23, 59, 59.999)

  Functions on texts

  t^u                           t and u joined into one text
  t^^n                          t repeated n times
  lower t                       lower "aBc" = "abc"
  upper t                       upper "aBc" = "ABC"
  stripped t                    Strip leading and trailing spaces from t
  split t                       Split text t into words

  Function on tables

  keys table                    List of all keys in table

  Functions and predicates on trains

  #train                        Number of elements in train
  e#train                       Number of elements equal to e
  e in train, e not.in train    Test for presence or absence
  min train                     Smallest element of train
  e min train                   Smallest element larger than e
  max train, e max train        Largest element
  train item n                  n-th element
  choice train                  Random element

  Functions on all types

  x<<n                          x converted to text, aligned left in width n
  x><n                          The same, centred
  x>>n                          The same, aligned right

  THE CHARACTERS

   !"#$%&'()*+,-./              This is the order of all characters
  0123456789:;<=>?              that may occur in a text.
  @ABCDEFGHIJKLMNO              (The first is a space.)
  PQRSTUVWXYZ[\]^_
  `abcdefghijklmno
  pqrstuvwxyz{|}~
 
ABC MANUAL

NAME
  abc - ABC interpreter & environment
  abckeys - change key bindings for 'abc'

SYNOPSIS
  abc    [workspace and editor options]  [file ...]
  abc    [workspace and task options]
  abckeys

DESCRIPTION
  Without options or files, the ABC interpreter is started, using the ABC
  editor, in the last workspace used or in workspace 'first' if this is
  your first abc session.  A workspace is kept as a group of files in a
  directory, with separate files for each how-to and location.  The
  workspace directories themselves are kept by default in the directory
  $HOME/abc.  On non-Unix machines, $HOME is the disk you are working on.

  Workspace Options:

  -W dir        use group of workspaces in 'dir' instead of $HOME/abc.

  -w name       start in workspace 'name' instead of last workspace used.

  -w path       use 'path' as workspace (no -W option allowed).

  Editor option:

  -e            Use $EDITOR as editor to edit definitions, instead of ABC
                editor (Unix only).

  file ...      Read commands from file(s) instead of from standard input;
                input for READ commands is taken from standard input.  If a
                file is called '-' and standard input is the keyboard, the
                ABC system is started up interactively for that entry.

  Special tasks:

  -i tab        Fill table 'tab' with text lines from standard input

  -o tab        Write text lines from table 'tab' to standard output

  -l            List the how-to's in workspace on standard output

  -r            Recover a workspace when its index is lost: useful after a
                machine crash if the ABC internal administration files
                didn't get written out.

  -R            Recover the index of a group of workspaces

USAGE
  (This is necessarily a very brief description; see 'The ABC Programmer's
  Handbook' for full details.)

  Use 'QUIT' to finish an ABC session.

  When ABC starts up interactively, it displays a prompt and awaits input.

  TYPING AND SUGGESTIONS: as you type, the system tries to suggest a
  possible continuation for what you have typed; to accept the suggestion,
  press [accept] (by default this is bound to the [TAB] key; type '?' to
  find out the bindings for the keyboard you are using).  If you don't want
  to accept the suggestion, just carry on typing (you can always type
  character for character, ignoring the suggestions).  Usually the system
  knows where a letter must be capital and where not, and you usually don't
  have to use the shift key; however, in the few places where both a
  lower-case and an upper-case letter would be legal (for instance for
  AND), you have to type the letter upper-case.

  When you type a control command, like WHILE, the system provides
  indentation automatically for the body of the command; to reduce the
  indentation one level, type [return].

  CORRECTING AND EDITING: the [undo] key (by default bound to backspace)
  undoes the last key you typed.  Repeatedly typing it undoes more and
  more, up to a certain maximum number of keypresses.

  To correct other parts, you must put the 'focus' onto the part you want
  to change.  The focus is displayed by underlining or reverse video.
  [Widen] and [extend] make the focus larger, [first] and [last] make it
  smaller.

  [Delete] deletes the contents of the focus.

  [Copy] copies the contents of the focus to a buffer, or if the focus is
  not focussed on anything, copies the contents of the buffer back to where
  you are positioned.

  MOVING THE FOCUS: [Upline] and [downline] focus on one line above or
  below.  [Previous] and [next] move the focus left and right.  [Up],
  [down], [left], and [right] move an empty focus around.  [Goto] widens
  the focus to the largest thing at the current position.

  OTHER OPERATIONS: [Look] redraws the screen; [record] records all
  keystrokes until the next time you press [record] - [play] replays them.
  [Redo] redoes the last key(s) undone; [interrupt] interrupts a running
  command.

  WORKSPACES: To create a new workspace, or go to an existing workspace,
  type '>name'.  To go to the last workspace you were in, type a single
  '>'.  To get a list of workspace names, type '>>'.

  HOW-TO's: To create a new how-to, just type the first line of the how-to.
  This creates the new how-to, and allows you to type the body.  Use [exit]
  to finish it (by default [ESC][ESC]).

  To visit a how-to, type a colon, followed by the name of the how-to.
  Again, use [exit] to exit.  To visit the last how-to again, or the last
  how-to you got an error message for, type a single ':'.  To get a list of
  the how-to's in this workspace, type '::'.

  To edit a location, type a '=' followed by the name of the location.  To
  re-edit it, type a single '='.  To get a list of the locations in the
  workspace, type '=='.

KEY BINDINGS
  The binding of editing operations like [accept] to keys may be different
  for your keyboard; type a '?' at the prompt to find out what the bindings
  are for your keyboard.
  To redefine the keys used for editor operations, run 'abckeys'.  This
  produces a private key definitions file.  You will be given instructions
  on how to use it.
  Keys labeled f1...f8 are function keys. On Unix, the way to type these is
  terminal-dependent.  The codes they send must be defined by the termcap
  entry for your terminal.
  If a terminal has arrow keys which transmit codes to the computer, these
  should be used for Up, Down, Left and Right.  Again, the termcap entry
  must define the codes.
  The Goto operation is of most use if the cursor can be moved locally at
  the terminal, or if the terminal has a mouse; the Goto operation will
  sense the terminal for the cursor or mouse position.  On Unix, we use two
  extra non-standard termcap capabilities for this: 'sp' which gives the
  string that must be sent to the terminal to sense the cursor position,
  and 'cp' which defines the format of the reply (in the same format as
  other cursor-addressing strings in termcap).  If your terminal's mouse-
  click sends the position of the click automatically, just set 'sp' to the
  empty string.  See termcap(5) for more details.

FILES
  $HOME/copybuf.abc        copy buffer between sessions
  $HOME/abc/wsgroup.abc    table mapping workspace names to directory names
  $HOME/abc/abckeys_$TERM  private key definitions file (Unix only)
  $HOME/abc/abc.key        private key definitions file (non-Unix)
  position.abc             focus position of edited how-to's in workspace
  perm.abc                 table mapping object names to file names
  suggest.abc              suggestion list for user-defined commands
  types.abc                table with codes for typechecking between how-to's
  *.cmd                    command how-to's in this workspace
  *.zfd, *.mfd, *.dfd      function how-to's in this workspace
  *.zpd, *.mpd, *.dpd      predicate how-to's in this workspace
  *.cts                    permanent locations in this workspace
  abc.msg                  messages file, used for errors (not on Macintosh)
  abc.hlp                  helpfile with this text (MacABC.help on Macintosh)

  The latter two are searched for first in your startup directory, then in
  $HOME/abc, and finally, on Unix, in a directory determined by the
  installer of ABC.  On the IBM PC and Atari ST the directories in your
  $PATH are used in the last stage (if you have a hard disk place these
  files in the workspaces directory abc).

ATARI ST IMPLEMENTATION
  There are four files supplied: the program abc.tos itself, abckeys.tos
  for changing your key bindings, the help file abc.hlp, and the error
  messages file abc.msg.  (See FILES above.)
  If you start ABC up from the desktop, and you want to use the options
  given above, like -w, you should rename abc.tos to abc.ttp.  There is an
  additional facility for redirecting input and output: the parameter
  >outfile redirects all output from ABC to the file called outfile, and
  similarly <infile takes its input from the file called infile.

IBM PC IMPLEMENTATION
  There are four files for running ABC, the program abc.exe itself,
  abckeys.exe for changing your key bindings, the help file abc.hlp, and
  the error messages file abc.msg.  (See FILES above.)
  If your screen size is non-standard, or your machine is not 100% BIOS
  compatible (which is unusal these days), you can specify the screen-size,
  and whether to use the BIOS or ANSI.SYS for output, by typing after the
  A> prompt, before you start ABC up, one of the following:
       SET SCREEN=ANSI lines cols
       SET SCREEN=BIOS lines cols
  If you are going to use ANSI.SYS, be sure you have the line
       DEVICE=ANSI.SYS
  in your CONFIG.SYS file.  Consult the DOS manual for further details.

APPLE MACINTOSH IMPLEMENTATION
  There are three files supplied: MacABC, the application itself,
  MacABC.help, the help file, and MacABC.doc, a MacWrite document
  containing a variant of this text.  The help file should be in the same
  folder as MacABC, or in your System Folder.
  MacABC runs in a single window.  You'll notice that most operations are
  menu entries, as well as being possible from the keyboard.  You can start
  ABC up by double-clicking the MacABC icon in which case you start up in
  the last workspace used, or by double-clicking on any icon in a
  workspace, in which case you start in that workspace.  In this latter
  case, if the filename of the icon you clicked on ends in .cmd, that how-
  to is executed, but the how-to may not have any parameters.
  Instead of the special option flags mentioned above, most of the tasks,
  like recovering a workspace, can be done from the File menu.
  * Notes for Macintosh guru's:
  The messages are STR# resources in MacABC; you must use a resource editor
  to change them.
  MacABC uses Monaco 9 for the screen, and Courier 10 for printing.  You
  can change them with ResEdit, by editing the resource with type Conf and
  ID 0.  The horizontal and vertical window-size and the window-title can
  also be adapted there.  To facilitate this, first Paste the TMPL resource
  with ID 5189 named Conf from MacABC to (a copy of) ResEdit.  But beware,
  MacABC only works properly with Fixed-width Fonts like Monaco and
  Courier.

SEE ALSO
  Leo Geurts, Lambert Meertens and Steven Pemberton, The ABC Programmer's
       Handbook, Prentice-Hall, Englewood Cliffs, New Jersey, 1989,
       ISBN 0-13-000027-2.
  Steven Pemberton, An Alternative Simple Language and Environment for PCs,
       IEEE Software, Vol. 4, No. 1, January 1987, pp. 56-64.
  The ABC Newsletter. Available free from CWI.

AUTHORS
  Frank van Dijk, Leo Geurts, Timo Krijnen, Lambert Meertens, Steven
  Pemberton, Guido van Rossum.

ADDRESS
  ABC Distribution, CWI/AA, Postbox 4079, 1009 AB Amsterdam, The
  Netherlands.
  E-mail: 'abc@cwi.nl'.

