Skip to content

Commit

Permalink
- Refactoring/Removed RML weird stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund committed Nov 10, 2010
1 parent 2755d89 commit 3701562
Show file tree
Hide file tree
Showing 15 changed files with 85 additions and 96 deletions.
2 changes: 1 addition & 1 deletion Compiler/Absyn.mo
Expand Up @@ -3921,7 +3921,7 @@ Helper function for mergeElementAttributes
input Variability v2;
output Variability v3;
algorithm v3 := matchcontinue(v1,v2)
case(v1,VAR) then v1;
case(v1,VAR()) then v1;
case(v1,_) then v1;
end matchcontinue;
end propagateAbsynVariability;
Expand Down
2 changes: 1 addition & 1 deletion Compiler/BackendDAECreate.mo
Expand Up @@ -1441,7 +1441,7 @@ algorithm
expl1 = BackendDAEUtil.statesAndVarsExp(e1, vars);
expl2 = BackendDAEUtil.statesAndVarsExp(e2, vars);
expl = listAppend(expl1, expl2);
numnodes = Util.listReduce(ds, int_mul);
numnodes = Util.listReduce(ds, intMul);
lst = lowerMultidimeqn2(expl, numnodes, aindx, source);
then
lst;
Expand Down
12 changes: 6 additions & 6 deletions Compiler/Ceval.mo
Expand Up @@ -513,7 +513,7 @@ algorithm
equation
(cache,lhvVal,stOpt) = ceval(cache,env, lh, impl, stOpt, dimOpt, msg);
(cache,rhvVal,stOpt) = ceval(cache,env, rh, impl, stOpt, dimOpt, msg);
resVal = ValuesUtil.safeIntRealOp(lhvVal, rhvVal, Values.POWOP);
resVal = ValuesUtil.safeIntRealOp(lhvVal, rhvVal, Values.POWOP());
then
(cache,resVal,stOpt);

Expand All @@ -522,7 +522,7 @@ algorithm
equation
(cache,lhvVal,stOpt) = ceval(cache,env, lh, impl, stOpt, dimOpt, msg);
(cache,rhvVal,stOpt) = ceval(cache,env, rh, impl, stOpt, dimOpt, msg);
resVal = ValuesUtil.safeIntRealOp(lhvVal, rhvVal, Values.MULOP);
resVal = ValuesUtil.safeIntRealOp(lhvVal, rhvVal, Values.MULOP());
then
(cache,resVal,stOpt);

Expand All @@ -531,7 +531,7 @@ algorithm
equation
(cache,lhvVal,stOpt) = ceval(cache,env, lh, impl, stOpt, dimOpt, msg);
(cache,rhvVal,stOpt) = ceval(cache,env, rh, impl, stOpt, dimOpt, msg);
resVal = ValuesUtil.safeIntRealOp(lhvVal, rhvVal, Values.DIVOP);
resVal = ValuesUtil.safeIntRealOp(lhvVal, rhvVal, Values.DIVOP());
then
(cache,resVal,stOpt);

Expand All @@ -551,7 +551,7 @@ algorithm
equation
(cache,lhvVal,stOpt) = ceval(cache,env, lh, impl, stOpt, dimOpt, msg);
(cache,rhvVal,stOpt) = ceval(cache,env, rh, impl, stOpt, dimOpt, msg);
resVal = ValuesUtil.safeIntRealOp(lhvVal, rhvVal, Values.ADDOP);
resVal = ValuesUtil.safeIntRealOp(lhvVal, rhvVal, Values.ADDOP());
then
(cache,resVal,stOpt);

Expand All @@ -560,7 +560,7 @@ algorithm
equation
(cache,lhvVal,stOpt) = ceval(cache,env, lh, impl, stOpt, dimOpt, msg);
(cache,rhvVal,stOpt) = ceval(cache,env, rh, impl, stOpt, dimOpt, msg);
resVal = ValuesUtil.safeIntRealOp(lhvVal, rhvVal, Values.SUBOP);
resVal = ValuesUtil.safeIntRealOp(lhvVal, rhvVal, Values.SUBOP());
then
(cache,resVal,stOpt);

Expand Down Expand Up @@ -707,7 +707,7 @@ algorithm
(cache,Values.REAL(r),stOpt);

