Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Fixed inputs/outputs of all functions using match expressions (all crefs are now in the correct order, with the correct name, and without duplicates)


git-svn-id: https://openmodelica.org/svn/OpenModelica/branches/sjoelund-functiontree@6513 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Oct 22, 2010
1 parent 96d735f commit 0fd6541
Show file tree
Hide file tree
Showing 35 changed files with 227 additions and 488 deletions.
4 changes: 2 additions & 2 deletions Compiler/Absyn.mo
Expand Up @@ -3360,7 +3360,7 @@ public function crefSetLastIdent
input ComponentRef inNewIdent; // ident to replace the old one
output ComponentRef outComponentRef;
algorithm
outComponentRef := matchcontinue (inNewIdent,inComponentRef)
outComponentRef := matchcontinue (inComponentRef,inNewIdent)
local
ComponentRef cref,cref1,cref2,cref_1;
Ident id;
Expand Down Expand Up @@ -4253,7 +4253,7 @@ protected function findIteratorInSubscripts
input Integer inInt;
output list<Integer> outIntLst;
algorithm
outLst := matchcontinue(inString,inSubLst,inInt)
outIntLst := matchcontinue(inString,inSubLst,inInt)
local
list<Integer> lst;
Integer n, n_1;
Expand Down
5 changes: 2 additions & 3 deletions Compiler/Builtin.mo
Expand Up @@ -2408,7 +2408,7 @@ public function initialEnv "function: initialEnv
list<Env.Frame> envb;
Env.Cache cache;
algorithm
env := matchcontinue(cache)
(outCache,env) := matchcontinue(inCache)

// First look for cached version
case (cache) equation
Expand Down Expand Up @@ -2903,9 +2903,8 @@ end initialEnv;
protected function initialEnvMetaModelica
input list<Env.Frame> inEnv;
output list<Env.Frame> outEnv;

