Skip to content

Commit

Permalink
-Changed error reporting to always prefix message with the severity s…
Browse files Browse the repository at this point in the history
…tring (Error, Warning or Notification)

-Added dependencies to some makefiles
- Removed DAE.RECORD, instead use DAE.COMPLEX

git-svn-id: https://openmodelica.org/svn/OpenModelica/branches/MathCoreOSMC@3808 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Peter Aronsson committed Jan 21, 2009
1 parent 6a21624 commit cc06596
Show file tree
Hide file tree
Showing 11 changed files with 303 additions and 149 deletions.
12 changes: 7 additions & 5 deletions Compiler/Codegen.mo
Expand Up @@ -1250,13 +1250,15 @@ algorithm
local
DAE.Element var;
list<DAE.Element> rest;
Absyn.Path path;
String name, first_str, last_str;
Types.Type ft;
list<String> strs,rest_strs,decl_strs;
list<String> rt, rt_1;
case ({},rt) then ({},rt);
case (((var as DAE.VAR(ty = DAE.RECORD(name = name), fullType = ft)) :: rest),rt)
case (((var as DAE.VAR(ty = DAE.COMPLEX(name = path), fullType = ft)) :: rest),rt)
equation
name = Absyn.pathString(path);
failure(_ = Util.listGetMember(name,rt));
first_str = Util.stringAppendList({"struct ",name," {"});
decl_strs = generateRecordDeclarations(ft);
Expand Down Expand Up @@ -1491,14 +1493,14 @@ protected function daeExpType
algorithm
outType:=
matchcontinue (inType)
local String name;
local String name; Absyn.Path path; list<DAE.Var> varLst;
case DAE.INT() then Exp.INT();
case DAE.REAL() then Exp.REAL();
case DAE.STRING() then Exp.STRING();
case DAE.BOOL() then Exp.BOOL();
case DAE.ENUM() then Exp.ENUM();
case DAE.LIST() then Exp.T_LIST(Exp.OTHER()); // MetaModelica list
case DAE.RECORD(name = name) then Exp.T_RECORD(name);
case DAE.COMPLEX(path,varLst) equation name = Absyn.pathString(path); then /* TODO: translate vars */ Exp.COMPLEX(name,{},ClassInf.UNKNOWN(name));
case DAE.METATUPLE() then Exp.T_METATUPLE({}); // MetaModelica tuple
case DAE.METAOPTION() then Exp.T_METAOPTION(Exp.OTHER()); // MetaModelica tuple
case _ then Exp.OTHER();
Expand Down Expand Up @@ -7661,7 +7663,7 @@ algorithm
case (DAE.VAR(componentRef = id,
kind = vk,
direction = DAE.INPUT(),
ty = DAE.RECORD(_),
ty = DAE.COMPLEX(name=_),
dims = {},
fullType = rt) :: r)
local
Expand Down Expand Up @@ -7835,7 +7837,7 @@ algorithm
case (DAE.VAR(componentRef = id,
kind = vk,
direction = DAE.OUTPUT(),
ty = (t as DAE.RECORD(_)),
ty = (t as DAE.COMPLEX(name=_)),
dims = {},
fullType = rt) :: r,i)
local
Expand Down
43 changes: 21 additions & 22 deletions Compiler/DAE.mo
Expand Up @@ -89,11 +89,7 @@ uniontype Type
record ENUM end ENUM;

record LIST end LIST; // MetaModelica list. KS

record RECORD
String name;
end RECORD;


record METATUPLE end METATUPLE; // MetaModelica tuple. KS

record METAOPTION end METAOPTION; // MetaModelica option. KS
Expand Down Expand Up @@ -1523,7 +1519,7 @@ algorithm
Print.printBuf(str);
end dumpVars;

protected function dumpVarsStr "function: dumpVarsStr
public function dumpVarsStr "function: dumpVarsStr
Dump variables to a string.
"
Expand Down Expand Up @@ -2066,14 +2062,7 @@ algorithm
Print.printBuf("String ");
then
();
/*
case RECORD(name = i)
equation
Print.printBuf("Record ");
Print.printBuf(i);
then
();
*/

