Skip to content

Commit

Permalink
- Remove Absyn.GOTO, Absyn.LABEL and Absyn.ALG_MATCHCASES from the co…
Browse files Browse the repository at this point in the history
…mpiler

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@7187 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Nov 25, 2010
1 parent 8aaf015 commit 013e485
Show file tree
Hide file tree
Showing 12 changed files with 3 additions and 188 deletions.
14 changes: 0 additions & 14 deletions Compiler/Absyn.mo
Expand Up @@ -577,20 +577,6 @@ uniontype Algorithm "The Algorithm type describes one algorithm statement in an
record ALG_THROW
end ALG_THROW;

record ALG_MATCHCASES
MatchType matchType;
list<Exp> inputExps;
list<Exp> switchCases;
end ALG_MATCHCASES;

record ALG_GOTO
String labelName;
end ALG_GOTO;

record ALG_LABEL
String labelName;
end ALG_LABEL;

record ALG_FAILURE
list<AlgorithmItem> equ;
end ALG_FAILURE;
Expand Down
2 changes: 0 additions & 2 deletions Compiler/BackendDAECreate.mo
Expand Up @@ -1749,8 +1749,6 @@ algorithm
((inputs,outputs)) = lowerAlgorithmInputsOutputs(vars,DAE.ALGORITHM_STMTS(statements));
then (inputs,outputs);
case(vars, DAE.STMT_THROW(source=_)) then ({}, {});
case(vars, DAE.STMT_GOTO(source=_)) then ({}, {});
case(vars, DAE.STMT_LABEL(source=_)) then ({}, {});
case(_, _)
equation
Debug.fprintln("failtrace", "- BackendDAECreate.lowerStatementInputsOutputs failed\n");
Expand Down
12 changes: 0 additions & 12 deletions Compiler/BackendVarTransform.mo
Expand Up @@ -580,18 +580,6 @@ algorithm
then
(DAE.STMT_THROW(source):: es_1);

case ((DAE.STMT_GOTO(labelName=str,source=source)::es),repl)
equation
es_1 = replaceStatementLst(es, repl);
then
(DAE.STMT_GOTO(str,source):: es_1);

case ((DAE.STMT_LABEL(labelName=str,source=source)::es),repl)
equation
es_1 = replaceStatementLst(es, repl);
then
(DAE.STMT_LABEL(str,source):: es_1);

case ((statement::es),repl)
equation
es_1 = replaceStatementLst(es, repl);
Expand Down
10 changes: 0 additions & 10 deletions Compiler/DAE.mo
Expand Up @@ -559,16 +559,6 @@ uniontype Statement "There are four kinds of statements. Assignments (`a := b;\
ElementSource source "the origin of the component/equation/algorithm";
end STMT_THROW;

record STMT_GOTO
String labelName;
ElementSource source "the origin of the component/equation/algorithm";
end STMT_GOTO;

record STMT_LABEL
String labelName;
ElementSource source "the origin of the component/equation/algorithm";
end STMT_LABEL;

//-----

end Statement;
Expand Down
10 changes: 0 additions & 10 deletions Compiler/DAEUtil.mo
Expand Up @@ -3869,16 +3869,6 @@ algorithm
(xs_1, extraArg) = traverseDAEEquationsStmts(xs, func, extraArg);
then (x :: xs_1,extraArg);

case (((x as DAE.STMT_GOTO(source = source)) :: xs),func,extraArg)
equation
(xs_1, extraArg) = traverseDAEEquationsStmts(xs, func, extraArg);
then (x :: xs_1,extraArg);

case (((x as DAE.STMT_LABEL(source = source)) :: xs),func,extraArg)
equation
(xs_1, extraArg) = traverseDAEEquationsStmts(xs, func, extraArg);
then (x :: xs_1,extraArg);

case ((x :: xs),func,extraArg)
equation
str = DAEDump.ppStatementStr(x);
Expand Down
31 changes: 0 additions & 31 deletions Compiler/Dump.mo
Expand Up @@ -3230,15 +3230,6 @@ algorithm
then
str;

