Skip to content

Commit

Permalink
Fixes for bugs: #1430, #1432
Browse files Browse the repository at this point in the history
- moved printing functions from SCode to SCodeDump.
- some fixes to redeclares-as-element in SCodeFlattenRedeclare.mo
- fixes for handling derived classes (that do not extend from basic types)
  to have the correct scope, not the scope of the base class (Inst.mo).
- added SCodeDump.mo
- added SCodeFlat.mo (not part of the compilation yet).
- added more tests for replaceable functions and for functions in derived packages that depend on a modified constant.
- added SCodeMod.mo to handle modifiers.
- some changes in SCodeHashTable.mo
- disabled SCodeFlattenExtends.mo for now.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@9080 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed May 24, 2011
1 parent 52d049d commit 80f65f7
Show file tree
Hide file tree
Showing 29 changed files with 1,667 additions and 1,557 deletions.
3 changes: 2 additions & 1 deletion Compiler/FrontEnd/Algorithm.mo
Expand Up @@ -68,6 +68,7 @@ protected import ExpressionDump;
protected import RTOpts;
protected import Types;
protected import Util;
protected import SCodeDump;

public function algorithmEmpty "Returns true if algorithm is empty, i.e. no statements"
input Algorithm alg;
Expand Down Expand Up @@ -388,7 +389,7 @@ algorithm
rhs_str = ExpressionDump.printExpStr(rhs);
str1 = Util.stringDelimitList(Util.listMap(lprop, Types.printPropStr), ", ");
str2 = Types.printPropStr(rprop);
strInitial = SCode.printInitialStr(initial_);
strInitial = SCodeDump.printInitialStr(initial_);
Debug.traceln("- Algorithm.makeTupleAssignment failed on: \n\t" +&
lhs_str +& " = " +& rhs_str +&
"\n\tprops lhs: (" +& str1 +& ") = props rhs: " +& str2 +&
Expand Down
4 changes: 2 additions & 2 deletions Compiler/FrontEnd/Ceval.mo
Expand Up @@ -5261,8 +5261,8 @@ algorithm
"\n env: " +& Env.printEnvPathStr(env) +&
"\n subs: " +& Util.stringDelimitList(Util.listMap(subs, ExpressionDump.printSubscriptStr), ", ") +&
"\n value: " +& ValuesUtil.printValStr(inValue) +&
"\n dim sizes: " +& Util.stringDelimitList(Util.listMap(dims, intString), ", ") +&
"\n env: " +& Env.printEnvStr(env)
"\n dim sizes: " +& Util.stringDelimitList(Util.listMap(dims, intString), ", ") /*+&
"\n env: " +& Env.printEnvStr(env)*/
);
then
fail();
Expand Down
3 changes: 2 additions & 1 deletion Compiler/FrontEnd/ClassInf.mo
Expand Up @@ -179,6 +179,7 @@ protected import Print;
protected import Error;
protected import RTOpts;
protected import Util;
protected import SCodeDump;

public function printStateStr "- Printing

Expand Down Expand Up @@ -606,7 +607,7 @@ algorithm
equation
str1 = Absyn.pathString(getStateName(st));
str2 = printStateStr(st);
str3 = SCode.restrString(re);
str3 = SCodeDump.restrString(re);
Error.addSourceMessage(Error.RESTRICTION_VIOLATION, {str1,str2,str3}, info);
then
fail();
Expand Down
3 changes: 2 additions & 1 deletion Compiler/FrontEnd/DAEDump.mo
Expand Up @@ -59,6 +59,7 @@ protected import Types;
protected import ClassInf;
protected import Algorithm;
protected import RTOpts;
protected import SCodeDump;

public function printDAE "function: printDAE
This function prints out a list of elements (i.e. a DAE)
Expand Down Expand Up @@ -930,7 +931,7 @@ algorithm
String s;
case SCode.ANNOTATION(modification = ann_mod)
equation
s = " annotation" +& SCode.printModStr(ann_mod);
s = " annotation" +& SCodeDump.printModStr(ann_mod);
then
s;
end match;
Expand Down
39 changes: 19 additions & 20 deletions Compiler/FrontEnd/Env.mo
Expand Up @@ -189,6 +189,7 @@ protected import Util;
protected import Types;
protected import OptManager;
protected import RTOpts;
protected import SCodeDump;

public constant Env emptyEnv={} "- Values" ;

Expand Down Expand Up @@ -1035,7 +1036,7 @@ algorithm
s1 = printAvlTreeStr(ht);
s2 = printAvlTreeStr(httypes);
s3 = printImportsStr(imps);
encflag_str = SCode.encapsulatedStr(encflag);
encflag_str = SCodeDump.encapsulatedStr(encflag);
res = stringAppendList(
"FRAME: " :: sid :: " (enc=" :: encflag_str ::
") \nclasses and vars:\n=============\n" :: s1 :: " Types:\n======\n" :: s2 :: " Imports:\n=======\n" :: s3 :: {});
Expand All @@ -1045,9 +1046,7 @@ algorithm
end printFrameStr;

