Skip to content

Commit

Permalink
#2212 Fixed the remaining debug-flags (removed execFiles as it was un…
Browse files Browse the repository at this point in the history
…used)

Updated some unused compiler sources (usually not compiled by the boostrapping since they are unused)


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@16361 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Jun 14, 2013
1 parent 2009395 commit b842e91
Show file tree
Hide file tree
Showing 15 changed files with 298 additions and 391 deletions.
4 changes: 2 additions & 2 deletions Compiler/BackEnd/SimCodeUtil.mo
Original file line number Diff line number Diff line change
Expand Up @@ -1668,10 +1668,10 @@ algorithm
crefToSimVarHT);
(simCode, (_, _, lits)) = traverseExpsSimCode(simCode, findLiteralsHelper, literals);
simCode = setSimCodeLiterals(simCode, listReverse(lits));
Debug.fcall(Flags.EXEC_FILES, print, "*** SimCode -> collect all files started: " +& realString(clock()) +& "\n" );
// print("*** SimCode -> collect all files started: " +& realString(clock()) +& "\n");
// adrpo: collect all the files from Absyn.Info and DAE.ElementSource
// simCode = collectAllFiles(simCode);
Debug.fcall(Flags.EXEC_FILES, print, "*** SimCode -> collect all files done!: " +& realString(clock()) +& "\n" );
// print("*** SimCode -> collect all files done!: " +& realString(clock()) +& "\n");
then simCode;

else equation
Expand Down
13 changes: 6 additions & 7 deletions Compiler/BackEnd/XMLDump.mo
Original file line number Diff line number Diff line change
Expand Up @@ -755,22 +755,21 @@ algorithm
_:=
matchcontinue (crefIdxLstArr,Content,inInteger)
local String error_msg;
case (crefIdxLstArr,Content,inInteger)
case (_,_,_)
equation
listLength(crefIdxLstArr[inInteger]) >= 1 = true;
dumpCrefIdxLst(crefIdxLstArr[inInteger],Content);
then ();
case (crefIdxLstArr,Content,inInteger)
case (_,_,_)
equation
listLength(crefIdxLstArr[inInteger]) >= 1 = false;
then ();
case (_,_,inInteger)
case (_,_,_)
equation
error_msg = "in XMLDump.dumpCrefIdxLstArr - failed for var number:";
error_msg = error_msg +& intString(inInteger);
Error.addMessage(Error.INTERNAL_ERROR, {error_msg});
then
fail();
then fail();
end matchcontinue;
end dumpCrefIdxLstArr;

Expand All @@ -792,12 +791,12 @@ algorithm
local Integer len;
case ({},_)
then ();
case (crefIdxLst,Content)
case (_,_)
equation
len = listLength(crefIdxLst);
len >= 1 = false;
then ();
case (crefIdxLst,Content)
else
equation
len = listLength(crefIdxLst);
len >= 1 = true;
Expand Down
2 changes: 1 addition & 1 deletion Compiler/FrontEnd/ExpressionDump.mo
Original file line number Diff line number Diff line change
Expand Up @@ -1612,7 +1612,7 @@ algorithm str := matchcontinue(inExp)
s1 = "{" +& stringAppendList(List.map(expl,debugPrintComponentRefExp)) +& "}";
then
s1;
case(inExp) then printExpStr(inExp); // when not cref, print expression anyways since it is used for some debugging.
else printExpStr(inExp); // when not cref, print expression anyways since it is used for some debugging.
end matchcontinue;
end debugPrintComponentRefExp;

Expand Down
7 changes: 3 additions & 4 deletions Compiler/FrontEnd/Types.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2210,8 +2210,7 @@ algorithm
equation
res = unparseType(ty);
res = "#" /* this is a box */ +& res;
then
res;
then res;

// MetaModelica Option type
case (DAE.T_METAOPTION(optionType = DAE.T_UNKNOWN(_))) then "Option<Any>";
Expand Down Expand Up @@ -5468,6 +5467,7 @@ algorithm
case (DAE.T_ANYTYPE(anyClassType = _)) then true;
case (DAE.T_UNKNOWN(_)) then true;
case (DAE.T_METATYPE(ty = _)) then true;
case (DAE.T_NORETCALL(source = _)) then true;
case _ then false;
end matchcontinue;
end isBoxedType;
Expand All @@ -5483,8 +5483,7 @@ algorithm
case (DAE.T_TUPLE(tupleType = tys))
equation
tys = List.map(tys, boxIfUnboxedType);
then
DAE.T_METATUPLE(tys,DAE.emptyTypeSource); // TODO?! should now propagate the type source?
then DAE.T_METATUPLE(tys,DAE.emptyTypeSource); // TODO?! should now propagate the type source?

