Skip to content

Commit

Permalink
- Update for OptManager.setOption (no more return value since it alwa…
Browse files Browse the repository at this point in the history
…ys returned true)

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@7133 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Nov 20, 2010
1 parent 563d09b commit 4eb4da6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
8 changes: 4 additions & 4 deletions Compiler/CevalScript.mo
Expand Up @@ -424,9 +424,9 @@ algorithm
lstVarVal = iv,
compiledFunctions = cf)),msg)
equation
_ = OptManager.setOption("checkModel", true);
OptManager.setOption("checkModel", true);
(cache,ret_val,st_1) = checkModel(cache, env, className, st, msg);
_ = OptManager.setOption("checkModel", false);
OptManager.setOption("checkModel", false);
then
(cache,ret_val,st_1);

Expand Down Expand Up @@ -4029,9 +4029,9 @@ algorithm
false = Interactive.isType(cr, p);
print("Checking: " +& Dump.unparseClassAttributesStr(c) +& " " +& Absyn.pathString(className) +& "... ");
t1 = clock();
_ = OptManager.setOption("checkModel", true);
OptManager.setOption("checkModel", true);
(_,Values.STRING(str),_) = checkModel(cache, env, className, st, msg);
_ = OptManager.setOption("checkModel", false);
OptManager.setOption("checkModel", false);
t2 = clock(); elapsedTime = t2 -. t1; s = realString(elapsedTime);
print (s +& " seconds -> " +& failOrSuccess(str) +& "\n\t");
print (System.stringReplace(str, "\n", "\n\t"));
Expand Down
6 changes: 3 additions & 3 deletions Compiler/Interactive.mo
Expand Up @@ -2661,7 +2661,7 @@ algorithm
matchApiFunction(istmts, "setOption");
{Absyn.CREF(componentRef = Absyn.CREF_IDENT(str, _)), Absyn.BOOL(value = b1)} =
getApiFunctionArgs(istmts);
_ = OptManager.setOption(str, b1);
OptManager.setOption(str, b1);
then
("true",st);

Expand Down Expand Up @@ -14339,12 +14339,12 @@ algorithm
// set check model on so that partial classes can be instantiated!
b1 = OptManager.getOption("checkModel");
b2 = RTOpts.getEvaluateParametersInAnnotations();
_ = OptManager.setOption("checkModel", true);
OptManager.setOption("checkModel", true);
RTOpts.setEvaluateParametersInAnnotations(true); // set to evaluate the parameters!
(cache,env,_,_) = Inst.instantiateClass(Env.emptyCache(),InnerOuter.emptyInstHierarchy,graphicProgramSCode,inModelPath);

RTOpts.setEvaluateParametersInAnnotations(b2);
_ = OptManager.setOption("checkModel", b1);
OptManager.setOption("checkModel", b1);
then
(cache, env, graphicProgram);

Expand Down
8 changes: 3 additions & 5 deletions Compiler/OptManager.mo
Expand Up @@ -44,18 +44,16 @@ package OptManager
public function dumpOptions "
Author BZ 2008-06
Dump all options."
external "C";
external "C" OptManager_dumpOptions() annotation(Library = "omcruntime");
end dumpOptions;

public function setOption "
Author: BZ 2008-06
Set one option, to set an option requires that the option to be set already exists in the program.
This is done in runtime/OptManager.cpp->OptManager_5finit.
"
input String option;
input Boolean optionValue;
output Boolean succeded;
external "C";
external "C" OptManager_setOption(option,optionValue) annotation(Library = "omcruntime");
end setOption;

public function getOption "
Expand All @@ -64,7 +62,7 @@ Get option as String.
"
input String option;
output Boolean optionValue;
external "C";
external "C" optionValue=OptManager_getOption(option) annotation(Library = "omcruntime");
end getOption;

end OptManager;
4 changes: 2 additions & 2 deletions Compiler/System.mo
Expand Up @@ -268,7 +268,7 @@ end setDataPort;
public function setVariableFilter
input String variables;
output Boolean b;
external "C" b=System_setVariableFilter(variables) annotation(Library = "omcruntime");
external "C" b=setenv("sendDataFilter",variables,true) annotation(Library = "omcruntime");
end setVariableFilter;

public function sendData2
Expand Down Expand Up @@ -331,7 +331,7 @@ public function setEnv ""
input String value;
input Boolean overwrite "is always true on Windows, so recommended to always call it using true";
output Integer outInteger;
external "C" outInteger=System_setEnv(varName,value,overwrite) annotation(Library = "omcruntime");
external "C" outInteger=setenv(varName,value,overwrite) annotation(Library = "omcruntime");
end setEnv;

public function subDirectories
Expand Down

0 comments on commit 4eb4da6

Please sign in to comment.