Skip to content

Commit

Permalink
- BREAKING 16 tests in the testsuite with this commit:
Browse files Browse the repository at this point in the history
  ==== Log /tmp/omc-rtest-adrpo/biochem/log-BiochemModels.mos
  ==== Log /tmp/omc-rtest-adrpo/bootstrapping/log-SimCodeTest.mos
  ==== Log /tmp/omc-rtest-adrpo/interactive/log-Rename.mos
  ==== Log /tmp/omc-rtest-adrpo/mofiles/log-ArrayModification13.mo
  ==== Log /tmp/omc-rtest-adrpo/mofiles/log-Constant9.mo
  ==== Log /tmp/omc-rtest-adrpo/mofiles/log-Discrete2.mo
  ==== Log /tmp/omc-rtest-adrpo/mofiles/log-Modification9.mo
  ==== Log /tmp/omc-rtest-adrpo/mofiles/log-Overwriting3.mo
  ==== Log /tmp/omc-rtest-adrpo/mofiles/log-Overwriting4.mo
  ==== Log /tmp/omc-rtest-adrpo/mosfiles-nosim/log-FinalTests.mos
  ==== Log /tmp/omc-rtest-adrpo/mosfiles/log-BuiltinMath.mos
  ==== Log /tmp/omc-rtest-adrpo/mosfiles/log-CheckEvents.mos
  ==== Log /tmp/omc-rtest-adrpo/parser/log-CheckSourcesForTabs.mos
  ==== Log /tmp/omc-rtest-adrpo/parser/log-ParseCompilerSources.mos
  ==== Log /tmp/omc-rtest-adrpo/redeclare/log-RedeclareFunction.mo
- i will fix them in the next days (they are not that problematic)
- quite big commit, some fixes for Media 255/26 instantiate/check now.
  i'm still loosing redeclares in some cases (mostly weird restrictions
  like connectors), i'll do some more chasing for redeclare mods in Inst 
  in the next days.
- running the Media testsuite with nogen and noevalfunc (for now as even so takse ~10 minutes)
  will fix function problems later.
- plenty of other new stuff:
  + some partial Graph implementation 
    Edge.mo, Element.mo, Instance.mo, Node.mo, Reference.mo, SCodeGraph.mo, Visited.mo
  + general stuff
    Scope.mo, Name.mo, NamePool.mo, Relation.mo (moved to Util), more stuff in AvlTree.mo
  + global data structure which could be used anywhere (Global/Global.mo)
  + collecting all files in SimCode.mo (i had also send them to templates, but i will not
    push those changes as the templates get more complicated).
- added Values.EMPTY and DAE.EMPTY to be returned when we do not have bindings.
- many more things i forgot about.


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@9391 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Jul 1, 2011
1 parent 4a4fe63 commit f936496
Show file tree
Hide file tree
Showing 55 changed files with 7,981 additions and 1,368 deletions.
718 changes: 701 additions & 17 deletions Compiler/BackEnd/SimCode.mo

Large diffs are not rendered by default.

12 changes: 2 additions & 10 deletions Compiler/FrontEnd/Absyn.mo
Expand Up @@ -871,22 +871,13 @@ uniontype CodeNode "The Code uniontype is used for Meta-programming. It originat
end CodeNode;



uniontype FunctionArgs "The FunctionArgs uniontype consists of a list of positional arguments
followed by a list of named arguments (Modelica v2.0)"
record FUNCTIONARGS
list<Exp> args "args" ;
list<NamedArg> argNames "argNames" ;
end FUNCTIONARGS;

/*
record FOR_ITER_FARG
Exp from "from" ;
Ident var "var" ;
Exp to "to" ;
end FOR_ITER_FARG;
*/

record FOR_ITER_FARG
Exp exp "iterator expression";
ForIterators iterators;
Expand Down Expand Up @@ -1059,12 +1050,13 @@ end Comment;

public
uniontype ExternalDecl "Declaration of an external function call - ExternalDecl"

record EXTERNALDECL
Option<Ident> funcName "The name of the external function" ;
Option<String> lang "Language of the external function" ;
Option<ComponentRef> output_ "output parameter as return value" ;
list<Exp> args "only positional arguments, i.e. expression list" ;
Option<Annotation> annotation_ ;
Option<Annotation> annotation_;
end EXTERNALDECL;

end ExternalDecl;
Expand Down
682 changes: 354 additions & 328 deletions Compiler/FrontEnd/Ceval.mo

