version 1.4, 1998/06/17 16:55:18
|
version 1.6, 1999/03/23 20:24:26
|
Line 1
|
Line 1
|
\ require.fs |
\ require.fs |
|
|
\ Copyright (C) 1995-1997 Free Software Foundation, Inc. |
\ Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc. |
|
|
\ This file is part of Gforth. |
\ This file is part of Gforth. |
|
|
Line 20
|
Line 20
|
|
|
\ Now: Kernel Module, Reloadable |
\ Now: Kernel Module, Reloadable |
|
|
\ $Id$ |
|
|
|
create included-files 0 , 0 , ( pointer to and count of included files ) |
create included-files 0 , 0 , ( pointer to and count of included files ) |
here ," ./the terminal" dup c@ swap 1 + swap , A, here 2 cells - |
here ," ./the terminal" dup c@ swap 1 + swap , A, here 2 cells - |
create image-included-files 1 , A, ( pointer to and count of included files ) |
create image-included-files 1 , A, ( pointer to and count of included files ) |
Line 51 create image-included-files 1 , A, ( po
|
Line 49 create image-included-files 1 , A, ( po
|
image-included-files 2@ nip included-files 2! ; |
image-included-files 2@ nip included-files 2! ; |
|
|
: included? ( c-addr u -- f ) \ gforth |
: included? ( c-addr u -- f ) \ gforth |
\G true, iff filename c-addr u is in included-files |
\G True, iff filename c-addr u is in included-files |
included-files 2@ 0 |
included-files 2@ 0 |
?do ( c-addr u addr ) |
?do ( c-addr u addr ) |
dup >r 2@ 2over compare 0= |
dup >r 2@ 2over compare 0= |
Line 84 create image-included-files 1 , A, ( po
|
Line 82 create image-included-files 1 , A, ( po
|
open-fpath-file throw included1 ; |
open-fpath-file throw included1 ; |
|
|
: required ( i*x addr u -- j*x ) \ gforth |
: required ( i*x addr u -- j*x ) \ gforth |
\G include the file with the name given by @var{addr u}, if it is not |
\G @code{include-file} the file with the name given by @var{addr u}, if it is not |
\G @code{included} (or @code{required}) already. Currently this |
\G @code{included} (or @code{required}) already. Currently this |
\G works by comparing the name of the file (with path) against the |
\G works by comparing the name of the file (with path) against the |
\G names of earlier included files. |
\G names of earlier included files. |
Line 103 create image-included-files 1 , A, ( po
|
Line 101 create image-included-files 1 , A, ( po
|
\ INCLUDE 9may93jaw |
\ INCLUDE 9may93jaw |
|
|
: include ( ... "file" -- ... ) \ gforth |
: include ( ... "file" -- ... ) \ gforth |
\G includes @var{file} |
\G @code{include-file} the file @var{file}. |
name included ; |
name included ; |
|
|
: require ( ... "file" -- ... ) \ gforth |
: require ( ... "file" -- ... ) \ gforth |
\G includes @var{file} only if it is not included already |
\G @code{include-file} @var{file} only if it is not included already. |
name required ; |
name required ; |
|
|
0 [IF] |
0 [IF] |