CLOSE-BLOCKFILE
( -- )
[FTH] w32for
=> [FORTH]
w32for-implementation:
blockhandle -1 <> if flush close-file drop then
-1 set-blockfile
in pfe:
: CLOSE-BLOCKFILE
BLOCK-FILE ?DUP IF FLUSH CLOSE-FILE DROP THEN
OFF> BLOCK-FILE ;
primitive code = [p4_close_blockfile]
OPEN-BLOCKFILE
( "filename" -- )
[FTH] w32for
=> [FORTH]
w32for-implementation:
close-blockfile
parse-word r/w open-file abort" failed to open block-file"
set-blockfile
empty-buffers
primitive code = [p4_open_blockfile]
CREATE-BLOCKFILE
( blocks-count "filename" -- )
[FTH] w32for
=> [FORTH]
w32for-implementation:
close-blockfile
parse-word r/w create-file abort" failed to create block-file"
set-blockfile
dup b/buf m* blockhandle resize-file
abort" unable to create a file of that size"
empty-buffers
0 do i wipe loop
flush
pfe does not wipe the buffers
primitive code = [p4_create_blockfile]
SET-BLOCKFILE
( block-file* -- )
[EXT] win32for
=> "EXTENSIONS"
win32forth uses a system-filedescriptor where -1 means unused
in the BLOCKHANDLE, but we use a "FILE*"-like structure, so NULL
means NOT-IN-USE. Here we set it.
primitive code = [p4_set_blockfile]
0 CREATE-BLOCKFILE
=> "EXTENSIONS"
(no description)
primitive code = [p4_zero_create_blockfile]