No longer deal with the log file at the preprocessor level

Ref. dynare#1743
issue#70
Sébastien Villemot 2021-01-06 14:19:33 +01:00
parent 7f77c4df60
commit 78874a01d3
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
3 changed files with 10 additions and 16 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright © 2003-2020 Dynare Team
* Copyright © 2003-2021 Dynare Team
*
* This file is part of Dynare.
*
@ -52,6 +52,9 @@ macroExpandModFile(const string &filename, const string &basename, const istream
void
usage()
{
/* "nolog" is in the following output, even though it is not parsed by the
preprocessor but by dynare.m, so that users get the right list of options
if they call the preprocessor from MATLAB/Octave. */
cerr << "Dynare usage: dynare mod_file [debug] [noclearall] [onlyclearglobals] [savemacro[=macro_file]] [onlymacro] [linemacro] [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>]] [-I/path] [nostrict] [stochastic] [fast] [minimal_workspace] [compute_xrefs] [output=dynamic|first|second|third] [language=matlab|julia]"
@ -132,7 +135,6 @@ main(int argc, char **argv)
bool no_tmp_terms = false;
bool only_macro = false;
bool line_macro = false;
bool no_log = false;
bool no_warn = false;
int params_derivs_order = 2;
bool warn_uninit = false;
@ -210,8 +212,6 @@ main(int argc, char **argv)
line_macro = true;
else if (s == "notmpterms")
no_tmp_terms = true;
else if (s == "nolog")
no_log = true;
else if (s == "nowarn")
no_warn = true;
else if (s == "warn_uninit")
@ -497,7 +497,7 @@ main(int argc, char **argv)
if (output_mode != FileOutputType::none)
mod_file->writeExternalFiles(basename, language);
else
mod_file->writeOutputFiles(basename, clear_all, clear_global, no_log, no_warn, console, nograph,
mod_file->writeOutputFiles(basename, clear_all, clear_global, no_warn, console, nograph,
nointeractive, config_file, check_model_changes, minimal_workspace, compute_xrefs,
mexext, matlabroot, dynareroot, onlymodel, gui, notime);

View File

@ -1,5 +1,5 @@
/*
* Copyright © 2006-2020 Dynare Team
* Copyright © 2006-2021 Dynare Team
*
* This file is part of Dynare.
*
@ -839,7 +839,7 @@ ModFile::computingPass(bool no_tmp_terms, FileOutputType output, int params_deri
}
void
ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_global, bool no_log, bool no_warn,
ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_global, bool no_warn,
bool console, bool nograph, bool nointeractive, const ConfigFile &config_file,
bool check_model_changes, bool minimal_workspace, bool compute_xrefs,
const string &mexext,
@ -928,10 +928,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
<< "%" << endl;
if (!onlymodel)
config_file.writeHooks(mOutputFile);
mOutputFile << "global_initialization;" << endl
<< "diary off;" << endl;
if (!no_log)
mOutputFile << "diary('" << basename << ".log');" << endl;
mOutputFile << "global_initialization;" << endl;
if (minimal_workspace)
mOutputFile << "options_.minimal_workspace = true;" << endl;
@ -1120,9 +1117,6 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
}
}
if (!no_log)
mOutputFile << "diary off" << endl;
mOutputFile.close();
if (hasModelChanged)

View File

@ -1,5 +1,5 @@
/*
* Copyright © 2006-2020 Dynare Team
* Copyright © 2006-2021 Dynare Team
*
* This file is part of Dynare.
*
@ -165,7 +165,7 @@ public:
\param mingw Should the MEX command of use_dll be adapted for MinGW?
\param compute_xrefs if true, equation cross references will be computed
*/
void writeOutputFiles(const string &basename, bool clear_all, bool clear_global, bool no_log, bool no_warn,
void writeOutputFiles(const string &basename, bool clear_all, bool clear_global, bool no_warn,
bool console, bool nograph, bool nointeractive, const ConfigFile &config_file,
bool check_model_changes, bool minimal_workspace, bool compute_xrefs,
const string &mexext, const filesystem::path &matlabroot,