// cast real to integer
case (cache,env,DAE.CAST(ty = DAE.ET_INT, exp = e),impl,stOpt,dimOpt,msg)
case (cache,env,DAE.CAST(ty = DAE.ET_INT(), exp = e),impl,stOpt,dimOpt,msg)
equation
(cache,Values.REAL(r),stOpt) = ceval(cache, env, e, impl, stOpt, dimOpt, msg);
i = realInt(r);
Expand Down
20 changes: 10 additions & 10 deletions Compiler/CevalScript.mo
Expand Up @@ -223,9 +223,9 @@ algorithm
BackendDAE.BackendDAE daelow;
BackendDAE.Variables vars;
BackendDAE.EquationArray eqnarr;
BackendDAE.MultiDimEquation[:] ae;
array<BackendDAE.MultiDimEquation> ae;
list<DAE.Exp> expVars,options;
list<Integer>[:] m,mt;
array<list<Integer>> m,mt;
Option<list<tuple<Integer, Integer, BackendDAE.Equation>>> jac;
Values.Value ret_val,simValue,size_value,value,v;
DAE.Exp filenameprefix,exp,starttime,stoptime,tolerance,interval,method,size_expression,
Expand Down Expand Up @@ -2152,8 +2152,8 @@ algorithm
list<DAE.Element> dael;
list<Interactive.InstantiatedClass> ic_1,ic;
BackendDAE.BackendDAE dlow,dlow_1,indexed_dlow,indexed_dlow_1;
list<Integer>[:] m,mT;
Integer[:] ass1,ass2;
array<list<Integer>> m,mT;
array<Integer> ass1,ass2;
list<list<Integer>> comps;
Absyn.ComponentRef a_cref;
list<String> libs;
Expand Down Expand Up @@ -2295,8 +2295,8 @@ algorithm
list<DAE.Element> dael;
list<Interactive.InstantiatedClass> ic_1,ic;
BackendDAE.BackendDAE dlow,dlow_1,indexed_dlow,indexed_dlow_1;
list<Integer>[:] m,mT;
Integer[:] ass1,ass2;
array<list<Integer>> m,mT;
array<Integer> ass1,ass2;
list<list<Integer>> comps;
Absyn.ComponentRef a_cref;
list<String> libs;
Expand Down Expand Up @@ -3256,8 +3256,8 @@ algorithm
list<DAE.Element> dael;
list<Interactive.InstantiatedClass> ic_1,ic;
BackendDAE.BackendDAE dlow,dlow_1,indexed_dlow,indexed_dlow_1;
list<Integer>[:] m,mT;
Integer[:] ass1,ass2;
array<list<Integer>> m,mT;
array<Integer> ass1,ass2;
list<list<Integer>> comps;
Absyn.ComponentRef a_cref;
list<String> libs;
Expand Down Expand Up @@ -3694,9 +3694,9 @@ algorithm
Values.Value ret_val;
list<DAE.Function> funcelems;
Boolean x;
Integer[:] ass1,ass2;
array<Integer> ass1,ass2;
DAE.DAElist dae_1,dae;
list<Integer>[:] m,mT;
array<list<Integer>> m,mT;
list<DAE.Element> dael;
list<SCode.Class> p_1,sp;
list<list<Integer>> comps;
Expand Down
11 changes: 5 additions & 6 deletions Compiler/ConnectUtil.mo
Expand Up @@ -71,7 +71,6 @@ protected import Types;
protected import Util;

public
type Env = Env.Env;
type AvlTree = Env.AvlTree;
type Cache = Env.Cache;

Expand Down Expand Up @@ -576,8 +575,8 @@ public function addArrayFlow "function: addArrayFlow
algorithm
outSets := matchcontinue (ss,r1,d1,r2,d2,dsize,source)
local
Connect.Sets s,ss_1,ss_2,ss;
DAE.ComponentRef r1_1,r2_1,r1,r2;
Connect.Sets s,ss_1,ss_2;
DAE.ComponentRef r1_1,r2_1;
Integer i_1,i;
Connect.Set s1,s2;

Expand Down Expand Up @@ -736,8 +735,8 @@ public function addArrayStream "function: addArrayStream
algorithm
outSets := matchcontinue (ss,r1,d1,r2,d2,dsize,source)
local
Connect.Sets s,ss_1,ss_2,ss;
DAE.ComponentRef r1_1,r2_1,r1,r2;
Connect.Sets s,ss_1,ss_2;
DAE.ComponentRef r1_1,r2_1;
Integer i_1,i;
Connect.Set s1,s2;