case ENUM()
equation
Print.printBuf("Enum ");
Expand Down Expand Up @@ -2116,13 +2105,7 @@ algorithm
case BOOL() then "Boolean ";
case STRING() then "String ";
case ENUM() then "Enum ";
/*
case RECORD(name = s1)
equation
s2 = stringAppend("Record ", s1);
then
s2;
*/

case ENUMERATION(stringLst = l)
equation
s1 = Util.stringDelimitList(l, ", ");
Expand Down Expand Up @@ -3384,7 +3367,7 @@ public function getInputVars "function getInputVars
output list<Element> vl_1;
list<Element> vl_1;
algorithm
vl_1 := getMatchingElements(vl, isInputVar);
vl_1 := getMatchingElements(vl, isInput);
end getInputVars;

public function generateDaeType "function generateDaeType
Expand Down Expand Up @@ -3539,6 +3522,22 @@ algorithm
end matchcontinue;
end isInputVar;

public function isInput "function: isInputVar
author: PA
Succeeds if Element is an input .
"
input Element inElement;
algorithm
_:=
matchcontinue (inElement)
local
Exp.ComponentRef n;
Type ty;
case VAR(direction = INPUT()) then ();
end matchcontinue;
end isInput;

protected function isNotVar "function: isNotVar
author: LS
Expand Down
2 changes: 1 addition & 1 deletion Compiler/Error.mo
Expand Up @@ -211,7 +211,7 @@ public constant ErrorID REDUNDANT_GUESS=513 "Used by MathCore in Backend";
public constant ErrorID INDEX_REDUCTION_NOTIFICATION=1000;
public constant ErrorID SELECTED_STATE_DUE_TO_START_NOTIFICATION = 1001;
protected constant list<tuple<Integer, MessageType, Severity, String>> errorTable={(SYNTAX_ERROR,SYNTAX(),ERROR(),"Syntax error near: %s"),
(GRAMMATIC_ERROR,GRAMMAR(),ERROR(),"error: %s"),
(GRAMMATIC_ERROR,GRAMMAR(),ERROR(),"%s"),
(LOOKUP_ERROR,TRANSLATION(),ERROR(),
"Class %s not found in scope %s."),
(LOOKUP_ERROR_COMPNAME,TRANSLATION(),ERROR(),
Expand Down
4 changes: 2 additions & 2 deletions Compiler/Inst.mo
Expand Up @@ -7704,12 +7704,12 @@ algorithm
then {DAE.VAR(vn,kind,dir,prot,DAE.ENUMERATION(l),e,finst_dims,fl,st,{}, dae_var_attr,comment,io,ty)};

/* Complex type that is Record*/
case (vn, ty as (Types.T_COMPLEX(complexClassType = ClassInf.RECORD(string = s)),_),fl,st,kind,dir,prot,e,inst_dims,start,dae_var_attr,comment,io,finalPrefix,declareComplexVars)
/* case (vn, ty as (Types.T_COMPLEX(complexClassType = ClassInf.RECORD(string = s)),_),fl,st,kind,dir,prot,e,inst_dims,start,dae_var_attr,comment,io,finalPrefix,declareComplexVars)
equation
finst_dims = Util.listFlatten(inst_dims);
dae_var_attr = DAE.setFinalAttr(dae_var_attr,finalPrefix);
then {DAE.VAR(vn,kind,dir,prot,DAE.RECORD(s),e,finst_dims,fl,st,{},dae_var_attr,comment,io,ty)};

*/
/* Complex type that is ExternalObject*/
case (vn, ty as (Types.T_COMPLEX(complexClassType = ClassInf.EXTERNAL_OBJ(path)),_),fl,st,kind,dir,prot,e,inst_dims,start,dae_var_attr,comment,io,finalPrefix,declareComplexVars)
local Absyn.Path path;
Expand Down

0 comments on commit cc06596

Please sign in to comment.