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