Skip to content

Commit

Permalink
- Make the filename prefix of the simulate commands be the actual cla…
Browse files Browse the repository at this point in the history
…ss if using reflections

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@14782 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Jan 15, 2013
1 parent 7baa051 commit d43df4d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
1 change: 0 additions & 1 deletion Compiler/BackEnd/SimCodeMain.mo
Expand Up @@ -541,7 +541,6 @@ algorithm
equation
// calculate stuff that we need to create SimCode data structure
System.realtimeTick(CevalScript.RT_CLOCK_FRONTEND);
//(cache,Values.STRING(filenameprefix),SOME(_)) = Ceval.ceval(cache,env, fileprefix, true, SOME(st),NONE(), msg);
(cache,env,dae,st) = CevalScript.runFrontEnd(cache,env,className,st,false);
timeFrontend = System.realtimeTock(CevalScript.RT_CLOCK_FRONTEND);
System.realtimeTick(CevalScript.RT_CLOCK_BACKEND);
Expand Down
2 changes: 1 addition & 1 deletion Compiler/FrontEnd/Static.mo
Expand Up @@ -13935,7 +13935,7 @@ algorithm
res := b and res;
end slotAnd;

protected function elabCodeExp
public function elabCodeExp
input Absyn.Exp exp;
input Env.Cache cache;
input Env.Env env;
Expand Down
2 changes: 1 addition & 1 deletion Compiler/Script/CevalScript.mo
Expand Up @@ -6449,7 +6449,7 @@ algorithm
end matchcontinue;
end unparseGroupImport;

protected function evalCodeTypeName
public function evalCodeTypeName
input Values.Value val;
input Env.Env env;
output Values.Value res;
Expand Down
18 changes: 12 additions & 6 deletions Compiler/Script/StaticScript.mo
Expand Up @@ -9,6 +9,7 @@ public import Prefix;

public type Ident = String;

protected import Ceval;
protected import CevalScript;
protected import ClassInf;
protected import Debug;
Expand All @@ -19,6 +20,7 @@ protected import ExpressionSimplify;
protected import Flags;
protected import Static;
protected import Types;
protected import Values;


protected function calculateSimulationTimes
Expand Down Expand Up @@ -121,6 +123,7 @@ algorithm
(outCache, outSimulationArguments) :=
match (inCache, inEnv, inAbsynExpLst, inAbsynNamedArgLst, inBoolean, inInteractiveInteractiveSymbolTableOption, inPrefix, inInfo)
local
Absyn.Exp crexp;
Absyn.ComponentRef cr;
DAE.ComponentRef cr_1;
list<Absyn.NamedArg> args;
Expand All @@ -130,19 +133,22 @@ algorithm
Absyn.Info info;
String cname_str;
Absyn.Path className;
DAE.Exp startTime,stopTime,numberOfIntervals,tolerance,method,cflags,simflags;
DAE.Exp exp,startTime,stopTime,numberOfIntervals,tolerance,method,cflags,simflags;
DAE.Exp fileNamePrefix,storeInTemp,options,noClean,outputFormat,variableFilter,measureTime;
CevalScript.SimulationOptions defaulSimOpt;
Env.Cache cache;
Env.Env env;
Values.Value v;

// fill in defaults
case (cache,env,{Absyn.CREF(componentRef = cr)},args,impl,SOME(st),pre,info)
case (cache,env,{crexp},args,impl,SOME(st),pre,info)
equation
(cache,cr_1) = Static.elabUntypedCref(cache,env,cr,impl,pre,info);
className = Static.componentRefToPath(cr_1) "this extracts the fileNamePrefix which is used when generating code and init-file" ;
exp = Static.elabCodeExp(crexp,cache,env,DAE.C_TYPENAME(),info);
// We need to force eval in order to get the correct prefix
(cache,v,SOME(st)) = Ceval.ceval(cache,env,exp,true,SOME(st),Ceval.MSG(info));
Values.CODE(Absyn.C_TYPENAME(className)) = CevalScript.evalCodeTypeName(v,env);

cname_str = Absyn.pathString(Absyn.unqotePathIdents(className)) "easier than checking if the file system supports UTF-8...";

defaulSimOpt = CevalScript.buildSimulationOptionsFromModelExperimentAnnotation(st, className, cname_str);

(cache, startTime, stopTime, numberOfIntervals) =
Expand Down Expand Up @@ -606,4 +612,4 @@ end elabGraphicsExp;



end StaticScript;
end StaticScript;

0 comments on commit d43df4d

Please sign in to comment.