This package contains functions to interact with the environment.
Extends from Modelica.Icons.Library (Icon for library).
| Name | Description |
|---|---|
| Get full path name of work directory | |
| Set work directory | |
| Get content of environment variable | |
| Set content of local environment variable | |
| Execute command in default shell | |
| Terminate execution of Modelica environment |
Modelica.Utilities.System.getWorkDirectory
Extends from Modelica.Icons.Function (Icon for a function).
| Type | Name | Description |
|---|---|---|
| String | directory | Full path name of work directory |
function getWorkDirectory "Get full path name of work directory" extends Modelica.Icons.Function; output String directory "Full path name of work directory"; // POSIX function "getcwd" external "C" directory = ModelicaInternal_getcwd(0);end getWorkDirectory;
Modelica.Utilities.System.setWorkDirectory
Extends from Modelica.Icons.Function (Icon for a function).
| Type | Name | Default | Description |
|---|---|---|---|
| String | directory | New work directory |
function setWorkDirectory "Set work directory" extends Modelica.Icons.Function; input String directory "New work directory"; // POSIX function "chdir" external "C" ModelicaInternal_chdir(directory);end setWorkDirectory;
Modelica.Utilities.System.getEnvironmentVariable
Extends from Modelica.Icons.Function (Icon for a function).
| Type | Name | Default | Description |
|---|---|---|---|
| String | name | Name of environment variable | |
| Boolean | convertToSlash | false | True, if native directory separators in 'result' shall be changed to '/' |
| Type | Name | Description |
|---|---|---|
| String | content | Content of environment variable (empty, if not existent) |
| Boolean | exist | = true, if environment variable exists; = false, if it does not exist |
function getEnvironmentVariable "Get content of environment variable"
extends Modelica.Icons.Function;
input String name "Name of environment variable";
input Boolean convertToSlash = false
"True, if native directory separators in 'result' shall be changed to '/'";
output String content
"Content of environment variable (empty, if not existent)";
output Boolean exist
"= true, if environment variable exists; = false, if it does not exist";
external "C" ModelicaInternal_getenv(name, convertToSlash, content, exist);
end getEnvironmentVariable;
Modelica.Utilities.System.setEnvironmentVariable
Extends from Modelica.Icons.Function (Icon for a function).
| Type | Name | Default | Description |
|---|---|---|---|
| String | name | Name of environment variable | |
| String | content | Value of the environment variable | |
| Boolean | convertFromSlash | false | True, if '/' in content shall be changed to the native directory separator |
function setEnvironmentVariable
"Set content of local environment variable"
extends Modelica.Icons.Function;
input String name "Name of environment variable";
input String content "Value of the environment variable";
input Boolean convertFromSlash = false
"True, if '/' in content shall be changed to the native directory separator";
external "C" ModelicaInternal_setenv(name, content, convertFromSlash);
end setEnvironmentVariable;
Modelica.Utilities.System.command
Extends from Modelica.Icons.Function (Icon for a function).
| Type | Name | Default | Description |
|---|---|---|---|
| String | string | String to be passed to shell |
| Type | Name | Description |
|---|---|---|
| Integer | result | Return value from command (depends on environment) |
function command "Execute command in default shell" extends Modelica.Icons.Function; input String string "String to be passed to shell"; output Integer result "Return value from command (depends on environment)"; external "C" result = system(string);end command;
Modelica.Utilities.System.exit
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | status | 0 | Result to be returned by environment (0 means success) |
function exit "Terminate execution of Modelica environment"
extends Modelica.Icons.Function;
input Integer status=0
"Result to be returned by environment (0 means success)";
external "C" ModelicaInternal_exit(status);
end exit;