From ed84e2731901e5553483a0da3660aac5593c4f15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Fri, 23 Apr 2010 18:36:51 +0200 Subject: [PATCH] Preprocessor: added new SymbolTable::orig_endo_nbr() method --- preprocessor/SymbolTable.cc | 2 +- preprocessor/SymbolTable.hh | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/preprocessor/SymbolTable.cc b/preprocessor/SymbolTable.cc index c4c05fc76..ae4af72c3 100644 --- a/preprocessor/SymbolTable.cc +++ b/preprocessor/SymbolTable.cc @@ -210,7 +210,7 @@ SymbolTable::writeOutput(ostream &output) const throw (NotYetFrozenException) << "M_.param_nbr = " << param_nbr() << ";" << endl; // Write the auxiliary variable table - output << "M_.orig_endo_nbr = " << endo_nbr() - aux_vars.size() << ";" << endl; + output << "M_.orig_endo_nbr = " << orig_endo_nbr() << ";" << endl; if (aux_vars.size() == 0) output << "M_.aux_vars = [];" << endl; else diff --git a/preprocessor/SymbolTable.hh b/preprocessor/SymbolTable.hh index 70105ff31..ecc886b21 100644 --- a/preprocessor/SymbolTable.hh +++ b/preprocessor/SymbolTable.hh @@ -236,6 +236,8 @@ public: inline int param_nbr() const throw (NotYetFrozenException); //! Returns the greatest symbol ID (the smallest is zero) inline int maxID(); + //! Get number of user-declared endogenous variables (without the auxiliary variables) + inline int orig_endo_nbr() const throw (NotYetFrozenException); //! Write output of this class void writeOutput(ostream &output) const throw (NotYetFrozenException); //! Mark a symbol as predetermined variable @@ -364,4 +366,10 @@ SymbolTable::maxID() return (size-1); } +inline int +SymbolTable::orig_endo_nbr() const throw (NotYetFrozenException) +{ + return (endo_nbr() - aux_vars.size()); +} + #endif