.if alone then start
.require "<altosource>ttydefs.pub" source!file
.every heading (|Chat|,|July 7, 1983|,{page})
.turn off "↑"
.once center
.skip 3
Chat is a program for establishing ~Pup Telnet~ connections between a pair of cooperating parties.  Its chief function is to permit Alto users to login to ~Maxc~ and ~IFS~ servers.  Chat includes an extension to support text-display control and graphics.  Chat also includes support for attachment of IBM-PCs to the network via a DLS line.

.sec(Simple operation)
Chat is organized so that default operation with Maxc is simple.  Simply saying "Chat" will establish a connection with Maxc and (provided you are "logged in" on your Alto) will try to establish the Alto as controlling terminal for a Maxc job that is logged in under your name.  Chat will perform a "login" or "attach" as appropriate.  If the simple methods fail you must deal with Maxc yourself (life is hard).

To connect to some server besides Maxc, type "Chat name" where "name" is the name of the desired server (Ivy, DLS, etc.)  Chat will perform the automatic login if the server is a Maxc or an IFS.

If you don't have the file Chat.Run on your disk, the Alto Executive will boot-load it from a boot server on the network.  In this case, Chat will not use the "name" you supply on the command line but rather will require you to type the server name directly to Chat.

If you are not logged in on your Alto at the time you start Chat, or you booted Chat from the network, Chat will first request that you type in your user name (if different from the one installed on your disk) and password.

The preferred method for exiting Chat is to depress the key immediately to the right of the "return" key on the keyboard, and then to press "q" for Quit.  The other method, <shift>SWAT, is frowned upon and is not guaranteed to work.

If the connection fails or is broken by the server, Chat will display an appropriate message and will ordinarily terminate.  However, if you booted Chat from the network, Chat will continue running and will ask you for the name of a new server to connect to.

.sec(Command Interpreter)
While Chat is running, you may wish to give various commands that alter its operation.  Depressing the key immediately to the right of the RETURN key will cause Chat to enter a command mode.  The commands are:
.begin indent 0,6;tabs 7
C\Change control character output setting.  Control characters other than CR, LF, and Tab are normally displayed as "↑x".  Changing this setting causes control characters to be thrown away.

D\Specify a "do" file to insert now.  The text of the file will be treated as if it had been typed in at the keyboard--it will be transmitted to the connected party.  This is a simple way to "can" Maxc procedures that you use a lot.

E\Change local echo setting.  Chat starts out assuming that the connected party will echo all characters.  In some instances, Chat will want to echo your typein locally (e.g., when connected to another Chat).

F\Specify a new font. The screen will be re-initialized, which will
cause recent typeout to disappear.  If insufficient core space
is available for the font, the system font will be used.

I\Toggle the "input" switch for the typescript file, set by the USER.CM entry TYPESCRIPTCHARS (see below).

M\Toggle the IBM PC mode of operation, set by the USER.CM entry PCMODE (see below).

N\Permits you to establish a New connection (after breaking the current one), without leaving Chat.

O\Toggle the "output" switch for the typescript file, set by the USER.CM entry TYPESCRIPTCHARS (see below).

Q\Quit--terminate the connection.

R\Receive characters and put into specified file.  To terminate capture issue the command again with a CR.  Command T is reset if this command is issued.

S\Send the text of the file to the connected party.  This is a simple way to transmit program text to the IBM-PC.

T\Specify a new typescript file.  The old typescript, if any, is closed.  The new typescript will grow without bound, even if the old typescript had a length limit specified in USER.CM (see below).

X\Toggle the "line feed strip" option, set by USER.CM entry LINEFEEDS (see below).
.sec(Command-line options)
Several options may be passed to Chat by global switches in the command line (i.e., by typing Chat/s/t where "s" and "t" are the switches):
.begin indent 0,12;tabs 13
/A\"Attach" -- meaningful only when connecting to Maxc.  This will force the Maxc attach sequence to be typed rather than whatever Chat considers appropriate.

/C\Chat will suppress output of control characters, rather than displaying them as "↑x".

/D\See /P below.

/E\Chat will cause local echoing of input characters.

/I\Equivalent to the command-line entry Chat.Initial/D  (see below).

/L\"Login" -- meaningful only when connecting to Maxc or an IFS.  This forces a login sequence to be typed, regardless of what Chat considers appropriate.  For example, if you already have a detached job on Maxc and wish to create a new job, you must use this option.

/M\Equivalent to the USER.CM entry PCMODE: ON (see below).

/N\Chat will not attempt any automatic login or attach.

/P or /D\Chat will enable a display protocol (see below).

/S\Chat will be a "Pup Telnet Server," and will respond to requests for connection from others rather than initiate requests itself.

/T\Chat will write a typescript on file Chat.ts$, regardless of whether or not a TYPESCRIPT entry appears in USER.CM.

/X\Chat will set the LINEFEEDS option to NO (see below).

Several options may be specified with "local" switches:

string\This gives the "name" of the party with whom Chat should initiate a connection.  The name may be an address constant of the form net#host#socket, or may be a full symbolic name like Maxc+Telnet (see "Naming and Addressing Conventions for Pup" for details).
The default socket is 1, the Telnet socket.  Thus typing "Chat Regis" will try to connect to a Telnet server on the host named Regis.

filename/D\This gives a "do" file name that is fed to the connected party.  When the last character of the file has been sent, Chat will not close the connection.

filename/E\Similar to /D, but will end the connection when end of file is encountered.

filename/F\Specifies the name of the font to use.

filename/T\Specifies the name of the typescript file.
.sec(USER.CM Options)
The USER.CM file may also contain defaults that Chat examines at initialization.  The section of USER.CM that Chat examines must begin with a line with the 6 characters [CHAT] on it.  Thereafter, lines begin with "labels," followed immediately by colons, followed by arguments.

