Guardian Programmer's Guide

Table Of Contents
Writing a Terminal Simulator
Guardian Programmer’s Guide 421922-014
24 - 7
Processing I/O Requests
Immediately after reading a message from $RECEIVE, the terminal-simulation process
should call FILE_GETRECEIVEINFO_ to check the value returned for the I/O type.
The meanings of the I/O type values that can be returned are as follows:
After the terminal-simulation process performs any processing associated with the
request, it must respond to the requester. Responding to the requester is performed
by calling the REPLY[X] procedure.
You can use the error-return parameter of the REPLY[X] procedure to return error
codes to the requester. The error number you specify in the error-return
parameter also controls the condition code returned to the requester.
The following example checks the I/O type of a request received from the requester. If
i
t is a WRITE[X] request, the code sends the message to the terminal. If the request is
for a READ operation, then the code fragment reads information from the terminal and
returns it to the requester. For a WRITEREAD[X] request, the code fragment writes
the message to the terminal, waits for a response, and then writes the response back
to the requester process.
0 The most recent message read from $RECEIVE was not an I/O request.
The terminal-simulation process should process the message as a system
me
ssage.
1 The most recent message read from $RECEIVE was a WRITE[X] request.
The buffer for the read from $RECEIVE contains the data that was written by the
requester. The count-read parameter for the read from $RECEIVE indicates
the number of bytes written by the requester.
2 The most recent message read from $RECEIVE was a READ[X] request.
The buffer for the read from $RECEIVE contains no data. The maximum reply
count returned by the FILE_GETRECEIVEINFO_ procedure indicates the
maximum number of bytes the requester expects to read.
3 The most recent message read from $RECEIVE was a WRITEREAD[X] request.
The buffer for the read from $RECEIVE contains the data that was written by the
requester, if any. The count-read parameter for the read from $RECEIVE
indicates how many bytes were written by the requester. The maximum reply
count returned by the FILE_GETRECEIVEINFO_ procedure indicates the
maximum number of bytes the requester expects to read.