/* Transmit routine */ $compact $optimize(3) trans$module: do; $INCLUDE(:INC:LTKSEL.LIT) declare true literally '0FFH'; declare false literally '0'; declare cr literally '0DH'; declare lf literally '0AH'; declare null literally '0'; $INCLUDE(:INC:NSLEEP.EXT) $INCLUDE(:INC:UREAD.EXT) $INCLUDE(:INC:UWRITE.EXT) declare status word external; declare trans_wait word external; declare in$conn token external; declare out$conn token external; declare file$conn token external; declare iobuff(1024) byte external; check$error: procedure (fatal) byte external; declare fatal byte; end check$error; nout: procedure(n) external; declare n word; end nout; do$co: procedure external; end do$co; print: procedure(string) external; declare string pointer; end print; trans: procedure byte public; declare (i,qcr) byte; declare len byte; declare (rec$num,len1) word; rec$num=0; qcr=true; do while true; len=DQ$READ(file$conn,@iobuff,64,@status); if check$error(0) then return false; if len=0 then goto clean$up; len1=256; do i=0 to len-1; iobuff(len1)=iobuff(i); if qcr then do; qcr=false; if iobuff(len1)=lf then len1=len1-1; end; else if iobuff(len1)=cr then qcr=true; len1=len1+1; end; CALL NOUT(LEN1); if len1>256 then call DQ$WRITE(out$conn,@iobuff(256),len1-256,@status); if check$error(0) then return false; rec$num=rec$num+1; call nout(rec$num); call print(@(cr,null)); call RQ$SLEEP(trans_wait,@status); if check$error(0) then return false; len=DQ$READ(in$conn,@iobuff,250,@status); if check$error(0) then return false; end; clean$up: call RQ$SLEEP(trans_wait,@status); if check$error(0) then return false; len=DQ$READ(in$conn,@iobuff,250,@status); if check$error(0) then return false; return true; end trans; end trans$module;