Skip to content

Commit

Permalink
- Annotations are now preserved in SCode format
Browse files Browse the repository at this point in the history
- make clean now removes .sigx files


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@4407 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Stefan Brus committed Oct 27, 2009
1 parent 50f7aa6 commit 5c0ab04
Show file tree
Hide file tree
Showing 9 changed files with 181 additions and 53 deletions.
28 changes: 14 additions & 14 deletions Compiler/Builtin.mo
@@ -1,9 +1,9 @@
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-2008, Linköpings University,
* Copyright (c) 1998-2008, Link�pings University,
* Department of Computer and Information Science,
* SE-58183 Linköping, Sweden.
* SE-58183 Link�ping, Sweden.
*
* All rights reserved.
*
Expand All @@ -14,7 +14,7 @@
*
* The OpenModelica software and the Open Source Modelica
* Consortium (OSMC) Public License (OSMC-PL) are obtained
* from Linköpings University, either from the above address,
* from Link�pings University, either from the above address,
* from the URL: http://www.ida.liu.se/projects/OpenModelica
* and in the OpenModelica distribution.
*
Expand Down Expand Up @@ -62,19 +62,19 @@ protected import Values;
`Real\', `Integer\' etc.
*/
public constant SCode.Class rlType=SCode.CLASS("RealType",false,false,SCode.R_PREDEFINED_REAL(),
SCode.PARTS({},{},{},{},{},NONE)) " real type ";
SCode.PARTS({},{},{},{},{},{},NONE)) " real type ";

public constant SCode.Class intType=SCode.CLASS("IntegerType",false,false,SCode.R_PREDEFINED_INT(),
SCode.PARTS({},{},{},{},{},NONE));
SCode.PARTS({},{},{},{},{},{},NONE));

public constant SCode.Class strType=SCode.CLASS("StringType",false,false,SCode.R_PREDEFINED_STRING(),
SCode.PARTS({},{},{},{},{},NONE));
SCode.PARTS({},{},{},{},{},{},NONE));

public constant SCode.Class boolType=SCode.CLASS("BooleanType",false,false,SCode.R_PREDEFINED_BOOL(),
SCode.PARTS({},{},{},{},{},NONE));
SCode.PARTS({},{},{},{},{},{},NONE));

protected constant SCode.Class enumType=SCode.CLASS("EnumType",false,false,SCode.R_PREDEFINED_ENUM(),
SCode.PARTS({},{},{},{},{},NONE));
SCode.PARTS({},{},{},{},{},{},NONE));

protected constant SCode.Element unit=SCode.COMPONENT("unit",Absyn.UNSPECIFIED(),true,false,false,
SCode.ATTR({},false,false,SCode.RW(),SCode.PARAM(),Absyn.BIDIR()),Absyn.TPATH(Absyn.IDENT("StringType"),NONE),
Expand Down Expand Up @@ -141,25 +141,25 @@ protected constant list<SCode.Element> stateSelectComps={
SCode.ATTR({},false,false,SCode.RO(),SCode.CONST(),Absyn.BIDIR()),Absyn.TPATH(Absyn.IDENT("EnumType"),NONE),SCode.NOMOD(),NONE,NONE,NONE,NONE,NONE)} "The StateSelect enumeration" ;

protected constant SCode.Class stateSelectType=SCode.CLASS("StateSelect",false,false,SCode.R_ENUMERATION(),
SCode.PARTS(stateSelectComps,{},{},{},{},NONE)) "The State Select Type" ;
SCode.PARTS(stateSelectComps,{},{},{},{},{},NONE)) "The State Select Type" ;

public constant SCode.Class ExternalObjectType=SCode.CLASS("ExternalObject",false,false,SCode.R_CLASS(),
SCode.PARTS(
{},{},{},{},{},NONE)) "ExternalObject type" ;
{},{},{},{},{},{},NONE)) "ExternalObject type" ;

public constant SCode.Class realType=SCode.CLASS("Real",false,false,SCode.R_PREDEFINED_REAL(),
SCode.PARTS(
{unit,quantity,displayUnit,min,max,realStart,fixed,nominal,
stateSelect},{},{},{},{},NONE)) "- The `Real\' type" ;
stateSelect},{},{},{},{},{},NONE)) "- The `Real\' type" ;

protected constant SCode.Class integerType=SCode.CLASS("Integer",false,false,SCode.R_PREDEFINED_INT(),
SCode.PARTS({quantity,min,max,integerStart,fixed},{},{},{},{},NONE)) "- The `Integer\' type" ;
SCode.PARTS({quantity,min,max,integerStart,fixed},{},{},{},{},{},NONE)) "- The `Integer\' type" ;

