Skip to content

Commit

Permalink
Parse all operations correctly for JSON
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@23273 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Nov 7, 2014
1 parent 8d3347a commit da98a1f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Compiler/SimCode/SerializeModelInfo.mo
Expand Up @@ -351,12 +351,11 @@ algorithm
File.writeEscape(file,expStr(op.exp),escape=File.Escape.JSON);
File.write(file,"\"]}");
then ();
// Custom operations - operations that can not be described in a general way because they are specialized
case DAE.OP_DIFFERENTIATE()
equation
File.write(file,"{\"op\":\"differentiate\",\"data\":[\"");
File.write(file,"{\"op\":\"before-after\",\"display\":\"differentiate d/d");
File.writeEscape(file,crefStr(op.cr),escape=File.Escape.JSON);
File.write(file,"\",\"");
File.write(file,"\",\"data\":[\"");
File.writeEscape(file,expStr(op.before),escape=File.Escape.JSON);
File.write(file,"\",\"");
File.writeEscape(file,expStr(op.after),escape=File.Escape.JSON);
Expand All @@ -365,14 +364,17 @@ algorithm

case DAE.OP_SCALARIZE()
equation
File.write(file,"{\"op\":\"scalarize\",\"data\":[\"");
writeEqExpStr(file,op.before);
File.write(file,"\",");
File.write(file,"{\"op\":\"before-after\",\"display\":\"scalarize [");
File.write(file,intString(op.index));
File.write(file,",\"");
File.write(file,"]\",\"data\":[\"");
writeEqExpStr(file,op.before);
File.write(file,"\",\"");
writeEqExpStr(file,op.after);
File.write(file,"\"]}");
then ();

// Custom operations - operations that can not be described in a general way because they are specialized

else
equation
Error.addInternalError("serializeOperation failed", sourceInfo());
Expand Down

0 comments on commit da98a1f

Please sign in to comment.