Libraries
Environment Source Code
 previous   up   next 

Function Summary
array string
argv (PROGRAM)
Return the argument vector of the program as array of strings.
string
name (PROGRAM)
Returns the name of the program without path and extension.
string
path (PROGRAM)
Return the absolute path of the program.
string
dir (PROGRAM)
Returns the absolute path of the directory containing the program.
string
file (PROGRAM)
Returns the filename of the program without path.
void
exit (in integer: status)
Terminate the program with the given exit status.
void
exit (PROGRAM)
Terminate the program with the exit status 0.
string
getenv (in string: name)
Determine the value of an environment variable.
void
setenv (in string: name, in string: value)
Add or change an environment variable.
void
unsetenv (in string: name)
Deletes the variable name from the environment.
array string
environment
Returns the list of environment variable names as array of strings.

Function Detail

argv

const func array string: argv (PROGRAM)

Return the argument vector of the program as array of strings. The name of the program is not part of the argument vector.

Returns:
an array of strings containing the argument vector.

name

const func string: name (PROGRAM)

Returns the name of the program without path and extension. The name returned by name(PROGRAM) is the same for interpreted and compiled programs. The function name(PROGRAM) does not follow symbolic links. It determines, with which name a program was called. If several symbolic links refer to one program name(PROGRAM) returns the name of the symbolic link.

Returns:
the name of the program.

path

const func string: path (PROGRAM)

Return the absolute path of the program. For an interpreted program this is the absolute path of the source file. For a compiled program this is the absolute path of the executable. The function path(PROGRAM) does follow symbolic links.

Returns:
the absolute path of the program.

dir

const func string: dir (PROGRAM)

Returns the absolute path of the directory containing the program. The function dir(PROGRAM) allows placing configuration data in the directory of the program. The function is based on path(PROGRAM).

Returns:
The absolute path of the directory containing the program.

file

const func string: file (PROGRAM)

Returns the filename of the program without path. The function is based on path(PROGRAM).

Returns:
The filename of the program.

exit

const proc: exit (in integer: status)

Terminate the program with the given exit status. By convention, the exit status 0 indicates normal termination. This function does not return. Placing exit(0); at the end of the main function is unnecessary since leaving main terminates the program with an exit status of 0.


exit

const proc: exit (PROGRAM)

Terminate the program with the exit status 0. By convention, the exit status 0 indicates normal termination. This function does not return. Placing exit(PROGRAM); at the end of the main function is unnecessary since leaving main terminates the program with an exit status of 0.


getenv

const func string: getenv (in string: name)

Determine the value of an environment variable. The function getenv searches the environment for an environment variable with the given name. If such an environment variable exists the corresponding string value is returned.

Returns:
the value of an environment variable or "", if the requested environment variable does not exist.
Raises:
MEMORY_ERROR - Not enough memory to convert name to the system string type or not enough memory to represent the result string.
RANGE_ERROR - name cannot be converted to the system string type or a system function returns an error.

setenv

const proc: setenv (in string: name, in string: value)

Add or change an environment variable. The function setenv searches the environment for an environment variable with the given name. If such an environment variable exists the corresponding value is changed to value. If no environment variable with the given name exists a new environment variable name with the value value is created.

Raises:
MEMORY_ERROR - Not enough memory to convert name or value to the system string type.
RANGE_ERROR - name or value cannot be converted to the system string type or a system function returns an error.

unsetenv

const proc: unsetenv (in string: name)

Deletes the variable name from the environment. If name does not exist in the environment, then the function succeeds, and the environment is unchanged.

Raises:
MEMORY_ERROR - Not enough memory to convert name to the system string type.
RANGE_ERROR - name cannot be converted to the system string type or a system function returns an error.

environment

const func array string: environment

Returns the list of environment variable names as array of strings.

Returns:
the list of environment variable names.
Raises:
MEMORY_ERROR - Not enough memory to create the result.


 previous   up   next