Skip to content

Commit

Permalink
- small update for the upcoming version of MMC/RML & OMDev
Browse files Browse the repository at this point in the history
- variable name changes to differentiate them from function names


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@2708 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Feb 15, 2007
1 parent f3963ab commit 220343b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
6 changes: 3 additions & 3 deletions Compiler/Codegen.mo
Expand Up @@ -5367,16 +5367,16 @@ algorithm
CFunction fn,restfn,resfn;
list<DAE.Element> rest;
Types.Type tp;
Boolean isOutput;
Boolean b_isOutput;
Integer i1;

case ({},i,tnr) then (cEmptyFunction,tnr);
case ((var :: rest),i,tnr)
equation
DAE.VAR(componentRef = cref,varible = vk,variable = vd,input_ = ty,one = value,binding = dims,dimension = start,fullType=tp) = var;
true = isArray(var);
isOutput = isOutput(var);
i1 = Util.if_(isOutput,i+1,i);
b_isOutput = isOutput(var);
i1 = Util.if_(b_isOutput,i+1,i);
cref_1 = varNameExternalCref(cref);
dims_1 = listReverse(dims);
extvar = DAE.VAR(cref_1,vk,vd,ty,value,dims_1,NONE,DAE.NON_FLOW(),{},NONE,
Expand Down
22 changes: 11 additions & 11 deletions Compiler/Exp.mo
Expand Up @@ -3130,19 +3130,19 @@ algorithm
Type tp;
list<Ident> explst;
Ident str;
Boolean isZero,b1,b2;
Boolean b_isZero,b1,b2;
case ({}) then RCONST(1.0);
case ({e1})
equation
isZero = isZero(e1);
res = Util.if_(isZero,makeConstZero(typeof(e1)),e1);
b_isZero = isZero(e1);
res = Util.if_(b_isZero,makeConstZero(typeof(e1)),e1);
then res;
case ((e :: es)) /* to prevent infinite recursion, disregard constant 1. */
equation
true = isConstOne(e);
res = makeProductLst(es);
isZero = isZero(res);
res = Util.if_(isZero,makeConstZero(typeof(e)),res);
b_isZero = isZero(res);
res = Util.if_(b_isZero,makeConstZero(typeof(e)),res);
then
res;
case ((e :: es)) /* to prevent infinite recursion, disregard constant 0. */
Expand All @@ -3160,20 +3160,20 @@ algorithm
equation
b1 = isZero(e1);
b2 = isZero(e2);
isZero = boolOr(b1,b2);
b_isZero = boolOr(b1,b2);
tp = typeof(e1) "Take type info from e1, ok since type checking already performed." ;
tp = checkIfOther(tp);
res = BINARY(e1,MUL(tp),e2);
res = Util.if_(isZero,makeConstZero(tp),res);
res = Util.if_(b_isZero,makeConstZero(tp),res);
then
res;
case ((BINARY(exp1 = e1,operator = DIV(ty = tp),exp2 = e) :: es))
equation
true = isConstOne(e1);
p1 = makeProductLst(es);
res = BINARY(p1,DIV(tp),e);
isZero = isZero(p1);
res = Util.if_(isZero,makeConstZero(typeof(e)),res);
b_isZero = isZero(p1);
res = Util.if_(b_isZero,makeConstZero(typeof(e)),res);
then
res;
case ((e1 :: rest))
Expand All @@ -3184,8 +3184,8 @@ algorithm
res = BINARY(e1,MUL(tp),e2);
b1 = isZero(e1);
b2 = isZero(e2);
isZero = boolOr(b1,b2);
res = Util.if_(isZero,makeConstZero(typeof(e1)),res);
b_isZero = boolOr(b1,b2);
res = Util.if_(b_isZero,makeConstZero(typeof(e1)),res);
then
res;
case (lst)
Expand Down
13 changes: 7 additions & 6 deletions Compiler/Inst.mo
Expand Up @@ -2029,7 +2029,7 @@ algorithm
list<SCode.Element> cdefelts,extendselts,els,allEls;
list<Env.Frame> env1,env2,env,cenv,cenv_2,env_2,env3;
Types.Mod emods,mods,m,mod_1,mods_1,mods_2;
list<tuple<SCode.Element, Mod>> extcomps,allEls2,constantEls;
list<tuple<SCode.Element, Mod>> extcomps,allEls2,lst_constantEls;
list<SCode.Equation> eqs2,initeqs2,eqs,initeqs;
list<SCode.Algorithm> alg2,initalg2,alg,initalg;
Prefix.Prefix pre;
Expand All @@ -2055,13 +2055,14 @@ algorithm
(cache,env2,emods,extcomps,eqs2,initeqs2,alg2,initalg2) = partialInstExtendsList(cache,env1, mods, extendselts, ci_state, true) "2. EXTENDS Nodes inst_extends_list only flatten inhteritance structure. It does not perform component instantiations." ;
allEls = listAppend(extendselts,els);
allEls2=addNomod(allEls);
constantEls = constantEls(allEls2) " Retrieve all constants";
env3 = addComponentsToEnv(env2, mods, pre, csets, ci_state, constantEls, constantEls,
{}, inst_dims, false);
(cache,_,env3,_,ci_state2,_) = instElementList(cache,env3, mods, pre, csets, ci_state1, constantEls, inst_dims, true) "instantiate constants";
lst_constantEls = constantEls(allEls2) " Retrieve all constants";
env3 = addComponentsToEnv(env2, mods, pre, csets, ci_state,
lst_constantEls, lst_constantEls, {}, inst_dims, false);
(cache,_,env3,_,ci_state2,_) =
instElementList(cache,env3, mods, pre, csets, ci_state1, lst_constantEls, inst_dims, true) "instantiate constants";
then
(cache,env3,ci_state2);

case (cache,env,mods,pre,csets,ci_state,SCode.DERIVED(Absyn.TPATH(path = cn, arrayDim = ad),mod = mod),re,prot,inst_dims) /* This rule describes how to instantiate a derived class definition */
equation
(cache,(c as SCode.CLASS(cn2,_,enc2,r,_)),cenv) = Lookup.lookupClass(cache,env, cn, true);
Expand Down

0 comments on commit 220343b

Please sign in to comment.