Skip to content

Commit

Permalink
- Fixed LF eol-style on Compiler/*.mo
Browse files Browse the repository at this point in the history
- Made C code generated by Susan use const char* instead of char*


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@5549 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed May 19, 2010
1 parent 2629277 commit 7d10159
Show file tree
Hide file tree
Showing 14 changed files with 72,830 additions and 72,830 deletions.
112 changes: 56 additions & 56 deletions Compiler/ConnectUtil.mo
@@ -1,32 +1,32 @@
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-CurrentYear, Linköping University,
* Department of Computer and Information Science,
* SE-58183 Linköping, Sweden.
*
* All rights reserved.
*
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3
* AND THIS OSMC PUBLIC LICENSE (OSMC-PL).
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S
* ACCEPTANCE OF THE OSMC PUBLIC LICENSE.
*
* The OpenModelica software and the Open Source Modelica
* Consortium (OSMC) Public License (OSMC-PL) are obtained
* from Linköping University, either from the above address,
* from the URLs: http://www.ida.liu.se/projects/OpenModelica or
* http://www.openmodelica.org, and in the OpenModelica distribution.
* GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html.
*
* This program is distributed WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
* IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS
* OF OSMC-PL.
*
* See the full OSMC Public License conditions for more details.
*
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-CurrentYear, Linköping University,
* Department of Computer and Information Science,
* SE-58183 Linköping, Sweden.
*
* All rights reserved.
*
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3
* AND THIS OSMC PUBLIC LICENSE (OSMC-PL).
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S
* ACCEPTANCE OF THE OSMC PUBLIC LICENSE.
*
* The OpenModelica software and the Open Source Modelica
* Consortium (OSMC) Public License (OSMC-PL) are obtained
* from Linköping University, either from the above address,
* from the URLs: http://www.ida.liu.se/projects/OpenModelica or
* http://www.openmodelica.org, and in the OpenModelica distribution.
* GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html.
*
* This program is distributed WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
* IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS
* OF OSMC-PL.
*
* See the full OSMC Public License conditions for more details.
*
*/

package ConnectUtil
Expand All @@ -51,7 +51,7 @@ public import DAE;
public import Env;
public import InnerOuter;
public import Prefix;
public import ClassInf;
public import ClassInf;
public import ConnectionGraph;

protected import Exp;
Expand Down Expand Up @@ -506,42 +506,42 @@ public function equations "
Equation generation
From a number of connection sets, this function generates a list of equations."
input Connect.Sets sets;
input Prefix.Prefix pre "prefix required for checking deleted components";
input Boolean isTopScope "this is true if we are in a top scope class!";
input Prefix.Prefix pre "prefix required for checking deleted components";
input Boolean isTopScope "this is true if we are in a top scope class!";
input ConnectionGraph.ConnectionGraph inConnectionGraph;
output DAE.DAElist outDAE;
output DAE.DAElist outDAE;
output ConnectionGraph.ConnectionGraph outConnectionGraph;
algorithm
(outDAE, outConnectionGraph) := matchcontinue(sets,pre,isTopScope,inConnectionGraph)
local
list<Connect.Set> s;
list<DAE.ComponentRef> crs,deletedComps;
DAE.ComponentRef cr,deletedComp;
list<Connect.OuterConnect> outerConn;
ConnectionGraph.ConnectionGraph graph;
DAE.DAElist dae;
list<DAE.Element> daeElements, daeEqualityConstraint;
DAE.FunctionTree functions;

list<Connect.OuterConnect> outerConn;
ConnectionGraph.ConnectionGraph graph;
DAE.DAElist dae;
list<DAE.Element> daeElements, daeEqualityConstraint;
DAE.FunctionTree functions;

// no deleted components
case(sets as Connect.SETS(s,crs,{},outerConn),pre,isTopScope,graph)
equation
case(sets as Connect.SETS(s,crs,{},outerConn),pre,isTopScope,graph)
equation
dae = equations2(sets);
then
(dae, graph);
then
(dae, graph);

// handle deleted components
case(Connect.SETS(s,crs,deletedComp::deletedComps,outerConn),pre,isTopScope,graph)
equation
cr = deletedComp;
s = removeComponentInSets(cr,s);
// remove all branches/connections/roots in the connection graph leading to the deleted components
graph = ConnectionGraph.removeDeletedComponentsFromCG(graph, cr);
// recursive call with all the rest of deleted components.
s = removeComponentInSets(cr,s);
// remove all branches/connections/roots in the connection graph leading to the deleted components
graph = ConnectionGraph.removeDeletedComponentsFromCG(graph, cr);
// recursive call with all the rest of deleted components.
(dae, graph) = equations(Connect.SETS(s,crs,deletedComps,outerConn),pre,isTopScope,graph);
then
(dae, graph);


