2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2013 - Scilab Enterprises - Antoine ELIAS
5 * This file must be used under the terms of the CeCILL.
6 * This source file is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at
9 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
13 #ifndef __NEWSCOPE_HXX__
14 #define __NEWSCOPE_HXX__
16 #include "variables.hxx"
23 Scope(Variables* _vars, int _iLevel) : m_vars(_vars), m_iLevel(_iLevel) {}
26 void put(const Symbol& _key, types::InternalType& _iT);
27 void remove(const Symbol& _key);
28 void print(std::wostream& ostr);
29 void addVar(const symbol::Symbol& _key);
30 void removeVar(const symbol::Symbol& _key);
37 typedef std::map<Symbol, int> SymbolMap;
46 typedef std::list<Scope*> ScopesList;
53 Scopes() : m_iLevel(-1) {}
61 void put(const Symbol& _key, types::InternalType& _iT, int _iLevel);
63 void put(const Symbol& _key, types::InternalType& _iT);
64 void putInPreviousScope(const Symbol& _key, types::InternalType& _iT);
67 types::InternalType* get(const Symbol& _key) const;
68 types::InternalType* getCurrentLevel(const Symbol& _key) const;
69 types::InternalType* getAllButCurrentLevel(const Symbol& _key) const;
72 bool remove(const Symbol& _key);
75 bool isGlobalVisible(const symbol::Symbol& _key) const;
76 void removeGlobal(const symbol::Symbol& _key);
77 void removeGlobalAll();
78 void setGlobalVisible(const symbol::Symbol& _key, bool bVisible);
79 types::InternalType* getGlobalValue(const symbol::Symbol& _key) const;
80 bool isGlobalExists(const symbol::Symbol& _key) const;
81 void setGlobalValue(const symbol::Symbol& _key, types::InternalType &value);
82 void createEmptyGlobalValue(const symbol::Symbol& _key);
85 std::list<symbol::Symbol>& getFunctionList(const std::wstring& _stModuleName, bool _bFromEnd);
86 void print(std::wostream& ostr) const
88 ScopesList::const_iterator it = m_scopes.begin();
90 for (; it != m_scopes.end() ; it++)
93 ostr << std::endl << std::endl;
98 inline std::wostream& operator<< (std::wostream& ostr, const Scopes& _scopes)
106 #endif /* !__NEWSCOPE_HXX__ */