protected constant SCode.Class stringType=SCode.CLASS("String",false,false,SCode.R_PREDEFINED_STRING(),
SCode.PARTS({quantity,stringStart},{},{},{},{},NONE)) "- The `String\' type" ;
SCode.PARTS({quantity,stringStart},{},{},{},{},{},NONE)) "- The `String\' type" ;

protected constant SCode.Class booleanType=SCode.CLASS("Boolean",false,false,SCode.R_PREDEFINED_BOOL(),
SCode.PARTS({quantity,booleanStart,fixed},{},{},{},{},NONE)) "- The `Boolean\' type" ;
SCode.PARTS({quantity,booleanStart,fixed},{},{},{},{},{},NONE)) "- The `Boolean\' type" ;

protected constant Types.Var timeVar=Types.VAR("time",
Types.ATTR(false,false,SCode.RO(),SCode.VAR(),Absyn.BIDIR(),Absyn.UNSPECIFIED()),false,(Types.T_REAL({}),NONE),Types.UNBOUND()) "- The `time\' variable" ;
Expand Down
8 changes: 4 additions & 4 deletions Compiler/Ceval.mo
@@ -1,9 +1,9 @@
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-2008, Linköpings University,
* Copyright (c) 1998-2008, Link�pings University,
* Department of Computer and Information Science,
* SE-58183 Linköping, Sweden.
* SE-58183 Link�ping, Sweden.
*
* All rights reserved.
*
Expand All @@ -14,7 +14,7 @@
*
* The OpenModelica software and the Open Source Modelica
* Consortium (OSMC) Public License (OSMC-PL) are obtained
* from Linköpings University, either from the above address,
* from Link�pings University, either from the above address,
* from the URL: http://www.ida.liu.se/projects/OpenModelica
* and in the OpenModelica distribution.
*
Expand Down Expand Up @@ -1264,7 +1264,7 @@ protected function cevalKnownExternalFuncs "function: cevalKnownExternalFuncs
list<Absyn.Exp> args;
algorithm
(outCache,cdef,env_1) := Lookup.lookupClass(inCache,env, funcpath, false);
SCode.CLASS(fid,_,_,SCode.R_EXT_FUNCTION(),SCode.PARTS(_,_,_,_,_,extdecl)) := cdef;
SCode.CLASS(fid,_,_,SCode.R_EXT_FUNCTION(),SCode.PARTS(_,_,_,_,_,_,extdecl)) := cdef;
SOME(Absyn.EXTERNALDECL(id,lan,out,args,_)) := extdecl;
isKnownExternalFunc(fid, id);
res := cevalKnownExternalFuncs2(fid, id, vals, msg);
Expand Down
8 changes: 4 additions & 4 deletions Compiler/Cevalfunc.mo
Expand Up @@ -55,7 +55,7 @@ algorithm
Absyn.Path funcpath;
list<Exp.Exp> crefArgs;
String str;
case(env,(callExp as Exp.CALL(path = funcpath,expLst = crefArgs)),inArgs, sc as SCode.CLASS(_,false,_,SCode.R_FUNCTION(),SCode.PARTS(elementList,_,_,_,_,_) ),daeList)
case(env,(callExp as Exp.CALL(path = funcpath,expLst = crefArgs)),inArgs, sc as SCode.CLASS(_,false,_,SCode.R_FUNCTION(),SCode.PARTS(elementList,_,_,_,_,_,_) ),daeList)
equation
str = Absyn.pathString(funcpath);
str = Util.stringAppendList({"cevalfunc_",str});
Expand All @@ -66,15 +66,15 @@ algorithm
retVal = convertOutputVarValues(retVals);
then
retVal;
case(env,(callExp as Exp.CALL(path = funcpath,expLst = crefArgs)),inArgs, sc as SCode.CLASS(_,false,_,SCode.R_FUNCTION(),SCode.PARTS(elementList,_,_,_,_,_) ),daeList)
case(env,(callExp as Exp.CALL(path = funcpath,expLst = crefArgs)),inArgs, sc as SCode.CLASS(_,false,_,SCode.R_FUNCTION(),SCode.PARTS(elementList,_,_,_,_,_,_) ),daeList)
equation
_ = extendEnvWithInputArgs(env,elementList,inArgs,crefArgs);
str = Absyn.pathString(funcpath);
str = Util.stringAppendList({"- Cevalfunc.evaluateStatements failed for function /* ",str," */\n"});
Debug.fprint("failtrace", str);
then
fail();
case(env,(callExp as Exp.CALL(path = funcpath,expLst = crefArgs)),inArgs, sc as SCode.CLASS(_,false,_,SCode.R_FUNCTION(),SCode.PARTS(elementList,_,_,_,_,_) ),daeList)
case(env,(callExp as Exp.CALL(path = funcpath,expLst = crefArgs)),inArgs, sc as SCode.CLASS(_,false,_,SCode.R_FUNCTION(),SCode.PARTS(elementList,_,_,_,_,_,_) ),daeList)
equation
failure(_ = extendEnvWithInputArgs(env,elementList,inArgs,crefArgs));
str = Absyn.pathString(funcpath);
Expand Down Expand Up @@ -345,7 +345,7 @@ algorithm outVal := matchcontinue(env,sc)
list<SCode.Equation> eqs1,eqs2;
list<SCode.Algorithm> algs1,algs2;
Env.Env env1;
case(env, SCode.CLASS(_,false,_,SCode.R_FUNCTION(),SCode.PARTS(_,eqs1,eqs2,algs1,algs2,_)) )
case(env, SCode.CLASS(_,false,_,SCode.R_FUNCTION(),SCode.PARTS(_,_,eqs1,eqs2,algs1,algs2,_)) )
equation
env1 = evaluateAlgorithmsList(env,algs1);
then
Expand Down
10 changes: 5 additions & 5 deletions Compiler/DFA.mo
@@ -1,9 +1,9 @@
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-2008, Linköpings University,
* Copyright (c) 1998-2008, Link�pings University,
* Department of Computer and Information Science,
* SE-58183 Linköping, Sweden.
* SE-58183 Link�ping, Sweden.
*
* All rights reserved.
*
Expand All @@ -14,7 +14,7 @@
*
* The OpenModelica software and the Open Source Modelica
* Consortium (OSMC) Public License (OSMC-PL) are obtained
* from Linköpings University, either from the above address,
* from Link�pings University, either from the above address,
* from the URL: http://www.ida.liu.se/projects/OpenModelica
* and in the OpenModelica distribution.
*
Expand Down Expand Up @@ -952,13 +952,13 @@ algorithm
list<Absyn.Ident> fNameList;
list<Absyn.TypeSpec> fTypes;
list<SCode.Element> elemList;
case (SCode.CLASS(_,_,_,_,SCode.PARTS(elemList,_,_,_,_,_)))
case (SCode.CLASS(_,_,_,_,SCode.PARTS(elemList,_,_,_,_,_,_)))
equation
fNameList = Util.listMap(elemList,extractFieldName);
fTypes = Util.listMap(elemList,extractFieldType);
then (fNameList,fTypes);
/* adrpo: handle also the case model extends X end X; */
case (SCode.CLASS(_,_,_,_,SCode.CLASS_EXTENDS(_,_,elemList,_,_,_,_)))
case (SCode.CLASS(_,_,_,_,SCode.CLASS_EXTENDS(_,_,elemList,_,_,_,_,_)))
equation
fNameList = Util.listMap(elemList,extractFieldName);
fTypes = Util.listMap(elemList,extractFieldType);
Expand Down
18 changes: 9 additions & 9 deletions Compiler/Inst.mo
@@ -1,9 +1,9 @@
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-2008, Link�pings University,
* Copyright (c) 1998-2008, Link�pings University,
* Department of Computer and Information Science,
* SE-58183 Link�ping, Sweden.
* SE-58183 Link�ping, Sweden.
*
* All rights reserved.
*
Expand All @@ -14,7 +14,7 @@
*
* The OpenModelica software and the Open Source Modelica
* Consortium (OSMC) Public License (OSMC-PL) are obtained
* from Link�pings University, either from the above address,
* from Link�pings University, either from the above address,
* from the URL: http://www.ida.liu.se/projects/OpenModelica
* and in the OpenModelica distribution.
*
Expand Down Expand Up @@ -6540,7 +6540,7 @@ algorithm
case (cache,_,_,_,cl as SCode.CLASS(name = "String"),_,_) then (cache,{},cl);
case (cache,_,_,_,cl as SCode.CLASS(name = "Boolean"),_,_) then (cache,{},cl);

