version 1.7, 1999/04/16 22:19:54
|
version 1.9, 1999/12/03 18:49:52
|
Line 21
|
Line 21
|
\ Now: Kernel Module, Reloadable |
\ Now: Kernel Module, Reloadable |
|
|
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 - |
|
\ ./ is confusing for the search path stuff! There should be never a . |
|
\ in sourcefilename.... |
|
here ," #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 ) |
\ included-files points to ALLOCATEd space, while image-included-files |
\ included-files points to ALLOCATEd space, while image-included-files |
\ points to ALLOTed objects, so it survives a save-system |
\ points to ALLOTed objects, so it survives a save-system |
|
|
: loadfilename ( -- a-addr ) |
: loadfilename ( -- a-addr ) \ gforth |
\G a-addr 2@ produces the current file name ( c-addr u ) |
\G @i{a-addr} @code{2@@} produces the current file name ( @i{c-addr u} ) |
included-files 2@ loadfilename# @ min 2* cells + ; |
included-files 2@ loadfilename# @ min 2* cells + ; |
|
|
: sourcefilename ( -- c-addr u ) \ gforth |
: sourcefilename ( -- c-addr u ) \ gforth |
Line 52 create image-included-files 1 , A, ( po
|
Line 55 create image-included-files 1 , A, ( po
|
: included? ( c-addr u -- f ) \ gforth |
: included? ( c-addr u -- f ) \ gforth |
\G True only if the file @var{c-addr u} is in the list of earlier |
\G True only if the file @var{c-addr u} is in the list of earlier |
\G included files. If the file has been loaded, it may have been |
\G included files. If the file has been loaded, it may have been |
\G specified as, say, foo.fs and found somewhere on the Forth |
\G specified as, say, @file{foo.fs} and found somewhere on the |
\G search path. To return true from @code{included?}, you must |
\G Forth search path. To return @code{true} from @code{included?}, |
\G specify the exact path to the file, even if that is |
\G you must specify the exact path to the file, even if that is |
\G @code{./foo.fs} |
\G @file{./foo.fs} |
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= |