Skip to content

Commit 0832aaf

Browse files
committed
- Fix MetaModelica testcases using the new runtime
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@10890 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 1e6d786 commit 0832aaf

File tree

2 files changed

+23
-42
lines changed

2 files changed

+23
-42
lines changed

Compiler/susan_codegen/SimCode/CodegenC.tpl

Lines changed: 22 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,10 +1706,10 @@ case SES_SIMPLE_ASSIGN(__) then
17061706
let &preExp = buffer "" /*BUFD*/
17071707
let expPart = daeExp(exp, context, &preExp /*BUFC*/, &varDecls /*BUFD*/)
17081708
<<
1709-
/*#modelicaLine <%eqInfoString(eq)%>*/
1709+
<%modelicaLine(eqInfo(eq))%>
17101710
<%preExp%>
17111711
<%cref(cref)%> = <%expPart%>; <%inlineCref(context,cref)%>
1712-
/*#endModelicaLine*/
1712+
<%endModelicaLine()%>
17131713
>>
17141714
end equationSimpleAssign;
17151715

@@ -1719,7 +1719,7 @@ template equationArrayCallAssign(SimEqSystem eq, Context context,
17191719
"Generates equation on form 'cref_array = call(...)'."
17201720
::=
17211721
<<
1722-
/*#modelicaLine <%eqInfoString(eq)%>*/
1722+
<%modelicaLine(eqInfo(eq))%>
17231723
<%match eq
17241724

17251725
case eqn as SES_ARRAY_CALL_ASSIGN(__) then
@@ -1753,7 +1753,7 @@ case eqn as SES_ARRAY_CALL_ASSIGN(__) then
17531753
>>
17541754
else error(sourceInfo(), 'No runtime support for this sort of array call: <%printExpStr(eqn.exp)%>')
17551755
%>
1756-
/*#endModelicaLine*/
1756+
<%endModelicaLine()%>
17571757
>>
17581758
end equationArrayCallAssign;
17591759

@@ -2188,6 +2188,7 @@ template commonHeader()
21882188
::=
21892189
<<
21902190
<% if acceptMetaModelicaGrammar() then "#define __OPENMODELICA__METAMODELICA"%>
2191+
<% if acceptMetaModelicaGrammar() then "#include \"meta_modelica.h\"" %>
21912192
<% if Flags.isSet(Flags.OPENMP) then "#include <omp.h>" else "#define omp_get_thread_num() 0" %>
21922193
#include <stdio.h>
21932194
#include <stdlib.h>
@@ -3702,38 +3703,6 @@ template funStatement(Statement stmt, Text &varDecls /*BUFP*/)
37023703
"NOT IMPLEMENTED FUN STATEMENT"
37033704
end funStatement;
37043705

3705-
template statementInfoString(DAE.Statement stmt)
3706-
::=
3707-
match stmt
3708-
case STMT_ASSIGN(__)
3709-
case STMT_ASSIGN_ARR(__)
3710-
case STMT_TUPLE_ASSIGN(__)
3711-
case STMT_IF(__)
3712-
case STMT_FOR(__)
3713-
case STMT_WHILE(__)
3714-
case STMT_ASSERT(__)
3715-
case STMT_TERMINATE(__)
3716-
case STMT_WHEN(__)
3717-
case STMT_BREAK(__)
3718-
case STMT_FAILURE(__)
3719-
case STMT_TRY(__)
3720-
case STMT_CATCH(__)
3721-
case STMT_THROW(__)
3722-
case STMT_RETURN(__)
3723-
case STMT_NORETCALL(__)
3724-
case STMT_REINIT(__)
3725-
then (match source case s as SOURCE(__) then infoStr(s.info))
3726-
end statementInfoString;
3727-
3728-
template eqInfoString(SimEqSystem eq)
3729-
::=
3730-
match eq
3731-
case SES_RESIDUAL(__)
3732-
case SES_SIMPLE_ASSIGN(__)
3733-
case SES_ARRAY_CALL_ASSIGN(__)
3734-
then (match source case s as SOURCE(__) then infoStr(s.info))
3735-
end eqInfoString;
3736-
37373706
template algStatement(DAE.Statement stmt, Context context, Text &varDecls /*BUFP*/)
37383707
"Generates an algorithm statement."
37393708
::=
@@ -3758,9 +3727,9 @@ template algStatement(DAE.Statement stmt, Context context, Text &varDecls /*BUFP
37583727
case s as STMT_REINIT(__) then algStmtReinit(s, context, &varDecls /*BUFD*/)
37593728
else error(sourceInfo(), 'ALG_STATEMENT NYI')
37603729
<<
3761-
/*#modelicaLine <%statementInfoString(stmt)%>*/
3730+
<%modelicaLine(getElementSourceFileInfo(getStatementSource(stmt)))%>#
37623731
<%res%>
3763-
/*#endModelicaLine*/
3732+
<%endModelicaLine()%>
37643733
>>
37653734
end algStatement;
37663735

@@ -5822,7 +5791,7 @@ case exp as MATCHEXPRESSION(__) then
58225791
let onPatternFail = match exp.matchType case MATCHCONTINUE(__) then "MMC_THROW()" case MATCH(__) then "break"
58235792
let &preExp +=
58245793
<<
5825-
/*#endModelicaLine*/
5794+
<%endModelicaLine()%>
58265795
{ /* <% match exp.matchType case MATCHCONTINUE(__) then "matchcontinue expression" case MATCH(__) then "match expression" %> */
58275796
<%varDeclsInput%>
58285797
<%preExpInput%>
@@ -5895,9 +5864,9 @@ template daeExpMatchCases(list<MatchCase> cases, list<Exp> tupleAssignExps, DAE.
58955864
%>
58965865
<%assignments%>
58975866
<%stmts%>
5898-
/*#modelicaLine <%infoStr(c.resultInfo)%>*/
5867+
<%modelicaLine(c.resultInfo)%>
58995868
<% if c.result then '<%preRes%><%caseRes%>' else 'MMC_THROW();<%\n%>' %>
5900-
/*#endModelicaLine*/
5869+
<%endModelicaLine()%>
59015870
<%done%> = 1;
59025871
59035872
/* GC: pop the mark! */
@@ -6885,6 +6854,18 @@ template addRootsTempArray()
68856854
>>
68866855
end addRootsTempArray;
68876856

6857+
template modelicaLine(Info info)
6858+
::=
6859+
match info
6860+
case INFO(columnNumberStart=0) then "/* Dummy Line */"
6861+
else '/*#modelicaLine <%infoStr(info)%>*/'
6862+
end modelicaLine;
6863+
6864+
template endModelicaLine()
6865+
::=
6866+
"/*#endModelicaLine*/"
6867+
end endModelicaLine;
6868+
68886869
end CodegenC;
68896870

68906871
// vim: filetype=susan sw=2 sts=2

Makefile.common

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ release: omc
4242

4343
oldc_runtime: .testvariables mkbuilddirs
4444
$(MAKE) -C c_runtime -f $(defaultMakefileTarget)
45-
newc_runtime: mkbuilddirs
45+
newc_runtime: .testvariables mkbuilddirs
4646
$(MAKE) -C SimulationRuntime/interactive -f $(defaultMakefileTarget)
4747
# Depends on libinteractive.a
4848
$(MAKE) -C SimulationRuntime/c -f $(defaultMakefileTarget)

0 commit comments

Comments
 (0)