Skip to content

Commit

Permalink
- Remove RML crap
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund committed Oct 29, 2010
1 parent dc226d4 commit 78debab
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 57 deletions.
42 changes: 18 additions & 24 deletions Compiler/Absyn.mo
Expand Up @@ -1475,6 +1475,10 @@ algorithm
Boolean t_1,b_1,t,b,scalar_1,scalar;
Integer i_1,i;
Ident id_1,id;
list<tuple<Exp,Exp>> elseIfBranch,elseIfBranch1;
FunctionArgs fargs,fargs1,fargs2;
ComponentRef cfn,cfn_1; Exp e_temp;
list<list<Exp>> mexpl,mexpl1;
case ((e as UNARY(op,e1)),rel,ext_arg) /* unary */
equation
((e1_1,ext_arg_1)) = traverseExp(e1, rel, ext_arg);
Expand Down Expand Up @@ -1510,7 +1514,6 @@ algorithm
((RELATION(e1_1,op_1,e2_1),ext_arg_3));

case ((e as IFEXP(e1,e2,e3,elseIfBranch)),rel,ext_arg) /* if expression */
local list<tuple<Exp,Exp>> elseIfBranch,elseIfBranch1;
equation
((e1_1,ext_arg_1)) = traverseExp(e1, rel, ext_arg);
((e2_1,ext_arg_2)) = traverseExp(e2, rel, ext_arg_1);
Expand All @@ -1521,7 +1524,6 @@ algorithm
((IFEXP(e1_1,e2_1,e3_1,elseIfBranch1),ext_arg_4));

case ((e as CALL(cfn,fargs)),rel,ext_arg)
local FunctionArgs fargs,fargs1,fargs2; ComponentRef cfn,cfn_1; Exp e_temp;
equation
((fargs1,ext_arg_1)) = traverseExpFunctionArgs(fargs, rel, ext_arg);
e_temp = CALL(cfn,fargs1);
Expand All @@ -1531,9 +1533,6 @@ algorithm

//stefan
case ((e as PARTEVALFUNCTION(cfn,fargs)),rel,ext_arg)
local
FunctionArgs fargs,fargs1;
ComponentRef cfn,cfn_1;
equation
((fargs1,ext_arg_1)) = traverseExpFunctionArgs(fargs,rel,ext_arg);
((PARTEVALFUNCTION(cfn_1,_),ext_arg_2)) = rel((e,ext_arg_1));
Expand All @@ -1549,7 +1548,6 @@ algorithm
((ARRAY(expl_1),ext_arg_2));

case ((e as MATRIX(mexpl)),rel,ext_arg)
local list<list<Exp>> mexpl,mexpl1;
equation
// Also traverse expressions within the matrix. Daniel Hedberg 2010-10.
((mexpl1,ext_arg_1)) = traverseExpListList(mexpl, rel, ext_arg);
Expand Down Expand Up @@ -2433,14 +2431,16 @@ pathContainedIn(B.C,A.B) => A.B.C"
output Path completePath;
algorithm
completePath := matchcontinue(subPath,path)
local
Ident ident;
Path newPath,newSubPath;
// A suffix, e.g. C.D in A.B.C.D
case (subPath,path)
equation
true=pathSuffixOf(subPath,path);
then path;
// strip last ident of path and recursively check if suffix.
case (subPath,path)
local Ident ident; Path newPath;
equation
ident = pathLastIdent(path);
newPath = stripLast(path);
Expand All @@ -2449,7 +2449,6 @@ algorithm

// strip last ident of subpath and recursively check if suffix.
case (subPath,path)
local Ident ident; Path newSubPath;
equation
ident = pathLastIdent(subPath);
newSubPath = stripLast(subPath);
Expand Down Expand Up @@ -2500,6 +2499,10 @@ algorithm
list<list<ComponentRef>> res2;
list<ComponentCondition> expl;
list<list<ComponentCondition>> expll;
list<Subscript> subs;
list<list<ComponentRef>> res1;
list<list<list<ComponentRef>>> reslll;
list<list<ComponentRef>> crefll;
case (INTEGER(value = _),checkSubs) then {};
case (REAL(value = _),checkSubs) then {};
case (STRING(value = _),checkSubs) then {};
Expand All @@ -2508,8 +2511,6 @@ algorithm
case (CREF(componentRef = cr),false) then {cr};