Expand Down Expand Up @@ -2223,7 +2222,7 @@ public function componentFace
All other connector elements that are hierarchically inside M, but not in one of the outside connectors
of M, is called an inside connector with respect to M. This is done **BEFORE** resolving outer elements
to corresponding inner ones."
input Env env;
input Env.Env env;
input InnerOuter.InstHierarchy inIH;
input DAE.ComponentRef inComponentRef;
output Connect.Face outFace;
Expand Down
10 changes: 5 additions & 5 deletions Compiler/DFA.mo
Expand Up @@ -52,7 +52,7 @@ public import RTOpts;

type Stamp = Integer;
type ArcName = Absyn.Ident;
type SimpleStateArray = SimpleState[:];
type SimpleStateArray = array<SimpleState>;

// protected imports
protected import Dump;
Expand Down Expand Up @@ -1072,12 +1072,12 @@ uniontype RightHandSide "Datastructure for the righthand sides in a matchcontinu
end RIGHTHANDLIGHT;
end RightHandSide;

type RenamedPatVec = RenamedPat[:];
type RenamedPatVec = array<RenamedPat>;
type RenamedPatList = list<RenamedPat>;
type RenamedPatMatrix = RenamedPatList[:];
type RenamedPatMatrix = array<RenamedPatList>;
type RenamedPatMatrix2 = list<RenamedPatList>;
type IndexVector = list<Integer>;
type RightHandVector = RightHandSide[:];
type RightHandVector = array<RightHandSide>;
type RightHandList = list<RightHandSide>;

// Functions for the handling of matrices
Expand Down Expand Up @@ -1107,7 +1107,7 @@ algorithm
Integer first;
IndexVector rest;
RenamedPatList localPatList;
RenamedPat[:] temp;
array<RenamedPat> temp;
RenamedPat temp2;

case (_,{},localAccPatList) then localAccPatList;
Expand Down
12 changes: 5 additions & 7 deletions Compiler/Inst.mo
Expand Up @@ -2937,7 +2937,7 @@ algorithm
case({}) equation
then 0;
case(SCode.COMPONENT(attributes = SCode.ATTR(
direction = Absyn.OUTPUT,
direction = Absyn.OUTPUT(),
arrayDims = {Absyn.SUBSCRIPT(Absyn.INTEGER(dim))}
)) :: _) equation
then dim;
Expand Down Expand Up @@ -2970,7 +2970,7 @@ algorithm

