home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / compiler / fpc / source / seqtoblk.seq < prev    next >
Text File  |  1988-09-19  |  1KB  |  37 lines

  1. \ SEQTOBLK.SEQ  Convert from Sequential file to Blocks. by Tom Zimmer
  2.  
  3.  
  4. : ?writerror    ( f1 --- )
  5.                 if      cr ." Error Writing to " seqhandle+ count type
  6.                         seqhandle+ hclose drop
  7.                 then    ;
  8.  
  9. : transblk      ( --- F1 )
  10.                 ascii \ pad c!
  11.                 pad 64 seqhandle+ hwrite 64 - ?writerror
  12.                 14 0
  13.                 do      lineread dup count 2- 64 min 0 max + 64 blank
  14.                         1+ 64 seqhandle+ hwrite 64 - ?writerror
  15.                 loop    pad 1+ 64 seqhandle+ hwrite 64 - ?writerror
  16.                         ." ." outbuf c@ 0= ;
  17.  
  18. : conv          ( --- )
  19.                 cr ." Only converts files with extension .SEQ"
  20.                 cr ." New files are created with a .SCR extension."
  21.                 cr ." DONOT specify the file extension."
  22.                 cr ." Filename to convert? "
  23.                 query bl word $hopen abort" Couldn't Open file!"
  24.                 seqhandle seqhandle+ $>handle
  25.                 " SCR" ">$ seqhandle+ $>ext
  26.                 seqhandle+ hcreate abort" Couldn't Create the .SCR file."
  27.                 pad 1024 blank
  28.                 pad 1024 seqhandle+ hwrite 1024 - ?writerror
  29.                 off> INSTART
  30.                 off> INLENGTH
  31.                 begin   transblk
  32.                 until   seqhandle+ hclose drop
  33.                         seqhandle hclose drop ;
  34.  
  35.  
  36.  
  37.