GDSX (Extended General Device Support) Manual
DEVICE^HANDLER Example, Design
Extended General Device Support (GDSX) Manual—529931-001
5-12
The DEVICE^HANDLER Procedure
If the condition code is > (CCG), a system message was received. The first character
of rcv^buf is examined to determine what kind of system message this is. The only
kind allowed for by this code is CTRL or SET^MD, -32 or -33, respectively. For
anything else, DEBUG is called.
Request Processing
Next in the source file is a section of code dealing with fault-tolerance processing, to be
discussed later in this section. Then there is code used to process the different types
of requests, shown in Example 5-4. A receiving buffer has already been allocated for
the data that came in on pseudo-$RECEIVE. Now a terminal buffer is allocated for the
data that will go out to the IOP.
Example 5-4. Request Processing (page 1 of 2)
@TERM^BUF := GETEXTPOOL(10,BUF^SIZE);
IF @TERM^BUF = 0D THEN CALL DEBUG;
CASE RQST^TYPE OF
BEGIN
WT^RD -> ! WRITEREAD
BEGIN
IF (NOT TAKE^OVER) THEN
BEGIN
CALL SCAN^BUF;
@MY^DCB := DCBTBL[INTERNAL^TERM^NO];
MY^DCB.WT^RD^PEND := TRUE; ! SET FLAG
! FOR USER^STOP PROCEDURE
CALL ^WRITEREADX(TERM^FILE^NUM,TERM^BUF,
RQSTR^WT^CT,RQSTR^RD^CT);
IF <> THEN CALL DEBUG;
CALL ^AWAITIOX(TERM^FILE^NUM,@TERM^BUF,
TERM^CT^RD);
CALL ^FILEINFO(TERM^FILE^NUM,FERR);
IF (FERR = 0) THEN
CALL ^REPLYX(TERM^BUF,TERM^CT^RD)
! NORMAL COMPLETION
ELSE
CALL ^REPLYX(,,,,FERR); ! APPL DEALS WITH
! IOP FS ERRORS
MY^DCB.WT^RD^PEND := FALSE; ! CLEAR FLAG
END;
END;
WT -> ! WRITE
BEGIN
CALL SCAN^BUF;
CALL ^WRITEX(TERM^FILE^NUM,TERM^BUF,RQSTR^WT^CT);
IF <> THEN CALL DEBUG;
CALL ^AWAITIOX(TERM^FILE^NUM);
CALL ^FILEINFO(TERM^FILE^NUM,FERR);
CALL ^REPLYX(,,,,FERR);
END;