Skip to content

Commit

Permalink
- Unescape comments in Interactive.getClassComment
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@8583 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Apr 11, 2011
1 parent e3b0143 commit 6e087b4
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 41 deletions.
78 changes: 40 additions & 38 deletions Compiler/BackEnd/BackendDAEOptimize.mo
Expand Up @@ -448,46 +448,48 @@ algorithm
(eqns_1,(BackendDAE.SOLVED_EQUATION(cr1,e2,source) :: seqns_1),mvars,mvars1,repl_2,extlst1,replc_2,varsAliases);

// alias equation like a=b
case (e::eqns,funcSimpleEquation,vars,knvars,mvars,mvars1,outputs,repl,inExtendLst,replc,varsAliases) equation
{e} = BackendVarTransform.replaceEquations({e},replc);
{e} = BackendVarTransform.replaceEquations({e},repl);
(e1 as DAE.CREF(cr1,t),e2,source) = funcSimpleEquation(e,false);
false = Expression.isConst(e2);
false = BackendVariable.isState(cr1, vars) "cr1 not state";
BackendVariable.isVariable(cr1, vars, knvars) "cr1 not constant";
false = BackendVariable.isTopLevelInputOrOutput(cr1,vars,knvars);
({v},_) = BackendVariable.getVar(cr1,vars);
failure(_ = BackendVariable.varStartValueFail(v));
failure(_ = BackendDAEUtil.treeGet(outputs, cr1)) "cr1 not output of algorithm";
(extlst,_,replc_1) = removeSimpleEquations3(inExtendLst,replc,cr1,NONE(),e2,t);
Debug.fcall("debugAlias",BackendDump.debugStrCrefStrExpStr,("Alias Equation ",cr1," = ",e2," found.\n"));
repl_1 = VarTransform.addReplacement(repl, cr1, e2);
mvars_1 = BackendDAEUtil.treeAdd(mvars1, cr1, 0);
varsAliases = BackendDAEUtil.updateAliasVariables(varsAliases, cr1, e2,v);
(eqns_1,seqns_1,mvars,mvars_1,repl_2,extlst1,replc_2,varsAliases) = removeSimpleEquations2(eqns, funcSimpleEquation, vars, knvars, mvars,mvars_1, outputs, repl_1, extlst,replc_1,varsAliases);
then
(eqns_1,seqns_1,mvars,mvars_1,repl_2,extlst1,replc_2,varsAliases);
case (e::eqns,funcSimpleEquation,vars,knvars,mvars,mvars1,outputs,repl,inExtendLst,replc,varsAliases)
equation
{e} = BackendVarTransform.replaceEquations({e},replc);
{e} = BackendVarTransform.replaceEquations({e},repl);
(e1 as DAE.CREF(cr1,t),e2,source) = funcSimpleEquation(e,false);
false = Expression.isConst(e2);
false = BackendVariable.isState(cr1, vars) "cr1 not state";
BackendVariable.isVariable(cr1, vars, knvars) "cr1 not constant";
false = BackendVariable.isTopLevelInputOrOutput(cr1,vars,knvars);
({v},_) = BackendVariable.getVar(cr1,vars);
failure(_ = BackendVariable.varStartValueFail(v));
failure(_ = BackendDAEUtil.treeGet(outputs, cr1)) "cr1 not output of algorithm";
(extlst,_,replc_1) = removeSimpleEquations3(inExtendLst,replc,cr1,NONE(),e2,t);
Debug.fcall("debugAlias",BackendDump.debugStrCrefStrExpStr,("Alias Equation ",cr1," = ",e2," found.\n"));
repl_1 = VarTransform.addReplacement(repl, cr1, e2);
mvars_1 = BackendDAEUtil.treeAdd(mvars1, cr1, 0);
varsAliases = BackendDAEUtil.updateAliasVariables(varsAliases, cr1, e2,v);
(eqns_1,seqns_1,mvars,mvars_1,repl_2,extlst1,replc_2,varsAliases) = removeSimpleEquations2(eqns, funcSimpleEquation, vars, knvars, mvars,mvars_1, outputs, repl_1, extlst,replc_1,varsAliases);
then
(eqns_1,seqns_1,mvars,mvars_1,repl_2,extlst1,replc_2,varsAliases);