algorithm
out := matchcontinue(inEnv)
outEnv := matchcontinue(inEnv)
local
list<Env.Frame> env;
case (env)
Expand Down
23 changes: 11 additions & 12 deletions Compiler/Ceval.mo
Expand Up @@ -944,7 +944,7 @@ public function cevalIfConstant
output DAE.Exp outExp;
output DAE.Properties outProp;
algorithm
(inCache, outExp, outProp) := matchcontinue(inCache, inEnv, inExp, inProp, impl)
(outCache,outExp,outProp) := matchcontinue(inCache, inEnv, inExp, inProp, impl)
local
DAE.Exp e;
Values.Value v;
Expand Down Expand Up @@ -1028,7 +1028,7 @@ public function cevalRangeIfConstant
output Env.Cache outCache;
output DAE.Exp outExp;
algorithm
(outCache, outExp, outProp) := matchcontinue(inCache, inEnv, inExp, inProp, impl)
(outCache, outExp) := matchcontinue(inCache, inEnv, inExp, inProp, impl)
case (_, _, DAE.RANGE(ty = ty, exp = e1, range = e2, expOption = e3), _, _)
local
DAE.Exp e1, e2;
Expand Down Expand Up @@ -2500,13 +2500,13 @@ protected function cevalBuiltinLinspace "
input Env.Env inEnv;
input list<DAE.Exp> inExpExpLst;
input Boolean inBoolean;
input Option<Interactive.InteractiveSymbolTable> inInteractiveInteractiveSymbolTableOption;
input Option<Interactive.InteractiveSymbolTable> st;
input Msg inMsg;
output Env.Cache outCache;
output Values.Value outValue;
output Option<Interactive.InteractiveSymbolTable> st;
output Option<Interactive.InteractiveSymbolTable> outST;
algorithm
(outCache,outValue,outInteractiveInteractiveSymbolTableOption):=
(outCache,outValue,outST):=
matchcontinue (inCache,inEnv,inExpExpLst,inBoolean,st,inMsg)
local
DAE.Exp x,y,n; Integer size;
Expand Down Expand Up @@ -5759,10 +5759,9 @@ public function add
If the Key-Value tuple already exists, the function updates the Value."
input tuple<Key,Value> entry;
input CevalHashTable hashTable;
output CevalHashTable outHahsTable;
output CevalHashTable outHashTable;
algorithm
outVariables:=
matchcontinue (entry,hashTable)
outHashTable := matchcontinue (entry,hashTable)
local
Integer hval,indx,newpos,n,n_1,bsize,indx_1;
ValueArray varr_1,varr;
Expand Down Expand Up @@ -5807,9 +5806,9 @@ public function addNoUpdCheck
If the Key-Value tuple already exists, the function updates the Value."
input tuple<Key,Value> entry;
input CevalHashTable hashTable;
output CevalHashTable outHahsTable;
output CevalHashTable outHashTable;
algorithm
outVariables := matchcontinue (entry,hashTable)
outHashTable := matchcontinue (entry,hashTable)
local
Integer hval,indx,newpos,n,n_1,bsize,indx_1;
ValueArray varr_1,varr;
Expand Down Expand Up @@ -5846,9 +5845,9 @@ public function delete
will still contain a lot of incices information."
input Key key;
input CevalHashTable hashTable;
output CevalHashTable outHahsTable;
output CevalHashTable outHashTable;
algorithm
outVariables := matchcontinue (key,hashTable)
outHashTable := matchcontinue (key,hashTable)
local
Integer hval,indx,newpos,n,n_1,bsize,indx_1;
ValueArray varr_1,varr;
Expand Down
12 changes: 6 additions & 6 deletions Compiler/ConnectUtil.mo
Expand Up @@ -334,7 +334,7 @@ protected function addOuterConnectToSets33 "help function to addOuterconnectToSe
output list<Connect.Set> outSets;
output Boolean added;
algorithm
(outCrs,outCrs2,added,outSets) := matchcontinue(cr1,cr2,isOuter1,isOuter2,f1,f2,crs,inCrs,inSets)
(outCrs,outCrs2,outSets,added) := matchcontinue(cr1,cr2,isOuter1,isOuter2,f1,f2,crs,inCrs,inSets)
local
DAE.ComponentRef outerCr,outerCr,connectorCr,newCr;
DAE.ElementSource src;
Expand Down Expand Up @@ -480,7 +480,7 @@ public function addArrayFlow "function: addArrayFlow
input Connect.Face d2;
input Integer dsize;
input DAE.ElementSource source "the element origin";
output Connect.Sets ss_1;
output Connect.Sets outSets;
Connect.Set s1,s2;
Connect.Sets ss_1;
algorithm
Expand Down Expand Up @@ -585,7 +585,7 @@ public function addArrayStream "function: addArrayStream
input Connect.Face d2;
input Integer dsize;
input DAE.ElementSource source "the element origin";
output Connect.Sets ss_1;
output Connect.Sets outSets;
Connect.Set s1,s2;
Connect.Sets ss_1;
algorithm
Expand Down Expand Up @@ -828,9 +828,9 @@ public function equations
"From a number of connection sets, this function generates a list of
equations."
input Connect.Sets inSets;
output DAE.DAElist outDae;
output DAE.DAElist outDae;
algorithm
outDAEElementLst := matchcontinue (inSets)
outDae := matchcontinue (inSets)
local
DAE.DAElist dae1,dae2,dae;
list<tuple<DAE.ComponentRef, DAE.ElementSource>> cs;
Expand Down Expand Up @@ -1818,7 +1818,7 @@ helper function for updateConnectionSetTypes"
input DAE.ComponentRef list2;
output list<DAE.ComponentRef> list3;
algorithm
lsit3 := matchcontinue(list1,list2)
list3 := matchcontinue(list1,list2)
local
list<DAE.ComponentRef> cr1s,cr2s;
DAE.ComponentRef cr1,cr2;
Expand Down
4 changes: 2 additions & 2 deletions Compiler/ConnectionGraph.mo
Expand Up @@ -152,9 +152,9 @@ public function handleOverconstrainedConnectionsInSets
input Connect.Sets inSets;
input Boolean isTopScope;
output Connect.Sets outSets;
output list<DAE.Element> outDAEElements;
output list<DAE.Element> outDAEElements;
algorithm
outSets := matchcontinue(inGraph, inSets, isTopScope)
(outSets,outDAEElements) := matchcontinue(inGraph, inSets, isTopScope)
local
ConnectionGraph graph;
list<DAE.Element> elts;
Expand Down
13 changes: 7 additions & 6 deletions Compiler/DAEDump.mo
Expand Up @@ -2262,12 +2262,13 @@ end dumpDebugElement;
public function dumpFlow "
Author BZ 2008-07, dump flow properties to string."
input DAE.Flow var;
output String flowStrig;
algorithm flowString := matchcontinue(var)
case DAE.FLOW() then "flow";
case DAE.NON_FLOW() then "effort";
case DAE.NON_CONNECTOR() then "non_connector";
end matchcontinue;
output String flowString;
algorithm
flowString := matchcontinue(var)
case DAE.FLOW() then "flow";
case DAE.NON_FLOW() then "effort";
case DAE.NON_CONNECTOR() then "non_connector";
end matchcontinue;
end dumpFlow;

