home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / intelrmx86 / trans.p86 < prev   
Text File  |  2020-01-01  |  2KB  |  82 lines

  1. /*  Transmit routine */
  2. $compact
  3. $optimize(3)
  4.  
  5. trans$module: do;
  6.  
  7. $INCLUDE(:INC:LTKSEL.LIT)
  8.  
  9. declare true  literally '0FFH';
  10. declare false literally '0';
  11. declare cr    literally '0DH';
  12. declare lf    literally '0AH';
  13. declare null  literally '0';
  14.  
  15. $INCLUDE(:INC:NSLEEP.EXT)
  16. $INCLUDE(:INC:UREAD.EXT)
  17. $INCLUDE(:INC:UWRITE.EXT)
  18.  
  19. declare status word external;
  20. declare trans_wait word external;
  21. declare in$conn token external;
  22. declare out$conn token external;
  23. declare file$conn token external;
  24. declare iobuff(1024) byte external;
  25.  
  26. check$error: procedure (fatal) byte external;
  27.     declare fatal byte;
  28. end check$error;
  29.  
  30. nout: procedure(n) external;
  31.     declare n word;
  32. end nout;
  33.  
  34. do$co: procedure external;
  35. end do$co;
  36.  
  37. print: procedure(string) external;
  38.     declare string pointer;
  39. end print;
  40.  
  41. trans: procedure byte public;
  42.     declare (i,qcr) byte;
  43.     declare len byte;
  44.     declare (rec$num,len1) word;
  45.     rec$num=0;
  46.     qcr=true;
  47.     do while true;
  48.       len=DQ$READ(file$conn,@iobuff,64,@status);
  49.       if check$error(0) then return false;
  50.       if len=0 then goto clean$up;
  51.       len1=256;
  52.       do i=0 to len-1;
  53.         iobuff(len1)=iobuff(i);
  54.         if qcr then do;
  55.           qcr=false;
  56.           if iobuff(len1)=lf then len1=len1-1;
  57.         end;
  58.         else if iobuff(len1)=cr then qcr=true;
  59.         len1=len1+1;
  60.       end;
  61.     CALL NOUT(LEN1);
  62.       if len1>256 then
  63.         call DQ$WRITE(out$conn,@iobuff(256),len1-256,@status);
  64.       if check$error(0) then return false;
  65.       rec$num=rec$num+1;
  66.       call nout(rec$num);
  67.       call print(@(cr,null));
  68.       call RQ$SLEEP(trans_wait,@status);
  69.       if check$error(0) then return false;
  70.       len=DQ$READ(in$conn,@iobuff,250,@status);
  71.       if check$error(0) then return false;
  72.     end;
  73. clean$up:
  74.     call RQ$SLEEP(trans_wait,@status);
  75.     if check$error(0) then return false;
  76.     len=DQ$READ(in$conn,@iobuff,250,@status);
  77.     if check$error(0) then return false;
  78.     return true;
  79. end trans;
  80.  
  81. end trans$module;
  82.