1 BOSS
BOSS is an interactive job controller.  It lets you run several interactive
jobs simultaneously.  Before running BOSS put

    $ boss :== $usr:[utility]boss

into your login.com file.  In order to run BOSS type

    $ boss

BOSS was written by Charles Karney based on the PHOTO program written by
Asbed Bedrossian of USC.  It utilizes the Pseudo TTY package of Dale Moore
of CMU and Kevin Carosso of Hughes Aircraft Co.

Bugs, questions, etc. to Charles Karney (Karney@PPC).
2 Description
BOSS lets you create up to 8 processes each of which is identified by a
single letter (A thru Z).  This letter is used in the process name and in
the DCL prompt.  At most one of these processes is `current'.  This means
that what you type is sent to that process, and output from that process is
sent to your terminal.  A process which is not current can run but normally
cannot do output.  (What happens to the output is governed by the output
flag for a particular process.  See topic Output_Flags.)   You usually
switch between processes by typing control-\ followed by the identifying
letter.  It is also possible to have have of your processes initiate the
switch.  (See topic Communicating.)

You can run any program under BOSS.  For example, you might
    run Emacs or EVE                   in process E
    SET HOST to the EPX                in process H
    run NETTY to the B machine         in process B
    do a FORTRAN compilation           in process F
    execute DCL commands               in process D
    talk to your colleague using PHONE in process P
and so on.

Of course, you would normally not need to run so many processes.  (Indeed
your subprocess quota may only let you run 5 processes.)  When you are
through with a process, you should log out of it (with `logout') and switch
back to some other process.

BOSS makes no attempt to keep track of what is on your screen.  Usually when
switching to a process which manages the screen in an advanced manner, you
should issue a command to the program to get it to re-draw the screen.
(This is control-w for EVE, PHONE, SPELL; control-l for Emacs.)

BOSS uses the VT100 escape sequences for clearing the screen, etc.  However
it should still be useable on non-VT100-compatible terminals.
2 Commands
Usually, all commands to BOSS begin with the C-\ (control-\).  The exception
is when there is no current process (i.e., initially and immediately after
logging out of a process).  In that case the C-\ is optional.

The commands are:

    C-h (or BS) Print command summary
    C-z         Quit (asking confirmation if there are processes)
    a thru z    Switch to a particular process (starting it if necessary)
    A thru Z     the same except clear the screen first
    C-b         Buffer output for this process
    C-o         Discard output for this process
    C-p         Print output from this process
    C-s         Stop output from this process
    ?           List processes and output flags
                 (* means current, +/- means waiting for output)
    C-\         Send a real C-\ to the current process
    DEL         Do nothing
    other       Sound the bell on the terminal
2 Output_Flags
Each process has an output flag which may be set by C-\ followed by one of
C-b, C-o, C-p, or C-s (this sets the flag to b, o, p, or s, resp.).  This
flag governs what BOSS does to the output of a process which is not current.
(The current process always gets its output displayed immediately.)  The
meanings of these settings are

 b  Buffer output for this process.  Output is saved in a 4k buffer.  Buffer
    is output when the process becomes current.  The process hangs when this
    buffer fills.  This is useful for running a program which dribbles
    output which you do not want to lose.  In the process list (obtained by
    C-\ ?), a - indicates that there is output ready to be displayed, and a
    + indicates that the buffer is full (and the process is probably
    hanging).

 o  Discard output for this process.  Only the most recent write will by
    output when the process becomes current.  This is useful for running a
    program which periodically outputs some straightforward information such
    as `Processing record 103', where all you care about is the most recent
    output.  In the process list, + means that there is output available
    (but the process is continuing to run).

 p  Print output from this process.  Output is output to the terminal
    regardless of whether this is the current process or not.  This is
    useful if you need to be informed when a program completes.  Also it can
    be used to display status information periodically on your screen (see
    subtopic Examples).

 s  Stop output from this process.  The process can do a single write which
    will be accepted and saved by BOSS.  The process will then hang when it
    attempts to do the next write.  In the process list + means that there
    is output available (and the process is probably hanging).

The default output flag is b.  The default can be changed by issuing one of
the flag setting commands when there is no current process (i.e.,
immediately after starting BOSS or after logging out of a process).

The best setting of the output flag very much depends on your application.
You will probably find the best setting to be b (the default).  If one
process is attempting to act synchronously with another, it may be
necessary to set their output flags to s.  However, if your synchronous
switches are all performed via the BOSS$SWITCH mechanism, this isn't
necessary since BOSS temporarily sets the output flag to s on these types
of process switches (see topic Communicating).

A potential problem with the b setting is that BOSS empties the buffer to
your terminal in a single operation.  This may overflow your terminal's
input buffer (this is not a problem with a Mac running VersaTerm at 9600
baud).  (Setting your terminal to use flow control won't help.)
3 Examples
Suppose TIME.COM contains:
    $ esc[0,8]=27
    $ sc = esc + "7"                    ! Save cursor
    $ rc = esc + "8"                    ! Restore cursor
    $ home = esc + "[;76H"              ! cursor to top right of screen
    $ invert = esc + "[7m"              ! inverse video
    $ revert = esc + "[m"               ! normal
    $10$:
    $ time = sc+home+invert+f$extract(12,5,f$time())+revert+rc
    $ read/prompt="''time'"/end=43$/error=42$/time_out=0 sys$command dummy
    $42$:
    $ wait  ::5
    $ goto 10$
    $43$:

This displays the time at 5 second intervals in the top right corner of
the screen.  If this is running in a process whose output flag is p, the
time will displayed while in other processes.
2 Communicating
BOSS and the processes under it can communicate via logical names.  The
following are recognized:

BOSS$ID (in process table);  BOSS defines this as the identifying letter of
the process.  This can be used in tailoring the DCL prompt etc.;  e.g.,
    $ set prompt "boss-''f$trnlnm("boss$id")'>"
It can also be used to indicate to a program that it is running under BOSS.

BOSS$SWITCH (in job table); whenever BOSS is writes output to the real
terminal, it checks whether BOSS$SWITCH is defined.  If it's defined as a
single letter, BOSS will switch to that process and delete the logical name.
Thus a DCL procedure can initiate a switch to process G with
    $ define/job boss$switch g
    $ write sys$error ""        ! do some output to make BOSS wake up
The switch takes place synchronously by setting the output flag for the
originating process to s temporarily (see topic Output_flags).

BOSS$STUFF (in job table); whenever a BOSS makes a process initiated
switch.  It stuffs the definition of BOSS$STUFF into the input stream of
the process being switched to.  After being used, BOSS$STUFF is deleted.
3 Examples
The following command procedure will do a SHO DEF and leave SHO DEF in the
recall buffer:
    $ cr[0,8] = 13
    $ define/job boss$stuff "sho def''cr'"
    $ define/job boss$switch 'f$trnlnm("boss$id")'

Here's how to switch to process F and have the present job continue
running:
    $ define/job boss$switch f
    $ char[0,8] = 22                    ! control-V
    $ gosub out_char
    $ return
    $!
    $out_char:                          ! Spit out the character
    $ read/prompt='char'/end=40$/error=40$/time_out=0 sys$command dummy
    $40$: return

If you want the present process to wait, then repeat the `gosub out_char'
three times.

