Refactored the way symbol tables are initialized and stored. This was done in response to the addition of EShSpec.
Symbol table entries depend on three things - language, spec (not now but may eventually), and built-in resources.
We used to build two global symbol-tables - one for each language. During each compile, one of the symbol table was
copied and resource-specific stuff was added. I have moved the symbol table to TCompiler that gets initilized when
compiler is created and reused for each compile. This makes it much cleaner and extensible in case a spec requires
special entries to be added to the symbol table.
PS: Sorry for the long CL, but all of it needed to be done in one CL. I have verified that everything still compiles
and passes all conformance tests.
Review URL: http://codereview.appspot.com/1864044
git-svn-id: https://angleproject.googlecode.com/svn/trunk@351 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/Initialize.h b/src/compiler/Initialize.h
index 777742e..03c9937 100644
--- a/src/compiler/Initialize.h
+++ b/src/compiler/Initialize.h
@@ -17,19 +17,18 @@
class TBuiltIns {
public:
- POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
- void initialize();
- void initialize(const TBuiltInResource& resources);
- TBuiltInStrings* getBuiltInStrings() { return builtInStrings; }
+ POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
+
+ void initialize(EShLanguage language, EShSpec spec, const TBuiltInResource& resources);
+ const TBuiltInStrings& getBuiltInStrings() { return builtInStrings; }
+
protected:
- TBuiltInStrings builtInStrings[EShLangCount];
+ TBuiltInStrings builtInStrings;
};
-void IdentifyBuiltIns(EShLanguage, TSymbolTable&);
-void IdentifyBuiltIns(EShLanguage, TSymbolTable&, const TBuiltInResource &resources);
-bool GenerateBuiltInSymbolTable(const TBuiltInResource* resources, TInfoSink&, TSymbolTable*, EShLanguage language = EShLangCount);
-bool InitializeSymbolTable(TBuiltInStrings* BuiltInStrings, EShLanguage language, TInfoSink& infoSink, const TBuiltInResource *resources, TSymbolTable*);
-const char* GetPreprocessorBuiltinString();
+void IdentifyBuiltIns(EShLanguage language, EShSpec spec, const TBuiltInResource& resources,
+ TSymbolTable& symbolTable);
+
extern "C" int InitPreprocessor(void);
extern "C" int FinalizePreprocessor(void);