Index: Include/Classes/System/Diagnostics/Trace.ab
===================================================================
--- Include/Classes/System/Diagnostics/Trace.ab	(revision 55)
+++ Include/Classes/System/Diagnostics/Trace.ab	(revision 58)
@@ -1,10 +1,20 @@
 
-' リスナ
-Class TraceListener
-End Class
 
 ' リスナコレクション
 Class TraceListenerCollection
+	ppListeners As **TraceListener
+	count As Long
 Public
+
+	Sub TraceListenerCollection()
+		ppListeners = _System_malloc( 1 )
+	End Sub
+	Sub ~TraceListenerCollection()
+		Dim i As Long
+		For i = 0 To ELM( count )
+			Delete ppListeners[i]
+		Next
+		_System_free( ppListeners )
+	End Sub
 
 	'----------------------------------------------------------------
@@ -13,12 +23,14 @@
 
 	' リスナを追加
-	Function Add( listener As TraceListener )
-		' TODO: 実装
-	End Function
+	Sub Add( listener As TraceListener ) As Long
+		ppListeners = _System_realloc( ppListeners, ( count + 1 ) * SizeOf( *TraceListener ) )
+		ppListeners[count] = New TraceListener( listener )
+		count++
+	End Sub
 
 	' 複数のリスナを追加
 	Sub AddRange( listeners As TraceListenerCollection )
 		' TODO: 実装
-	End Function
+	End Sub
 
 	' リストからすべてのリスナを削除
@@ -50,12 +62,18 @@
 	'----------------------------------------------------------------
 
+	' インデクサ ( Getter )
+	Function Operator[] ( index As Long ) As TraceListener
+		If index < 0 or count <= index Then
+			' TODO: エラー処理
+			debug
+		End If
+
+		Dim tempListener As TraceListener( ByVal ppListeners[index] )
+		Return tempListener
+	End Function
+
 	' 保有するリスナの数を取得する
 	Function Count() As Long
-		' TODO: 実装
-	End Function
-
-	' リスナを取得する
-	Function Item( index As Long ) As TraceListener
-		' TODO: 実装
+		Return count
 	End Function
 End Class
@@ -65,19 +83,7 @@
 	Static indentSize = 4 As Long
 
-	Static Function GetIndentString() As String
-		Dim i As Long
 
-		Dim IndentStr = ""
-		For i = 0 To ELM( indentSize )
-			IndentStr = IndentStr + " "
-		Next
-
-		Dim ResultStr = ""
-		For i = 0 To ELM( indentLevel )
-			ResultStr = ResultStr + IndentStr
-		Next
-
-		Return ResultStr
-	End Function
+	' リスナ管理
+	Static Listeners As TraceListenerCollection
 
 Public
@@ -113,5 +119,5 @@
 	' インデントレベルを上げる
 	Static Sub Indent()
-		indentLevel++
+		IndentLevel = indentLevel + 1
 	End Sub
 
@@ -122,12 +128,19 @@
 			Return
 		End If
-		indentLevel--
+		IndentLevel = indentLevel - 1
+	End Sub
+
+	Static Sub Write( message As String )
+		
 	End Sub
 
 	' 一行の文字列を出力
 	Static Sub WriteLine( message As String )
-		Dim tempmsg = GetIndentString() + message + Ex"\n"
-
-		' TODO: リスナへの出力を実装
+		Dim i As Long
+		For i = 0 To ELM( Listeners.Count )
+			Dim temp As TraceListener
+			temp = Listeners[i]
+			temp.WriteLine( message )
+		Next
 	End Sub
 
@@ -141,6 +154,13 @@
 		Return indentLevel
 	End Function
-	Static Sub IndentLevel( level As Long )
-		indentLevel = level
+	Static Sub IndentLevel( indentLevel As Long )
+		This.indentLevel = indentLevel
+
+		Dim i As Long
+		For i = 0 To ELM( Listeners.Count )
+			Dim temp As TraceListener
+			temp = Listeners[i]
+			temp.IndentLevel = indentLevel
+		Next
 	End Sub
 
@@ -151,12 +171,11 @@
 	Static Sub IndentSize( size As Long )
 		indentSize = size
-	End Sub
 
-	' Listenersプロパティ
-	Static Function Listeners() As TraceListenerCollection
-		Return listeners
-	End Function
-	Static Sub Listeners( listeners As TraceListenerCollection )
-		This.listeners = listeners
+		Dim i As Long
+		For i = 0 To ELM( Listeners.Count )
+			Dim temp As TraceListener
+			temp = Listeners[i]
+			temp.IndentSize = indentSize
+		Next
 	End Sub
 
