Name

pfe-block-misc-ext ? BLOCK-Misc Compatibility words

Synopsis

CLOSE-BLOCKFILE ( -- ) ?=>? ();?
[FORTH];
?
OPEN-BLOCKFILE ( "filename" -- ) ?=>? ();?
[FORTH];
?
CREATE-BLOCKFILE ( blocks-count "filename" -- ) ?=>? ();?
[FORTH];
?
SET-BLOCKFILE ( block-file* -- ) ?=>? ();?
"EXTENSIONS";
?
0 CREATE-BLOCKFILE ?=>? ();?
"EXTENSIONS";
?

Description

B/BUF ( -- bytesperbuffer-count ) [EXT]

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 ;
  

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 
  

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

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.

0 CREATE-BLOCKFILE - no description, sorry