case (cache,_,_,_,cl as SCode.CLASS(restriction = SCode.R_RECORD(), classDef = SCode.PARTS(_,_,_,_,_,_)),_,_) then (cache,{},cl);
case (cache,_,_,_,cl as SCode.CLASS(restriction = SCode.R_RECORD(), classDef = SCode.PARTS(_,_,_,_,_,_,_)),_,_) then (cache,{},cl);

/*------------------------*/
/* MetaModelica extension */
Expand Down Expand Up @@ -6611,7 +6611,7 @@ algorithm

/* extended classes type Y = Real[3]; class X extends Y; */
case (cache,env,mods,pre,SCode.CLASS(name = id,restriction = _,
classDef = SCode.PARTS(els,{},{},{},{},_)),
classDef = SCode.PARTS(els,{},{},{},{},{},_)),
dims,impl)
local list<SCode.Element> els, extendsels; SCode.Path path;
equation
Expand Down Expand Up @@ -7808,7 +7808,7 @@ algorithm
equation
typePath = Absyn.crefToPath(cr);
/* make sure is an enumeration! */
(_, SCode.CLASS(_, _, _, SCode.R_ENUMERATION(), SCode.PARTS(elementLst, {}, {}, {}, {}, NONE())), _) =
(_, SCode.CLASS(_, _, _, SCode.R_ENUMERATION(), SCode.PARTS(elementLst, {}, {}, {}, {}, {}, NONE())), _) =
Lookup.lookupClass(cache, env, typePath, false);
i = listLength(elementLst);
(cache,l) = elabArraydimDecl(cache,env, cref, ds, impl, st,doVect);
Expand Down Expand Up @@ -8382,7 +8382,7 @@ algorithm
case (cache,env,ih,SCode.CLASS(name = id,partialPrefix = p,encapsulatedPrefix = e,restriction = r,
classDef = SCode.PARTS(elementLst = elts,externalDecl=extDecl)))
equation
stripped_class = SCode.CLASS(id,p,e,r,SCode.PARTS(elts,{},{},{},{},extDecl));
stripped_class = SCode.CLASS(id,p,e,r,SCode.PARTS(elts,{},{},{},{},{},extDecl));
(cache,env_1,ih,_) = implicitFunctionInstantiation(cache,env,ih, Types.NOMOD(), Prefix.NOPRE(), Connect.emptySet, stripped_class, {});
then
(cache,env_1,ih);
Expand Down Expand Up @@ -8996,7 +8996,7 @@ protected function instEnumeration
list<SCode.Element> comp;
algorithm
comp := makeEnumComponents(l);
outClass := SCode.CLASS(n,false,false,SCode.R_ENUMERATION(),SCode.PARTS(comp,{},{},{},{},NONE));
outClass := SCode.CLASS(n,false,false,SCode.R_ENUMERATION(),SCode.PARTS(comp,{},{},{},{},{},NONE));
end instEnumeration;


