MAINSAIL System-Specific User's Guides, Chapter 5

previous   next   top   contents   index   framed top   this page unframed


5. System Information PROCEDUREs

5.1. $currentDirectory

$currentDirectory returns a STRING prefixed by a drive name, e.g., c:\my\favorite\directory.

5.2. $setCurrentDirectory

If you call $setCurrentDirectory with just a device name (e.g., $setCurrentDirectory("d:")), your current directory becomes the top-level directory (\) on that device (in this case, d:\).

5.3. $homeDirectory

$homeDirectory is calculated from the concatenation of the environment variables HOMEDRIVE and HOMEPATH.

5.4. $getCommandLine

Character-based MAINSAIL bootstraps implement $getCommandLine in the standard way by reading the initial command arguments from the Command Prompt window command line.

Windows-based MAINSAIL bootstraps obtain the command line from the Command Line property associated with the bootstrap itself. You can change this property by selecting the icon for the bootstrap in question and choosing Properties from the File menu. However, this mechanism is not very flexible, since after you change the command line, the bootstrap is always run with the same command line arguments.

5.5. $programName

$programName is unavailable from Windows-based bootstraps. From character-based bootstraps, it returns the name of the program as it was entered to the Command Prompt window prompt.

5.6. $directory

When $fullPathNames is set, file names produced by $directory include the drive name.

5.7. $fileInfo

Full path names produced by $fileInfo include the drive name. All fields of the $fileInfoCls record are set for non-directory files (NT maintains separate create and modify dates for such files). For directories, the $OSDSize, $createDate, $createTime, $modifyDate, and $modifyTime fields are not set.

$fileAttr can have the following bits set in it:

5.8. $composeFileName Examples

Here are some sample results for $composeFileName(base,extension,"",path) on NTPNT:

base extension path $composeFileName
"abc" "msl" "" "abc.msl"
"a.b" "c" "xyz" "xyz\a.b.c"
"xyz" "" "\foo" "\foo\xyz"
"xyz" "" "c:\foo" "c:\foo\xyz"

5.9. $composePath Examples

Here are some sample results for
$composePath(pathPrefix,pathComponents) on NTPNT:

pathPrefix pathComponents $composePath
"" "" ""
"" "xyz" "xyz"
"\" "foo" "\foo"
"c:\" "foo" & eol & "bar" "c:\foo\bar"
"\\srv\xyz\" "baz" "\\srv\xyz\baz"

5.10. $decomposePathName

When a STRING passed to $decomposePathName is prefixed with a drive name followed by backslash (e.g., c:\), both the drive name and the backslash are included in pathPrefix. If only one of these two elements is present in the input, then only one is present in pathPrefix. A path prefix can also have the form \\serverName\shareName\. For example:

path pathPrefix pathComponents
"c:\x\y" "c:\" "x" & eol & "y"
"\x\y" "\" "x" & eol & "y"
"c:x\y" "c:" "x" & eol & "y"
"\\srv\shar\x\y" "\\srv\shar\" "x" & eol & "y"

5.11. $decomposeFileName

In a file name containing no periods, $decomposeFileName considers the entire file name to be the base, so that:

$decomposeFileName("abc",base,extension)

yields base = "abc" and extension = "".

If a file name contains exactly one period, the base is the part before the period, and the extension the part after, so that:

$decomposeFileName("ab.c",base,extension)

results in base = "ab" and extension = "c".

If a file name contains multiple periods, the part after the last period is treated as the extension. Thus:

$decomposeFileName("a.b.c",base,extension)

leaves base = "a.b" and extension = "c".

5.12. $userID

$userID obtains the user ID by calling the GetUserName system function. $login is ignored.

5.13. $cpuID

$cpuID is not implemented, and therefore always returns the empty STRING.

5.14. Exit Codes

$successExitCode is '0L, and $failureExitCode is 'HFFFFFFFFL. The operating system does not seem to do anything with these values, however.

5.15. $truncateFile

$truncateFile is fully supported.

5.16. Environment Variable PROCEDUREs

NTPNT MAINSAIL provides several PROCEDUREs for manipulating operating system environment variables. The PROCEDURE headers are:

BOOLEAN
PROCEDURE       $getEnvironmentVars
                        (
PRODUCES STRING ARRAY(1 TO *)
                            
environment;
                         
OPTIONAL PRODUCES STRING msg);

BOOLEAN
PROCEDURE       $lookupEnvironmentVar
                        (
STRING name;
                         
OPTIONAL PRODUCES STRING value);

BOOLEAN
PROCEDURE       $setEnvironmentVar
                        (
STRING name,value;
                         
OPTIONAL PRODUCES STRING msg);

BOOLEAN
PROCEDURE       $deleteEnvironmentVar
                        (
STRING name;
                         
OPTIONAL PRODUCES STRING msg);

$getEnvironmentVars produces an ARRAY environment containing the names and values of all currently defined environment variables. Each element is of the form name=value. The caller is responsible for disposing the environment ARRAY.

$lookupEnvironmentVar sets value to the value of the environment variable named name. It fails if no such environment variable exists.

$setEnvironmentVar sets the value of the environment variable named name to value.

$deleteEnvironmentVar removes the environment variable named name.

All these PROCEDUREs return TRUE if successful; if unsuccessful, they set msg to a STRING describing the error and return FALSE.


previous   next   top   contents   index   framed top   this page unframed

MAINSAIL System-Specific User's Guides, Chapter 5