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