Index: BasicCompiler32/BasicCompiler.vcproj
===================================================================
--- BasicCompiler32/BasicCompiler.vcproj	(revision 8)
+++ BasicCompiler32/BasicCompiler.vcproj	(revision 11)
@@ -736,32 +736,4 @@
 					</FileConfiguration>
 				</File>
-				<File
-					RelativePath="..\BasicCompiler_Common\Variable.cpp"
-					>
-					<FileConfiguration
-						Name="Debug|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="English_Rel|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-				</File>
 				<Filter
 					Name="Intermediate"
@@ -1269,4 +1241,40 @@
 					<File
 						RelativePath="..\BasicCompiler_Common\Const.h"
+						>
+					</File>
+				</Filter>
+				<Filter
+					Name="Variable"
+					>
+					<File
+						RelativePath="..\BasicCompiler_Common\Variable.cpp"
+						>
+						<FileConfiguration
+							Name="Debug|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Release|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="English_Rel|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+					</File>
+					<File
+						RelativePath="..\BasicCompiler_Common\Variable.h"
 						>
 					</File>
Index: BasicCompiler32/CParameter.cpp
===================================================================
--- BasicCompiler32/CParameter.cpp	(revision 8)
+++ BasicCompiler32/CParameter.cpp	(revision 11)
@@ -556,5 +556,5 @@
 				int VarType;
 				LONG_PTR lpVarIndex;
-				if(!GetVarOffset(1,Parms[i2],&VarType,&RelativeVar,&lpVarIndex)) continue;
+				if(!GetVarOffsetReadOnly(Parms[i2],&VarType,&RelativeVar,&lpVarIndex)) continue;
 
 				if(DummyTypeInfo.type!=DEF_ANY){
Index: BasicCompiler32/Compile_Calc.cpp
===================================================================
--- BasicCompiler32/Compile_Calc.cpp	(revision 8)
+++ BasicCompiler32/Compile_Calc.cpp	(revision 11)
@@ -516,6 +516,5 @@
 
 		//変数アドレスを取得
-		if(!GetVarOffset(
-			1,
+		if(!GetVarOffsetReadWrite(
 			variable,
 			&VarType,
@@ -535,6 +534,5 @@
 
 	//変数アドレスを取得
-	if(!GetVarOffset(
-		1,
+	if(!GetVarOffsetReadWrite(
 		variable,
 		&VarType,
Index: BasicCompiler32/Compile_CallProc.cpp
===================================================================
--- BasicCompiler32/Compile_CallProc.cpp	(revision 8)
+++ BasicCompiler32/Compile_CallProc.cpp	(revision 11)
@@ -185,5 +185,5 @@
 	RELATIVE_VAR RelativeVar;
 	LONG_PTR lp;
-	GetVarOffset(1,variable,&i,&RelativeVar,&lp);
+	GetVarOffsetReadOnly(variable,&i,&RelativeVar,&lp);
 	SetVarPtrToEax(&RelativeVar);
 
@@ -382,5 +382,5 @@
 
 			RELATIVE_VAR RelativeVar;
-			if(!GetVarOffset(1,ObjectName,&i2,&RelativeVar,0)) return -1;
+			if(!GetVarOffsetReadOnly(ObjectName,&i2,&RelativeVar,0)) return -1;
 			SetVarPtrToEax(&RelativeVar);
 
Index: BasicCompiler32/Compile_Func.cpp
===================================================================
--- BasicCompiler32/Compile_Func.cpp	(revision 8)
+++ BasicCompiler32/Compile_Func.cpp	(revision 11)
@@ -223,5 +223,5 @@
 	int SubScripts[MAX_ARRAYDIM];
 	RELATIVE_VAR RelativeVar;
-	if(!GetVarOffset(1,tempParm,&type,&RelativeVar,&lpIndex,SubScripts)) return;
+	if(!GetVarOffsetReadOnly(tempParm,&type,&RelativeVar,&lpIndex,SubScripts)) return;
 
 	if(type&FLAG_PTR){
@@ -295,5 +295,5 @@
 				RELATIVE_VAR RelativeVar;
 				int type;
-				if(!GetVarOffset(1,ObjectName,&type,&RelativeVar,(LONG_PTR *)&pobj_c)) return;
+				if(!GetVarOffsetReadOnly(ObjectName,&type,&RelativeVar,(LONG_PTR *)&pobj_c)) return;
 				SetVarPtrToEax(&RelativeVar);
 
@@ -375,5 +375,5 @@
 
 	//変数のアドレスを取得
-	if(!GetVarOffset(1,Parameter,&type,&RelativeVar,0)) return;
+	if(!GetVarOffsetReadOnly(Parameter,&type,&RelativeVar,0)) return;
 
 	SetVarPtrToEax(&RelativeVar);
Index: BasicCompiler32/Compile_ProcOp.cpp
===================================================================
--- BasicCompiler32/Compile_ProcOp.cpp	(revision 8)
+++ BasicCompiler32/Compile_ProcOp.cpp	(revision 11)
@@ -282,4 +282,7 @@
 
 		lstrcpy(LocalVar[MaxLocalVarNum].name,psi->pRealParmInfo[i3].name);
+
+		// TODO: パラメータのConst定義の指定が未完成
+		LocalVar[MaxLocalVarNum].bConst=false;
 
 		LocalVar[MaxLocalVarNum].bArray=psi->pRealParmInfo[i3].bArray;
@@ -696,5 +699,5 @@
 			temp="_System_ReturnValue";
 		else temp=psi->name;
-		GetVarOffset(1,temp,&i3,&RelativeVar,&lpIndex);
+		GetVarOffsetReadWrite(temp,&i3,&RelativeVar,&lpIndex);
 
 		i3=psi->ReturnType;
Index: BasicCompiler32/Compile_Statement.cpp
===================================================================
--- BasicCompiler32/Compile_Statement.cpp	(revision 8)
+++ BasicCompiler32/Compile_Statement.cpp	(revision 11)
@@ -1573,6 +1573,5 @@
 
 		LONG_PTR lpIndex;
-		RELATIVE_VAR RelativeVar;
-		GetVarOffset(1,temporary,&type,&RelativeVar,&lpIndex);
+		type = GetVarType(temporary,&lpIndex,1);
 
 		sprintf(temp2,"_System_InputDataPtr[%d]=VarPtr(%s)",i4,temporary);
Index: BasicCompiler32/Compile_Var.cpp
===================================================================
--- BasicCompiler32/Compile_Var.cpp	(revision 8)
+++ BasicCompiler32/Compile_Var.cpp	(revision 11)
@@ -157,5 +157,5 @@
 	return 1;
 }
-BOOL GetMemberOffset(BOOL bError,CClass *pobj_c,char *member,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpNestIndex,BOOL bPrivateAccess){
+BOOL GetMemberOffset(bool ErrorEnabled,CClass *pobj_c,char *member,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpNestIndex,BOOL bPrivateAccess){
 	int i,offset;
 
@@ -175,5 +175,5 @@
 	offset=GetSizeOfClassMember(pobj_c,VarName,&i);
 	if(i==pobj_c->iMemberNum){
-		if(bError) SetError(103,VarName,cp);
+		if(ErrorEnabled) SetError(103,VarName,cp);
 		return 0;
 	}
@@ -183,5 +183,5 @@
 		//同一クラスオブジェクトの場合はプライベートアクセスを容認する
 		if(pobj_c->ppobj_Member[i]->dwAccess==ACCESS_NON){
-			if(bError) SetError(107,VarName,cp);
+			if(ErrorEnabled) SetError(107,VarName,cp);
 			return 0;
 		}
@@ -190,9 +190,9 @@
 		if((bPrivateAccess==0&&pobj_c->ppobj_Member[i]->dwAccess==ACCESS_PRIVATE)||
 			pobj_c->ppobj_Member[i]->dwAccess==ACCESS_NON){
-			if(bError) SetError(107,VarName,cp);
+			if(ErrorEnabled) SetError(107,VarName,cp);
 			return 0;
 		}
 		else if(bPrivateAccess==0&&pobj_c->ppobj_Member[i]->dwAccess==ACCESS_PROTECTED){
-			if(bError) SetError(108,VarName,cp);
+			if(ErrorEnabled) SetError(108,VarName,cp);
 			return 0;
 		}
@@ -211,5 +211,5 @@
 	else{
 		if(lpPtrOffset[0]){
-			if(bError) SetError(16,member,cp);
+			if(ErrorEnabled) SetError(16,member,cp);
 			return 0;
 		}
@@ -227,5 +227,5 @@
 		//配列オフセット
 		if(!GetArrayOffset(pobj_c->ppobj_Member[i]->SubScripts,array,*pType,pobj_c->ppobj_Member[i]->TypeInfo.u.lpIndex))
-			if(bError) SetError(14,member,cp);
+			if(ErrorEnabled) SetError(14,member,cp);
 	}
 	else if(pobj_c->ppobj_Member[i]->SubScripts[0]!=-1){
@@ -238,5 +238,5 @@
 		if(*pType==DEF_OBJECT){
 			if(RefType!=DEF_OBJECT){
-				if(bError) SetError(104,member,cp);
+				if(ErrorEnabled) SetError(104,member,cp);
 				return 0;
 			}
@@ -248,5 +248,5 @@
 				//pObj[n].member
 				if(RefType!=DEF_OBJECT){
-					if(bError) SetError(104,member,cp);
+					if(ErrorEnabled) SetError(104,member,cp);
 					return 0;
 				}
@@ -261,5 +261,5 @@
 				//pObj->member
 				if(RefType!=DEF_PTR_OBJECT){
-					if(bError) SetError(104,member,cp);
+					if(ErrorEnabled) SetError(104,member,cp);
 					return 0;
 				}
@@ -287,5 +287,5 @@
 				//ppObj[n]->member
 				if(RefType!=DEF_PTR_OBJECT){
-					if(bError) SetError(104,member,cp);
+					if(ErrorEnabled) SetError(104,member,cp);
 					return 0;
 				}
@@ -302,10 +302,10 @@
 			}
 			else{
-				if(bError) SetError(104,member,cp);
+				if(ErrorEnabled) SetError(104,member,cp);
 				return 0;
 			}
 		}
 
-		if(!GetMemberOffset(bError,pobj_c->ppobj_Member[i]->TypeInfo.u.pobj_Class,
+		if(!GetMemberOffset(ErrorEnabled,pobj_c->ppobj_Member[i]->TypeInfo.u.pobj_Class,
 			NestMember,
 			pType,
@@ -344,5 +344,5 @@
 }
 
-BOOL GetVarOffset(BOOL bError,char *NameBuffer,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpIndex,int *pss){
+BOOL GetVarOffset(bool ErrorEnabled,bool WriteAccess,char *NameBuffer,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpIndex,int *pss){
 	extern BOOL bCompilingGlobal;
 	int i,RefType;
@@ -360,4 +360,5 @@
 	LONG_PTR lpIndex;
 	int *pSubScripts;
+	bool bConst;
 
 	if(bCompilingGlobal==0){
@@ -395,4 +396,5 @@
 			if(plpIndex) *plpIndex=lpIndex;
 			pSubScripts=LocalVar[i].SubScripts;
+			bConst = LocalVar[i].bConst;
 
 			goto ok;
@@ -439,5 +441,5 @@
 
 		pRelativeVar->dwKind=VAR_DIRECTMEM;
-		if(!GetMemberOffset(bError,pobj_CompilingClass,variable,pType,pRelativeVar,&lpIndex,1)) return 0;
+		if(!GetMemberOffset(ErrorEnabled,pobj_CompilingClass,variable,pType,pRelativeVar,&lpIndex,1)) return 0;
 		if(plpIndex) *plpIndex=lpIndex;
 		return 1;
@@ -511,5 +513,5 @@
 	}
 
-	if(bError) SetError(3,variable,cp);
+	if(ErrorEnabled) SetError(3,variable,cp);
 	pRelativeVar->dwKind=NON_VAR;
 	return 0;
@@ -540,8 +542,13 @@
 	if(plpIndex) *plpIndex=lpIndex;
 	pSubScripts=GlobalVar[i].SubScripts;
+	bConst = GlobalVar[i].bConst;
 
 
 ok:
 
+	if(bConst && WriteAccess){
+		//Const定義の変数に書き込みアクセスをしようとした場合
+		SetError(61,VarName,cp);
+	}
 
 	if(array[0]==0&&pSubScripts[0]!=-1){
@@ -576,5 +583,5 @@
 
 			LONG_PTR lp2;
-			if(!GetMemberOffset(bError,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;
+			if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;
 			if(plpIndex) *plpIndex=lp2;
 		}
@@ -592,5 +599,5 @@
 
 				LONG_PTR lp2;
-				if(!GetMemberOffset(bError,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;
+				if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;
 				if(plpIndex) *plpIndex=lp2;
 			}
@@ -611,5 +618,5 @@
 
 				LONG_PTR lp2;
-				if(!GetMemberOffset(bError,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;
+				if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;
 				if(plpIndex) *plpIndex=lp2;
 			}
@@ -636,5 +643,5 @@
 
 				LONG_PTR lp2;
-				if(!GetMemberOffset(bError,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;
+				if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;
 				if(plpIndex) *plpIndex=lp2;
 			}
@@ -1117,6 +1124,6 @@
 			lstrcpy(pVar->name,VarName);
 			pVar->fRef=0;
-			if(dwFlag & DIMFLAG_CONST) pVar->bConst = 1;
-			else pVar->bConst = 0;
+			if(dwFlag & DIMFLAG_CONST) pVar->bConst = true;
+			else pVar->bConst = false;
 			if(SubScripts[0]==-1) pVar->bArray=0;
 			else pVar->bArray=1;
@@ -1132,4 +1139,8 @@
 
 			if(InitBuf[0]){
+				//初期代入時のみ、書き込みアクセスを許可する
+				bool bConstBack = pVar->bConst;
+				pVar->bConst = false;
+
 				int result = InitLocalVar(-pVar->offset,
 					pVar->type,
@@ -1144,4 +1155,6 @@
 					OpcodeCalc(temporary);
 				}
+
+				pVar->bConst = bConstBack;
 			}
 			else{
Index: BasicCompiler32/NumOpe.cpp
===================================================================
--- BasicCompiler32/NumOpe.cpp	(revision 8)
+++ BasicCompiler32/NumOpe.cpp	(revision 11)
@@ -375,5 +375,8 @@
 
 					RELATIVE_VAR RelativeVar;
-					if(GetVarOffset(0,term,&i2,&RelativeVar,&index_stack[sp])){
+					if(GetVarOffset(
+						false,	//エラー表示あり
+						false,	//読み込み専用
+						term,&i2,&RelativeVar,&index_stack[sp])){
 						//////////
 						// 変数
Index: BasicCompiler32/Opcode.h
===================================================================
--- BasicCompiler32/Opcode.h	(revision 8)
+++ BasicCompiler32/Opcode.h	(revision 11)
@@ -172,5 +172,5 @@
 void GetWithName(char *buffer);
 void SetThisPtrToReg(int reg);
-BOOL GetVarOffset(BOOL bError,char *NameBuffer,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpIndex,int *pss=0);
+BOOL GetVarOffset(bool ErrorEnabled,bool WriteAccess,char *NameBuffer,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpIndex,int *pss=0);
 BOOL SetInitGlobalData(int offset,int type,LONG_PTR lpIndex,int *SubScripts,char *InitBuf);
 #define DIMFLAG_INITDEBUGVAR			1
Index: BasicCompiler32/increment.cpp
===================================================================
--- BasicCompiler32/increment.cpp	(revision 8)
+++ BasicCompiler32/increment.cpp	(revision 11)
@@ -235,6 +235,5 @@
 	///////////////////////////
 
-	if(!GetVarOffset(
-		1,
+	if(!GetVarOffsetReadWrite(
 		lpszLeft,
 		&VarType,
