Envoy Application Programming Manual

Table Of Contents
BISYNC Multipoint Tributary Protocol
Envoy Application Programming Manual427159-001
5-45
Programming Examples
Example 5-15. Program Code for BISYNC Multipoint Tributary (Page 6 of 7)
! Then the line is checked for a completion. If the
! completion indicates the line was polled, the message is
! sent to the supervisor (polling is indicated only if
! the station’s poll state is "active," which happens only if
! the station has something to send). If the completion
! indicates that the station was selected, the incoming
! message is displayed.
! The flag term^done is used to indicate whether a terminal
! WRITEREAD should be issued. If term^done = 2 then a
! WRITEREAD is issued. This happens in three instances: (1)
! at the start of program execution; (2) when the terminal
! completes and the associated message has been sent to the
! supervisor; and (3) when no terminal completion has
! occurred (that is, nothing was entered), the terminal
! WRITEREAD is cancelled so an incoming message can be
! displayed.
PROC doit;
BEGIN
INT done;
done := 0;
term^done := line^done := 2;
WHILE NOT done DO
BEGIN
IF term^done = 2 THEN
BEGIN
term^done := 0;
termbuf := "? ";
CALL WRITEREAD (termfnum,termbuf,1,132);
END;
IF line^done THEN
BEGIN
line^done := 0;
CALL READ (linefnum, linebuf, linecnt);
END;
IF NOT term^done THEN
CASE (term^done := check^term) OF
BEGIN
! 0 ! ; ! no completion.
! 1 ! IF termlen THEN
BEGIN ! something to send, so
! set poll active.
CALL CHANGELIST (linefnum,0,0);
IF < THEN CALL DEBUG;
END;