Skip to content

Commit

Permalink
- mmc_unbox as macros.
Browse files Browse the repository at this point in the history
- Changed in cevalScript/SimCodegen generation of functions.
- We now generate all metarecords of referenced uniontypes instead of only the ones created by a METARECORDCALL. This is necessary due to the possibility of external functions (lexers/parsers) generating these structures. It kinda worked before, but was a bit of a hack.
- Codegen.getFunctionCalls(exps), etc renamed to getMatchingExps(exps, matchCalls).


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@4435 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Oct 29, 2009
1 parent 304946a commit e6df086
Show file tree
Hide file tree
Showing 12 changed files with 521 additions and 431 deletions.
6 changes: 3 additions & 3 deletions Compiler/Builtin.mo
@@ -1,9 +1,9 @@
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-2008, Link�pings University,
* Copyright (c) 1998-2008, Linköpings University,
* Department of Computer and Information Science,
* SE-58183 Link�ping, Sweden.
* SE-58183 Linköping, Sweden.
*
* All rights reserved.
*
Expand All @@ -14,7 +14,7 @@
*
* The OpenModelica software and the Open Source Modelica
* Consortium (OSMC) Public License (OSMC-PL) are obtained
* from Link�pings University, either from the above address,
* from Linköpings University, either from the above address,
* from the URL: http://www.ida.liu.se/projects/OpenModelica
* and in the OpenModelica distribution.
*
Expand Down
12 changes: 8 additions & 4 deletions Compiler/CevalScript.mo
Expand Up @@ -2342,7 +2342,7 @@ algorithm
makefilename = generateMakefilename(filenameprefix);
a_cref = Absyn.pathToCref(className);
file_dir = getFileDir(a_cref, p);
libs = SimCodegen.generateFunctions(p_1, dae, indexed_dlow_1, className, funcfilename);
(cache,libs) = SimCodegen.generateFunctions(cache, env, p_1, dae, indexed_dlow_1, className, funcfilename);
SimCodegen.generateSimulationCode(dae, /* dlow_1,*/ indexed_dlow_1, ass1, ass2, m, mT, comps, className, filename, funcfilename,file_dir);
SimCodegen.generateMakefile(makefilename, filenameprefix, libs, file_dir);
/*
Expand Down Expand Up @@ -4059,7 +4059,7 @@ protected constant String constCfileHeader =
#if defined(_MSC_VER)
#define DLLExport __declspec( dllexport )
#else \n
#else
#define DLLExport /* nothing */
#endif
Expand All @@ -4070,6 +4070,7 @@ protected constant String constCfileHeader =
#define MODELICA_TERMINATE(msg) { fprintf(stderr,\"Modelica Terminate: %s!\\n\", msg); fflush(stderr); }
#endif
";

public function cevalGenerateFunction "function: cevalGenerateFunction
Expand All @@ -4090,20 +4091,23 @@ algorithm
String MakefileHeader;
list<String> libs;
list<DAE.Element> d;

list<Absyn.Path> uniontypePaths;
list<Types.Type> metarecordTypes;
case (cache, env, path)
equation
false = RTOpts.debugFlag("nogen");
(cache,false) = Static.isExternalObjectFunction(cache,env,path); //ext objs functions not possible to Ceval.ceval.
pathstr = generateFunctionName(path);
Debug.fprintln("ceval", "/*- Ceval.cevalGenerateFunction starting*/");
(cache,d,_) = cevalGenerateFunctionDAEs(cache, path, env, {});
uniontypePaths = Codegen.getUniontypePaths(d);
(cache,metarecordTypes) = Lookup.lookupMetarecordsRecursive(cache, env, uniontypePaths, {});

cfilename = stringAppend(pathstr, ".c");
Print.clearBuf();
Debug.fprintln("ceval", "/*- Ceval.cevalGenerateFunction generating function string */");
Print.printBuf(constCfileHeader);
libs = Codegen.generateFunctions(DAE.DAE(d));
libs = Codegen.generateFunctions(DAE.DAE(d),metarecordTypes);
Print.writeBuf(cfilename);
Print.clearBuf();

Expand Down

0 comments on commit e6df086

Please sign in to comment.