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

Revision 550, 2.8 kB (checked in by otter, 15 months ago)

Library description string made in a standardized fashion for the top-level libraries
(Library of xxx)

  • 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 (
5  preferedView="info",
6Documentation(info="
7<HTML>
8<p>
9This package contains functions to interact with the environment.
10</p>
11</HTML>
12"),   Coordsys(
13        extent=[0, 0; 417, 614],
14        grid=[1, 1],
15        component=[20, 20]),
16      Window(
17        x=0.03,
18        y=0.02,
19        width=0.42,
20        height=0.86,
21        library=1,
22        autolayout=1));
23 
24function getWorkDirectory "Get full path name of work directory" 
25  extends Modelica.Icons.Function;
26  output String directory "Full path name of work directory";
27// POSIX function "getcwd"
28  external "C" directory = ModelicaInternal_getcwd(0);
29    annotation (Documentation(info="<html>
30 
31</html>"));
32end getWorkDirectory;
33 
34function setWorkDirectory "Set work directory" 
35  extends Modelica.Icons.Function;
36  input String directory "New work directory";
37// POSIX function "chdir"
38external "C" ModelicaInternal_chdir(directory);
39    annotation (Documentation(info="<html>
40 
41</html>"));
42end setWorkDirectory;
43 
44function getEnvironmentVariable "Get content of environment variable" 
45  extends Modelica.Icons.Function;
46  input String name "Name of environment variable";
47  input Boolean convertToSlash =  false 
48      "True, if native directory separators in 'result' shall be changed to '/'";
49  output String content
50      "Content of environment variable (empty, if not existent)";
51  output Boolean exist
52      "= true, if environment variable exists; = false, if it does not exist";
53  external "C" ModelicaInternal_getenv(name, convertToSlash, content, exist);
54    annotation (Documentation(info="<html>
55 
56</html>"));
57end getEnvironmentVariable;
58 
59function setEnvironmentVariable "Set content of local environment variable" 
60  extends Modelica.Icons.Function;
61  input String name "Name of environment variable";
62  input String content "Value of the environment variable";
63  input Boolean convertFromSlash =  false 
64      "True, if '/' in content shall be changed to the native directory separator";
65external "C" ModelicaInternal_setenv(name, content, convertFromSlash);
66    annotation (Documentation(info="<html>
67   
68</html>"));
69end setEnvironmentVariable;
70 
71function command "Execute command in default shell" 
72  extends Modelica.Icons.Function;
73  input String string "String to be passed to shell";
74  output Integer result "Return value from command (depends on environment)";
75  external "C" result = system(string);
76    annotation (Documentation(info="<html>
77 
78</html>"));
79end command;
80 
81function exit "Terminate execution of Modelica environment" 
82  extends Modelica.Icons.Function;
83  input Integer status=0 
84      "Result to be returned by environment (0 means success)";
85  external "C" ModelicaInternal_exit(status);
86end exit;
87end System;
Note: See TracBrowser for help on using the browser.