Index: /trunk/ab5.0/abdev/BasicCompiler_Common/BasicCompiler.h
===================================================================
--- /trunk/ab5.0/abdev/BasicCompiler_Common/BasicCompiler.h	(revision 640)
+++ /trunk/ab5.0/abdev/BasicCompiler_Common/BasicCompiler.h	(revision 641)
@@ -28,5 +28,4 @@
 //デバッグ
 BOOL bDebugSupportProc;
-BOOL bSystemProc;
 DWORD dwStepRun;
 double width_ratio_VarList=0.3;
Index: /trunk/ab5.0/abdev/BasicCompiler_Common/Compile.cpp
===================================================================
--- /trunk/ab5.0/abdev/BasicCompiler_Common/Compile.cpp	(revision 640)
+++ /trunk/ab5.0/abdev/BasicCompiler_Common/Compile.cpp	(revision 641)
@@ -747,5 +747,11 @@
 			}
 
-			compiler.codeGenerator.NextSourceLine( SourceCodePosition( compiler.GetCurrentRelationalObjectModuleIndexForSource(), cp ) );
+			if( basbuf[cp] != '\0' )
+			{
+				compiler.codeGenerator.NextSourceLine(
+					SourceCodePosition( compiler.GetCurrentRelationalObjectModuleIndexForSource(), cp ),
+					compiler.GetCompilingUserProc().IsSystem()
+				);
+			}
 
 			if(Command[0]==1){
Index: /trunk/ab5.0/abdev/BasicCompiler_Common/Debug.cpp
===================================================================
--- /trunk/ab5.0/abdev/BasicCompiler_Common/Debug.cpp	(revision 640)
+++ /trunk/ab5.0/abdev/BasicCompiler_Common/Debug.cpp	(revision 641)
@@ -262,5 +262,6 @@
 	SendDlgItemMessage(hMainDlg,IDC_DEBUGLIST,EM_REPLACESEL,0,(LPARAM)buffer);
 }
