version 1.11, 1999/02/22 21:39:43
|
version 1.12, 1999/03/23 20:24:26
|
Line 19
|
Line 19
|
\ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
\ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|
|
\ -Changing the search-path: |
\ -Changing the search-path: |
\ fpath+ <path> adds a directory to the searchpath |
\ fpath+ <path> adds a directory to the searchpath |
\ fpath= <path>|<path> makes complete now searchpath |
\ fpath= <path>|<path> makes complete now searchpath |
\ seperator is | |
\ seperator is | |
\ .fpath displays the search path |
\ .fpath displays the search path |
\ remark I: |
\ remark I: |
\ a ./ in the beginning of filename is expanded to the directory the |
\ a ./ in the beginning of filename is expanded to the directory the |
\ current file comes from. ./ can also be included in the search-path! |
\ current file comes from. ./ can also be included in the search-path! |
Line 72 sourcepath avalue fpath
|
Line 72 sourcepath avalue fpath
|
r@ cell+ @ over + r@ @ u> ABORT" path buffer too small!" |
r@ cell+ @ over + r@ @ u> ABORT" path buffer too small!" |
\ copy into |
\ copy into |
tuck r@ cell+ dup @ cell+ + swap cmove |
tuck r@ cell+ dup @ cell+ + swap cmove |
\ make delemiter |
\ make delimiter |
0 r@ cell+ dup @ cell+ + 2 pick + c! 1 + r> cell+ +! |
0 r@ cell+ dup @ cell+ + 2 pick + c! 1 + r> cell+ +! |
; |
; |
|
|
Line 80 sourcepath avalue fpath
|
Line 80 sourcepath avalue fpath
|
dup 0 swap cell+ ! also-path ; |
dup 0 swap cell+ ! also-path ; |
|
|
: path+ ( path-addr "dir" -- ) \ gforth |
: path+ ( path-addr "dir" -- ) \ gforth |
\G add the directory to the search path path-addr. |
\G Add the directory @var{dir} to the search path @var{path-addr}. |
name rot also-path ; |
name rot also-path ; |
|
|
: fpath+ ( "dir" ) \ gforth |
: fpath+ ( "dir" ) \ gforth |
\G Add the a directory to the Forth search path. |
\G Add directory @var{dir} to the Forth search path. |
fpath path+ ; |
fpath path+ ; |
|
|
: path= ( path-addr "dir1|dir2|dir3" ) \ gforth |
: path= ( path-addr "dir1|dir2|dir3" ) \ gforth |
\G Make a complete new search path, separator is |. |
\G Make a complete new search path; the path separator is |. |
name 2dup bounds ?DO i c@ '| = IF 0 i c! THEN LOOP |
name 2dup bounds ?DO i c@ '| = IF 0 i c! THEN LOOP |
rot only-path ; |
rot only-path ; |
|
|
: fpath= ( "dir1|dir2|dir3" ) \ gforth |
: fpath= ( "dir1|dir2|dir3" ) \ gforth |
\G Make a complete new Forth search path, serparator is |. |
\G Make a complete new Forth search path; the path separator is |. |
fpath path= ; |
fpath path= ; |
|
|
: path>counted cell+ dup cell+ swap @ ; |
: path>counted cell+ dup cell+ swap @ ; |
Line 109 sourcepath avalue fpath
|
Line 109 sourcepath avalue fpath
|
BEGIN tuck dup WHILE repeat ; |
BEGIN tuck dup WHILE repeat ; |
|
|
: .path ( path-addr -- ) \ gforth |
: .path ( path-addr -- ) \ gforth |
\G Display the contents of the search path path-addr. |
\G Display the contents of the search path @var{path-addr}. |
path>counted |
path>counted |
BEGIN next-path dup WHILE type space REPEAT 2drop 2drop ; |
BEGIN next-path dup WHILE type space REPEAT 2drop 2drop ; |
|
|
: .fpath ( -- ) \ gforth |
: .fpath ( -- ) \ gforth |
\G Display the contents of the Forth search patch. |
\G Display the contents of the Forth search path. |
fpath .path ; |
fpath .path ; |
|
|
: absolut-path? ( addr u -- flag ) \ gforth |
: absolut-path? ( addr u -- flag ) \ gforth |
Line 196 Create tfile 0 c, 255 chars allot
|
Line 196 Create tfile 0 c, 255 chars allot
|
open-ofile ; |
open-ofile ; |
|
|
\ !! returns 2 stack items if file is not found, not just the ior |
\ !! returns 2 stack items if file is not found, not just the ior |
: open-path-file ( adr len path-addr -- fd adr1 len2 0 | ior ) \ gforth |
: open-path-file ( addr1 u1 path-addr -- wfileid addr2 u2 0 | ior ) \ gforth |
\G Look in path path-addr for the file specified by adr len. |
\G Look in path @var{path-addr} for the file specified by @var{addr1 u1}. |
\G If found the resulting path and an open file descriptor |
\G If found, the resulting path and an open file descriptor |
\G are returned. If the file is not found ior is non-zero. |
\G are returned. If the file is not found, @var{ior} is non-zero. |
>r |
>r |
2dup absolut-path? |
2dup absolut-path? |
IF rdrop |
IF rdrop |
Line 214 Create tfile 0 c, 255 chars allot
|
Line 214 Create tfile 0 c, 255 chars allot
|
THEN ; |
THEN ; |
|
|
\ !! returns 2 stack items if file is not found, not just the ior |
\ !! returns 2 stack items if file is not found, not just the ior |
: open-fpath-file ( adr len -- fd adr1 len2 0 | ior ) \ gforth |
: open-fpath-file ( addr1 u1 -- wfileid addr2 u2 0 | ior ) \ gforth |
\G Look in the Forth search path for the file specified by adr len. |
\G Look in the Forth search path for the file specified by @var{addr1 u1}. |
\G If found the resulting path and an open file descriptor |
\G If found, the resulting path and an open file descriptor |
\G are returned. If the file is not found ior is non-zero. |
\G are returned. If the file is not found, @var{ior} is non-zero. |
fpath open-path-file ; |
fpath open-path-file ; |