Commit f0c98e97 authored by sebastien's avatar sebastien
Browse files

v4 parser: fixed output of Matlab/Scilab comments via abstract interface


git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1012 ac1d8469-bf42-47a9-8791-bf33cf982152
parent a1bcb2bc
......@@ -9,6 +9,7 @@
using namespace std;
//------------------------------------------------------------------------------
#include "ComputingTasks.h"
#include "Interface.h"
//------------------------------------------------------------------------------
//ostringstream ComputingTasks::output;
//------------------------------------------------------------------------------
......@@ -308,7 +309,8 @@ void ComputingTasks::set_trend_element (string name, string expression)
void ComputingTasks::BeginCalibVar(void)
{
*output << "%\n% CALIB_VAR \n%\n";
*output << interfaces::comment() << "\n" << interfaces::comment() << "CALIB_VAR \n"
<< interfaces::comment() << "\n";
for(int i=1;i<4;++i)
{
*output << "calib_var_index{" << i << "} = [];\n";
......@@ -447,7 +449,7 @@ void ComputingTasks::runOlr(string tmp1)
//------------------------------------------------------------------------------
void ComputingTasks::BeginOptimWeights(void)
{
*output << "% OPTIM_WEIGHTS\n\n";
*output << interfaces::comment() << "OPTIM_WEIGHTS\n\n";
*output << "optim_weights_ = sparse(M_.endo_nbr,M_.endo_nbr);\n";
*output << "obj_var_ = [];\n\n";
}
......
......@@ -51,7 +51,7 @@ void ModelTree::OpenMFiles(string iModelFileName1, string iModelFileName2)
//Writing comments and function definition command
mStaticModelFile << "function [residual, g1] = " << iModelFileName1 << "( y, x )\n";
mStaticModelFile << interfaces::comment()+"\n"+interfaces::comment();
mStaticModelFile << "Status : Computes static model for Dynare\n%\n";
mStaticModelFile << "Status : Computes static model for Dynare\n" << interfaces::comment() << "\n";
mStaticModelFile << interfaces::comment();
mStaticModelFile << "Warning : this file is generated automatically by Dynare\n";
mStaticModelFile << interfaces::comment();
......@@ -69,7 +69,7 @@ void ModelTree::OpenMFiles(string iModelFileName1, string iModelFileName2)
iModelFileName2.erase(iModelFileName2.end()-2,iModelFileName2.end());
mDynamicModelFile << "function [residual, g1, g2] = " << iModelFileName2 << "(y, x)\n";
mDynamicModelFile << interfaces::comment()+"\n"+interfaces::comment();
mDynamicModelFile << "Status : Computes dynamic model for Dynare\n%\n";
mDynamicModelFile << "Status : Computes dynamic model for Dynare\n" << interfaces::comment() << "\n";
mDynamicModelFile << interfaces::comment();
mDynamicModelFile << "Warning : this file is generated automatically by Dynare\n";
mDynamicModelFile << interfaces::comment();
......
......@@ -7,6 +7,7 @@
using namespace std;
//------------------------------------------------------------------------------
#include "NumericalInitialization.h"
#include "Interface.h"
//------------------------------------------------------------------------------
//ostringstream NumericalInitialization::output;
//------------------------------------------------------------------------------
......@@ -52,7 +53,8 @@ void NumericalInitialization::BeginInitval (void)
{
// Writing a Matlab comment
*output << "%\n% INITVAL instructions \n%\n";
*output << interfaces::comment() << "\n" << interfaces::comment() << "INITVAL instructions \n"
<< interfaces::comment() << "\n";
// Writing initval block to set initial values for variables
*output << "options_.initval_file = 0;\nendval_=0;\n";
if(ModelParameters::recur_nbr > 0)
......@@ -108,7 +110,8 @@ void NumericalInitialization::EndInitval(void)
void NumericalInitialization::BeginEndval (void)
{
// Writing a Matlab comment
*output << "%\n% ENDVAL instructions\n%\n";
*output << interfaces::comment() << "\n" << interfaces::comment() << "ENDVAL instructions\n"
<< interfaces::comment() << "\n";
// Writing endval block to set terminal values for variables
*output << "ys0_= oo_.steady_state;\nex0_ = oo_.exo_steady_state;\nrecurs0_ = recurs_;\nendval_ = 1;\n";
......@@ -121,7 +124,8 @@ void NumericalInitialization::EndEndval (void)
void NumericalInitialization::BeginHistval (void)
{
// Writing a Matlab comment
*output << "%\n% HISTVAL instructions\n%\n";
*output << interfaces::comment() << "\n" << interfaces::comment() << "HISTVAL instructions\n"
<< interfaces::comment() << "\n";
}
//------------------------------------------------------------------------------
......
......@@ -9,6 +9,7 @@ using namespace std;
//------------------------------------------------------------------------------
#include "Shocks.h"
#include "ModelParameters.h"
#include "Interface.h"
static int mshock_flag = 0;
static int exo_det_length = 0;
......@@ -35,7 +36,8 @@ void Shocks::BeginShocks(void)
{
mshock_flag = 0;
// Writing a Matlab comment
*output << "%\n% SHOCKS instructions \n%\n";
*output << interfaces::comment() << "\n" << interfaces::comment() << "SHOCKS instructions \n"
<< interfaces::comment() << "\n";
//Writing intstruction that initialize a shocks
*output << "make_ex_;\n";
}
......@@ -44,7 +46,8 @@ void Shocks::BeginMShocks(void)
{
mshock_flag = 1;
// Writing a Matlab comment
*output << "%\n% MSHOCKS instructions \n%\n";
*output << interfaces::comment() << "\n" << interfaces::comment() << "MSHOCKS instructions \n"
<< interfaces::comment() << "\n";
//Writing intstruction that initialize a shocks
*output << "make_ex_;\n";
}
......
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