Skip to content

Commit

Permalink
Some refactoring
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@16747 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Aug 6, 2013
1 parent 2739ef3 commit 1b53b39
Show file tree
Hide file tree
Showing 19 changed files with 1,251 additions and 1,268 deletions.
2 changes: 1 addition & 1 deletion Compiler/BackEnd/Causalize.mo
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public partial function stateDeselectionFunc
output BackendDAE.BackendDAE outDAE;
end stateDeselectionFunc;

public type DAEHandler = tuple<StructurallySingularSystemHandlerFunc,String,stateDeselectionFunc,String>;
protected type DAEHandler = tuple<StructurallySingularSystemHandlerFunc,String,stateDeselectionFunc,String>;

/*
* public part
Expand Down
28 changes: 14 additions & 14 deletions Compiler/BackEnd/SimCodeUtil.mo
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ algorithm
list<String> includes, libs, fn_libs, fn_includes, fn_includeDirs, rt, rt_1;
Absyn.Path fpath;
list<DAE.FuncArg> args;
Types.Type restype, tp;
DAE.Type restype, tp;
list<DAE.ExtArg> extargs;
list<SimCode.SimExtArg> simextargs;
SimCode.SimExtArg extReturn;
Expand Down Expand Up @@ -877,15 +877,15 @@ end elaborateFunction;
protected function typesSimFunctionArg
"function: generateFunctionArgs
Generates code from a function argument."
input Types.FuncArg inFuncArg;
input DAE.FuncArg inFuncArg;
output SimCode.Variable outVar;
algorithm
outVar := matchcontinue (inFuncArg)
local
Types.Type tty;
DAE.Type tty;
String name;
DAE.ComponentRef cref_;
list<Types.FuncArg> args;
list<DAE.FuncArg> args;
DAE.Type res_ty;
list<SimCode.Variable> var_args;
list<DAE.Type> tys;
Expand Down Expand Up @@ -5425,7 +5425,7 @@ algorithm
local
DAE.Element var;
list<DAE.Element> rest;
Types.Type ft;
DAE.Type ft;
list<String> rt, rt_1, rt_2;
list<SimCode.RecordDeclaration> accRecDecls;
DAE.Algorithm algorithm_;
Expand Down Expand Up @@ -5461,7 +5461,7 @@ end elaborateRecordDeclarations;
protected function elaborateRecordDeclarationsForRecord
"function generateRecordDeclarations
Helper function to generateStructsForRecords."
input Types.Type inRecordType;
input DAE.Type inRecordType;
input list<SimCode.RecordDeclaration> inAccRecordDecls;
input list<String> inReturnTypes;
output list<SimCode.RecordDeclaration> outRecordDecls;
Expand All @@ -5471,7 +5471,7 @@ algorithm
matchcontinue (inRecordType, inAccRecordDecls, inReturnTypes)
local
Absyn.Path path, name;
list<Types.Var> varlst;
list<DAE.Var> varlst;
String sname;
list<String> rt, rt_1, rt_2, fieldNames;
list<SimCode.RecordDeclaration> accRecDecls;
Expand Down Expand Up @@ -5529,16 +5529,16 @@ end generateVarName;
protected function elaborateNestedRecordDeclarations
"function elaborateNestedRecordDeclarations
Helper function to elaborateRecordDeclarations."
input list<Types.Var> inRecordTypes;
input list<DAE.Var> inRecordTypes;
input list<SimCode.RecordDeclaration> inAccRecordDecls;
input list<String> inReturnTypes;
output list<SimCode.RecordDeclaration> outRecordDecls;
output list<String> outReturnTypes;
algorithm
(outRecordDecls, outReturnTypes) := matchcontinue (inRecordTypes, inAccRecordDecls, inReturnTypes)
local
Types.Type ty;
list<Types.Var> rest;
DAE.Type ty;
list<DAE.Var> rest;
list<String> rt, rt_1, rt_2;
list<SimCode.RecordDeclaration> accRecDecls;
case ({}, accRecDecls, rt)
Expand Down Expand Up @@ -8669,13 +8669,13 @@ algorithm
end scodeParallelismToDAEParallelism;

protected function typesVarNoBinding
input Types.Var inTypesVar;
input DAE.Var inTypesVar;
output SimCode.Variable outVar;
algorithm
outVar := match (inTypesVar)
local
String name;
Types.Type ty;
DAE.Type ty;
DAE.ComponentRef cref_;
DAE.Attributes attr;
SCode.Parallelism scPrl;
Expand All @@ -8692,13 +8692,13 @@ algorithm
end typesVarNoBinding;

protected function typesVar
input Types.Var inTypesVar;
input DAE.Var inTypesVar;
output SimCode.Variable outVar;
algorithm
outVar := match (inTypesVar)
local
String name;
Types.Type ty;
DAE.Type ty;
DAE.ComponentRef cref_;
DAE.Attributes attr;
SCode.Parallelism scPrl;
Expand Down
2 changes: 1 addition & 1 deletion Compiler/BackEnd/XMLDump.mo
Original file line number Diff line number Diff line change
Expand Up @@ -3717,7 +3717,7 @@ function: unparseCommentOptionNoAnnotation
algorithm
outString:=
matchcontinue (inAbsynCommentOption)
local Dump.Ident str,cmt;
local String str,cmt;
case (SOME(SCode.COMMENT(_,SOME(cmt))))
equation
//str = stringAppendList({" \"",cmt,"\""});
Expand Down
4 changes: 2 additions & 2 deletions Compiler/FrontEnd/AbsynDep.mo
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ algorithm
end match;
end getUsesTransitive2Lst;

public function getUsedBy "returns the classes that uses the class 'cl' e.g. as a component"
protected function getUsedBy "returns the classes that uses the class 'cl' e.g. as a component"
input Depends depends;
input Absyn.Path cl;
output AvlTree usedBy;
Expand All @@ -291,7 +291,7 @@ algorithm
end matchcontinue;
end getUsedBy;

public function getUsedBySub "
protected function getUsedBySub "
Author BZ, 2009-10
If inpu cl is 'A.B' it returns classes using A.B, but also classes that uses A.B.C.D and A.B.R, it returns all classes that equals or are a subpath of provided path.
"
Expand Down
16 changes: 8 additions & 8 deletions Compiler/FrontEnd/Builtin.mo
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ protected constant DAE.Type T_STRING_ARRAY_9_DEFAULT = DAE.T_ARRAY(DAE.T_STRING_

protected constant DAE.Type T_UNKNOWN_ARRAY_1_DEFAULT = DAE.T_ARRAY(DAE.T_UNKNOWN_DEFAULT, {DAE.DIM_INTEGER(1)}, DAE.emptyTypeSource);

public constant SCode.Prefixes commonPrefixes =
protected constant SCode.Prefixes commonPrefixes =
SCode.PREFIXES(
SCode.PUBLIC(),
SCode.NOT_REDECLARE(),
SCode.FINAL(), // make everything here final!
Absyn.NOT_INNER_OUTER(),
SCode.NOT_REPLACEABLE());

public constant SCode.Prefixes commonPrefixesNotFinal =
protected constant SCode.Prefixes commonPrefixesNotFinal =
SCode.PREFIXES(
SCode.PUBLIC(),
SCode.NOT_REDECLARE(),
Expand All @@ -145,16 +145,16 @@ constant SCode.Attributes attrParamVectorNoDim = SCode.ATTR({Absyn.NOSUB()},SCod
// The primitive types
// These are the primitive types that are used to build the types
// Real, Integer etc.
public constant SCode.Element rlType = SCode.CLASS("RealType",commonPrefixes,SCode.NOT_ENCAPSULATED(),SCode.NOT_PARTIAL(),SCode.R_PREDEFINED_REAL(),
protected constant SCode.Element rlType = SCode.CLASS("RealType",commonPrefixes,SCode.NOT_ENCAPSULATED(),SCode.NOT_PARTIAL(),SCode.R_PREDEFINED_REAL(),
SCode.PARTS({},{},{},{},{},{},{},NONE()),SCode.noComment,Absyn.dummyInfo) " real type ";

public constant SCode.Element intType = SCode.CLASS("IntegerType",commonPrefixes,SCode.NOT_ENCAPSULATED(),SCode.NOT_PARTIAL(),SCode.R_PREDEFINED_INTEGER(),
protected constant SCode.Element intType = SCode.CLASS("IntegerType",commonPrefixes,SCode.NOT_ENCAPSULATED(),SCode.NOT_PARTIAL(),SCode.R_PREDEFINED_INTEGER(),
SCode.PARTS({},{},{},{},{},{},{},NONE()),SCode.noComment,Absyn.dummyInfo);

public constant SCode.Element strType = SCode.CLASS("StringType",commonPrefixes,SCode.NOT_ENCAPSULATED(),SCode.NOT_PARTIAL(),SCode.R_PREDEFINED_STRING(),
protected constant SCode.Element strType = SCode.CLASS("StringType",commonPrefixes,SCode.NOT_ENCAPSULATED(),SCode.NOT_PARTIAL(),SCode.R_PREDEFINED_STRING(),
SCode.PARTS({},{},{},{},{},{},{},NONE()),SCode.noComment,Absyn.dummyInfo);

public constant SCode.Element boolType = SCode.CLASS("BooleanType",commonPrefixes,SCode.NOT_ENCAPSULATED(),SCode.NOT_PARTIAL(),SCode.R_PREDEFINED_BOOLEAN(),
protected constant SCode.Element boolType = SCode.CLASS("BooleanType",commonPrefixes,SCode.NOT_ENCAPSULATED(),SCode.NOT_PARTIAL(),SCode.R_PREDEFINED_BOOLEAN(),
SCode.PARTS({},{},{},{},{},{},{},NONE()),SCode.noComment,Absyn.dummyInfo);

protected constant SCode.Element enumType = SCode.CLASS("EnumType",commonPrefixes,SCode.NOT_ENCAPSULATED(),SCode.NOT_PARTIAL(),SCode.R_PREDEFINED_ENUMERATION(),
Expand Down Expand Up @@ -252,11 +252,11 @@ protected constant SCode.Element stateSelectType = SCode.CLASS("StateSelect",com
protected constant SCode.Element uncertaintyType = SCode.CLASS("Uncertainty",commonPrefixes,SCode.NOT_ENCAPSULATED(),SCode.NOT_PARTIAL(),SCode.R_ENUMERATION(),
SCode.PARTS(uncertaintyComps,{},{},{},{},{},{},NONE()),SCode.noComment,Absyn.dummyInfo) "The Uncertainty Type";

public constant SCode.Element ExternalObjectType = SCode.CLASS("ExternalObject",commonPrefixes,SCode.NOT_ENCAPSULATED(),SCode.NOT_PARTIAL(),SCode.R_CLASS(),
protected constant SCode.Element ExternalObjectType = SCode.CLASS("ExternalObject",commonPrefixes,SCode.NOT_ENCAPSULATED(),SCode.NOT_PARTIAL(),SCode.R_CLASS(),
SCode.PARTS({},{},{},{},{},{},{},NONE()),SCode.noComment,Absyn.dummyInfo) "ExternalObject type" ;

// The Real type
public constant SCode.Element realType = SCode.CLASS("Real",commonPrefixes,SCode.NOT_ENCAPSULATED(),SCode.NOT_PARTIAL(),SCode.R_PREDEFINED_REAL(),
protected constant SCode.Element realType = SCode.CLASS("Real",commonPrefixes,SCode.NOT_ENCAPSULATED(),SCode.NOT_PARTIAL(),SCode.R_PREDEFINED_REAL(),
SCode.PARTS({unit,quantity,displayUnit,min,max,realStart,fixed,nominal,
stateSelect,uncertainty,distribution,startOrigin},{},{},{},{},{},{},NONE()),SCode.noComment,Absyn.dummyInfo) "- The `Real\' type" ;

Expand Down
11 changes: 5 additions & 6 deletions Compiler/FrontEnd/CevalFunction.mo
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ protected import Util;
protected import ValuesUtil;

// [TYPE] Types
public type SymbolTable = Option<Interactive.SymbolTable>;

protected type SymbolTable = Option<Interactive.SymbolTable>;
protected type FunctionVar = tuple<DAE.Element, Option<Values.Value>>;

// LoopControl is used to control the functions behaviour in different
Expand All @@ -102,10 +101,10 @@ public function evaluate
input Env.Env inEnv;
input DAE.Function inFunction;
input list<Values.Value> inFunctionArguments;
input SymbolTable inST;
input Option<Interactive.SymbolTable> inST;
output Env.Cache outCache;
output Values.Value outResult;
output SymbolTable outST;
output Option<Interactive.SymbolTable> outST;
algorithm
(outCache, outResult, outST) :=
matchcontinue(inCache, inEnv, inFunction, inFunctionArguments, inST)
Expand Down Expand Up @@ -2120,10 +2119,10 @@ public function assignVector
input list<DAE.Subscript> inSubscripts;
input Env.Cache inCache;
input Env.Env inEnv;
input SymbolTable inST;
input Option<Interactive.SymbolTable> inST;
output Env.Cache outCache;
output Values.Value outResult;
output SymbolTable outST;
output Option<Interactive.SymbolTable> outST;
algorithm
(outCache, outResult, outST) :=
matchcontinue(inNewValue, inOldValue, inSubscripts, inCache, inEnv, inST)
Expand Down

0 comments on commit 1b53b39

Please sign in to comment.