Index: Include/Classes/System/Diagnostics/TraceListener.ab
===================================================================
--- Include/Classes/System/Diagnostics/TraceListener.ab	(revision 58)
+++ Include/Classes/System/Diagnostics/TraceListener.ab	(revision 58)
@@ -0,0 +1,105 @@
+
+' リスナ
+Class TraceListener
+	indentLevel As Long
+	indentSize As Long
+
+Protected
+	Function GetIndentString() As String
+		Dim i As Long
+
+		Dim IndentStr = ""
+		For i = 0 To ELM( indentSize )
+			IndentStr = IndentStr + " "
+		Next
+
+		Dim ResultStr = ""
+		For i = 0 To ELM( indentLevel )
+			ResultStr = ResultStr + IndentStr
+		Next
+
+		Return ResultStr
+	End Function
+
+Public
+	Sub TraceListener()
+		indentLevel = 0
+		indentSize = 4
+	End Sub
+
+	' コピーコンストラクタ
+	Sub TraceListener( ByRef listener As TraceListener )
+		memcpy( VarPtr( This ), VarPtr( listener ), SizeOf( TraceListener ) )
+	End Sub
+
+
+	'----------------------------------------------------------------
+	' パブリック コンストラクタ
+	'----------------------------------------------------------------
+
+	Virtual Sub Write( message As String )
+		'派生クラスで実装 (基底では何もしない）
+	End Sub
+	Virtual Sub Write( o As Object )
+		Write( o.ToString() )
+	End Sub
+	Virtual Sub Write( o As Object, category As String )
+		Write( category + ": " + o.ToString() )
+	End Sub
+	Virtual Sub Write( message As String, category As String )
+		Write( category + ": " + message )
+	End Sub
+
+	Virtual Sub WriteLine( message As String )
+		'派生クラスで実装 (基底では何もしない）
+	End Sub
+	Virtual Sub WriteLine( o As Object )
+		WriteLine( o.ToString() )
+	End Sub
+	Virtual Sub WriteLine( o As Object, category As String )
+		WriteLine( category + ": " + o.ToString() )
+	End Sub
+	Virtual Sub WriteLine( message As String, category As String )
+		WriteLine( category + ": " + message )
+	End Sub
+
+
+	'----------------------------------------------------------------
+	' パブリック プロパティ
+	'----------------------------------------------------------------
+
+	' IndentLevelプロパティ
+	Function IndentLevel() As Long
+		Return indentLevel
+	End Function
+	Sub IndentLevel( indentLevel As Long )
+		This.indentLevel = indentLevel
+	End Sub
+
+	' IndentSizeプロパティ
+	Function IndentSize() As Long
+		Return indentSize
+	End Function
+	Sub IndentSize( size As Long )
+		indentSize = size
+	End Sub
+End Class
+
+' デフォルトリスナ（デバッガビューへの出力）
+Class DefaultTraceListener
+	Inherits TraceListener
+Public
+
+	Override Sub Write( message As String )
+		' デバッグビューへ出力
+		Dim tempStr = GetIndentString() + message
+		OutputDebugString( tempStr )
+
+		' デバッグログへ書き込む
+		' TODO: 実装
+	End Sub
+
+	Override Sub WriteLine( message As String )
+		Write( GetIndentString() + message + Ex"\r\n" )
+	End Sub
+End Class
Index: Include/Classes/System/Diagnostics/index.ab
===================================================================
--- Include/Classes/System/Diagnostics/index.ab	(revision 58)
+++ Include/Classes/System/Diagnostics/index.ab	(revision 58)
@@ -0,0 +1,3 @@
+#include "Debug.ab"
+#include "Trace.ab"
+#include "TraceListener.ab"
Index: Include/Classes/System/Object.ab
===================================================================
--- Include/Classes/System/Object.ab	(revision 55)
+++ Include/Classes/System/Object.ab	(revision 58)
@@ -1,4 +1,9 @@
 Class Object
 Public
+
+	Sub Object()
+	End Sub
+	Sub ~Object()
+	End Sub
 
 	' 2つのオブジェクトが等しいかどうかを判断する
Index: Include/Classes/System/Threading/Thread.ab
===================================================================
--- Include/Classes/System/Threading/Thread.ab	(revision 55)
+++ Include/Classes/System/Threading/Thread.ab	(revision 58)
@@ -1,4 +1,8 @@
 'threading.sbp
 
+
+'--------------------------------------------------------------------
+' スレッドの優先順位
+'--------------------------------------------------------------------
 Enum ThreadPriority
 	Highest =      2
@@ -11,4 +15,8 @@
 TypeDef PTHREAD_START_ROUTINE = *Function(args As VoidPtr) As DWord
 
+
+'--------------------------------------------------------------------
+' スレッド クラス
+'--------------------------------------------------------------------
 Class Thread
 	m_hThread As HANDLE
