Skip to content

Commit

Permalink
[NF] fix ticket:5577
Browse files Browse the repository at this point in the history
- for an FMU build, evaluate OpenModelica_uriToFilename in NFCeval to OpenModelica_fmuLoadResource same as the old frontend does
  • Loading branch information
adrpo committed Jul 10, 2019
1 parent c496614 commit 6bd362b
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions OMCompiler/Compiler/NFFrontEnd/NFCeval.mo
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import NFClass.Class;
import TypeCheck = NFTypeCheck;
import ExpandExp = NFExpandExp;
import ElementSource;
import Flags;

public
uniontype EvalTarget
Expand Down Expand Up @@ -1641,7 +1642,7 @@ algorithm
case "transpose" then evalBuiltinTranspose(listHead(args));
case "vector" then evalBuiltinVector(listHead(args));
case "zeros" then evalBuiltinZeros(args);
case "OpenModelica_uriToFilename" then evalUriToFilename(listHead(args));
case "OpenModelica_uriToFilename" then evalUriToFilename(fn, args, target);
case "intBitAnd" then evalIntBitAnd(args);
case "intBitOr" then evalIntBitOr(args);
case "intBitXor" then evalIntBitXor(args);
Expand Down Expand Up @@ -2593,12 +2594,26 @@ algorithm
end evalBuiltinZeros;

function evalUriToFilename
input Expression arg;
input Function fn;
input list<Expression> args;
input EvalTarget target;
output Expression result;
protected
Expression e, arg;
String s;
Function f;
algorithm
arg := listHead(args);
result := match arg
case Expression.STRING()
then Expression.STRING(OpenModelica.Scripting.uriToFilename(arg.value));
algorithm
s := OpenModelica.Scripting.uriToFilename(arg.value);
e := Expression.STRING(s);
if Flags.getConfigBool(Flags.BUILDING_FMU) then
f := Function.setName(Absyn.IDENT("OpenModelica_fmuLoadResource"), fn);
e := Expression.CALL(Call.makeTypedCall(f, {e}, Variability.PARAMETER, Expression.typeOf(e)));
end if;
then e;

else algorithm printWrongArgsError(getInstanceName(), {arg}, sourceInfo()); then fail();
end match;
Expand Down

0 comments on commit 6bd362b

Please sign in to comment.