GDSX (Extended General Device Support) Manual
DEVICE^HANDLER Example, Design
Extended General Device Support (GDSX) Manual—529931-001
5-10
The DEVICE^HANDLER Procedure
The first, term^file^num, is the pseudo-file number (not a Guardian file number) used
for I/O to the file that this task is to manage. Note that the DEVICE^HANDLER does
not open this file; TSCODE opens it, assigns a term^file^num for the task to use, and
passes this number when the call to DEVICE^HANDLER creates the task.
The second parameter is the internal^term^no. Each DEVICE^HANDLER task has
exactly one device control block (DCB) associated with it. Internal^term^no is an index
used to find this task’s DCB in the array of DCBs. This is discussed later in this
section.
If a task is configured with the SCF ADD SU command (which is discussed in
Section 6, LINE^HANDLER Example, Running and Managing), the SU’s SUTYPE
attribute can be set, indicating what type of terminal is being configured. When
TSCODE calls the DEVICE^HANDLER procedure, it passes this setting as the
term^type parameter; the DEVICE^HANDLER task can then use a CASE statement on
term^type to branch to different code for different types of terminals.
Example 5-2 also shows miscellaneous pointers as well as literals used for analyzing
the five different kinds of requests that may be received.
Reading and Decoding Requests
Although the SCAN^BUF subprocedure appears next in the source code (see
Appendix B, USKELEX and USKELEXC Listings), it is discussed with the different
types of request processing below.
Example 5-2. DEVICE^HANDLER Local Declarations
PROC DEVICE^HANDLER (TERM^FILE^NUM, INTERNAL^TERM^NO, TERM^TYPE);
INT TERM^FILE^NUM , ! FILE^NUM FOR THIS D^H TASK
INTERNAL^TERM^NO, ! TERM NUMBER FOR THIS D^H TASK
TERM^TYPE ; ! TERMINAL TYPE
BEGIN
!===============================================================
! Comment - USCODE can declare desired Device^Handler Local
! Variables here
!===============================================================
INT .EXT MY^DCB(DCB^TEMPLATE);
INT .EXT TERM^BUF;
STRING .EXT S^TERM^BUF;
INT .EXT RCV^BUF;
STRING .EXT S^RCV^BUF;
INT .EXT E^RCV^BUF := 0D;
INT RQSTR^WT^CT;
INT RQSTR^RD^CT;
INT TERM^CT^RD;
INT DOLR^RCV := 0;
INT RQST^TYPE := 0;
INT FERR;
INT TAKE^OVER;
LITERAL WT=1, RD=2, WT^RD=3, CTRL=4, SET^MD=5;
LITERAL BUF^SIZE = 1024;