create &forthdir
A static forth installation directory.
: init-Win32fDirectory { \ kernel$ -- }
Set &forthdir to the folder of the current forth application.
: .program ( -- )
Type the program path.
: .forthdir ( -- )
Type the forth directory.
: "chdir ( a1 n1 -- )
Set the current directory.
: .dir ( -- )
Print the current directory.
: chdir ( -<optional_new_directory>- -- )
Set the current directory.
: path: ( -- )
Defines a directory search path.
The first 2 cells are used too handle a search path.
The next 260 bytes are reserved for a counted string of a path.
followed by null.
At runtime it returns address of the counted string of a path.
-2 cells offset path-source ( path -- 2variable_path-source )
Path-source points to a substring in a path.
Path-source returns this address.
: next-path" ( path -- a1 n1 ) \ w32f path
Get the next path from dir list.
: reset-path-source ( path -- ) \ w32f path
Points the path-source to the whole path.
: first-path" ( path -- a1 n1 ) \ w32f path
Get the first forth directory path.
: "path+ ( a1 n1 path -- ) \ w32f path
Append a directory to a path.
: .path ( path -- ) \ w32f path system
Display a directory search path list. Note: The path source will be reset for this path.
: full-path { a1 n1 path \ searchpath$ filename$ current$ -- a2 n2 f1 }
Find the file a1,n1 in the path path and return the full path. a2,n2 . f1 = false if successful.
: find-path { a1 n1 basepath path \ filename$ current$ search-current$ -- a2 n2 f1 }
Find the file a1,n1 in the path basepath by scanning the sub folders defined in path . Returns the full path of the file if possible. a2,n2 . f1 = false if succeeded.
path: search-base-path \ w32f path
The path buffer for the base search folders for Forth.
Applications that let Forth compile should not change it.
path: search-path \ w32f path
The path buffer for the sub folders to search in. Applications that let Forth compile should not change it.
: "fbase-path+ ( a1 n1 -- ) \ w32f path
Append a directory to the Forth search base path.
: "fpath+ ( a1 n1 -- ) \ w32f path
Append a directory to the Forth search path.
: fbase-path+ ( -<directory>- -- ) \ w32f path system
Append a directory to the Forth search base path.
: fpath+ ( -<directory>- -- ) \ w32f path system
Append a directory to the Forth search path.
: .fpath ( -- ) \ w32f path system
Display the Forth directory search path list.
: program-path-init ( -- )
Initialize the Forth directory search path list. Automatically done at program initialization and when Paths.f is loaded.
: "path-file ( a1 n1 -- a2 n2 f1 )
Find file a1,n1 in the Forth search path and return the full path.
a2,n2 and f1=false, succeeded.
: n"open ( a1 n1 -- handle f1 )
Open file a1,n1 with a Forth path search.
: MakeAbsolutePath ( a1 n1 a2 n2 -- a3 )
Make path a1 n1 absolute to path a2 n2.
: IsPathRelativeTo? { a1 n1 a2 n2 -- f }
Return true if path a1 n1 is relative to path a2 n2
: MakePathRelativeTo ( a1 n1 a2 n2 -- a3 )
Make path a1 n1 relative to path a2 n2.
: FindRelativePath ( a1 n1 path - a2 n2 )
Returns a relative path for file a1 n1 in path ( first part ).
n2=0 means not in search path.
: FindRelativeName ( a1 n1 path - a2 n2 f )
Returns a relative name for file a1 n1 in path ( last-part ).
n2=0 means not in search path.
: "LOADED? ( addr len -- flag )
True if a file addr len is loaded. The filename must contain a full path.
: LOADED? ( -<name>- -- flag ) { \ current$ }
True if the following file is loaded. The filename may be relative.
: \LOADED- ( -<name>- )
If the following file IS NOT LOADED interpret line.
: \LOADED ( -<name>- )
If the following file IS LOADED interpret line.
: NEEDS ( -<name>- )
Conditionally load file "name" if not loaded.
synonym Require needs
Forth 200X name for needs.
: "file-clip" { addr len limit | temp$ pre -- addr len2 }
Clip filename to limit. If limit is less than 20 then the filename is clipped to 20. len2=len if len < limit or len < 20. len2 = 20 if limit < 20. len2 = limt otherwise. The string (if clipped) contains ... in the middle to indicate that# it has been clipped.
Document $Id: Paths.htm,v 1.9 2007/05/26 10:24:11 dbu_de Exp $