public function dumpGraphviz "
Expand Down
14 changes: 7 additions & 7 deletions Compiler/DAEUtil.mo
Expand Up @@ -1003,12 +1003,12 @@ public function getAllMatchingElements "function getAllMatchingElements
"
input list<DAE.Element> elist;
input FuncTypeElementTo cond;
output list<DAE.Element> elist;
output list<DAE.Element> outElist;
partial function FuncTypeElementTo
input DAE.Element inElement;
end FuncTypeElementTo;
algorithm
elist := matchcontinue(elist,cond)
outElist := matchcontinue(elist,cond)
local
list<DAE.Element> elist2;
DAE.Element e;
Expand Down Expand Up @@ -1511,8 +1511,7 @@ public function toStream "function: toStram
input ClassInf.State inState;
output DAE.Stream outStream;
algorithm
outFlow:=
matchcontinue (inBoolean,inState)
outStream := matchcontinue (inBoolean,inState)
case (true,_) then DAE.STREAM();
case (_,ClassInf.CONNECTOR(path = _)) then DAE.NON_STREAM();
case (_,_) then DAE.NON_STREAM_CONNECTOR();
Expand Down Expand Up @@ -2162,7 +2161,7 @@ protected function getFunctionElements
input DAE.Function fn;
output list<DAE.Element> els;
algorithm
exps := matchcontinue fn
els := matchcontinue fn
local
list<DAE.Element> elements;
case DAE.FUNCTION(functions = (DAE.FUNCTION_DEF(body = elements)::_)) then elements;
Expand Down Expand Up @@ -3843,7 +3842,8 @@ Helper function for traverseDAEEquationsStmts
output Type_a oextraArg;
partial function FuncExpType input DAE.Exp exp; input Type_a arg; output DAE.Exp oexp; output Type_a oarg; end FuncExpType;
replaceable type Type_a subtypeof Any;
algorithm (outElse,extraArg) := matchcontinue(inElse,func,extraArg)
algorithm
(outElse,oextraArg) := matchcontinue(inElse,func,extraArg)
local
DAE.Exp e,e_1;
list<DAE.Statement> st,st_1;
Expand Down Expand Up @@ -3874,7 +3874,7 @@ Help function to traverseDAE
partial function FuncExpType input DAE.Exp exp; input Type_a arg; output DAE.Exp oexp; output Type_a oarg; end FuncExpType;
replaceable type Type_a subtypeof Any;
algorithm
(outAttr,extraArg) := matchcontinue(attr,func,extraArg)
(traversedDaeList,oextraArg) := matchcontinue(attr,func,extraArg)
local
Option<DAE.Exp> quantity,unit,displayUnit,min,max,initial_,fixed,nominal,eb;
Option<DAE.StateSelect> stateSelect;
Expand Down
2 changes: 1 addition & 1 deletion Compiler/DFA.mo
Expand Up @@ -764,7 +764,7 @@ protected function mergeLists "function: mergeLists"
input list<tuple<Absyn.Ident,Absyn.TypeSpec>> accList;
output list<tuple<Absyn.Ident,Absyn.TypeSpec>> outList;
algorithm
outTypeSpec := matchcontinue (idList,tList,accList)
outList := matchcontinue (idList,tList,accList)
local
list<tuple<Absyn.Ident,Absyn.TypeSpec>> localAccList;
case ({},_,localAccList) then localAccList;
Expand Down
2 changes: 1 addition & 1 deletion Compiler/Env.mo
Expand Up @@ -1406,7 +1406,7 @@ public function cacheAddEnv "Add an environment to the cache"
input Env env "environment";
output CacheTree outTree;
algorithm
outTree := matchcontinue(path,tree,env)
outTree := matchcontinue(fullpath,tree,env)
local
Ident id1,globalID,id2;
Absyn.Path path;
Expand Down
2 changes: 1 addition & 1 deletion Compiler/Error.mo
Expand Up @@ -630,7 +630,7 @@ protected constant list<tuple<Integer, MessageType, Severity, String>> errorTabl
(TUPLE_ASSIGN_CREFS_ONLY,TRANSLATION(),ERROR(),"Tuple assignment only allowed for tuple of component references in lhs (in %s)"),
(META_CONS_TYPE_MATCH,TRANSLATION(),ERROR(),"Failed to match types of cons expression %s. The head has type %s and the tail %s."),
(LOOKUP_FUNCTION_GOT_CLASS,TRANSLATION(),ERROR(),"Looking for a function %s but found a %s."),
(META_STRICT_RML_MATCH_IN_OUT,TRANSLATION(),ERROR(),"Strict RML enforces match expression input and output to be the same as the function's. %s."),
(META_STRICT_RML_MATCH_IN_OUT,TRANSLATION(),ERROR(),"%s. Strict RML enforces match expression input and output to be the same as the function's."),
(META_NONE_CREF,TRANSLATION(),ERROR(),"NONE is not acceptable syntax. Use NONE() instead.")
};

