source: dev/BasicCompiler_Common/LoopRefCheck.cpp@ 90

Last change on this file since 90 was 90, checked in by dai_9181, 17 years ago

実行時型情報の生成にほぼ対応した。

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(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(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(lstrcmp(names[i],inheritsClass.name)==0) return 1;
53 }
54 return 0;
55}
56CLoopRefCheck *pobj_LoopRefCheck;
Note: See TracBrowser for help on using the repository browser.