Index: trunk/ab5.0/abdev/BasicCompiler_Common/src/Const.cpp
===================================================================
--- trunk/ab5.0/abdev/BasicCompiler_Common/src/Const.cpp	(revision 577)
+++ trunk/ab5.0/abdev/BasicCompiler_Common/src/Const.cpp	(revision 578)
@@ -86,79 +86,4 @@
 }
 
-
-bool ConstMacro::GetCalcBuffer( const char *parameterStr, char *dest ) const
-{
-	extern HANDLE hHeap;
-	int i2,i3,i4,num;
-	char temporary[VN_SIZE];
-	char *pParms[MAX_PARMS];
-	num=0;
-	i2=0;
-	while(1){
-		i2=GetOneParameter(parameterStr,i2,temporary);
-
-		pParms[num]=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
-		lstrcpy(pParms[num],temporary);
-
-		num++;
-		if(parameterStr[i2]=='\0') break;
-	}
-	if( num != this->GetParameters().size() ){
-		extern int cp;
-		for(i2=0;i2<num;i2++) HeapDefaultFree(pParms[i2]);
-		compiler.errorMessenger.Output(10,GetName().c_str(),cp);
-		lstrcpy(dest,"0");
-		return 1;
-	}
-
-	i2=0;
-	i4=0;
-	while(1){
-
-		//数式内の項を取得
-		for(i3=0;;i2++,i3++){
-			if(!IsVariableChar( this->GetExpression()[i2] )){
-				temporary[i3]=0;
-				break;
-			}
-			temporary[i3] = this->GetExpression()[i2];
-		}
-
-		//パラメータと照合する
-		for( i3=0; i3<(int)this->GetParameters().size(); i3++ ){
-			if( this->GetParameters()[i3] == temporary ) break;
-		}
-
-		if( i3 == (int)this->GetParameters().size() ){
-			//パラメータでないとき
-			lstrcpy(dest+i4,temporary);
-			i4+=lstrlen(temporary);
-		}
-		else{
-			//パラメータのとき
-			lstrcpy(dest+i4,pParms[i3]);
-			i4+=lstrlen(pParms[i3]);
-		}
-
-		//演算子をコピー
-		for(;;i2++,i4++){
-			if( this->GetExpression()[i2] == 1 ){
-				dest[i4++] = this->GetExpression()[i2++];
-				dest[i4] = this->GetExpression()[i2];
-				continue;
-			}
-			if(IsVariableTopChar( this->GetExpression()[i2] )) break;
-			dest[i4] = this->GetExpression()[i2];
-			if( this->GetExpression()[i2] == '\0' ) break;
-		}
-
-		if( this->GetExpression()[i2] == '\0' ) break;
-	}
-
-	for(i2=0;i2<num;i2++) HeapDefaultFree(pParms[i2]);
-
-	return 1;
-}
-
 // マクロ定数を追加するための関数
 void ConstMacros::Add( const NamespaceScopes &namespaceScopes, const std::string &name, const char *parameterStr )
Index: trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Const.cpp
===================================================================
--- trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Const.cpp	(revision 577)
+++ trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Const.cpp	(revision 578)
@@ -202,2 +202,76 @@
 	compiler.GetObjectModule().meta.GetGlobalConstMacros().Iterator_Init();
 }
+
+bool LexicalAnalyzer::ConstMacroToExpression( const ConstMacro &constMacro, const char *parameterStr, char *dest )
+{
+	extern HANDLE hHeap;
+	int i2,i3,i4,num;
+	char temporary[VN_SIZE];
+	char *pParms[MAX_PARMS];
+	num=0;
+	i2=0;
+	while(1){
+		i2=GetOneParameter(parameterStr,i2,temporary);
+
+		pParms[num]=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
+		lstrcpy(pParms[num],temporary);
+
+		num++;
+		if(parameterStr[i2]=='\0') break;
+	}
+	if( num != constMacro.GetParameters().size() ){
+		extern int cp;
+		for(i2=0;i2<num;i2++) HeapDefaultFree(pParms[i2]);
+		compiler.errorMessenger.Output(10,constMacro.GetName().c_str(),cp);
+		lstrcpy(dest,"0");
+		return true;
+	}
+
+	i2=0;
+	i4=0;
+	while(1){
+
+		//数式内の項を取得
+		for(i3=0;;i2++,i3++){
+			if(!IsVariableChar( constMacro.GetExpression()[i2] )){
+				temporary[i3]=0;
+				break;
+			}
+			temporary[i3] = constMacro.GetExpression()[i2];
+		}
+
+		//パラメータと照合する
+		for( i3=0; i3<(int)constMacro.GetParameters().size(); i3++ ){
+			if( constMacro.GetParameters()[i3] == temporary ) break;
+		}
+
+		if( i3 == (int)constMacro.GetParameters().size() ){
+			//パラメータでないとき
+			lstrcpy(dest+i4,temporary);
+			i4+=lstrlen(temporary);
+		}
+		else{
+			//パラメータのとき
+			lstrcpy(dest+i4,pParms[i3]);
+			i4+=lstrlen(pParms[i3]);
+		}
+
+		//演算子をコピー
+		for(;;i2++,i4++){
+			if( constMacro.GetExpression()[i2] == 1 ){
+				dest[i4++] = constMacro.GetExpression()[i2++];
+				dest[i4] = constMacro.GetExpression()[i2];
+				continue;
+			}
+			if(IsVariableTopChar( constMacro.GetExpression()[i2] )) break;
+			dest[i4] = constMacro.GetExpression()[i2];
+			if( constMacro.GetExpression()[i2] == '\0' ) break;
+		}
+
+		if( constMacro.GetExpression()[i2] == '\0' ) break;
+	}
+
+	for(i2=0;i2<num;i2++) HeapDefaultFree(pParms[i2]);
+
+	return true;
+}