Expand Down
10 changes: 5 additions & 5 deletions Compiler/Exp.mo
Expand Up @@ -1390,11 +1390,11 @@ end crefEqualNoStringCompare;
public function prependSubscriptExp
"Prepends a subscript to a CREF expression
For instance a.b[1,2] with subscript 'i' becomes a.b[i,1,2]."
input Exp exp;
input Subscript subscr;
output Exp outExp;
input Exp exp;
input Subscript subscr;
output Exp outExp;
algorithm
outexp := matchcontinue(exp,subscr)
outExp := matchcontinue(exp,subscr)
local Type t; ComponentRef cr,cr1,cr2;
list<Subscript> subs;
case(DAE.CREF(cr,t),subscr) equation
Expand Down Expand Up @@ -2389,7 +2389,7 @@ protected function simplifyCref
input Type inType;
output Exp exp;
algorithm
outExpLst := matchcontinue(inCREF, inType)
exp := matchcontinue(inCREF, inType)
local
Type t,t2;
list<Subscript> ssl;
Expand Down
16 changes: 7 additions & 9 deletions Compiler/HashTable.mo
Expand Up @@ -203,9 +203,9 @@ public function add "
"
input tuple<Key,Value> entry;
input HashTable hashTable;
output HashTable outHahsTable;
output HashTable outHashTable;
algorithm
outVariables:=
outHashTable :=
matchcontinue (entry,hashTable)
local
Integer hval,indx,newpos,n,n_1,bsize,indx_1;
Expand Down Expand Up @@ -266,7 +266,7 @@ public function addListNoUpd "adds several keys with the same value, using addNu
input HashTable ht;
output HashTable outHt;
algorithm
ht := matchcontinue(keys,v,ht)
outHt := matchcontinue(keys,v,ht)
local Key key;
case ({},v,ht) then ht;
case(key::keys,v,ht) equation
Expand All @@ -284,10 +284,9 @@ public function addNoUpdCheck "
"
input tuple<Key,Value> entry;
input HashTable hashTable;
output HashTable outHahsTable;
output HashTable outHashTable;
algorithm
outVariables:=
matchcontinue (entry,hashTable)
outHashTable := matchcontinue (entry,hashTable)
local
Integer hval,indx,newpos,n,n_1,bsize,indx_1;
ValueArray varr_1,varr;
Expand Down Expand Up @@ -329,10 +328,9 @@ public function delete "
"
input Key key;
input HashTable hashTable;
output HashTable outHahsTable;
output HashTable outHashTable;
algorithm
outVariables:=
matchcontinue (key,hashTable)
outHashTable := matchcontinue (key,hashTable)
local
Integer hval,indx,newpos,n,n_1,bsize,indx_1;
ValueArray varr_1,varr;
Expand Down
5 changes: 2 additions & 3 deletions Compiler/HashTable2.mo
Expand Up @@ -151,10 +151,9 @@ public function addNoUpdCheck "
"
input tuple<Key,Value> entry;
input HashTable hashTable;
output HashTable outHahsTable;
output HashTable outHashTable;
algorithm
outVariables:=
matchcontinue (entry,hashTable)
outHashTable := matchcontinue (entry,hashTable)
local
Integer hval,indx,newpos,n,n_1,bsize,indx_1;
ValueArray varr_1,varr;
Expand Down
10 changes: 4 additions & 6 deletions Compiler/HashTable3.mo
Expand Up @@ -105,10 +105,9 @@ public function add "
"
input tuple<Key,Value> entry;
input HashTable hashTable;
output HashTable outHahsTable;
output HashTable outHashTable;
algorithm
outVariables:=
matchcontinue (entry,hashTable)
outHashTable := matchcontinue (entry,hashTable)
local
Integer hval,indx,newpos,n,n_1,bsize,indx_1;
ValueArray varr_1,varr;
Expand Down Expand Up @@ -157,10 +156,9 @@ public function delete "
"
input Key key;
input HashTable hashTable;
output HashTable outHahsTable;
output HashTable outHashTable;
algorithm
outVariables:=
matchcontinue (key,hashTable)
outHashTable := matchcontinue (key,hashTable)
local
Integer hval,indx,newpos,n,n_1,bsize,indx_1;
ValueArray varr_1,varr;
Expand Down

0 comments on commit 0fd6541

Please sign in to comment.