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. */
|
||||
|
||||
|
||||
#include "dynareBison.hh"
|
||||
#include "DynareBison.hh"
|
||||
|
||||
/* User implementation prologue. */
|
||||
#line 32 "DynareBison.yy"
|
||||
|
@ -42,7 +42,7 @@
|
|||
|
||||
|
||||
/* Line 317 of lalr1.cc. */
|
||||
#line 46 "dynareBison.cc"
|
||||
#line 46 "DynareBison.cc"
|
||||
|
||||
#ifndef YY_
|
||||
# if YYENABLE_NLS
|
||||
|
@ -279,7 +279,7 @@ namespace yy
|
|||
yylloc.begin.filename = yylloc.end.filename = &driver.file;
|
||||
}
|
||||
/* Line 547 of yacc.c. */
|
||||
#line 283 "dynareBison.cc"
|
||||
#line 283 "DynareBison.cc"
|
||||
/* Initialize the stacks. The initial state will be pushed in
|
||||
yynewstate, since the latter expects the semantical and the
|
||||
location values to have been already stored, initialize these
|
||||
|
@ -2178,7 +2178,7 @@ namespace yy
|
|||
|
||||
|
||||
/* Line 675 of lalr1.cc. */
|
||||
#line 2182 "dynareBison.cc"
|
||||
#line 2182 "DynareBison.cc"
|
||||
default: break;
|
||||
}
|
||||
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
|
||||
if (op_code == oPower && (!OFFSET(output_type)))
|
||||
{
|
||||
output << "pow1(";
|
||||
output << "pow(";
|
||||
arg1->writeOutput(output, output_type, temporary_terms);
|
||||
output << ",";
|
||||
arg2->writeOutput(output, output_type, temporary_terms);
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace interfaces
|
|||
|
||||
std::string file_exist(std::string s)
|
||||
{
|
||||
return "exist(" + s + ")";
|
||||
return "exist('" + s + "')";
|
||||
}
|
||||
|
||||
std::string compile(std::string s)
|
||||
|
|
|
@ -117,12 +117,12 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all) const
|
|||
if (model_tree.mode == eDLLMode)
|
||||
{
|
||||
mOutputFile << "if ";
|
||||
mOutputFile << interfaces::file_exist(basename + "_static.c)") << endl;
|
||||
mOutputFile << interfaces::file_exist(basename + "_static.c") << endl;
|
||||
mOutputFile << " clear " << basename << "_static" << endl;
|
||||
mOutputFile << " " << interfaces::compile(basename +"_static.c") << endl;
|
||||
mOutputFile << "end" << endl;
|
||||
mOutputFile << "if ";
|
||||
mOutputFile << interfaces::file_exist(basename + "_dynamic.c)") << endl;
|
||||
mOutputFile << interfaces::file_exist(basename + "_dynamic.c") << endl;
|
||||
mOutputFile << " clear " << basename << "_dynamic" << endl;
|
||||
mOutputFile << " " + interfaces::compile(basename+"_dynamic.c") << endl;
|
||||
mOutputFile << "end" << endl;
|
||||
|
|
|
@ -173,6 +173,10 @@ ModelTree::writeModelLocalVariables(ostream &output, ExprNodeOutputType output_t
|
|||
{
|
||||
int id = it->first;
|
||||
NodeID value = it->second;
|
||||
|
||||
if (!OFFSET(output_type))
|
||||
output << "double ";
|
||||
|
||||
output << symbol_table.getNameByID(eModelLocalVariable, id) << " = ";
|
||||
// Use an empty set for the temporary terms
|
||||
value->writeOutput(output, output_type, temporary_terms_type());
|
||||
|
@ -746,7 +750,7 @@ ModelTree::writeDynamicCFile(const string &dynamic_basename) const
|
|||
<< " }" << endl
|
||||
<< " params = mxGetPr(mxGetFieldByNumber(M_, 0, mxGetFieldNumber(M_,\"params\")));" << 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
|
||||
<< " Dynamic(y, x, residual, g1, g2);" << endl
|
||||
<< "}" << endl;
|
||||
|
|
|
@ -58,7 +58,7 @@ class ParsingDriver;
|
|||
|
||||
|
||||
/* Line 35 of lalr1.cc. */
|
||||
#line 62 "dynareBison.hh"
|
||||
#line 62 "DynareBison.hh"
|
||||
|
||||
#include "location.hh"
|
||||
|
||||
|
@ -115,7 +115,7 @@ namespace yy
|
|||
NodeID node_val;
|
||||
}
|
||||
/* Line 35 of lalr1.cc. */
|
||||
#line 119 "dynareBison.hh"
|
||||
#line 119 "DynareBison.hh"
|
||||
;
|
||||
#else
|
||||
typedef YYSTYPE semantic_type;
|
||||
|
|
Loading…
Reference in New Issue