The following page contains reserved words. These are not part of the ANS Forth Standard. They are just proposed by various people and published here at FORTH.SF.NET for public review.

:NON:
:STD:

TOC


R.7 Block reserved extension words

A forth system must include the block word set if it implements file word set. The mapping between blocks to a file is system dependent, a simple way is to map one fileid and have block number 0 be at the start of the file and the maximum block number to be an equivalent of
 : #blocks blockhandle file-size drop b/buf um/mod nip ; 
The following names stem from win32forth and its predecessors, implementors are advised to use these names to create the feature of mapping a single file as the current block file - or otherwise ignore these word names for user implemenations on top of a more complex one.


R.7.001 BLOCKHANDLE
BLOCK RES EXT
        ( -- fileid )

Returns the current block file handle

See: 11.3.2 Blocks in files 11.3.1.1 File identifiers


R.7.002 B/BUF
BLOCK RES EXT
        ( -- u )

Returns the length of each block. Traditionally 1024.

See: 11.3.2 Blocks in files


R.7.003 SET-BLOCKFILE
BLOCK RES EXT
        ( fileid -- )

Set the block file handle. May need to handle cached blocks.

See: 11.3.1.1 File identifiers 7.6.1.2400 UPDATE R.7.001 BLOCKHANDLE


R.7.004 OPEN-BLOCKFILE
BLOCK RES EXT
        ( "filename" -- )

Open the filename, usually in r/w mode. If successful then set it as the current block file, otherwise abort.

See: 11.3.1.1 File identifiers 11.6.1.1970 OPEN-FILE, 11.6.1.2056 R/W, R.7.003 SET-BLOCKFILE


R.7.005 CLOSE-BLOCKFILE
BLOCK RES EXT
        ( -- )

Flush and close the current block file.

See: 11.3.1.1 File identifiers 7.6.1.1559 FLUSH, 11.6.1.0900 CLOSE-FILE, R.7.001 BLOCKHANDLE R.7.003 SET-BLOCKFILE


R.7.006 CREATE-BLOCKFILE
BLOCK RES EXT
        ( u1 "filename" -- )

create a blank file of u1 block long.

See: 11.3.1.1 File identifiers 11.6.1.1010 CREATE-FILE, 11.6.1.2147 RESIZE-FILE, R.7.003 SET-BLOCKFILE 7.6.2.1330 EMPTY-BUFFERS; 7.6.1.1559 FLUSH,


Table of Contents
Next Section