Skip to content

Commit

Permalink
- Added support for external function annotation Library={"lib1","lib…
Browse files Browse the repository at this point in the history
…2"}, as per the 3.1 specification.

  + Updated MetaModelicaDev testsuite to use this functionality.


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@5116 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Mar 10, 2010
1 parent 7732cc9 commit 5b6f8ef
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Compiler/Absyn.mo
Expand Up @@ -1804,6 +1804,15 @@ algorithm ostring := matchcontinue(imp)
end matchcontinue;
end printImportString;

public function expString "returns the string of an expression if it is a string constant."
input Exp exp;
output String str;
algorithm
str := matchcontinue(exp)
case(STRING(str)) then str;
end matchcontinue;
end expString;

public function expCref "returns the componentRef of an expression if matches."
input Exp exp;
output ComponentRef cr;
Expand Down
9 changes: 8 additions & 1 deletion Compiler/Codegen.mo
Expand Up @@ -1357,12 +1357,19 @@ algorithm
local
Lib lib;
list<Absyn.ElementArg> eltarg;
list<Absyn.Exp> arr;
case (eltarg)
equation
Absyn.CLASSMOD(_,SOME(Absyn.STRING(lib))) =
Interactive.getModificationValue(eltarg, Absyn.CREF_IDENT("Library",{})) "System.stringReplace(lib,\"\\\"\",\"\"\") => lib\'" ;
Interactive.getModificationValue(eltarg, Absyn.CREF_IDENT("Library",{}));
then
{lib};
case (eltarg)
equation
Absyn.CLASSMOD(_,SOME(Absyn.ARRAY(arr))) =
Interactive.getModificationValue(eltarg, Absyn.CREF_IDENT("Library",{}));
then
Util.listMap(arr, Absyn.expString);
case (_) then {};
end matchcontinue;
end generateExtFunctionIncludesLibstr;
Expand Down

0 comments on commit 5b6f8ef

Please sign in to comment.