Skip to content

Commit

Permalink
Added a parameter (addMathMLCode=true/false) to select if adding the …
Browse files Browse the repository at this point in the history
…MathMLCode to the XML dumped fileor no (default is false).

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@3805 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Filippo Donida committed Jan 20, 2009
1 parent 4b3620e commit 0eaa5e6
Show file tree
Hide file tree
Showing 3 changed files with 272 additions and 166 deletions.
14 changes: 8 additions & 6 deletions Compiler/Ceval.mo
Expand Up @@ -1577,7 +1577,7 @@ algorithm
list<Integer>[:] m,mt;
Option<list<tuple<Integer, Integer, DAELow.Equation>>> jac;
Values.Value ret_val,simValue,size_value,value,v;
Exp.Exp filenameprefix,exp,starttime,stoptime,tolerance,interval,method,size_expression,funcref,bool_exp,storeInTemp,asInSimulationCode;
Exp.Exp filenameprefix,exp,starttime,stoptime,tolerance,interval,method,size_expression,funcref,bool_exp,storeInTemp,asInSimulationCode,addMathMLCode;
Absyn.ComponentRef cr_1;
Integer size,length,rest;
list<String> vars_1,vars_2,args;
Expand Down Expand Up @@ -3386,6 +3386,7 @@ algorithm
expLst =
{Exp.CODE(Absyn.C_TYPENAME(className),_),
asInSimulationCode,
addMathMLCode,
filenameprefix,
storeInTemp})),
(st_1 as Interactive.SYMBOLTABLE(
Expand All @@ -3408,6 +3409,7 @@ algorithm
{
Exp.CODE(Absyn.C_TYPENAME(className),_),
asInSimulationCode,
addMathMLCode,
filenameprefix,
storeInTemp})),
(st_1 as Interactive.SYMBOLTABLE(
Expand Down Expand Up @@ -7075,13 +7077,13 @@ algorithm
Absyn.Program p;
DAELow.DAELow indexed_dlow_1;
Env.Cache cache;
Exp.Exp exp,fileprefix,storeInTemp;
Exp.Exp exp,fileprefix,storeInTemp,addMathMLCode;
Exp.ComponentRef cr;
Interactive.InteractiveSymbolTable st,st_1;
Msg msg;
Values.Value ret_val;
case (cache,env,(exp as Exp.CALL(path = Absyn.IDENT(name = _),
expLst = {Exp.CODE(Absyn.C_TYPENAME(classname),_),Exp.BCONST(bool=true),fileprefix,storeInTemp})),
expLst = {Exp.CODE(Absyn.C_TYPENAME(classname),_),Exp.BCONST(bool=true),addMathMLCode,fileprefix,storeInTemp})),
(st_1 as Interactive.SYMBOLTABLE(ast = p,explodedAst = sp,instClsLst = ic,lstVarVal = iv,compiledFunctions = cf)),msg)
local
Boolean x;
Expand Down Expand Up @@ -7114,14 +7116,14 @@ algorithm
indexed_dlow_1 = DAELow.calculateValues(indexed_dlow);
xml_filename = Util.stringAppendList({filenameprefix,".xml"});
Print.clearBuf();
XMLDump.dumpDAELow(indexed_dlow_1);
XMLDump.dumpDAELow(indexed_dlow_1,addMathMLCode);
xml_contents = Print.getString();
Print.clearBuf();
System.writeFile(xml_filename,xml_contents);
then
(cache,st,xml_contents,stringAppend("The model has been dumped to xml file: ",xml_filename));
case (cache,env,(exp as Exp.CALL(path = Absyn.IDENT(name = _),
expLst = {Exp.CODE(Absyn.C_TYPENAME(classname),_),Exp.BCONST(bool=false),fileprefix,storeInTemp})),
expLst = {Exp.CODE(Absyn.C_TYPENAME(classname),_),Exp.BCONST(bool=false),addMathMLCode,fileprefix,storeInTemp})),
(st_1 as Interactive.SYMBOLTABLE(ast = p,explodedAst = sp,instClsLst = ic,lstVarVal = iv,compiledFunctions = cf)),msg)
local
Boolean x;
Expand Down Expand Up @@ -7149,7 +7151,7 @@ algorithm
(_,_,dlow_1,m,mT) = DAELow.matchingAlgorithm(dlow, m, mT, (DAELow.INDEX_REDUCTION(),DAELow.EXACT(), DAELow.REMOVE_SIMPLE_EQN()));
xml_filename = Util.stringAppendList({filenameprefix,".xml"});
Print.clearBuf();
XMLDump.dumpDAELow(dlow_1);
XMLDump.dumpDAELow(dlow_1,addMathMLCode);
xml_contents = Print.getString();
Print.clearBuf();
System.writeFile(xml_filename,xml_contents);
Expand Down
6 changes: 4 additions & 2 deletions Compiler/Static.mo
Expand Up @@ -5838,19 +5838,21 @@ algorithm
(cache,Exp.CALL(Absyn.IDENT("echo"),{bool_exp_1},false,true,Exp.STRING()),Types.PROP((Types.T_BOOL({}),NONE),Types.C_CONST()),SOME(st));

case (cache,env,Absyn.CREF_IDENT(name = "dumpXMLDAE"),{Absyn.CREF(componentReg = cr)},args,impl,SOME(st))
local Absyn.Path className; Exp.Exp storeInTemp,asInSimulationCode;
local Absyn.Path className; Exp.Exp storeInTemp,asInSimulationCode,addMathMLCode;
equation
className = Absyn.crefToPath(cr);
cname_str = Absyn.pathString(className);
(cache,asInSimulationCode) = getOptionalNamedArg(cache,env, SOME(st), impl, "asInSimulationCode",
(Types.T_BOOL({}),NONE), args, Exp.BCONST(false));
(cache,addMathMLCode) = getOptionalNamedArg(cache,env, SOME(st), impl, "addMathMLCode",
(Types.T_BOOL({}),NONE), args, Exp.BCONST(false));
(cache,filenameprefix) = getOptionalNamedArg(cache,env, SOME(st), impl, "fileNamePrefix",
(Types.T_STRING({}),NONE), args, Exp.SCONST(cname_str));
(cache,storeInTemp) = getOptionalNamedArg(cache,env, SOME(st), impl, "storeInTemp",
(Types.T_BOOL({}),NONE), args, Exp.BCONST(false));
then
(cache,Exp.CALL(Absyn.IDENT("dumpXMLDAE"),
{Exp.CODE(Absyn.C_TYPENAME(className),Exp.OTHER()),asInSimulationCode,filenameprefix,storeInTemp},false,true,Exp.OTHER()),Types.PROP(
{Exp.CODE(Absyn.C_TYPENAME(className),Exp.OTHER()),asInSimulationCode,addMathMLCode,filenameprefix,storeInTemp},false,true,Exp.OTHER()),Types.PROP(
(
Types.T_ARRAY(Types.DIM(SOME(2)),(Types.T_STRING({}),NONE)),NONE),Types.C_VAR()),SOME(st));
end matchcontinue;
Expand Down

0 comments on commit 0eaa5e6

Please sign in to comment.