Various standard system functions are available through the System class. This class represents the operating environment of the computer on which the program is running. Its members are as follows:
Static Function Spawn (Path: String; Wait: Boolean(False));
This function initiates, or "spawns" another process. Wait specifies whether the function should wait for the new process to terminate before returning from the function.
Static Function GetProgramPath (IncludeFileName: Boolean): String; Static Function GetModulePath (IncludeFileName: Boolean): String;
GetProgramPath retrieves the path to the program from which the call was made. GetModulePath retrieves the path to the current module; this is the same as the program path unless the call is made inside a dynamically linked library, in which case the path to the library is returned. IncludeFileName specifies whether the file name should be included. If False, only the directory containing the program or module is returned.
Static Function GetCommandLine (): String;
This returns the command-line argument string, not including the program's path.
Static Function ParseCommandLine (CmdLine: String @): Integer;
This function
Static Function Sleep (MinTime: UInt32);
This function causes the thread to "go to sleep" for the specified amount of time. In a multithreaded system, this function relinquishes the timeslice currently being used by the thread, and continues to give up timeslices until at least the amount of time specified by MinTime (in milliseconds) has passed.
Static Var Env: Environment Vars;
This variable allows you to access system environment variables. For example:
StdOut.Print System::Env.GetVar ("OS");
The Environment Vars class is described in detail below.
Environment variables are accessed using the Environment Vars class. This class has dual functionality: it can view the variables provided by the system, but objects of this class can also store lists of environment variables that do not affect the outside environment.
Function Constructor ("System");
Function Constructor ();
The first constructor sets up the class to access and modify system environment variables; the second sets up the class simply to be a list of non-system variables.
Function DoesVarExist (Name: String @): Boolean; Function IsGlobal (Name: String @): Boolean; Function IsLocal (Name: String @): Boolean;
DoesVarExist returns True if the variable exists, False if it does not. IsGlobal returns whether the specified variable is in the global environment. IsLocal returs whether the specified variable is in the current Environment Vars object. It is possible for IsLocal and IsGlobal to both return true for the same variable name. This happens when a local and global version of the variable exist. In this case, Get returns the value of the local variable.
Operator [] (Name: String @): String; Function Get (Name: String @): String;
These functions search for an environment variable and return its value. If the variable was not found, an empty String is returned. If there is a local variable that has the same name as a global variable, the local variable's value is returned.
Function Set (Name, NewValue: String @; Global: Boolean (True)): Boolean;
This function creates or modifies an environment variable. If Global is true, a system environment variable is modified; otherwise, an environment variable local to the Environment Vars is added or modified. If you add a local variable that has the same name as a global variable, the local variable is accessed whenever the name is specified again.
Under some operating systems, setting an environment variable to an empty string will delete the variable. This is not the case with QDL local variables. An empty local variable can mask (hide) the existence of a global variable when calling Get.
Returns True if the change was made successfully, and False if the operating system denied create/write access to the variable.
Function Delete (Name: String @): Boolean;
Deletes an environment variable. If there is both a local and a global version of the variable, only the local variable is deleted. Call Delete a second time to ensure removal of both variables. The function returns True if the variable was deleted, or False is it was not found or access was denied by the operating system.
Function Count (): Integer;
Returns a count of the number of environment variables (both global and local.)
Operator Get (Index: Integer; Name, Value: String @; IsGlobal: Boolean @ (*Null)): Boolean;
Retrieves the name and value of the environment variable with the specified index. If the specified index does not exist, the function does not modify the variables provided and returns False. On success, it returns True. IsGlobal will be set indicating whether the variable was global. The IsGlobal reference can be Null but Name and Value must not be.
When both a global and a local version of a variable exist, they will both be in the variable list this function accesses.
| Table of Contents | Qwertie's Site/Mirror |
|