// alias equation like a=b (Swappend args)
case (e::eqns,funcSimpleEquation,vars,knvars,mvars,mvars1,outputs,repl,inExtendLst,replc,varsAliases) equation
{e} = BackendVarTransform.replaceEquations({e},replc);
{BackendDAE.EQUATION(e1,e2,source)} = BackendVarTransform.replaceEquations({e},repl);
(e1 as DAE.CREF(cr1,t),e2,source) = simpleEquation(BackendDAE.EQUATION(e2,e1,source),true);
false = Expression.isConst(e2);
false = BackendVariable.isState(cr1, vars) "cr1 not state";
BackendVariable.isVariable(cr1, vars, knvars) "cr1 not constant";
false = BackendVariable.isTopLevelInputOrOutput(cr1,vars,knvars);
({v},_) = BackendVariable.getVar(cr1,vars);
failure( _ = BackendVariable.varStartValueFail(v));
failure(_ = BackendDAEUtil.treeGet(outputs, cr1)) "cr1 not output of algorithm";
(extlst,_,replc_1) = removeSimpleEquations3(inExtendLst,replc,cr1,NONE(),e2,t);
Debug.fcall("debugAlias",BackendDump.debugStrCrefStrExpStr,("Alias Equation ",cr1," = ",e2," found.\n"));
repl_1 = VarTransform.addReplacement(repl, cr1, e2);
mvars_1 = BackendDAEUtil.treeAdd(mvars1, cr1, 0);
varsAliases = BackendDAEUtil.updateAliasVariables(varsAliases, cr1, e2,v);
(eqns_1,seqns_1,mvars,mvars_1,repl_2,extlst1,replc_2,varsAliases) = removeSimpleEquations2(eqns, funcSimpleEquation, vars, knvars, mvars,mvars_1, outputs, repl_1, extlst,replc_1,varsAliases);
then
(eqns_1,seqns_1,mvars,mvars_1,repl_2,extlst1,replc_2,varsAliases);
case (e::eqns,funcSimpleEquation,vars,knvars,mvars,mvars1,outputs,repl,inExtendLst,replc,varsAliases)
equation
{e} = BackendVarTransform.replaceEquations({e},replc);
{BackendDAE.EQUATION(e1,e2,source)} = BackendVarTransform.replaceEquations({e},repl);
(e1 as DAE.CREF(cr1,t),e2,source) = simpleEquation(BackendDAE.EQUATION(e2,e1,source),true);
false = Expression.isConst(e2);
false = BackendVariable.isState(cr1, vars) "cr1 not state";
BackendVariable.isVariable(cr1, vars, knvars) "cr1 not constant";
false = BackendVariable.isTopLevelInputOrOutput(cr1,vars,knvars);
({v},_) = BackendVariable.getVar(cr1,vars);
failure( _ = BackendVariable.varStartValueFail(v));
failure(_ = BackendDAEUtil.treeGet(outputs, cr1)) "cr1 not output of algorithm";
(extlst,_,replc_1) = removeSimpleEquations3(inExtendLst,replc,cr1,NONE(),e2,t);
Debug.fcall("debugAlias",BackendDump.debugStrCrefStrExpStr,("Alias Equation ",cr1," = ",e2," found.\n"));
repl_1 = VarTransform.addReplacement(repl, cr1, e2);
mvars_1 = BackendDAEUtil.treeAdd(mvars1, cr1, 0);
varsAliases = BackendDAEUtil.updateAliasVariables(varsAliases, cr1, e2,v);
(eqns_1,seqns_1,mvars,mvars_1,repl_2,extlst1,replc_2,varsAliases) = removeSimpleEquations2(eqns, funcSimpleEquation, vars, knvars, mvars,mvars_1, outputs, repl_1, extlst,replc_1,varsAliases);
then
(eqns_1,seqns_1,mvars,mvars_1,repl_2,extlst1,replc_2,varsAliases);

// try next equation.
case ((e :: eqns),funcSimpleEquation,vars,knvars,mvars,mvars1,outputs,repl,extlst,replc,varsAliases)
Expand Down
4 changes: 2 additions & 2 deletions Compiler/BackEnd/BackendDAEUtil.mo
Expand Up @@ -1318,7 +1318,7 @@ end addAliasVariables;
public function updateAliasVariablesDAE
"function: updateAliasVariablesDAE
author: Frenkel TUD 2011-04
update the aliaas variables."
update the alias variables."
input DAE.ComponentRef inCref;
input DAE.Exp inExp;
input BackendDAE.Var inVar;
Expand All @@ -1345,7 +1345,7 @@ end updateAliasVariablesDAE;
public function updateAliasVariables
"function: changeAliasVariables
author: wbraun
replace creaf in AliasVariable variable to the AliasVariables "
replace cref in AliasVariable variable to the AliasVariables "
input BackendDAE.AliasVariables inAliasVariables;
input DAE.ComponentRef inCref;
input DAE.Exp inExp;
Expand Down
2 changes: 1 addition & 1 deletion Compiler/BackEnd/BackendVariable.mo
Expand Up @@ -162,7 +162,7 @@ algorithm
streamPrefix = streamPrefix),fixed)
equation
oattr = DAEUtil.setFixedAttr(SOME(attr),SOME(DAE.BCONST(fixed)));
then BackendDAE.VAR(a,b,c,d,e,f,g,i,source,oattr,s,t,streamPrefix);
then BackendDAE.VAR(a,b,c,d,e,f,g,i,source,oattr,s,t,streamPrefix);

case (BackendDAE.VAR(varName = a,
varKind = b,
Expand Down
1 change: 1 addition & 0 deletions Compiler/Script/Interactive.mo
Expand Up @@ -8449,6 +8449,7 @@ protected function getClassComment
String s;
algorithm
s := getClassComment2(cdef);
s := System.unescapedString(s);
res := stringAppendList({"\"",s,"\""});
end getClassComment;

Expand Down

0 comments on commit 6e087b4

Please sign in to comment.