Large diffs are not rendered by default.

31 changes: 18 additions & 13 deletions Compiler/FrontEnd/CevalFunction.mo
Expand Up @@ -78,9 +78,10 @@ protected import System;
protected import Types;
protected import Util;
protected import ValuesUtil;
protected import SCodeDump;

// [TYPE] Types
public type SymbolTable = Option<Interactive.InteractiveSymbolTable>;
public type SymbolTable = Option<Interactive.SymbolTable>;

protected type FunctionVar = tuple<DAE.Element, Option<Values.Value>>;

Expand Down Expand Up @@ -117,6 +118,7 @@ algorithm
String func_name;
Env.Cache cache;
SymbolTable st;
Boolean partialPrefix;

// The DAE.FUNCTION structure might contain an optional function derivative
// mapping which is why functions below is a list. We only evaluate the
Expand All @@ -133,11 +135,14 @@ algorithm
then
(cache, result, st);

else
case (_, _, DAE.FUNCTION(
path = p,
functions = func :: _,
type_ = ty,
partialPrefix = partialPrefix), _, st)
equation
true = RTOpts.debugFlag("failtrace");
Debug.traceln("- CevalFunction.evaluate failed for function ");
Debug.traceln(DAEDump.dumpFunctionStr(inFunction));
Debug.traceln("- CevalFunction.evaluate failed for function: " +& Util.if_(partialPrefix, "partial ", "") +& Absyn.pathString(p));
then
fail();
end matchcontinue;
Expand Down Expand Up @@ -230,7 +235,7 @@ algorithm

else
equation
Debug.fprintln("failtrace", "- CevalFunction.evaluateFunction failed.\n");
Debug.fprintln("evalfunc", "- CevalFunction.evaluateFunction failed.\n");
then
fail();
end matchcontinue;
Expand All @@ -257,7 +262,7 @@ algorithm

