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 0.
In runtime it returns adres of the counted string of a path
: path-source ( path - 2variable_path-source )
Path-source points to a substring in a path.
Path-source returns this adress.
path: path-ptr deprecated
The old functionality had the bad habbit to pass a pointer through a
value instead of passing the parameter over the stack.
Use win32forth\src\Compat\OldPaths.f for the old functionality.
Words like first-path" and next-path" are now able to handle
each path separate without saving and restoring a path-ptr.
path: search-path
search-path defines the path buffer for Forth.
Applications that let Forth
compile should not change it in a way that Forth is not able too compile.
: next-path" ( path -- a1 n1 )
Get the next path from dir list.
: reset-path-source ( path -- )
Points the path-source to the whole path.
: first-path" ( path -- a1 n1 )
Get the first forth directory path.
: "path+ ( a1 n1 path -- )
Append a directory to a path.
: "fpath+ ( a1 n1 -- )
Append a directory to the Forth path.
: fpath+ ( -<directory>- )
Append a directory to the Forth path.
: .path ( path -- )
Display a directory search path list.
: .fpath ( -- )
Display the Forth directory search path list.
: volume-indication? ( adr - flag )
True when the counted string at adr starts with x: or \name
: full-path { a1 n1 path \ searchpath$ filename$ current$ -- a2 n2 f1 }
Find file a1,n1 in a path and return the full path.
a2,n2 and f1=false, succeeded.
: 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 \ current$ -- a2 n2 f1 }
Find file a1,n1 in the Forth 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" { adr len limit \ temp$ pre -- 'adr 'len }
Clip filename to limit.
Document $Id: Paths.htm,v 1.6 2006/08/29 10:31:46 georgeahubert Exp $