// failure
case(_,_,_,_) equation
Debug.fprint("failtrace", "Connect.equations failed\n");
Expand Down Expand Up @@ -699,18 +699,18 @@ algorithm
DAE.ComponentRef x,y;
list<tuple<DAE.ComponentRef,DAE.ElementSource>> cs;
DAE.ElementSource src,src1,src2;
DAE.FunctionTree funcs;
list<Absyn.Within> partOfLst;
list<Option<DAE.ComponentRef>> instanceOptLst;
list<Option<tuple<DAE.ComponentRef, DAE.ComponentRef>>> connectEquationOptLst;
DAE.FunctionTree funcs;
list<Absyn.Within> partOfLst;
list<Option<DAE.ComponentRef>> instanceOptLst;
list<Option<tuple<DAE.ComponentRef, DAE.ComponentRef>>> connectEquationOptLst;
list<Absyn.Path> typeLst;

case {_} then DAEUtil.emptyDae;
case ((x,src1) :: ((y,src2) :: cs))
equation
DAE.DAE(eq,funcs) = equEquations(((y,src2) :: cs));
DAE.SOURCE(partOfLst, instanceOptLst, connectEquationOptLst, typeLst) = DAEUtil.mergeSources(src1,src2);
// do not propagate connects from different sources! use the crefs directly!
DAE.SOURCE(partOfLst, instanceOptLst, connectEquationOptLst, typeLst) = DAEUtil.mergeSources(src1,src2);
// do not propagate connects from different sources! use the crefs directly!
src = DAE.SOURCE(partOfLst, instanceOptLst, {SOME((x,y))}, typeLst);
then
(DAE.DAE(DAE.EQUEQUATION(x,y,src) :: eq,funcs));
Expand Down Expand Up @@ -1804,8 +1804,8 @@ algorithm
s2 = printSetCrsStr(crs);
s3 = Util.stringDelimitList(Util.listMap(dc,Exp.printComponentRefStr),",");
s4 = printOuterConnectsStr(outerConn);
res = Util.stringAppendList({"Connect.SETS(\n\t",
s1_1,", \n\t",
res = Util.stringAppendList({"Connect.SETS(\n\t",
s1_1,", \n\t",
s2,", \n\tdeleted comps: ",s3,", \n\touter connections:",s4,")\n"});
then
res;
Expand Down
88 changes: 44 additions & 44 deletions Compiler/InnerOuter.mo
@@ -1,32 +1,32 @@
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-CurrentYear, Linköping University,
* Department of Computer and Information Science,
* SE-58183 Linköping, Sweden.
*
* All rights reserved.
*
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3
* AND THIS OSMC PUBLIC LICENSE (OSMC-PL).
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S
* ACCEPTANCE OF THE OSMC PUBLIC LICENSE.
*
* The OpenModelica software and the Open Source Modelica
* Consortium (OSMC) Public License (OSMC-PL) are obtained
* from Linköping University, either from the above address,
* from the URLs: http://www.ida.liu.se/projects/OpenModelica or
* http://www.openmodelica.org, and in the OpenModelica distribution.
* GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html.
*
* This program is distributed WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
* IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS
* OF OSMC-PL.
*
* See the full OSMC Public License conditions for more details.
*
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-CurrentYear, Linköping University,
* Department of Computer and Information Science,
* SE-58183 Linköping, Sweden.
*
* All rights reserved.
*
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3
* AND THIS OSMC PUBLIC LICENSE (OSMC-PL).
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S
* ACCEPTANCE OF THE OSMC PUBLIC LICENSE.
*
* The OpenModelica software and the Open Source Modelica
* Consortium (OSMC) Public License (OSMC-PL) are obtained
* from Linköping University, either from the above address,
* from the URLs: http://www.ida.liu.se/projects/OpenModelica or
* http://www.openmodelica.org, and in the OpenModelica distribution.
* GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html.
*
* This program is distributed WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
* IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS
* OF OSMC-PL.
*
* See the full OSMC Public License conditions for more details.
*
*/
package InnerOuter
"
Expand Down Expand Up @@ -59,7 +59,7 @@ protected import Inst;
protected import ConnectUtil;
protected import RTOpts;
protected import Mod;
protected import PrefixUtil;
protected import PrefixUtil;
protected import ErrorExt;

public
Expand Down Expand Up @@ -596,7 +596,7 @@ algorithm
case(cache,env,ih,pre,{},setLst,crs,_) then ({},setLst,crs,{});

case(cache,env,ih,pre,Connect.OUTERCONNECT(scope,cr1,io1,f1,cr2,io2,f2,source)::outerConnects,setLst,crs,topCall)
equation
equation
cr1first = Exp.crefFirstIdent(cr1);
cr2first = Exp.crefFirstIdent(cr2);
(inner1,outer1) = lookupVarInnerOuterAttr(cache,env,ih,cr1first,cr2first);
Expand All @@ -621,7 +621,7 @@ algorithm
in a special way */
case(cache,env,ih,pre,(oc as Connect.OUTERCONNECT(scope,cr1,io1,f1,cr2,io2,f2,source))::outerConnects,setLst,crs,true)
local Boolean b1,b2,b3,b4;
equation
equation
(b1,b3) = innerOuterBooleans(io1);
(b2,b4) = innerOuterBooleans(io2);
true = boolOr(b1,b2); // for inner outer we set Absyn.INNER()
Expand All @@ -636,7 +636,7 @@ algorithm
/* If no connection set available (added = false), create new one */
setLst = addOuterConnectIfEmptyNoEnv(cache,env,ih,pre,setLst,added,cr1,io1,f1,cr2,io2,f2);
(outerConnects,setLst,crs,innerOuterConnects) =
retrieveOuterConnections2(cache,env,ih,pre,outerConnects,setLst,crs,true);
retrieveOuterConnections2(cache,env,ih,pre,outerConnects,setLst,crs,true);
then
(outerConnects,setLst,crs,innerOuterConnects);

Expand Down Expand Up @@ -804,7 +804,7 @@ end removeOuter;

protected function lookupVarInnerOuterAttr
"searches for two variables in env and retrieves
its inner and outer attributes in form of booleans.
its inner and outer attributes in form of booleans.
adrpo: Make sure that there are no error messages displayed!"
input Env.Cache cache;
input Env env;
Expand All @@ -821,36 +821,36 @@ algorithm
InstHierarchy ih;
// Search for both
case(cache,env,ih,cr1,cr2)
equation
ErrorExt.setCheckpoint("lookupVarInnerOuterAttr");
equation
ErrorExt.setCheckpoint("lookupVarInnerOuterAttr");
(_,DAE.ATTR(innerOuter=io1),_,_,_,_,_) = Lookup.lookupVar(cache,env,cr1);
(_,DAE.ATTR(innerOuter=io2),_,_,_,_,_) = Lookup.lookupVar(cache,env,cr2);
(isInner1,isOuter1) = innerOuterBooleans(io1);
(isInner2,isOuter2) = innerOuterBooleans(io2);
isInner = isInner1 or isInner2;
isOuter = isOuter1 or isOuter2;
isOuter = isOuter1 or isOuter2;
ErrorExt.rollBack("lookupVarInnerOuterAttr");
then
(isInner,isOuter);
// try to find var cr1 (lookup can fail for one of them)
case(cache,env,ih,cr1,cr2)
equation
(_,DAE.ATTR(innerOuter=io),_,_,_,_,_) = Lookup.lookupVar(cache,env,cr1);
(isInner,isOuter) = innerOuterBooleans(io);
(isInner,isOuter) = innerOuterBooleans(io);
ErrorExt.rollBack("lookupVarInnerOuterAttr");
then
(isInner,isOuter);
// ..else try cr2 (lookup can fail for one of them)
case(cache,env,ih,cr1,cr2)
equation
(_,DAE.ATTR(innerOuter=io),_,_,_,_,_) = Lookup.lookupVar(cache,env,cr2);
(isInner,isOuter) = innerOuterBooleans(io);
(isInner,isOuter) = innerOuterBooleans(io);
ErrorExt.rollBack("lookupVarInnerOuterAttr");
then (isInner,isOuter);
// failure
case(cache,env,ih,cr1,cr2)
equation
ErrorExt.rollBack("lookupVarInnerOuterAttr");
then (isInner,isOuter);
// failure
case(cache,env,ih,cr1,cr2)
equation
ErrorExt.rollBack("lookupVarInnerOuterAttr");
then fail();
end matchcontinue;
end lookupVarInnerOuterAttr;
Expand Down

0 comments on commit 7d10159

Please sign in to comment.