Return paths may be implemented via additional logical names.  E.g., the
procedure that runs Emacs under BOSS does the following.

If Emacs isn't running (boss$emacs undefined) do
    $ define/job boss$emacs 'f$trnlnm("boss$id")'
and start Emacs.

If Emacs is running (boss$emacs defined) do
    $ define/job boss$return_switch 'f$trnlnm("boss$id")'
    $ define/job boss$switch 'f$trnlnm("boss$emacs","lnm$job")'
    $ gosub out_char
    $ gosub out_char
    $ gosub out_char

The suspend-emacs function in Emacs is redefined to do the equivalent of
    $ define/job boss$switch 'f$trnlnm("boss$return_switch","lnm$job")'
    $ deassign/job boss$return_switch
    ...

Similarly boss$return_stuff may be used as the string to stuff into the
process on return.  The edit procedure that is called on a TeX error may
set this to the current TeX command line so that on exiting from the
editor the user has the input buffer prepared with the command to re-run
TeX.  The user then has the option either of accepting the command (by
typing return) or cancelling it (with C-u).
2 Bugs
BOSS does single character input.  This is rather slow.  Don't expect it to
be able to keep up with lots of data coming from the terminal.

The output on some terminals (Visual 550s in particular) at 9600 baud may
have glitches in it.  This is because these terminals need flow control
enabled to operate at 9600 baud, but BOSS doesn't react quickly enough to
the control-s sent by the terminal.  The solution is to run at 4800 baud or
slower.

I have seen various strange bugs occurring when using BOSS.  These are all
associated with VMS running out of some quota.  The symptoms range from
BOSS hanging while creating a process (because LIB$SPAWN does not return)
to SYS$LIBRARY being mis-translated by LINK.  As far as I can tell these
problems occur only because of the additional stress multiple running jobs
puts on a users quota's and not because of BOSS problems per se.  The
culprits is usually BYTLM (8000 is too low, 40000 is OK).  However PGFLQUO
is another quota to check.

I know of one program SMP (an algebra system) that grabs the entire PGFLQUO
on startup.  This obviously interfers with BOSS's other processes.  The
solution is to do a re-entrant SET HOST to run SMP.

Output gets garbled when using BOSS via SET HOST (i.e., SET HOST followed by
BOSS).  This happens when you type while output is coming to your terminal.
The symptom is that the lines come out in the wrong order.  It's OK to use
SET HOST while in BOSS (i.e., BOSS followed by SET HOST).

PC file transfer using the XMODEM protocol (e.g., with MACX) doesn't work
through BOSS.  Kermit seems to work fine.

Attempting to attach to the process running BOSS from one of its
subprocesses causes a hangage.

Control-\ is used by the Switcher program on the Macintosh.  If you are
running your terminal emulation program under Switcher, you need to check
`Disable keyboard switching' in the Options menu item in Switcher.
2 Unfeatures
The following features are not implemented but are possible future
enhancements.

* Log files.
* Ability to kill particular processes.
* Ability to ATTACH to non-BOSS processes.  I haven't managed to make this
  work yet.
* Configurable for other terminals.
* Allow default directory to propagate to other processes.
