Index: trunk/ab5.0/abdev/BasicCompiler_Common/RSrcSection.cpp
===================================================================
--- trunk/ab5.0/abdev/BasicCompiler_Common/RSrcSection.cpp	(revision 467)
+++ trunk/ab5.0/abdev/BasicCompiler_Common/RSrcSection.cpp	(revision 622)
@@ -61,6 +61,4 @@
 
 	//カーソルリソース
-	extern RESOURCEDATAINFO *pCursorResourceInfo;
-	extern int CursorResourceNum;
 	int CursorNum;
 	CURSORDIR *pCursorDir;
@@ -69,11 +67,5 @@
 	CursorNum=0;
 
-	//ビットマップリソース
-	extern RESOURCEDATAINFO *pBitmapResourceInfo;
-	extern int BitmapResourceNum;
-
 	//アイコンリソース
-	extern RESOURCEDATAINFO *pIconResourceInfo;
-	extern int IconResourceNum;
 	int IconNum;
 	ICONDIR *pIconDir;
@@ -82,8 +74,4 @@
 	IconNum=0;
 
-	//XPManifestリソース
-	extern char szManifestPath[MAX_PATH];
-	extern int XPManiResourceNum;
-
 	BufSize=8192*2;
 	buffer=(char *)HeapAlloc(hHeap,0,BufSize);
@@ -97,16 +85,19 @@
 	*pLen=0;
 
-	if(CursorResourceNum==0&&
-		BitmapResourceNum==0&&
-		IconResourceNum==0&&
-		XPManiResourceNum==0) return buffer;
+	if( compiler.resourceManager.cursorResources.empty()
+		&& compiler.resourceManager.bitmapResources.empty()
+		&& compiler.resourceManager.iconResources.empty()
+		&& compiler.resourceManager.manifestFilePath.empty() )
+	{
+		return buffer;
+	}
 
 	sw=0;
 
 	//カーソルの枚数を計算（CursorNumに格納）
