Index: trunk/abdev/BasicCompiler64/Compile_Statement.cpp
===================================================================
--- trunk/abdev/BasicCompiler64/Compile_Statement.cpp	(revision 226)
+++ trunk/abdev/BasicCompiler64/Compile_Statement.cpp	(revision 242)
@@ -140,12 +140,15 @@
 
 		//comisd xmm0,qword ptr[data table offset]
-		OpBuffer[obp++]=(char)0x66;
-		OpBuffer[obp++]=(char)0x0F;
-		OpBuffer[obp++]=(char)0x2F;
-		OpBuffer[obp++]=(char)0x04;
-		OpBuffer[obp++]=(char)0x25;
-		*((long *)(OpBuffer+obp))=offset;
-		pobj_DataTableSchedule->add();
-		obp+=sizeof(long);
+		compiler.codeGenerator.PutOld(
+			(char)0x66,
+			(char)0x0F,
+			(char)0x2F,
+			(char)0x04,
+			(char)0x25
+		);
+		compiler.codeGenerator.PutOld(
+			(long)offset,
+			Schedule::DataTable
+		);
 	}
 	else if(resultType.IsSingle()){
@@ -154,11 +157,14 @@
 
 		//comiss xmm0,dword ptr[data table offset]
-		OpBuffer[obp++]=(char)0x0F;
-		OpBuffer[obp++]=(char)0x2F;
-		OpBuffer[obp++]=(char)0x04;
-		OpBuffer[obp++]=(char)0x25;
-		*((long *)(OpBuffer+obp))=offset;
-		pobj_DataTableSchedule->add();
-		obp+=sizeof(long);
+		compiler.codeGenerator.PutOld(
+			(char)0x0F,
+			(char)0x2F,
+			(char)0x04,
+			(char)0x25
+		);
+		compiler.codeGenerator.PutOld(
+			(long)offset,
+			Schedule::DataTable
+		);
 	}
 	else{
@@ -171,7 +177,5 @@
 
 void OpcodeIf(char *Parameter){
-	int i,i2,i3;
-
-	for(i=0;;i++){
+	for(int i=0;;i++){
 		if(Parameter[i]=='\0'){
 			SetError(21,NULL,cp);
@@ -188,10 +192,5 @@
 
 	//je (endif、または else まで条件ジャンプ)
-	OpBuffer[obp++]=(char)0x0F;
-	OpBuffer[obp++]=(char)0x84;
-	obp+=sizeof(long);
-
-	//jeの番地
-	i3=obp;
+	CodeGenerator::PertialSchedule *pIfPertialSchedule = compiler.codeGenerator.op_je( 0, sizeof(long), true );
 
 
@@ -203,5 +202,5 @@
 	GetLexicalScopes().Start( obp, SCOPE_TYPE_IF );
 
-	i2=CompileBuffer(ESC_ENDIF,0);
+	int i2=CompileBuffer(ESC_ENDIF,0);
 
 	//レキシカルスコープをレベルダウン
@@ -211,10 +210,8 @@
 	if(i2==ESC_ELSE){
 		//jmp (endifまで)
-		OpBuffer[obp++]=(char)0xE9;
-		obp+=sizeof(long);
-
-		*((long *)(OpBuffer+i3-sizeof(long)))=obp-i3;	//ifからelseへのジャンプ先のオフセット値
-
-		i3=obp;
+		CodeGenerator::PertialSchedule *pTempPertialSchedule = compiler.codeGenerator.op_jmp( 0, sizeof(long), true );
+
+		compiler.codeGenerator.opfix_JmpPertialSchedule( pIfPertialSchedule );
+
 
 
@@ -232,8 +229,8 @@
 
 
-		*((long *)(OpBuffer+i3-sizeof(long)))=obp-i3;	//jmpジャンプ先のオフセット値
+		compiler.codeGenerator.opfix_JmpPertialSchedule( pTempPertialSchedule );
 	}
 	else{
-		*((long *)(OpBuffer+i3-sizeof(long)))=obp-i3;	//jeジャンプ先のオフセット値
+		compiler.codeGenerator.opfix_JmpPertialSchedule( pIfPertialSchedule );
 	}
 }
@@ -304,10 +301,5 @@
 
 	//Continueアドレスのバックアップとセット
-	extern DWORD dwContinueAddress;
-	DWORD dwTempContinue;
-	dwTempContinue=dwContinueAddress;
-	dwContinueAddress=obp;
-	pobj_TempSchedule->lock((int *)&dwTempContinue);
-	pobj_TempSchedule->lock((int *)&dwContinueAddress);
+	compiler.codeGenerator.ContinueAreaBegin();
 
 	if(!Parameter[0]) SetError(10,"While",cp);
@@ -317,11 +309,5 @@
 
 	//je (Wend まで)
-	OpBuffer[obp++]=(char)0x0F;
-	OpBuffer[obp++]=(char)0x84;
-	obp+=sizeof(long);
-
-	//実行中の番地
-	int je_schedule=obp;
-	pobj_TempSchedule->lock(&je_schedule);
+	CodeGenerator::PertialSchedule *pWhilePertialSchedule = compiler.codeGenerator.op_je( 0, sizeof(long), true );
 
 	//レキシカルスコープをレベルアップ
@@ -334,18 +320,13 @@
 
 	//jmp ...
-	OpBuffer[obp++]=(char)0xE9;
-	*((long *)(OpBuffer+obp))=dwContinueAddress-(obp+sizeof(long));
-	obp+=sizeof(long);
-	pobj_TempSchedule->unlock();
-	pobj_TempSchedule->unlock();
+	compiler.codeGenerator.op_jmp_continue();
 
 	//レキシカルスコープをレベルダウン
 	GetLexicalScopes().End();
 
-	*((long *)(OpBuffer+je_schedule-sizeof(long)))=obp-je_schedule;	//jeジャンプ先のオフセット値
-	pobj_TempSchedule->unlock();
+	compiler.codeGenerator.opfix_JmpPertialSchedule( pWhilePertialSchedule );
 
 	//Continueアドレスを復元
-	dwContinueAddress=dwTempContinue;
+	compiler.codeGenerator.ContinueAreaEnd();
 }
 
@@ -354,5 +335,5 @@
 	extern HANDLE hHeap;
 	Type resultType;
-	int i,i2,i3;
+	int i,i2;
 	char temporary[VN_SIZE],variable[VN_SIZE],JudgeNum[VN_SIZE],StepNum[VN_SIZE];
 	bool isError = false;
@@ -383,15 +364,8 @@
 
 	//jmp ...
-	OpBuffer[obp++]=(char)0xE9;
-	i2=obp;
-	obp+=sizeof(long);
+	CodeGenerator::PertialSchedule *pTempPertialSchedule = compiler.codeGenerator.op_jmp( 0, sizeof(long), true );
 
 	//Continueアドレスのバックアップとセット
-	extern DWORD dwContinueAddress;
-	DWORD dwTempContinue;
-	dwTempContinue=dwContinueAddress;
-	dwContinueAddress=obp;
-	pobj_TempSchedule->lock((int *)&dwTempContinue);
-	pobj_TempSchedule->lock((int *)&dwContinueAddress);
+	compiler.codeGenerator.ContinueAreaBegin();
 
 	//第２パラメータを取得（to～）
@@ -409,5 +383,5 @@
 	OpcodeCalc(temporary);
 
-	*((long *)(OpBuffer+i2))=obp-(i2+sizeof(long));
+	compiler.codeGenerator.opfix_JmpPertialSchedule( pTempPertialSchedule );
 
 	//増加か減少かを区別する
@@ -424,8 +398,5 @@
 
 	//je [カウンタ減少の場合の判定]
-	OpBuffer[obp++]=(char)0x0F;
-	OpBuffer[obp++]=(char)0x84;
-	i2=obp;
-	obp+=sizeof(long);
+	pTempPertialSchedule = compiler.codeGenerator.op_je( 0, sizeof(long), true );
 
 	//判定（カウンタ増加の場合）
@@ -436,9 +407,8 @@
 
 	//jmp [カウンタ減少の場合の判定を飛び越す]
-	OpBuffer[obp++]=(char)0xE9;
-	i3=obp;
-	obp+=sizeof(long);
-
-	*((long *)(OpBuffer+i2))=obp-(i2+sizeof(long)); //jeジャンプ先のオフセット値
+	CodeGenerator::PertialSchedule *pTempPertialSchedule2 = compiler.codeGenerator.op_jmp( 0, sizeof(long), true );
+
+	//jeジャンプ先のオフセット値
+	compiler.codeGenerator.opfix_JmpPertialSchedule( pTempPertialSchedule );
 
 	//判定（カウンタ減少の場合）
@@ -448,5 +418,6 @@
 	NumOpe(&reg,temporary,Type(),resultType);
 
-	*((long *)(OpBuffer+i3))=obp-(i3+sizeof(long)); //jmpジャンプ先のオフセット値
+	//jmpジャンプ先のオフセット値
+	compiler.codeGenerator.opfix_JmpPertialSchedule( pTempPertialSchedule2 );
 
 	//cmp rax,0
@@ -456,9 +427,5 @@
 
 	//je ...
-	OpBuffer[obp++]=(char)0x0F;
-	OpBuffer[obp++]=(char)0x84;
-	int je_schedule=obp;
-	obp+=sizeof(long);
-	pobj_TempSchedule->lock(&je_schedule);
+	pTempPertialSchedule = compiler.codeGenerator.op_je( 0, sizeof(long), true );
 
 	//レキシカルスコープをレベルアップ
@@ -477,20 +444,14 @@
 
 	//jmp ...
-	OpBuffer[obp++]=(char)0xE9;
-	*((long *)(OpBuffer+obp))=dwContinueAddress-(obp+sizeof(long));
-	obp+=sizeof(long);
-	if( isError == false ){
-		pobj_TempSchedule->unlock();
-		pobj_TempSchedule->unlock();
-	}
+	compiler.codeGenerator.op_jmp_continue();
 
 	//レキシカルスコープをレベルダウン
 	GetLexicalScopes().End();
 
-	*((long *)(OpBuffer+je_schedule))=obp-(je_schedule+sizeof(long)); //jeジャンプ先のオフセット値
-	pobj_TempSchedule->unlock();
+	//jeジャンプ先のオフセット値
+	compiler.codeGenerator.opfix_JmpPertialSchedule( pTempPertialSchedule );
 
 	//Continueアドレスを復元
-	dwContinueAddress=dwTempContinue;
+	compiler.codeGenerator.ContinueAreaEnd();
 }
 
@@ -502,10 +463,5 @@
 
 	//Continueアドレスのバックアップとセット
-	extern DWORD dwContinueAddress;
-	DWORD dwTempContinue;
-	dwTempContinue=dwContinueAddress;
-	dwContinueAddress=obp;
-	pobj_TempSchedule->lock((int *)&dwTempContinue);
-	pobj_TempSchedule->lock((int *)&dwContinueAddress);
+	compiler.codeGenerator.ContinueAreaBegin();
 
 	//レキシカルスコープをレベルアップ
@@ -516,4 +472,6 @@
 
 	GetLexicalScopes().CallDestructorsOfScopeEnd();
+
+	CodeGenerator::PertialSchedule *pDoPertialSchedule = NULL;
 
 	extern char *basbuf;
@@ -543,6 +501,5 @@
 
 				//je 5（ループ終了）
-				OpBuffer[obp++]=(char)0x74;
-				OpBuffer[obp++]=(char)0x05;
+				pDoPertialSchedule = compiler.codeGenerator.op_je( 0, sizeof(char), true );
 			}
 			else if(basbuf[i3]=='1'){
@@ -550,6 +507,5 @@
 
 				//jne 5（ループ終了）
-				OpBuffer[obp++]=(char)0x75;
-				OpBuffer[obp++]=(char)0x05;
+				pDoPertialSchedule = compiler.codeGenerator.op_jne( 0, sizeof(char), true );
 			}
 			break;
@@ -558,9 +514,10 @@
 
 	//jmp ...
-	OpBuffer[obp++]=(char)0xE9;
-	*((long *)(OpBuffer+obp))=dwContinueAddress-(obp+sizeof(long));
-	obp+=sizeof(long);
-	pobj_TempSchedule->unlock();
-	pobj_TempSchedule->unlock();
+	compiler.codeGenerator.op_jmp_continue();
+
+	if( pDoPertialSchedule )
+	{
+		compiler.codeGenerator.opfix_JmpPertialSchedule( pDoPertialSchedule );
+	}
 
 	//jmp ...
@@ -568,5 +525,4 @@
 	int je_schedule=obp;
 	obp+=sizeof(long);
-	pobj_TempSchedule->lock(&je_schedule);
 
 	//レキシカルスコープをレベルダウン
@@ -574,22 +530,11 @@
 
 	*((long *)(OpBuffer+je_schedule))=obp-(je_schedule+sizeof(long)); //jmpジャンプ先のオフセット値
-	pobj_TempSchedule->unlock();
 
 	//Continueアドレスを復元
-	dwContinueAddress=dwTempContinue;
+	compiler.codeGenerator.ContinueAreaEnd();
 }
 void OpcodeContinue(void){
-	extern DWORD dwContinueAddress;
-
-	if(dwContinueAddress==-1){
-		SetError(12,"Continue",cp);
-		return;
-	}
-
 	//jmp ...(Continue addr)
-	OpBuffer[obp++]=(char)0xE9;
-
-	*((long *)(OpBuffer+obp))=dwContinueAddress-(obp+sizeof(long));
-	obp+=sizeof(long);
+	compiler.codeGenerator.op_jmp_continue();
 }
 