protected function printFrameVarsStr "function: printFrameVarsStr

Print only the variables in a Frame to a string.
"
Print only the variables in a Frame to a string."
input Frame inFrame;
output String outString;
algorithm
Expand All @@ -1064,7 +1063,7 @@ algorithm
case FRAME(optName = SOME(sid),clsAndVars = ht,types = httypes,imports = imps,connectionSet = crs,encapsulatedPrefix = encflag)
equation
s1 = printAvlTreeStr(ht);
encflag_str = SCode.encapsulatedStr(encflag);
encflag_str = SCodeDump.encapsulatedStr(encflag);
res = stringAppendList(
{"FRAME: ",sid," (enc=",encflag_str,
") \nclasses and vars:\n=============\n",s1,"\n\n\n"});
Expand All @@ -1074,7 +1073,7 @@ algorithm
case FRAME(optName = NONE(),clsAndVars = ht,types = httypes,imports = imps,connectionSet = crs,encapsulatedPrefix = encflag)
equation
s1 = printAvlTreeStr(ht);
encflag_str = SCode.encapsulatedStr(encflag);
encflag_str = SCodeDump.encapsulatedStr(encflag);
res = stringAppendList(
{"FRAME: unnamed (enc=",encflag_str,
") \nclasses and vars:\n=============\n",s1,"\n\n\n"});
Expand Down Expand Up @@ -1140,8 +1139,8 @@ algorithm

case ((n,VAR(instantiated = (tv as DAE.TYPES_VAR(attributes = DAE.ATTR(variability = var),ty = tp,binding = bind)),declaration = SOME((elt,_)),instStatus = i,env = (compframe :: _))))
equation
s = SCode.variabilityString(var);
elt_str = SCode.printElementStr(elt);
s = SCodeDump.variabilityString(var);
elt_str = SCodeDump.printElementStr(elt);
tp_str = Types.unparseType(tp);
var_str = Types.unparseVar(tv);
frame_str = printFrameVarsStr(compframe);
Expand All @@ -1154,8 +1153,8 @@ algorithm

case ((n,VAR(instantiated = (tv as DAE.TYPES_VAR(attributes = DAE.ATTR(variability = var),ty = tp)),declaration = SOME((elt,_)),instStatus = i,env = {})))
equation
s = SCode.variabilityString(var);
elt_str = SCode.printElementStr(elt);
s = SCodeDump.variabilityString(var);
elt_str = SCodeDump.printElementStr(elt);
tp_str = Types.unparseType(tp);
var_str = Types.unparseVar(tv);
res = stringAppendList(
Expand Down Expand Up @@ -1636,21 +1635,21 @@ algorithm
equation
str = "var: " +& name +& " " +& Types.unparseType(tp) +& "("
+& Types.printTypeStr(tp) +& ")" +& " attr: " +&
SCode.flowStr(flowPrefix) +& ", " +&
SCode.streamStr(streamPrefix) +& ", " +&
SCode.accessibilityString(accessibility) +& ", " +&
SCode.variabilityString(variability) +& ", " +&
SCode.innerouterString(innerOuter);
SCodeDump.flowStr(flowPrefix) +& ", " +&
SCodeDump.streamStr(streamPrefix) +& ", " +&
SCodeDump.accessibilityString(accessibility) +& ", " +&
SCodeDump.variabilityString(variability) +& ", " +&
SCodeDump.innerouterString(innerOuter);
then str;

case(VAR(declaration = SOME((SCode.COMPONENT(name=name,typeSpec=tsp,prefixes=SCode.PREFIXES(innerOuter=innerOuter),attributes=SCode.ATTR(_, flowPrefix, streamPrefix, accessibility, variability, direction)), _))))
equation
str = "var: " +& name +& " " +& Dump.unparseTypeSpec(tsp) +& " attr: " +&
SCode.flowStr(flowPrefix) +& ", " +&
SCode.streamStr(streamPrefix) +& ", " +&
SCode.accessibilityString(accessibility) +& ", " +&
SCode.variabilityString(variability) +& ", " +&
SCode.innerouterString(innerOuter);
SCodeDump.flowStr(flowPrefix) +& ", " +&
SCodeDump.streamStr(streamPrefix) +& ", " +&
SCodeDump.accessibilityString(accessibility) +& ", " +&
SCodeDump.variabilityString(variability) +& ", " +&
SCodeDump.innerouterString(innerOuter);
then str;

case(CLASS(cl=SCode.CLASS(name=name)))
Expand Down
1 change: 0 additions & 1 deletion Compiler/FrontEnd/Inline.mo
Expand Up @@ -45,7 +45,6 @@ encapsulated package Inline
public import Absyn;
public import BackendDAE;
public import DAE;
public import Error;
public import SCode;
public import Util;
public import Values;
Expand Down

0 comments on commit 80f65f7

Please sign in to comment.