source: dev/BasicCompiler_Common/LoopRefCheck.cpp @ 131

Last change on this file since 131 was 131, checked in by dai_9181, 16 years ago

Prototypeクラスを用意した。

File size: 1.2 KB
Line 
1#include "../BasicCompiler_Common/common.h"
2
3
4//////////////////////////////////////////////////////////////
5// 循環参照でないかをチェックするためのクラスモジュール
6//////////////////////////////////////////////////////////////
7
8extern HANDLE hHeap;
9
10
11void CLoopRefCheck::init(){
12    int i;
13    for(i=0;i<num;i++){
14        HeapDefaultFree(names[i]);
15    }
16    HeapDefaultFree(names);
17}
18
19CLoopRefCheck::CLoopRefCheck(){
20    names=(char **)HeapAlloc(hHeap,0,1);
21    num=0;
22}
23CLoopRefCheck::~CLoopRefCheck(){
24    init();
25}
26void CLoopRefCheck::add(const 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}
32void CLoopRefCheck::del(const 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}
47BOOL CLoopRefCheck::check(const CClass &inheritsClass) const
48{
49    //ループ継承チェック
50    int i;
51    for(i=0;i<num;i++){
52        if( inheritsClass.GetName() == names[i] ){
53            return 1;
54        }
55    }
56    return 0;
57}
58CLoopRefCheck *pobj_LoopRefCheck;
Note: See TracBrowser for help on using the repository browser.