Skip to content

Commit 841b8ec

Browse files
committed
- Update some RML syntax to MetaModelica
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@6994 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 36b290a commit 841b8ec

File tree

14 files changed

+39
-44
lines changed

14 files changed

+39
-44
lines changed

Compiler/BackendDAETransform.mo

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ algorithm
280280
equation
281281
newarr = arrayCreate(size, 0);
282282
newarr_1 = Util.arrayNCopy(arr, newarr, size);
283-
vec = array_copy(newarr_1);
283+
vec = arrayCopy(newarr_1);
284284
then
285285
vec;
286286
case (_)
@@ -1217,7 +1217,7 @@ algorithm
12171217
(dummy_der,dae) = newDummyVar(state, dae) ;
12181218
// print("Chosen dummy: ");print(ComponentReference.printComponentRefStr(dummy_der));print("\n");
12191219
reqns = BackendDAEUtil.eqnsForVarWithStates(mt, stateno);
1220-
changedeqns = Util.listUnionOnTrue(deqns, reqns, int_eq);
1220+
changedeqns = Util.listUnionOnTrue(deqns, reqns, intEq);
12211221
(dae,m,mt) = replaceDummyDer(state, dummy_der, dae, m, mt, changedeqns)
12221222
"We need to change variables in the differentiated equations and in the equations having the dummy derivative" ;
12231223
dae = makeAlgebraic(dae, state);
@@ -1353,7 +1353,7 @@ algorithm
13531353
/* eqns dummy state */
13541354
case ((dae as BackendDAE.DAE(vars,kv,ev,av,e,se,ie,ae,al,ei,eoc)),eqns,dummy,dummy_no)
13551355
equation
1356-
eqns_1 = Util.listMap1(eqns, int_sub, 1);
1356+
eqns_1 = Util.listMap1(eqns, intSub, 1);
13571357
eqns_lst = Util.listMap1r(eqns_1, BackendDAEUtil.equationNth, e);
13581358
crefs = BackendEquation.equationsCrefs(eqns_lst);
13591359
crefs = Util.listDeleteMemberOnTrue(crefs, dummy, ComponentReference.crefEqualNoStringCompare);
@@ -1369,7 +1369,7 @@ algorithm
13691369
// Never propagate fixed=true
13701370
case ((dae as BackendDAE.DAE(vars,kv,ev,av,e,se,ie,ae,al,ei,eoc)),eqns,dummy,dummy_no)
13711371
equation
1372-
eqns_1 = Util.listMap1(eqns, int_sub, 1);
1372+
eqns_1 = Util.listMap1(eqns, intSub, 1);
13731373
eqns_lst = Util.listMap1r(eqns_1, BackendDAEUtil.equationNth, e);
13741374
crefs = BackendEquation.equationsCrefs(eqns_lst);
13751375
crefs = Util.listDeleteMemberOnTrue(crefs, dummy, ComponentReference.crefEqualNoStringCompare);
@@ -1969,7 +1969,7 @@ protected function varStateSelectHeuristicPrio3
19691969
output Real prio;
19701970
algorithm
19711971
prio := matchcontinue(cr,vars)
1972-
local Integer i; Real c,prio;
1972+
local Integer i; Real c;
19731973
case(cr,vars)
19741974
equation
19751975
((_,i)) = BackendVariable.traverseBackendDAEVars(vars,varHasSameLastIdent,(cr,0));
@@ -2268,7 +2268,7 @@ protected function statesAsAlgebraicVars "function: statesAsAlgebraicVars
22682268
input BackendDAE.Variables vars;
22692269
output BackendDAE.Variables v1_1;
22702270
list<BackendDAE.Var> varlst,varlst_1;
2271-
BackendDAE.Variables v1,v1_1;
2271+
BackendDAE.Variables v1;
22722272
algorithm
22732273
varlst := BackendDAEUtil.varList(vars) "Creates a new set of BackendDAE.Variables from a BackendDAE.Var list" ;
22742274
varlst_1 := statesAsAlgebraicVars2(varlst);

