v4 parser: fixed several problems with USE_DLL option:
* in the .m file, corrected "if exist" and "mex" lines * in the .c files, fixed problem with model local variables * reverted Fehrat's change: power operator in C is pow(), not pow1() git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1301 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
34004449df
commit
6eec6211fe
|
@ -33,7 +33,7 @@
|
||||||
version 2.2 of Bison. */
|
version 2.2 of Bison. */
|
||||||
|
|
||||||
|
|
||||||
#include "dynareBison.hh"
|
#include "DynareBison.hh"
|
||||||
|
|
||||||
/* User implementation prologue. */
|
/* User implementation prologue. */
|
||||||
#line 32 "DynareBison.yy"
|
#line 32 "DynareBison.yy"
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
|
|
||||||
|
|
||||||
/* Line 317 of lalr1.cc. */
|
/* Line 317 of lalr1.cc. */
|
||||||
#line 46 "dynareBison.cc"
|
#line 46 "DynareBison.cc"
|
||||||
|
|
||||||
#ifndef YY_
|
#ifndef YY_
|
||||||
# if YYENABLE_NLS
|
# if YYENABLE_NLS
|
||||||
|
@ -279,7 +279,7 @@ namespace yy
|
||||||
yylloc.begin.filename = yylloc.end.filename = &driver.file;
|
yylloc.begin.filename = yylloc.end.filename = &driver.file;
|
||||||
}
|
}
|
||||||
/* Line 547 of yacc.c. */
|
/* Line 547 of yacc.c. */
|
||||||
#line 283 "dynareBison.cc"
|
#line 283 "DynareBison.cc"
|
||||||
/* Initialize the stacks. The initial state will be pushed in
|
/* Initialize the stacks. The initial state will be pushed in
|
||||||
yynewstate, since the latter expects the semantical and the
|
yynewstate, since the latter expects the semantical and the
|
||||||
location values to have been already stored, initialize these
|
location values to have been already stored, initialize these
|
||||||
|
@ -2178,7 +2178,7 @@ namespace yy
|
||||||
|
|
||||||
|
|
||||||
/* Line 675 of lalr1.cc. */
|
/* Line 675 of lalr1.cc. */
|
||||||
#line 2182 "dynareBison.cc"
|
#line 2182 "DynareBison.cc"
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc);
|
YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc);
|
||||||
|
|
|
@ -972,7 +972,7 @@ BinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
// Treat special case of power operator in C
|
// Treat special case of power operator in C
|
||||||
if (op_code == oPower && (!OFFSET(output_type)))
|
if (op_code == oPower && (!OFFSET(output_type)))
|
||||||
{
|
{
|
||||||
output << "pow1(";
|
output << "pow(";
|
||||||
arg1->writeOutput(output, output_type, temporary_terms);
|
arg1->writeOutput(output, output_type, temporary_terms);
|
||||||
output << ",";
|
output << ",";
|
||||||
arg2->writeOutput(output, output_type, temporary_terms);
|
arg2->writeOutput(output, output_type, temporary_terms);
|
||||||
|
|
|
@ -16,12 +16,12 @@ namespace interfaces
|
||||||
|
|
||||||
std::string file_exist(std::string s)
|
std::string file_exist(std::string s)
|
||||||
{
|
{
|
||||||
return "exist(" + s + ")";
|
return "exist('" + s + "')";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string compile(std::string s)
|
std::string compile(std::string s)
|
||||||
{
|
{
|
||||||
return "mex -O" + s + "\n";
|
return "mex -O " + s + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string function_close()
|
std::string function_close()
|
||||||
|
|
|
@ -117,12 +117,12 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all) const
|
||||||
if (model_tree.mode == eDLLMode)
|
if (model_tree.mode == eDLLMode)
|
||||||
{
|
{
|
||||||
mOutputFile << "if ";
|
mOutputFile << "if ";
|
||||||
mOutputFile << interfaces::file_exist(basename + "_static.c)") << endl;
|
mOutputFile << interfaces::file_exist(basename + "_static.c") << endl;
|
||||||
mOutputFile << " clear " << basename << "_static" << endl;
|
mOutputFile << " clear " << basename << "_static" << endl;
|
||||||
mOutputFile << " " << interfaces::compile(basename +"_static.c") << endl;
|
mOutputFile << " " << interfaces::compile(basename +"_static.c") << endl;
|
||||||
mOutputFile << "end" << endl;
|
mOutputFile << "end" << endl;
|
||||||
mOutputFile << "if ";
|
mOutputFile << "if ";
|
||||||
mOutputFile << interfaces::file_exist(basename + "_dynamic.c)") << endl;
|
mOutputFile << interfaces::file_exist(basename + "_dynamic.c") << endl;
|
||||||
mOutputFile << " clear " << basename << "_dynamic" << endl;
|
mOutputFile << " clear " << basename << "_dynamic" << endl;
|
||||||
mOutputFile << " " + interfaces::compile(basename+"_dynamic.c") << endl;
|
mOutputFile << " " + interfaces::compile(basename+"_dynamic.c") << endl;
|
||||||
mOutputFile << "end" << endl;
|
mOutputFile << "end" << endl;
|
||||||
|
|
|
@ -173,6 +173,10 @@ ModelTree::writeModelLocalVariables(ostream &output, ExprNodeOutputType output_t
|
||||||
{
|
{
|
||||||
int id = it->first;
|
int id = it->first;
|
||||||
NodeID value = it->second;
|
NodeID value = it->second;
|
||||||
|
|
||||||
|
if (!OFFSET(output_type))
|
||||||
|
output << "double ";
|
||||||
|
|
||||||
output << symbol_table.getNameByID(eModelLocalVariable, id) << " = ";
|
output << symbol_table.getNameByID(eModelLocalVariable, id) << " = ";
|
||||||
// Use an empty set for the temporary terms
|
// Use an empty set for the temporary terms
|
||||||
value->writeOutput(output, output_type, temporary_terms_type());
|
value->writeOutput(output, output_type, temporary_terms_type());
|
||||||
|
@ -746,7 +750,7 @@ ModelTree::writeDynamicCFile(const string &dynamic_basename) const
|
||||||
<< " }" << endl
|
<< " }" << endl
|
||||||
<< " params = mxGetPr(mxGetFieldByNumber(M_, 0, mxGetFieldNumber(M_,\"params\")));" << endl
|
<< " params = mxGetPr(mxGetFieldByNumber(M_, 0, mxGetFieldNumber(M_,\"params\")));" << endl
|
||||||
<< " /* Gets it_ from global workspace of Matlab */" << endl
|
<< " /* Gets it_ from global workspace of Matlab */" << endl
|
||||||
<< " //it_ = (int) floor(mxGetScalar(mexGetVariable(\"global\", \"it_\")))-1;" << endl
|
<< " /* it_ = (int) floor(mxGetScalar(mexGetVariable(\"global\", \"it_\")))-1; */" << endl
|
||||||
<< " /* Call the C subroutines. */" << endl
|
<< " /* Call the C subroutines. */" << endl
|
||||||
<< " Dynamic(y, x, residual, g1, g2);" << endl
|
<< " Dynamic(y, x, residual, g1, g2);" << endl
|
||||||
<< "}" << endl;
|
<< "}" << endl;
|
||||||
|
|
|
@ -58,7 +58,7 @@ class ParsingDriver;
|
||||||
|
|
||||||
|
|
||||||
/* Line 35 of lalr1.cc. */
|
/* Line 35 of lalr1.cc. */
|
||||||
#line 62 "dynareBison.hh"
|
#line 62 "DynareBison.hh"
|
||||||
|
|
||||||
#include "location.hh"
|
#include "location.hh"
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ namespace yy
|
||||||
NodeID node_val;
|
NodeID node_val;
|
||||||
}
|
}
|
||||||
/* Line 35 of lalr1.cc. */
|
/* Line 35 of lalr1.cc. */
|
||||||
#line 119 "dynareBison.hh"
|
#line 119 "DynareBison.hh"
|
||||||
;
|
;
|
||||||
#else
|
#else
|
||||||
typedef YYSTYPE semantic_type;
|
typedef YYSTYPE semantic_type;
|
||||||
|
|
Loading…
Reference in New Issue