case (i,Absyn.ALGORITHMITEM(algorithm_ = Absyn.ALG_MATCHCASES(matchType=matchType,switchCases=explist), comment = optcmt))
equation
s3 = unparseCommentOption(optcmt);
strlist = Util.listMap(explist, printExpStr);
strlist = Util.listMap1r(strlist, stringAppend, "\ncase:\n ");
s2 = stringAppendList(strlist);
str_1 = printMatchType(matchType) +& " cases { " +& s2 +& " } "+& s3 +&";";
then
str_1;
case (i,Absyn.ALGORITHMITEM(algorithm_ = Absyn.ALG_TRY(al),comment = optcmt)) /* ALG_TRY */
equation
i_1 = i + 1;
Expand Down Expand Up @@ -6194,28 +6185,6 @@ algorithm
equation
Print.printBuf("record Absyn.ALG_THROW end Absyn.ALG_THROW;");
then ();
case Absyn.ALG_MATCHCASES(matchType,inputExps,switchCases)
equation
Print.printBuf("record Absyn.ALG_MATCHCASES matchType = ");
printMatchTypeAsCorbaString(matchType);
Print.printBuf(", inputExps = ");
printListAsCorbaString(inputExps, printExpAsCorbaString, ",");
Print.printBuf(", switchCases = ");
printListAsCorbaString(switchCases, printExpAsCorbaString, ",");
Print.printBuf(" end Absyn.ALG_MATCHCASES;");
then ();
case Absyn.ALG_GOTO(label)
equation
Print.printBuf("record Absyn.ALG_GOTO label = \"");
Print.printBuf(label);
Print.printBuf("\" end Absyn.ALG_GOTO;");
then ();
case Absyn.ALG_LABEL(label)
equation
Print.printBuf("record Absyn.ALG_LABEL label = \"");
Print.printBuf(label);
Print.printBuf("\" end Absyn.ALG_LABEL;");
then ();
case Absyn.ALG_FAILURE(body)
equation
Print.printBuf("record Absyn.ALG_FAILURE body = ");
Expand Down
17 changes: 0 additions & 17 deletions Compiler/InstSection.mo
Expand Up @@ -2613,23 +2613,6 @@ algorithm
then
(cache,{stmt});

/* GOTO */
case (cache,env,ih,pre,SCode.ALG_GOTO(labelName = s, comment = comment, info = info),source,initial_,impl,unrollForLoops)
equation
true = RTOpts.acceptMetaModelicaGrammar();
source = DAEUtil.addElementSourceFileInfo(source, info);
stmt = DAE.STMT_GOTO(s,source);
then
(cache,{stmt});

case (cache,env,ih,pre,SCode.ALG_LABEL(labelName = s, comment = comment, info = info),source,initial_,impl,unrollForLoops)
equation
true = RTOpts.acceptMetaModelicaGrammar();
source = DAEUtil.addElementSourceFileInfo(source, info);
stmt = DAE.STMT_LABEL(s,source);
then
(cache,{stmt});