case ((var as DAE.VAR(direction = DAE.INPUT())) :: _, {})
equation
Debug.fprintln("failtrace", "- CevalFunction.pairFuncParamsWithArgs "
Debug.fprintln("evalfunc", "- CevalFunction.pairFuncParamsWithArgs "
+& "failed because of too few input arguments.");
then
fail();
Expand Down Expand Up @@ -1052,7 +1057,7 @@ algorithm

else
equation
true = RTOpts.debugFlag("failtrace");
true = RTOpts.debugFlag("evalfunc");
Debug.traceln("- CevalFunction.evaluateStatement failed for:");
Debug.traceln(DAEDump.ppStatementStr(inStatement));
then
Expand Down Expand Up @@ -1276,7 +1281,7 @@ algorithm

case (DAE.STMT_FOR(range = range), _, _, _)
equation
true = RTOpts.debugFlag("failtrace");
true = RTOpts.debugFlag("evalfunc");
Debug.traceln("- evaluateForStatement not implemented for:");
Debug.traceln(ExpressionDump.printExpStr(range));
then
Expand Down Expand Up @@ -1378,7 +1383,7 @@ algorithm
case DAE.CREF(componentRef = cref) then cref;
else
equation
Debug.fprintln("failtrace",
Debug.fprintln("evalfunc",
"- CevalFunction.extractLhsComponentRef failed on " +&
ExpressionDump.printExpStr(inExp) +& "\n");
then
Expand Down Expand Up @@ -1488,7 +1493,7 @@ algorithm

case (_, env, (e, _), _)
equation
true = RTOpts.debugFlag("failtrace");
true = RTOpts.debugFlag("evalfunc");
Debug.traceln("- CevalFunction.extendEnvWithFunctionVars failed for:");
Debug.traceln(DAEDump.dumpElementsStr({e}));
then
Expand Down Expand Up @@ -1832,7 +1837,7 @@ algorithm

case (_, sub :: _, _, _, _, _)
equation
Debug.fprintln("failtrace", "- CevalFunction.appendDimensions2 failed");
Debug.fprintln("evalfunc", "- CevalFunction.appendDimensions2 failed");
then
fail();
end matchcontinue;
Expand Down Expand Up @@ -2076,7 +2081,7 @@ algorithm

case (_, _, sub :: _, _, _, _)
equation
true = RTOpts.debugFlag("failtrace");
true = RTOpts.debugFlag("evalfunc");
print("- CevalFunction.assignVector failed on: ");
print(ExpressionDump.printSubscriptStr(sub) +& "\n");
then
Expand Down Expand Up @@ -2247,7 +2252,7 @@ algorithm
Values.ARRAY(values, int_dim :: dims);
case (_)
equation
Debug.fprintln("failtrace", "- CevalFunction.generateDefaultBinding failed\n");
Debug.fprintln("evalfunc", "- CevalFunction.generateDefaultBinding failed\n");
then
fail();
end matchcontinue;
Expand Down
4 changes: 1 addition & 3 deletions Compiler/FrontEnd/ClassInf.mo
Expand Up @@ -329,9 +329,7 @@ algorithm
end printState;

public function getStateName "function: getStateName

Returns the classname of the state.
"
Returns the classname of the state."
input State inState;
output Absyn.Path outPath;
algorithm
Expand Down
11 changes: 11 additions & 0 deletions Compiler/FrontEnd/DAE.mo
Expand Up @@ -1164,6 +1164,17 @@ uniontype Exp "Expressions
ExpType ty;
end CODE;

record EMPTY
"an empty expression, meaning a constant without a binding. is used to be able to continue the evaluation of a model even if there are
constants with no bindings. at the end, when we have the DAE we should have no EMPTY values or expressions in it when we need to simulate
the model.
From Modelica specification: a package may we look inside should not be partial in a simulation model!"
String scope "the scope where we could not find the binding";
ComponentRef name "the name of the variable";
ExpType ty "the type of the variable";
String tyStr;
end EMPTY;

record REDUCTION "e.g. sum(i*i+1 for i in 1:4)"
ReductionInfo reductionInfo;
Exp expr "expr, e.g i*i+1" ;
Expand Down
32 changes: 12 additions & 20 deletions Compiler/FrontEnd/Dump.mo
Expand Up @@ -582,14 +582,14 @@ end unparseRestrictionStr;
public function printIstmtStr
"function: printIstmtStr
Prints an interactive statement to a string."
input Interactive.InteractiveStmts inInteractiveStmts;
input Interactive.Statements inStatements;
output String strIstmt;
algorithm
strIstmt := matchcontinue (inInteractiveStmts)
strIstmt := matchcontinue (inStatements)
local
Absyn.AlgorithmItem alg;
Absyn.Exp expr;
list<Interactive.InteractiveStmt> l;
list<Interactive.Statement> l;
Boolean sc;
String str;

Expand Down Expand Up @@ -625,13 +625,13 @@ end printIstmtStr;
public function dumpIstmt
"function: dumpIstmt
Dumps an interactive statement to the Print buffer."
input Interactive.InteractiveStmts inInteractiveStmts;
input Interactive.Statements inStatements;
algorithm
_ := matchcontinue (inInteractiveStmts)
_ := matchcontinue (inStatements)
local
Absyn.AlgorithmItem alg;
Absyn.Exp expr;
list<Interactive.InteractiveStmt> l;
list<Interactive.Statement> l;
Boolean sc;

case (Interactive.ISTMTS(interactiveStmtLst = {Interactive.IALG(algItem = alg)}))
Expand Down Expand Up @@ -2176,10 +2176,8 @@ algorithm
end match;
end unparseVariabilitySymbolStr;

protected function unparseDirectionSymbolStr "function: unparseDirectionSymbolStr

Returns a prettyprinted string of direction.
"
public function unparseDirectionSymbolStr "function: unparseDirectionSymbolStr
Returns a prettyprinted string of direction."
input Absyn.Direction inDirection;
output String outString;
algorithm
Expand All @@ -2192,13 +2190,10 @@ algorithm
end unparseDirectionSymbolStr;

public function printComponent "function: printComponent

Prints a Component to the Print buffer.
"
Prints a Component to the Print buffer."
input Absyn.Component inComponent;
algorithm
_:=
match (inComponent)
_ := match (inComponent)
local
Ident n;
list<Absyn.Subscript> a;
Expand All @@ -2218,13 +2213,10 @@ algorithm
end printComponent;

protected function printComponentitem "function: printComponentitem

Prints a ComponentItem to the Print buffer.
"
Prints a ComponentItem to the Print buffer."
input Absyn.ComponentItem inComponentItem;
algorithm
_:=
match (inComponentItem)
_ := match (inComponentItem)
local
Absyn.Component c;
Option<Absyn.Exp> optcond;
Expand Down

0 comments on commit f936496

Please sign in to comment.