Envoy Application Programming Manual

Table Of Contents
BISYNC Centralized Multipoint Supervisor Protocol
Envoy Application Programming Manual427159-001
4-50
Programming Examples
Example 4-20. Program Code for Poll and Select Procedures (Page 2 of 7)
STRING
.saddr^list[ 0 : addr^size * num^entries * 2 - 1] :=
[ SYN, "PA", ENQ, ! entry 0, station 0 poll.
SYN, "PB", ENQ, ! entry 1, station 1 poll.
SYN, "PC", ENQ, ! entry 2, station 2 poll.
SYN, "PD", ENQ, ! entry 3, station 3 poll.
SYN, "Sa", ENQ, ! entry 4, station 0 select.
SYN, "Sb", ENQ, ! entry 5, station 1 select.
SYN, "Sc", ENQ, ! entry 6, station 2 select.
SYN, "Sd", ENQ ]; ! entry 7, station 3 select.
INT .addr^list := @saddr^list '>>' 1;
?SOURCE $SYSTEM.SYSTEM.EXTDECS (ABEND, AWAITIO, CANCEL,
? CHANGELIST, CLOSE, CONTROL,
? DEBUG, DEFINELIST, FILEERROR,
? FILEINFO, OPEN, READ, STOP,
? WRITE, WRITEREAD)
! This procedure performs the polling function. A 1 is
! returned if a station responded to the poll, a 0 is
! returned if not.
INT PROC poll;
BEGIN
INT buf[0:1];
CALL READ (linefnum,linebuf,linecnt,linelen);
IF = THEN ! a station responded.
BEGIN
! let the write complete at the remote
! station.
CALL READ (linefnum,buf,3);
RETURN 1;
END;
! no response to poll or error in poll.
! clear the line and restore any nonresponding
! stations.
CALL CONTROL (linefnum,13); ! send EOT.
CALL CHANGELIST (linefnum,-2,0); ! clear
!.nonresponding list
RETURN 0;
END;