root/branches/maintenance/3.0/Modelica/Utilities/System.mo

Revision 1044, 2.7 kB (checked in by otter, 9 months ago)

Removed "Windows(..)" annotation (an "old" Dymola 4 annotation that was not used anymore and is not part of the Modelica 3 graphical annotations)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1within Modelica.Utilities;
2package System "Interaction with environment"
3  extends Modelica.Icons.Library;
4    annotation (
5Documentation(info="
6<HTML>
7<p>
8This package contains functions to interact with the environment.
9</p>
10</HTML>
11")   );
12
13function getWorkDirectory "Get full path name of work directory"
14  extends Modelica.Icons.Function;
15  output String directory "Full path name of work directory";
16// POSIX function "getcwd"
17  external "C" directory = ModelicaInternal_getcwd(0);
18    annotation (Library="ModelicaExternalC",Documentation(info="<html>
19 
20</html>"));
21end getWorkDirectory;
22
23function setWorkDirectory "Set work directory"
24  extends Modelica.Icons.Function;
25  input String directory "New work directory";
26// POSIX function "chdir"
27external "C" ModelicaInternal_chdir(directory);
28    annotation (Library="ModelicaExternalC",Documentation(info="<html>
29 
30</html>"));
31end setWorkDirectory;
32
33function getEnvironmentVariable "Get content of environment variable"
34  extends Modelica.Icons.Function;
35  input String name "Name of environment variable";
36  input Boolean convertToSlash =  false
37      "True, if native directory separators in 'result' shall be changed to '/'";
38  output String content
39      "Content of environment variable (empty, if not existent)";
40  output Boolean exist
41      "= true, if environment variable exists; = false, if it does not exist";
42  external "C" ModelicaInternal_getenv(name, convertToSlash, content, exist);
43    annotation (Library="ModelicaExternalC",Documentation(info="<html>
44 
45</html>"));
46end getEnvironmentVariable;
47
48function setEnvironmentVariable "Set content of local environment variable"
49  extends Modelica.Icons.Function;
50  input String name "Name of environment variable";
51  input String content "Value of the environment variable";
52  input Boolean convertFromSlash =  false
53      "True, if '/' in content shall be changed to the native directory separator";
54external "C" ModelicaInternal_setenv(name, content, convertFromSlash);
55    annotation (Library="ModelicaExternalC",Documentation(info="<html>
56   
57</html>"));
58end setEnvironmentVariable;
59
60function command "Execute command in default shell"
61  extends Modelica.Icons.Function;
62  input String string "String to be passed to shell";
63  output Integer result "Return value from command (depends on environment)";
64  external "C" result = system(string);
65    annotation (Library="ModelicaExternalC",Documentation(info="<html>
66 
67</html>"));
68end command;
69
70function exit "Terminate execution of Modelica environment"
71  extends Modelica.Icons.Function;
72  input Integer status=0
73      "Result to be returned by environment (0 means success)";
74  external "C" ModelicaInternal_exit(status);
75  annotation(Library="ModelicaExternalC");
76end exit;
77end System;
Note: See TracBrowser for help on using the browser.