case (cache,env,ih,pre,alg,_,initial_,impl,unrollForLoops)
equation
true = RTOpts.debugFlag("failtrace");
Expand Down
49 changes: 2 additions & 47 deletions Compiler/OpenModelicaBootstrappingHeader.h
Expand Up @@ -1533,51 +1533,6 @@ extern struct record_description Absyn_Algorithm_ALG__THROW__desc;
#define Absyn__ALG_5fTHROW_3dBOX0 13
#define Absyn__ALG_5fTHROW (mmc_mk_box1(13,&Absyn_Algorithm_ALG__THROW__desc))
#ifdef ADD_METARECORD_DEFINTIONS
#ifndef Absyn_Algorithm_ALG__MATCHCASES__desc_added
#define Absyn_Algorithm_ALG__MATCHCASES__desc_added
const char* Absyn_Algorithm_ALG__MATCHCASES__desc__fields[3] = {"matchType","inputExps","switchCases"};
struct record_description Absyn_Algorithm_ALG__MATCHCASES__desc = {
"Absyn_Algorithm_ALG__MATCHCASES",
"Absyn.Algorithm.ALG_MATCHCASES",
Absyn_Algorithm_ALG__MATCHCASES__desc__fields
};
#endif
#else /* Only use the file as a header */
extern struct record_description Absyn_Algorithm_ALG__MATCHCASES__desc;
#endif
#define Absyn__ALG_5fMATCHCASES_3dBOX3 14
#define Absyn__ALG_5fMATCHCASES(matchType,inputExps,switchCases) (mmc_mk_box4(14,&Absyn_Algorithm_ALG__MATCHCASES__desc,matchType,inputExps,switchCases))
#ifdef ADD_METARECORD_DEFINTIONS
#ifndef Absyn_Algorithm_ALG__GOTO__desc_added
#define Absyn_Algorithm_ALG__GOTO__desc_added
const char* Absyn_Algorithm_ALG__GOTO__desc__fields[1] = {"labelName"};
struct record_description Absyn_Algorithm_ALG__GOTO__desc = {
"Absyn_Algorithm_ALG__GOTO",
"Absyn.Algorithm.ALG_GOTO",
Absyn_Algorithm_ALG__GOTO__desc__fields
};
#endif
#else /* Only use the file as a header */
extern struct record_description Absyn_Algorithm_ALG__GOTO__desc;
#endif
#define Absyn__ALG_5fGOTO_3dBOX1 15
#define Absyn__ALG_5fGOTO(labelName) (mmc_mk_box2(15,&Absyn_Algorithm_ALG__GOTO__desc,labelName))
#ifdef ADD_METARECORD_DEFINTIONS
#ifndef Absyn_Algorithm_ALG__LABEL__desc_added
#define Absyn_Algorithm_ALG__LABEL__desc_added
const char* Absyn_Algorithm_ALG__LABEL__desc__fields[1] = {"labelName"};
struct record_description Absyn_Algorithm_ALG__LABEL__desc = {
"Absyn_Algorithm_ALG__LABEL",
"Absyn.Algorithm.ALG_LABEL",
Absyn_Algorithm_ALG__LABEL__desc__fields
};
#endif
#else /* Only use the file as a header */
extern struct record_description Absyn_Algorithm_ALG__LABEL__desc;
#endif
#define Absyn__ALG_5fLABEL_3dBOX1 16
#define Absyn__ALG_5fLABEL(labelName) (mmc_mk_box2(16,&Absyn_Algorithm_ALG__LABEL__desc,labelName))
#ifdef ADD_METARECORD_DEFINTIONS
#ifndef Absyn_Algorithm_ALG__FAILURE__desc_added
#define Absyn_Algorithm_ALG__FAILURE__desc_added
const char* Absyn_Algorithm_ALG__FAILURE__desc__fields[1] = {"equ"};
Expand All @@ -1590,8 +1545,8 @@ struct record_description Absyn_Algorithm_ALG__FAILURE__desc = {
#else /* Only use the file as a header */
extern struct record_description Absyn_Algorithm_ALG__FAILURE__desc;
#endif
#define Absyn__ALG_5fFAILURE_3dBOX1 17
#define Absyn__ALG_5fFAILURE(equ) (mmc_mk_box2(17,&Absyn_Algorithm_ALG__FAILURE__desc,equ))
#define Absyn__ALG_5fFAILURE_3dBOX1 14
#define Absyn__ALG_5fFAILURE(equ) (mmc_mk_box2(14,&Absyn_Algorithm_ALG__FAILURE__desc,equ))
#ifdef ADD_METARECORD_DEFINTIONS
#ifndef Absyn_Modification_CLASSMOD__desc_added
#define Absyn_Modification_CLASSMOD__desc_added
Expand Down
12 changes: 0 additions & 12 deletions Compiler/PrefixUtil.mo
Expand Up @@ -1049,18 +1049,6 @@ algorithm
localAccList = listAppend(localAccList,Util.listCreate(elem));
(localCache,elems) = prefixStatements(localCache,localEnv,ih,rest,localAccList,pre);
then (localCache,elems);
case (localCache,localEnv,ih,DAE.STMT_GOTO(s,source) :: rest,localAccList,pre)
equation
elem = DAE.STMT_GOTO(s,source);
localAccList = listAppend(localAccList,Util.listCreate(elem));
(localCache,elems) = prefixStatements(localCache,localEnv,ih,rest,localAccList,pre);
then (localCache,elems);
case (localCache,localEnv,ih,DAE.STMT_LABEL(s,source) :: rest,localAccList,pre)
equation
elem = DAE.STMT_LABEL(s,source);
localAccList = listAppend(localAccList,Util.listCreate(elem));
(localCache,elems) = prefixStatements(localCache,localEnv,ih,rest,localAccList,pre);
then (localCache,elems);
end matchcontinue;
end prefixStatements;

Expand Down
26 changes: 0 additions & 26 deletions Compiler/SCode.mo
Expand Up @@ -407,26 +407,6 @@ public uniontype Statement "The Statement type describes one algorithm statement
Absyn.Info info;
end ALG_THROW;

record ALG_MATCHCASES
Absyn.MatchType matchType;
list<Absyn.Exp> inputExps;
list<Absyn.Exp> switchCases;
Option<Comment> comment;
Absyn.Info info;
end ALG_MATCHCASES;

record ALG_GOTO
String labelName;
Option<Comment> comment;
Absyn.Info info;
end ALG_GOTO;

record ALG_LABEL
String labelName;
Option<Comment> comment;
Absyn.Info info;
end ALG_LABEL;

record ALG_FAILURE
list<Statement> stmts;
Option<Comment> comment;
Expand Down Expand Up @@ -2603,12 +2583,6 @@ algorithm
case ALG_THROW(comment,info)
then Absyn.ALGORITHMITEM(Absyn.ALG_THROW(),NONE(),info);

case ALG_MATCHCASES(matchType,inputExps,switchCases,comment,info)
then Absyn.ALGORITHMITEM(Absyn.ALG_MATCHCASES(matchType,inputExps,switchCases),NONE(),info);

case ALG_GOTO(labelName,comment,info)
then Absyn.ALGORITHMITEM(Absyn.ALG_GOTO(labelName),NONE(),info);

case ALG_FAILURE(body,comment,info)
equation
algs1 = Util.listMap(body,statementToAlgorithmItem);
Expand Down
6 changes: 0 additions & 6 deletions Compiler/SCodeUtil.mo
Expand Up @@ -752,12 +752,6 @@ algorithm
case (Absyn.ALG_THROW(),comment,info)
then SCode.ALG_THROW(comment,info);

case (Absyn.ALG_MATCHCASES(matchType,inputExps,switchCases),comment,info)
then SCode.ALG_MATCHCASES(matchType,inputExps,switchCases,comment,info);

case (Absyn.ALG_GOTO(labelName),comment,info)
then SCode.ALG_GOTO(labelName,comment,info);

case (Absyn.ALG_FAILURE(body),comment,info)
equation
stmts = translateClassdefAlgorithmitems(body);
Expand Down
2 changes: 1 addition & 1 deletion Parser/Makefile.common
Expand Up @@ -37,7 +37,7 @@ MetaModelica_Lexer.o: MetaModelica_Lexer.h MetaModelica_Lexer_BaseModelica_Lexer
Modelica_3_Lexer.o: Modelica_3_Lexer.h Modelica_3_Lexer_BaseModelica_Lexer.h
MetaModelica_Lexer_BaseModelica_Lexer.o: MetaModelica_Lexer_BaseModelica_Lexer.h
Modelica_3_Lexer_BaseModelica_Lexer.o: Modelica_3_Lexer_BaseModelica_Lexer.h
ModelicaParser_rml.o: ModelicaParser.c ModelicaParser.h ModelicaParserCommon.h
ModelicaParser_rml.o: ModelicaParser.c ModelicaParser.h ModelicaParserCommon.h ../Compiler/Absyn.h ../Compiler/Interactive.h
ModelicaParser_omc.o: ModelicaParser.c ModelicaParser.h ModelicaParserCommon.h ../Compiler/OpenModelicaBootstrappingHeader.h

Parser_rml.o: $(HFILES) parse.c
Expand Down

0 comments on commit 013e485

Please sign in to comment.