Commit e1cebde8 authored by Houtan Bastani's avatar Houtan Bastani Committed by MichelJuillard
Browse files

ms-dsge: add param initialization to C output

parent 053ee41a
......@@ -852,6 +852,15 @@ ModFile::writeCOutputFiles(const string &basename) const
dynamic_model.writeCOutput(mDriverCFile, basename, false, false, true, mod_file_struct.order_option, mod_file_struct.estimation_present);
mDriverCFile << "/*" << endl
<< " * Writing statements" << endl
<< " */" << endl;
// Print statements
for (vector<Statement *>::const_iterator it = statements.begin();
it != statements.end(); it++)
(*it)->writeCOutput(mDriverCFile, basename);
mDriverCFile << "}" << endl;
mDriverCFile.close();
......
......@@ -50,6 +50,16 @@ InitParamStatement::writeOutput(ostream &output, const string &basename) const
output << symbol_table.getName(symb_id) << " = M_.params( " << id << " );\n";
}
void
InitParamStatement::writeCOutput(ostream &output, const string &basename)
{
int id = symbol_table.getTypeSpecificID(symb_id);
output << "params[ " << id << " ] = ";
param_value->writeOutput(output);
output << ";" << endl;
output << "double " << symbol_table.getName(symb_id) << " = params[ " << id << " ];" << endl;
}
void
InitParamStatement::fillEvalContext(eval_context_t &eval_context) const
{
......
......@@ -41,6 +41,7 @@ public:
const SymbolTable &symbol_table_arg);
virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
virtual void writeOutput(ostream &output, const string &basename) const;
virtual void writeCOutput(ostream &output, const string &basename);
//! Fill eval context with parameter value
void fillEvalContext(eval_context_t &eval_context) const;
};
......
......@@ -63,6 +63,11 @@ Statement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &wa
{
}
void
Statement::writeCOutput(ostream &output, const string &basename)
{
}
void
Statement::computingPass()
{
......
......@@ -138,6 +138,7 @@ public:
\param basename is the name of the modfile (without extension) which can be used to build auxiliary files
*/
virtual void writeOutput(ostream &output, const string &basename) const = 0;
virtual void writeCOutput(ostream &output, const string &basename);
};
class NativeStatement : public Statement
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment