Envoy Application Programming Manual

Table Of Contents
Asynchronous Line Supervisor Protocol
Envoy Application Programming Manual427159-001
10-26
Asynchronous Supervisor Programming Example
The example in Example 10-8 demonstrates the sequence involved in polling a terminal
network and reading a message.
The example in Example 10-9
demonstrates the sequence involved in selecting a
terminal sending a message.
Example 10-8. Poll a Terminal and Read a Message
INT PROC poll^term;
BEGIN
INT index := 0;
FOR index := 0 TO num^entries DO
BEGIN
sbuff ’:=’ addr^list[index * addr^size]
FOR addr^size;
CALL WRITEREAD (lineno,buffer,addr^size,80,r^count);
IF < THEN
BEGIN
! handle the error.
END;
IF r^count <> no^data^cnt AND
buffer[0] <> no^data^ctl THEN
BEGIN
buffer := index;
RETURN data^return;
END;
END;
RETURN no^data^return;
END;
Example 10-9. Select a Terminal and Send a Message
INT PROC select^term;
BEGIN
CALL WRITE (lineno,buffer,80,t^count);
IF < THEN
BEGIN
! handle the error.
RETURN 1;
END;
RETURN 0;
END;