From 74fa654047fb2da0ad64a5b5d5b996dd1bbd4c09 Mon Sep 17 00:00:00 2001
From: sebastien <sebastien@ac1d8469-bf42-47a9-8791-bf33cf982152>
Date: Thu, 24 Apr 2008 10:55:26 +0000
Subject: [PATCH] v4 preprocessor: fixed bug with "order" option

git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1809 ac1d8469-bf42-47a9-8791-bf33cf982152
---
 ModFile.cc           | 4 ++++
 Statement.cc         | 2 +-
 include/Statement.hh | 3 ++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ModFile.cc b/ModFile.cc
index 9381545f..45f5ab3b 100644
--- a/ModFile.cc
+++ b/ModFile.cc
@@ -49,6 +49,10 @@ ModFile::checkPass()
       it != statements.end(); it++)
     (*it)->checkPass(mod_file_struct);
 
+  // If order option has not been set, default to 2
+  if (!mod_file_struct.order_option)
+    mod_file_struct.order_option = 2;
+
   // Allow empty model only when doing a standalone BVAR estimation
   if (model_tree.equation_number() == 0
       && (mod_file_struct.check_present
diff --git a/Statement.cc b/Statement.cc
index 8d385e65..dc629b49 100644
--- a/Statement.cc
+++ b/Statement.cc
@@ -23,7 +23,7 @@ ModFileStructure::ModFileStructure() :
   check_present(false),
   simul_present(false),
   stoch_simul_or_similar_present(false),
-  order_option(2)
+  order_option(0)
 {
 }
 
diff --git a/include/Statement.hh b/include/Statement.hh
index 41cf774e..77dd8744 100644
--- a/include/Statement.hh
+++ b/include/Statement.hh
@@ -39,7 +39,8 @@ public:
   //! Whether a stoch_simul, estimation, osr, ramsey_policy statement is present
   bool stoch_simul_or_similar_present;
   //! The value of the "order" option of stoch_simul, estimation, osr, ramsey_policy
-  /*! Defaults to 2 */
+  //! Derivation order
+  /*! First initialized to zero. If user sets order option somewhere in the MOD file, it will be equal to the maximum of order options. Otherwise will default to 2 */
   int order_option;
 };
 
-- 
GitLab