home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / computervision / kermit.bufill < prev    next >
Text File  |  2020-01-01  |  2KB  |  52 lines

  1. ; 23 jly esj on cr, add lf
  2. ; 18 jly 85 esj converted
  3. ;;;;;;;;;;;;;;       BUFILL            ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4.       E'F A:S(NWLS)
  5.       E'O BUFILL.(BUFFER)
  6.  
  7. ;     fill up the buffer with character byte from the sending disk file
  8. ;     BUFFER is used to stored the data from the sending disk file
  9.  
  10. /INCLUDE BYU.PROG.KERMIT.SYM.EQU.KERCOM
  11. /INCLUDE BYU.PROG.KERMIT.SYM.EQU.KERDEF
  12.  
  13.       I'R I,BUFFER(132)
  14.  
  15.       I=0
  16.  
  17.       R'T
  18.          E'E DGETCH.(T,FD)                 ;keep reading byte from the d
  19.          W'R T .E. -1 , B'K                ;file until we reach an EOF,o
  20.                                            ;we have enough byte to fill
  21.                                            ;buffer, return from within t
  22.                                            ;directly
  23.          W'R ((T.LT.BLANK).OR.(T.EQ.DEL).OR.(T.EQ.QUOTE))
  24.              W'R (T.EQ.CR)               ;it is the line delimiter of
  25.                 BUFFER(I)=QUOTE            ;this system, insert the CR
  26.                 I=I+1                      ;before the LF
  27.                 BUFFER(I)=CTL.(CR)
  28.                 I=I+1
  29.                 T = LF                    ; and put lf in buffer
  30.              E'L
  31.              BUFFER(I)=QUOTE               ;we got a character that
  32.              I=I+1                         ;quoting
  33.              W'R (T.NE.QUOTE),T=CTL.(T)
  34.          E'L
  35.          BUFFER(I)=T
  36.          I=I+1
  37.          W'R (I.GT.(SPSIZ-8))      ;read up to spsiz-8 byte from disk
  38.             LCLSTATE=I               ;I byte was read
  39.             F'N LCLSTATE
  40.          E'L
  41.       F'R
  42.  
  43.       W'R (I.EQ.0)
  44.         LCLSTATE=EOF                   ;zero byte was read
  45.         F'N LCLSTATE
  46.       O'E
  47.         LCLSTATE=I                    ;partial EOF was detected
  48.         F'N LCLSTATE
  49.       E'L
  50.       F'N LCLSTATE
  51.       E'N
  52.