home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
forth
/
compiler
/
fpc
/
source
/
seqtoblk.seq
< prev
next >
Wrap
Text File
|
1988-09-19
|
1KB
|
37 lines
\ SEQTOBLK.SEQ Convert from Sequential file to Blocks. by Tom Zimmer
: ?writerror ( f1 --- )
if cr ." Error Writing to " seqhandle+ count type
seqhandle+ hclose drop
then ;
: transblk ( --- F1 )
ascii \ pad c!
pad 64 seqhandle+ hwrite 64 - ?writerror
14 0
do lineread dup count 2- 64 min 0 max + 64 blank
1+ 64 seqhandle+ hwrite 64 - ?writerror
loop pad 1+ 64 seqhandle+ hwrite 64 - ?writerror
." ." outbuf c@ 0= ;
: conv ( --- )
cr ." Only converts files with extension .SEQ"
cr ." New files are created with a .SCR extension."
cr ." DONOT specify the file extension."
cr ." Filename to convert? "
query bl word $hopen abort" Couldn't Open file!"
seqhandle seqhandle+ $>handle
" SCR" ">$ seqhandle+ $>ext
seqhandle+ hcreate abort" Couldn't Create the .SCR file."
pad 1024 blank
pad 1024 seqhandle+ hwrite 1024 - ?writerror
off> INSTART
off> INLENGTH
begin transblk
until seqhandle+ hclose drop
seqhandle hclose drop ;