From 4419f4aa51c5e408937adec77a80c387dbb02fd0 Mon Sep 17 00:00:00 2001
From: sebastien <sebastien@ac1d8469-bf42-47a9-8791-bf33cf982152>
Date: Thu, 26 Nov 2009 17:25:04 +0000
Subject: [PATCH] preprocessor: allow the omission of model block when sbvar or
 ms_sbvar statement is used

git-svn-id: https://www.dynare.org/svn/dynare/trunk@3169 ac1d8469-bf42-47a9-8791-bf33cf982152
---
 ComputingTasks.cc |  8 ++++----
 ModFile.cc        |  3 +--
 Statement.cc      |  3 +--
 Statement.hh      | 10 ++--------
 4 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/ComputingTasks.cc b/ComputingTasks.cc
index f9f2223f..90f7e9a8 100644
--- a/ComputingTasks.cc
+++ b/ComputingTasks.cc
@@ -901,7 +901,7 @@ BVARDensityStatement::BVARDensityStatement(int maxnlags_arg, const OptionsList &
 void
 BVARDensityStatement::checkPass(ModFileStructure &mod_file_struct)
 {
-  mod_file_struct.bvar_density_present = true;
+  mod_file_struct.bvar_present = true;
 }
 
 void
@@ -920,7 +920,7 @@ BVARForecastStatement::BVARForecastStatement(int nlags_arg, const OptionsList &o
 void
 BVARForecastStatement::checkPass(ModFileStructure &mod_file_struct)
 {
-  mod_file_struct.bvar_forecast_present = true;
+  mod_file_struct.bvar_present = true;
 }
 
 void
@@ -938,7 +938,7 @@ SBVARStatement::SBVARStatement(const OptionsList &options_list_arg) :
 void
 SBVARStatement::checkPass(ModFileStructure &mod_file_struct)
 {
-  mod_file_struct.sbvar_present = true;
+  mod_file_struct.bvar_present = true;
 }
 
 void
@@ -956,7 +956,7 @@ MS_SBVARStatement::MS_SBVARStatement(const OptionsList &options_list_arg) :
 void
 MS_SBVARStatement::checkPass(ModFileStructure &mod_file_struct)
 {
-  mod_file_struct.ms_sbvar_present = true;
+  mod_file_struct.bvar_present = true;
 }
 
 void
diff --git a/ModFile.cc b/ModFile.cc
index 77e57716..7201dc28 100644
--- a/ModFile.cc
+++ b/ModFile.cc
@@ -161,8 +161,7 @@ ModFile::transformPass()
     - a BVAR command is used and there is no equation (standalone BVAR estimation)
   */
   if (!mod_file_struct.ramsey_policy_present
-      && !((mod_file_struct.bvar_density_present || mod_file_struct.bvar_forecast_present)
-           && dynamic_model.equation_number() == 0)
+      && !(mod_file_struct.bvar_present && dynamic_model.equation_number() == 0)
       && (dynamic_model.equation_number() != symbol_table.endo_nbr()))
     {
       cerr << "ERROR: There are " << dynamic_model.equation_number() << " equations but " << symbol_table.endo_nbr() << " endogenous variables!" << endl;
diff --git a/Statement.cc b/Statement.cc
index 97d4ad64..786fbc42 100644
--- a/Statement.cc
+++ b/Statement.cc
@@ -27,8 +27,7 @@ ModFileStructure::ModFileStructure() :
   osr_present(false),
   ramsey_policy_present(false),
   order_option(0),
-  bvar_density_present(false),
-  bvar_forecast_present(false),
+  bvar_present(false),
   identification_present(false),
   partial_information(false),
   shocks_present(false)
diff --git a/Statement.hh b/Statement.hh
index cfeb071d..5469bb97 100644
--- a/Statement.hh
+++ b/Statement.hh
@@ -48,14 +48,8 @@ public:
   //! 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;
-  //! Whether a bvar_density statement is present
-  bool bvar_density_present;
-  //! Whether a bvar_forecast statement is present
-  bool bvar_forecast_present;
-  //! Whether a sbvar statement is present
-  bool sbvar_present;
-  //! Whether a sbvar statement is present
-  bool ms_sbvar_present;
+  //! Whether a bvar_density, bvar_forecast, sbvar, ms_sbvar statement is present
+  bool bvar_present;
   //! Whether an identification statement is present or the identification option of dynare_sensitivity statement is equal to one
   bool identification_present;
   //! Whether the option partial_information is given to stoch_simul/estimation/osr/ramsey_policy
-- 
GitLab