Compiler/BackendDAEUtil.mo

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,7 +1876,7 @@ algorithm
18761876
case (BackendDAE.VAR(varName = cr),((dae as BackendDAE.DAE(orderedVars = vars)),arr,m,mt,a1,a2))
18771877
equation
18781878
(_,v_indxs) = BackendVariable.getVar(cr, vars);
1879-
v_indxs_1 = Util.listMap1(v_indxs, int_sub, 1);
1879+
v_indxs_1 = Util.listMap1(v_indxs, intSub, 1);
18801880
eqns = Util.listMap1r(v_indxs_1, arrayNth, a1);
18811881
((arr_1,m,mt,a1,a2)) = markStateEquation2(eqns, (arr,m,mt,a1,a2));
18821882
then
@@ -3571,7 +3571,7 @@ algorithm
35713571
case (BackendDAE.RESIDUAL_EQUATION(exp = e),vars,ae,m,mt,eqn_indx,differentiateIfExp,inEntrylst)
35723572
equation
35733573
var_indxs = varsInEqn(m, eqn_indx);
3574-
var_indxs_1 = Util.listUnionOnTrue(var_indxs, {}, int_eq) "Remove duplicates and get in correct order: ascending index" ;
3574+
var_indxs_1 = Util.listUnionOnTrue(var_indxs, {}, intEq) "Remove duplicates and get in correct order: ascending index" ;
35753575
SOME(eqns) = calculateJacobianRow2(e, vars, eqn_indx, var_indxs_1,differentiateIfExp);
35763576
then
35773577
(SOME(eqns),inEntrylst);
@@ -3587,7 +3587,7 @@ algorithm
35873587
(subs,entrylst1) = getArrayEquationSub(indx,ad,inEntrylst);
35883588
new_exp = Expression.applyExpSubscripts(new_exp,subs);
35893589
var_indxs = varsInEqn(m, eqn_indx);
3590-
var_indxs_1 = Util.listUnionOnTrue(var_indxs, {}, int_eq) "Remove duplicates and get in correct order: acsending index";
3590+
var_indxs_1 = Util.listUnionOnTrue(var_indxs, {}, intEq) "Remove duplicates and get in correct order: acsending index";
35913591
SOME(eqns) = calculateJacobianRow2(new_exp, vars, eqn_indx, var_indxs_1,differentiateIfExp);
35923592
then
35933593
(SOME(eqns),entrylst1);

Compiler/BackendDump.mo

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,7 @@ public function dumpMatching
11211121
algorithm
11221122
print("Matching\n");
11231123
print("========\n");
1124-
len := array_length(v);
1124+
len := arrayLength(v);
11251125
len_str := intString(len);
11261126
print(len_str);
11271127
print(" variables and equations\n");
@@ -1142,7 +1142,7 @@ algorithm
11421142
array<BackendDAE.Value> v;
11431143
case (v,i)
11441144
equation
1145-
len = array_length(v);
1145+
len = arrayLength(v);
11461146
i_1 = i + 1;
11471147
(len == i_1) = true;
11481148
s = intString(i_1);
@@ -1157,7 +1157,7 @@ algorithm
11571157
();
11581158
case (v,i)
11591159
equation
1160-
len = array_length(v);
1160+
len = arrayLength(v);
11611161
i_1 = i + 1;
11621162
(len == i_1) = false;
11631163
s = intString(i_1);

Compiler/BackendVariable.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1663,7 +1663,7 @@ algorithm
16631663
matchcontinue (inindex,dimlist)
16641664
local
16651665
list<Integer> index_lst,dim_lst;
1666-
Integer value,value1,index,dim;
1666+
Integer value1,index,dim;
16671667
case ({},{}) then 0;
16681668
case (index::{},_) then index;
16691669
case (index::index_lst,dim::dim_lst)

Compiler/DAEQuery.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ algorithm
735735
BackendVariable.getVar(cr, vars) "If variable x is a state, der(x) is a variable in incidence matrix,
736736
x is inserted as negative value, since it is needed by debugging and index
737737
reduction using dummy derivatives" ;
738-
p_1 = Util.listMap1r(p, int_sub, 0);
738+
p_1 = Util.listMap1r(p, intSub, 0);
739739
pStr = Util.listMap(p_1, intString);
740740
then
741741
pStr;

Compiler/DFA.mo

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ algorithm
254254
case ({},Absyn.TUPLE({}) :: _,_,_) then {};
255255

256256
// _ := ... then ..., not fail()
257-
case ({Absyn.CREF(Absyn.WILD)},_,_,_) then {};
257+
case ({Absyn.CREF(Absyn.WILD())},_,_,_) then {};
258258

259259
case (firstLhs :: restLhs,firstRhs :: restRhs,localAccList,info)
260260
equation
@@ -828,7 +828,7 @@ algorithm
828828
localDfaEnv = listReverse(localDfaEnv);
829829
then (SOME(localDfaEnv),localCache);
830830

