Skip to content

Commit

Permalink
Merge pull request #403 from perost/nfinst3
Browse files Browse the repository at this point in the history
[NF] Add scanInteger to known external functions.
  • Loading branch information
perost committed Aug 22, 2019
1 parent 1b470a5 commit 1509b42
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions OMCompiler/Compiler/NFFrontEnd/NFEvalFunction.mo
Expand Up @@ -971,6 +971,13 @@ algorithm
Expression.TUPLE(Type.TUPLE({Type.INTEGER(), Type.BOOLEAN()}, NONE()),
{Expression.INTEGER(i), Expression.REAL(r)});

case ("ModelicaStrings_scanInteger", {Expression.STRING(s1), Expression.INTEGER(i), Expression.BOOLEAN(b)})
algorithm
(i, i2) := ModelicaExternalC.Strings_advanced_scanInteger(s1, i, b);
then
Expression.TUPLE(Type.TUPLE({Type.INTEGER(), Type.INTEGER()}, NONE()),
{Expression.INTEGER(i), Expression.INTEGER(i2)});

case ("ModelicaStrings_skipWhiteSpace", {Expression.STRING(s1), Expression.INTEGER(i)})
then Expression.INTEGER(ModelicaExternalC.Strings_advanced_skipWhiteSpace(s1, i));

Expand Down
11 changes: 11 additions & 0 deletions OMCompiler/Compiler/Util/ModelicaExternalC.mo
Expand Up @@ -95,6 +95,17 @@ function Strings_advanced_scanReal
external "C" ModelicaStrings_scanReal(string,startIndex,unsigned,nextIndex,number) annotation(Library = "ModelicaExternalC");
end Strings_advanced_scanReal;

function Strings_advanced_scanInteger
input String string;
input Integer startIndex;
input Boolean unsigned;
output Integer nextIndex;
output Integer number;

external "C"
ModelicaStrings_scanInteger(string,startIndex,unsigned,nextIndex,number) annotation(Library = "ModelicaExternalC");
end Strings_advanced_scanInteger;

function Strings_advanced_skipWhiteSpace
input String string;
input Integer startIndex(min = 1) = 1;
Expand Down

0 comments on commit 1509b42

Please sign in to comment.