Envoy Application Programming Manual

Table Of Contents
Asynchronous Line Supervisor Protocol
Envoy Application Programming Manual427159-001
10-23
Read-Only Programming Examples
Read-Only Programming Examples
Example 10-6 shows the use of read-only mode with a simplex line. The application
program reads from a simplex line and writes to a line printer.
Example 10-6. Read-Only Programming Example (Page 1 of 2)
! Simplex programming example:
! Read-only line to a RS-232C printer.
INT t^count,
rlineno
rlinedef[0:12],
plineno,
plinedef[0:12],
buffer[0:81];
STRING .rline := @rlinedef ’<<’ 1,
.rpbuff := @buffer ’<<’ 1,
.pline := @plinedef ’<<’ 1;
LITERAL cr = %15, !ASCII carriage return.
lf = %12, !ASCII line feed
cancan = %14030, !ASCII CAN char for termination.
full^plex = %10, !SETMODE for full-duplex.
r^continuous = %4, !SETMODE for READ continuous.
set^ltype = 16, !SETMODE function line type.
set^tmout = 15; !SETMODE function timeout value.
?SOURCE $SYSTEM.EXTDECS(OPEN,CLOSE,READ,WRITE,SETMODE)
PROC line^recorder MAIN;
BEGIN
pline ’:=’ "$RS232PT ";
CALL OPEN (plinedef,plineno); ! open printer line.
IF < THEN GOTO stop^pfail;
t^count := full^plex;
!set printer line as full-duplex since write only.
CALL SETMODE (plineno,set^ltype,t^count);
rline ’:=’ "$SIMPLEX ";
CALL OPEN (rlinedef,rlineno); ! open read-only line.
IF < THEN
BEGIN ! print error
rpbuff ’:=’ "READ LINE OPEN FAILURE"; ! message and
CALL WRITE (plineno,buffer,22); ! close.
GOTO stop^rfail;
END;