Diff for /gforth/blocks.fs between versions 1.20 and 1.23

version 1.20, 1998/12/13 23:29:58 version 1.23, 1999/03/29 22:52:27
Line 58  block-cold Line 58  block-cold
 Defer flush-blocks  Defer flush-blocks
   
 : open-blocks ( addr u -- ) \ gforth  : open-blocks ( addr u -- ) \ gforth
     \g use the file, whose name is given by @var{addr u}, as blocks file       \g Use the file, whose name is given by @var{addr u}, as the blocks file.
     2dup open-fpath-file 0<>      2dup open-fpath-file 0<>
     if      if
         r/w bin create-file throw          r/w bin create-file throw
Line 70  Defer flush-blocks Line 70  Defer flush-blocks
     block-fid ! ;      block-fid ! ;
   
 : use ( "file" -- ) \ gforth  : use ( "file" -- ) \ gforth
     \g use @var{file} as blocks file      \g Use @var{file} as the blocks file.
     name open-blocks ;      name open-blocks ;
   
 \ the file is opened as binary file, since it either will contain text  \ the file is opened as binary file, since it either will contain text
Line 83  Defer flush-blocks Line 83  Defer flush-blocks
     block-fid @ ;      block-fid @ ;
   
 : block-position ( u -- ) \ block  : block-position ( u -- ) \ block
     \G positions the block file to the start of block u      \G Position the block file to the start of block @var{u}.
     1- chars/block chars um* get-block-fid reposition-file throw ;      1- chars/block chars um* get-block-fid reposition-file throw ;
   
 : update ( -- ) \ block  : update ( -- ) \ block
Line 119  Defer flush-blocks Line 119  Defer flush-blocks
 : get-buffer ( n -- a-addr ) \ gforth  : get-buffer ( n -- a-addr ) \ gforth
     buffers mod buffer-struct %size * block-buffers @ + ;      buffers mod buffer-struct %size * block-buffers @ + ;
   
 : block ( u -- a-addr ) \ block  : block ( u -- a-addr ) \ block- block
     \G @var{u} identifies a block number. Assign a block buffer to @var{u},
     \G make it the current block buffer and return its start
     \G address, @var{a-addr}.
     dup 0= -35 and throw      dup 0= -35 and throw
     dup get-buffer >r      dup get-buffer >r
     dup r@ buffer-block @ <>      dup r@ buffer-block @ <>
Line 141  Defer flush-blocks Line 144  Defer flush-blocks
     \ reading in the block is unnecessary, but simpler      \ reading in the block is unnecessary, but simpler
     block ;      block ;
   
 User scr 0 scr !  User scr ( -- a-addr ) \ block-ext
       \G USER VARIABLE @var{a-addr} is the address of a cell containing
       \G the block number of the block most recently processed by
       \G @code{LIST}.
       0 scr !
   
 : updated?  ( n -- f ) \ gforth  : updated?  ( n -- f ) \ gforth
     scr @ buffer      scr @ buffer
Line 158  User scr 0 scr ! Line 165  User scr 0 scr !
         i 2 .r space scr @ block i 64 * chars + 64 type cr          i 2 .r space scr @ block i 64 * chars + 64 type cr
     loop ;      loop ;
   
 : (source)  ( -- addr len )  : (source)  ( -- c-addr u )
   blk @ ?dup    blk @ ?dup
   IF    block chars/block    IF    block chars/block
   ELSE  tib #tib @    ELSE  tib #tib @
   THEN ;    THEN ;
   
 ' (source) IS source  ' (source) IS source ( -- c-addr u ) \ core
   \G @var{c-addr} is the address of the input buffer and @var{u} is the
   \G number of characters in it.
   
 : load ( i*x n -- j*x ) \ block  : load ( i*x n -- j*x ) \ block
   push-file    push-file
Line 181  User scr 0 scr ! Line 190  User scr 0 scr !
   1+ swap ?DO  I +load  LOOP ;    1+ swap ?DO  I +load  LOOP ;
   
 : --> ( -- ) \ block- block  : --> ( -- ) \ block- block
       \G If this symbol is encountered whilst loading block @var{n},
       \G discard the remainder of the block and load block @var{n+1}. Used
       \G for chaining multiple blocks together as a single loadable unit.
     refill drop ; immediate      refill drop ; immediate
   
 : block-included ( addr u -- ) \ gforth  : block-included ( addr u -- ) \ gforth
Line 198  true constant block Line 210  true constant block
 true constant block-ext  true constant block-ext
 set-current  set-current
   
 : bye  ['] flush catch drop bye ;  : bye ( -- ) \ tools-ext
     \G Return control to the host operating system (if any).
     ['] flush catch drop bye ;

Removed from v.1.20  
changed lines
  Added in v.1.23


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>