[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 |
|
---|
[17] | 97 | void AddMember( DWORD dwAccess, bool idConst, char *buffer );
|
---|
| 98 | void AddStaticMember( DWORD dwAccess, bool isConst, char *buffer, int NowLine );
|
---|
[18] | 99 | void AddMethod( SUBINFO *psi,DWORD dwAccess, bool isConst, BOOL bAbstract, BOOL bVirtual );
|
---|
[4] | 100 | void AddStaticMethod(SUBINFO *psi,DWORD dwAccess);
|
---|
| 101 |
|
---|
| 102 | BOOL DupliCheckAll(char *name);
|
---|
| 103 | BOOL DupliCheckMember(char *name);
|
---|
| 104 |
|
---|
[18] | 105 | CMethod *GetMethodInfo( SUBINFO *psi );
|
---|
| 106 | CMethod *GetStaticMethodInfo( SUBINFO *psi );
|
---|
[4] | 107 |
|
---|
[18] | 108 |
|
---|
[4] | 109 | //vtbl
|
---|
| 110 | private:
|
---|
| 111 | long vtbl_offset;
|
---|
| 112 | LONG_PTR AddVtblDataTable(SUBINFO **ppsi,int length);
|
---|
| 113 | public:
|
---|
| 114 | LONG_PTR GetVtblGlobalOffset(void);
|
---|
| 115 | void ActionVtblSchedule(LONG_PTR ImageBase, LONG_PTR MemPos_CodeSection);
|
---|
| 116 | BOOL IsHoldAbstractFunction(void);
|
---|
| 117 |
|
---|
| 118 |
|
---|
| 119 | //オペレータ関数の取得
|
---|
| 120 | SUBINFO **GetOperatorSubInfo(BYTE idCalc,int &num);
|
---|
| 121 |
|
---|
| 122 |
|
---|
[17] | 123 | //コンストラクタをコンパイルしているかどうかのチェックフラグ
|
---|
| 124 | private:
|
---|
| 125 | bool isCompilingConstructor;
|
---|
| 126 | public:
|
---|
| 127 | void NotifyStartConstructorCompile();
|
---|
| 128 | void NotifyFinishConstructorCompile();
|
---|
| 129 | bool IsCompilingConstructor();
|
---|
| 130 |
|
---|
[18] | 131 | //デストラクタをコンパイルしているかどうかのチェックフラグ
|
---|
| 132 | private:
|
---|
| 133 | bool isCompilingDestructor;
|
---|
| 134 | public:
|
---|
| 135 | void NotifyStartDestructorCompile();
|
---|
| 136 | void NotifyFinishDestructorCompile();
|
---|
| 137 | bool IsCompilingDestructor();
|
---|
[17] | 138 |
|
---|
[18] | 139 |
|
---|
[4] | 140 | //線形リスト用
|
---|
| 141 | CClass *pobj_NextClass;
|
---|
| 142 | };
|
---|
| 143 |
|
---|
| 144 | #define MAX_CLASS_HASH 65535
|
---|
| 145 | class CDBClass{
|
---|
| 146 | int hash(char *name);
|
---|
| 147 | void DestroyClass(CClass *pobj_c);
|
---|
| 148 | public:
|
---|
| 149 | CClass *pobj_ClassHash[MAX_CLASS_HASH];
|
---|
| 150 |
|
---|
| 151 | CDBClass();
|
---|
| 152 | ~CDBClass();
|
---|
| 153 |
|
---|
| 154 | CClass *check(char *name);
|
---|
| 155 |
|
---|
| 156 | CClass *AddClass(char *name,int NowLine);
|
---|
| 157 |
|
---|
| 158 | void ActionVtblSchedule(LONG_PTR ImageBase, LONG_PTR MemPos_CodeSection);
|
---|
| 159 |
|
---|
| 160 | private:
|
---|
[18] | 161 | void AddMethod(CClass *pobj_c, DWORD dwAccess, BOOL bStatic, bool isConst, BOOL bAbstract,
|
---|
| 162 | BOOL bVirtual, BOOL bOverride, char *buffer, int NowLine);
|
---|
[4] | 163 | BOOL MemberVar_LoopRefCheck(CClass *pobj_c);
|
---|
| 164 | public:
|
---|
| 165 | void InitNames(void);
|
---|
| 166 | void GetClass_recur(char *lpszInheritsClass);
|
---|
| 167 | void GetObjectClassInfo(void);
|
---|
| 168 |
|
---|
| 169 |
|
---|
[18] | 170 | /////////////////////////////
|
---|
| 171 | // 現在コンパイル中の情報
|
---|
| 172 | /////////////////////////////
|
---|
[4] | 173 | private:
|
---|
[18] | 174 | CClass *pCompilingClass;
|
---|
| 175 | CMethod *pCompilingMethod;
|
---|
| 176 | public:
|
---|
| 177 | //コンパイル開始の通知を受け取るメソッド
|
---|
| 178 | void StartCompile( SUBINFO *psi );
|
---|
| 179 |
|
---|
| 180 | //現在コンパイル中のメソッド情報を取得
|
---|
| 181 | CClass *GetNowCompilingClass();
|
---|
| 182 | CMethod *GetNowCompilingMethodInfo();
|
---|
| 183 |
|
---|
| 184 |
|
---|
| 185 | /////////////////////
|
---|
| 186 | // イテレータ
|
---|
| 187 | /////////////////////
|
---|
| 188 | private:
|
---|
[4] | 189 | CClass **ppobj_IteClass;
|
---|
| 190 | int iIteMaxNum;
|
---|
| 191 | int iIteNextNum;
|
---|
| 192 | public:
|
---|
| 193 | void Iterator_Reset(void);
|
---|
| 194 | BOOL Iterator_HasNext(void);
|
---|
| 195 | CClass *Iterator_GetNext(void);
|
---|
| 196 | int Iterator_GetMaxCount(void);
|
---|
| 197 | };
|
---|
| 198 |
|
---|
| 199 |
|
---|
| 200 | extern CDBClass *pobj_DBClass;
|
---|
| 201 | extern CClass *pobj_CompilingClass;
|
---|