New "console" option (closes #130)

time-shift
Sébastien Villemot 2010-10-28 11:19:11 +02:00
parent c28d15d78a
commit 9d6ad96abd
5 changed files with 20 additions and 7 deletions

View File

@ -280,6 +280,7 @@ mark_as_command dynare
<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> <arg><option>warn_uninit</option></arg>
<arg><option>console</option></arg>
<arg><option>cygwin</option></arg> <arg><option>cygwin</option></arg>
<arg><option>msvc</option></arg> <arg><option>msvc</option></arg>
</cmdsynopsis> </cmdsynopsis>
@ -347,6 +348,10 @@ mark_as_command dynare
<term><option>warn_uninit</option></term> <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> <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> </varlistentry>
<varlistentry>
<term><option>console</option></term>
<listitem><para>Activate console mode: Dynare will not use graphical waitbars for long computations. Note that this option is only useful under <trademark class="registered">MATLAB</trademark>, since Octave does not provide graphical waitbar capabilities.</para></listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><option>cygwin</option></term> <term><option>cygwin</option></term>
<listitem><para>Tells Dynare that your <trademark class="registered">MATLAB</trademark> is configured for compiling MEX files with Cygwin (see <xref linkend="software-requirements"/>). This option is only available under Windows, and is used in conjunction with <xref linkend="use_dll"/>.</para></listitem> <listitem><para>Tells Dynare that your <trademark class="registered">MATLAB</trademark> is configured for compiling MEX files with Cygwin (see <xref linkend="software-requirements"/>). This option is only available under Windows, and is used in conjunction with <xref linkend="use_dll"/>.</para></listitem>

View File

@ -34,7 +34,7 @@ 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, bool warn_uninit, void main2(stringstream &in, string &basename, bool debug, bool clear_all, bool no_tmp_terms, bool warn_uninit, bool console,
bool parallel, const string &parallel_config_file, const string &cluster_name, bool parallel_slave_open_mode, bool parallel, const string &parallel_config_file, const string &cluster_name, bool parallel_slave_open_mode,
bool parallel_test bool parallel_test
#if defined(_WIN32) || defined(__CYGWIN32__) #if defined(_WIN32) || defined(__CYGWIN32__)
@ -46,7 +46,7 @@ void
usage() usage()
{ {
cerr << "Dynare usage: dynare mod_file [debug] [noclearall] [savemacro[=macro_file]] [onlymacro] [nolinemacro] [notmpterms] [warn_uninit]" cerr << "Dynare usage: dynare mod_file [debug] [noclearall] [savemacro[=macro_file]] [onlymacro] [nolinemacro] [notmpterms] [warn_uninit]"
<< " [parallel[=cluster_name]] [conffile=parallel_config_path_and_filename] [parallel_slave_open_mode] [parallel_test]" << " [console] [parallel[=cluster_name]] [conffile=parallel_config_path_and_filename] [parallel_slave_open_mode] [parallel_test]"
#if defined(_WIN32) || defined(__CYGWIN32__) #if defined(_WIN32) || defined(__CYGWIN32__)
<< " [cygwin] [msvc]" << " [cygwin] [msvc]"
#endif #endif
@ -71,6 +71,7 @@ main(int argc, char **argv)
bool only_macro = false; bool only_macro = false;
bool no_line_macro = false; bool no_line_macro = false;
bool warn_uninit = false; bool warn_uninit = false;
bool console = false;
#if defined(_WIN32) || defined(__CYGWIN32__) #if defined(_WIN32) || defined(__CYGWIN32__)
bool cygwin = false; bool cygwin = false;
bool msvc = false; bool msvc = false;
@ -109,6 +110,8 @@ main(int argc, char **argv)
no_tmp_terms = true; no_tmp_terms = true;
else if (!strcmp(argv[arg], "warn_uninit")) else if (!strcmp(argv[arg], "warn_uninit"))
warn_uninit = true; warn_uninit = true;
else if (!strcmp(argv[arg], "console"))
console = true;
#if defined(_WIN32) || defined(__CYGWIN32__) #if defined(_WIN32) || defined(__CYGWIN32__)
else if (!strcmp(argv[arg], "cygwin")) else if (!strcmp(argv[arg], "cygwin"))
cygwin = true; cygwin = true;
@ -180,7 +183,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, warn_uninit, main2(macro_output, basename, debug, clear_all, no_tmp_terms, warn_uninit, console,
parallel, parallel_config_file, cluster_name, parallel_slave_open_mode, parallel_test parallel, parallel_config_file, cluster_name, parallel_slave_open_mode, parallel_test
#if defined(_WIN32) || defined(__CYGWIN32__) #if defined(_WIN32) || defined(__CYGWIN32__)
, cygwin, msvc , cygwin, msvc

View File

@ -26,7 +26,7 @@ using namespace std;
#include "ConfigFile.hh" #include "ConfigFile.hh"
void void
main2(stringstream &in, string &basename, bool debug, bool clear_all, bool no_tmp_terms, bool warn_uninit, main2(stringstream &in, string &basename, bool debug, bool clear_all, bool no_tmp_terms, bool warn_uninit, bool console,
bool parallel, const string &parallel_config_file, const string &cluster_name, bool parallel_slave_open_mode, bool parallel, const string &parallel_config_file, const string &cluster_name, bool parallel_slave_open_mode,
bool parallel_test bool parallel_test
#if defined(_WIN32) || defined(__CYGWIN32__) #if defined(_WIN32) || defined(__CYGWIN32__)
@ -56,7 +56,7 @@ main2(stringstream &in, string &basename, bool debug, bool clear_all, bool no_tm
mod_file->computingPass(no_tmp_terms); mod_file->computingPass(no_tmp_terms);
// Write outputs // Write outputs
mod_file->writeOutputFiles(basename, clear_all, config_file mod_file->writeOutputFiles(basename, clear_all, console, config_file
#if defined(_WIN32) || defined(__CYGWIN32__) #if defined(_WIN32) || defined(__CYGWIN32__)
, cygwin, msvc , cygwin, msvc
#endif #endif

View File

@ -345,7 +345,7 @@ ModFile::computingPass(bool no_tmp_terms)
} }
void void
ModFile::writeOutputFiles(const string &basename, bool clear_all, const ConfigFile &config_file ModFile::writeOutputFiles(const string &basename, bool clear_all, bool console, const ConfigFile &config_file
#if defined(_WIN32) || defined(__CYGWIN32__) #if defined(_WIN32) || defined(__CYGWIN32__)
, bool cygwin, bool msvc , bool cygwin, bool msvc
#endif #endif
@ -398,6 +398,9 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, const ConfigFi
<< "end" << endl << "end" << endl
<< "diary(logname_)" << endl; << "diary(logname_)" << endl;
if (console)
mOutputFile << "options_.console_mode = 1;" << endl;
cout << "Processing outputs ..."; cout << "Processing outputs ...";
symbol_table.writeOutput(mOutputFile); symbol_table.writeOutput(mOutputFile);

View File

@ -105,9 +105,11 @@ public:
/*! /*!
\param basename The base name used for writing output files. Should be the name of the mod file without its extension \param basename The base name used for writing output files. Should be the name of the mod file without its extension
\param clear_all Should a "clear all" instruction be written to output ? \param clear_all Should a "clear all" instruction be written to output ?
\param console Are we in console mode ?
\param cygwin Should the MEX command of use_dll be adapted for Cygwin?
\param msvc Should the MEX command of use_dll be adapted for MSVC? \param msvc Should the MEX command of use_dll be adapted for MSVC?
*/ */
void writeOutputFiles(const string &basename, bool clear_all, const ConfigFile &config_file void writeOutputFiles(const string &basename, bool clear_all, bool console, const ConfigFile &config_file
#if defined(_WIN32) || defined(__CYGWIN32__) #if defined(_WIN32) || defined(__CYGWIN32__)
, bool cygwin, bool msvc , bool cygwin, bool msvc
#endif #endif