Skip to content

Commit b507d30

Browse files
authored
First draft of getModelInstance API (#8676)
- Implement getModelInstance. - Improve the JSON parser to also allow constructing JSON structures in a convenient manner.
1 parent 6c7b82d commit b507d30

File tree

9 files changed

+623
-80
lines changed

9 files changed

+623
-80
lines changed

OMCompiler/Compiler/NFFrontEnd/NFModelicaBuiltin.mo

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4645,6 +4645,13 @@ annotation(preferredView="text",Documentation(info="<html>
46454645
</html>"));
46464646
end convertPackageToLibrary;
46474647

4648+
function getModelInstance
4649+
input TypeName className;
4650+
input Boolean prettyPrint = false;
4651+
output String result;
4652+
external "builtin";
4653+
end getModelInstance;
4654+
46484655
// OMSimulator API calls
46494656
type oms_system = enumeration(oms_system_none,oms_system_tlm, oms_system_wc,oms_system_sc);
46504657
type oms_causality = enumeration(oms_causality_input, oms_causality_output, oms_causality_parameter, oms_causality_bidir, oms_causality_undefined);

OMCompiler/Compiler/NFFrontEnd/NFPrefixes.mo

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,26 @@ function mergeVisibility
665665
output Visibility vis = if outerVis == Visibility.PROTECTED then outerVis else innerVis;
666666
end mergeVisibility;
667667

668+
function isReplaceable
669+
input Replaceable repl;
670+
output Boolean res;
671+
algorithm
672+
res := match repl
673+
case Replaceable.REPLACEABLE() then true;
674+
else false;
675+
end match;
676+
end isReplaceable;
677+
678+
function replaceableString
679+
input Replaceable repl;
680+
output String str;
681+
algorithm
682+
str := match repl
683+
case Replaceable.REPLACEABLE() then "replaceable";
684+
else "";
685+
end match;
686+
end replaceableString;
687+
668688
function unparseReplaceable
669689
input Replaceable repl;
670690
output String str;

0 commit comments

Comments
 (0)