vrq
/usr/src/RPM/BUILD/vrq-1.0.96/src/csymbol.h
Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Copyright (C) 1997-2007, Mark Hummel
00003  * This file is part of Vrq.
00004  *
00005  * Vrq is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * Vrq is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public
00016  * License along with this library; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, 
00018  * Boston, MA  02110-1301  USA
00019  *****************************************************************************
00020  */
00021 /******************************************************************************
00022  *
00023  *
00024  *         csymbol.hpp
00025  *              - class definition for symbol CSymbol 
00026  *
00027  *
00028  ******************************************************************************
00029  */
00030 
00031 #ifndef CSYMBOL_HPP
00032 #define CSYMBOL_HPP
00033 
00034 #include "glue.h"
00035 #include "cobject.h"
00036 #include <set>
00037 
00038 
00044 class CSymbol : public CObject
00045 {
00046 private:
00047         struct SymbolCompare {
00048             bool operator()( CSymbol* const& lhs, CSymbol* const& rhs );
00049         };
00050         static set<CSymbol*,SymbolCompare> hashTable;
00051         static CSymbol*         freeSymbol;               
00052         static CObstack*        obstack;                  
00053         static INT32            nextLabelId;              
00054 
00055 
00056         const char*     name;           
00057         INT32           hash;           
00058 public:
00065         static  CSymbol* Lookup( const char* name );
00072         static  CSymbol* GenSymbol( const char* prefix );
00076         static  void    DumpTable( void );
00080         static  void    SetObstack( CObstack* aObstack );
00085         CSymbol( const char* aName );
00089         ~CSymbol( void );
00094         const char* GetName( void ) const;
00099         int Escaped( void ) const;
00104         int External() const;
00108         static void DumpStats();
00112 private:
00113         static INT32    Hash( const char* string );
00117 };
00118 
00129 const char* Identifier( const char* s );
00130 
00131 #endif // CSYMBOL_HPP