case (CREF(componentRef = (cr)),true)
local
list<Subscript> subs;
equation
subs = getSubsFromCref(cr);
l1 = getCrefsFromSubs(subs);
Expand Down Expand Up @@ -2550,9 +2551,9 @@ algorithm
equation
l1 = getCrefFromExp(e1,checkSubs);
l2 = getCrefFromExp(e2,checkSubs);
res1 = listAppend(l1, l2);
l3 = getCrefFromExp(e3,checkSubs);
res = listAppend(res1, l3) "TODO elseif\'s e4" ;
l1 = listAppend(l1, l2);
l2 = getCrefFromExp(e3,checkSubs);
res = listAppend(l1, l2) "TODO elseif\'s e4" ;
then
res;
case (CALL(functionArgs = farg),checkSubs)
Expand All @@ -2566,27 +2567,23 @@ algorithm
then
res;
case (ARRAY(arrayExp = expl),checkSubs)
local list<list<ComponentRef>> res1;
equation
res1 = Util.listMap1(expl, getCrefFromExp,checkSubs);
res = Util.listFlatten(res1);
then
res;
case (MATRIX(matrix = expll),checkSubs)
local list<list<list<ComponentRef>>> res1;
equation
res1 = Util.listListMap1(expll, getCrefFromExp,checkSubs);
res2 = Util.listFlatten(res1);
res = Util.listFlatten(res2);
res = Util.listFlatten(Util.listFlatten(Util.listListMap1(expll, getCrefFromExp,checkSubs)));
then
res;
case (RANGE(start = e1,step = SOME(e3),stop = e2),checkSubs)
equation
l1 = getCrefFromExp(e1,checkSubs);
l2 = getCrefFromExp(e2,checkSubs);
res1 = listAppend(l1, l2);
l3 = getCrefFromExp(e3,checkSubs);
res = listAppend(res1, l3);
l2 = listAppend(l1, l2);
l2 = getCrefFromExp(e3,checkSubs);
res = listAppend(l1, l2);
then
res;
case (RANGE(start = e1,step = NONE(),stop = e2),checkSubs)
Expand All @@ -2599,7 +2596,6 @@ algorithm
case (END(),checkSubs) then {};

case (TUPLE(expressions = expl),checkSubs)
local list<list<ComponentRef>> crefll;
equation
crefll = Util.listMap1(expl,getCrefFromExp,checkSubs);
res = Util.listFlatten(crefll);
Expand All @@ -2620,8 +2616,6 @@ algorithm
res;

case (LIST(expl),checkSubs)
local
list<list<ComponentRef>> crefll;
equation
crefll = Util.listMap1(expl,getCrefFromExp,checkSubs);
res = Util.listFlatten(crefll);
Expand Down
10 changes: 4 additions & 6 deletions Compiler/AbsynDep.mo
Expand Up @@ -607,27 +607,25 @@ algorithm
local
AvlKey rkey,key;
AvlValue rval,res;
Option<AvlTree> left,right;
AvlTree left,right;
Integer rhval;
/* hash func Search to the right */
case (AVLTREENODE(value = SOME(AVLTREEVALUE(rkey,rval)),left = left,right = right),key)
case (AVLTREENODE(value = SOME(AVLTREEVALUE(rkey,rval))),key)
equation
true = ModUtil.pathEqual(rkey,key);
then
rval;

/* Search to the right */
case (AVLTREENODE(value = SOME(AVLTREEVALUE(rkey,rval)),left = left,right = SOME(right)),key)
local AvlTree right;
case (AVLTREENODE(value = SOME(AVLTREEVALUE(rkey,rval)),right = SOME(right)),key)
equation
true = stringCompare(Absyn.pathString(key),Absyn.pathString(rkey)) > 0;
res = avlTreeGet(right, key);
then
res;

/* Search to the left */
case (AVLTREENODE(value = SOME(AVLTREEVALUE(rkey,rval)),left = SOME(left),right = right),key)
local AvlTree left;
case (AVLTREENODE(value = SOME(AVLTREEVALUE(rkey,rval)),left = SOME(left)),key)
equation
/*true = stringCompare(key,rkey) < 0;*/
res = avlTreeGet(left, key);
Expand Down
24 changes: 12 additions & 12 deletions Compiler/Algorithm.mo
Expand Up @@ -244,9 +244,12 @@ protected function makeAssignment2
output Statement outStatement;
algorithm
outStatement := matchcontinue(lhs,lhprop,rhs,rhprop,source)
local DAE.ComponentRef c;
local
DAE.ComponentRef c;
DAE.ExpType crt,t;
DAE.Exp rhs_1,e3,e1;
DAE.Type ty;
list<DAE.Exp> ea2;
case (DAE.CREF(componentRef = c,ty = crt),lhprop,rhs,rhprop,source)
equation
(rhs_1,_) = Types.matchProp(rhs, rhprop, lhprop, true);
Expand All @@ -264,7 +267,6 @@ algorithm
DAE.STMT_ASSIGN(t,e1,rhs_1);
*/
case (DAE.CREF(componentRef = c,ty = crt),lhprop,rhs,rhprop,source)
local DAE.Type ty;
equation
(rhs_1,_) = Types.matchProp(rhs, rhprop, lhprop, false /* Don't duplicate errors */);
true = Types.isPropArray(lhprop);
Expand All @@ -274,7 +276,6 @@ algorithm
DAE.STMT_ASSIGN_ARR(t,c,rhs_1,source);

