Envoy Application Programming Manual

Table Of Contents
BISYNC Point-To-Point Protocol
Envoy Application Programming Manual427159-001
3-46
Line Bid
Example 3-18. Program Code for read^text and write^text (Page 2 of 5)
! This procedure is used to write a message to the remote
! station. This procedure embeds the appropriate line control
! characters. The file-system error number associated with
! the line is returned.
INT PROC write^text ( text , text^len );
INT .text, .text^len;
BEGIN
INT .linebuf[-1:max^line-1], ! data declarations.
writecnt, !
lerror; !
STRING
.slinebuf := @linebuf '<<' 1,
.s;
! format the message.
linebuf := DLE '<<' 8 + STX;
linebuf[1] ':=' text FOR ((text^len + 1) / 2);
@s := @slinebuf[2 + text^len];
s := ETX;
! send the message.
CALL WRITE (linefnum , linebuf[-1]
, @s[1] '-' @slinebuf[-2]);
IF = THEN
BEGIN
linestate := writestate;
RETURN 0;
END;
CALL FILEINFO (linefnum, lerror);
RETURN lerror;
END; ! write^text.