Line | |
---|
1 | #include "../BasicCompiler_Common/common.h" |
---|
2 | |
---|
3 | |
---|
4 | ////////////////////////////////////////////////////////////// |
---|
5 | // 循環参照でないかをチェックするためのクラスモジュール |
---|
6 | ////////////////////////////////////////////////////////////// |
---|
7 | |
---|
8 | extern HANDLE hHeap; |
---|
9 | |
---|
10 | |
---|
11 | void CLoopRefCheck::init(){ |
---|
12 | int i; |
---|
13 | for(i=0;i<num;i++){ |
---|
14 | HeapDefaultFree(names[i]); |
---|
15 | } |
---|
16 | HeapDefaultFree(names); |
---|
17 | } |
---|
18 | |
---|
19 | CLoopRefCheck::CLoopRefCheck(){ |
---|
20 | names=(char **)HeapAlloc(hHeap,0,1); |
---|
21 | num=0; |
---|
22 | } |
---|
23 | CLoopRefCheck::~CLoopRefCheck(){ |
---|
24 | init(); |
---|
25 | } |
---|
26 | void CLoopRefCheck::add(char *lpszInheritsClass){ |
---|
27 | names=(char **)HeapReAlloc(hHeap,0,names,(num+1)*sizeof(char *)); |
---|
28 | names[num]=(char *)HeapAlloc(hHeap,0,lstrlen(lpszInheritsClass)+1); |
---|
29 | lstrcpy(names[num],lpszInheritsClass); |
---|
30 | num++; |
---|
31 | } |
---|
32 | void CLoopRefCheck::del(char *lpszInheritsClass){ |
---|
33 | int i; |
---|
34 | for(i=0;i<num;i++){ |
---|
35 | if(lstrcmp(names[i],lpszInheritsClass)==0){ |
---|
36 | HeapDefaultFree(names[i]); |
---|
37 | break; |
---|
38 | } |
---|
39 | } |
---|
40 | if(i!=num){ |
---|
41 | num--; |
---|
42 | for(;i<num;i++){ |
---|
43 | names[i]=names[i+1]; |
---|
44 | } |
---|
45 | } |
---|
46 | } |
---|
47 | BOOL CLoopRefCheck::check(const CClass &inheritsClass) const |
---|
48 | { |
---|
49 | //ループ継承チェック |
---|
50 | int i; |
---|
51 | for(i=0;i<num;i++){ |
---|
52 | if(lstrcmp(names[i],inheritsClass.name)==0) return 1; |
---|
53 | } |
---|
54 | return 0; |
---|
55 | } |
---|
56 | CLoopRefCheck *pobj_LoopRefCheck; |
---|
Note: See
TracBrowser
for help on using the repository browser.