Skip to content

Commit

Permalink
- ClassInf.mo: handle all cases in ClassInf.getStateName
Browse files Browse the repository at this point in the history
- Exp.mo: minor edit
- CevalScript.mo library filtering for checkAllModelsRecursive (disabled for now)
  we should make possible to specify a filter in this API.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@6087 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Sep 10, 2010
1 parent 28a1be4 commit 25f2865
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
13 changes: 12 additions & 1 deletion Compiler/CevalScript.mo
Expand Up @@ -3917,6 +3917,16 @@ algorithm
end matchcontinue;
end getAllClassPathsRecursive;

protected function filterLib
input Absyn.Path path;
output Boolean b;
Boolean b1, b2;
algorithm
b1 := not Absyn.pathPrefixOf(Absyn.QUALIFIED("Modelica", Absyn.IDENT("Media")), path);
b2 := not Absyn.pathPrefixOf(Absyn.QUALIFIED("Modelica", Absyn.IDENT("Fluid")), path);
b := b1 and b2;
end filterLib;

public function checkAllModelsRecursive
"@author adrpo
checks all models and returns number of variables and equations"
Expand Down Expand Up @@ -3947,6 +3957,7 @@ algorithm
case (cache,env,className,(st as Interactive.SYMBOLTABLE(ast = p,explodedAst = sp,instClsLst = ic,lstVarVal = iv,compiledFunctions = cf)),msg)
equation
allClassPaths = getAllClassPathsRecursive(className, p);
// allClassPaths = Util.listSelect(allClassPaths, filterLib);
// allClassPaths = listReverse(allClassPaths);
print("Number of classes to check: " +& intString(listLength(allClassPaths)) +& "\n");
// print ("All paths: \n" +& Util.stringDelimitList(Util.listMap(allClassPaths, Absyn.pathString), "\n") +& "\n");
Expand Down Expand Up @@ -4034,7 +4045,7 @@ algorithm
case (cache,env,className::rest,(st as Interactive.SYMBOLTABLE(ast = p,explodedAst = sp,instClsLst = ic,lstVarVal = iv,compiledFunctions = cf)),msg)
equation
c = Interactive.getPathedClassInProgram(className, p);
print("Skipping: " +& Dump.unparseClassAttributesStr(c) +& " " +& Absyn.pathString(className) +& "... \n");
print("Checking skipped: " +& Dump.unparseClassAttributesStr(c) +& " " +& Absyn.pathString(className) +& "... \n");
checkAll(cache, env, rest, st, msg);
then
();
Expand Down
15 changes: 11 additions & 4 deletions Compiler/ClassInf.mo
Expand Up @@ -321,20 +321,27 @@ algorithm
case TYPE(path = p) then p;
case PACKAGE(path = p) then p;
case FUNCTION(path = p) then p;
case ENUMERATION(path = p) then p;

case HAS_EQUATIONS(path = p) then p;
case IS_NEW(path = p) then p;

case TYPE_INTEGER(path = p) then p;
case TYPE_REAL(path = p) then p;
case TYPE_STRING(path = p) then p;
case TYPE_BOOL(path = p) then p;
case IS_NEW(path = p) then p;
case HAS_EQUATIONS(path = p) then p;
case TYPE_ENUM(path = p) then p;
case EXTERNAL_OBJ(p) then p;

case META_TUPLE(p) then p;
case META_LIST(p) then p;
case META_OPTION(p) then p;
case META_RECORD(p) then p;
case META_POLYMORPHIC(p) then p;
case META_ARRAY(p) then p;
case UNIONTYPE(p) then p;
case META_ARRAY(p) then p;
case META_POLYMORPHIC(p) then p;

case _ then Absyn.IDENT("#getStateName failed#");
end matchcontinue;
end getStateName;
Expand Down
4 changes: 2 additions & 2 deletions Compiler/Exp.mo
Expand Up @@ -882,7 +882,7 @@ algorithm
true;
case (DAE.CAST(ty = t,exp = e))
equation
res = isOne(e) "Casting to zero is still zero" ;
res = isOne(e) "Casting to one is still one" ;
then
res;
case (_) then false;
Expand Down Expand Up @@ -5570,7 +5570,7 @@ algorithm
// constant real 1.0
case DAE.RCONST(rval)
equation
true = realEq(rval, 1.0);
true = realEq(rval, 1.0);
then
true;

Expand Down

0 comments on commit 25f2865

Please sign in to comment.