From ddddb5ad0ffbc6fbcf54551063ec5b5ff901439b Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan@dynare.org>
Date: Mon, 12 Nov 2012 16:34:18 +0100
Subject: [PATCH] console => nodisplay (Completes ticket #282)

---
 doc/dynare.texi                |  6 +++---
 matlab/global_initialization.m | 27 ++++++++++++++-------------
 preprocessor/ModFile.cc        |  3 ++-
 3 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/doc/dynare.texi b/doc/dynare.texi
index 499f298181..76e392c99a 100644
--- a/doc/dynare.texi
+++ b/doc/dynare.texi
@@ -696,9 +696,9 @@ initialized. @xref{Parameter initialization}, or
 and exogenous variables.
 
 @item console
-Activate console mode: Dynare will not use graphical waitbars for long
-computations. Note that this option is only useful under MATLAB, since
-Octave does not provide graphical waitbar capabilities.
+Activate console mode. In addition to the behavior of
+@code{nodisplay}, Dynare will not use graphical waitbars for long
+computations.
 
 @item cygwin
 Tells Dynare that your MATLAB is configured for compiling MEX files with
diff --git a/matlab/global_initialization.m b/matlab/global_initialization.m
index 0c3f68811b..4554b8402a 100644
--- a/matlab/global_initialization.m
+++ b/matlab/global_initialization.m
@@ -34,19 +34,6 @@ estim_params_ = [];
 bayestopt_ = [];
 options_.datafile = '';
 options_.verbosity = 1;
-options_.console_mode = 0;
-if exist('OCTAVE_VERSION')
-    if sum(get(0,'screensize'))==4
-        options_.console_mode = 1;
-    end
-else
-    if isunix && (~usejava('jvm') || ...
-            ((matlab_ver_less_than('7.5') && sum(get(0,'ScreenSize'))==4) || ...
-            (~matlab_ver_less_than('7.5') && ~feature('ShowFigureWindows'))))
-        options_.console_mode = 1;
-    end
-end
-
 options_.terminal_condition = 0;
 options_.rplottype = 0;
 options_.smpl = 0;
@@ -125,6 +112,20 @@ options_.nodisplay = 0;
 options_.nograph = 0;
 options_.XTick = [];
 options_.XTickLabel = [];
+options_.console_mode = 0;
+if exist('OCTAVE_VERSION')
+    if sum(get(0,'screensize'))==4
+        options_.console_mode = 1;
+        options_.nodisplay = 1;
+    end
+else
+    if isunix && (~usejava('jvm') || ...
+            ((matlab_ver_less_than('7.5') && sum(get(0,'ScreenSize'))==4) || ...
+            (~matlab_ver_less_than('7.5') && ~feature('ShowFigureWindows'))))
+        options_.console_mode = 1;
+        options_.nodisplay = 1;
+    end
+end
 
 % IRFs & other stoch_simul output
 options_.irf = 40;
diff --git a/preprocessor/ModFile.cc b/preprocessor/ModFile.cc
index 3f6b4a4299..b1676b05ef 100644
--- a/preprocessor/ModFile.cc
+++ b/preprocessor/ModFile.cc
@@ -475,7 +475,8 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, b
                 << "diary(logname_)" << endl;
 
   if (console)
-    mOutputFile << "options_.console_mode = 1;" << endl;
+    mOutputFile << "options_.console_mode = 1;" << endl
+                << "options_.nodisplay = 1;" << endl;
 
   cout << "Processing outputs ...";
 
-- 
GitLab