case(env, {})
then NONE();
case(env, SCode.CLASSDEF(classDef = classDef as SCode.CLASS(name = "equalityConstraint", restriction = SCode.R_FUNCTION,
case(env, SCode.CLASSDEF(classDef = classDef as SCode.CLASS(name = "equalityConstraint", restriction = SCode.R_FUNCTION(),
classDef = SCode.PARTS(elementLst = els))) :: _)
equation
SOME(path) = Env.getEnvPath(env);
Expand Down Expand Up @@ -3640,7 +3640,7 @@ algorithm
Lookup.lookupClass(cache,env, cn, true);


env3 = Env.openScope(cenv, enc2, SOME(cn2), SOME(Env.CLASS_SCOPE));
env3 = Env.openScope(cenv, enc2, SOME(cn2), SOME(Env.CLASS_SCOPE()));
ci_state2 = ClassInf.start(r, Env.getEnvName(env3));
(cache,cenv_2,_,_,_,_,_,_,_,_,_,_) =
instClassIn(
Expand Down Expand Up @@ -4267,7 +4267,6 @@ algorithm
local
Env.Cache cache;
Env.Env env1;
DAE.Function fn;
DAE.Type funcTp;
String s;
InstanceHierarchy ih;
Expand Down Expand Up @@ -4361,7 +4360,6 @@ input list<SCode.Element> els;
output SCode.Class cl;
algorithm
cl:= matchcontinue(els)
local SCode.Class cl;
case SCode.CLASSDEF(classDef = cl as SCode.CLASS(name="destructor"))::_ then cl;
case _::els then getExternalObjectDestructor(els);
end matchcontinue;
Expand Down Expand Up @@ -15138,9 +15136,9 @@ algorithm
DAE.ComponentRef cr;
DAE.ElementSource src;
Connect.Sets cs;
case (DAE.VAR(componentRef = cr, flowPrefix = DAE.FLOW, source = src), cs)
case (DAE.VAR(componentRef = cr, flowPrefix = DAE.FLOW(), source = src), cs)
equation
cs = ConnectUtil.addFlowVariable(cs, cr, Connect.INSIDE, src);
cs = ConnectUtil.addFlowVariable(cs, cr, Connect.INSIDE(), src);
then
cs;
case (_, _) then inConnectionSet;
Expand Down
20 changes: 8 additions & 12 deletions Compiler/InstSection.mo
Expand Up @@ -177,7 +177,6 @@ algorithm
Prefix.Prefix pre;
SCode.EEquation eq;
Boolean impl;
Env.Cache cache;
ConnectionGraph.ConnectionGraph graph;
InstanceHierarchy ih;

Expand Down Expand Up @@ -590,7 +589,7 @@ algorithm
case (cache,env,ih,mod,pre,csets,ci_state,SCode.EQ_IF(condition = conditions,thenBranch = tb,elseBranch = fb,info = info),SCode.NON_INITIAL(),impl,graph)
equation
(cache, expl1,props,_) = Static.elabExpList(cache,env, conditions, impl,NONE(),true,pre,info);
(DAE.PROP((DAE.T_BOOL(_),_),DAE.C_VAR)) = Types.propsAnd(props);
(DAE.PROP((DAE.T_BOOL(_),_),DAE.C_VAR())) = Types.propsAnd(props);
(cache,expl1) = PrefixUtil.prefixExpList(cache, env, ih, expl1, pre);

// set the source of this element
Expand Down Expand Up @@ -1008,7 +1007,7 @@ algorithm
Boolean b1,b2,b3,b4;
DAE.DAElist fdae1,fdae2,dae;
DAE.Exp elabedE1_2, elabedE2_2;
DAE.Properties prop1, prop2;
DAE.Properties prop1;
Prefix.Prefix pre;
case(cache,env,e1,e2,elabedE1,elabedE2,prop,prop2,impl,pre,info) equation
b3 = Types.isPropTupleArray(prop);
Expand Down Expand Up @@ -1055,7 +1054,7 @@ algorithm
fillValue = (listLength(typeList)-listLength(aexpl));
lst2 = Util.listFill((DAE.T_ANYTYPE(NONE()),NONE()),fillValue) "types";
aexpl2 = Util.listFill(Absyn.CREF(Absyn.WILD()),fillValue) "epxressions";
tupleConst2 = Util.listFill(DAE.SINGLE_CONST(DAE.C_VAR),fillValue) "TupleConst's";
tupleConst2 = Util.listFill(DAE.SINGLE_CONST(DAE.C_VAR()),fillValue) "TupleConst's";
aexpl = listAppend(aexpl,aexpl2);
lst = listAppend(lst,lst2);
tupleConst = listAppend(tupleConst,tupleConst2);
Expand All @@ -1066,7 +1065,7 @@ algorithm
fillValue = (listLength(typeList)-1);
aexpl2 = Util.listFill(Absyn.CREF(Absyn.WILD()),fillValue) "epxressions";
lst2 = Util.listFill((DAE.T_ANYTYPE(NONE()),NONE()),fillValue) "types";
tupleConst2 = Util.listFill(DAE.SINGLE_CONST(DAE.C_VAR),fillValue) "TupleConst's";
tupleConst2 = Util.listFill(DAE.SINGLE_CONST(DAE.C_VAR()),fillValue) "TupleConst's";
aexpl = inExp::aexpl2;
lst = propType::lst2;
tupleConst = DAE.SINGLE_CONST(tconst)::tupleConst2;
Expand Down Expand Up @@ -2834,8 +2833,8 @@ algorithm
equation
_ :: wild_props = Types.propTuplePropList(inRhsProps);
wild_count = listLength(wild_props);
wilds = Util.listFill(DAE.CREF(DAE.WILD, DAE.ET_OTHER), wild_count);
wild_props = Util.listFill(DAE.PROP((DAE.T_ANYTYPE(NONE()),NONE()), DAE.C_VAR), wild_count);
wilds = Util.listFill(DAE.CREF(DAE.WILD(), DAE.ET_OTHER()), wild_count);
wild_props = Util.listFill(DAE.PROP((DAE.T_ANYTYPE(NONE()),NONE()), DAE.C_VAR()), wild_count);
then Algorithm.makeTupleAssignment(inLhs :: wilds, inLhsProps :: wild_props, inRhs, inRhsProps, inInitial, inSource);
// Otherwise, call Algorithm.makeAssignment as usual.
case (_, _, _, _, _, _, _)
Expand Down Expand Up @@ -3037,7 +3036,7 @@ algorithm
source = DAEUtil.createElementSource(info,NONE(),NONE(),NONE(),NONE());
stmt = DAE.STMT_ASSIGN(
DAE.ET_OTHER(),
DAE.CREF(DAE.WILD,DAE.ET_OTHER()),
DAE.CREF(DAE.WILD(),DAE.ET_OTHER()),
e_2,source);
then
(localCache,stmt);
Expand Down Expand Up @@ -4272,7 +4271,6 @@ algorithm
Boolean flowPrefix, streamPrefix;
String c1_str,t1_str,t2_str,c2_str;
Env.Cache cache;
Absyn.InnerOuter io1,io2;
Boolean c1outer,c2outer;
ConnectionGraph.ConnectionGraph graph;
InstanceHierarchy ih;
Expand Down Expand Up @@ -4650,13 +4648,12 @@ algorithm
Connect.Face f1,f2;
tuple<DAE.TType, Option<Absyn.Path>> t1,t2,bc_tp1,bc_tp2;
SCode.Variability vr;
Integer dim1,dim2;
Integer dim2;
DAE.DAElist dae,dae1,dae2;
list<DAE.Var> l1,l2;
Boolean flowPrefix,streamPrefix;
String c1_str,t1_str,t2_str,c2_str;
Env.Cache cache;
Absyn.InnerOuter io1,io2;
ConnectionGraph.ConnectionGraph graph;
InstanceHierarchy ih;

Expand Down Expand Up @@ -4718,7 +4715,6 @@ algorithm
String n;
DAE.Attributes attr1,attr2;
Boolean flow1,flow2,stream1,stream2;
SCode.Variability vt1,vt2;
tuple<DAE.TType, Option<Absyn.Path>> ty1,ty2;
list<DAE.Var> xs1,xs2;
SCode.Variability vta,vtb;
Expand Down
6 changes: 2 additions & 4 deletions Compiler/Patternm.mo
Expand Up @@ -66,7 +66,7 @@ type RightHandList = DFA.RightHandList;
type RightHandSide = DFA.RightHandSide;
type IndexVector = DFA.IndexVector;
type AsList = list<Absyn.EquationItem>;
type AsArray = AsList[:];
type AsArray = array<AsList>;
type ArcName = Absyn.Ident;

protected function ASTtoMatrixForm "function: ASTtoMatrixForm
Expand Down Expand Up @@ -2477,7 +2477,6 @@ protected function getCaseDecls
output list<Absyn.ElementItem> els;
algorithm
els := matchcontinue (cas)
local list<Absyn.ElementItem> els;
case Absyn.CASE(localDecls = els) then els;
case Absyn.ELSE(localDecls = els) then els;
end matchcontinue;
Expand Down Expand Up @@ -2690,7 +2689,6 @@ algorithm
local
Absyn.Exp exp;
String s;
DAE.Pattern pattern;
DAE.Type ty,t;
Absyn.Path utPath1,utPath2,fqPath;
Integer index,numPosArgs;
Expand Down Expand Up @@ -2788,7 +2786,7 @@ algorithm
list<DAE.Pattern> pats;
DAE.Exp exp;
DAE.Pattern pat,head,tail;
String id,str;
String id;
DAE.ExpType et;
case DAE.PAT_WILD() then "_";
case DAE.PAT_AS(id,_,DAE.PAT_WILD()) then id;
Expand Down
1 change: 0 additions & 1 deletion Compiler/PrefixUtil.mo
Expand Up @@ -332,7 +332,6 @@ public function prefixToCref "function: prefixToCref
Convert a prefix to a component reference."
input Prefix.Prefix pre;
output DAE.ComponentRef cref_1;
DAE.ComponentRef cref_1;
algorithm
(_,cref_1) := prefixToCref2(Env.emptyCache(),{},InnerOuter.emptyInstHierarchy,pre, NONE());
end prefixToCref;
Expand Down

0 comments on commit 3701562

Please sign in to comment.