case _ then Util.if_(isBoxedType(ty), ty, DAE.T_METABOXED(ty,DAE.emptyTypeSource));

Expand Down
10 changes: 0 additions & 10 deletions Compiler/Main/Main.mo
Original file line number Diff line number Diff line change
Expand Up @@ -833,16 +833,6 @@ algorithm
end matchcontinue;
end simcodegen;

protected function runModparQ
"function: runModparQ
Returns true if parallelization should be run."
output Boolean res;
Integer n;
algorithm
n := Config.noProc();
res := (n > 0);
end runModparQ;

protected function interactivemode
"function: interactivemode
Initiate the interactive mode using socket communication."
Expand Down
1 change: 0 additions & 1 deletion Compiler/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ TplParser.mo \
Unparsing.mo

UTIL = \
AvlTree.mo \
BaseHashTable.mo \
BaseHashSet.mo \
Config.mo \
Expand Down
72 changes: 7 additions & 65 deletions Compiler/Script/CevalScript.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2888,27 +2888,6 @@ algorithm
end matchcontinue;
end cevalInteractiveFunctions2;

protected function visualizationVarShouldBeAdded
input String var;
input list<String> inIds;
algorithm
_ := matchcontinue (var,inIds)
local
String id;
list<String> ids;

case (var,id::ids)
equation
false = 0 == stringLength(id);
true = 0 == System.strncmp(var,id,stringLength(id));
then ();
case (var,_::ids)
equation
visualizationVarShouldBeAdded(var,ids);
then ();
end matchcontinue;
end visualizationVarShouldBeAdded;

protected function sconstToString
"@author: adrpo
Transform an DAE.SCONST into a string.
Expand Down Expand Up @@ -3878,23 +3857,6 @@ algorithm
end matchcontinue;
end compileModel;

protected function readEnvNoFail
"@author: adrpo
System.readEnv can fail, if it does this function returns the empty string"
input String variableName;
output String variableValue;
algorithm
variableValue := matchcontinue(variableName)
local String vValue;
case (variableName)
equation
vValue = System.readEnv(variableName);
then
vValue;
case (variableName) then "";
end matchcontinue;
end readEnvNoFail;

protected function winCitation "function: winCitation
author: PA
Returns a citation mark if platform is windows, otherwise empty string.
Expand All @@ -3906,8 +3868,7 @@ algorithm
case ()
equation
"WIN32" = System.platform();
then
"\"";
then "\"";
case () then "";
end matchcontinue;
end winCitation;
Expand Down Expand Up @@ -4010,7 +3971,7 @@ algorithm

case (_, "") then "";

case (inString, selector)
else
equation
s = inString +& selector;
then s;
Expand Down Expand Up @@ -4090,10 +4051,11 @@ public function subtractDummy
output Integer outVarSize;
algorithm
(outEqnSize,outVarSize) := matchcontinue(vars,eqnSize,varSize)
case(vars,eqnSize,varSize) equation
(_,_) = BackendVariable.getVar(ComponentReference.makeCrefIdent("$dummy",DAE.T_UNKNOWN_DEFAULT,{}),vars);
then (eqnSize-1,varSize-1);
case(vars,eqnSize,varSize) then (eqnSize,varSize);
case(_,_,_)
equation
(_,_) = BackendVariable.getVar(ComponentReference.makeCrefIdent("$dummy",DAE.T_UNKNOWN_DEFAULT,{}),vars);
then (eqnSize-1,varSize-1);
else (eqnSize,varSize);
end matchcontinue;
end subtractDummy;

Expand Down Expand Up @@ -4292,24 +4254,6 @@ algorithm
end matchcontinue;
end getAllClassPathsRecursive;

protected function filterLib
input Absyn.Path path;
output Boolean b;
Boolean b1, b2, b3;
algorithm
b1 := not Absyn.pathPrefixOf(Absyn.QUALIFIED("Modelica", Absyn.IDENT("Media")), path);
b2 := not Absyn.pathPrefixOf(Absyn.QUALIFIED("Modelica", Absyn.IDENT("Fluid")), path);
b3 := not Absyn.pathPrefixOf(
Absyn.QUALIFIED("Modelica",
Absyn.QUALIFIED("Mechanics",
Absyn.QUALIFIED("MultiBody",
Absyn.QUALIFIED("Examples",
Absyn.QUALIFIED("Loops",
Absyn.QUALIFIED("Utilities",
Absyn.IDENT("EngineV6_analytic"))))))), path);
b := b1 and b2; // and b3;
end filterLib;

