From 42106f85a82494e9e2b95c56c9c4e126d1c45f82 Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan@dynare.org>
Date: Fri, 20 Dec 2019 11:25:01 +0100
Subject: [PATCH] det_cond_forecast: fix output aesthetics

- remove semicolon after `end`
- don't test for existence of `oo_`
- fix spacing to conform with MATLAB/Octave spacing

issue #39
---
 src/ComputingTasks.cc | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/ComputingTasks.cc b/src/ComputingTasks.cc
index 2515a9fd..e7ce5678 100644
--- a/src/ComputingTasks.cc
+++ b/src/ComputingTasks.cc
@@ -750,13 +750,11 @@ DetCondForecast::writeOutput(ostream &output, const string &basename, bool minim
   if (linear_decomposition)
     {
       output << "first_order_solution_to_compute = 1;" << endl
-             << "if exist('oo_')" << endl
-             << "  if isfield(oo_, 'dr')" << endl
+             << "if isfield(oo_, 'dr')" << endl
              << "    if isfield(oo_.dr, 'ghx') && isfield(oo_.dr, 'ghu') && isfield(oo_.dr, 'state_var') && isfield(oo_.dr, 'order_var')" << endl
-             << "      first_order_solution_to_compute = 0;" << endl
-             << "    end;" << endl
-             << "  end;" << endl
-             << "end;" << endl
+             << "        first_order_solution_to_compute = 0;" << endl
+             << "    end" << endl
+             << "end" << endl
              << "if first_order_solution_to_compute" << endl
              << "  fprintf('%s','Computing the first order solution ...');" << endl
              << "  options_.nograph = true;" << endl
@@ -773,7 +771,7 @@ DetCondForecast::writeOutput(ostream &output, const string &basename, bool minim
              << "  info = stoch_simul(var_list_);" << endl
              << R"(  fprintf('%s\n','done');)" << endl
              << "  options_.periods = tmp_periods;" << endl
-             << "end;" << endl;
+             << "end" << endl;
     }
   vector<string> symbols = symbol_list.get_symbols();
   if (symbols.size() > 0)
-- 
GitLab