-	for(i3=0;i3<CursorResourceNum;i3++){
-		hFile=CreateFile(pCursorResourceInfo[i3].FileName,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
+	for(i3=0;i3<compiler.resourceManager.cursorResources.size();i3++){
+		hFile=CreateFile(compiler.resourceManager.cursorResources[i3].filepath.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
 		if(hFile==INVALID_HANDLE_VALUE){
-			compiler.errorMessenger.Output(23,pCursorResourceInfo[i3].FileName,-1);
+			compiler.errorMessenger.Output(23,compiler.resourceManager.cursorResources[i3].filepath.c_str(),-1);
 			sw=1;
 			continue;
@@ -124,8 +115,8 @@
 
 	//ビットマップのファイルの有無を確認
-	for(i3=0;i3<BitmapResourceNum;i3++){
-		hFile=CreateFile(pBitmapResourceInfo[i3].FileName,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
+	for(i3=0;i3<compiler.resourceManager.bitmapResources.size();i3++){
+		hFile=CreateFile(compiler.resourceManager.bitmapResources[i3].filepath.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
 		if(hFile==INVALID_HANDLE_VALUE){
-			compiler.errorMessenger.Output(23,pBitmapResourceInfo[i3].FileName,-1);
+			compiler.errorMessenger.Output(23,compiler.resourceManager.bitmapResources[i3].filepath.c_str(),-1);
 			sw=1;
 			continue;
@@ -135,8 +126,8 @@
 
 	//アイコンの枚数を計算（IconNumに格納）
-	for(i3=0;i3<IconResourceNum;i3++){
-		hFile=CreateFile(pIconResourceInfo[i3].FileName,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
+	for(i3=0;i3<compiler.resourceManager.iconResources.size();i3++){
+		hFile=CreateFile(compiler.resourceManager.iconResources[i3].filepath.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
 		if(hFile==INVALID_HANDLE_VALUE){
-			compiler.errorMessenger.Output(23,pIconResourceInfo[i3].FileName,-1);
+			compiler.errorMessenger.Output(23,compiler.resourceManager.iconResources[i3].filepath.c_str(),-1);
 			sw=1;
 			continue;
@@ -161,8 +152,8 @@
 	/////////////////////////
 	TypeNum=0;
-	if(CursorResourceNum) TypeNum+=2;
-	if(BitmapResourceNum) TypeNum++;
-	if(IconResourceNum) TypeNum+=2;
-	if(XPManiResourceNum) TypeNum++;
+	if( !compiler.resourceManager.cursorResources.empty() ) TypeNum+=2;
+	if( !compiler.resourceManager.bitmapResources.empty() ) TypeNum++;
+	if( !compiler.resourceManager.iconResources.empty() ) TypeNum+=2;
+	if( !compiler.resourceManager.manifestFilePath.empty() ) TypeNum++;
 
 	NextBase=sizeof(IMAGE_RESOURCE_DIRECTORY)+
@@ -193,5 +184,5 @@
 				sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY)*CursorNum;
 	}
-	if(BitmapResourceNum){
+	if( !compiler.resourceManager.bitmapResources.empty() ){
 		//RT_BITMAP
 		ImgDirEntry.Name=(DWORD)(LONG_PTR)RT_BITMAP;
@@ -202,5 +193,5 @@
 		//2階層のサイズ
 		i6+=	sizeof(IMAGE_RESOURCE_DIRECTORY)+
-				sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY)*BitmapResourceNum;
+				sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY) * compiler.resourceManager.bitmapResources.size();
 	}
 	if(IconNum){
@@ -215,5 +206,6 @@
 				sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY)*IconNum;
 	}
-	if(CursorResourceNum){
+	if( !compiler.resourceManager.cursorResources.empty() )
+	{
 		//RT_GROUP_CURSOR
 		ImgDirEntry.Name=(DWORD)(LONG_PTR)RT_GROUP_CURSOR;
@@ -226,5 +218,6 @@
 				sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY)*CursorNum;
 	}
-	if(IconResourceNum){
+	if( !compiler.resourceManager.iconResources.empty() )
+	{
 		//RT_GROUP_ICON
 		ImgDirEntry.Name=(DWORD)(LONG_PTR)RT_GROUP_ICON;
@@ -235,7 +228,8 @@
 		//2階層のサイズ
 		i6+=	sizeof(IMAGE_RESOURCE_DIRECTORY)+
-				sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY)*IconResourceNum;
-	}
-	if(XPManiResourceNum){
+				sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY) * compiler.resourceManager.iconResources.size();
+	}
+	if( !compiler.resourceManager.manifestFilePath.empty() )
+	{
 		//RT_MANIFEST
 		ImgDirEntry.Name=(DWORD)(LONG_PTR)RT_MANIFEST;
@@ -246,5 +240,5 @@
 		//2階層のサイズ
 		i6+=	sizeof(IMAGE_RESOURCE_DIRECTORY)+
-				sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY)*XPManiResourceNum;
+				sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY) * 1/*XPManiResourceNum*/ ;
 	}
 
@@ -279,5 +273,5 @@
 			sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY))*CursorNum;
 	}
-	if(BitmapResourceNum){
+	if( !compiler.resourceManager.bitmapResources.empty() ){
 		//RT_BITMAP
 		ImgResDir.Characteristics=0;
@@ -286,10 +280,15 @@
 		ImgResDir.MinorVersion=0;
 		ImgResDir.NumberOfNamedEntries=0;
-		ImgResDir.NumberOfIdEntries=BitmapResourceNum;
+		ImgResDir.NumberOfIdEntries = compiler.resourceManager.bitmapResources.size();
 		memcpy(buffer+i2,&ImgResDir,sizeof(IMAGE_RESOURCE_DIRECTORY));
 		i2+=sizeof(IMAGE_RESOURCE_DIRECTORY);
 
-		for(i3=0;i3<BitmapResourceNum;i3++){
-			ImgDirEntry.Name=pBitmapResourceInfo[i3].dwId;
+		for(i3=0;i3<compiler.resourceManager.bitmapResources.size();i3++)
+		{
+			ImgDirEntry.Name = compiler.GetObjectModule().meta.GetGlobalConsts().GetWholeData(
+				ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol(
+					compiler.resourceManager.bitmapResources[i3].idName
+				)
+			);
 			ImgDirEntry.OffsetToData=(NextBase+i6+
 				(sizeof(IMAGE_RESOURCE_DIRECTORY)+
@@ -301,5 +300,5 @@
 
 		i6+=(sizeof(IMAGE_RESOURCE_DIRECTORY)+
-			sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY))*BitmapResourceNum;
+			sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY)) * compiler.resourceManager.bitmapResources.size();
 	}
 	if(IconNum){
@@ -328,5 +327,6 @@
 			sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY))*IconNum;
 	}
-	if(CursorResourceNum){
+	if( !compiler.resourceManager.cursorResources.empty() )
+	{
 		//RT_GROUP_CURSOR
 		ImgResDir.Characteristics=0;
@@ -335,10 +335,14 @@
 		ImgResDir.MinorVersion=0;
 		ImgResDir.NumberOfNamedEntries=0;
-		ImgResDir.NumberOfIdEntries=CursorResourceNum;
+		ImgResDir.NumberOfIdEntries = compiler.resourceManager.cursorResources.size();
 		memcpy(buffer+i2,&ImgResDir,sizeof(IMAGE_RESOURCE_DIRECTORY));
 		i2+=sizeof(IMAGE_RESOURCE_DIRECTORY);
 
-		for(i3=0;i3<CursorResourceNum;i3++){
-			ImgDirEntry.Name=pCursorResourceInfo[i3].dwId;
+		for(i3=0;i3<compiler.resourceManager.cursorResources.size();i3++){
+			ImgDirEntry.Name = compiler.GetObjectModule().meta.GetGlobalConsts().GetWholeData(
+				ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol(
+					compiler.resourceManager.cursorResources[i3].idName
+				)
+			);
 			ImgDirEntry.OffsetToData=(NextBase+i6+
 				(sizeof(IMAGE_RESOURCE_DIRECTORY)+
@@ -351,7 +355,8 @@
 		//3階層のサイズ
 		i6+=(sizeof(IMAGE_RESOURCE_DIRECTORY)+
-			sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY))*CursorResourceNum;
-	}
-	if(IconResourceNum){
+			sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY)) * compiler.resourceManager.cursorResources.size();
+	}
+	if( !compiler.resourceManager.iconResources.empty() )
+	{
 		//RT_GROUP_ICON
 		ImgResDir.Characteristics=0;
@@ -360,10 +365,14 @@
 		ImgResDir.MinorVersion=0;
 		ImgResDir.NumberOfNamedEntries=0;
-		ImgResDir.NumberOfIdEntries=IconResourceNum;
+		ImgResDir.NumberOfIdEntries = compiler.resourceManager.iconResources.size();
 		memcpy(buffer+i2,&ImgResDir,sizeof(IMAGE_RESOURCE_DIRECTORY));
 		i2+=sizeof(IMAGE_RESOURCE_DIRECTORY);
 
-		for(i3=0;i3<IconResourceNum;i3++){
-			ImgDirEntry.Name=pIconResourceInfo[i3].dwId;
+		for(i3=0;i3<compiler.resourceManager.iconResources.size();i3++){
+			ImgDirEntry.Name = compiler.GetObjectModule().meta.GetGlobalConsts().GetWholeData(
+				ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol(
+					compiler.resourceManager.iconResources[i3].idName
+				)
+			);
 			ImgDirEntry.OffsetToData=(NextBase+i6+
 				(sizeof(IMAGE_RESOURCE_DIRECTORY)+
@@ -376,7 +385,8 @@
 		//3階層のサイズ
 		i6+=(sizeof(IMAGE_RESOURCE_DIRECTORY)+
-			sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY))*IconResourceNum;
-	}
-	if(XPManiResourceNum){
+			sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY)) * compiler.resourceManager.iconResources.size();
+	}
+	if( !compiler.resourceManager.manifestFilePath.empty() )
+	{
 		//RT_MANIFEST
 		ImgResDir.Characteristics=0;
@@ -385,9 +395,10 @@
 		ImgResDir.MinorVersion=0;
 		ImgResDir.NumberOfNamedEntries=0;
-		ImgResDir.NumberOfIdEntries=XPManiResourceNum;
+		ImgResDir.NumberOfIdEntries = 1 /*XPManiResourceNum*/ ;
 		memcpy(buffer+i2,&ImgResDir,sizeof(IMAGE_RESOURCE_DIRECTORY));
 		i2+=sizeof(IMAGE_RESOURCE_DIRECTORY);
 
-		for(i3=0;i3<XPManiResourceNum;i3++){
+		i3 = 0;
+		{
 			ImgDirEntry.Name=i3+1;
 			ImgDirEntry.OffsetToData=(NextBase+i6+
@@ -400,5 +411,5 @@
 
 		i6+=(sizeof(IMAGE_RESOURCE_DIRECTORY)+
-			sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY))*XPManiResourceNum;
+			sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY)) * 1 /*XPManiResourceNum*/ ;
 	}
 
@@ -434,7 +445,7 @@
 		i6+=sizeof(IMAGE_RESOURCE_DATA_ENTRY)*CursorNum;
 	}
-	if(BitmapResourceNum){
+	if( !compiler.resourceManager.bitmapResources.empty() ){
 		//RT_BITMAP
-		for(i3=0;i3<BitmapResourceNum;i3++){
+		for(i3=0;i3<compiler.resourceManager.bitmapResources.size();i3++){
 			ImgResDir.Characteristics=0;
 			ImgResDir.TimeDateStamp=0;
@@ -453,5 +464,5 @@
 		}
 
-		i6+=sizeof(IMAGE_RESOURCE_DATA_ENTRY)*BitmapResourceNum;
+		i6+=sizeof(IMAGE_RESOURCE_DATA_ENTRY) * compiler.resourceManager.bitmapResources.size();
 	}
 	if(IconNum){
@@ -476,7 +487,8 @@
 		i6+=sizeof(IMAGE_RESOURCE_DATA_ENTRY)*IconNum;
 	}
-	if(CursorResourceNum){
+	if( !compiler.resourceManager.cursorResources.empty() )
+	{
 		//RT_GROUP_CURSOR
-		for(i3=0;i3<CursorResourceNum;i3++){
+		for(i3=0;i3<compiler.resourceManager.cursorResources.size();i3++){
 			ImgResDir.Characteristics=0;
 			ImgResDir.TimeDateStamp=0;
@@ -495,9 +507,10 @@
 		}
 
-		i6+=sizeof(IMAGE_RESOURCE_DATA_ENTRY)*CursorResourceNum;
-	}
-	if(IconResourceNum){
+		i6+=sizeof(IMAGE_RESOURCE_DATA_ENTRY) * compiler.resourceManager.cursorResources.size();
+	}
+	if( !compiler.resourceManager.iconResources.empty() )
+	{
 		//RT_GROUP_ICON
-		for(i3=0;i3<IconResourceNum;i3++){
+		for(i3=0;i3<compiler.resourceManager.iconResources.size();i3++){
 			ImgResDir.Characteristics=0;
 			ImgResDir.TimeDateStamp=0;
@@ -516,9 +529,10 @@
 		}
 
-		i6+=sizeof(IMAGE_RESOURCE_DATA_ENTRY)*IconResourceNum;
-	}
-	if(XPManiResourceNum){
+		i6+=sizeof(IMAGE_RESOURCE_DATA_ENTRY)*compiler.resourceManager.iconResources.size();
+	}
+	if( !compiler.resourceManager.manifestFilePath.empty() ){
 		//RT_MANIFEST
-		for(i3=0;i3<XPManiResourceNum;i3++){
+		i3 = 0;
+		{
 			ImgResDir.Characteristics=0;
 			ImgResDir.TimeDateStamp=0;
@@ -537,5 +551,5 @@
 		}
 
-		i6+=sizeof(IMAGE_RESOURCE_DATA_ENTRY)*XPManiResourceNum;
+		i6+=sizeof(IMAGE_RESOURCE_DATA_ENTRY) * 1 /*XPManiResourceNum*/ ;
 	}
 
@@ -576,5 +590,5 @@
 	//RT_BITMAP
 	BitmapEntryBase=DataEntryScheduleNum;
-	for(i3=0;i3<BitmapResourceNum;i3++){
+	for(i3=0;i3<compiler.resourceManager.bitmapResources.size();i3++){
 		dwDataEntrySchedule[DataEntryScheduleNum]=i2;
 		DataEntryScheduleNum++;
@@ -594,5 +608,5 @@
 	//RT_GROUP_CURSOR
 	CursorGroupEntryBase=DataEntryScheduleNum;
-	for(i3=0;i3<CursorResourceNum;i3++){
+	for(i3=0;i3<compiler.resourceManager.cursorResources.size();i3++){
 		dwDataEntrySchedule[DataEntryScheduleNum]=i2;
 		DataEntryScheduleNum++;
@@ -603,5 +617,5 @@
 	//RT_GROUP_ICON
 	IconGroupEntryBase=DataEntryScheduleNum;
-	for(i3=0;i3<IconResourceNum;i3++){
+	for(i3=0;i3<compiler.resourceManager.iconResources.size();i3++){
 		dwDataEntrySchedule[DataEntryScheduleNum]=i2;
 		DataEntryScheduleNum++;
@@ -613,5 +627,6 @@
 	int XPManiEntryBase;
 	XPManiEntryBase=DataEntryScheduleNum;
-	for(i3=0;i3<XPManiResourceNum;i3++){
+	i3 = 0;
+	{
 		dwDataEntrySchedule[DataEntryScheduleNum]=i2;
 		DataEntryScheduleNum++;
@@ -642,8 +657,8 @@
 
 	//カーソルリソース
-	for(i3=0,i6=0;i3<CursorResourceNum;i3++){
-		hFile=CreateFile(pCursorResourceInfo[i3].FileName,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
+	for(i3=0,i6=0;i3<compiler.resourceManager.cursorResources.size();i3++){
+		hFile=CreateFile(compiler.resourceManager.cursorResources[i3].filepath.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
 		if(hFile==INVALID_HANDLE_VALUE){
-			compiler.errorMessenger.Output(23,pCursorResourceInfo[i3].FileName,-1);
+			compiler.errorMessenger.Output(23,compiler.resourceManager.cursorResources[i3].filepath.c_str(),-1);
 			return buffer;
 		}
@@ -722,8 +737,8 @@
 
 	//ビットマップリソース
-	for(i3=0;i3<BitmapResourceNum;i3++){
-		hFile=CreateFile(pBitmapResourceInfo[i3].FileName,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
+	for(i3=0;i3<compiler.resourceManager.bitmapResources.size();i3++){
+		hFile=CreateFile(compiler.resourceManager.bitmapResources[i3].filepath.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
 		if(hFile==INVALID_HANDLE_VALUE){
-			compiler.errorMessenger.Output(23,pBitmapResourceInfo[i3].FileName,-1);
+			compiler.errorMessenger.Output(23,compiler.resourceManager.bitmapResources[i3].filepath.c_str(),-1);
 			return buffer;
 		}
@@ -750,8 +765,8 @@
 
 	//アイコンリソース
-	for(i3=0,i6=0;i3<IconResourceNum;i3++){
-		hFile=CreateFile(pIconResourceInfo[i3].FileName,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
+	for(i3=0,i6=0;i3<compiler.resourceManager.iconResources.size();i3++){
+		hFile=CreateFile(compiler.resourceManager.iconResources[i3].filepath.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
 		if(hFile==INVALID_HANDLE_VALUE){
-			compiler.errorMessenger.Output(23,pIconResourceInfo[i3].FileName,-1);
+			compiler.errorMessenger.Output(23,compiler.resourceManager.iconResources[i3].filepath.c_str(),-1);
 			return buffer;
 		}
@@ -831,13 +846,10 @@
 
 	//XPManifestリソース
-	for(i3=0;i3<XPManiResourceNum;i3++){
-		extern char BasicCurDir[MAX_PATH];
-		extern char szManifestPath[MAX_PATH];
-		char temp2[MAX_PATH];
-		lstrcpy(temp2,szManifestPath);
-		GetFullPath(temp2,BasicCurDir);
-		hFile=CreateFile(temp2,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
+	i3 = 0;
+	if( !compiler.resourceManager.manifestFilePath.empty() )
+	{
+		hFile=CreateFile(compiler.resourceManager.manifestFilePath.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
 		if(hFile==INVALID_HANDLE_VALUE){
-			compiler.errorMessenger.Output(59,temp2,-1);
+			compiler.errorMessenger.Output(59,compiler.resourceManager.manifestFilePath.c_str(),-1);
 			return buffer;
 		}
@@ -857,4 +869,5 @@
 		//アプリケーション名をセット
 		char szAppliName[MAX_PATH];
+		char temp2[MAX_PATH];
 		_splitpath( program.GetOutputFilePath().c_str(),NULL,NULL,szAppliName,temp2);
 		lstrcat(szAppliName,temp2);
