[50] | 1 | #include <vector>
|
---|
[4] | 2 |
|
---|
| 3 | class CClass;
|
---|
| 4 | struct SUBINFO;
|
---|
| 5 |
|
---|
| 6 | //データ型
|
---|
| 7 | struct TYPEINFO{
|
---|
| 8 | int type;
|
---|
| 9 | union{
|
---|
| 10 | LONG_PTR lpIndex;
|
---|
| 11 | CClass *pobj_Class;
|
---|
| 12 | }u;
|
---|
| 13 | };
|
---|
| 14 |
|
---|
| 15 | #define ACCESS_NON 0
|
---|
| 16 | #define ACCESS_PRIVATE 1
|
---|
| 17 | #define ACCESS_PUBLIC 2
|
---|
| 18 | #define ACCESS_PROTECTED 3
|
---|
| 19 |
|
---|
| 20 | class CMember{
|
---|
[17] | 21 | bool isConst;
|
---|
[40] | 22 | bool isRef;
|
---|
[4] | 23 | public:
|
---|
| 24 | char *name;
|
---|
| 25 | int SubScripts[MAX_ARRAYDIM];
|
---|
| 26 | TYPEINFO TypeInfo;
|
---|
| 27 |
|
---|
| 28 | DWORD dwAccess;
|
---|
| 29 |
|
---|
| 30 | char *InitBuf;
|
---|
| 31 | char *ConstractParameter;
|
---|
| 32 |
|
---|
| 33 | int source_code_address;
|
---|
| 34 |
|
---|
| 35 |
|
---|
[40] | 36 | CMember( CClass *pobj_c, DWORD access, bool idConst, bool isRef, char *buffer, int NowLine=-1 );
|
---|
[17] | 37 | CMember( CMember *pobj );
|
---|
[4] | 38 | CMember();
|
---|
| 39 | ~CMember();
|
---|
| 40 |
|
---|
[17] | 41 | bool IsConst();
|
---|
[40] | 42 | bool IsRef();
|
---|
| 43 | int GetSize();
|
---|
[4] | 44 |
|
---|
[17] | 45 |
|
---|
[4] | 46 | static void InitStaticMember(void);
|
---|
| 47 | };
|
---|
| 48 | class CMethod{
|
---|
| 49 | public:
|
---|
| 50 | SUBINFO *psi;
|
---|
| 51 | DWORD dwAccess;
|
---|
| 52 | BOOL bAbstract;
|
---|
| 53 | BOOL bVirtual;
|
---|
[18] | 54 | bool isConst;
|
---|
[4] | 55 |
|
---|
| 56 | CClass *pobj_InheritsClass;
|
---|
| 57 |
|
---|
| 58 | CMethod(CMethod *pobj);
|
---|
| 59 | CMethod();
|
---|
| 60 | ~CMethod();
|
---|
| 61 | };
|
---|
[51] | 62 | class CDBClass;
|
---|
| 63 | class CDebugSection;
|
---|
[4] | 64 | class CClass{
|
---|
[51] | 65 | friend CDBClass;
|
---|
| 66 | friend CDebugSection;
|
---|
| 67 |
|
---|
| 68 | //メソッド情報
|
---|
| 69 | std::vector<CMethod *> methods;
|
---|
| 70 | int ConstructorMemberSubIndex;
|
---|
| 71 | int CopyConstructorMemberSubIndex;
|
---|
| 72 | int DestructorMemberSubIndex;
|
---|
| 73 |
|
---|
[50] | 74 | //静的メソッド情報
|
---|
[51] | 75 | std::vector<CMethod *> staticMethods;
|
---|
[50] | 76 |
|
---|
[4] | 77 | public:
|
---|
| 78 | //クラス名
|
---|
| 79 | char *name;
|
---|
| 80 |
|
---|
| 81 | //継承クラスへのポインタ
|
---|
| 82 | CClass *pobj_InheritsClass;
|
---|
| 83 |
|
---|
| 84 | //メンバ情報
|
---|
| 85 | CMember **ppobj_Member;
|
---|
| 86 | int iMemberNum;
|
---|
| 87 |
|
---|
| 88 | //静的メンバ情報
|
---|
| 89 | CMember **ppobj_StaticMember;
|
---|
| 90 | int iStaticMemberNum;
|
---|
| 91 |
|
---|
| 92 | //仮想関数の数
|
---|
| 93 | int vtbl_num;
|
---|
| 94 |
|
---|
| 95 | //アラインメント値
|
---|
| 96 | int iAlign;
|
---|
| 97 |
|
---|
| 98 |
|
---|
| 99 | public:
|
---|
[46] | 100 | CClass(const char *name);
|
---|
[4] | 101 | ~CClass();
|
---|
| 102 |
|
---|
[29] | 103 | //継承させる
|
---|
| 104 | void Inherits( CClass *pInheritsClass );
|
---|
| 105 |
|
---|
[40] | 106 | void AddMember( DWORD dwAccess, bool idConst, bool isRef, char *buffer );
|
---|
| 107 | void AddStaticMember( DWORD dwAccess, bool isConst, bool isRef, char *buffer, int NowLine );
|
---|
[18] | 108 | void AddMethod( SUBINFO *psi,DWORD dwAccess, bool isConst, BOOL bAbstract, BOOL bVirtual );
|
---|
[4] | 109 | void AddStaticMethod(SUBINFO *psi,DWORD dwAccess);
|
---|
| 110 |
|
---|
[46] | 111 | BOOL DupliCheckAll(const char *name);
|
---|
| 112 | BOOL DupliCheckMember(const char *name);
|
---|
[4] | 113 |
|
---|
[28] | 114 | //メソッド取得
|
---|
[18] | 115 | CMethod *GetMethodInfo( SUBINFO *psi );
|
---|
| 116 | CMethod *GetStaticMethodInfo( SUBINFO *psi );
|
---|
[28] | 117 |
|
---|
| 118 | //メソッドの存在を確認
|
---|
[46] | 119 | bool IsExistMethod( const char *name );
|
---|
| 120 | bool IsExistStaticMethod( const char *name );
|
---|
[4] | 121 |
|
---|
[50] | 122 | //メソッドを列挙
|
---|
| 123 | void EnumStaticMethod( const char *methodName, std::vector<SUBINFO *> &subs ) const;
|
---|
| 124 | void EnumMethod( const char *methodName, std::vector<SUBINFO *> &subs ) const;
|
---|
| 125 | void EnumMethod( const BYTE idOperatorCalc, std::vector<SUBINFO *> &subs ) const;
|
---|
[18] | 126 |
|
---|
[51] | 127 | //デフォルト コンストラクタ メソッドを取得
|
---|
| 128 | CMethod *GetConstructorMethod() const;
|
---|
[50] | 129 |
|
---|
[51] | 130 | //デフォルト コピーコンストラクタ メソッドを取得
|
---|
| 131 | CMethod *GetCopyConstructorMethod() const;
|
---|
| 132 |
|
---|
| 133 | //デストラクタ メソッドを取得
|
---|
| 134 | CMethod *GetDestructorMethod() const;
|
---|
| 135 |
|
---|
| 136 |
|
---|
[4] | 137 | //vtbl
|
---|
| 138 | private:
|
---|
| 139 | long vtbl_offset;
|
---|
| 140 | LONG_PTR AddVtblDataTable(SUBINFO **ppsi,int length);
|
---|
| 141 | public:
|
---|
[51] | 142 | int GetFuncNumInVtbl( const SUBINFO *psi ) const;
|
---|
| 143 | LONG_PTR GetVtblGlobalOffset(void);
|
---|
[4] | 144 | void ActionVtblSchedule(LONG_PTR ImageBase, LONG_PTR MemPos_CodeSection);
|
---|
[28] | 145 | bool IsAbstract();
|
---|
[4] | 146 |
|
---|
| 147 |
|
---|
[17] | 148 | //コンストラクタをコンパイルしているかどうかのチェックフラグ
|
---|
| 149 | private:
|
---|
| 150 | bool isCompilingConstructor;
|
---|
| 151 | public:
|
---|
| 152 | void NotifyStartConstructorCompile();
|
---|
| 153 | void NotifyFinishConstructorCompile();
|
---|
| 154 | bool IsCompilingConstructor();
|
---|
| 155 |
|
---|
[18] | 156 | //デストラクタをコンパイルしているかどうかのチェックフラグ
|
---|
| 157 | private:
|
---|
| 158 | bool isCompilingDestructor;
|
---|
| 159 | public:
|
---|
| 160 | void NotifyStartDestructorCompile();
|
---|
| 161 | void NotifyFinishDestructorCompile();
|
---|
| 162 | bool IsCompilingDestructor();
|
---|
[17] | 163 |
|
---|
[18] | 164 |
|
---|
[28] | 165 | //自身と等しいクラスかどうかを確認
|
---|
| 166 | bool IsEquals( CClass *pClass );
|
---|
| 167 |
|
---|
| 168 | //自身の派生クラスかどうかを確認
|
---|
| 169 | bool IsSubClass( CClass *pClass );
|
---|
| 170 |
|
---|
| 171 |
|
---|
[4] | 172 | //線形リスト用
|
---|
| 173 | CClass *pobj_NextClass;
|
---|
| 174 | };
|
---|
| 175 |
|
---|
| 176 | #define MAX_CLASS_HASH 65535
|
---|
| 177 | class CDBClass{
|
---|
[46] | 178 | int hash(const char *name);
|
---|
[4] | 179 | void DestroyClass(CClass *pobj_c);
|
---|
| 180 | public:
|
---|
| 181 | CClass *pobj_ClassHash[MAX_CLASS_HASH];
|
---|
| 182 |
|
---|
| 183 | CDBClass();
|
---|
| 184 | ~CDBClass();
|
---|
| 185 |
|
---|
[46] | 186 | CClass *check(const char *name);
|
---|
[4] | 187 |
|
---|
[46] | 188 | CClass *AddClass(const char *name,int NowLine);
|
---|
[4] | 189 |
|
---|
| 190 | void ActionVtblSchedule(LONG_PTR ImageBase, LONG_PTR MemPos_CodeSection);
|
---|
| 191 |
|
---|
| 192 | private:
|
---|
[18] | 193 | void AddMethod(CClass *pobj_c, DWORD dwAccess, BOOL bStatic, bool isConst, BOOL bAbstract,
|
---|
| 194 | BOOL bVirtual, BOOL bOverride, char *buffer, int NowLine);
|
---|
[4] | 195 | BOOL MemberVar_LoopRefCheck(CClass *pobj_c);
|
---|
| 196 | public:
|
---|
| 197 | void InitNames(void);
|
---|
[46] | 198 | void GetClass_recur(const char *lpszInheritsClass);
|
---|
[4] | 199 | void GetObjectClassInfo(void);
|
---|
| 200 |
|
---|
| 201 |
|
---|
[18] | 202 | /////////////////////////////
|
---|
| 203 | // 現在コンパイル中の情報
|
---|
| 204 | /////////////////////////////
|
---|
[4] | 205 | private:
|
---|
[18] | 206 | CClass *pCompilingClass;
|
---|
| 207 | CMethod *pCompilingMethod;
|
---|
| 208 | public:
|
---|
| 209 | //コンパイル開始の通知を受け取るメソッド
|
---|
| 210 | void StartCompile( SUBINFO *psi );
|
---|
| 211 |
|
---|
| 212 | //現在コンパイル中のメソッド情報を取得
|
---|
| 213 | CClass *GetNowCompilingClass();
|
---|
| 214 | CMethod *GetNowCompilingMethodInfo();
|
---|
| 215 |
|
---|
| 216 |
|
---|
| 217 | /////////////////////
|
---|
| 218 | // イテレータ
|
---|
| 219 | /////////////////////
|
---|
| 220 | private:
|
---|
[4] | 221 | CClass **ppobj_IteClass;
|
---|
| 222 | int iIteMaxNum;
|
---|
| 223 | int iIteNextNum;
|
---|
| 224 | public:
|
---|
| 225 | void Iterator_Reset(void);
|
---|
| 226 | BOOL Iterator_HasNext(void);
|
---|
| 227 | CClass *Iterator_GetNext(void);
|
---|
| 228 | int Iterator_GetMaxCount(void);
|
---|
| 229 | };
|
---|
| 230 |
|
---|
| 231 |
|
---|
| 232 | extern CDBClass *pobj_DBClass;
|
---|
| 233 | extern CClass *pobj_CompilingClass;
|
---|