Changeset 422 for trunk/Include/system
- Timestamp:
- Feb 25, 2008, 11:00:24 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Include/system/exception.ab
r411 r422 93 93 94 94 Class ExceptionService 95 ppTryLayers As **TryLayer 96 nTryLayers As Long 95 tryLayers As System.Collections.Generic.List<TryLayer> 97 96 98 97 Sub FreeLocalObjects() … … 102 101 103 102 Sub ExceptionService() 104 ppTryLayers = _System_malloc( 1 ) 105 nTryLayers = 0 103 tryLayers = New System.Collections.Generic.List<TryLayer> 106 104 End Sub 107 105 Sub ~ExceptionService() 108 Dim i As Long109 For i = 0 To ELM( nTryLayers )110 Delete ppTryLayers[i]111 Next112 _System_free( ppTryLayers )113 ppTryLayers = 0114 106 End Sub 115 107 116 108 'Try 117 109 Function _BeginTryScope( catchTable As *LONG_PTR, addressOfFinally As VoidPtr, basePtr As LONG_PTR, stackPtr As LONG_PTR ) As TryLayer 118 ppTryLayers = _System_realloc( ppTryLayers, ( nTryLayers + 1 ) * SizeOf( *TryLayer ) ) 119 ppTryLayers[nTryLayers] = New TryLayer( catchTable, addressOfFinally, basePtr, stackPtr ) 120 nTryLayers++ 121 122 Return ByVal ppTryLayers[nTryLayers-1] 110 Dim tryLayer = New TryLayer( catchTable, addressOfFinally, basePtr, stackPtr ) 111 tryLayers.Add( tryLayer ) 112 113 Return tryLayer 123 114 End Function 124 115 … … 129 120 'End Try 130 121 Sub EndTryScope() 131 nTryLayers-- 132 Delete ppTryLayers[nTryLayers] 122 tryLayers.RemoveAt( tryLayers.Count - 1 ) 133 123 End Sub 134 124 135 125 'Throw 136 126 Sub _Throw( ex As Object ) 137 If nTryLayers<= 0 then127 If tryLayers.Count <= 0 then 138 128 '例外処理スコープ制御が無効なとき 139 129 … … 151 141 FreeLocalObjects() 152 142 153 Dim pTryLayer = ppTryLayers[nTryLayers - 1] As *TryLayer154 155 Dim addressOfCatch = pTryLayer->ResolveCatchesOverload( ex ) As LONG_PTR143 Dim tryLayer = tryLayers[tryLayers.Count - 1] 144 145 Dim addressOfCatch = tryLayer.ResolveCatchesOverload( ex ) As LONG_PTR 156 146 If addressOfCatch = NULL Then 157 147 ' Catchが定義されていないときはFinallyへ誘導 158 addressOfCatch = pTryLayer->addressOfFinally As LONG_PTR148 addressOfCatch = tryLayer.addressOfFinally As LONG_PTR 159 149 End If 160 150 … … 174 164 #ifdef _WIN64 175 165 context.Rip = addressOfCatch As QWord 176 context.Rbp = pTryLayer->basePtr177 context.Rsp = pTryLayer->stackPtr166 context.Rbp = tryLayer.basePtr 167 context.Rsp = tryLayer.stackPtr 178 168 #else 179 169 context.Eip = addressOfCatch As DWord 180 context.Ebp = pTryLayer->basePtr181 context.Esp = pTryLayer->stackPtr170 context.Ebp = tryLayer.basePtr 171 context.Esp = tryLayer.stackPtr 182 172 #endif 183 173 … … 186 176 ThreadNum=_DebugSys_GetThread() 187 177 If ThreadNum <> -1 Then 188 _DebugSys_ProcNum[ThreadNum] = pTryLayer->debugProcNum-1178 _DebugSys_ProcNum[ThreadNum] = tryLayer.debugProcNum-1 189 179 End If 190 180 #endif … … 205 195 206 196 Sub FinishFinally() 207 Dim pTryLayer = ppTryLayers[nTryLayers - 1] As *TryLayer208 pTryLayer->FinishFinally()197 Dim tryLayer = tryLayers[tryLayers.Count - 1] 198 tryLayer.FinishFinally() 209 199 End Sub 210 200 End Class
Note:
See TracChangeset
for help on using the changeset viewer.