[gforth] / gforth / kernel / paths.fs  

gforth: gforth/kernel/paths.fs

Diff for /gforth/kernel/paths.fs between version 1.8 and 1.9

version 1.8, Tue Dec 22 23:11:30 1998 UTC version 1.9, Wed Feb 3 00:10:25 1999 UTC
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 adds a directory to the search path path-addr      \G add the directory to the search path path-addr.
   name rot also-path ;    name rot also-path ;
   
 : fpath+ ( "dir" ) \ gforth  : fpath+ ( "dir" ) \ gforth
 \G adds a directory to the forth search path      \G Add the a directory to the Forth search path.
   fpath path+ ;    fpath path+ ;
   
 : path= ( path-addr "dir1|dir2|dir3" ) \ gforth  : path= ( path-addr "dir1|dir2|dir3" ) \ gforth
 \G makes complete new searchpath, seperator is |      \G Make a complete new search 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 makes complete new searchpath, serpeator is |      \G Make a complete new Forth search path, serparator 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 displays the contents of the search path path-addr      \G Display the contents of the search path 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 displays the contents of the forth search patch      \G Display the contents of the Forth search patch.
   fpath .path ;    fpath .path ;
   
 : absolut-path? ( addr u -- flag ) \ gforth  : absolut-path? ( addr u -- flag ) \ gforth
     \G a path is absolute, if it starts with a / or a ~ (~ expansion),      \G A path is absolute if it starts with a / or a ~ (~ expansion),
     \G or if it is in the form ./*, extended regexp: ^[/~]|./, or if      \G or if it is in the form ./*, extended regexp: ^[/~]|./, or if
     \G it has a colon as second character ("C:...").  Paths simply      \G it has a colon as second character ("C:...").  Paths simply
     \G containing a / are not absolute!      \G containing a / are not absolute!
Line 209 
Line 209 
   open-ofile ;    open-ofile ;
   
 : open-path-file ( adr len path-addr -- fd adr1 len2 0 | ior ) \ gforth  : open-path-file ( adr len path-addr -- fd adr1 len2 0 | ior ) \ gforth
 \G looks in path path-addr for the file specified by adr len      \G Look in path path-addr for the file specified by adr len.
 \G when found the resulting path and an open file descriptor      \G If found the resulting path and an open file descriptor
 \G is returned. If the file is not found ior is non zero      \G are returned. If the file is not found ior is non-zero.
   >r    >r
   2dup absolut-path?    2dup absolut-path?
   IF    rdrop    IF    rdrop
Line 226 
Line 226 
   THEN ;    THEN ;
   
 : open-fpath-file ( adr len -- fd adr1 len2 0 | ior ) \ gforth  : open-fpath-file ( adr len -- fd adr1 len2 0 | ior ) \ gforth
 \G looks in the forth search path for the file specified by adr len      \G Look in the Forth search path for the file specified by adr len.
 \G when found the resulting path and an open file descriptor      \G If found the resulting path and an open file descriptor
 \G is returned. If the file is not found ior is non zero      \G are returned. If the file is not found 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.8  
changed lines
  Added in v.1.9

CVS Admin

Powered by ViewCVS 1.0-dev
(Powered by ViewCVS)

ViewCVS and CVS Help