version 1.29, 2000/02/28 21:27:07
|
version 1.32, 2000/09/23 15:05:58
|
Line 1
|
Line 1
|
\ A less simple implementation of the blocks wordset. |
\ A less simple implementation of the blocks wordset. |
|
|
\ Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc. |
\ Copyright (C) 1995,1996,1997,1998,2000 Free Software Foundation, Inc. |
|
|
\ This file is part of Gforth. |
\ This file is part of Gforth. |
|
|
Line 45 Variable last-block
|
Line 45 Variable last-block
|
$20 Value buffers |
$20 Value buffers |
|
|
User block-fid |
User block-fid |
User offset 0 offset ! \ store 1 here fore 0.4.0 compatibility |
User block-offset ( -- addr ) \ gforth |
|
\G User variable containing the number of the first block (default |
|
\G since 0.5.0: 0). Block files created with Gforth versions before |
|
\G 0.5.0 have the offset 1. If you use these files you can: @code{1 |
|
\G offset !}; or add 1 to every block number used; or prepend 1024 |
|
\G characters to the file. |
|
0 block-offset ! \ store 1 here fore 0.4.0 compatibility |
|
|
|
' block-offset alias offset \ !! eliminate this? |
|
|
: block-cold ( -- ) |
: block-cold ( -- ) |
block-fid off last-block off |
block-fid off last-block off |
Line 109 Defer flush-blocks ( -- ) \ gforth
|
Line 117 Defer flush-blocks ( -- ) \ gforth
|
|
|
: save-buffers ( -- ) \ block |
: save-buffers ( -- ) \ block |
\G Transfer the contents of each @code{update}d block buffer to |
\G Transfer the contents of each @code{update}d block buffer to |
\G mass storage, then mark all block buffers as unassigned. |
\G mass storage, then mark all block buffers as assigned-clean. |
block-buffers @ |
block-buffers @ |
buffers 0 ?DO dup save-buffer next-buffer LOOP drop ; |
buffers 0 ?DO dup save-buffer next-buffer LOOP drop ; |
|
|
Line 208 User scr ( -- a-addr ) \ block-ext s-c-r
|
Line 216 User scr ( -- a-addr ) \ block-ext s-c-r
|
\G Save the current input source specification. Store @i{n} in |
\G Save the current input source specification. Store @i{n} in |
\G @code{BLK}, set @code{>IN} to 0 and interpret. When the parse |
\G @code{BLK}, set @code{>IN} to 0 and interpret. When the parse |
\G area is exhausted, restore the input source specification. |
\G area is exhausted, restore the input source specification. |
|
loadfilename# @ >r |
|
2 loadfilename# ! \ "\a block/" |
push-file |
push-file |
dup loadline ! blk ! >in off ['] interpret catch |
dup loadline ! blk ! >in off ['] interpret catch |
pop-file throw ; |
pop-file |
|
r> loadfilename# ! |
|
throw ; |
|
|
: thru ( i*x n1 n2 -- j*x ) \ block-ext |
: thru ( i*x n1 n2 -- j*x ) \ block-ext |
\G @code{load} the blocks @i{n1} through @i{n2} in sequence. |
\G @code{load} the blocks @i{n1} through @i{n2} in sequence. |