Use true/false instead of 1/0 for boolean options

This is more elegant, and makes it easier to distinguish them from integer
options.
parent 1793078b
Pipeline #1003 passed with stage
in 1 minute and 49 seconds
This diff is collapsed.
......@@ -3124,9 +3124,7 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
/* Say if static and dynamic models differ (because of [static] and [dynamic]
equation tags) */
output << modstruct << "static_and_dynamic_models_differ = "
<< (static_only_equations.size() > 0 ?
(julia ? "true" : "1") :
(julia ? "false" : "0"))
<< (static_only_equations.size() > 0 ? "true" :"false")
<< ";" << endl;
vector<int> state_var;
......
This diff is collapsed.
......@@ -889,16 +889,16 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
mOutputFile << "diary('" << basename << ".log');" << endl;
if (minimal_workspace)
mOutputFile << "options_.minimal_workspace = 1;" << endl;
mOutputFile << "options_.minimal_workspace = true;" << endl;
if (console)
mOutputFile << "options_.console_mode = 1;" << endl
<< "options_.nodisplay = 1;" << endl;
mOutputFile << "options_.console_mode = true;" << endl
<< "options_.nodisplay = true;" << endl;
if (nograph)
mOutputFile << "options_.nograph = 1;" << endl;
mOutputFile << "options_.nograph = true;" << endl;
if (nointeractive)
mOutputFile << "options_.nointeractive = 1;" << endl;
mOutputFile << "options_.nointeractive = true;" << endl;
if (param_used_with_lead_lag)
mOutputFile << "M_.parameter_used_with_lead_lag = true;" << endl;
......@@ -926,18 +926,18 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
<< "M_.Correlation_matrix_ME = 1;" << endl;
// May be later modified by a shocks block
mOutputFile << "M_.sigma_e_is_diagonal = 1;" << endl;
mOutputFile << "M_.sigma_e_is_diagonal = true;" << endl;
// Initialize M_.det_shocks
mOutputFile << "M_.det_shocks = [];" << endl;
if (linear == 1)
mOutputFile << "options_.linear = 1;" << endl;
auto to_matlab_logical = [](bool m) { return m ? "true" : "false"; };
mOutputFile << "options_.block=" << block << ";" << endl
<< "options_.bytecode=" << byte_code << ";" << endl
<< "options_.use_dll=" << use_dll << ";" << endl
<< "options_.linear_decomposition=" << linear_decomposition << ";" << endl;
mOutputFile << "options_.linear = " << to_matlab_logical(linear) << ";" << endl
<< "options_.block = " << to_matlab_logical(block) << ";" << endl
<< "options_.bytecode = " << to_matlab_logical(byte_code) << ";" << endl
<< "options_.use_dll = " << to_matlab_logical(use_dll) << ";" << endl
<< "options_.linear_decomposition = " << to_matlab_logical(linear_decomposition) << ";" << endl;
if (parallel_local_files.size() > 0)
{
......
......@@ -225,7 +225,7 @@ InitValStatement::writeOutput(ostream &output, const string &basename, bool mini
<< "% INITVAL instructions" << endl
<< "%" << endl;
// Writing initval block to set initial values for variables
output << "options_.initval_file = 0;" << endl;
output << "options_.initval_file = false;" << endl;
writeInitValues(output);
}
......@@ -420,7 +420,7 @@ InitvalFileStatement::writeOutput(ostream &output, const string &basename, bool
output << "%" << endl
<< "% INITVAL_FILE statement" << endl
<< "%" << endl
<< "options_.initval_file = 1;" << endl
<< "options_.initval_file = true;" << endl
<< "initvalf('" << filename << "');" << endl;
}
......
Markdown is supported
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