* preprocessor: make optional the warnings about uninitialized parameters/endogenous/exogenous, added a new "warn_uninit" option to dynare command to display them

* reference manual: documented the new option, fixed XML conformance of the document


git-svn-id: https://www.dynare.org/svn/dynare/trunk@3135 ac1d8469-bf42-47a9-8791-bf33cf982152
time-shift
sebastien 2009-11-06 18:31:03 +00:00
parent 28a9a11878
commit ab8b4f37f1
5 changed files with 25 additions and 10 deletions

View File

@ -253,6 +253,7 @@ second step, the program actually runs the computations. Boths steps are trigger
<arg><option>savemacro</option><arg>=<replaceable>FILENAME</replaceable></arg></arg> <arg><option>savemacro</option><arg>=<replaceable>FILENAME</replaceable></arg></arg>
<arg><option>onlymacro</option></arg> <arg><option>onlymacro</option></arg>
<arg><option>nolinemacro</option></arg> <arg><option>nolinemacro</option></arg>
<arg><option>warn_uninit</option></arg>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@ -314,6 +315,10 @@ These files may be looked at to understand errors reported at the simulation sta
<term><option>nolinemacro</option></term> <term><option>nolinemacro</option></term>
<listitem><para>Instructs the macro-preprocessor to omit line numbering information in the intermediary <filename class="extension">.mod</filename> file created after the maco-processing step. Useful in conjunction with <option>savemacro</option> when one wants that to reuse the intermediary <filename class="extension">.mod</filename> file, without having it cluttered by line numbering directives.</para></listitem> <listitem><para>Instructs the macro-preprocessor to omit line numbering information in the intermediary <filename class="extension">.mod</filename> file created after the maco-processing step. Useful in conjunction with <option>savemacro</option> when one wants that to reuse the intermediary <filename class="extension">.mod</filename> file, without having it cluttered by line numbering directives.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><option>warn_uninit</option></term>
<listitem><para>Display a warning for each variable or parameter which is not initialized. Initialization should be done through <xref linkend="param_init"/> or <xref linkend="load_params_and_steady_state"/> for parameters, or through <xref linkend="initval"/>, <xref linkend="endval"/> or <xref linkend="load_params_and_steady_state"/> for endogenous and exogenous.</para></listitem>
</varlistentry>
</variablelist> </variablelist>
</refsect1> </refsect1>
@ -1770,9 +1775,13 @@ The simulated endogenous variables are available in global matrix <varname>oo_.e
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry id="conditional_variance_decomposition"> <varlistentry id="conditional_variance_decomposition">
<term><option>conditional_variance_decomposition</option> = <replaceable>INTEGER</replaceable></term></varlistentry> <term><option>conditional_variance_decomposition</option> = <replaceable>INTEGER</replaceable></term>
<listitem><para>See below</para></listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><option>conditional_variance_decomposition</option> = [<replaceable>INTEGER1</replaceable>:<replaceable>INTEGER2</replaceable>]</term></varlistentry> <term><option>conditional_variance_decomposition</option> = [<replaceable>INTEGER1</replaceable>:<replaceable>INTEGER2</replaceable>]</term>
<listitem><para>See below</para></listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><option>conditional_variance_decomposition</option> = [<replaceable>INTEGER1</replaceable> <replaceable>INTEGER2</replaceable> ...]</term> <term><option>conditional_variance_decomposition</option> = [<replaceable>INTEGER1</replaceable> <replaceable>INTEGER2</replaceable> ...]</term>
<listitem><para>Computes a conditional variance decomposition for the specified period(s). Conditional variances are given by var(y<subscript>t+k</subscript>|t). For period 1, the conditional variance decomposition provides the decomposition of the effects of shocks upon impact.</para></listitem> <listitem><para>Computes a conditional variance decomposition for the specified period(s). Conditional variances are given by var(y<subscript>t+k</subscript>|t). For period 1, the conditional variance decomposition provides the decomposition of the effects of shocks upon impact.</para></listitem>

View File

