Skip to content

Commit

Permalink
- Generate correct external type for records
Browse files Browse the repository at this point in the history
- Only declare init variable if it does not already exist in return struct
- Extract record declarations from external functions in addition to just
  regular Modelica functions
- Fixed bug in writeOutVar: a comma too much if external function had no input
  arguments


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@5137 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Rickard Lindberg committed Mar 12, 2010
1 parent 7571353 commit cca934e
Show file tree
Hide file tree
Showing 5 changed files with 1,263 additions and 1,032 deletions.
7 changes: 5 additions & 2 deletions Compiler/SimCode.mo
Expand Up @@ -199,6 +199,7 @@ uniontype Function
list<String> includes;
list<String> libs;
String language "C or Fortran";
list<RecordDeclaration> recordDecls;
end EXTERNAL_FUNCTION;
end Function;

Expand Down Expand Up @@ -747,14 +748,16 @@ algorithm
outVars = Util.listMap(DAEUtil.getOutputVars(daeElts), daeInOutSimVar);
inVars = Util.listMap(DAEUtil.getInputVars(daeElts), daeInOutSimVar);
biVars = Util.listMap(DAEUtil.getBidirVars(daeElts), daeInOutSimVar);
(recordDecls,rt_1) = elaborateRecordDeclarations(daeElts, {}, rt);
(includes, libs) = generateExtFunctionIncludes(ann);
simextargs = Util.listMap(extargs, extArgsToSimExtArgs);
extReturn = extArgsToSimExtArgs(extretarg);
(simextargs, extReturn) = fixOutputIndex(outVars, simextargs, extReturn);
then
(EXTERNAL_FUNCTION(fpath, extfnname, funArgs, simextargs, extReturn,
inVars, outVars, biVars, includes, libs, lang),
rt);
inVars, outVars, biVars, includes, libs, lang,
recordDecls),
rt_1);
case (comp,rt)
equation
Error.addMessage(Error.INTERNAL_ERROR, {"SimCode.elaborateFunction failed"});
Expand Down

0 comments on commit cca934e

Please sign in to comment.