Index: BasicCompiler_Common/Subroutine.cpp
===================================================================
--- BasicCompiler_Common/Subroutine.cpp	(revision 73)
+++ BasicCompiler_Common/Subroutine.cpp	(revision 75)
@@ -6,7 +6,4 @@
 #include "../BasicCompiler32/opcode.h"
 #endif
-
-//コンパイル中の関数情報
-SubInfo *pCompilingSubInfo;
 
 int GetCallProcName(char *buffer,char *name){
@@ -56,8 +53,11 @@
 
 	//関数ポインタ
-	int type;
-	LONG_PTR lpIndex;
-	type=GetVarType(name,&lpIndex,0);
-	if(type==DEF_PTR_PROC) return PROC_PTR;
+	Type type;
+	if( !GetVarType( name, type, false ) ){
+		return 0;
+	}
+	if( type.IsProcPtr() ){
+		return PROC_PTR;
+	}
 
 	return 0;
@@ -105,24 +105,22 @@
 }
 
-
-int CallProc(int idProc,void *pInfo,char *name,char *Parameter,LONG_PTR *plpRetIndex){
-	int ret_type;
-
-	if(idProc==PROC_DEFAULT){
+bool CallProc( int kind, const void *pProc, const char *fullCallName, const char *lpszParms, Type &resultType, bool isCallOn ){
+
+	//GetSubHash内でエラー提示が行われた場合
+	if(pProc==(Procedure *)-1){
+		return false;
+	}
+
+	if(kind==PROC_DEFAULT){
 		/////////////////////
 		// ユーザー定義関数
 		/////////////////////
 
-		SubInfo *pSub;
-		pSub=(SubInfo *)pInfo;
-
-		//GetSubHash内でエラー提示が行われた場合
-		if(pSub==(SubInfo *)-1) return -1;
-
+		UserProc *pUserProc = (UserProc *)pProc;
 
 		//オブジェクト名を取得
 		char ObjectName[VN_SIZE];
 		int RefType;
-		SplitObjectName(name,ObjectName,&RefType);
+		SplitObjectName(fullCallName,ObjectName,&RefType);
 
 
@@ -131,58 +129,72 @@
 		////////////////////////
 
-		std::vector<SubInfo *> subs;
-		GetOverloadSubHash(name,subs);
+		std::vector<UserProc *> subs;
+		GetOverloadSubHash(fullCallName,subs);
 		if(subs.size()){
 			//オーバーロードを解決
-			pSub=OverloadSolutionWithStrParam(name,subs,Parameter,ObjectName,NULL);
-
-			if(!pSub) return 0;
-		}
-
-
-		Opcode_CallProc(Parameter,pSub,0,ObjectName,RefType);
-		if( plpRetIndex ){
-			*plpRetIndex = pSub->u.ReturnIndex;
-		}
-		return pSub->ReturnType;
-	}
-	else if(idProc==PROC_DLL){
+			pUserProc=OverloadSolutionWithStrParam(fullCallName,subs,lpszParms,ObjectName);
+
+			if(!pUserProc){
+				return false;
+			}
+		}
+
+		resultType = pUserProc->ReturnType();
+
+		if( isCallOn ){
+			if( !Opcode_CallProc(lpszParms,pUserProc,0,ObjectName,RefType) ){
+				return false;
+			}
+		}
+	}
+	else if(kind==PROC_DLL){
 		/////////////////////////
 		// DLL関数
 		/////////////////////////
-		DECLAREINFO *pdi;
-		pdi=(DECLAREINFO *)pInfo;
-
-		ret_type=Opcode_CallDllProc(Parameter,pdi,plpRetIndex);
-	}
-	else if(idProc==PROC_BUILTIN){
+		DllProc *pDllProc = (DllProc *)pProc;
+
+		resultType = pDllProc->ReturnType();
+
+		if( isCallOn ){
+			if( !Opcode_CallDllProc(lpszParms,pDllProc) ){
+				return false;
+			}
+		}
+	}
+	else if(kind==PROC_BUILTIN){
 		/////////////////////////
 		// 組み込み関数
 		/////////////////////////
-		int FuncId;
-		FuncId=(int)(_int64)pInfo;
-
-		TYPEINFO ReturnTypeInfo = { DEF_LONG, NULL };
-		Opcode_CallFunc( Parameter, FuncId, ReturnTypeInfo );
-		if( plpRetIndex ){
-			*plpRetIndex = ReturnTypeInfo.u.lpIndex;
-		}
-		return ReturnTypeInfo.type;
-	}
-	else if(idProc==PROC_PTR){
+		int FuncId = (int)(_int64)pProc;
+
+		if( !Opcode_CallFunc( lpszParms, FuncId, resultType, isCallOn ) ){
+			return false;
+		}
+	}
+	else if(kind==PROC_PTR){
 		/////////////////
 		// 関数ポインタ
 		/////////////////
 
-		LONG_PTR lpIndex;
-		GetVarType(name,&lpIndex,0);
-
-		extern PROCPTRINFO *pProcPtrInfo;
-		ret_type=Opcode_CallProcPtr(name,Parameter,&pProcPtrInfo[lpIndex],plpRetIndex);
-	}
-
-	return ret_type;
-}
-BOOL CallPropertyMethod(char *variable,char *RightSide,TYPEINFO *pRetTypeInfo){
+		Type type;
+		GetVarType(fullCallName,type,false);
+
+		extern ProcPointer **ppProcPointer;
+		ProcPointer *pProcPtr = ppProcPointer[type.GetIndex()];
+		resultType = pProcPtr->ReturnType();
+
+		if( isCallOn ){
+			if( !Opcode_CallProcPtr(fullCallName,lpszParms,pProcPtr) ){
+				return false;
+			}
+		}
+	}
+	else{
+		return false;
+	}
+
+	return true;
+}
+bool CallPropertyMethod( const char *variable, const char *rightSide, Type &resultType){
 	//プロパティ用のメソッドを呼び出す
 
@@ -197,113 +209,36 @@
 
 	//オーバーロード用の関数リストを作成
-	std::vector<SubInfo *> subs;
+	std::vector<UserProc *> subs;
 	GetOverloadSubHash(VarName,subs);
 	if(subs.size()==0){
-		return 0;
+		return false;
 	}
 
 	//パラメータを整備
 	char *Parameter;
-	Parameter=(char *)HeapAlloc(hHeap,0,lstrlen(ArrayElements)+lstrlen(RightSide)+32);
+	Parameter=(char *)HeapAlloc(hHeap,0,lstrlen(ArrayElements)+lstrlen(rightSide)+32);
 	lstrcpy(Parameter,ArrayElements);
-	if(RightSide){
-		if(Parameter[0]&&RightSide[0]) lstrcat(Parameter,",");
-		lstrcat(Parameter,RightSide);
+	if(rightSide){
+		if(Parameter[0]&&rightSide[0]) lstrcat(Parameter,",");
+		lstrcat(Parameter,rightSide);
 	}
 
 	//オーバーロードを解決
-	SubInfo *pSub;
-	pSub=OverloadSolutionWithStrParam(VarName,subs,Parameter,ObjectName,NULL);
-
-	if(pSub){
+	UserProc *pUserProc;
+	pUserProc=OverloadSolutionWithStrParam(VarName,subs,Parameter,ObjectName);
+
+	if(pUserProc){
 		//呼び出し
-		Opcode_CallProc(Parameter,pSub,0,ObjectName,RefType);
-
-		if( pRetTypeInfo ){
-			pRetTypeInfo->type = pSub->ReturnType;
-			pRetTypeInfo->u.lpIndex = pSub->u.ReturnIndex;
-		}
+		Opcode_CallProc(Parameter,pUserProc,0,ObjectName,RefType);
+
+		resultType = pUserProc->ReturnType();
 	}
 
 	HeapDefaultFree(Parameter);
 
-	return 1;
-}
-
-
-int GetReturnTypeOfProc(int idProc,void *pInfo,char *name,char *Parameter,LONG_PTR *plpRetIndex){
-	int ret_type;
-
-	if(idProc==PROC_DEFAULT){
-		/////////////////////
-		// ユーザー定義関数
-		/////////////////////
-
-		SubInfo *pSub;
-		pSub=(SubInfo *)pInfo;
-
-		//GetSubHash内でエラー提示が行われた場合
-		if(pSub==(SubInfo *)-1) return -1;
-
-
-		//オブジェクト名を取得
-		char ObjectName[VN_SIZE];
-		int RefType;
-		SplitObjectName(name,ObjectName,&RefType);
-
-
-		////////////////////////
-		// オーバーロードを解決
-		////////////////////////
-
-		std::vector<SubInfo *> subs;
-		GetOverloadSubHash(name,subs);
-		if( subs.size() > 0 ){
-			//オーバーロードを解決
-			pSub=OverloadSolutionWithStrParam(name,subs,Parameter,ObjectName,NULL);
-
-			if(!pSub) return 0;
-		}
-
-
-		ret_type=pSub->ReturnType;
-		*plpRetIndex=pSub->u.ReturnIndex;
-	}
-	else if(idProc==PROC_DLL){
-		/////////////////////////
-		// DLL関数
-		/////////////////////////
-		DECLAREINFO *pdi;
-		pdi=(DECLAREINFO *)pInfo;
-
-		ret_type=pdi->ReturnType;
-		*plpRetIndex=pdi->u.ReturnIndex;
-	}
-	else if(idProc==PROC_BUILTIN){
-		/////////////////////////
-		// 組み込み関数
-		/////////////////////////
-		int FuncId;
-		FuncId=(int)(_int64)pInfo;
-
-		ret_type=GetFunctionType(FuncId);
-		*plpRetIndex=-1;
-	}
-	else if(idProc==PROC_PTR){
-		/////////////////
-		// 関数ポインタ
-		/////////////////
-
-		LONG_PTR lpIndex;
-		GetVarType(name,&lpIndex,0);
-
-		extern PROCPTRINFO *pProcPtrInfo;
-		ret_type=pProcPtrInfo[lpIndex].ReturnType;
-		*plpRetIndex=pProcPtrInfo[lpIndex].u.ReturnIndex;
-	}
-
-	return ret_type;
-}
-BOOL GetReturnTypeOfPropertyMethod(char *variable,char *RightSide,TYPEINFO *pRetTypeInfo){
+	return true;
+}
+
+bool GetReturnTypeOfPropertyMethod( const char *variable, const char *rightSide, Type &resultType ){
 	//プロパティ用のメソッドを呼び出す
 
@@ -318,5 +253,5 @@
 
 	//オーバーロード用の関数リストを作成
-	std::vector<SubInfo *> subs;
+	std::vector<UserProc *> subs;
 	GetOverloadSubHash(VarName,subs);
 	if(subs.size()==0){
@@ -326,20 +261,17 @@
 	//パラメータを整備
 	char *Parameter;
-	Parameter=(char *)HeapAlloc(hHeap,0,lstrlen(ArrayElements)+lstrlen(RightSide)+32);
+	Parameter=(char *)HeapAlloc(hHeap,0,lstrlen(ArrayElements)+lstrlen(rightSide)+32);
 	lstrcpy(Parameter,ArrayElements);
-	if(RightSide){
-		if(Parameter[0]&&RightSide[0]) lstrcat(Parameter,",");
-		lstrcat(Parameter,RightSide);
+	if(rightSide){
+		if(Parameter[0]&&rightSide[0]) lstrcat(Parameter,",");
+		lstrcat(Parameter,rightSide);
 	}
 
 	//オーバーロードを解決
-	SubInfo *pSub;
-	pSub=OverloadSolutionWithStrParam(VarName,subs,Parameter,ObjectName,NULL);
-
-	if(pSub){
-		if(pRetTypeInfo){
-			pRetTypeInfo->type=pSub->ReturnType;
-			pRetTypeInfo->u.lpIndex=pSub->u.ReturnIndex;
-		}
+	UserProc *pUserProc;
+	pUserProc=OverloadSolutionWithStrParam(VarName,subs,Parameter,ObjectName);
+
+	if(pUserProc){
+		resultType = pUserProc->ReturnType();
 	}
 
@@ -348,13 +280,12 @@
 
 //インデクサ（getter）の戻り値を取得
-bool GetReturnTypeOfIndexerGetterProc(CClass *pobj_Class,TYPEINFO &RetTypeInfo){
-	std::vector<SubInfo *> subs;
-	pobj_Class->EnumMethod( CALC_ARRAY_GET, subs );
+bool GetReturnTypeOfIndexerGetterProc( const CClass &objClass, Type &resultType ){
+	std::vector<UserProc *> subs;
+	objClass.EnumMethod( CALC_ARRAY_GET, subs );
 	if( subs.size() == 0 ){
 		return false;
 	}
 
-	RetTypeInfo.type = subs[0]->ReturnType;
-	RetTypeInfo.u.lpIndex = subs[0]->u.ReturnIndex;
+	resultType = subs[0]->ReturnType();
 
 	return true;
@@ -362,26 +293,19 @@
 
 
-void AddDeclareData(char *buffer,int NowLine){
+void AddDeclareData(char *buffer,int nowLine){
 	extern HANDLE hHeap;
-	int i,i2,i3,i4,sw,IsFunction;
-	char temporary[VN_SIZE];
-
-	i=0;
-
-	DWORD dwType;
-	BOOL bCdecl=0;
-
-	//Static/Dynamic
-	if(buffer[i]==ESC_STATIC){
-		dwType=DECLARE_STATIC;
-		i++;
-	}
-	else dwType=DECLARE_DYNAMIC;
+	int i2;
+
+	int i=0;
 
 	//Sub/Function
-	if(buffer[i]==ESC_SUB) IsFunction=0;
-	else if(buffer[i]==ESC_FUNCTION) IsFunction=1;
+	Procedure::Kind kind = Procedure::Sub;
+	if(buffer[i]==ESC_SUB){
+	}
+	else if(buffer[i]==ESC_FUNCTION){
+		kind = Procedure::Function;
+	}
 	else{
-		SetError(1,NULL,NowLine);
+		SetError(1,NULL,nowLine);
 		return;
 	}
@@ -389,280 +313,161 @@
 
 	//プロシージャ名
+	char procName[VN_SIZE];
+	bool isCdecl = false;
 	for(i2=0;;i++,i2++){
 		if(buffer[i]==1&&buffer[i+1]==ESC_CDECL){
-			bCdecl=1;
+			isCdecl = true;
 
 			i+=2;
-			temporary[i2]=0;
+			procName[i2]=0;
 			break;
 		}
 		if(buffer[i]==','){
-			temporary[i2]=0;
+			procName[i2]=0;
 			break;
 		}
 		if(buffer[i]=='\0'){
-			SetError(1,NULL,NowLine);
+			SetError(1,NULL,nowLine);
 			return;
 		}
-		temporary[i2]=buffer[i];
-	}
+		procName[i2]=buffer[i];
+	}
+	i++;
 
 	//ユーザー定義関数との重複チェック
-	if(GetSubHash(temporary)){
-		SetError(15,temporary,NowLine);
+	if(GetSubHash(procName)){
+		SetError(15,procName,nowLine);
 		return;
 	}
 
 
+	//ライブラリ
+	char dllFileName[MAX_PATH];
+	i = GetOneParameter( buffer, i, dllFileName );
+	Type resultType;
+	_int64 i64data;
+	if( !StaticCalculation( true, dllFileName, 0, &i64data, resultType ) ){
+		return;
+	}
+	if( resultType.GetBasicType() != typeOfPtrChar ){
+		SetError(1,NULL,nowLine);
+		return;
+	}
+	lstrcpy( dllFileName, (char *)i64data );
+	CharUpper(dllFileName);
+	if(!strstr(dllFileName,".")){
+		lstrcat(dllFileName,".DLL");
+		if(lstrlen(dllFileName)>=16){
+			SetError(7,NULL,nowLine);
+			return;
+		}
+	}
+
+	//エイリアス
+	char alias[VN_SIZE];
+	i = GetOneParameter( buffer, i, alias );
+	if( alias[0] ){
+		if( !StaticCalculation( true, alias, 0, &i64data, resultType ) ){
+			return;
+		}
+		if( resultType.GetBasicType() != typeOfPtrChar ){
+			SetError(1,NULL,nowLine);
+			return;
+		}
+		lstrcpy( alias, (char *)i64data );
+	}
+	else{
+		//省略されたときは関数名
+		lstrcpy( alias, procName );
+	}
+
+
+	// オブジェクトを生成
+	DllProc *pDllProc = new DllProc( procName, kind, isCdecl, dllFileName, alias );
+
+	// パラメータを解析
+	// ※第1パラメータにに指定するデータの例："( s As String ) As String"
+	pDllProc->SetParamsAndReturnType( buffer + i, nowLine );
+
+	// パラメータのエラーチェック
+	foreach( const Parameter *pParam, pDllProc->Params() ){
+		if( pParam->IsObject() ){
+			SetError(25,pParam->GetVarName(),nowLine);
+		}
+		if( !pParam->IsRef() ){
+			if( pParam->IsStruct() ){
+				SetError(28,pParam->GetVarName(),nowLine);
+			}
+		}
+	}
+
+	//戻り値のエラーチェック
+	if( pDllProc->IsFunction() ){
+		// Function定義
+
+		if( pDllProc->ReturnType().IsObject() ){
+			// DLL関数ではオブジェクトを戻り値にできない
+			SetError(40,pDllProc->GetName(),nowLine);
+		}
+	}
+
+
 	/////////////////////////////////
-	// 格納位置を計算してpciにセット
+	// 格納位置を計算してppDeclareHashにセット
 	/////////////////////////////////
 
 	//ハッシュ値を取得
 	int key;
-	key=hash_default(temporary);
-
-	extern DECLAREINFO **ppDeclareHash;
-	DECLAREINFO *pdi;
+	key=hash_default(procName);
+
+	extern DllProc **ppDeclareHash;
 	if(ppDeclareHash[key]){
-		pdi=ppDeclareHash[key];
+		DllProc *pTempProc;
+		pTempProc=ppDeclareHash[key];
 		while(1){
-			if(lstrcmpi(pdi->name,temporary)==0){
+			if( pDllProc->GetName() == pTempProc->GetName() ){
 				//重複エラー
-				SetError(15,temporary,NowLine);
+				SetError(15,procName,nowLine);
 				return;
 			}
 
-			if(pdi->pNextData==0){
-				pdi->pNextData=(DECLAREINFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,sizeof(DECLAREINFO));
+			if(pTempProc->pNextData==0){
+				pTempProc->pNextData=pDllProc;
 				break;
 			}
-			pdi=pdi->pNextData;
-		}
-		pdi=pdi->pNextData;
+			pTempProc=pTempProc->pNextData;
+		}
+		pTempProc=pTempProc->pNextData;
 	}
 	else{
-		ppDeclareHash[key]=(DECLAREINFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,sizeof(DECLAREINFO));
-		pdi=ppDeclareHash[key];
-	}
-
-	pdi->dwType=dwType;
-	pdi->bCdecl=bCdecl;
-
-	pdi->name=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
-	lstrcpy(pdi->name,temporary);
+		ppDeclareHash[key]=pDllProc;
+	}
+}
+
+UserProc *AddSubData(char *buffer,int nowLine,BOOL bVirtual,CClass *pobj_c, bool isStatic){
+	int i2,i3;
+	char temporary[8192];
+
+	int i=1;
+
+	UserProc::Kind kind = Procedure::Sub;
+	bool isMacro = false;
+	if(buffer[i]==ESC_FUNCTION) kind = Procedure::Function;
+	if(buffer[i]==ESC_MACRO){
+		isMacro = true;
+	}
+
 	i++;
 
-	//ライブラリ
-	i = GetOneParameter( buffer, i, temporary );
-	int type;
-	LONG_PTR lpIndex;
-	_int64 i64data;
-	type = StaticCalculation( true, temporary, 0, &i64data, &lpIndex );
-	if( type != typeOfPtrChar ){
-		SetError(1,NULL,NowLine);
-		return;
-	}
-	lstrcpy( temporary, (char *)i64data );
-	CharUpper(temporary);
-	if(!strstr(temporary,".")){
-		if(pdi->dwType==DECLARE_STATIC) lstrcat(temporary,".LIB");
-		else{
-			lstrcat(temporary,".DLL");
-			if(lstrlen(temporary)>=16){
-				SetError(7,NULL,NowLine);
-				return;
-			}
-		}
-	}
-	pdi->file=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
-	lstrcpy(pdi->file,temporary);
-
-	//エイリアス
-	i = GetOneParameter( buffer, i, temporary );
-	if( temporary[0] ){
-		type = StaticCalculation( true, temporary, 0, &i64data, &lpIndex );
-		if( type != typeOfPtrChar ){
-			SetError(1,NULL,NowLine);
-			return;
-		}
-		lstrcpy( temporary, (char *)i64data );
-
-		pdi->alias=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
-		lstrcpy(pdi->alias,temporary);
-	}
-	else{
-		//省略されたときは関数名
-		pdi->alias=(char *)HeapAlloc(hHeap,0,lstrlen(pdi->name)+1);
-		lstrcpy(pdi->alias,pdi->name);
-	}
-
-	//パラメータの始めのカッコ
-	if(buffer[i]!='('){
-		SetError(1,NULL,NowLine);
-		return;
-	}
-	i++;
-
-	pdi->pParmInfo=(PARAMETER_INFO *)HeapAlloc(hHeap,0,1);
-
-	//各パラメータ
-	for(i3=0;;i3++){
-		if(buffer[i]==')') break;
-
-		pdi->pParmInfo=(PARAMETER_INFO *)HeapReAlloc(hHeap,0,pdi->pParmInfo,(i3+1)*sizeof(PARAMETER_INFO));
-
-		//ByVal
-		if(buffer[i]==1&&buffer[i+1]==ESC_BYVAL){
-			pdi->pParmInfo[i3].bByVal=1;
+	bool isCdecl = false;
+	bool isExport = false;
+	while(1){
+		if(buffer[i]==1&&buffer[i+1]==ESC_CDECL&& isCdecl == false ){
+			isCdecl = true;
+
 			i+=2;
 		}
-		else if(buffer[i]==1&&buffer[i+1]==ESC_BYREF){
-			pdi->pParmInfo[i3].bByVal=0;
-			i+=2;
-		}
-		else pdi->pParmInfo[i3].bByVal=1;
-
-		//変数名は無視（temporaryの変数名は型宣言文字判断のため）
-		sw=0;
-		for(i2=0;;i++,i2++){
-			if(buffer[i]=='('){
-				if(!sw) sw=1;
-
-				i4=GetStringInPare(temporary+i2,buffer+i);
-				i2+=i4-1;
-				i+=i4-1;
-				continue;
-			}
-			if(buffer[i]=='['){
-				if(!sw) sw=1;
-
-				i4=GetStringInBracket(temporary+i2,buffer+i);
-				i2+=i4-1;
-				i+=i4-1;
-				continue;
-			}
-			if(!IsVariableChar(buffer[i])){
-				temporary[i2]=0;
-				break;
-			}
-			temporary[i2]=buffer[i];
-		}
-		if(lstrcmp(temporary,"...")==0) pdi->pParmInfo[i3].type=DEF_ELLIPSE;
-		else{
-			//型
-			if(buffer[i]==1&&buffer[i+1]==ESC_AS){
-				i+=2;
-				for(i2=0;;i++,i2++){
-					if(!(IsVariableChar(buffer[i])||buffer[i]=='*')){
-						temporary[i2]=0;
-						break;
-					}
-					temporary[i2]=buffer[i];
-				}
-				pdi->pParmInfo[i3].type=GetTypeFixed(temporary,&pdi->pParmInfo[i3].u.index);
-			}
-			else{
-				pdi->pParmInfo[i3].type=GetTypeFromSimpleName(temporary);
-				SetError(-103,temporary,NowLine);
-			}
-
-			if(sw){
-				//配列ポインタを引き渡すとき
-				pdi->pParmInfo[i3].type=GetPtrType(pdi->pParmInfo[i3].type,pdi->pParmInfo[i3].u.index);
-			}
-		}
-
-		//名前はダミー（使用しないため）
-		pdi->pParmInfo[i3].name="";
-
-		//構造体の場合はエラーチェック
-		if(pdi->pParmInfo[i3].type==-1) SetError(3,temporary,NowLine);
-		if(pdi->pParmInfo[i3].type==DEF_OBJECT){
-			if(pdi->pParmInfo[i3].bByVal) pdi->pParmInfo[i3].type=DEF_LONG;//SetError(28,temporary,NowLine);
-		}
-
-		//構造体アドレスの空白部
-		while(buffer[i]==' ') i++;
-
-		if(buffer[i]==','){
-			i++;
-			continue;
-		}
-		else if(buffer[i]==')') continue;
-		else{
-			SetError(1,NULL,NowLine);
-			break;
-		}
-	}
-	pdi->ParmNum=i3;
-
-	//戻り値
-	i++;
-	if(buffer[i]==1&&buffer[i+1]==ESC_AS){
-		if(IsFunction==0) SetError(1,NULL,NowLine);
-		i+=2;
-		pdi->ReturnType=GetTypeFixed(buffer+i,&pdi->u.ReturnIndex);
-		if(pdi->ReturnType==DEF_NON) SetError(3,buffer+i,NowLine);
-		if(pdi->ReturnType==DEF_OBJECT) SetError(40,NULL,NowLine);
-	}
-	else if(buffer[i]) SetError(1,NULL,NowLine);
-	else pdi->ReturnType=DEF_NON;
-
-	pdi->pos=NowLine;
-}
-
-BOOL CompareParameter(PARAMETER_INFO *ppi1,int pi_num1,PARAMETER_INFO *ppi2,int pi_num2){
-	if(pi_num1!=pi_num2) return 1;
-
-	int i;
-	for(i=0;i<pi_num1;i++){
-		if(ppi1[i].type!=ppi2[i].type){
-
-			if(ppi1[i].bByVal==0&&ppi1[i].type==DEF_ANY&&
-				ppi2[i].bByVal==1&&IsPtrType(ppi2[i].type)||
-				ppi1[i].bByVal==1&&IsPtrType(ppi1[i].type)&&
-				ppi2[i].bByVal==0&&ppi2[i].type==DEF_ANY){
-					/* ByRef var As Any
-							と
-						var As VoidPtr
-						は同等
-					*/
-					continue;
-			}
-
-			return 1;
-		}
-		else{
-			if(NATURAL_TYPE(ppi1[i].type)==DEF_OBJECT
-				|| NATURAL_TYPE(ppi1[i].type)==DEF_STRUCT ){
-				if(ppi1[i].u.index!=ppi2[i].u.index) return 1;
-			}
-		}
-	}
-
-	return 0;
-}
-SubInfo *AddSubData(char *buffer,int NowLine,BOOL bVirtual,CClass *pobj_c,BOOL bStatic){
-	int i,i2,i3,sw;
-	DWORD dwType;
-	char temporary[8192],temp2[VN_SIZE];
-
-	i=1;
-	if(buffer[i]==ESC_SUB) dwType=SUBTYPE_SUB;
-	else if(buffer[i]==ESC_FUNCTION) dwType=SUBTYPE_FUNCTION;
-	else if(buffer[i]==ESC_MACRO) dwType=SUBTYPE_MACRO;
-
-	i++;
-
-	BOOL bExport=0,bCdecl=0;
-	while(1){
-		if(buffer[i]==1&&buffer[i+1]==ESC_EXPORT&&bExport==0){
-			bExport=1;
-
-			i+=2;
-		}
-		else if(buffer[i]==1&&buffer[i+1]==ESC_CDECL&&bCdecl==0){
-			bCdecl=1;
+		else if(buffer[i]==1&&buffer[i+1]==ESC_EXPORT&& isExport == false ){
+			isExport = true;
 
 			i+=2;
@@ -674,5 +479,5 @@
 	if(buffer[i]==1&&buffer[i+1]==ESC_OPERATOR){
 		if(!pobj_c){
-			SetError(126,NULL,NowLine);
+			SetError(126,NULL,nowLine);
 			return 0;
 		}
@@ -708,5 +513,5 @@
 		}
 		if(!iCalcId){
-			SetError(1,NULL,NowLine);
+			SetError(1,NULL,nowLine);
 			return 0;
 		}
@@ -735,5 +540,5 @@
 	}
 
-	if(dwType==SUBTYPE_MACRO){
+	if( isMacro ){
 		//大文字に変換
 		CharUpper(temporary);
@@ -753,5 +558,5 @@
 
 		if(GetDeclareHash(temporary)){
-			SetError(15,temporary,NowLine);
+			SetError(15,temporary,nowLine);
 			return 0;
 		}
@@ -761,434 +566,19 @@
 	SubNum++;
 
-	SubInfo *pSub = new SubInfo();
-
-	//クラス名
-	pSub->pobj_ParentClass=pobj_c;
+
+	UserProc *pUserProc = new UserProc( temporary, kind, isMacro, isCdecl, isExport );
+	pUserProc->SetParentClass( pobj_c );
 
 	//ID
 	static int id_base=0;
-	pSub->id=(id_base++);
-
-	//関数名
-	pSub->name=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
-	lstrcpy(pSub->name,temporary);
-
-	//ソースコードの位置
-	pSub->address=NowLine;
-
-	pSub->bExport=bExport;
-	pSub->bCdecl=bCdecl;
-	pSub->bVirtual=bVirtual;
-	if(bExport) pSub->bUse=1;
-	else pSub->bUse=0;
-	pSub->bCompile=0;
-	pSub->bSystem=0;
-
-	pSub->dwType=dwType;
-
-
-	if(pSub->dwType==SUBTYPE_FUNCTION){
-		///////////////////
-		// 戻り値を取得
-		///////////////////
-
-		pSub->isReturnRef = false;
-
-		if(pobj_c){
-			if(lstrcmp(pSub->name,pobj_c->name)==0||
-				pSub->name[0]=='~'){
-				//クラスのコンストラクタ、デストラクタがFunction定義の場合はエラーをだす
-				SetError(115,NULL,NowLine);
-			}
-		}
-
-
-		i2=lstrlen(buffer)-2;
-
-		int sw_as=0;
-		for(;i2>0;i2--){
-			if(buffer[i2]==')') break;
-
-			if(buffer[i2]==1&&buffer[i2+1]==ESC_AS){
-				if( buffer[i2-2] == 1 && buffer[i2-1] == ESC_BYREF ){
-					//参照型
-					pSub->isReturnRef = true;
-				}
-
-				i2+=2;
-				i3=0;
-				while(buffer[i2]=='*') temporary[i3++]=buffer[i2++];
-				for(;;i2++,i3++){
-					if(!IsVariableChar(buffer[i2])){
-						temporary[i3]=0;
-						break;
-					}
-					temporary[i3]=buffer[i2];
-				}
-				pSub->ReturnType=GetTypeFixed(temporary,&pSub->u.ReturnIndex);
-				if(pSub->ReturnType==DEF_NON) SetError(3,temporary,NowLine);
-
-				sw_as=1;
-				break;
-			}
-		}
-
-		if(!sw_as){
-			SetError(-104,pSub->name,NowLine);
-
-			pSub->ReturnType=DEF_DOUBLE;
-		}
-	}
-	else{
-		//戻り値なしのSub定義
-		pSub->ReturnType=DEF_NON;
-		pSub->u.ReturnIndex=-1;
-	}
-
-	//パラメータ
-	if(buffer[i]!='('){
-		SetError(1,NULL,NowLine);
-		return 0;
-	}
-	i++;
-	if(buffer[i]!=')'&&pobj_c){
-		//クラスのメンバ関数の場合のみ、デストラクタにパラメータがある場合にエラーをだす
-		if(pSub->name[0]=='~'){
-			SetError(114,NULL,NowLine);
-			i=JumpStringInPare(buffer,i);
-		}
-	}
-	while(1){
-		if(buffer[i]==')') break;
-
-		//ByRef
-		bool isRef;
-		if(buffer[i]==1&&buffer[i+1]==ESC_BYVAL){
-			isRef = false;
-			i+=2;
-		}
-		else if(buffer[i]==1&&buffer[i+1]==ESC_BYREF){
-			isRef = true;
-			i+=2;
-		}
-		else isRef = false;
-
-		//パラメータ名
-		bool isArray = false;
-		int subScripts[MAX_ARRAYDIM];
-		char name[VN_SIZE];
-		sw=0;
-		for(i2=0;;i++,i2++){
-			if(buffer[i]=='('){
-				if(!sw) sw=1;
-
-				i3=GetStringInPare(name+i2,buffer+i);
-				i2+=i3-1;
-				i+=i3-1;
-				continue;
-			}
-			if(buffer[i]=='['){
-				if(!sw) sw=1;
-
-				i3=GetStringInBracket(name+i2,buffer+i);
-				i2+=i3-1;
-				i+=i3-1;
-				continue;
-			}
-			if(!IsVariableChar(buffer[i])){
-				name[i2]=0;
-				break;
-			}
-			name[i2]=buffer[i];
-		}
-		if(sw){
-			//配列パラメータ
-			if( isRef == false ) SetError(29,NULL,NowLine);
-			isArray = true;
-
-			if((name[i2-2]=='('&&name[i2-1]==')')||
-				(name[i2-2]=='['&&name[i2-1]==']')){
-				subScripts[0]=LONG_MAX;
-				subScripts[1]=-1;
-
-				name[i2-2]=0;
-			}
-			else{
-				GetArrange(name,temp2,subScripts);
-				lstrcpy(name,temp2);
-			}
-
-			i2=lstrlen(name);
-		}
-
-		//型
-		Type type( DEF_NON );
-		if(buffer[i]==1&&buffer[i+1]==ESC_AS){
-			i+=2;
-
-			i2=0;
-			while(buffer[i]=='*'){
-				temporary[i2]=buffer[i];
-				i++;
-				i2++;
-			}
-			for(;;i++,i2++){
-				if(!IsVariableChar(buffer[i])){
-					if(buffer[i]==1&&(buffer[i+1]==ESC_FUNCTION||buffer[i+1]==ESC_SUB)){
-						temporary[i2++]=buffer[i++];
-						temporary[i2]=buffer[i];
-						continue;
-					}
-					temporary[i2]=0;
-					break;
-				}
-				temporary[i2]=buffer[i];
-			}
-
-			Type::StringToType( temporary, type );
-
-			if(temporary[0]=='*'&&
-				temporary[1]==1&&
-				(temporary[2]==ESC_FUNCTION||temporary[2]==ESC_SUB)){
-				if(buffer[i]!='('){
-					SetError(10,temporary,NowLine);
-					break;
-				}
-				i3=GetStringInPare(temporary+i2,buffer+i);
-				i+=i3;
-				i2+=i3;
-
-				if(temporary[2]==ESC_FUNCTION&&buffer[i]==1&&buffer[i+1]==ESC_AS){
-					temporary[i2++]=buffer[i++];
-					temporary[i2++]=buffer[i++];
-					for(;;i++,i2++){
-						if(!IsVariableChar(buffer[i])){
-							temporary[i2]=0;
-							break;
-						}
-						temporary[i2]=buffer[i];
-					}
-				}
-			}
-			else{
-				//TypeDefをする前のベース型を取得
-				GetOriginalTypeName(temporary);
-			}
-
-			if( type.IsNull() ){
-				SetError(3,temporary,NowLine);
-				type.SetBasicType( DEF_PTR_VOID );
-			}
-		}
-		else{
-			type.SetBasicType( GetTypeFromSimpleName(temporary) );
-			SetError(-103,temporary,NowLine);
-		}
-
-		if( type.IsProcPtr() ){
-			//関数ポインタの場合
-			type.SetIndex( AddProcPtrInfo(temporary+3,temporary[2]) );
-		}
-
-		Parameter *pParam = new Parameter( name, type, isRef );
-		if( isArray ){
-			pParam->SetArray( subScripts );
-		}
-
-		//パラメータを追加
-		pSub->params.push_back( pParam );
-
-		if(buffer[i]==','){
-			i++;
-			continue;
-		}
-		else if(buffer[i]==')') continue;
-		else{
-			SetError(1,NULL,NowLine);
-			break;
-		}
-	}
-	pSub->SecondParmNum = (int)pSub->params.size();
-	i++;
-	if(buffer[i]=='('){
-		i++;
-		while(1){
-			if(buffer[i]==')') break;
-
-			//ByRef
-			bool isRef;
-			if(buffer[i]==1&&buffer[i+1]==ESC_BYVAL){
-				isRef = false;
-				i+=2;
-			}
-			else if(buffer[i]==1&&buffer[i+1]==ESC_BYREF){
-				isRef = true;
-				i+=2;
-			}
-			else isRef = false;
-
-			//パラメータ名
-			bool isArray = false;
-			int subScripts[MAX_ARRAYDIM];
-			char name[VN_SIZE];
-			sw=0;
-			for(i2=0;;i++,i2++){
-				if(buffer[i]=='('){
-					if(!sw) sw=1;
-
-					i3=GetStringInPare(name+i2,buffer+i);
-					i2+=i3-1;
-					i+=i3-1;
-					continue;
-				}
-				if(buffer[i]=='['){
-					if(!sw) sw=1;
-
-					i3=GetStringInBracket(name+i2,buffer+i);
-					i2+=i3-1;
-					i+=i3-1;
-					continue;
-				}
-				if(!IsVariableChar(buffer[i])){
-					name[i2]=0;
-					break;
-				}
-				name[i2]=buffer[i];
-			}
-			if(sw){
-				//配列パラメータ
-				if( isRef == false ) SetError(29,NULL,NowLine);
-				isArray = true;
-
-				if((name[i2-2]=='('&&name[i2-1]==')')||
-					(name[i2-2]=='['&&name[i2-1]==']')){
-					subScripts[0]=LONG_MAX;
-					subScripts[1]=-1;
-
-					name[i2-2]=0;
-				}
-				else{
-					GetArrange(name,temp2,subScripts);
-					lstrcpy(name,temp2);
-				}
-
-				i2=lstrlen(name);
-			}
-
-			//型
-			Type type( DEF_NON );
-			if(buffer[i]==1&&buffer[i+1]==ESC_AS){
-				i+=2;
-
-				i2=0;
-				while(buffer[i]=='*'){
-					temporary[i2]=buffer[i];
-					i++;
-					i2++;
-				}
-				for(;;i++,i2++){
-					if(!IsVariableChar(buffer[i])){
-						if(buffer[i]==1&&(buffer[i+1]==ESC_FUNCTION||buffer[i+1]==ESC_SUB)){
-							temporary[i2++]=buffer[i++];
-							temporary[i2]=buffer[i];
-							continue;
-						}
-						temporary[i2]=0;
-						break;
-					}
-					temporary[i2]=buffer[i];
-				}
-
-				Type::StringToType( temporary, type );
-
-				if(temporary[0]=='*'&&
-					temporary[1]==1&&
-					(temporary[2]==ESC_FUNCTION||temporary[2]==ESC_SUB)){
-					if(buffer[i]!='('){
-						SetError(10,temporary,NowLine);
-						break;
-					}
-					i3=GetStringInPare(temporary+i2,buffer+i);
-					i+=i3;
-					i2+=i3;
-
-					if(temporary[2]==ESC_FUNCTION&&buffer[i]==1&&buffer[i+1]==ESC_AS){
-						temporary[i2++]=buffer[i++];
-						temporary[i2++]=buffer[i++];
-						for(;;i++,i2++){
-							if(!IsVariableChar(buffer[i])){
-								temporary[i2]=0;
-								break;
-							}
-							temporary[i2]=buffer[i];
-						}
-					}
-				}
-				else{
-					//TypeDefをする前のベース型を取得
-					GetOriginalTypeName(temporary);
-				}
-
-				if( type.IsNull() ){
-					SetError(3,temporary,NowLine);
-					type.SetBasicType( DEF_PTR_VOID );
-				}
-			}
-			else{
-				type.SetBasicType( GetTypeFromSimpleName(temporary) );
-				SetError(-103,temporary,NowLine);
-			}
-
-			if( type.IsProcPtr() ){
-				//関数ポインタの場合
-				type.SetIndex( AddProcPtrInfo(temporary+3,temporary[2]) );
-			}
-
-			Parameter *pParam = new Parameter( name, type, isRef );
-			if( isArray ){
-				pParam->SetArray( subScripts );
-			}
-
-			//パラメータを追加
-			pSub->params.push_back( pParam );
-
-			if(buffer[i]==','){
-				i++;
-				continue;
-			}
-			else if(buffer[i]==')') continue;
-			else{
-				SetError(1,NULL,NowLine);
-				break;
-			}
-		}
-		i++;
-	}
-
-	//リアルパラメータ領域を取得（_System_LocalThisを考慮して2つだけ多く確保する場合がある）
-
-	if(pobj_c&&bStatic==0){
-		//オブジェクトメンバの場合は、第一パラメータを_System_LocalThis引き渡し用として利用
-		string name = "_System_LocalThis";
-		Type type( DEF_PTR_VOID );
-		pSub->realParams.push_back( new Parameter( name, type ) );
-	}
-
-	if(pSub->ReturnType==DEF_STRUCT){
-		//構造体を戻り値として持つ場合
-		//※第一パラメータ（Thisポインタありの場合は第二パラメータ）を戻り値用の参照宣言にする
-
-		string name = pSub->name;
-		if(pSub->name[0]==1&&pSub->name[1]==ESC_OPERATOR){
-			name="_System_ReturnValue";
-		}
-		Type type( DEF_STRUCT, pSub->u.ReturnIndex );
-		pSub->realParams.push_back( new Parameter( name, type, true ) );
-	}
-
-	//パラメータをコピー
-	foreach( Parameter *pParam, pSub->params ){
-		pSub->realParams.push_back( new Parameter( *pParam ) );
-	}
+	pUserProc->id = (id_base++);
+
+	if(isExport){
+		pUserProc->Using();
+	}
+
+	// パラメータを解析
+	// ※第1パラメータにに指定するデータの例："( s As String ) As String"
+	pUserProc->SetParamsAndReturnType( buffer + i, nowLine, isStatic );
 
 
@@ -1198,16 +588,16 @@
 
 	int key;
-	key=hash_default(pSub->name);
-
-	extern SubInfo **ppSubHash;
+	key=hash_default(pUserProc->GetName().c_str());
+
+	extern UserProc **ppSubHash;
 	if(ppSubHash[key]){
-		SubInfo *psi2;
+		UserProc *psi2;
 		psi2=ppSubHash[key];
 		while(1){
-			if(pobj_c==psi2->pobj_ParentClass){
+			if(pobj_c==psi2->GetParentClassPtr()){
 				//重複エラーチェックを行う
-				if(lstrcmp(psi2->name,pSub->name)==0){
-					if( Parameter::Equals( psi2->params, pSub->params ) ){
-						SetError(15,pSub->name,NowLine);
+				if( pUserProc->GetName() == psi2->GetName() ){
+					if( Parameter::Equals( psi2->Params(), pUserProc->Params() ) ){
+						SetError(15,pUserProc->GetName().c_str(),nowLine);
 						return 0;
 					}
@@ -1218,11 +608,11 @@
 			psi2=psi2->pNextData;
 		}
-		psi2->pNextData=pSub;
+		psi2->pNextData=pUserProc;
 	}
 	else{
-		ppSubHash[key]=pSub;
-	}
-
-	return pSub;
+		ppSubHash[key]=pUserProc;
+	}
+
+	return pUserProc;
 }
 
@@ -1234,11 +624,11 @@
 
 	//Declare（DLL関数）情報を初期化
-	extern DECLAREINFO **ppDeclareHash;
-	ppDeclareHash=(DECLAREINFO **)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,MAX_HASH*sizeof(DECLAREINFO *));
+	extern DllProc **ppDeclareHash;
+	ppDeclareHash=(DllProc **)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,MAX_HASH*sizeof(DllProc *));
 
 	//サブルーチン（ユーザー定義）情報を初期化
-	extern SubInfo **ppSubHash;
+	extern UserProc **ppSubHash;
 	extern int SubNum;
-	ppSubHash=(SubInfo **)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,MAX_HASH*sizeof(SubInfo *));
+	ppSubHash=(UserProc **)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,MAX_HASH*sizeof(UserProc *));
 	SubNum=0;
 
@@ -1334,19 +724,9 @@
 	AddSubData(temporary,0,0,0);
 }
-void Delete_si(SubInfo *pSub){
-	foreach( Parameter *pParam, pSub->params ){
-		delete pParam;
-	}
-
-	foreach( Parameter *pParam, pSub->realParams ){
-		delete pParam;
-	}
-
-	if(pSub->pNextData) Delete_si(pSub->pNextData);
-
-	HeapDefaultFree(pSub->name);
-	delete pSub;
-}
-void DeleteSubInfo(SubInfo **ppSubHash,char **ppMacroNames,int MacroNum){	//サブルーチン情報のメモリ解放
+void Delete_si(UserProc *pUserProc){
+	if(pUserProc->pNextData) Delete_si(pUserProc->pNextData);
+	delete pUserProc;
+}
+void DeleteSubInfo(UserProc **ppSubHash,char **ppMacroNames,int MacroNum){	//サブルーチン情報のメモリ解放
 	int i;
 	for(i=0;i<MAX_HASH;i++){
@@ -1365,18 +745,12 @@
 	}
 }
-void Delete_di(DECLAREINFO *pdi){
-	if(pdi->pParmInfo) HeapDefaultFree(pdi->pParmInfo);
-
-	HeapDefaultFree(pdi->name);
-	if(pdi->file) HeapDefaultFree(pdi->file);
-	if(pdi->alias) HeapDefaultFree(pdi->alias);
-
-	if(pdi->pNextData) Delete_di(pdi->pNextData);
-
-	HeapDefaultFree(pdi);
+void Delete_di(DllProc *pDllProc){
+	if(pDllProc->pNextData) Delete_di(pDllProc->pNextData);
+
+	delete pDllProc;
 }
 void DeleteDeclareInfo(void){
 	//DLL情報を解放
-	extern DECLAREINFO **ppDeclareHash;
+	extern DllProc **ppDeclareHash;
 	int i;
 	for(i=0;i<MAX_HASH;i++){
@@ -1394,168 +768,32 @@
 ///////////////////////
 
-int AddProcPtrInfo(char *buffer,DWORD dwProcType){
-	extern HANDLE hHeap;
-	extern int cp;
-	extern PROCPTRINFO *pProcPtrInfo;
+int AddProcPtrInfo( char *buffer, DWORD dwProcType, int nowLine ){
+
+	Procedure::Kind kind = Procedure::Sub;
+	if( dwProcType == ESC_FUNCTION ){
+		kind = Procedure::Function;
+	}
+
+	ProcPointer *pProcPointer = new ProcPointer( kind );
+
+	//buffer[0]は'('となっている
+	pProcPointer->SetParamsAndReturnType( buffer, nowLine );
+
+	extern ProcPointer **ppProcPointer;
 	extern int ProcPtrInfoNum;
-	int i,i2,i3,sw;
-	PROCPTRINFO *pi;
-	char temporary[VN_SIZE],temp2[VN_SIZE];
-
-	pProcPtrInfo=(PROCPTRINFO *)HeapReAlloc(hHeap,0,pProcPtrInfo,(ProcPtrInfoNum+1)*sizeof(PROCPTRINFO));
-	pi=&pProcPtrInfo[ProcPtrInfoNum];
+	ppProcPointer=(ProcPointer **)HeapReAlloc(hHeap,0,ppProcPointer,(ProcPtrInfoNum+1)*sizeof(ProcPointer *));
+	ppProcPointer[ProcPtrInfoNum] = pProcPointer;
 	ProcPtrInfoNum++;
 
-	pi->pParmInfo=(PARAMETER_INFO *)HeapAlloc(hHeap,0,1);
-	pi->ParmNum=0;
-
-	//buffer[0]は'('となっている
-	i=1;
-
-	while(1){
-		if(buffer[i]==')') break;
-
-		pi->pParmInfo=(PARAMETER_INFO *)HeapReAlloc(hHeap,0,pi->pParmInfo,(pi->ParmNum+1)*sizeof(PARAMETER_INFO));
-
-		//ByVal
-		if(buffer[i]==1&&buffer[i+1]==ESC_BYVAL){
-			pi->pParmInfo[pi->ParmNum].bByVal=1;
-			i+=2;
-		}
-		else if(buffer[i]==1&&buffer[i+1]==ESC_BYREF){
-			pi->pParmInfo[pi->ParmNum].bByVal=0;
-			i+=2;
-		}
-		else pi->pParmInfo[pi->ParmNum].bByVal=1;
-
-		//パラメータ名
-		sw=0;
-		for(i2=0;;i++,i2++){
-			if(buffer[i]=='('){
-				if(!sw) sw=1;
-
-				i3=GetStringInPare(temporary+i2,buffer+i);
-				i2+=i3-1;
-				i+=i3-1;
-				continue;
-			}
-			if(buffer[i]=='['){
-				if(!sw) sw=1;
-
-				i3=GetStringInBracket(temporary+i2,buffer+i);
-				i2+=i3-1;
-				i+=i3-1;
-				continue;
-			}
-			if(!IsVariableChar(buffer[i])){
-				temporary[i2]=0;
-				break;
-			}
-			temporary[i2]=buffer[i];
-		}
-		pi->pParmInfo[pi->ParmNum].name=0;
-
-		if(sw){
-			//配列パラメータ
-			if(pi->pParmInfo[pi->ParmNum].bByVal) SetError(29,NULL,cp);
-			pi->pParmInfo[pi->ParmNum].bArray=1;
-
-			if((temporary[i2-2]=='('&&temporary[i2-1]==')')||
-				(temporary[i2-2]=='['&&temporary[i2-1]==']')){
-				pi->pParmInfo[pi->ParmNum].SubScripts[0]=LONG_MAX;
-				pi->pParmInfo[pi->ParmNum].SubScripts[1]=-1;
-
-				temporary[i2-2]=0;
-			}
-			else{
-				GetArrange(temporary,temp2,pi->pParmInfo[pi->ParmNum].SubScripts);
-				lstrcpy(temporary,temp2);
-			}
-
-			i2=lstrlen(temporary);
-		}
-		else{
-			pi->pParmInfo[pi->ParmNum].bArray=0;
-			pi->pParmInfo[pi->ParmNum].SubScripts[0]=-1;
-		}
-
-		//型
-		if(buffer[i]==1&&buffer[i+1]==ESC_AS){
-			i+=2;
-
-			i2=0;
-			while(buffer[i]=='*'){
-				temporary[i2]=buffer[i];
-				i++;
-				i2++;
-			}
-			for(;;i++,i2++){
-				if(!IsVariableChar(buffer[i])){
-					temporary[i2]=0;
-					break;
-				}
-				temporary[i2]=buffer[i];
-			}
-
-			pi->pParmInfo[pi->ParmNum].type=
-				GetTypeFixed(temporary,&pi->pParmInfo[pi->ParmNum].u.index);
-			if(pi->pParmInfo[pi->ParmNum].type==-1){
-				SetError(3,temporary,cp);
-				pi->pParmInfo[pi->ParmNum].type=DEF_PTR_VOID;
-			}
-			if(pi->pParmInfo[pi->ParmNum].type==DEF_OBJECT){
-				if(pi->pParmInfo[pi->ParmNum].bByVal) SetError(28,temporary,cp);
-			}
-		}
-		else{
-			pi->pParmInfo[pi->ParmNum].type=GetTypeFromSimpleName(temporary);
-			SetError(-103,temporary,cp);
-		}
-
-		pi->ParmNum++;
-
-		if(buffer[i]==','){
-			i++;
-			continue;
-		}
-		else if(buffer[i]==')') continue;
-		else{
-			SetError(1,NULL,cp);
-			return 0;
-		}
-	}
-	i++;
-
-	//戻り値
-	if(dwProcType==ESC_FUNCTION){
-		if(buffer[i]==1&&buffer[i+1]==ESC_AS){
-			i+=2;
-			i2=0;
-			if(buffer[i]=='*') temporary[i2++]=buffer[i++];
-			for(;;i++,i2++){
-				if(!IsVariableChar(buffer[i])){
-					temporary[i2]=0;
-					break;
-				}
-				temporary[i2]=buffer[i];
-			}
-			pi->ReturnType=GetTypeFixed(temporary,&pi->u.ReturnIndex);
-			if(pi->ReturnType==DEF_NON) SetError(3,temporary,cp);
-		}
-		else pi->ReturnType=DEF_DOUBLE;
-	}
-	else pi->ReturnType=DEF_NON;
-
 	return ProcPtrInfoNum-1;
 }
 void DeleteProcPtrInfo(void){
-	extern PROCPTRINFO *pProcPtrInfo;
+	extern ProcPointer **ppProcPointer;
 	extern int ProcPtrInfoNum;
-	int i;
-
-	for(i=0;i<ProcPtrInfoNum;i++){
-		HeapDefaultFree(pProcPtrInfo[i].pParmInfo);
-	}
-
-	HeapDefaultFree(pProcPtrInfo);
-}
+
+	for(int i=0;i<ProcPtrInfoNum;i++){
+		delete ppProcPointer[i];
+	}
+
+	HeapDefaultFree(ppProcPointer);
+}
