Explicitly include a boost "windows" folder even on linux
[supercollider.git] / include / lang / PyrSymbolTable.h
blob228aaada765ed72cde0ea941a66ffac2295f8a3c
1 /*
2 SuperCollider real time audio synthesis system
3 Copyright (c) 2002 James McCartney. All rights reserved.
4 http://www.audiosynth.com
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef _SymbolTable_
22 #define _SymbolTable_
24 #include "PyrSymbol.h"
25 #include "AdvancingAllocPool.h"
26 #include "SC_Export.h"
28 #define STRINGCHUNK 32000
29 #define SYMBOLCHUNK 32000
31 SC_DLLEXPORT_C PyrSymbol* getsym(const char *name);
32 SC_DLLEXPORT_C PyrSymbol* findsym(const char *name);
34 class SymbolSpace
36 public:
37 SymbolSpace(AllocPool *inPool);
38 PyrSymbol* NewSymbol(const char *inName, int inHash, int inLength);
40 private:
41 AllocPool *mPool;
42 AdvancingAllocPool mStringPool;
43 AdvancingAllocPool mSymbolPool;
46 class SymbolTable
48 public:
50 SymbolTable(AllocPool *inPool, int inSize);
52 void CopyFrom(SymbolTable& inTable);
54 int NumItems() { return mNumItems; }
55 int TableSize() { return mMaxItems; }
56 PyrSymbol* Get(int inIndex) { return mTable[inIndex]; }
58 void CheckSymbols();
60 private:
61 friend PyrSymbol* getsym(const char *name);
62 friend PyrSymbol* findsym(const char *name);
64 PyrSymbol* Find(const char *inName);
65 PyrSymbol* Make(const char *inName);
66 PyrSymbol* MakeNew(const char *inName, int inHash, int inLength);
68 int StrHash(const char *inName, int *outLength);
69 void AllocTable();
70 void Grow();
71 PyrSymbol* Find(const char *inName, int inHash);
72 void Add(PyrSymbol* inSymbol);
73 void Rehash(PyrSymbol** inTable, int inSize);
74 void MakeEmpty();
76 AllocPool *mPool;
77 SymbolSpace mSpace;
78 PyrSymbol **mTable;
79 int mNumItems, mMaxItems, mMask;
82 #endif