preprocessor: add new commandline option onlyclearglobals. closes #635
parent
8ddda0ef82
commit
0f24ec02a6
|
@ -35,7 +35,8 @@
|
|||
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 no_log, bool no_warn, bool warn_uninit, bool console, bool nograph, bool nointeractive,
|
||||
void main2(stringstream &in, string &basename, bool debug, bool clear_all, bool clear_global, bool no_tmp_terms, bool no_log, bool no_warn,
|
||||
bool warn_uninit, bool console, bool nograph, bool nointeractive,
|
||||
bool parallel, const string ¶llel_config_file, const string &cluster_name, bool parallel_slave_open_mode,
|
||||
bool parallel_test, bool nostrict, FileOutputType output_mode, LanguageOutputType lang
|
||||
#if defined(_WIN32) || defined(__CYGWIN32__)
|
||||
|
@ -46,7 +47,7 @@ void main2(stringstream &in, string &basename, bool debug, bool clear_all, bool
|
|||
void
|
||||
usage()
|
||||
{
|
||||
cerr << "Dynare usage: dynare mod_file [debug] [noclearall] [savemacro[=macro_file]] [onlymacro] [nolinemacro] [notmpterms] [nolog] [warn_uninit]"
|
||||
cerr << "Dynare usage: dynare mod_file [debug] [noclearall] [onlyclearglobals] [savemacro[=macro_file]] [onlymacro] [nolinemacro] [notmpterms] [nolog] [warn_uninit]"
|
||||
<< " [console] [nograph] [nointeractive] [parallel[=cluster_name]] [conffile=parallel_config_path_and_filename] [parallel_slave_open_mode] [parallel_test] "
|
||||
<< " [-D<variable>[=<value>]] [nostrict] [output=dynamic|first|second|third] [language=C|C++]"
|
||||
#if defined(_WIN32) || defined(__CYGWIN32__)
|
||||
|
@ -73,6 +74,7 @@ main(int argc, char **argv)
|
|||
}
|
||||
|
||||
bool clear_all = true;
|
||||
bool clear_global = false;
|
||||
bool save_macro = false;
|
||||
string save_macro_file;
|
||||
bool debug = false;
|
||||
|
@ -106,6 +108,11 @@ main(int argc, char **argv)
|
|||
debug = true;
|
||||
else if (!strcmp(argv[arg], "noclearall"))
|
||||
clear_all = false;
|
||||
else if (!strcmp(argv[arg], "onlyclearglobals"))
|
||||
{
|
||||
clear_all = false;
|
||||
clear_global = true;
|
||||
}
|
||||
else if (!strcmp(argv[arg], "onlymacro"))
|
||||
only_macro = true;
|
||||
else if (strlen(argv[arg]) >= 9 && !strncmp(argv[arg], "savemacro", 9))
|
||||
|
@ -277,7 +284,7 @@ main(int argc, char **argv)
|
|||
return EXIT_SUCCESS;
|
||||
|
||||
// Do the rest
|
||||
main2(macro_output, basename, debug, clear_all, no_tmp_terms, no_log, no_warn, warn_uninit, console, nograph, nointeractive,
|
||||
main2(macro_output, basename, debug, clear_all, clear_global, no_tmp_terms, no_log, no_warn, warn_uninit, console, nograph, nointeractive,
|
||||
parallel, parallel_config_file, cluster_name, parallel_slave_open_mode, parallel_test, nostrict, output_mode, language
|
||||
#if defined(_WIN32) || defined(__CYGWIN32__)
|
||||
, cygwin, msvc
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "ExtendedPreprocessorTypes.hh"
|
||||
|
||||
void
|
||||
main2(stringstream &in, string &basename, bool debug, bool clear_all, bool no_tmp_terms, bool no_log, bool no_warn, bool warn_uninit, bool console, bool nograph, bool nointeractive,
|
||||
main2(stringstream &in, string &basename, bool debug, bool clear_all, bool clear_global, bool no_tmp_terms, bool no_log, bool no_warn, bool warn_uninit, bool console, bool nograph, bool nointeractive,
|
||||
bool parallel, const string ¶llel_config_file, const string &cluster_name, bool parallel_slave_open_mode,
|
||||
bool parallel_test, bool nostrict, FileOutputType output_mode, LanguageOutputType language
|
||||
#if defined(_WIN32) || defined(__CYGWIN32__)
|
||||
|
@ -60,7 +60,7 @@ main2(stringstream &in, string &basename, bool debug, bool clear_all, bool no_tm
|
|||
if (output_mode != none)
|
||||
mod_file->writeExternalFiles(basename, output_mode, language);
|
||||
else
|
||||
mod_file->writeOutputFiles(basename, clear_all, no_log, no_warn, console, nograph, nointeractive, config_file
|
||||
mod_file->writeOutputFiles(basename, clear_all, clear_global, no_log, no_warn, console, nograph, nointeractive, config_file
|
||||
#if defined(_WIN32) || defined(__CYGWIN32__)
|
||||
, cygwin, msvc
|
||||
#endif
|
||||
|
|
|
@ -522,7 +522,7 @@ ModFile::computingPass(bool no_tmp_terms, FileOutputType output)
|
|||
}
|
||||
|
||||
void
|
||||
ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, bool no_warn, bool console, bool nograph, bool nointeractive, const ConfigFile &config_file
|
||||
ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_global, bool no_log, bool no_warn, bool console, bool nograph, bool nointeractive, const ConfigFile &config_file
|
||||
#if defined(_WIN32) || defined(__CYGWIN32__)
|
||||
, bool cygwin, bool msvc
|
||||
#endif
|
||||
|
@ -559,6 +559,8 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, b
|
|||
|
||||
if (clear_all)
|
||||
mOutputFile << "clear all" << endl;
|
||||
else if (clear_global)
|
||||
mOutputFile << "clear M_ options_ oo_ estim_params_ bayestopt_ dataset_;" << endl;
|
||||
|
||||
mOutputFile << "tic;" << endl
|
||||
<< "% Save empty dates and dseries objects in memory." << endl
|
||||
|
|
|
@ -136,7 +136,7 @@ public:
|
|||
\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, bool no_log, bool no_warn, bool console, bool nograph, bool nointeractive, const ConfigFile &config_file
|
||||
void writeOutputFiles(const string &basename, bool clear_all, bool clear_global, bool no_log, bool no_warn, bool console, bool nograph, bool nointeractive, const ConfigFile &config_file
|
||||
#if defined(_WIN32) || defined(__CYGWIN32__)
|
||||
, bool cygwin, bool msvc
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue