Index: trunk/abdev/BasicCompiler32/Compile_ProcOp.cpp
===================================================================
--- trunk/abdev/BasicCompiler32/Compile_ProcOp.cpp	(revision 275)
+++ trunk/abdev/BasicCompiler32/Compile_ProcOp.cpp	(revision 276)
@@ -120,5 +120,5 @@
 		};
 
-		compiler.codeGenerator.PutOld( NativeCode( (const char *)Buffer_allrem, 178, false ) );
+		compiler.codeGenerator.PutOld( NativeCode( (const char *)Buffer_allrem, 178 ) );
 	}
 	else if( userProc.GetName() == "_aullrem" ){
@@ -136,5 +136,5 @@
 		};
 
-		compiler.codeGenerator.PutOld( NativeCode( (const char *)Buffer_aullrem, 117, false ) );
+		compiler.codeGenerator.PutOld( NativeCode( (const char *)Buffer_aullrem, 117 ) );
 	}
 	else if( userProc.GetName() == "_allmul" ){
@@ -144,5 +144,5 @@
 		};
 
-		compiler.codeGenerator.PutOld( NativeCode( (const char *)Buffer_allmul, 52, false ) );
+		compiler.codeGenerator.PutOld( NativeCode( (const char *)Buffer_allmul, 52 ) );
 	}
 	else if( userProc.GetName() == "_alldiv" ){
@@ -152,5 +152,5 @@
 		};
 
-		compiler.codeGenerator.PutOld( NativeCode( (const char *)Buffer_alldiv, 170, false ) );
+		compiler.codeGenerator.PutOld( NativeCode( (const char *)Buffer_alldiv, 170 ) );
 	}
 	else if( userProc.GetName() == "_aulldiv" ){
@@ -167,5 +167,5 @@
 		};
 
-		compiler.codeGenerator.PutOld( NativeCode( (const char *)Buffer_aulldiv, 104, false ) );
+		compiler.codeGenerator.PutOld( NativeCode( (const char *)Buffer_aulldiv, 104 ) );
 	}
 	else if( userProc.GetName() == "_allshl" ){
@@ -175,5 +175,5 @@
 		};
 
-		compiler.codeGenerator.PutOld( NativeCode( (const char *)Buffer_allshl, 31, false ) );
+		compiler.codeGenerator.PutOld( NativeCode( (const char *)Buffer_allshl, 31 ) );
 	}
 	else if( userProc.GetName() == "_allshr" ){
@@ -183,5 +183,5 @@
 		};
 
-		compiler.codeGenerator.PutOld( NativeCode( (const char *)Buffer_allshr, 33, false ) );
+		compiler.codeGenerator.PutOld( NativeCode( (const char *)Buffer_allshr, 33 ) );
 	}
 	else if( userProc.GetName() == "_aullshr" ){
@@ -207,5 +207,5 @@
 		};
 
-		compiler.codeGenerator.PutOld( NativeCode( (const char *)Buffer_aullshr, 31, false ) );
+		compiler.codeGenerator.PutOld( NativeCode( (const char *)Buffer_aullshr, 31 ) );
 	}
 	else{
@@ -262,6 +262,9 @@
 	else bDebugSupportProc=0;
 
-	extern int obp;
-	pUserProc->_beginOpAddressOld = obp;
+	if( pUserProc->GetCodeSize() != 0 )
+	{
+		// 既にコード生成が行われている場合はエラー
+		SetError();
+	}
 
 	//コンパイル中の関数が属するクラス
@@ -292,6 +295,4 @@
 
 		SystemProc(*pUserProc);
-
-		pUserProc->_endOpAddressOld = obp;
 		return;
 	}
@@ -399,5 +400,4 @@
 	//プロシージャ抜け出しスケジュール（Exit Sub/Function）
 	compiler.codeGenerator.exitSubCodePositions.clear();
-	compiler.codeGenerator._exitSubCodePositions_ObpOld.clear();
 
 	//ラベル管理オブジェクトを初期化
@@ -727,7 +727,4 @@
 
 
-	pUserProc->_endOpAddressOld = obp;
-
-
 	//重複エラー情報管理のメモリを解放
 	for(i3=0;i3<SynonymErrorNum;i3++) HeapDefaultFree(SynonymErrorWords[i3]);
Index: trunk/abdev/BasicCompiler32/Compile_Statement.cpp
===================================================================
--- trunk/abdev/BasicCompiler32/Compile_Statement.cpp	(revision 275)
+++ trunk/abdev/BasicCompiler32/Compile_Statement.cpp	(revision 276)
@@ -240,6 +240,8 @@
 
 	//レキシカルスコープをレベルアップ
-	extern int obp;
-	compiler.codeGenerator.lexicalScopes.Start( obp, LexicalScope::SCOPE_TYPE_IF );
+	compiler.codeGenerator.lexicalScopes.Start(
+		compiler.codeGenerator.GetNativeCodeSize(),
+		LexicalScope::SCOPE_TYPE_IF
+	);
 
 	i2=CompileBuffer(ESC_ENDIF,0);
@@ -263,5 +265,8 @@
 
 		//レキシカルスコープをレベルアップ
-		compiler.codeGenerator.lexicalScopes.Start( obp, LexicalScope::SCOPE_TYPE_IF );
+		compiler.codeGenerator.lexicalScopes.Start(
+			compiler.codeGenerator.GetNativeCodeSize(),
+			LexicalScope::SCOPE_TYPE_IF
+		);
 
 		CompileBuffer(ESC_ENDIF,0);
@@ -320,6 +325,10 @@
 		{
 			//jmp ...
-			extern int obp;
-			compiler.codeGenerator.op_jmp( i-obp, sizeof(long), false, true );
+			compiler.codeGenerator.op_jmp(
+				i-compiler.codeGenerator.GetNativeCodeSize(),
+				sizeof(long),
+				false,
+				true
+			);
 		}
 	}
@@ -336,6 +345,10 @@
 		{
 			//jmp ...
-			extern int obp;
-			compiler.codeGenerator.op_jmp( i-obp, sizeof(long), false, true );
+			compiler.codeGenerator.op_jmp(
+				i-compiler.codeGenerator.GetNativeCodeSize(),
+				sizeof(long),
+				false,
+				true
+			);
 		}
 	}
@@ -445,6 +458,5 @@
 
 	//レキシカルスコープをレベルアップ
-	extern int obp;
-	compiler.codeGenerator.lexicalScopes.Start( obp, LexicalScope::SCOPE_TYPE_WHILE );
+	compiler.codeGenerator.lexicalScopes.Start( compiler.codeGenerator.GetNativeCodeSize(), LexicalScope::SCOPE_TYPE_WHILE );
 
 	//While内をコンパイル
@@ -562,6 +574,5 @@
 
 	//レキシカルスコープをレベルアップ
-	extern int obp;
-	compiler.codeGenerator.lexicalScopes.Start( obp, LexicalScope::SCOPE_TYPE_FOR );
+	compiler.codeGenerator.lexicalScopes.Start( compiler.codeGenerator.GetNativeCodeSize(), LexicalScope::SCOPE_TYPE_FOR );
 
 	//For内をコンパイル
@@ -599,6 +610,5 @@
 
 	//レキシカルスコープをレベルアップ
-	extern int obp;
-	compiler.codeGenerator.lexicalScopes.Start( obp, LexicalScope::SCOPE_TYPE_DO );
+	compiler.codeGenerator.lexicalScopes.Start( compiler.codeGenerator.GetNativeCodeSize(), LexicalScope::SCOPE_TYPE_DO );
 
 	//Do内をコンパイル
@@ -1040,6 +1050,5 @@
 
 	//レキシカルスコープをレベルアップ
-	extern int obp;
-	compiler.codeGenerator.lexicalScopes.Start( obp, LexicalScope::SCOPE_TYPE_SELECT );
+	compiler.codeGenerator.lexicalScopes.Start( compiler.codeGenerator.GetNativeCodeSize(), LexicalScope::SCOPE_TYPE_SELECT );
 
 	//Select Case内をコンパイル
@@ -1090,5 +1099,4 @@
 void OpcodeGosub(char *Parameter){
 	extern HANDLE hHeap;
-	extern int obp;
 	int i,LineNum;
 
@@ -1104,5 +1112,10 @@
 		{
 			//jmp ...
-			compiler.codeGenerator.op_jmp( i-obp, sizeof(long), false, true );
+			compiler.codeGenerator.op_jmp(
+				i-compiler.codeGenerator.GetNativeCodeSize(),
+				sizeof(long),
+				false,
+				true
+			);
 		}
 	}
@@ -1119,5 +1132,10 @@
 		{
 			//jmp ...
-			compiler.codeGenerator.op_jmp( i-obp, sizeof(long), false, true );
+			compiler.codeGenerator.op_jmp(
+				i-compiler.codeGenerator.GetNativeCodeSize(),
+				sizeof(long),
+				false,
+				true
+			);
 		}
 	}
Index: trunk/abdev/BasicCompiler32/Compile_Var.cpp
===================================================================
--- trunk/abdev/BasicCompiler32/Compile_Var.cpp	(revision 275)
+++ trunk/abdev/BasicCompiler32/Compile_Var.cpp	(revision 276)
@@ -1300,6 +1300,4 @@
 			// call AddGlobalRootPtr
 			compiler.codeGenerator.op_call( pUserProc_AddGlobalRootPtr );
-
-			ReallocNativeCodeBuffer();
 		}
 	}
Index: trunk/abdev/BasicCompiler32/MakePeHdr.cpp
===================================================================
--- trunk/abdev/BasicCompiler32/MakePeHdr.cpp	(revision 275)
+++ trunk/abdev/BasicCompiler32/MakePeHdr.cpp	(revision 276)
@@ -122,5 +122,4 @@
 	extern BOOL bDebugCompile;
 	extern DWORD ImageBase;
-	extern int obp_AllocSize;
 	extern char *basbuf;
 	extern char OutputFileName[MAX_PATH];
@@ -355,21 +354,4 @@
 
 
-
-
-	//データテーブルスケジュール
-	pobj_DataTableSchedule=new CSchedule();
-	pobj_DataTableSchedule->SetFlag(SCHEDULE_FLAG_RELOC);
-
-	//インポートテーブルスケジュール
-	pobj_ImportAddrSchedule=new CImportAddrSchedule();
-	pobj_ImportAddrSchedule->SetFlag(SCHEDULE_FLAG_RELOC);
-
-	//プロシージャポインタスケジュール
-	pobj_SubAddrSchedule=new CSubAddrSchedule();
-
-	//グローバル変数アドレススケジュール
-	pobj_GlobalVarSchedule=new CSchedule();
-	pobj_GlobalVarSchedule->SetFlag(SCHEDULE_FLAG_RELOC);
-
 	//グローバル変数の初期バッファ
 	extern BYTE *initGlobalBuf;
@@ -379,12 +361,7 @@
 	pobj_Reloc=new CReloc();
 
-	extern char *OpBuffer;
-	extern int obp;
-	obp_AllocSize=8192*2;
-	OpBuffer=(char *)malloc(obp_AllocSize);
-	obp=0;
-
 	//レキシカルスコープ情報を初期化
-	compiler.codeGenerator.lexicalScopes.Init(obp);
+	compiler.codeGenerator.lexicalScopes.Init( 0 );
+	//compiler.codeGenerator.lexicalScopes.Init( compiler.codeGenerator.GetNativeCodeSize() );
 
 
@@ -702,10 +679,9 @@
 
 			if( pUserProc->GetName() == "DllMain" ){
-				// TODO: 未完成
-				DllMain_EntryPoint=pUserProc->_beginOpAddressOld;
+				DllMain_EntryPoint = pUserProc->GetBeginOpAddress();
 			}
 
 			lpdwExportAddressTable=(DWORD *)HeapReAlloc(hHeap,0,lpdwExportAddressTable,(ExportNum+1)*sizeof(DWORD));
-			lpdwExportAddressTable[ExportNum]=pUserProc->_beginOpAddressOld;
+			lpdwExportAddressTable[ExportNum] = pUserProc->GetBeginOpAddress();
 
 			lpdwExportNamePointerTable=(DWORD *)HeapReAlloc(hHeap,0,lpdwExportNamePointerTable,(ExportNum+1)*sizeof(DWORD));
@@ -1143,76 +1119,8 @@
 
 
-	//////////////////////////////
-	// データテーブルスケジュール
-	for(i=0;i<pobj_DataTableSchedule->num;i++){
-		*((long *)(OpBuffer+pobj_DataTableSchedule->pObpValues[i]))+=ImageBase+MemPos_DataSection;
-	}
-	delete pobj_DataTableSchedule;
-
-
-	//////////////////////////////////
-	// インポートテーブルスケジュール（インポート アドレス テーブルを指し示させる）
-	for(i=0;i<pobj_ImportAddrSchedule->num;i++){
-		const DllProc *pDllProc=pobj_ImportAddrSchedule->ppdi[i];
-		*((long *)(OpBuffer+pobj_ImportAddrSchedule->pObpValues[i]))=
-			ImageBase+
-			MemPos_ImportSection+
-			LookupSize+			//ルックアップテーブル
-			HintSize+			//ヒント名（関数名）テーブル
-			pDllProc->GetLookupAddress();
-	}
-	delete pobj_ImportAddrSchedule;
-
-
-	////////////////////////////////////
-	// プロシージャポインタスケジュール
-	for(i=0;i<pobj_SubAddrSchedule->num;i++){
-		if(pobj_SubAddrSchedule->ppsi[i]->_beginOpAddressOld==0
-			&&pobj_SubAddrSchedule->ppsi[i]->_endOpAddressOld==0){
-			SetError(300,NULL,-1);
-		}
-
-		if(pobj_SubAddrSchedule->pbCall[i]){
-			*((long *)(OpBuffer+pobj_SubAddrSchedule->pObpValues[i]))=
-				pobj_SubAddrSchedule->ppsi[i]->_beginOpAddressOld-(pobj_SubAddrSchedule->pObpValues[i]+sizeof(long));
-		}
-		else{
-			*((long *)(OpBuffer+pobj_SubAddrSchedule->pObpValues[i]))=
-				pobj_SubAddrSchedule->ppsi[i]->_beginOpAddressOld+ImageBase+MemPos_CodeSection;
-		}
-	}
-	delete pobj_SubAddrSchedule;
-
-
 	if( compiler.IsDll() ){
 		//DLLの場合はリロケーション情報を生成
 		pobj_Reloc->ResetRelocBuffer();
 	}
-
-
-
-	//////////////////////////////////////
-	// グローバル変数アドレススケジュール
-	//////////////////////////////////////
-
-	/*
-	GlobalArea1 - 初期バッファあり
-	GlobalArea2 - 初期バッファなし
-	*/
-	for(i=0;i<pobj_GlobalVarSchedule->num;i++){
-		if(*((long *)(OpBuffer+pobj_GlobalVarSchedule->pObpValues[i])) & 0x80000000){
-			//初期バッファなし
-			*((long *)(OpBuffer+pobj_GlobalVarSchedule->pObpValues[i]))=
-				compiler.GetObjectModule().meta.GetGlobalVars().GetAllInitSize() +
-				(*((long *)(OpBuffer+pobj_GlobalVarSchedule->pObpValues[i])) & 0x7FFFFFFF)+
-				ImageBase+MemPos_RWSection;
-		}
-		else{
-			//初期バッファあり
-			*((long *)(OpBuffer+pobj_GlobalVarSchedule->pObpValues[i]))+=
-				ImageBase+MemPos_RWSection;
-		}
-	}
-	delete pobj_GlobalVarSchedule;
 
 
@@ -1784,8 +1692,4 @@
 	HeapDefaultFree(initGlobalBuf);
 
-	//コードバッファを解放
-	free(OpBuffer);
-	OpBuffer=0;
-
 	//リソースセクションバッファを解放
 	HeapDefaultFree(RSrcSectionBuffer);
Index: trunk/abdev/BasicCompiler32/NumOpe.cpp
===================================================================
--- trunk/abdev/BasicCompiler32/NumOpe.cpp	(revision 275)
+++ trunk/abdev/BasicCompiler32/NumOpe.cpp	(revision 276)
@@ -677,13 +677,4 @@
 	//リテラル値のみの計算かどうかを判別するためのフラグ
 	BOOL bLiteralCalculation=1;
-
-	//リテラル演算の場合を考慮した演算前のプロシージャスケジュール位置
-	//※64ビットの掛け算、除算などで特殊関数が呼ばれるため
-	int Before_ProcAddrScheduleNum;
-	Before_ProcAddrScheduleNum=pobj_SubAddrSchedule->num;
-
-	//リテラル演算の場合を考慮した演算前のデータテーブルスケジュール位置
-	int Before_DataTableScheduleNum;
-	Before_DataTableScheduleNum=pobj_DataTableSchedule->num;
 
 	//リテラル演算の場合を考慮した演算前の再配置スケジュール