Expand Down Expand Up @@ -9837,7 +9837,7 @@ algorithm

typePath = Absyn.crefToPath(cr);
/* make sure is an enumeration! */
(_, SCode.CLASS(_, _, _, SCode.R_ENUMERATION(), SCode.PARTS(elementLst, {}, {}, {}, {}, NONE())), _) =
(_, SCode.CLASS(_, _, _, SCode.R_ENUMERATION(), SCode.PARTS(elementLst, {}, {}, {}, {}, {}, NONE())), _) =
Lookup.lookupClass(cache, env, typePath, false);
len = listLength(elementLst);
env_1 = addForLoopScope(env, i, (Types.T_INTEGER({}),NONE())) "//Debug.fprintln (\"insti\", \"for expression elaborated\") &" ;
Expand Down
8 changes: 4 additions & 4 deletions Compiler/Lookup.mo
@@ -1,9 +1,9 @@
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-2008, Linköpings University,
* Copyright (c) 1998-2008, Link�pings University,
* Department of Computer and Information Science,
* SE-58183 Linköping, Sweden.
* SE-58183 Link�ping, Sweden.
*
* All rights reserved.
*
Expand All @@ -14,7 +14,7 @@
*
* The OpenModelica software and the Open Source Modelica
* Consortium (OSMC) Public License (OSMC-PL) are obtained
* from Linköpings University, either from the above address,
* from Link�pings University, either from the above address,
* from the URL: http://www.ida.liu.se/projects/OpenModelica
* and in the OpenModelica distribution.
*
Expand Down Expand Up @@ -1799,7 +1799,7 @@ algorithm
initStmts = {SCode.ALGORITHM(initAbsynStmts,NONE())};
then
SCode.CLASS(id,false,false,SCode.R_FUNCTION(),
SCode.PARTS((reselt :: funcelts),{},{},initStmts,{},NONE));
SCode.PARTS((reselt :: funcelts),{},{},{},initStmts,{},NONE));
case (cl,env) equation
print("buildRecordConstructorClass failed\n");
then fail();
Expand Down

0 comments on commit 5c0ab04

Please sign in to comment.