This section lists a set of procedures which permits to access some system internals.
`=̀13`(ndexfile(index-entry "expand-file-name" "tt" main )expand-file-namestring) procedure
ndexfile(index-entry "Expand-file-name" "tt" aux )Expand-file-name expands the filename given in string to
an absolute path. This function understands the tilde
conventionndexfile(index-entry "tilde expansion" "rm" aux ) for filenames.
unspecified
error
makeotherˆ`=̀13`
gobblecr;; Current directory is /users/eg/STk(expand-file-name "..") "/users/eg"(expand-file-name "~root/bin) "/bin"(expand-file-name "~/STk)" "/users/eg/STk"
`=̀13`(ndexfile(index-entry "canonical-path" "tt" main )canonical-pathpath) procedure
Expands all symbolic links in path and returns its canonicalized
absolute pathname. The resulting path do not have symbolic links. If
path doesn't designate a valid pathname, canonical-path returns
#f.
`=̀13`(ndexfile(index-entry "dirname" "tt" main )dirnamestring) procedure
Returns a string containing all but the last component of the path name given in
string.
unspecified
error
makeotherˆ`=̀13`
gobblecr(dirname "/a/b/c.stk") "/a/b"
`=̀13`(ndexfile(index-entry "basename" "tt" main )basenamestring) procedure
Returns a string containing the last component of the path name given in
string.
unspecified
error
makeotherˆ`=̀13`
gobblecr(basname "/a/b/c.stk") "c.stk"
`=̀13`(ndexfile(index-entry "decompose-file-name" "tt" main )decompose-file-namestring) procedure
Returns an ``exploded'' list of the path name components given in
string.
The first element in the list denotes if the given string is an
absolute path or a relative one, being "/" or "." respectively.
Each component of this list is a string.
unspecified
error
makeotherˆ`=̀13`
gobblecr(decompose-file-name "/a/b/c.stk") ("/" "a" "b" "c.stk")(decompose-file-name "a/b/c.stk") ("." "a" "b" "c.stk")
`=̀13`(ndexfile(index-entry "file-is-directory?" "tt" main )file-is-directory?string) procedure
`=̀13`(ndexfile(index-entry "file-is-regular?" "tt" main )file-is-regular?string) procedure
`=̀13`(ndexfile(index-entry "file-is-readable?" "tt" main )file-is-readable?string) procedure
`=̀13`(ndexfile(index-entry "file-is-writable?" "tt" main )file-is-writable?string) procedure
`=̀13`(ndexfile(index-entry "file-is-executable?" "tt" main )file-is-executable?string) procedure
`=̀13`(ndexfile(index-entry "file-exists?" "tt" main )file-exists?string) procedure
Returns #t if the predicate is true for the path name given in
string; returns #f otherwise (or if string denotes a file
which does not exist).
`=̀13`(ndexfile(index-entry "glob" "tt" main )globpattern1 pattern2 … ) procedure
The code for ndexfile(index-entry "glob" "tt" aux )glob is taken from the Tcl library. It performs file name ``globbing'' in a fashion similar to the csh shell. ndexfile(index-entry "Glob" "tt" aux )Glob returns a list of the filenames that match at least one of the pattern arguments. The pattern arguments may contain the following special characters:
\
x Matches the character x.
As with csh, a ``.'' at the beginning of a file's name or just after a ``/'' must be matched explicitly or with a {} construct. In addition, all ``/'' characters must be matched explicitly.
If the first character in a pattern is ``~'' then it refers to the home directory of the user whose name follows the ``~''. If the ``~'' is followed immediately by ``/'' then the value of the environment variable HOME is used.
ndexfile(index-entry "Glob" "tt" aux )Glob differs from csh globbing in two ways. First, it does not
sort its result list (use the ndexfile(index-entry "sort" "tt" aux )sort procedure if you want the list sorted).
Second, glob only returns the names of files that actually exist; in csh no
check for existence is made unless a pattern contains a ?, *, or
[]
construct.
`=̀13`(ndexfile(index-entry "getcwd" "tt" main )getcwdstring) procedure
ndexfile(index-entry "Getcwd" "tt" aux )Getcwd returns a string containing the current working directory.
`=̀13`(ndexfile(index-entry "chdir" "tt" main )chdirstring) procedure
ndexfile(index-entry "Chdir" "tt" aux )Chdir changes the current directory to the directory given in
string.
`=̀13`(ndexfile(index-entry "getpid" "tt" main )getpidstring) procedure
Returns the system process number of the current STK interpreter (i.e. the
Unix pid). Result is an integer.
`=̀13`(ndexfile(index-entry "system" "tt" main )systemstring) procedure
`=̀13`(ndexfile(index-entry "!" "tt" main )!string) procedure
Sends the given string to the system shell /bin/sh. The result of
ndexfile(index-entry "system" "tt" aux )system is the integer status code the shell returns.
`=̀13`(ndexfile(index-entry "exec" "tt" main )execstring) procedure
Executes the command contained in string and redirects its output in
a string. This string constitutes the result of ndexfile(index-entry "exec" "tt" aux )exec.
`=̀13`(ndexfile(index-entry "getenv" "tt" main )getenvstring) procedure
Looks for the environment variable named string and returns its
value as a string, if it exists. Otherwise, ndexfile(index-entry "getenv" "tt" aux )getenv returns
#f.
unspecified
error
makeotherˆ`=̀13`
gobblecr(getenv "SHELL") "/bin/zsh"
`=̀13`(ndexfile(index-entry "setenv!" "tt" main )setenv!var value) procedure
Sets the environment variable var to value. Var and
value must be strings. The result of setenv! is undefined.
unspecified
error
makeotherˆ`=̀13`
gobblecr(getenv "SHELL") "/bin/zsh"