--- gforth/kernel/require.fs 1999/04/16 22:19:54 1.7 +++ gforth/kernel/require.fs 2000/07/01 07:59:10 1.10 @@ -21,13 +21,16 @@ \ Now: Kernel Module, Reloadable 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 ) \ included-files points to ALLOCATEd space, while image-included-files \ points to ALLOTed objects, so it survives a save-system -: loadfilename ( -- a-addr ) - \G a-addr 2@ produces the current file name ( c-addr u ) +: loadfilename ( -- a-addr ) \ gforth + \G @i{a-addr} @code{2@@} produces the current file name ( @i{c-addr u} ) included-files 2@ loadfilename# @ min 2* cells + ; : sourcefilename ( -- c-addr u ) \ gforth @@ -52,10 +55,10 @@ create image-included-files 1 , A, ( po : included? ( c-addr u -- f ) \ gforth \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 specified as, say, foo.fs and found somewhere on the Forth - \G search path. To return true from @code{included?}, you must - \G specify the exact path to the file, even if that is - \G @code{./foo.fs} + \G specified as, say, @file{foo.fs} and found somewhere on the + \G Forth search path. To return @code{true} from @code{included?}, + \G you must specify the exact path to the file, even if that is + \G @file{./foo.fs} included-files 2@ 0 ?do ( c-addr u addr ) dup >r 2@ 2over compare 0= @@ -121,7 +124,8 @@ create image-included-files 1 , A, ( po string, needsrcs^ @ ! ; -: .modules +: .included ( -- ) \ gforth + \G list the names of the files that have been @code{included} cr needs^ @ BEGIN dup @@ -144,10 +148,11 @@ create image-included-files 1 , A, ( po : loadfilename#>str ( n -- adr len ) included-files 2@ drop swap 2* cells + 2@ ; -: .modules +: .included ( -- ) \ gforth + \G list the names of the files that have been @code{included} included-files 2@ 2* cells bounds ?DO cr I 2@ type 2 cells +LOOP ; \ contains tools/newrequire.fs -\ \I $Id: require.fs,v 1.7 1999/04/16 22:19:54 crook Exp $ +\ \I $Id: require.fs,v 1.10 2000/07/01 07:59:10 anton Exp $