Skip to content
Snippets Groups Projects
Select Git revision
  • d10242fbabbb09f4edce368bb11a81d929f1a9b6
  • master default
  • nlf-fixes
  • newton-quadratic-equation-solver
  • nlf-fixes-r
  • nls-fixes
  • sep-fixes
  • sep
  • use-dprior
  • ep-sparse
  • rebase-1
  • parfor
  • reset-seed-in-unit-tests
  • remove-persistent-variables
  • nonlinear-filter-fixes
  • pac-mce-with-composite-target
  • 6.x
  • dprior
  • covariance-quadratic-approximation
  • benchmark-ec
  • kalman_mex
  • 5.5
  • 5.4
  • 5.3
  • 5.2
  • 5.1
  • 5.0
  • 5.0-rc1
  • 4.7-beta3
  • 4.7-beta2
  • 4.7-beta1
  • 4.6.4
  • 4.6.3
  • 4.6.2
  • 4.6.1
  • 4.6.0
  • 4.6.0-rc2
  • 4.6.0-rc1
  • 4.6-beta1
  • 4.5.7
  • 4.5.6
41 results

extended_path_initialization.m

Blame
  • Forked from Dynare / dynare
    Source project has a limited visibility.
    SymbolTable.cc 22.67 KiB
    /*
     * Copyright (C) 2003-2015 Dynare Team
     *
     * This file is part of Dynare.
     *
     * Dynare is free software: you can redistribute it and/or modify
     * it under the terms of the GNU General Public License as published by
     * the Free Software Foundation, either version 3 of the License, or
     * (at your option) any later version.
     *
     * Dynare is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU General Public License for more details.
     *
     * You should have received a copy of the GNU General Public License
     * along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
     */
    
    #include <algorithm>
    #include <sstream>
    #include <iostream>
    #include <cassert>
    #include <list>
    
    #include "SymbolTable.hh"
    
    AuxVarInfo::AuxVarInfo(int symb_id_arg, aux_var_t type_arg, int orig_symb_id_arg, int orig_lead_lag_arg,
                           int equation_number_for_multiplier_arg) :
      symb_id(symb_id_arg),
      type(type_arg),
      orig_symb_id(orig_symb_id_arg),
      orig_lead_lag(orig_lead_lag_arg),
      equation_number_for_multiplier(equation_number_for_multiplier_arg)
    {
    }
    
    SymbolTable::SymbolTable() : frozen(false), size(0)
    {
    }
    
    int
    SymbolTable::addSymbol(const string &name, SymbolType type, const string &tex_name, const string &long_name) throw (AlreadyDeclaredException, FrozenException)
    {
      if (frozen)
        throw FrozenException();
    
      if (exists(name))
        {
          if (type_table[getID(name)] == type)
            throw AlreadyDeclaredException(name, true);
          else
            throw AlreadyDeclaredException(name, false);
        }
    
      string final_tex_name = tex_name;
      if (final_tex_name.empty())
        {
          final_tex_name = name;
          size_t pos = 0;
          while ((pos = final_tex_name.find('_', pos)) != string::npos)
            {
              final_tex_name.insert(pos, "\\");
              pos += 2;
            }
        }
    
      string final_long_name = long_name;
      if (final_long_name.empty())
        final_long_name = name;