Asynchronous Terminals and Printer Processes Programming Manual

TERMINAL PROGRAMMING CONSIDERATIONS
Conversational Mode
Example
Assume that a tab function is required on a conversational-
mode terminal. The EOF character is not needed, so it is
replaced by the horizontal tab character. The other system-
defined characters are retained.
LITERAL SET^SIG = 9, ! setmode, set interrupt chars
SET^SPACE = 6, ! setmode, set spacing mode
SPACE = 1, ! spacing mode = single space
NO^SPACE = 0; ! spacing mode = no space
.
STRING INTCHARS[0:3] := [ %010, ! backspace
%031, ! line cancel
%011, ! horizontal tab
%015 ]; ! carriage return (line
! termination)
INT IINTCHARS = INTCHARS; ! equivalence INT to STRING
! call SETMODE to set the new interrupt characters
CALL SETMODE ( HOME^TERM^NUM, SET^SIG, IINTCHARS,
IINTCHARS[1] );
! issue a read to the terminal
CALL READ ( HOME^TERM^NUM, BUFFER, 72, NUM^READ );
The interrupt characters are now set up. The following examples
show what happens when the terminal operator uses the TAB key.
The operator types the following information:
TODAY IS THE DAY<HT>
<HT> is the horizontal tab character. "TODAY IS THE DAY<HT>" is
returned in BUFFER, 17 is returned in NUM^READ. No line feed
occurs on the terminal.
Next, the application checks the last character received to
determine if <HT> was entered:
IF BUFFER [ NUM^READ - 1 ] = %011 THEN ... ! horizontal tab
Assuming that the cursor needs to move to column 30 (indicating
tabulation has occurred), call SETMODE to turn off single
spacing, then call WRITE to write blanks (%040) to the terminal:
4-7