#BLOCKS ( -- UNSIGNED )
UNSIGNED is the number of blocks available in the block file.
BLK ( -- DATA -> UNSIGNED )
DATA -> UNSIGNED is the address of a cell containing zero or the number of the block being interpreted. If BLK contains zero, the input source is not a block, and can be identified by SOURCE-ID. An ambiguous condition exists if a program directly alters the contents of BLK.
BLK-BUFF ( -- CDATA -> CHARACTER )
CDATA -> CHARACTER is the address of a single buffer for C/B characters, called block buffer. This buffer is always used when transferring a block from or to the block file.
BLK-STAT ( -- DATA -> SIGNED )
DATA -> SIGNED is the address of a cell containing a number that describes the status of the block buffer. If the number is zero, the block buffer is unassigned. Otherwise, the block buffer is assigned to the block whose number is the absolute value of the number. If the number is negative, the block buffer has been modified with respect to the block in the block file it is assigned to.
BLOCK ( UNSIGNED -- CDATA -> CHARACTER )
If the block buffer is unassigned, transfer block UNSIGNED from the block file to the block buffer.
If block UNSIGNED is not already in the block buffer, and the block buffer is assigned but has not been modified, transfer block UNSIGNED from the block file to the block buffer.
If block UNSIGNED is not already in the block buffer, and the block buffer is assigned and has been modified, transfer the block to the block file and then transfer block UNSIGNED from the block file to the block buffer.
Assign block UNSIGNED to the block buffer. CDATA -> CHARACTER is the address of the block buffer.
Exceptions are thrown if UNSIGNED is not a valid block number or if a block buffer can not be written to or read from the block file.
BUFFER ( UNSIGNED -- CDATA -> CHARACTER )
If block UNSIGNED is not already in the block buffer, and the block buffer is assigned and has been modified, transfer the block to the block file.
Assign block UNSIGNED to the block buffer. CDATA -> CHARACTER is the address of the block buffer.
Exceptions are thrown if UNSIGNED is not a valid block number or if a block buffer can not be written to or read from the block file.
C/B ( -- UNSIGNED )
UNSIGNED is the number of characters in a block (1024).
C/L ( -- UNSIGNED )
UNSIGNED is the number of characters in each line of text in a block (64).
EMPTY-BUFFERS ( -- )
Unassign the block buffer. Do not transfer the contents of the block buffer to the block file.
EVALUATE ( CDATA -> CHARACTER UNSIGNED -- )
Extend the execution semantics of EVALUATE with the following:
Save the content of BLK, store 0 in BLK, and perform EVALUATE. Then restore the content of BLK.
FLUSH ( -- )
Perform the function of SAVE-BUFFERS, then unassign the block buffer.
LIST ( UNSIGNED -- )
Display block UNSIGNED as 16 lines of text. Store UNSIGNED in SCR.
LOAD ( UNSIGNED -- )
Save the current input source specification. Store UNSIGNED in BLK, thus making block UNSIGNED the input source and setting the input buffer to encompass its contents. Set >IN to zero and interpret. When the parse area is exhausted, restore the prior input source specification. Other stack effects are due to the words LOADed.
An exception is thrown if UNSIGNED is not a valid block number.
QUIT ( -- )
Extend the execution semantics of QUIT with the following:
Store 0 in BLK and perform QUIT.
REFILL ( -- FLAG )
Extend the execution semantics of REFILL with the following:
When the input source is a block, make the next block the input source and current input buffer by adding one to the value of BLK and setting >IN to zero. Return TRUE if the new value of BLK is a valid block number, otherwise FALSE.
R/W ( CDATA -> CHARACTER UNSIGNED FLAG -- )
If flag is FALSE, read the contents of block UNSIGNED from the block file into the buffer with start address CDATA -> CHARACTER. If flag is TRUE, write the contents of the buffer starting at CDATA -> CHARACTER to block UNSIGNED of the block file.
Exceptions are thrown if UNSIGNED is not a valid block number or if the block can not be written to or read from the block file.
RESTORE-INPUT ( INPUT-SOURCE -- FLAG )
Attempt to restore the input source specification to the state described by INPUT-SOURCE. The input source specification includes the content of BLK.FLAG is true if the input source specification cannot be restored.
An ambiguous condition exists if the input source represented by the arguments is not the same as the current input source.
Extend the execution semantics of RESTORE-INPUT by including the content of BLK in the current state of the input source specification.
SAVE-BUFFERS ( -- )
If the block buffer is marked as modified, transfer its contents to the block file. Mark the block buffer as not modified.
SAVE-INPUT ( -- INPUT-SOURCE )
INPUT-SOURCE describes the current state of the input source specification for later use by RESTORE-INPUT. The input source specification includes the content of BLK.
SCR ( -- DATA -> UNSIGNED )
DATA -> UNSIGNED is the address of a cell containing the block number of the block most recently LISTed.
SOURCE ( CDATA -> CHARACTER UNSIGNED -- )
Extend the execution semantics of SOURCE with the following:
When the input source is a block, CDATA -> CHARACTER is the address of the block buffer assigned to block BLK, and UNSIGNED is the number of characters in the block.
THRU ( UNSIGNED 1ST -- )
LOAD the blocks numbered UNSIGNED through 1ST in sequence. Other stack effects are due to the words LOADed.
An exception is thrown if UNSIGNED is greater than 1ST, or if either UNSIGNED or 1ST are no valid block numbers.
UPDATE ( -- )
Mark the block buffer as modified.
Note: UPDATE does not immediately cause a transfer to the block file.
\ ( "ccc\" -- )
Compilation:
Perform the execution semantics given below.
Execution:
If BLK contains zero, parse and discard ccc delimited by
a second \ (backslash), but at most until the end the parse
area. Otherwise parse and discard ccc delimited by a second \
(backslash), but at most the portion of the parse area corresponding to
the remainder of the current line.
\ is an immediate word.
Dr. Stephan Becher - December 16th, 2005