831-
case (Absyn.CREF(Absyn.WILD) :: restExps,localDfaEnv,localCache,localEnv,info)
831+
case (Absyn.CREF(Absyn.WILD()) :: restExps,localDfaEnv,localCache,localEnv,info)
832832
equation
833833
(res,localCache) = addVarsToDfaEnv2(restExps,localDfaEnv,localCache,localEnv,info);
834834
then (res,localCache);
@@ -1504,9 +1504,9 @@ protected function matchContinueToSwitch2
15041504
input list<tuple<Absyn.Ident,Absyn.TypeSpec>> initialDfaEnv;
15051505
input Absyn.Info info;
15061506
output Env.Cache outCache;
1507-
output list<Absyn.Exp> expr;
1507+
output list<Absyn.Exp> exprs;
15081508
algorithm
1509-
(outCache, expr) := matchcontinue (patMat, caseLocalDecls, inputVarList, resVarList, rhlist, elseRhSide, cache, localEnv, invalidDecls, initialDfaEnv, info)
1509+
(outCache, exprs) := matchcontinue (patMat, caseLocalDecls, inputVarList, resVarList, rhlist, elseRhSide, cache, localEnv, invalidDecls, initialDfaEnv, info)
15101510
local
15111511
RenamedPatList firstCase;
15121512
RenamedPatMatrix2 restCase;
@@ -1699,8 +1699,8 @@ function generatePathVarDeclarationsList
16991699
algorithm
17001700
(outCache,outDfaEnv,outEls,outAlgs) := matchcontinue(pats, inputVarList, cache, env, dfaEnv,info)
17011701
local
1702-
list<Absyn.ElementItem> outEls, outEls1, outEls2, matchDecls;
1703-
list<Absyn.AlgorithmItem> outAlgs, outAlgs1, outAlgs2, matchAlgs;
1702+
list<Absyn.ElementItem> outEls1, outEls2, matchDecls;
1703+
list<Absyn.AlgorithmItem> outAlgs1, outAlgs2, matchAlgs;
17041704
list<RenamedPat> rest;
17051705
RenamedPat pat;
17061706
list<Absyn.Exp> varList;
@@ -1768,25 +1768,25 @@ algorithm
17681768

17691769
case (RP_EMPTYLIST(_), var, nequal,info) // Optimizes comparison with emptylist by not creating an empty list to compare with
17701770
equation
1771-
alg = Absyn.ALGORITHMITEM(Absyn.ALG_BREAK, NONE(), info);
1771+
alg = Absyn.ALGORITHMITEM(Absyn.ALG_BREAK(), NONE(), info);
17721772
exp = Absyn.CALL(Absyn.CREF_FULLYQUALIFIED(Absyn.CREF_IDENT("listEmpty",{})), Absyn.FUNCTIONARGS({var}, {}));
17731773
exp = Util.if_(nequal, Absyn.LUNARY(Absyn.NOT(), exp), exp);
17741774
alg = Absyn.ALGORITHMITEM(Absyn.ALG_IF(exp, {alg}, {}, {}), NONE(), info);
17751775
then {alg};
17761776

17771777
case (RP_NONE(_), var, nequal,info) // Optimizes comparison with NONE() by not creating an empty option to compare with
17781778
equation
1779-
alg = Absyn.ALGORITHMITEM(Absyn.ALG_BREAK, NONE(), info);
1779+
alg = Absyn.ALGORITHMITEM(Absyn.ALG_BREAK(), NONE(), info);
17801780
exp = Absyn.CALL(Absyn.CREF_FULLYQUALIFIED(Absyn.CREF_IDENT("optionNone",{})), Absyn.FUNCTIONARGS({var}, {}));
17811781
exp = Util.if_(nequal, Absyn.LUNARY(Absyn.NOT(), exp), exp);
17821782
alg = Absyn.ALGORITHMITEM(Absyn.ALG_IF(exp, {alg}, {}, {}), NONE(), info);
17831783
then {alg};
17841784

17851785
case (pat, var, nequal,info)
17861786
equation
1787-
op = Util.if_(nequal, Absyn.NEQUAL, Absyn.EQUAL);
1787+
op = Util.if_(nequal, Absyn.NEQUAL(), Absyn.EQUAL());
17881788
exp = getPatternExp(pat);
1789-
alg = Absyn.ALGORITHMITEM(Absyn.ALG_BREAK, NONE(), info);
1789+
alg = Absyn.ALGORITHMITEM(Absyn.ALG_BREAK(), NONE(), info);
17901790
alg = Absyn.ALGORITHMITEM(Absyn.ALG_IF(Absyn.RELATION(var,op,exp), {alg}, {}, {}), NONE(), info);
17911791
then {alg};
17921792

@@ -1811,7 +1811,7 @@ algorithm
18111811

