Index: trunk/abdev/BasicCompiler_Common/VarList.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/VarList.cpp	(revision 182)
+++ trunk/abdev/BasicCompiler_Common/VarList.cpp	(revision 206)
@@ -1,3 +1,7 @@
+#include "stdafx.h"
+
 #include <jenga/include/smoothie/Smoothie.h>
+
+#include <Compiler.h>
 
 #include "../BasicCompiler_Common/common.h"
@@ -9,5 +13,5 @@
 HWND hVarTree_Global,hVarTree_Local,hVarTree_This;
 
-int VarList_Array(HWND hVarTree,HTREEITEM hParent,LONG_PTR offset,const Type &type,const int *SubScripts);
+int VarList_Array(HWND hVarTree,HTREEITEM hParent,LONG_PTR offset,const Type &type,const Subscripts &subscripts);
 void VarList_Member(HWND hVarTree,HTREEITEM hParent,LONG_PTR pTopOffset,const CClass &objClass,BOOL bPtr);
 void VarList_Insert(HWND hVarTree,TV_INSERTSTRUCT *lptv,const char *VarName,const Type &type,LONG_PTR offset){
@@ -180,5 +184,5 @@
 		offset=objClass.GetMemberOffset( pMember->GetName().c_str(), &i2 );
 
-		if(pMember->SubScripts[0]!=-1){
+		if( pMember->GetSubscripts().size() > 0 ){
 			//構造体内の配列
 			sprintf(VarData,"%s %s(&H%X)",VarName,STRING_ARRAY,pTopOffset+offset);
@@ -187,8 +191,11 @@
 			hParent=TreeView_InsertItem(hVarTree,&tv);
 
-			VarList_Array(hVarTree,hParent,
-				pTopOffset+offset,
+			VarList_Array(
+				hVarTree,
+				hParent,
+				pTopOffset + offset,
 				pMember->GetType(),
-				pMember->SubScripts);
+				pMember->GetSubscripts()
+			);
 		}
 		else{
@@ -202,5 +209,5 @@
 	}
 }
-int VarList_Array(HWND hVarTree,HTREEITEM hParent,LONG_PTR offset,const Type &type,const int *SubScripts ){
+int VarList_Array(HWND hVarTree,HTREEITEM hParent,LONG_PTR offset,const Type &type, const Subscripts &subscripts ){
 	int i,i2,i3,ElementNum,MemCounter,UseCount[255];
 	char temporary[VN_SIZE],temp2[DIGIT_SIZE];
@@ -213,6 +220,5 @@
 	tv.item.pszText=temporary;
 
-	for(i=0;i<255;i++){
-		if(SubScripts[i]==-1) break;
+	for(i=0;i<(int)subscripts.size();i++){
 		UseCount[i]=0;
 	}
@@ -221,5 +227,5 @@
 	while(1){
 		UseCount[i]++;
-		for(ElementNum=0;SubScripts[i-ElementNum]<UseCount[i-ElementNum];ElementNum++){
+		for(ElementNum=0;subscripts[i-ElementNum]<UseCount[i-ElementNum];ElementNum++){
 			UseCount[i-ElementNum]=0;
 			if(i-ElementNum-1<0) return MemCounter;
@@ -268,10 +274,10 @@
 	extern int MemPos_RWSection;
 
-	BOOST_FOREACH( Variable *pVar, globalVars ){
+	BOOST_FOREACH( Variable *pVar, compiler.GetMeta().GetGlobalVars() ){
 
 		//スコープ外の場合は無視
-		if(pVar->ScopeLevel!=0){
-			if(rva_to_real(pVar->ScopeStartAddress) <= pobj_dti->lplpObp[0]  &&
-				pobj_dti->lplpObp[0] < rva_to_real(pVar->ScopeEndAddress)){
+		if(pVar->GetScopeLevel()!=0){
+			if(rva_to_real(pVar->GetScopeStartAddress()) <= pobj_dti->lplpObp[0]  &&
+				pobj_dti->lplpObp[0] < rva_to_real(pVar->GetScopeEndAddress())){
 				//範囲内
 			}
@@ -304,13 +310,16 @@
 				pVar->GetName().c_str(),
 				STRING_ARRAY,
-				ImageBase+MemPos_RWSection+pVar->offset);
+				ImageBase+MemPos_RWSection+pVar->GetOffsetAddress());
 			tv.item.iImage=0;
 			tv.item.iSelectedImage=0;
 			hParent=TreeView_InsertItem(hVarTree_Global,&tv);
 
-			VarList_Array(hVarTree_Global,hParent,
-				(LONG_PTR)(ImageBase+MemPos_RWSection+pVar->offset),
-				*pVar,
-				pVar->GetSubScriptsPtr());
+			VarList_Array(
+				hVarTree_Global,
+				hParent,
+				(LONG_PTR)(ImageBase+MemPos_RWSection + pVar->GetOffsetAddress()),
+				pVar->GetType(),
+				pVar->GetSubscripts()
+			);
 		}
 		else{
@@ -318,11 +327,11 @@
 				&tv,
 				pVar->GetName().c_str(),
-				*pVar,
-				(LONG_PTR)(ImageBase+MemPos_RWSection+pVar->offset));
+				pVar->GetType(),
+				(LONG_PTR)(ImageBase+MemPos_RWSection+pVar->GetOffsetAddress()));
 		}
 	}
 }
 void RefreshLocalVar(void){
-	int i2,i3,sw;
+	int i2;
 	char temporary[VN_SIZE];
 	TV_INSERTSTRUCT tv;
@@ -347,27 +356,22 @@
 	if(pobj_dti->lplpSpBase[i2]==0) return;
 
-	extern GlobalProc **ppSubHash;
-	GlobalProc *pUserProc;
-	for(i3=0,sw=0;i3<MAX_HASH;i3++){
-		pUserProc=ppSubHash[i3];
-		while(pUserProc){
-			if(rva_to_real(pUserProc->beginOpAddress) <= pobj_dti->lplpObp[i2]  &&
-				pobj_dti->lplpObp[i2] < rva_to_real(pUserProc->endOpAddress)){
-				sw=1;
-				break;
-			}
-
-			pUserProc=pUserProc->pNextData;
-		}
-		if(sw) break;
+	UserProc *pUserProc = NULL;
+	compiler.GetMeta().GetUserProcs().Iterator_Reset();
+	while( compiler.GetMeta().GetUserProcs().Iterator_HasNext() )
+	{
+		pUserProc = compiler.GetMeta().GetUserProcs().Iterator_GetNext();
+		if(rva_to_real(pUserProc->GetBeginOpAddress()) <= pobj_dti->lplpObp[i2]  &&
+			pobj_dti->lplpObp[i2] < rva_to_real(pUserProc->GetEndOpAddress())){
+			break;
+		}
 	}
 	if(!pUserProc) return;
 
-	BOOST_FOREACH( Variable *pVar, pUserProc->localVars ){
+	BOOST_FOREACH( Variable *pVar, pUserProc->GetLocalVars() ){
 
 		//スコープ外の場合は無視
-		if(pVar->ScopeLevel!=0){
-			if(rva_to_real(pVar->ScopeStartAddress) <= pobj_dti->lplpObp[i2]  &&
-				pobj_dti->lplpObp[i2] < rva_to_real(pVar->ScopeEndAddress)){
+		if(pVar->GetScopeLevel()!=0){
+			if(rva_to_real(pVar->GetScopeStartAddress()) <= pobj_dti->lplpObp[i2]  &&
+				pobj_dti->lplpObp[i2] < rva_to_real(pVar->GetScopeEndAddress())){
 				//範囲内
 			}
@@ -382,16 +386,19 @@
 				pVar->GetName().c_str(),
 				STRING_ARRAY,
-				pobj_dti->lplpSpBase[i2]+pVar->offset);
+				pobj_dti->lplpSpBase[i2]+pVar->GetOffsetAddress());
 			tv.item.iImage=0;
 			tv.item.iSelectedImage=0;
 			hParent=TreeView_InsertItem(hVarTree_Local,&tv);
 
-			VarList_Array(hVarTree_Local,hParent,
-				pobj_dti->lplpSpBase[i2]+pVar->offset,
-				*pVar,
-				pVar->GetSubScriptsPtr());
+			VarList_Array(
+				hVarTree_Local,
+				hParent,
+				pobj_dti->lplpSpBase[i2] + pVar->GetOffsetAddress(),
+				pVar->GetType(),
+				pVar->GetSubscripts()
+			);
 		}
 		else{
-			offset=pobj_dti->lplpSpBase[i2]+pVar->offset;
+			offset=pobj_dti->lplpSpBase[i2]+pVar->GetOffsetAddress();
 			if(pVar->IsRef()){
 				ReadProcessMemory(hDebugProcess,(void *)offset,&lpData,sizeof(LONG_PTR),&accessBytes);
@@ -400,5 +407,5 @@
 			VarList_Insert(hVarTree_Local,&tv,
 				pVar->GetName().c_str(),
-				*pVar,
+				pVar->GetType(),
 				offset);
 		}
@@ -416,9 +423,9 @@
 	//Thisポインタを取得
 	LONG_PTR pThis;
-	const Variable *pVar = pUserProc->localVars.Find( Symbol( "_System_LocalThis" ) );
+	const Variable *pVar = pUserProc->GetLocalVars().Find( Symbol( "_System_LocalThis" ) );
 	if( !pVar ){
 		return;
 	}
-	lpData=pobj_dti->lplpSpBase[i2]+pVar->offset;
+	lpData=pobj_dti->lplpSpBase[i2]+pVar->GetOffsetAddress();
 	ReadProcessMemory(hDebugProcess,(void *)lpData,&pThis,sizeof(LONG_PTR),&accessBytes);
 
@@ -426,5 +433,5 @@
 		offset=pUserProc->GetParentClassPtr()->GetMemberOffset( pMember->GetName().c_str(),&i2);
 
-		if(pMember->SubScripts[0]!=-1){
+		if( pMember->GetSubscripts().size() > 0 ){
 			//配列
 			sprintf(temporary,"%s %s(&H%X)",
@@ -436,8 +443,11 @@
 			hParent=TreeView_InsertItem(hVarTree_This,&tv);
 
-			VarList_Array(hVarTree_This,hParent,
-				pThis+offset,
+			VarList_Array(
+				hVarTree_This,
+				hParent,
+				pThis + offset,
 				pMember->GetType(),
-				pMember->SubScripts);
+				pMember->GetSubscripts()
+			);
 		}
 		else{
@@ -590,21 +600,19 @@
 
 	//プロシージャ コンボボックス
-	extern GlobalProc **ppSubHash;
-	GlobalProc *pUserProc;
-	int sw;
 	SendMessage(hProcCombo,CB_RESETCONTENT,0,0);
 	for(i2=pobj_dti->iProcLevel;i2>=0;i2--){
-		for(i3=0,sw=0;i3<MAX_HASH;i3++){
-			pUserProc=ppSubHash[i3];
-			while(pUserProc){
-				if(rva_to_real(pUserProc->beginOpAddress) <= pobj_dti->lplpObp[i2]  &&
-					pobj_dti->lplpObp[i2] < rva_to_real(pUserProc->endOpAddress)){
-						lstrcpy(temporary,pUserProc->GetName().c_str());
-						sw=1;
-						break;
-				}
-				pUserProc=pUserProc->pNextData;
-			}
-			if(sw) break;
+
+		UserProc *pUserProc = NULL;
+		compiler.GetMeta().GetUserProcs().Iterator_Reset();
+		while( compiler.GetMeta().GetUserProcs().Iterator_HasNext() )
+		{
+			pUserProc = compiler.GetMeta().GetUserProcs().Iterator_GetNext();
+
+			if(rva_to_real(pUserProc->GetBeginOpAddress()) <= pobj_dti->lplpObp[i2]  &&
+				pobj_dti->lplpObp[i2] < rva_to_real(pUserProc->GetEndOpAddress()))
+			{
+				lstrcpy(temporary,pUserProc->GetName().c_str());
+				break;
+			}
 		}
 		if(!pUserProc){
@@ -675,5 +683,5 @@
 void InitVarList(DWORD dwThreadId){
 	extern HWND hDebugWnd;
-	int i2,i3,i5;
+	int i2,i5;
 	char temporary[255];
 
@@ -703,29 +711,23 @@
 	///////////////////////////////////////////////
 
-	int sw;
-
 	i2=(int)SendDlgItemMessage(hDebugWnd,IDC_PROCCOMBO,CB_GETCURSEL,0,0);
 	i2=pobj_dti->iProcLevel-i2;
 
 	if(pobj_dti->lplpSpBase[i2]){
-		extern GlobalProc **ppSubHash;
-		GlobalProc *pUserProc;
-		for(i3=0,sw=0;i3<MAX_HASH;i3++){
-			pUserProc=ppSubHash[i3];
-			while(pUserProc){
-				if(rva_to_real(pUserProc->beginOpAddress) <= pobj_dti->lplpObp[i2]  &&
-					pobj_dti->lplpObp[i2] < rva_to_real(pUserProc->endOpAddress)){
-					sw=1;
-					break;
-				}
-
-				pUserProc=pUserProc->pNextData;
-			}
-			if(sw) break;
-		}
-
+
+		UserProc *pUserProc = NULL;
+		compiler.GetMeta().GetUserProcs().Iterator_Reset();
+		while( compiler.GetMeta().GetUserProcs().Iterator_HasNext() )
+		{
+			pUserProc = compiler.GetMeta().GetUserProcs().Iterator_GetNext();
+
+			if(rva_to_real(pUserProc->GetBeginOpAddress()) <= pobj_dti->lplpObp[i2]  &&
+				pobj_dti->lplpObp[i2] < rva_to_real(pUserProc->GetEndOpAddress())){
+				break;
+			}
+		}
 
 		if(pUserProc){
-			Smoothie::Temp::pCompilingClass = pUserProc->GetParentClassPtr();
+			compiler.pCompilingClass = pUserProc->GetParentClassPtr();
 			UserProc::CompileStartForUserProc( pUserProc );
 		}
