Commit 9d6ad96a authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

New "console" option (closes #130)

parent c28d15d7
......@@ -280,6 +280,7 @@ mark_as_command dynare
<arg><option>onlymacro</option></arg>
<arg><option>nolinemacro</option></arg>
<arg><option>warn_uninit</option></arg>
<arg><option>console</option></arg>
<arg><option>cygwin</option></arg>
<arg><option>msvc</option></arg>
</cmdsynopsis>
......@@ -347,6 +348,10 @@ mark_as_command dynare
<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>
<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>
<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>
......
......@@ -34,7 +34,7 @@ using namespace std;
Splitting main() in two parts was necessary because ParsingDriver.h and MacroDriver.h can't be
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_test
#if defined(_WIN32) || defined(__CYGWIN32__)
......@@ -46,7 +46,7 @@ void
usage()
{
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__)
<< " [cygwin] [msvc]"
#endif
......@@ -71,6 +71,7 @@ main(int argc, char **argv)
bool only_macro = false;
bool no_line_macro = false;
bool warn_uninit = false;
bool console = false;
#if defined(_WIN32) || defined(__CYGWIN32__)
bool cygwin = false;
bool msvc = false;
......@@ -109,6 +110,8 @@ main(int argc, char **argv)
no_tmp_terms = true;
else if (!strcmp(argv[arg], "warn_uninit"))
warn_uninit = true;
else if (!strcmp(argv[arg], "console"))
console = true;
#if defined(_WIN32) || defined(__CYGWIN32__)
else if (!strcmp(argv[arg], "cygwin"))
cygwin = true;
......@@ -180,7 +183,7 @@ main(int argc, char **argv)
return EXIT_SUCCESS;
// 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
#if defined(_WIN32) || defined(__CYGWIN32__)
, cygwin, msvc
......
......@@ -26,7 +26,7 @@ using namespace std;
#include "ConfigFile.hh"
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_test
#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);
// Write outputs
mod_file->writeOutputFiles(basename, clear_all, config_file
mod_file->writeOutputFiles(basename, clear_all, console, config_file
#if defined(_WIN32) || defined(__CYGWIN32__)
, cygwin, msvc
#endif
......
......@@ -345,7 +345,7 @@ ModFile::computingPass(bool no_tmp_terms)
}
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__)
, bool cygwin, bool msvc
#endif
......@@ -398,6 +398,9 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, const ConfigFi
<< "end" << endl
<< "diary(logname_)" << endl;
if (console)
mOutputFile << "options_.console_mode = 1;" << endl;
cout << "Processing outputs ...";
symbol_table.writeOutput(mOutputFile);
......
......@@ -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 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?
*/
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__)
, bool cygwin, bool msvc
#endif
......
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