[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{
|
---|
[53] | 65 | friend CMember;
|
---|
[51] | 66 | friend CDBClass;
|
---|
| 67 | friend CDebugSection;
|
---|
| 68 |
|
---|
[53] | 69 | //静的メンバ情報
|
---|
| 70 | std::vector<CMember *>staticMembers;
|
---|
| 71 |
|
---|
[51] | 72 | //メソッド情報
|
---|
| 73 | std::vector<CMethod *> methods;
|
---|
| 74 | int ConstructorMemberSubIndex;
|
---|
| 75 | int CopyConstructorMemberSubIndex;
|
---|
| 76 | int DestructorMemberSubIndex;
|
---|
| 77 |
|
---|
[50] | 78 | //静的メソッド情報
|
---|
[51] | 79 | std::vector<CMethod *> staticMethods;
|
---|
[50] | 80 |
|
---|
[4] | 81 | public:
|
---|
| 82 | //クラス名
|
---|
| 83 | char *name;
|
---|
| 84 |
|
---|
| 85 | //継承クラスへのポインタ
|
---|
| 86 | CClass *pobj_InheritsClass;
|
---|
| 87 |
|
---|
| 88 | //メンバ情報
|
---|
| 89 | CMember **ppobj_Member;
|
---|
| 90 | int iMemberNum;
|
---|
| 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 |
|
---|
[53] | 106 | //メンバ、メソッドの追加
|
---|
[40] | 107 | void AddMember( DWORD dwAccess, bool idConst, bool isRef, char *buffer );
|
---|
| 108 | void AddStaticMember( DWORD dwAccess, bool isConst, bool isRef, char *buffer, int NowLine );
|
---|
[18] | 109 | void AddMethod( SUBINFO *psi,DWORD dwAccess, bool isConst, BOOL bAbstract, BOOL bVirtual );
|
---|
[4] | 110 | void AddStaticMethod(SUBINFO *psi,DWORD dwAccess);
|
---|
| 111 |
|
---|
[53] | 112 | //重複チェック
|
---|
[46] | 113 | BOOL DupliCheckAll(const char *name);
|
---|
| 114 | BOOL DupliCheckMember(const char *name);
|
---|
[4] | 115 |
|
---|
[28] | 116 | //メソッド取得
|
---|
[18] | 117 | CMethod *GetMethodInfo( SUBINFO *psi );
|
---|
| 118 | CMethod *GetStaticMethodInfo( SUBINFO *psi );
|
---|
[28] | 119 |
|
---|
| 120 | //メソッドの存在を確認
|
---|
[46] | 121 | bool IsExistMethod( const char *name );
|
---|
| 122 | bool IsExistStaticMethod( const char *name );
|
---|
[4] | 123 |
|
---|
[50] | 124 | //メソッドを列挙
|
---|
| 125 | void EnumStaticMethod( const char *methodName, std::vector<SUBINFO *> &subs ) const;
|
---|
| 126 | void EnumMethod( const char *methodName, std::vector<SUBINFO *> &subs ) const;
|
---|
| 127 | void EnumMethod( const BYTE idOperatorCalc, std::vector<SUBINFO *> &subs ) const;
|
---|
[18] | 128 |
|
---|
[51] | 129 | //デフォルト コンストラクタ メソッドを取得
|
---|
| 130 | CMethod *GetConstructorMethod() const;
|
---|
[50] | 131 |
|
---|
[51] | 132 | //デフォルト コピーコンストラクタ メソッドを取得
|
---|
| 133 | CMethod *GetCopyConstructorMethod() const;
|
---|
| 134 |
|
---|
| 135 | //デストラクタ メソッドを取得
|
---|
| 136 | CMethod *GetDestructorMethod() const;
|
---|
| 137 |
|
---|
[63] | 138 | // メンバの総合サイズを取得
|
---|
| 139 | int GetSize() const;
|
---|
[51] | 140 |
|
---|
[63] | 141 | // メンバのオフセットを取得
|
---|
| 142 | int GetMemberOffset( const char *memberName, int *pMemberNum ) const;
|
---|
| 143 |
|
---|
| 144 | private:
|
---|
| 145 | // アラインメント値を取得
|
---|
| 146 | int GetAlignment() const;
|
---|
| 147 |
|
---|
| 148 |
|
---|
[4] | 149 | //vtbl
|
---|
| 150 | private:
|
---|
| 151 | long vtbl_offset;
|
---|
| 152 | public:
|
---|
[51] | 153 | int GetFuncNumInVtbl( const SUBINFO *psi ) const;
|
---|
| 154 | LONG_PTR GetVtblGlobalOffset(void);
|
---|
[4] | 155 | void ActionVtblSchedule(LONG_PTR ImageBase, LONG_PTR MemPos_CodeSection);
|
---|
[28] | 156 | bool IsAbstract();
|
---|
[4] | 157 |
|
---|
| 158 |
|
---|
[17] | 159 | //コンストラクタをコンパイルしているかどうかのチェックフラグ
|
---|
| 160 | private:
|
---|
| 161 | bool isCompilingConstructor;
|
---|
| 162 | public:
|
---|
| 163 | void NotifyStartConstructorCompile();
|
---|
| 164 | void NotifyFinishConstructorCompile();
|
---|
| 165 | bool IsCompilingConstructor();
|
---|
| 166 |
|
---|
[18] | 167 | //デストラクタをコンパイルしているかどうかのチェックフラグ
|
---|
| 168 | private:
|
---|
| 169 | bool isCompilingDestructor;
|
---|
| 170 | public:
|
---|
| 171 | void NotifyStartDestructorCompile();
|
---|
| 172 | void NotifyFinishDestructorCompile();
|
---|
| 173 | bool IsCompilingDestructor();
|
---|
[17] | 174 |
|
---|
[18] | 175 |
|
---|
[28] | 176 | //自身と等しいクラスかどうかを確認
|
---|
| 177 | bool IsEquals( CClass *pClass );
|
---|
| 178 |
|
---|
| 179 | //自身の派生クラスかどうかを確認
|
---|
| 180 | bool IsSubClass( CClass *pClass );
|
---|
| 181 |
|
---|
[59] | 182 | //自身と等しいまたは派生クラスかどうかを確認
|
---|
| 183 | bool IsEqualsOrSubClass( CClass *pClass );
|
---|
[28] | 184 |
|
---|
[59] | 185 |
|
---|
[4] | 186 | //線形リスト用
|
---|
| 187 | CClass *pobj_NextClass;
|
---|
| 188 | };
|
---|
| 189 |
|
---|
| 190 | #define MAX_CLASS_HASH 65535
|
---|
| 191 | class CDBClass{
|
---|
[46] | 192 | int hash(const char *name);
|
---|
[4] | 193 | void DestroyClass(CClass *pobj_c);
|
---|
| 194 | public:
|
---|
| 195 | CClass *pobj_ClassHash[MAX_CLASS_HASH];
|
---|
| 196 |
|
---|
| 197 | CDBClass();
|
---|
| 198 | ~CDBClass();
|
---|
| 199 |
|
---|
[46] | 200 | CClass *check(const char *name);
|
---|
[4] | 201 |
|
---|
[46] | 202 | CClass *AddClass(const char *name,int NowLine);
|
---|
[4] | 203 |
|
---|
| 204 | void ActionVtblSchedule(LONG_PTR ImageBase, LONG_PTR MemPos_CodeSection);
|
---|
| 205 |
|
---|
| 206 | private:
|
---|
[18] | 207 | void AddMethod(CClass *pobj_c, DWORD dwAccess, BOOL bStatic, bool isConst, BOOL bAbstract,
|
---|
| 208 | BOOL bVirtual, BOOL bOverride, char *buffer, int NowLine);
|
---|
[4] | 209 | BOOL MemberVar_LoopRefCheck(CClass *pobj_c);
|
---|
| 210 | public:
|
---|
| 211 | void InitNames(void);
|
---|
[46] | 212 | void GetClass_recur(const char *lpszInheritsClass);
|
---|
[4] | 213 | void GetObjectClassInfo(void);
|
---|
| 214 |
|
---|
| 215 |
|
---|
[18] | 216 | /////////////////////////////
|
---|
| 217 | // 現在コンパイル中の情報
|
---|
| 218 | /////////////////////////////
|
---|
[4] | 219 | private:
|
---|
[18] | 220 | CClass *pCompilingClass;
|
---|
| 221 | CMethod *pCompilingMethod;
|
---|
| 222 | public:
|
---|
| 223 | //コンパイル開始の通知を受け取るメソッド
|
---|
| 224 | void StartCompile( SUBINFO *psi );
|
---|
| 225 |
|
---|
| 226 | //現在コンパイル中のメソッド情報を取得
|
---|
| 227 | CClass *GetNowCompilingClass();
|
---|
| 228 | CMethod *GetNowCompilingMethodInfo();
|
---|
| 229 |
|
---|
| 230 |
|
---|
| 231 | /////////////////////
|
---|
| 232 | // イテレータ
|
---|
| 233 | /////////////////////
|
---|
| 234 | private:
|
---|
[4] | 235 | CClass **ppobj_IteClass;
|
---|
| 236 | int iIteMaxNum;
|
---|
| 237 | int iIteNextNum;
|
---|
| 238 | public:
|
---|
| 239 | void Iterator_Reset(void);
|
---|
| 240 | BOOL Iterator_HasNext(void);
|
---|
| 241 | CClass *Iterator_GetNext(void);
|
---|
| 242 | int Iterator_GetMaxCount(void);
|
---|
| 243 | };
|
---|
| 244 |
|
---|
| 245 |
|
---|
| 246 | extern CDBClass *pobj_DBClass;
|
---|
| 247 | extern CClass *pobj_CompilingClass;
|
---|