Note that Chat does not look at User.cm (or anything else on your disk) if you boot-loaded it from the network.

In the following descriptions, square brackets enclose parameters that are optional--you shouldn't actually type the square brackets.
.begin indent 0,6
.once indent 6
Tells what to do when a bell character is received.  If DING is specified, a pattern that spells out DING will be displayed at the top of the screen.  If FLASH is specified, the bottom area of the screen will flash black.  If AUDIO is specified, and you have a loudspeaker connected to your Alto's Diablo printer interface, an audible tone will sound.  Any combination of options can be specified together (default: DING FLASH).

.once indent 6
Gives the color of the top border of the screen (default: white).

CONNECT: net#host#socket  or  host-name
.once indent 6
Gives the network address constant or name of the party with whom a connection should be initiated (see "Naming and Addressing Conventions for Pup" for details).  Default is Maxc+Telnet, the Maxc Pup Telnet server.

.once indent 6
Normally, control characters other than CR, LF, and Tab are displayed in the form "↑x".  This option forces them not to be displayed at all.  Default is ON.

.once indent 6
This entry enables a ~display protocol~.  The same effect can be
achieved with the /P or /D command-line switches.  Default is OFF.

.once indent 6
This option turns on local echoing.  This is usually necessary only if you are connecting to another Alto running Chat that has used the /S option.

FONT: AltoFontName.AL [width height]
.once indent 6
Gives the name of a font to use when displaying typeout from the connected party (default: system font).
If two numbers follow the name, they are interpreted as the width of
a line (in characters) and the height of a page (in lines).  These numbers
override the calculations made by Chat, and are shipped
to the server to set the terminal parameters.

.once indent 6
Normally, line feeds transmitted by the other party are included in the typescript file.  If you wish to keep line feeds out of the file, set LINEFEEDS: OFF.

.once indent 6
Normally, carrage returns are not followed by line feeds in text send to the other party.  If you wish Chat to send line feeds after carrage returns set PCMODE: ON.  THis option is intended to be used to communicate with and IBM-PC connected via a DLS line.

TYPESCRIPT: filename [length]
.once indent 6
Gives the name of a file on which to record a typescript of the session.  If length is specified, the file will be treated as a "ring" buffer of that length (in bytes; 65535 maximum).  The file will be created at the beginning of the session, so that the user can be certain the disk will not overflow when recording typescript information.  The characters "<=>" will mark the end of the ring buffer, which will be updated periodically.  If length is not specified, the file will grow without bound and "<=>" will not be appended.  In this case, if the disk becomes full the typescript will be closed and a warning message displayed.

.once indent 6
This entry governs the selection of characters that are included
in the typescript file.  The first on/off switch controls characters
typed on the Alto keyboard: if the switch is "on," these characters will be entered in the typescript file.  The second switch controls characters sent from the other party to the Alto: if the switch
is "on," these characters will be entered in the file.  Default is OFF ON.

.sec(Display Protocol)
Chat allows a remote program to control carefully the entire
Alto display.  The interactive facilities of the Alto can thus
be used by MAXC programs and others.
A set of Interlisp-10 functions has been written to ease use of the display from LISP.  These functions are documented in "Raster Graphics for Interactive Programming Environments,"
by R.F. Sproull, CSL-79-6, and are contained in <SPROULL>ADIS.COM; the symbolics (should you need them) in <SPROULL>ADIS.

"Display Chat" is almost completely different from "teletype Chat"; they
are loaded as one program largely for convenience.  To exit
display Chat, use the <shift><Swat> convention.  Be very careful when attaching and detaching jobs that have Chat display connections open.  If you re-attach to a LISP job that previously had connections open, and CONTINUE your LISP job, the connections are no longer usable because the Pup executive has timed them out.  ADISCheck should be called to verify the state of the connection. 	After this call, it may be necessary to invoke ADISInit again.  If this procedure is not followed, you may get traps with "IO Data Error" or some such message coming out of your LISP program!

Fonts are declared in User.Cm as follows: a line of the form "DISPLAY-FONT: FileName" is a font declaration.  Numbers are associated with the fonts by the order in the file: the first is font 0, the second font 1, etc.  The fonts must be in "strike" format; several fonts in this format are saved on the <ALTOFONTS> directory with extension .STRIKE.

The number of "regions" available to Chat can be altered by including a line of the form "DISPLAY-REGIONS: 6" in User.Cm.

Two functions for making hard copies are not documented in
the CSL report:

ADISPress[file] (Flush).  This function writes a one-page Press file of the given name on your Alto disk.  The page contains a bit-map for the current contents of the Chat display area.  WARNING: This function requires considerable quantities of disk space (about 130 pages per file), and may lead to errors while writing the file.  Best use it only when your state is safe.

ADISPressMaxc[file;scaleFactor] (Flush).  This function is similar to ADISPress, but the file will be written on the connected MAXC directory.  The scaleFactor defaults to 1.0, but can be set to any fraction.  It will cause the Press file to contain directives to reduce the size of the image of the screen when it is printed.

Efficiency and space.  The ADIS protocol operations cost a certain amount in LISP function call and Tenex JSYS overhead; they also have a cost determined by the number of bytes of protocol commands that are sent to Chat.  Thus we can express the communication cost in terms of the number of "characters" we could display by transmitting the same number of bits.  Here are approximate numbers:
.begin nofill; tabs 50

ADISRegionOp\13 or 21
ADISScroll\34 in most cases



Space in the Alto is at a premium.  At present, about 6700 words must be shared among all fonts and region descriptions.  Note that font sizes vary.  Sizes are:
.begin nofill; tabs 50

Region\34 words (always)
Helvetica8.Strike\570 words
Helvetica10.Strike\630 words