Guardian Programmer's Guide

Table Of Contents
Communicating With Terminals
Guardian Programmer’s Guide 421922-014
10 - 23
Managing the BREAK Key
The advantage of having the application program handle triggering is that only one
word of buffer space is used while the user enters information. The buffer space is
allocated after the user presses the ENTER key. (Terminals operating in normal page
mode require that the entire system buffer space be allocated during the wait for a
transfer to take place.)
Here’s how application triggering works. The application program initiates a read
operation of one character to the pseudopolled terminal. This read waits for the ready
character.
RCOUNT := 1;
CALL READX(TERM^NUM,
SBUFFER,
RCOUNT,
COUNT^READ);
Reading one byte causes one byte of system buffer space to be allocated. The user
types in the page of text, then presses the ENTER key. Pressing ENTER causes a
ready character (for example, device-control-2) to be sent to the computer system,
causing the read to finish.
The application then issues the trigger character (for example, device-control-1) to the
terminal and issues a read of 600 characters. To ensure that the system is ready to
start reading when the terminal starts transmitting, you must combine both operations
into one using WRITEREADX:
SBUFFER := %21; !device-control-1
WCOUNT := 1;
RCOUNT := 600;
CALL WRITEREADX(TERM^NUM,
SBUFFER,
WCOUNT,
RCOUNT,
COUNT^READ);
This call to WRITEREADX causes 300 words (600 bytes) of system buffer space to be
allocated. Sending the device-control-1 character to the terminal causes the terminal
to send a page of information to the computer system. The page is returned to the
application process in SBUFFER, and the actual number of bytes read is returned in
COUNT^READ. (As with any file-system operation, the system buffer space is
deallocated after the read finishes.)
Managing the BREAK Key
The file system enables a user to signal a process by pressing the BREAK key. A
common example of the use of the BREAK key to signal a process is in the TACL
process: if an application started from a TACL prompt does not perform its own BREAK
handling, pressing the BREAK key while the application process is running returns
control of the terminal to the TACL process.
An application that performs its own BREAK processing can be interrupted from the
terminal without periodically checking the terminal for input; instead, the application