GDSX Manual

Design and Development
Extended General Device Support (GDSX) Manual134303
2-97
The LINE^HANDLER Procedure
2. The state transition table is indexed based on the current line state and rslt. When
a match is found, byte 2 of the matching entry is stored in the local variable action
and the line state is changed to byte 3 of the entry. If a match is not found, there is
an error in constructing the state transition table.
3. The next line action is initiated by a CASE statement, which uses action as an index.
The possible actions are:
1 : la^null: Do nothing (but continue in the state machine).
2 : la^write: Initiate a WRITE operation on the line. If the operation is
successfully initiated, exit the state machine.
3 : la^abort: Issue a “Line aborted” message and exit the state machine.
4 : la^read: Initiate a READ operation on the line. If the operation is
successfully initiated, exit the state machine.
5 : la^reset: Initiate a CONTROL 13 on the line. If the operation is successfully
initiated, exit the state machine.
6 : la^wait: Exit the state machine.
Note that in those cases that initiate nowait I/O operations, if the operation is
initiated successfully, the state machine is exited and is reentered when the I/O
completes.
If the I/O is not successfully initiated, a file management error number is stored in
the variable action^error, and the subprocedure that attempted the I/O returns zero.
When this happens, the state machine obtains a temporary IOCB by a call on
ALLOCATEIOCB and stores action^error in iocb.err. In this way, the code for
handling I/O completions within the state machine does not have to be sensitive to
whether the error was detected at I/O initiation time or was returned at I/O
completion.
When an initial read operation completes, the subprocedure INITIAL^READ is called.
INITIAL^READ resets the poll^halting flag, then determines whether polling completed
with no subdevice responding (file error 176). If the latter is the case, any subdevices on
the slow poll list are placed back on the poll list by a CHANGELIST(.., -2,..) call. As
the line is now idle, a call is made to CHECK^CANCELS to get rid of any canceled
IOCBs.
If no error occurred on the READ operation, some subdevice responded to the poll. A
call to the subprocedure FIND^DCB locates the DCB corresponding to this subdevice.
FIND^DCB returns 1 if the DCB is located, and 0 otherwise. If 1 is returned,
FIND^DCB has also set adcb to point to the proper DCB and aiocb to point to the
IOCB for the READ request.
Aiocb.bufaddr is examined to see whether the DEVICE^HANDLER task passed a
buffer to ^READ. If it did not, a buffer is allocated and given to the task. Note that if
the buffer owner is not changed, aiocb.bufaddr is reset, and the user’s request is
Note. If this LINE^HANDLER is to be used in a production environment, handling of the slow
poll list should be improved.