case(e3 as DAE.ASUB(e1,ea2),lhprop,rhs,rhprop,source)
local list<DAE.Exp> ea2;
equation
(rhs_1,_) = Types.matchProp(rhs, rhprop, lhprop, true);
//false = Types.isPropArray(lhprop);
Expand All @@ -294,18 +295,17 @@ public function makeAssignmentsList
input DAE.ElementSource source;
output list<Statement> assignments;
algorithm
assignments := matchcontinue(lhsExps, lhsProps, rhsExps, rhsProps,
accessibility, initial_, source)
assignments := matchcontinue(lhsExps, lhsProps, rhsExps, rhsProps, accessibility, initial_, source)
local
DAE.Exp lhs, rhs;
list<DAE.Exp> rest_lhs, rest_rhs;
DAE.Properties lhs_prop, rhs_prop;
list<DAE.Properties> rest_lhs_prop, rest_rhs_prop;
DAE.Statement ass;
list<DAE.Statement> rest_ass;
case ({}, {}, {}, {}, _, _, _) then {};
case (lhs :: rest_lhs, lhs_prop :: rest_lhs_prop,
rhs :: rest_rhs, rhs_prop :: rest_rhs_prop, _, _, _)
local
DAE.Exp lhs, rhs;
list<DAE.Exp> rest_lhs, rest_rhs;
DAE.Properties lhs_prop, rhs_prop;
list<DAE.Properties> rest_lhs_prop, rest_rhs_prop;
DAE.Statement ass;
list<DAE.Statement> rest_ass;
equation
ass = makeAssignment(lhs, lhs_prop, rhs, rhs_prop, accessibility, initial_, source);
rest_ass = makeAssignmentsList(rest_lhs, rest_lhs_prop, rest_rhs, rest_rhs_prop, accessibility, initial_, source);
Expand Down
20 changes: 5 additions & 15 deletions Compiler/XMLDump.mo
Expand Up @@ -2682,15 +2682,13 @@ public function dumpSolvingInfo "
algorithm
_:=
matchcontinue (addOriginalIncidenceMatrix,addSolvingInfo,inBackendDAE)
local BackendDAE.BackendDAE dlow;
case (DAE.BCONST(bool=false),DAE.BCONST(bool=false),_)
equation
then ();
case (DAE.BCONST(bool=true),DAE.BCONST(bool=true),dlow)
local
BackendDAE.BackendDAE dlow;
list<Integer>[:] m,mT;
array<Integer> v1,v2;
list<list<Integer>> comps;
case (DAE.BCONST(bool=false),DAE.BCONST(bool=false),_) then ();
case (DAE.BCONST(bool=true),DAE.BCONST(bool=true),dlow)
equation
m = BackendDAEUtil.incidenceMatrix(dlow);
mT = BackendDAEUtil.transposeMatrix(m);
Expand All @@ -2708,10 +2706,6 @@ algorithm
dumpStrCloseTag(ADDITIONAL_INFO);
then ();
case (DAE.BCONST(bool=true),DAE.BCONST(bool=false),dlow)
local
list<Integer>[:] m,mT;
array<Integer> v1,v2;
list<list<Integer>> comps;
equation
m = BackendDAEUtil.incidenceMatrix(dlow);
mT = BackendDAEUtil.transposeMatrix(m);
Expand All @@ -2722,10 +2716,6 @@ algorithm
dumpStrCloseTag(ADDITIONAL_INFO);
then ();
case (DAE.BCONST(bool=false),DAE.BCONST(bool=true),dlow)
local
list<Integer>[:] m,mT;
array<Integer> v1,v2;
list<list<Integer>> comps;
equation
m = BackendDAEUtil.incidenceMatrix(dlow);
mT = BackendDAEUtil.transposeMatrix(m);
Expand Down Expand Up @@ -3435,15 +3425,15 @@ the zero crossing list. The output is:
algorithm
_:=
matchcontinue (zeroCross,inContent,addMathMLCode)
local
Integer len;
case ({},_,_) then ();
case (zeroCross,inContent,_)
local Integer len;
equation
len = listLength(zeroCross);
len >= 1 = false;
then();
case (zeroCross,inContent,addMathMLCode)
local Integer len;
equation
len = listLength(zeroCross);
len >= 1 = true;
Expand Down

0 comments on commit 78debab

Please sign in to comment.