Skip to content

Commit

Permalink
Error.mo
Browse files Browse the repository at this point in the history
- typo fix

DAEUtil.mo
- better error messages

Inst.mo
- sort innerouter after the element dependency analysis
- add record constructors that are function inputs to the DAE (IdealGasH2O now compiles but has dassl issues)
- speedup Inst.makeFullyQualified a bit

InstExtends.mo
- more fix* calls which were missed

Interactive.mo
- use System.get/setPartialInst instead of RTOpts debug flags as they are REALLY slow
- this will speed up the MSL query for qt & java clients a bit.

SimCodeC.tpl
- use -O0 when running the testsuite.

Derive.mo
- better printout for derivative function error message

testsuite/
- update tests (more record constructors now)
- add one more to Media simulation and 2 more to Fluid flattening

mingw makefiles
- use wget (will be replaced by svn put into OMDev later) 
  to fetch revision number and put it part of the OMC version





git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@10556 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Nov 19, 2011
1 parent a3f224d commit 3588440
Show file tree
Hide file tree
Showing 12 changed files with 248 additions and 61 deletions.
12 changes: 6 additions & 6 deletions Compiler/BackEnd/Derive.mo
Expand Up @@ -840,9 +840,9 @@ algorithm
false = List.isEqualOnTrue(tlst1,tlst2,Types.equivtypes);
// add Warning
typlststring = List.map(tlst1,Types.unparseType);
typstring = stringDelimitList(typlststring,";");
typstring = "\n" +& stringDelimitList(typlststring,";\n");
dastring = Absyn.pathString(da);
Error.addMessage(Error.UNEXCPECTED_FUNCTION_INPUTS_WARNING, {dastring,typstring});
Error.addMessage(Error.UNEXPECTED_FUNCTION_INPUTS_WARNING, {dastring,typstring});
then
fail();

Expand Down Expand Up @@ -875,9 +875,9 @@ algorithm
false = List.isEqualOnTrue(tlst,tlst2,Types.equivtypes);
// add Warning
typlststring = List.map(tlst,Types.unparseType);
typstring = stringDelimitList(typlststring,";");
typstring = "\n" +& stringDelimitList(typlststring,";\n");
dastring = Absyn.pathString(da);
Error.addMessage(Error.UNEXCPECTED_FUNCTION_INPUTS_WARNING, {dastring,typstring});
Error.addMessage(Error.UNEXPECTED_FUNCTION_INPUTS_WARNING, {dastring,typstring});
then
fail();
end matchcontinue;
Expand Down Expand Up @@ -945,9 +945,9 @@ algorithm
(false,tlst) = checkDerivativeFunctionInputs(blst,tp,dtp);
// add Warning
typlststring = List.map(tlst,Types.unparseType);
typstring = stringDelimitList(typlststring,";");
typstring = "\n" +& stringDelimitList(typlststring,";\n");
dastring = Absyn.pathString(da);
Error.addMessage(Error.UNEXCPECTED_FUNCTION_INPUTS_WARNING, {dastring,typstring});
Error.addMessage(Error.UNEXPECTED_FUNCTION_INPUTS_WARNING, {dastring,typstring});
then
fail();
end matchcontinue;
Expand Down
93 changes: 88 additions & 5 deletions Compiler/FrontEnd/DAEUtil.mo
Expand Up @@ -3436,20 +3436,23 @@ public function getFunctionList
algorithm
fns := matchcontinue ft
local
list<tuple<DAE.AvlKey,DAE.AvlValue>> lst;
list<tuple<DAE.AvlKey,DAE.AvlValue>> lst, lstInvalid, lstValid;
Absyn.Path path;
String str;

case ft
equation
lst = avlTreeToList(ft);
then List.mapMap(lst, Util.tuple22, Util.getOption);
then
List.mapMap(lst, Util.tuple22, Util.getOption);
case ft
equation
lst = avlTreeToList(ft);
((path,_)) = List.selectFirst(lst, isInvalidFunctionEntry);
str = Absyn.pathString(path);
lstInvalid = List.select(lst, isInvalidFunctionEntry);
str = stringDelimitList(List.map(List.map(lstInvalid, Util.tuple21), Absyn.pathString), ", ");
Error.addMessage(Error.NON_INSTANTIATED_FUNCTION, {str});
then fail();
then
fail();
end matchcontinue;
end getFunctionList;

Expand All @@ -3463,6 +3466,13 @@ algorithm
end matchcontinue;
end isInvalidFunctionEntry;

protected function isValidFunctionEntry
input tuple<DAE.AvlKey,DAE.AvlValue> tpl;
output Boolean b;
algorithm
b := not isInvalidFunctionEntry(tpl);
end isValidFunctionEntry;

public function traverseDAE " This function traverses all dae exps.
NOTE, it also traverses DAE.VAR(componenname) as an expression."
input DAE.DAElist dae;
Expand Down Expand Up @@ -5637,4 +5647,77 @@ algorithm
end match;
end isBound;

public function isCompleteFunction
"@author: adrpo
this function returns true if the given function is complete:
- has inputs
- has outputs
- has an algorithm section
note that record constructors are always considered complete"
input DAE.Function f;
output Boolean isComplete;
algorithm
isComplete := matchcontinue(f)
local
list<DAE.FunctionDefinition> functions;

// record constructors are always complete!
case (DAE.RECORD_CONSTRUCTOR(path = _)) then true;

// functions are complete if they have inputs, outputs and algorithm section
case (DAE.FUNCTION(functions = functions))
equation
true = isCompleteFunctionBody(functions);
then
true;

case (_)
then false;
end matchcontinue;
end isCompleteFunction;

public function isCompleteFunctionBody
"@author: adrpo
this function returns true if the given function body is complete"
input list<DAE.FunctionDefinition> functions;
output Boolean isComplete;
algorithm
isComplete := matchcontinue(functions)
local
list<DAE.FunctionDefinition> rest;
list<DAE.Element> els;
list<DAE.Element> v, ie, ia, e, a, o;

case ({}) then false;

// external are complete!
case (DAE.FUNCTION_EXT(body = _)::rest) then true;

// functions are complete if they have inputs, outputs and algorithm section
case (DAE.FUNCTION_DEF(els)::rest)
equation
// algs are not empty
(v,ie,ia,e,a,o) = splitElements(els);
false = List.isEmpty(a);
then
true;

case (DAE.FUNCTION_DER_MAPPER(derivedFunction = _)::rest)
equation
true = isCompleteFunctionBody(rest);
then
true;

case (_)
then false;
end matchcontinue;
end isCompleteFunctionBody;

public function isNotCompleteFunction
input DAE.Function f;
output Boolean isNotComplete;
algorithm
isNotComplete := not isCompleteFunction(f);
end isNotCompleteFunction;

end DAEUtil;

0 comments on commit 3588440

Please sign in to comment.