--- gforth/blocks.fs 1995/11/07 18:06:32 1.7 +++ gforth/blocks.fs 1996/09/30 13:16:07 1.10 @@ -57,16 +57,22 @@ block-cold Defer flush-file -: use-file ( addr u -- ) - 2dup r/w bin open-file 0<> +: use-file ( addr u -- ) \ gforth + \g use the file, whose name is given by @var{addr u}, as blocks file + 2dup ['] open-path-file catch 0<> if - drop r/w bin create-file throw + 2drop r/w bin create-file throw else - nip nip + rot close-file throw 2dup file-status throw bin open-file throw + >r 2drop r> then block-fid @ IF flush-file block-fid @ close-file throw THEN block-fid ! ; +: use ( "file" -- ) \ gforth + \g use @var{file} as blocks file + name use-file ; + \ the file is opened as binary file, since it either will contain text \ without newlines or binary data : get-block-fid ( -- fid ) @@ -114,7 +120,7 @@ Defer flush-file dup 0= -35 and throw dup get-buffer >r dup r@ buffer-block @ <> - r@ buffer-fid @ block-fid @ <> and + r@ buffer-fid @ block-fid @ <> or if r@ save-buffer dup block-position