18121812
case (pathVar,(DAE.T_METARECORD(index=i),_),numFields,info)
18131813
equation
1814-
alg = Absyn.ALGORITHMITEM(Absyn.ALG_BREAK, NONE(), info);
1814+
alg = Absyn.ALGORITHMITEM(Absyn.ALG_BREAK(), NONE(), info);
18151815
fargs = Absyn.FUNCTIONARGS({Absyn.CREF(Absyn.CREF_IDENT(pathVar,{})),Absyn.INTEGER(i),Absyn.INTEGER(numFields)}, {});
18161816
exp = Absyn.CALL(Absyn.CREF_FULLYQUALIFIED(Absyn.CREF_QUAL("OpenModelicaInternal",{},Absyn.CREF_IDENT("uniontypeMetarecordTypedefEqual",{}))), fargs);
18171817
exp = Absyn.LUNARY(Absyn.NOT(), exp);

Compiler/Inline.mo

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ algorithm
8080
BackendDAE.EquationArray orderedEqs;
8181
BackendDAE.EquationArray removedEqs;
8282
BackendDAE.EquationArray initialEqs;
83-
BackendDAE.MultiDimEquation[:] arrayEqs;
83+
array<BackendDAE.MultiDimEquation> arrayEqs;
8484
list<BackendDAE.MultiDimEquation> mdelst;
85-
Algorithm.Algorithm[:] algorithms;
85+
array<Algorithm.Algorithm> algorithms;
8686
list<Algorithm.Algorithm> alglst;
8787
BackendDAE.EventInfo eventInfo;
8888
BackendDAE.ExternalObjectClasses extObjClasses;
@@ -121,7 +121,7 @@ algorithm
121121
local
122122
Functiontuple fns;
123123
Integer i1,i2;
124-
Option<BackendDAE.Equation>[:] eqarr,eqarr_1;
124+
array<Option<BackendDAE.Equation>> eqarr,eqarr_1;
125125
list<Option<BackendDAE.Equation>> eqlst,eqlst_1;
126126
case(BackendDAE.EQUATION_ARRAY(i1,i2,eqarr),fns)
127127
equation
@@ -251,10 +251,10 @@ algorithm
251251
outVariables := matchcontinue(inVariables,inElementList)
252252
local
253253
Functiontuple fns;
254-
list<BackendDAE.CrefIndex>[:] crefind;
255-
list<BackendDAE.StringIndex>[:] strind;
254+
array<list<BackendDAE.CrefIndex>> crefind;
255+
array<list<BackendDAE.StringIndex>> strind;
256256
Integer i1,i2,i3,i4;
257-
Option<BackendDAE.Var>[:] vararr,vararr_1;
257+
array<Option<BackendDAE.Var>> vararr,vararr_1;
258258
list<Option<BackendDAE.Var>> varlst,varlst_1;
259259
case(BackendDAE.VARIABLES(crefind,strind,BackendDAE.VARIABLE_ARRAY(i3,i4,vararr),i1,i2),fns)
260260
equation

Compiler/MetaUtil.mo

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,6 @@ algorithm
828828
Absyn.TypeSpec tSpec;
829829
list<Absyn.TypeSpec> tSpecList;
830830
String id,str;
831-
DAE.Type t;
832831
list<DAE.Type> tList;
833832
Absyn.Path p;
834833
case ((DAE.T_INTEGER(_),_)) then Absyn.TPATH(Absyn.IDENT("Integer"),NONE());

Compiler/PartFn.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ algorithm
737737
DAE.Element el,el_1,el1,el1_1,el2,el2_1;
738738
list<DAE.Element> elts,elts_1;
739739
DAE.Function fn;
740-
list<DAE.Function> cdr,cdr_1,dae;
740+
list<DAE.Function> cdr,cdr_1;
741741
list<list<DAE.Element>> elm,elm_1;
742742
DAE.ComponentRef cref;
743743
DAE.VarKind kind;

Compiler/Patternm.mo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ algorithm
119119
// Create pattern matrix. The as-bindings ( ... case (var1 as 3) ...)
120120
// are first collected in the fillMatrix function and then
121121
// assignments of these variables are added to the RightHandSide list
122-
patMat = fill({},varListLength);
123-
asBindings = fill({},listLength(rhsList));
122+
patMat = arrayCreate(varListLength,{});
123+
asBindings = arrayCreate(listLength(rhsList),{});
124124
(localCache,patMat,asBindings,_) =
125125
fillMatrix(1,asBindings,varList,patList,patMat,localCache,localEnv,(1,{}),infoList);
126126
rhsList = addAsBindings(rhsList,arrayList(asBindings)); // Add the as-bindings (assignments)

0 commit comments

Comments
 (0)