Commit a399b8e4 authored by sebastien's avatar sebastien
Browse files

trunk:

* DynareBison.yy: use "filename" rule for initval_file, dynasave, dynatype and datafile option
* DynareBison.yy: removed some spurious syntaxes for dynatype and dynasave
* ComputingTasks.cc: bugfix for dynatype
* cosmetic changes to dynatype.m and dynasave.m


git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@2145 ac1d8469-bf42-47a9-8791-bf33cf982152
parent 3d21bb42
......@@ -780,10 +780,9 @@ OptimWeightsStatement::writeOutput(ostream &output, const string &basename) cons
}
DynaSaveStatement::DynaSaveStatement(const SymbolList &symbol_list_arg,
const string &filename_arg, const string &ext_arg) :
const string &filename_arg) :
symbol_list(symbol_list_arg),
filename(filename_arg),
ext(ext_arg)
filename(filename_arg)
{
}
......@@ -791,17 +790,14 @@ void
DynaSaveStatement::writeOutput(ostream &output, const string &basename) const
{
symbol_list.writeOutput("var_list_", output);
output << "dynasave('" << filename;
if (ext.size() > 0)
output << "," << ext;
output << "',var_list_);\n";
output << "dynasave('" << filename
<< "',var_list_);" << endl;
}
DynaTypeStatement::DynaTypeStatement(const SymbolList &symbol_list_arg,
const string &filename_arg, const string &ext_arg) :
const string &filename_arg) :
symbol_list(symbol_list_arg),
filename(filename_arg),
ext(ext_arg)
filename(filename_arg)
{
}
......@@ -809,10 +805,8 @@ void
DynaTypeStatement::writeOutput(ostream &output, const string &basename) const
{
symbol_list.writeOutput("var_list_", output);
output << "dynatype(" << filename;
if (ext.size() > 0)
output << "," << ext;
output << ",var_list_);\n";
output << "dynatype('" << filename
<< "',var_list_);" << endl;
}
ModelComparisonStatement::ModelComparisonStatement(const filename_list_type &filename_list_arg,
......
......@@ -373,7 +373,7 @@ comma_expression : expression
initval : INITVAL ';' initval_list END
{ driver.end_initval(); }
initval_file : INITVAL_FILE '(' FILENAME EQUAL NAME ')' ';'
initval_file : INITVAL_FILE '(' FILENAME EQUAL filename ')' ';'
{ driver.initval_file($5); }
;
......@@ -1091,32 +1091,16 @@ calib : CALIB ';'
{ driver.run_calib(1); }
;
dynatype : DYNATYPE '(' NAME ')'';'
dynatype : DYNATYPE '(' filename ')'';'
{ driver.run_dynatype($3); }
| DYNATYPE '(' NAME ')' symbol_list ';'
| DYNATYPE '(' filename ')' symbol_list ';'
{ driver.run_dynatype($3); }
| DYNATYPE NAME ';'
{ driver.run_dynatype($2); }
| DYNATYPE '(' NAME '.' NAME ')'';'
{ driver.run_dynatype($3, $5); }
| DYNATYPE '(' NAME '.' NAME ')' symbol_list ';'
{ driver.run_dynatype($3, $5); }
| DYNATYPE NAME '.' NAME ';'
{ driver.run_dynatype($2,$4); }
;
dynasave : DYNASAVE '(' NAME ')'';'
dynasave : DYNASAVE '(' filename ')'';'
{ driver.run_dynasave($3); }
| DYNASAVE '(' NAME ')' symbol_list ';'
| DYNASAVE '(' filename ')' symbol_list ';'
{ driver.run_dynasave($3); }
| DYNASAVE NAME ';'
{ driver.run_dynasave($2); }
| DYNASAVE '(' NAME '.' NAME ')'';'
{ driver.run_dynasave($3, $5); }
| DYNASAVE '(' NAME '.' NAME ')' symbol_list ';'
{ driver.run_dynasave($3, $5); }
| DYNASAVE NAME '.' NAME ';'
{ driver.run_dynasave($2, $4); }
;
model_comparison : MODEL_COMPARISON mc_filename_list ';'
......@@ -1323,7 +1307,7 @@ o_markowitz : MARKOWITZ EQUAL number { driver.option_num("markowitz", $3); };
o_simul : SIMUL { driver.option_num("simul", "1"); };
o_simul_seed : SIMUL_SEED EQUAL INT_NUMBER { driver.option_num("simul_seed", $3)} ;
o_qz_criterium : QZ_CRITERIUM EQUAL number { driver.option_num("qz_criterium", $3) };
o_datafile : DATAFILE EQUAL NAME { driver.option_str("datafile", $3); };
o_datafile : DATAFILE EQUAL filename { driver.option_str("datafile", $3); };
o_nobs : NOBS EQUAL vec_int
{ driver.option_num("nobs", $3); }
| NOBS EQUAL INT_NUMBER
......
......@@ -1004,21 +1004,19 @@ ParsingDriver::run_calib(int covar)
}
void
ParsingDriver::run_dynatype(string *filename, string *ext)
ParsingDriver::run_dynatype(string *filename)
{
mod_file->addStatement(new DynaTypeStatement(symbol_list, *filename, *ext));
mod_file->addStatement(new DynaTypeStatement(symbol_list, *filename));
symbol_list.clear();
delete filename;
delete ext;
}
void
ParsingDriver::run_dynasave(string *filename, string *ext)
ParsingDriver::run_dynasave(string *filename)
{
mod_file->addStatement(new DynaSaveStatement(symbol_list, *filename, *ext));
mod_file->addStatement(new DynaSaveStatement(symbol_list, *filename));
symbol_list.clear();
delete filename;
delete ext;
}
void
......
......@@ -270,10 +270,9 @@ class DynaTypeStatement : public Statement
private:
const SymbolList symbol_list;
const string filename;
const string ext;
public:
DynaTypeStatement(const SymbolList &symbol_list_arg,
const string &filename_arg, const string &ext_arg);
const string &filename_arg);
virtual void writeOutput(ostream &output, const string &basename) const;
};
......@@ -282,10 +281,9 @@ class DynaSaveStatement : public Statement
private:
const SymbolList symbol_list;
const string filename;
const string ext;
public:
DynaSaveStatement(const SymbolList &symbol_list_arg,
const string &filename_arg, const string &ext_arg);
const string &filename_arg);
virtual void writeOutput(ostream &output, const string &basename) const;
};
......
......@@ -322,8 +322,8 @@ public:
void set_calib_covar(string *name1, string *name2, string *weight, NodeID expression);
void set_calib_ac(string *name, string *ar, string *weight, NodeID expression);
void run_calib(int covar);
void run_dynasave(string *arg1, string *arg2 = new string);
void run_dynatype(string *arg1, string *arg2 = new string);
void run_dynasave(string *filename);
void run_dynatype(string *filename);
void add_mc_filename(string *filename, string *prior = new string("1"));
void run_model_comparison();
//! Begin a planner_objective statement
......
Markdown is supported
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