source: dev/BasicCompiler_Common/Class.h@ 6

Last change on this file since 6 was 4, checked in by dai_9181, 18 years ago
File size: 3.0 KB
Line 
1
2
3class CClass;
4struct SUBINFO;
5
6//データ型
7struct 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
20class CMember{
21public:
22 char *name;
23 int SubScripts[MAX_ARRAYDIM];
24 TYPEINFO TypeInfo;
25
26 DWORD dwAccess;
27
28 char *InitBuf;
29 char *ConstractParameter;
30
31 int source_code_address;
32
33
34 CMember(CClass *pobj_c,DWORD access,char *buffer,int NowLine=-1);
35 CMember(CMember *pobj);
36 CMember();
37 ~CMember();
38
39
40 static void InitStaticMember(void);
41};
42class CMethod{
43public:
44 SUBINFO *psi;
45 DWORD dwAccess;
46 BOOL bAbstract;
47 BOOL bVirtual;
48
49 CClass *pobj_InheritsClass;
50
51 CMethod(CMethod *pobj);
52 CMethod();
53 ~CMethod();
54};
55class CClass{
56public:
57 //クラス名
58 char *name;
59
60 //継承クラスへのポインタ
61 CClass *pobj_InheritsClass;
62
63 //メンバ情報
64 CMember **ppobj_Member;
65 int iMemberNum;
66
67 //メソッド情報
68 CMethod **ppobj_Method;
69 int iMethodNum;
70 int ConstructorMemberSubIndex;
71 int DestructorMemberSubIndex;
72 int CopyConstructorMemberSubIndex;
73
74 //静的メンバ情報
75 CMember **ppobj_StaticMember;
76 int iStaticMemberNum;
77
78 //静的メソッド情報
79 CMethod **ppobj_StaticMethod;
80 int iStaticMethodNum;
81
82 //仮想関数の数
83 int vtbl_num;
84
85 //アラインメント値
86 int iAlign;
87
88
89public:
90 CClass(char *name);
91 ~CClass();
92
93 void AddMember(DWORD dwAccess,char *buffer);
94 void AddStaticMember(DWORD dwAccess,char *buffer,int NowLine);
95 void AddMethod(SUBINFO *psi,DWORD dwAccess,BOOL bAbstract,BOOL bVirtual);
96 void AddStaticMethod(SUBINFO *psi,DWORD dwAccess);
97
98 BOOL DupliCheckAll(char *name);
99 BOOL DupliCheckMember(char *name);
100
101
102 //vtbl
103private:
104 long vtbl_offset;
105 LONG_PTR AddVtblDataTable(SUBINFO **ppsi,int length);
106public:
107 LONG_PTR GetVtblGlobalOffset(void);
108 void ActionVtblSchedule(LONG_PTR ImageBase, LONG_PTR MemPos_CodeSection);
109 BOOL IsHoldAbstractFunction(void);
110
111
112 //オペレータ関数の取得
113 SUBINFO **GetOperatorSubInfo(BYTE idCalc,int &num);
114
115
116 //線形リスト用
117 CClass *pobj_NextClass;
118};
119
120#define MAX_CLASS_HASH 65535
121class CDBClass{
122 int hash(char *name);
123 void DestroyClass(CClass *pobj_c);
124public:
125 CClass *pobj_ClassHash[MAX_CLASS_HASH];
126
127 CDBClass();
128 ~CDBClass();
129
130 CClass *check(char *name);
131
132 CClass *AddClass(char *name,int NowLine);
133
134 void ActionVtblSchedule(LONG_PTR ImageBase, LONG_PTR MemPos_CodeSection);
135
136private:
137 void AddMemberSub(CClass *pobj_c,DWORD dwAccess,BOOL bStatic,BOOL bAbstract,BOOL bVirtual,BOOL bOverride,char *buffer,int NowLine);
138 BOOL MemberVar_LoopRefCheck(CClass *pobj_c);
139public:
140 void InitNames(void);
141 void GetClass_recur(char *lpszInheritsClass);
142 void GetObjectClassInfo(void);
143
144
145 //イテレータ
146private:
147 CClass **ppobj_IteClass;
148 int iIteMaxNum;
149 int iIteNextNum;
150public:
151 void Iterator_Reset(void);
152 BOOL Iterator_HasNext(void);
153 CClass *Iterator_GetNext(void);
154 int Iterator_GetMaxCount(void);
155};
156
157
158extern CDBClass *pobj_DBClass;
159extern CClass *pobj_CompilingClass;
Note: See TracBrowser for help on using the repository browser.