Guardian Programmer's Guide

Table Of Contents
Communicating With Terminals
Guardian Programmer’s Guide 421922-014
10 - 4
Opening a Terminal
On return from a call to SETMODE for one of the calls listed in Table 10-2, the
condition code should be CCE if the function was performed successfully. A condition
code of CCL indicates an error. A condition code of CCG indicates that the attempted
SETMODE function is invalid for the type of device.
Once you change the mode of terminal using one of these SETMODE functions, the
change remains in effect for all processes that use the terminal until you revoke the
change by issuing another call to the SETMODE procedure.
You can use the last-params parameter of the SETMODE procedure to obtain the
previous settings associated with a function.
For complete details on any of the procedures, CONTROL operations, and SETMODE
functions listed here, refer to the Guardian Procedure Calls Reference Manual.
Opening a Terminal
You establish communication with a terminal the same way as you would for any file,
by issuing a call to the FILE_OPEN_ procedure. You must supply the FILE_OPEN_
procedure with the terminal name. FILE_OPEN_ returns a file number that you use to
make subsequent access to the terminal.
The most common way of opening a terminal is by opening the IN and OUT files
whose names are supplied in the Startup message. A less useful approach is to open
the home terminal of the process. These operations are described below. Note,
however, that opening terminals is not limited in this way; you can open any terminal
that you know the name or logical device number of.
Multiple concurrent opens for a terminal are permitted but limited depending on which
driver controls the terminal.
Opening the IN and OUT Files
Usually, the only terminals that an application needs to open are those terminals
named in the Startup message as the IN file and the OUT file. For example, if you
have saved your Startup message in a structure called CI^STARTUP as described in
Section 8, Communicating With a TACL Process, you would open your IN and OUT
files as follows. Note that the Startup message provides 12-word file names
compatible with C-series systems. To convert these file names into D-series file
names, you can use the OLDFILENAME_TO_FILENAME_ procedure.
LITERAL MAXLEN = 256;
STRING IN^TERMNAME[0:MAXLEN - 1];
STRING OUT^TERMNAME[0:MAXLEN - 1];
INT INFILE^LENGTH, OUTFILE^LENGTH;
STRUCT .CI^STARTUP; !Startup message
BEGIN
INT MSGCODE;
STRUCT DEFAULT;
BEGIN