Guardian Programmer's Guide

Table Of Contents
Writing a Terminal Simulator
Guardian Programmer’s Guide 421922-014
24 - 12
Processing Device-Type Information Requests
Processing Device-Type Information Requests
A requester process can call a procedure such as FILE_GETINFO[BYNAME]_ to
determine the device type of the terminal-simulation process. When another process
requests device-type information from the terminal-simulation process, system
message -106 is sent to the terminal-simulation process. The format of system
message -106 is as follows:
The terminal-simulation process must reply with a message in the following format:
The terminal-simulation process should return 6 in replymsg[1] to indicate the device
type for a terminal and 30 in replymsg[2] to indicate device substitution. That is, the
device-type value for a terminal is substituted for the device-type value for a process.
The following code fragment processes requests for device-type information:
STRUCT REPLY^TO^106;
BEGIN
INT MESSAGE^NUMBER;
INT DEVICE^TYPE;
INT DEVICE^SUBTYPE;
INT RESERVED[0:2];
INT RECORD^LEN;
END;
.
.
CALL READUPDATEX(RECV^NUM,SBUFFER,RCOUNT,BYTES^READ);
CALL FILE_GETINFO_(RECV^NUM,ERROR);
CALL FILE_GETRECEIVEINFO_(RECEIVE^INFO);
IF ERROR = 6 THEN !system message
BEGIN
IF SBUFFER[0] = -106 THEN
!It is a request for device-type information:
Structure of system message -106:
sysmsg[0] = -106
sysmsg[1:3] = reserved
sysmsg[4] = length in bytes of the qualifier
name
sysmsg[5] FOR sysmsg[4] = the qualifier name
Structure of -106 reply message:
replymsg[0] = -106
replymsg[1] = device type
replymsg[2] = device subtype
replymsg[3:5] = reserved (filled with -1)
replymsg[6] = physical-record length