[gforth] / gforth / kernel / paths.fs  

gforth: gforth/kernel/paths.fs

Diff for /gforth/kernel/paths.fs between version 1.11 and 1.12

version 1.11, Mon Feb 22 21:39:43 1999 UTC version 1.12, Tue Mar 23 20:24:26 1999 UTC
Line 72 
Line 72 
   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 
Line 80 
   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 
Line 109 
   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 
Line 196 
   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 
Line 214 
   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 ;


Generate output suitable for use with a patch program
Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

CVS Admin

Powered by ViewCVS 1.0-dev
(Powered by ViewCVS)

ViewCVS and CVS Help