00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef CSYMBOL_HPP
00032 #define CSYMBOL_HPP
00033
00034 #include "glue.h"
00035 #include "cobject.h"
00036
00037
00043 class CSymbol : public CObject
00044 {
00045 private:
00046 static const int hashTableSize = 16*1024;
00047 static CSymbol* hashTable[hashTableSize];
00048 static int hashTableInited;
00049 static CObstack* obstack;
00050 static INT32 nextLabelId;
00051
00052
00053 CSymbol* nextHash;
00054 const char* name;
00055 int caseSensitive;
00056 int escaped;
00057 public:
00068 static CSymbol* Lookup( const char* name, int caseSensitive,
00069 int escaped=FALSE );
00076 static CSymbol* GenSymbol( const char* prefix );
00080 static void DumpTable( void );
00088 static int StringCompare( const char* s1, const char* s2,
00089 int caseSensitive );
00093 static void SetObstack( CObstack* aObstack );
00101 CSymbol( const char* aName, int caseSensitive, int escape );
00105 ~CSymbol( void );
00110 const char* GetName( void );
00115 int Escaped( ) { return escaped; }
00119 private:
00120 static void InitializeHashTable( void );
00121 static INT32 Hash( const char* string );
00125 };
00126
00137 const char* Identifier( const char* s );
00138
00139 #endif // CSYMBOL_HPP