GDSX (Extended General Device Support) Manual
LINE^HANDLER Example, Design
Extended General Device Support (GDSX) Manual—529931-001
7-14
LINE^HANDLER Procedure
The second parameter is internal^line^no. Each LINE^HANDLER task has exactly one
line control block (LCB) associated with it. The value of internal^line^no is an index
used to find this task’s LCB in the array of LCBs. This is discussed further in the
Inspect exercise later in this section.
The third parameter is in^queue^file^num, which contains a file number for a TSCODE-
maintained $RECEIVE-like queue of intertask messages sent to this task from all
DEVICE^HANDLER tasks. The value of n^queue^file^num is equal to (MAXFILES +
1) for every LINE^HANDLER task created.
Example 7-1 also shows some literals used for analyzing the two different kinds of
intertask requests that are expected by USCODE. These literals may be sourced in
from the iocb^layout section of DCCBDECS. (See Appendix C, DCCBDECS and
ULHDECSE Listings.)
The variable wt^rd^iocb^list is the queue used to store IOCBs for pending
^WRITEREADs to the LINE file. The queue is a circular list, maintained with an oldest
index that points to the address of the IOCB for which a ^WRITEREAD has been sent
to the LINE file (if one has) and with a newest index that points to the next available
element in the queue. The list is empty if the value of oldest is equal to the value of
newest.
Wt^iocb holds the IOCB for the one possible outstanding ^WRITE operation, and
line^iocb holds the IOCB for the current LINE file operation, whether a WRITE or
WRITEREAD. Msg^buf is the buffer used when sending the WRITE or WRITEREAD.
Decoding Events
Processing in the main procedure was discussed Basic Structure of LINE^HANDLER
Code on page 7-10. Example 7-2 shows the example code.
Example 7-1. LINE^HANDLER Local Declarations
PROC LINE^HANDLER (LINE^FILE^NUM, INTERNAL^LINE^NO, IN^QUEUE^FILE^NUM);
INT LINE^FILE^NUM, INTERNAL^LINE^NO, IN^QUEUE^FILE^NUM;
BEGIN
LITERAL DISP^STOP = %000001, ! EVENT MASKS--THESE LITERALS MAY BE
DISP^ITC = %000020, ! SOURCED IN FROM DCCBDECS
DISP^IOC = %000040,
WT^OP = 1, ! IOCB.OPTYPE VALUES
WT^RD^OP = 3;
LITERAL LIST^SZ = 15; ! MAX NUMBER OF D^H IOCBS
! WE CAN SAVE
INT(32) .WT^RD^IOCB^LIST[0:LIST^SZ-1]; !ARRAY FOR SAVING IOCBS
! FOR OUTSTANDING WRITEREADS FROM D^H TASKS
INT .EXT DH^IOCB(IOCB^TEMPLATE),
.EXT LINE^IOCB(IOCB^TEMPLATE),
.EXT WT^IOCB(IOCB^TEMPLATE); ! IOCB FOR THE ONE
! OUTSTANDING D^H WRITE
INT OLDEST, NEWEST; ! INDICES FOR WT^RD^IOCB^LIST
INT .EXT MSG^BUF;
INT EVT;