@ -34,12 +34,12 @@ using namespace std;
Splitting main() in two parts was necessary because ParsingDriver.h and MacroDriver.h can't be Splitting main() in two parts was necessary because ParsingDriver.h and MacroDriver.h can't be
included simultaneously (because of Bison limitations). included simultaneously (because of Bison limitations).
*/ */
void main2(stringstream &in, string &basename, bool debug, bool clear_all, bool no_tmp_terms); void main2(stringstream &in, string &basename, bool debug, bool clear_all, bool no_tmp_terms, bool warn_uninit);
void void
usage() usage()
{ {
cerr << "Dynare usage: dynare mod_file [debug] [noclearall] [savemacro[=macro_file]] [onlymacro] [nolinemacro] [notmpterms]" << endl; cerr << "Dynare usage: dynare mod_file [debug] [noclearall] [savemacro[=macro_file]] [onlymacro] [nolinemacro] [notmpterms] [warn_uninit]" << endl;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -59,6 +59,7 @@ main(int argc, char** argv)
bool no_tmp_terms = false; bool no_tmp_terms = false;
bool only_macro = false; bool only_macro = false;
bool no_line_macro = false; bool no_line_macro = false;
bool warn_uninit = false;
// Parse options // Parse options
for (int arg = 2; arg < argc; arg++) for (int arg = 2; arg < argc; arg++)
@ -86,6 +87,8 @@ main(int argc, char** argv)
no_line_macro = true; no_line_macro = true;
else if (!strcmp(argv[arg], "notmpterms")) else if (!strcmp(argv[arg], "notmpterms"))
no_tmp_terms = true; no_tmp_terms = true;
else if (!strcmp(argv[arg], "warn_uninit"))
warn_uninit = true;
else else
{ {
cerr << "Unknown option: " << argv[arg] << endl; cerr << "Unknown option: " << argv[arg] << endl;
@ -125,7 +128,7 @@ main(int argc, char** argv)
return EXIT_SUCCESS; return EXIT_SUCCESS;
// Do the rest // Do the rest
main2(macro_output, basename, debug, clear_all, no_tmp_terms); main2(macro_output, basename, debug, clear_all, no_tmp_terms, warn_uninit);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -25,7 +25,8 @@ using namespace std;
#include "ModFile.hh" #include "ModFile.hh"
void void
main2(stringstream &in, string &basename, bool debug, bool clear_all, bool no_tmp_terms) main2(stringstream &in, string &basename, bool debug, bool clear_all, bool no_tmp_terms,
bool warn_uninit)
{ {
ParsingDriver p; ParsingDriver p;
@ -39,7 +40,7 @@ main2(stringstream &in, string &basename, bool debug, bool clear_all, bool no_tm
mod_file->transformPass(); mod_file->transformPass();
// Evaluate parameters initialization, initval, endval and pounds // Evaluate parameters initialization, initval, endval and pounds
mod_file->evalAllExpressions(); mod_file->evalAllExpressions(warn_uninit);
// Do computations // Do computations
mod_file->computingPass(no_tmp_terms); mod_file->computingPass(no_tmp_terms);

View File

@ -40,7 +40,7 @@ ModFile::~ModFile()
} }
void void
ModFile::evalAllExpressions() ModFile::evalAllExpressions(bool warn_uninit)
{ {
cout << "Evaluating expressions..."; cout << "Evaluating expressions...";
@ -73,7 +73,8 @@ ModFile::evalAllExpressions()
|| type == eParameter || type == eModelLocalVariable) || type == eParameter || type == eModelLocalVariable)
&& global_eval_context.find(id) == global_eval_context.end()) && global_eval_context.find(id) == global_eval_context.end())
{ {
cerr << "WARNING: can't find a numeric initial value for " << symbol_table.getName(id) << ", using zero" << endl; if (warn_uninit)
cerr << "WARNING: can't find a numeric initial value for " << symbol_table.getName(id) << ", using zero" << endl;
global_eval_context[id] = 0; global_eval_context[id] = 0;
} }
} }

View File

@ -77,7 +77,8 @@ public:
//! Add a statement //! Add a statement
void addStatement(Statement *st); void addStatement(Statement *st);
//! Evaluate all the statements //! Evaluate all the statements
void evalAllExpressions(); /*! \param warn_uninit Should a warning be displayed for uninitialized endogenous/exogenous/parameters ? */
void evalAllExpressions(bool warn_uninit);
//! Do some checking and fills mod_file_struct //! Do some checking and fills mod_file_struct
/*! \todo add check for number of equations and endogenous if ramsey_policy is present */ /*! \todo add check for number of equations and endogenous if ramsey_policy is present */
void checkPass(); void checkPass();