@@ -19,4 +27,5 @@
 	m_fp As PTHREAD_START_ROUTINE
 	m_args As VoidPtr
+
 Public
 	Sub Thread()
@@ -137,4 +146,7 @@
 		Return GetThreadContext(m_hThread,Context)
 	End Function
+	Function __SetContext(ByRef Context As CONTEXT) As BOOL
+		Return SetThreadContext(m_hThread,Context)
+	End Function
 
 
@@ -147,5 +159,8 @@
 
 
-'すべてのスレッドの管理
+'--------------------------------------------------------------------
+' すべてのスレッドの管理
+'--------------------------------------------------------------------
+' TODO: このクラスをシングルトンにする
 Class _System_CThreadCollection
 Public
@@ -159,4 +174,5 @@
 		ppobj_Thread=HeapAlloc(_System_hProcessHeap,0,1)
 		pStackBase=HeapAlloc(_System_hProcessHeap,0,1)
+		ppException=HeapAlloc(_System_hProcessHeap,0,1)
 		ThreadNum=0
 
@@ -175,4 +191,7 @@
 		pStackBase=0
 
+		HeapFree(_System_hProcessHeap,0,ppException)
+		ppException = 0
+
 		ThreadNum=0
 
@@ -185,21 +204,29 @@
 		EnterCriticalSection(CriticalSection)
 
+			'スレッドオブジェクトを生成
 			Dim pobj_NewThread As *Thread
 			pobj_NewThread=New Thread(obj_Thread)
 
+			'例外処理管理用オブジェクトを生成
+			Dim pException As *ExceptionService
+			pException = New ExceptionService
+
 			Dim i As Long
 			For i=0 To ELM(ThreadNum)
-				If ppobj_Thread[i]=0 Then
-					ppobj_Thread[i]=pobj_NewThread
-					pStackBase[i]=NowSp
+				If ppobj_Thread[i] = 0 Then
+					ppobj_Thread[i] = pobj_NewThread
+					pStackBase[i] = NowSp
+					ppException[i] = pException
 					Exit For
 				End If
 			Next
 
-			If i=ThreadNum Then
+			If i = ThreadNum Then
 				ppobj_Thread=HeapReAlloc(_System_hProcessHeap,0,ppobj_Thread,(ThreadNum+1)*SizeOf(*Thread))
 				ppobj_Thread[ThreadNum]=pobj_NewThread
 				pStackBase=HeapReAlloc(_System_hProcessHeap,0,pStackBase,(ThreadNum+1)*SizeOf(LONG_PTR))
 				pStackBase[ThreadNum]=NowSp
+				ppException=HeapReAlloc(_System_hProcessHeap,0,ppException,(ThreadNum+1)*SizeOf(*ExceptionService))
+				ppException[ThreadNum]=pException
 				ThreadNum++
 			End If
@@ -242,5 +269,5 @@
 	End Sub
 
-
+	'カレントスレッドを取得
 	Function CurrentThread(ByRef obj_Thread As Thread) As BOOL
 		Dim dwNowThreadId As DWord
@@ -257,4 +284,26 @@
 		Return 0
 	End Function
+
+
+Private
+	'------------------------------------------
+	' スレッド固有の例外処理制御
+	'------------------------------------------
+	ppException As **ExceptionService
+
+Public
+	Function GetCurrentException() As *ExceptionService
+		Dim dwNowThreadId As DWord
+		dwNowThreadId=GetCurrentThreadId()
+
+		Dim i As Long
+		For i=0 To ELM(ThreadNum)
+			If ppobj_Thread[i]->ThreadId=dwNowThreadId Then
+				Return ppException[i]
+			End If
+		Next
+
+		Return NULL
+	End Function
 End Class
 Dim _System_pobj_AllThreads As *_System_CThreadCollection
Index: Include/Classes/System/Threading/WaitHandle.ab
===================================================================
--- Include/Classes/System/Threading/WaitHandle.ab	(revision 55)
+++ Include/Classes/System/Threading/WaitHandle.ab	(revision 58)
@@ -99,5 +99,5 @@
 				ExitThread(0)
 		End Select
-	End Sub
+	End Function
 End Class
 
Index: Include/Classes/System/Threading/index.ab
===================================================================
--- Include/Classes/System/Threading/index.ab	(revision 58)
+++ Include/Classes/System/Threading/index.ab	(revision 58)
@@ -0,0 +1,2 @@
+#require "Thread.ab"
+#require "WaitHandle.ab"
Index: Include/Classes/System/index.ab
===================================================================
--- Include/Classes/System/index.ab	(revision 58)
+++ Include/Classes/System/index.ab	(revision 58)
@@ -0,0 +1,4 @@
+#require "DateTime.ab"
+#require "Math.ab"
+#require "Object.ab"
+#require "String.ab"
