Index: BasicCompiler64/Compile_Func.cpp
===================================================================
--- BasicCompiler64/Compile_Func.cpp	(revision 73)
+++ BasicCompiler64/Compile_Func.cpp	(revision 75)
@@ -40,14 +40,11 @@
 }
 void Opcode_Func_Len( const char *Parameter ){
-	int type,TypeSize;
-	LONG_PTR lpIndex;
 	BOOL bArrayHead;
-
-	type=GetVarType(Parameter,&lpIndex,0);
 
 	const char *tempParm=Parameter;
 	char temporary[VN_SIZE];
 	char temp2[32];
-	if(type==-1){
+	Type type;
+	if( !GetVarType(Parameter,type,0) ){
 		sprintf(temporary,"_System_DummyStr2=%s",Parameter);
 		OpcodeCalc(temporary);
@@ -57,15 +54,13 @@
 
 		extern CClass *pobj_StringClass;
-		type=DEF_OBJECT;
-		lpIndex=(LONG_PTR)pobj_StringClass;
-	}
-
-	TYPEINFO TypeInfo={type,lpIndex};
-	if(IsStringObjectType(TypeInfo)){
+		type.SetType( DEF_OBJECT, pobj_StringClass );
+	}
+
+	if( type.IsStringObject() ){
 		//Stringオブジェクトの場合
 		sprintf(temporary,"%s.Length",tempParm);
 
 		int reg=REG_RAX;
-		NumOpe(&reg,temporary,0,0,NULL,NULL);
+		NumOpe(&reg,temporary,Type(),Type(),NULL);
 		return;
 	}
@@ -74,9 +69,9 @@
 	int SubScripts[MAX_ARRAYDIM];
 	RELATIVE_VAR RelativeVar;
-	if(!GetVarOffsetReadOnly(tempParm,&type,&RelativeVar,&lpIndex,SubScripts)) return;
-
-
-	if(type&FLAG_PTR){
-		type&=~FLAG_PTR;
+	if(!GetVarOffsetReadOnly(tempParm,&RelativeVar,type,SubScripts)) return;
+
+
+	if(type.GetBasicType()&FLAG_PTR){
+		type.SetBasicType( type.GetBasicType() & ( ~FLAG_PTR ) );
 
 		bArrayHead=1;
@@ -84,10 +79,10 @@
 	else bArrayHead=0;
 
-	TypeSize=GetTypeSize(type,lpIndex);
-
-	if(bArrayHead) TypeSize*=JumpSubScripts(SubScripts);
+	int typeSize = type.GetSize();
+
+	if(bArrayHead) typeSize*=JumpSubScripts(SubScripts);
 
 	//mov rax,TypeSize
-	op_mov_RV(sizeof(_int64),REG_RAX,TypeSize);
+	op_mov_RV(sizeof(_int64),REG_RAX,typeSize);
 
 	return;
@@ -95,5 +90,5 @@
 void Opcode_Func_AddressOf( const char *name ){
 	extern int cp;
-	SubInfo *psi;
+	UserProc *pUserProc;
 
 	extern LONG_PTR ProcPtr_BaseIndex;
@@ -101,5 +96,5 @@
 		//左辺の型にのっとり、オーバーロードを解決
 
-		std::vector<SubInfo *> subs;
+		std::vector<UserProc *> subs;
 		GetOverloadSubHash( name, subs );
 		if( subs.size() == 0 ){
@@ -109,8 +104,8 @@
 
 		//オーバーロードを解決
-		extern PROCPTRINFO *pProcPtrInfo;
-		psi=OverloadSolution(name,subs,pProcPtrInfo[ProcPtr_BaseIndex].pParmInfo,pProcPtrInfo[ProcPtr_BaseIndex].ParmNum,NULL);
-
-		if(!psi){
+		extern ProcPointer **ppProcPointer;
+		pUserProc=OverloadSolution(name,subs,ppProcPointer[ProcPtr_BaseIndex]->Params(), Type() );
+
+		if(!pUserProc){
 			SetError(27,name,cp);
 			return;
@@ -118,6 +113,6 @@
 	}
 	else{
-		psi=GetSubHash(name);
-		if(!psi){
+		pUserProc=GetSubHash(name);
+		if(!pUserProc){
 			SetError(27,name,cp);
 			return;
@@ -125,6 +120,5 @@
 	}
 
-
-	if(psi->bVirtual){
+	if( pUserProc->IsVirtual() ){
 		///////////////////////////////
 		// 仮想関数の場合
@@ -142,12 +136,12 @@
 			else{
 				RELATIVE_VAR RelativeVar;
-				int type;
-				if(!GetVarOffsetReadOnly(ObjectName,&type,&RelativeVar,(LONG_PTR *)&pobj_c)) return;
+				Type type;
+				if(!GetVarOffsetReadOnly(ObjectName,&RelativeVar,type)) return;
 				SetVarPtrToReg(REG_RCX,&RelativeVar);
 
 				//参照タイプが整合しているかをチェック
-				if(type!=RefType) SetError(104,ObjectName,cp);
-
-				if(type==DEF_PTR_OBJECT){
+				if(type.GetBasicType()!=RefType) SetError(104,ObjectName,cp);
+
+				if(type.IsObjectPtr()){
 					//mov rcx,qword ptr[rcx]
 					op_mov_RM(sizeof(_int64),REG_RCX,REG_RCX,0,MOD_BASE);
@@ -172,5 +166,5 @@
 		op_mov_RM(sizeof(_int64),REG_R11,REG_RCX,0,MOD_BASE);
 
-		int i2 = pobj_c->GetFuncNumInVtbl( psi );
+		int i2 = pobj_c->GetFuncNumInVtbl( pUserProc );
 
 		//mov rax,qword ptr[r11+func_index]
@@ -188,9 +182,9 @@
 		op_mov_RV(sizeof(_int64),REG_RAX,0);
 		obp-=sizeof(long);
-		pobj_SubAddrSchedule->add(psi,0);
+		pobj_SubAddrSchedule->add(pUserProc,0);
 		obp+=sizeof(long);
 	}
 
-	psi->bUse=1;
+	pUserProc->Using();
 }
 void Opcode_Func_SizeOf( const char *Parameter ){
@@ -210,13 +204,24 @@
 	op_mov_RV(sizeof(_int64),REG_RAX,size);
 }
-void Opcode_Func_VarPtr( const char *Parameter, TYPEINFO &ReturnTypeInfo ){
+void Opcode_Func_VarPtr( const char *Parameter, Type &resultType, bool isCallOn ){
+	if( isCallOn == false ){
+		// 戻り値の型を取得するだけ
+
+		//変数のアドレスを取得
+		if(!GetVarType( Parameter, resultType, true )) return;
+
+		resultType.PtrLevelUp();
+
+		return;
+	}
+
 	RELATIVE_VAR RelativeVar;
 
 	//変数のアドレスを取得
-	if(!GetVarOffsetReadOnly( Parameter, &ReturnTypeInfo.type, &RelativeVar, &ReturnTypeInfo.u.lpIndex )) return;
-
-	int beforeType = ReturnTypeInfo.type;
-
-	PTR_LEVEL_UP( ReturnTypeInfo.type );
+	if(!GetVarOffsetReadOnly( Parameter, &RelativeVar, resultType )) return;
+
+	int beforeType = resultType.GetBasicType();
+
+	resultType.PtrLevelUp();
 
 	SetVarPtrToReg(REG_RAX,&RelativeVar);
@@ -230,10 +235,10 @@
 }
 void Opcode_Func_GetPtrData( const char *Parameter, const int type ){
-	int i2;
-
 	int reg=REG_RAX;
-	i2=NumOpe(&reg,Parameter,0,0,0);
-	if(!IsWholeNumberType(i2)){
-		extern int cp;
+	Type tempType;
+	if( !NumOpe(&reg,Parameter,Type(),tempType) ){
+		return;
+	}
+	if(!tempType.IsWhole()){
 		SetError(11,Parameter,cp);
 		return;
@@ -254,46 +259,49 @@
 }
 
-void Opcode_CallFunc( const char *Parameter, const int FuncNum, TYPEINFO &ReturnTypeInfo ){
+bool Opcode_CallFunc( const char *Parameter, const int FuncNum, Type &resultType, bool isCallOn ){
 	switch(FuncNum){
 		case FUNC_LEN:
-			Opcode_Func_Len(Parameter);
-			ReturnTypeInfo.type = DEF_LONG;
+			if( isCallOn ) Opcode_Func_Len(Parameter);
+			resultType.SetBasicType( DEF_LONG );
 			break;
 		case FUNC_ADDRESSOF:
-			Opcode_Func_AddressOf(Parameter);
-			ReturnTypeInfo.type = DEF_PTR_VOID;
+			if( isCallOn ) Opcode_Func_AddressOf(Parameter);
+			resultType.SetBasicType( DEF_PTR_VOID );
 			break;
 		case FUNC_SIZEOF:
-			Opcode_Func_SizeOf(Parameter);
-			ReturnTypeInfo.type = DEF_LONG;
+			if( isCallOn ) Opcode_Func_SizeOf(Parameter);
+			resultType.SetBasicType( DEF_LONG );
 			break;
 		case FUNC_VARPTR:
-			Opcode_Func_VarPtr( Parameter, ReturnTypeInfo );
+			Opcode_Func_VarPtr( Parameter, resultType, isCallOn );
 			break;
 
 		case FUNC_GETDOUBLE:
-			Opcode_Func_GetPtrData(Parameter,DEF_DOUBLE);
-			ReturnTypeInfo.type = DEF_DOUBLE;
+			if( isCallOn ) Opcode_Func_GetPtrData(Parameter,DEF_DOUBLE);
+			resultType.SetBasicType( DEF_DOUBLE );
 			break;
 		case FUNC_GETSINGLE:
-			Opcode_Func_GetPtrData(Parameter,DEF_SINGLE);
-			ReturnTypeInfo.type = DEF_SINGLE;
+			if( isCallOn ) Opcode_Func_GetPtrData(Parameter,DEF_SINGLE);
+			resultType.SetBasicType( DEF_SINGLE );
 			break;
 		case FUNC_GETQWORD:
-			Opcode_Func_GetPtrData(Parameter,DEF_QWORD);
-			ReturnTypeInfo.type = DEF_QWORD;
+			if( isCallOn ) Opcode_Func_GetPtrData(Parameter,DEF_QWORD);
+			resultType.SetBasicType( DEF_QWORD );
 			break;
 		case FUNC_GETDWORD:
-			Opcode_Func_GetPtrData(Parameter,DEF_DWORD);
-			ReturnTypeInfo.type = DEF_DWORD;
+			if( isCallOn ) Opcode_Func_GetPtrData(Parameter,DEF_DWORD);
+			resultType.SetBasicType( DEF_DWORD );
 			break;
 		case FUNC_GETWORD:
-			Opcode_Func_GetPtrData(Parameter,DEF_WORD);
-			ReturnTypeInfo.type = DEF_WORD;
+			if( isCallOn ) Opcode_Func_GetPtrData(Parameter,DEF_WORD);
+			resultType.SetBasicType( DEF_WORD );
 			break;
 		case FUNC_GETBYTE:
-			Opcode_Func_GetPtrData(Parameter,DEF_BYTE);
-			ReturnTypeInfo.type = DEF_BYTE;
-			break;
-	}
-}
+			if( isCallOn ) Opcode_Func_GetPtrData(Parameter,DEF_BYTE);
+			resultType.SetBasicType( DEF_BYTE );
+			break;
+		default:
+			return false;
+	}
+	return true;
+}