-UserProc *GetSubFromObp(ULONG_PTR pos){
+UserProc *GetSubFromObp(ULONG_PTR pos)
+{
 	compiler.GetObjectModule().meta.GetUserProcs().Iterator_Reset();
 	while( compiler.GetObjectModule().meta.GetUserProcs().Iterator_HasNext() )
Index: /trunk/ab5.0/abdev/BasicCompiler_Common/include/CodeGenerator.h
===================================================================
--- /trunk/ab5.0/abdev/BasicCompiler_Common/include/CodeGenerator.h	(revision 640)
+++ /trunk/ab5.0/abdev/BasicCompiler_Common/include/CodeGenerator.h	(revision 641)
@@ -241,7 +241,7 @@
 	}
 
-	void NextSourceLine( const SourceCodePosition &sourceCodePosition )
-	{
-		pNativeCode->NextSourceLine( sourceCodePosition );
+	void NextSourceLine( const SourceCodePosition &sourceCodePosition, bool isInSystemProc )
+	{
+		pNativeCode->NextSourceLine( sourceCodePosition, isInSystemProc );
 	}
 
Index: /trunk/ab5.0/abdev/BasicCompiler_Common/src/Compiler.cpp
===================================================================
--- /trunk/ab5.0/abdev/BasicCompiler_Common/src/Compiler.cpp	(revision 640)
+++ /trunk/ab5.0/abdev/BasicCompiler_Common/src/Compiler.cpp	(revision 641)
@@ -402,31 +402,35 @@
 bool Compiler::IsGlobalAreaCompiling()
 {
-	return ( pCompilingUserProc == NULL );
+	if( pCompilingUserProc == NULL )
+	{
+		return true;
+	}
+	return ( pCompilingUserProc->GetName() == this->globalAreaProcName );
 }
 bool Compiler::IsLocalAreaCompiling()
 {
-	return ( pCompilingUserProc != NULL );
+	return !IsGlobalAreaCompiling();
 }
 const UserProc &Compiler::GetCompilingUserProc()
 {
-	if( !this->IsGlobalAreaCompiling() )
-	{
-		return *pCompilingUserProc;
+	if( pCompilingUserProc == NULL )
+	{
+		_ASSERTE( false );
+		throw;
+	}
+	return *pCompilingUserProc;
+}
+
+bool Compiler::IsCompilingClass()
+{
+	return ( pCompilingClass != NULL );
+}
+const CClass &Compiler::GetCompilingClass()
+{
+	if( this->IsCompilingClass() )
+	{
+		return *pCompilingClass;
 	}
 
 	throw;
 }
-
-bool Compiler::IsCompilingClass()
-{
-	return ( pCompilingClass != NULL );
-}
-const CClass &Compiler::GetCompilingClass()
-{
-	if( this->IsCompilingClass() )
-	{
-		return *pCompilingClass;
-	}
-
-	throw;
-}
Index: /trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Procedure.cpp
===================================================================
--- /trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Procedure.cpp	(revision 640)
+++ /trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Procedure.cpp	(revision 641)
@@ -915,5 +915,5 @@
 	importedNamespaces.clear();
 
-	compiler.globalAreaProcName = "_System_GlobalArea_" + compiler.GetModuleName();
+	compiler.globalAreaProcName = "_GlobalArea_" + compiler.GetModuleName();
 	sprintf(temporary,"%c%c%s()",1,ESC_SUB,compiler.globalAreaProcName.c_str());
 	UserProc *pUserProc = ParseUserProc( namespaceScopes, importedNamespaces, temporary, 0, false, NULL, false );
Index: /trunk/ab5.0/abdev/ab_common/include/Lexical/NativeCode.h
===================================================================
--- /trunk/ab5.0/abdev/ab_common/include/Lexical/NativeCode.h	(revision 640)
+++ /trunk/ab5.0/abdev/ab_common/include/Lexical/NativeCode.h	(revision 641)
@@ -244,5 +244,5 @@
 		return sourceLines;
 	}
-	void NextSourceLine( const SourceCodePosition &sourceCodePosition );
+	void NextSourceLine( const SourceCodePosition &sourceCodePosition, bool isInSystemProc );
 
 	void ResetDataSectionBaseOffset( long dataSectionBaseOffset );
Index: /trunk/ab5.0/abdev/ab_common/include/Lexical/Procedure.h
===================================================================
--- /trunk/ab5.0/abdev/ab_common/include/Lexical/Procedure.h	(revision 640)
+++ /trunk/ab5.0/abdev/ab_common/include/Lexical/Procedure.h	(revision 641)
@@ -136,5 +136,5 @@
 	// 各種フラグ
 	bool isExport;
-	mutable bool isSystem;
+	mutable bool isAutoGenerationSystem;
 	mutable bool isAutoGeneration;
 	mutable bool isCompiled;
@@ -180,5 +180,5 @@
 		ar & BOOST_SERIALIZATION_NVP( realSecondParmNum );
 		ar & BOOST_SERIALIZATION_NVP( isExport );
-		ar & BOOST_SERIALIZATION_NVP( isSystem );
+		ar & BOOST_SERIALIZATION_NVP( isAutoGenerationSystem );
 		ar & BOOST_SERIALIZATION_NVP( isAutoGeneration );
 		ar & BOOST_SERIALIZATION_NVP( isCompiled );
@@ -275,11 +275,11 @@
 		return isExport;
 	}
-	void ThisIsSystemProc() const
-	{
-		isSystem = true;
-	}
-	bool IsSystem() const
-	{
-		return isSystem;
+	void ThisIsAutoGenerationSystemProc() const
+	{
+		isAutoGenerationSystem = true;
+	}
+	bool IsAutoGenerationSystem() const
+	{
+		return isAutoGenerationSystem;
 	}
 	void ThisIsAutoGenerationProc() const
@@ -291,4 +291,5 @@
 		return isAutoGeneration;
 	}
+	bool IsSystem() const;
 	void CompleteCompile() const
 	{
Index: /trunk/ab5.0/abdev/ab_common/src/Lexical/NativeCode.cpp
===================================================================
--- /trunk/ab5.0/abdev/ab_common/src/Lexical/NativeCode.cpp	(revision 640)
+++ /trunk/ab5.0/abdev/ab_common/src/Lexical/NativeCode.cpp	(revision 641)
@@ -161,5 +161,5 @@
 }
 
-void NativeCode::NextSourceLine( const SourceCodePosition &sourceCodePosition )
+void NativeCode::NextSourceLine( const SourceCodePosition &sourceCodePosition, bool isInSystemProc )
 {
 	if( sourceLines.size() )
@@ -173,5 +173,4 @@
 
 	extern BOOL bDebugSupportProc;
-	extern BOOL bSystemProc;
 	DWORD sourceLineType = 0;
 	if( bDebugSupportProc )
@@ -179,5 +178,5 @@
 		sourceLineType |= CODETYPE_DEBUGPROC;
 	}
-	if( bSystemProc )
+	if( isInSystemProc )
 	{
 		sourceLineType |= CODETYPE_SYSTEMPROC;
Index: /trunk/ab5.0/abdev/ab_common/src/Lexical/Procedure.cpp
===================================================================
--- /trunk/ab5.0/abdev/ab_common/src/Lexical/Procedure.cpp	(revision 640)
+++ /trunk/ab5.0/abdev/ab_common/src/Lexical/Procedure.cpp	(revision 641)
@@ -44,5 +44,5 @@
 	, realSecondParmNum( 1 )
 	, isExport( isExport )
-	, isSystem( false )
+	, isAutoGenerationSystem( false )
 	, isAutoGeneration( false )
 	, isCompiled( false )
@@ -65,5 +65,5 @@
 	, realSecondParmNum( userProc.realSecondParmNum )
 	, isExport( userProc.isExport )
-	, isSystem( userProc.isSystem )
+	, isAutoGenerationSystem( userProc.isAutoGenerationSystem )
 	, isAutoGeneration( userProc.isAutoGeneration )
 	, isCompiled( false )
@@ -138,4 +138,23 @@
 	return false;
 }
+bool UserProc::IsSystem() const
+{
+	// "_System_" を名前の先頭に含む関数
+	if( memcmp( this->GetName().c_str(), "_System_", 8 ) == 0 )
+	{
+		return true;
+	}
+
+	// "_System_" を名前の先頭に含むクラスのメソッド
+	if( this->HasParentClass() )
+	{
+		if( memcmp( this->GetParentClass().GetName().c_str(), "_System_", 8 ) == 0 )
+		{
+			return true;
+		}
+	}
+
+	return false;
+}
 const NamespaceScopes &UserProc::GetNamespaceScopes() const
 {
Index: /trunk/ab5.0/abdev/ab_common/src/Lexical/Source.cpp
===================================================================
--- /trunk/ab5.0/abdev/ab_common/src/Lexical/Source.cpp	(revision 640)
+++ /trunk/ab5.0/abdev/ab_common/src/Lexical/Source.cpp	(revision 641)
@@ -900,5 +900,5 @@
 	}
 
-	if( includedFilesRelation.GetLineCounts() < i2 )
+	if( includedFilesRelation.GetLineCounts() <= i2 )
 	{
 		//Jenga::Throw( "BasicSource::GetLineInfoメソッドで不正な行の情報を取得しようとした" );
Index: /trunk/ab5.0/abdev/compiler_x86/Compile_ProcOp.cpp
===================================================================
--- /trunk/ab5.0/abdev/compiler_x86/Compile_ProcOp.cpp	(revision 640)
+++ /trunk/ab5.0/abdev/compiler_x86/Compile_ProcOp.cpp	(revision 641)
@@ -24,8 +24,4 @@
 		}
 
-		const UserProc *pBackUserProc;
-		pBackUserProc = &compiler.GetCompilingUserProc();
-		compiler.StartGlobalAreaCompile();
-
 		int BackCp;
 		BackCp=cp;
@@ -52,5 +48,4 @@
 		GetGlobalDataForDll();
 
-		compiler.SetCompilingUserProc( pBackUserProc );
 		cp=BackCp;
 
@@ -81,14 +76,9 @@
 		compiler.codeGenerator.op_ret();
 	}
-	else if( userProc.GetName() == "_System_Call_Destructor_of_GlobalObject" ){
-
-		const UserProc *pBackUserProc;
-		pBackUserProc = &compiler.GetCompilingUserProc();
-		compiler.StartGlobalAreaCompile();
-
+	else if( userProc.GetName() == "_System_Call_Destructor_of_GlobalObject" )
+	{
 		compiler.codeGenerator.lexicalScopes.CallDestructorsOfScopeEnd();
 
 		compiler.SetCompilingUserProc( pBackUserProc );
-
 
 		//ret
@@ -213,9 +203,10 @@
 	else if( userProc.GetName() == "RegisterGlobalRoots"
 		&& userProc.HasParentClass()
-		&& userProc.GetParentClass().GetName() == "_System_CGarbageCollection" ){
-
-			Compile_AddGlobalRootsForGc();
-	}
-	else if( userProc.GetName() == compiler.globalAreaProcName ){
+		&& userProc.GetParentClass().GetName() == "_System_CGarbageCollection" )
+	{
+		Compile_AddGlobalRootsForGc();
+	}
+	else if( userProc.GetName() == compiler.globalAreaProcName )
+	{
 		////////////////////////////////////////
 		// グローバル領域をコンパイル
@@ -223,7 +214,4 @@
 
 		UserProc::pGlobalProc = &userProc;
-
-		const UserProc *pBackUserProc = &compiler.GetCompilingUserProc();
-		compiler.StartGlobalAreaCompile();
 
 		int BackCp = cp;
@@ -251,5 +239,4 @@
 		}
 
-		compiler.SetCompilingUserProc( pBackUserProc );
 		cp=BackCp;
 	}
@@ -293,8 +280,4 @@
 	pUserProc->CompleteCompile();
 
-	extern BOOL bSystemProc;
-	if(memcmp(pUserProc->GetName().c_str(),"_System_",8)==0) bSystemProc=1;
-	else bSystemProc=0;
-
 	extern BOOL bDebugSupportProc;
 	if(memcmp(pUserProc->GetName().c_str(),"_DebugSys_",10)==0)
@@ -316,5 +299,5 @@
 	compiler.StartProcedureCompile( pUserProc );
 
-	if(pUserProc->IsSystem()){
+	if(pUserProc->IsAutoGenerationSystem()){
 		////////////////////
 		// 特殊関数
Index: /trunk/ab5.0/abdev/compiler_x86/Compile_Var.cpp
===================================================================
--- /trunk/ab5.0/abdev/compiler_x86/Compile_Var.cpp	(revision 640)
+++ /trunk/ab5.0/abdev/compiler_x86/Compile_Var.cpp	(revision 641)
@@ -1329,5 +1329,6 @@
 	}
 }
-void SetVarPtrToReg(int reg,RELATIVE_VAR *pRelativeVar){
+void SetVarPtrToReg(int reg,RELATIVE_VAR *pRelativeVar)
+{
 	if( reg != REG_EAX ){
 		compiler.errorMessenger.OutputFatalError();
@@ -1337,7 +1338,9 @@
 }
 
-bool Compile_AddGlobalRootsForGc(){
+bool Compile_AddGlobalRootsForGc()
+{
 	const UserProc *pUserProc_AddGlobalRootPtr = GetClassMethod( "_System_CGarbageCollection", "AddGlobalRootPtr" );
-	if( !pUserProc_AddGlobalRootPtr ){
+	if( !pUserProc_AddGlobalRootPtr )
+	{
 		compiler.errorMessenger.Output(3, "_System_CGarbageCollection.AddGlobalRootPtr", -1 );
 		return false;
Index: /trunk/ab5.0/abdev/compiler_x86/MakePeHdr.cpp
===================================================================
--- /trunk/ab5.0/abdev/compiler_x86/MakePeHdr.cpp	(revision 640)
+++ /trunk/ab5.0/abdev/compiler_x86/MakePeHdr.cpp	(revision 641)
@@ -260,20 +260,20 @@
 	if(pSub_System_GetEip=GetSubHash("_System_GetEip",1)){
 		pSub_System_GetEip->Using();
-		pSub_System_GetEip->ThisIsSystemProc();
+		pSub_System_GetEip->ThisIsAutoGenerationSystemProc();
 	}
 
 	if(pSub_System_InitDllGlobalVariables=GetSubHash("_System_InitDllGlobalVariables",1)){
 		pSub_System_InitDllGlobalVariables->Using();
-		pSub_System_InitDllGlobalVariables->ThisIsSystemProc();
+		pSub_System_InitDllGlobalVariables->ThisIsAutoGenerationSystemProc();
 	}
 
 	if(pSub_System_InitStaticLocalVariables=GetSubHash("_System_InitStaticLocalVariables",1)){
 		pSub_System_InitStaticLocalVariables->Using();
-		pSub_System_InitStaticLocalVariables->ThisIsSystemProc();
+		pSub_System_InitStaticLocalVariables->ThisIsAutoGenerationSystemProc();
 	}
 
 	if(pSub_System_Call_Destructor_of_GlobalObject=GetSubHash("_System_Call_Destructor_of_GlobalObject",1)){
 		pSub_System_Call_Destructor_of_GlobalObject->Using();
-		pSub_System_Call_Destructor_of_GlobalObject->ThisIsSystemProc();
+		pSub_System_Call_Destructor_of_GlobalObject->ThisIsAutoGenerationSystemProc();
 	}
 
@@ -329,33 +329,33 @@
 	pSub_allrem=GetSubHash("_allrem");
 	pSub_allrem->Using();
-	pSub_allrem->ThisIsSystemProc();
+	pSub_allrem->ThisIsAutoGenerationSystemProc();
 
 	pSub_aullrem=GetSubHash("_aullrem");
 	pSub_aullrem->Using();
-	pSub_aullrem->ThisIsSystemProc();
+	pSub_aullrem->ThisIsAutoGenerationSystemProc();
 
 	pSub_allmul=GetSubHash("_allmul");
 	pSub_allmul->Using();
-	pSub_allmul->ThisIsSystemProc();
+	pSub_allmul->ThisIsAutoGenerationSystemProc();
 
 	pSub_alldiv=GetSubHash("_alldiv");
 	pSub_alldiv->Using();
-	pSub_alldiv->ThisIsSystemProc();
+	pSub_alldiv->ThisIsAutoGenerationSystemProc();
 
 	pSub_aulldiv=GetSubHash("_aulldiv");
 	pSub_aulldiv->Using();
-	pSub_aulldiv->ThisIsSystemProc();
+	pSub_aulldiv->ThisIsAutoGenerationSystemProc();
 
 	pSub_allshl=GetSubHash("_allshl");
 	pSub_allshl->Using();
-	pSub_allshl->ThisIsSystemProc();
+	pSub_allshl->ThisIsAutoGenerationSystemProc();
 
 	pSub_allshr=GetSubHash("_allshr");
 	pSub_allshr->Using();
-	pSub_allshr->ThisIsSystemProc();
+	pSub_allshr->ThisIsAutoGenerationSystemProc();
 
 	pSub_aullshr=GetSubHash("_aullshr");
 	pSub_aullshr->Using();
-	pSub_aullshr->ThisIsSystemProc();
+	pSub_aullshr->ThisIsAutoGenerationSystemProc();
 
 	pSub_esp_error=GetSubHash("_esp_error");