public function checkAllModelsRecursive
"@author adrpo
checks all models and returns number of variables and equations"
Expand Down Expand Up @@ -4338,8 +4282,6 @@ algorithm
case (cache,env,_,b,(st as Interactive.SYMBOLTABLE(ast = p)),msg)
equation
allClassPaths = getAllClassPathsRecursive(className, b, p);
// allClassPaths = List.select(allClassPaths, filterLib);
// allClassPaths = listReverse(allClassPaths);
print("Number of classes to check: " +& intString(listLength(allClassPaths)) +& "\n");
// print ("All paths: \n" +& stringDelimitList(List.map(allClassPaths, Absyn.pathString), "\n") +& "\n");
checkAll(cache, env, allClassPaths, st, msg);
Expand Down
28 changes: 15 additions & 13 deletions Compiler/Script/Interactive.mo
Original file line number Diff line number Diff line change
Expand Up @@ -3517,16 +3517,16 @@ protected function renameComponentInIterators
output Absyn.ForIterators iteratorsRenamed;
algorithm
iteratorsRenamed := matchcontinue(iterators, oldComp, newComp)
local
Absyn.ForIterators rest, restNew;
Absyn.Exp exp, expNew; String i;
local
Absyn.ForIterators rest, restNew;
Absyn.Exp exp, expNew; String i;
case ({}, _, _) then {};
case (Absyn.ITERATOR(i, NONE(), SOME(exp))::rest, oldComp, newComp)
case (Absyn.ITERATOR(i, NONE(), SOME(exp))::rest, _, _)
equation
expNew = renameComponentInExp(exp, oldComp, newComp);
restNew = renameComponentInIterators(rest, oldComp, newComp);
then Absyn.ITERATOR(i, NONE(), SOME(expNew))::restNew;
case (Absyn.ITERATOR(i, NONE(), NONE())::rest, oldComp, newComp)
case (Absyn.ITERATOR(i, NONE(), NONE())::rest, _, _)
equation
restNew = renameComponentInIterators(rest, oldComp, newComp);
then Absyn.ITERATOR(i, NONE(), NONE())::restNew;
Expand Down Expand Up @@ -15080,14 +15080,16 @@ public function getDefineunitsInElements "retrives defineunit definitions in ele
output list<Absyn.Element> outElts;
algorithm
outElts := matchcontinue(elts)
local Absyn.Element e;
case({}) then {};
case(Absyn.ELEMENTITEM(e as Absyn.DEFINEUNIT(name=_))::elts) equation
outElts = getDefineunitsInElements(elts);
then e::outElts;
case(_::elts) equation
outElts = getDefineunitsInElements(elts);
then outElts;
local
Absyn.Element e;
list<Absyn.ElementItem> rest;
case {} then {};
case (Absyn.ELEMENTITEM(e as Absyn.DEFINEUNIT(name=_))::rest)
equation
outElts = getDefineunitsInElements(rest);
then e::outElts;
case (_::rest)
then getDefineunitsInElements(rest);
end matchcontinue;
end getDefineunitsInElements;

Expand Down
6 changes: 3 additions & 3 deletions Compiler/Util/AvlTree.mo → Compiler/Unused/AvlTree.mo
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ partial function FuncTypeValToStr
end FuncTypeValToStr;

partial function FuncTypeItemUpdateCheck "function to print an error on duplicate items"
input Item<Key,Val> inItemNew "the new item";
input Item<Key,Val> inItemOld "the old item in the tree";
output Boolean updateAllowed "returns true, the update is performed, false no update, fail, the update will fail";
input Item<tuple<Key,Val>> inItemNew "the new item";
input Item<tuple<Key,Val>> inItemOld "the old item in the tree";
output Boolean updateAllowed "returns true, the update is performed, false no update, fail, the update will fail";
end FuncTypeItemUpdateCheck;

partial function FuncTypeKeyCompare "function to compare keys"
Expand Down
7 changes: 3 additions & 4 deletions Compiler/Util/Debug.mo
Original file line number Diff line number Diff line change
Expand Up @@ -336,13 +336,12 @@ public function fcallret3
replaceable type Type_d subtypeof Any;
algorithm
res := matchcontinue (inFlag,func,arg1,arg2,arg3,default)
case (_,func,arg1,arg2,arg3,_)
case (_,_,_,_,_,_)
equation
true = Flags.isSet(inFlag);
res = func(arg1,arg2,arg3);
then
res;
case (_,_,_,_,_,default) then default;
then res;
else default;
end matchcontinue;
end fcallret3;

Expand Down

0 comments on commit b842e91

Please sign in to comment.