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