UP
This module provides several virtual terminals from one
terminal. The TMM requires SIKA, SOKA, and CCKA which obey
the SIK3, SOK3, and CCK3 protocols, respectively, and provides
TMMK and several (_branch)es, each of which provides its
own SIK3, SOK3, and CCK3.
Note that multiplexors can be cascaded.
Motivation
The TMM is designed to be of use in implementing a typical
programming environment with an interactive terminal. There
is a special branch called the (_control branch) which would
be under control of a command language interpreter. A user
could run one or more other programs, each of which requires
an interactive terminal, and could select which program
he wishes to talk to. The selection would be made by typing
a special switch character followed by a command to switch
the terminal to another program.
Switching is insensible to a program using a switched branch,
which is why we use the term "virtual terminal" to describe
a branch. The exception is in screen mode, where a program
may be asked to reconstruct the screen when you switch to
it.
Specification
The TMM acts as two switches, one for input and one for
output. Signals from the terminal (SIKA) are generally passed
on to the (_input branch) SIK3. Signals from the (_output
branch) SOK3 are passed on to the terminal (SOKA).
Design note: The input and output branches are independent
in order to cater to command language interpreters which
want to interject messages on the terminal without disturbing
the stream of input which the user may be typing ahead.
There are two distinguished signals from the terminal,
one for line mode and one for screen mode. When the terminal
is in line mode, typing the (_switch character) changes
the input branch to be the control branch. (The switch
character will often be the ASCII character ESC.) The switch
character will be read by the control branch, not the old
input branch.
When the terminal is in screen mode, typing the (_attention
character) changes the input branch to be the control branch.
The attention character is PA1. (Someday this will be specifiable.)
(The terminal keyboard remains locked and the terminal remains
in screen mode, until some output changes that.) The attention
character will be read by the control branch, not the old
input branch.
TMM reads input from the terminal at all times, in order
to scan for switch characters and attention characters (and
orange balls). (Note that sometimes it will not know whether
the input is to be echoed; at such times it reads without
echoing, and echoes later if necessary.) If the input branch
is not consuming input the data is queued for that branch.
If the input branch is switched from the control branch to
another branch, any input that was queued for the control
branch is treated as if it had just been read. In other
words, the data is sent to the new input branch, until a
switch character is encountered.
A yellow ball sent on a branch will result in an orange ball
sent to that branch after the yellow ball is "printed".
Switching does not misdirect orange balls.
A gobbler sent on a branch using either CCK3 or SOK3 will
gobble only data from that branch. It will not gobble yellow
balls or the data beyond them.
EOF signalled from SIKA causes the input branch to be switched
to the control branch and EOF to be signalled on the control
branch SIK3.
EOF signalled from SOKA causes EOF to be signalled on all
SOK3 keys.
EOF signalled to SIK3 or SOK3 is ignored.
Fine print:
If the input branch is different from the output branch
and echoing is specified, echoes may not be printed until
the output branch is switched to the same branch as the
input branch.
If the input branch is different from the output branch and
the input branch specifies that tab is to be echoed, the
output from the output branch may use the tab stop settings
for the input branch instead of those for the output branch.
Note: this wart is inconsequential in the anticipated
modes of use. Normally the input and output branches will
be the same. When the input branch is switched to the control
branch, the command language interpreter should either switch
the output branch also before reading, or read without echoing
tab. To switch back, the command language interpreter can
finish its output, switch input, then switch output. If
the command language interpreter switches output to interject
a message, the message should not contain tabs.
CCK3
TMMK
{TMMK's come from (tmmkc).} This
key has the following functions:
TMMK(0;BID==>c;CCK3,SIK3,SOK3) "Create branch"
Attempts to create a new branch. If unsuccessful (because
not enough space), c=1. Otherwise c=0 and CCK3, SIK3, and
SOK3 are keys to use. The CCK3 returned is used also to
identify this branch. Key BID ("branch identifier") will
be associated with this branch. {You get this key back
with (p2,tmmk7).}
TMMK(1;CCK3==>c;) "Destroy branch"
CCK3 must be a key identifying a branch other than the
control branch; if not, c=1. The branch is destroyed. EOF is signaled on the corresponding SIK3 and SOK3.
If the branch destroyed was the current input branch, the
control branch becomes the current input branch. If the
branch destroyed was the current output branch, the control
branch becomes the current output branch.
If the branch destroyed was the current input branch and
there was a transmission in progress, the transmission is
considered to be still in progress on the control branch.
In this case c=2, otherwise c=0. The next characters read
may be echoed according to the parameters of the old input
branch.
In this case it is recommended that a yellow ball be
sent from the control branch. (The command language interpreter
may also want to send a message informing the user that
he is now talking to the control branch.) Data read should
be discarded until the orange ball comes back; the orange
ball ends the transmission and thereafter data is echoed
correctly.
TMMK(2;CCK3==>c;) "Switch input"
CCK3 must be a key identifying a branch; if not, c=1.
If there is a transmission in progress on the current input
branch, c may be 2. Otherwise, c=0 and the branch that
CCK3 identifies is made the current input branch.
Programming note: In normal use, this operation can only
be used to switch from the control branch, because in general
the command language interpreter will not know whether a
transmission is in progress on any other branch. Only the
switch or attention character can switch from another branch.
TMMK(3;CCK3==>c;) "Switch output"
CCK3 must be a key identifying a branch; if not, c=1.
Otherwise, c=0 and the branch that CCK3 identifies is made
the current output branch.
TMMK(4;==>;SIKA,SOKA,CCKA) "Destroy TMM"
Destroys the TMM and signals EOF on the control branch
SIK3 and SOK3. All branches other than the control branch
must first be destroyed with "destroy branch".
Since the TMM reads all the time, there are no circumstances
under which SIKA is guaranteed to be available. If not
available, DK(0) is returned in this position. Similarly
if SOKA is not available, SK(0) is returned in this position.
Since no limit for SOKA is returned, the user will have
to assume a limit of zero initially.
TMMK(5,data;CCK3==>c;) "Generate ASCII input"
{ni}"Generate EBCDIC input"
{ni}"Generate screen mode input"
This is needed to make a PA1 appear on a branch.
TMMK(6;==>;) "Send gobbler"
Sends a gobbler on CCKA. {Of course, the gobbler may
gobble data from several branches.}
Warning: Use of this operation may interfere with correct
operation of yellow/orange ball logic on any branch. The
interference may continue long after the operation has completed.
To avoid interference, use instead the "send gobbler" function
on the individual CCK3s.
TMMK(7;==>c;CCK3,BID) "Wait
for active branch"
A branch is either (_active) or inactive. A branch other
than the control branch becomes active when:
(1) it enters the state in which its
output interface has data to output and {can't output it
because} it is not the output branch,
or (2) it enters the state in which it is not the input branch
and its input interface needs data.
{ni}Perhaps a branch should become active when it signals
EOF on SIK3 or SOK3.
The control branch is never active.
This operation waits until there is an active branch. Then
it selects an active branch, makes it inactive, and returns
its CCK3 and the BID associated with it. c = a + b where
a = 1 if the event (1) above has happened since the branch
became inactive, 0 otherwise;
and b = 2 if the event (2) above has happened since the branch
became inactive, 0 otherwise.
If there is already a domain waiting, c = -1.
TMMK(8;CCK3==>c;) "Branch status"
CCK3 must be a key identifying a branch; if not, c=1.
Otherwise, returns in c the following bits telling about
the branch:
X'20' on iff branch is waiting for input
X'10' on iff branch is the current input branch
X'08' on iff branch is the current output branch
X'04' on iff branch has output to send
X'02' on iff branch is the control branch
An operation could be added to discard or reroute
output from a specified branch.
Here is one proposal. This allows implementing a command
system that creates a new branch for, say, the editor, and
when the editor is finished and returns, any data typed
ahead but unread by the editor could be processed by the
command system, without requiring the user to explicitly
switch to the command system. (This is how CMS works.)
When a branch is deleted, if its SIK3 is consuming, a new
SIK3 key would be returned which could be used to read any
input that was buffered for that branch.
TMMK(kt;==>X'1060E';)