1 //************************************************************************** 2 //** 3 //** ## ## ## ## ## #### #### ### ### 4 //** ## ## ## ## ## ## ## ## ## ## #### #### 5 //** ## ## ## ## ## ## ## ## ## ## ## ## ## ## 6 //** ## ## ######## ## ## ## ## ## ## ## ### ## 7 //** ### ## ## ### ## ## ## ## ## ## 8 //** # ## ## # #### #### ## ## 9 //** 10 //** $Id: vc_package.h 3894 2008-12-17 21:11:22Z dj_jl $ 11 //** 12 //** Copyright (C) 1999-2006 Jānis Legzdiņš 13 //** 14 //** This program is free software; you can redistribute it and/or 15 //** modify it under the terms of the GNU General Public License 16 //** as published by the Free Software Foundation; either version 2 17 //** of the License, or (at your option) any later version. 18 //** 19 //** This program is distributed in the hope that it will be useful, 20 //** but WITHOUT ANY WARRANTY; without even the implied warranty of 21 //** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 //** GNU General Public License for more details. 23 //** 24 //************************************************************************** 25 26 class VProgsReader; 27 28 //========================================================================== 29 // 30 // mobjinfo_t 31 // 32 //========================================================================== 33 34 struct mobjinfo_t 35 { 36 int DoomEdNum; 37 vint32 GameFilter; 38 VClass* Class; 39 40 friend VStream& operator<<(VStream&, mobjinfo_t&); 41 }; 42 43 //========================================================================== 44 // 45 // VImportedPackage 46 // 47 //========================================================================== 48 49 struct VImportedPackage 50 { 51 VName Name; 52 TLocation Loc; 53 VPackage* Pkg; 54 }; 55 56 //========================================================================== 57 // 58 // VPackage 59 // 60 //========================================================================== 61 62 class VPackage : public VMemberBase 63 { 64 private: 65 struct TStringInfo 66 { 67 int Offs; 68 int Next; 69 }; 70 71 TArray<TStringInfo> StringInfo; 72 int StringLookup[256]; 73 74 static int StringHashFunc(const char*); 75 76 public: 77 // Shared fields 78 TArray<char> Strings; 79 80 // Compiler fields 81 TArray<VImportedPackage> PackagesToLoad; 82 83 TArray<mobjinfo_t> MobjInfo; 84 TArray<mobjinfo_t> ScriptIds; 85 86 TArray<VConstant*> ParsedConstants; 87 TArray<VStruct*> ParsedStructs; 88 TArray<VClass*> ParsedClasses; 89 TArray<VClass*> ParsedDecorateImportClasses; 90 91 int NumBuiltins; 92 93 // Run-time fields 94 vuint16 Checksum; 95 VProgsReader* Reader; 96 97 VPackage(); 98 VPackage(VName InName); 99 ~VPackage(); 100 101 void Serialise(VStream&); 102 103 int FindString(const char*); 104 VConstant* FindConstant(VName); 105 106 VClass* FindDecorateImportClass(VName) const; 107 108 void Emit(); 109 void WriteObject(const VStr&); 110 void LoadObject(TLocation); 111 112 friend inline VStream& operator<<(VStream& Strm, VPackage*& Obj) 113 { return Strm << *(VMemberBase**)&Obj; } 114 }; 115