Changeset 203
- Timestamp:
- Apr 4, 2007, 6:53:48 PM (18 years ago)
- Location:
- Include
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/Classes/System/Collections/ArrayList.ab
r195 r203 37 37 Debug 38 38 End If 39 capacity = size 39 40 End Sub 40 41 … … 42 43 If This.capacity < capacity Then 43 44 This.capacity = capacity 44 Realloc( capacity)45 Realloc(capacity) 45 46 End If 46 47 End Sub … … 96 97 /*Override*/ Virtual Sub Operator []=(index As Long, object As Object) 97 98 If 0 <= index And index < size Then 98 pObject[i ] = object99 pObject[index] = object 99 100 Else 100 101 'Throw OutOfRangeException? … … 114 115 End Sub 115 116 /* 116 Sub ArrayList( ByRefc As ICollection)117 Sub ArrayList(c As ICollection) 117 118 ' 未実装 118 119 Debug … … 127 128 End Sub 128 129 129 ' Sub Operator =( ByRefa As ArrayList)130 ' Sub Operator =(a As ArrayList) 130 131 131 132 /*Override*/ Virtual Function Add( object As Object ) As Long … … 136 137 End Function 137 138 138 Virtual Sub AddRange(ByRef c As ICollection) 139 ' TODO: 実装 140 End Sub 141 142 Const Virtual Function BinarySearch(x As *Object) 143 ' TODO: 実装 144 End Function 145 146 Const Virtual Function BinarySearch(x As *Object, ByRef c As IComparer) As Long 147 ' TODO: 実装 148 End Function 149 150 Const Virtual Function BinarySearch(index As Long, count As Long, x As *Object, ByRef c As IComparer) As Long 151 ' TODO: 実装 139 Virtual Sub AddRange(c As ICollection) 140 ' TODO: 実装 141 End Sub 142 143 Const Virtual Function BinarySearch(x As Object) 144 ' TODO: 実装 145 End Function 146 147 Const Virtual Function BinarySearch(x As Object, c As IComparer) As Long 148 Return BinarySearch(0, size, x, c) 149 End Function 150 151 Const Virtual Function BinarySearch(index As Long, count As Long, x As Object, c As IComparer) As Long 152 Dim l = index 153 Dim r = index + ELM(count) 154 While l <= r 155 Dim mid = (l + r) >> 2 156 Dim ret = c.Compare(pObject[mid], x) 157 If ret = 0 Then 158 Return mid 159 Else If ret < 0 Then 'pObject[mid] < x 160 If l = r Then 161 If mid + 1 <= index + ELM(count) Then 162 Return Not (mid + 1) 163 Else 164 Return count 165 End If 166 End If 167 l = mid + 1 168 Else 'pObject[mid] > x 169 If l = r And mid + 1 <= index + ELM(count) Then 170 Return Not mid 171 End If 172 r = mid - 1 173 End If 174 Wend 175 If l = index Then 176 Return Not index 177 Else 'r = index + ELM(count) 178 Return Not count 179 End If 152 180 End Function 153 181 … … 172 200 173 201 ' CopyTo 174 /*Const*/ /*Override*/ Virtual Function GetEnumerator() As *IEnumerator 175 'Return GetEnumerator(index, count) 176 End Function 177 178 Const Virtual Function GetEnumerator(index As Long, count As Long) As *IEnumerator 179 ' TODO: 実装 180 End Function 181 182 Virtual Function GetRange(index As Long, count As Long) As *ArrayList 202 203 ' 204 ' /*Const*/ /*Override*/ Virtual Function GetEnumerator() As IEnumerator 205 ' 'Return GetEnumerator(index, count) 206 ' End Function 207 208 ' Const Virtual Function GetEnumerator(index As Long, count As Long) As IEnumerator 209 ' ' TODO: 実装 210 ' End Function 211 212 Virtual Function GetRange(index As Long, count As Long) As ArrayList 183 213 ' TODO: 実装 184 214 End Function … … 210 240 End Sub 211 241 212 Virtual Sub InsertRange(index As Long, ByRefc As ICollection)242 Virtual Sub InsertRange(index As Long, c As ICollection) 213 243 ' TODO: 実装 214 244 End Sub … … 253 283 End Sub 254 284 255 Virtual Sub SetRange(index As Long, ByRefc As ICollection)285 Virtual Sub SetRange(index As Long, c As ICollection) 256 286 ' TODO: 実装 257 287 End Sub … … 261 291 End Sub 262 292 263 Virtual Sub Sort( ByRefc As IComparer)293 Virtual Sub Sort(c As IComparer) 264 294 Sort(0, size, c) 265 295 End Sub 266 296 267 Virtual Sub Sort(index As Long, count As Long, ByRefc As IComparer)297 Virtual Sub Sort(index As Long, count As Long, c As IComparer) 268 298 ' TODO: 実装 269 299 End Sub … … 280 310 ' -------------------------------- 281 311 ' static methods 282 Static Function Adapter( ByRef l As IList) As *ArrayList283 ' TODO: 実装 284 End Function 285 286 Static Function FixedSize( ByRef l As ArrayList) As *ArrayList287 ' TODO: 実装 288 End Function 289 290 Static Function FixedSize( ByRef l As IList) As *IList312 Static Function Adapter(l As IList) As ArrayList 313 ' TODO: 実装 314 End Function 315 316 Static Function FixedSize(l As ArrayList) As ArrayList 317 ' TODO: 実装 318 End Function 319 320 Static Function FixedSize(l As IList) As IList 291 321 Return FixedSize(Adapter(VarPtr(i))) 292 322 End Function 293 323 294 Static Function ReadOnly( ByRef l As ArrayList) As *ArrayList295 ' TODO: 実装 296 End Function 297 298 Static Function ReadOnly( ByRef l As IList) As *IList324 Static Function ReadOnly(l As ArrayList) As ArrayList 325 ' TODO: 実装 326 End Function 327 328 Static Function ReadOnly(l As IList) As IList 299 329 Return ReadOnly(Adapter(VarPtr(i))) 300 330 End Function 301 331 302 Static Function Repeat( ByRef x As Object, c As Long) As *ArrayList332 Static Function Repeat(x As Object, c As Long) As ArrayList 303 333 Repeat = New ArrayList(c) 304 334 Dim i As Long … … 308 338 End Function 309 339 310 Static Function Synchronized( ByRef l As ArrayList) As *ArrayList311 ' TODO: 実装 312 End Function 313 314 Static Function Synchronized( ByRef l As IList) As *IList340 Static Function Synchronized(l As ArrayList) As ArrayList 341 ' TODO: 実装 342 End Function 343 344 Static Function Synchronized(l As IList) As IList 315 345 Return Synchronized(Adapter(VarPtr(i))) 316 346 End Function -
Include/Classes/System/String.ab
r193 r203 16 16 17 17 Class String 18 ' Inherits IComparable, ICloneable, IConvertible, IEnumerable 19 18 20 m_Length As Long 19 21 Public … … 21 23 22 24 Sub String() 23 Chars = _System_malloc(SizeOf (StrChar)) '025 Chars = _System_malloc(SizeOf (StrChar)) 24 26 Chars[0] = 0 25 27 m_Length = 0 … … 129 131 End Function 130 132 131 Const Function Operator + ( ByRefobjString As String) As String133 Const Function Operator + (objString As String) As String 132 134 Return Concat(objString.Chars, objString.m_Length) 133 135 End Function … … 143 145 End Function 144 146 145 Const Function Operator & ( ByRefobjString As String) As String147 Const Function Operator & (objString As String) As String 146 148 Dim tempString = This + objString 147 149 Return tempString 148 150 End Function 149 151 150 Const Function Operator == ( ByRefobjString As String) As Boolean151 Return _System_StrCmp(This.Chars, objString.Chars) = 0152 Const Function Operator == (objString As String) As Boolean 153 Return String.Compare(This, objString) = 0 152 154 End Function 153 155 … … 156 158 End Function 157 159 158 Const Function Operator <> ( ByRefobjString As String) As Boolean159 Return _System_StrCmp(This.Chars, objString.Chars) <> 0160 Const Function Operator <> (objString As String) As Boolean 161 Return String.Compare(This, objString) <> 0 160 162 End Function 161 163 … … 164 166 End Function 165 167 166 Const Function Operator < ( ByRefobjString As String) As Boolean167 Return _System_StrCmp(This.Chars, objString.Chars) < 0168 Const Function Operator < (objString As String) As Boolean 169 Return String.Compare(This, objString) < 0 168 170 End Function 169 171 … … 172 174 End Function 173 175 174 Const Function Operator > ( ByRefobjString As String) As Boolean175 Return _System_StrCmp(This.Chars, objString.Chars) > 0176 Const Function Operator > (objString As String) As Boolean 177 Return String.Compare(This, objString) > 0 176 178 End Function 177 179 … … 180 182 End Function 181 183 182 Const Function Operator <= ( ByRefobjString As String) As Boolean183 Return _System_StrCmp(This.Chars, objString.Chars) <= 0184 Const Function Operator <= (objString As String) As Boolean 185 Return String.Compare(This, objString) <= 0 184 186 End Function 185 187 … … 188 190 End Function 189 191 190 Const Function Operator >= ( ByRefobjString As String) As Boolean191 Return _System_StrCmp(This.Chars, objString.Chars) >= 0192 Const Function Operator >= (objString As String) As Boolean 193 Return String.Compare(This, objString) >= 0 192 194 End Function 193 195 194 196 Const Function Operator >= (text As *StrChar) As Boolean 195 197 Return _System_StrCmp(This.Chars, text) >= 0 198 End Function 199 200 Static Function Compare(x As String, y As String) As Long 201 Return CompareOrdinal(x, y) 202 End Function 203 204 Static Function Compare(x As String, indexX As Long, y As String, indexY As Long, length As Long) As Long 205 Return CompareOrdinal(x, indexX, y, indexY, length) 206 End Function 207 208 Static Function CompareOrdinal(x As String, y As String) As Long 209 Return _System_StrCmp(x.Chars, y.Chars) 210 End Function 211 212 Static Function CompareOrdinal(x As String, indexX As Long, y As String, indexY As Long, length As Long) As Long 213 If x = Nothing Then 214 If y = Nothing Then 215 Return 0 216 Else 217 Return -1 218 End If 219 ElseIf y = Nothing Then 220 Return 1 221 End If 222 Return _System_StrCmpN(VarPtr(x.Chars[indexX]), VarPtr(y.Chars[indexY]), length) 223 End Function 224 225 Function CompareTo(y As String) As Long 226 Return String.Compare(This, y) 227 End Function 228 229 Function CompareTo(y As Object) As Long 230 Dim s = y As String 231 ' If y is not String Then 232 ' Throw New ArgumentException 233 ' End If 234 Return CompareTo(y) 196 235 End Function 197 236 … … 341 380 #endif 342 381 End Function 343 Const Function Contains(ByRef objString As String) As Boolean 382 383 Static Function Concat(x As String, y As String) As String 384 If x = Nothing Then 385 Return y 386 Else 387 Return x.Concat(objString.Chars, objString.m_Length) 388 End If 389 End Function 390 391 Static Function Concat(x As Object, y As Object) As String 392 Return String.Concat(x.ToString, y.ToString) 393 End Function 394 395 Const Function Contains(objString As String) As Boolean 344 396 Return IndexOf(objString, 0, m_Length) >= 0 345 397 End Function -
Include/basic/function.sbp
r192 r203 1169 1169 End Function 1170 1170 1171 1172 1171 Function _System_StrCmp(s1 As PCSTR, s2 As PCSTR) As Long 1173 1172 Dim i = 0 As SIZE_T … … 1192 1191 End Function 1193 1192 1193 Function _System_StrCmpN(s1 As PCSTR, s2 As PCSTR, size As SIZE_T) As Long 1194 Dim i = 0 As SIZE_T 1195 For i = 0 To ELM(size) 1196 _System_StrCmp = s1[i] - s2[i] 1197 If _System_StrCmp <> 0 Then 1198 Exit Function 1199 End If 1200 Next 1201 End Function 1202 1203 Function _System_StrCmpN(s1 As PCWSTR, s2 As PCWSTR, size As SIZE_T) As Long 1204 Dim i = 0 As SIZE_T 1205 For i = 0 To ELM(size) 1206 _System_StrCmp = s1[i] - s2[i] 1207 If _System_StrCmp <> 0 Then 1208 Exit Function 1209 End If 1210 Next 1211 End Function 1212 1213 Function _System_MemChr(s As PCSTR, c As CHAR, size As SIZE_T) As PCSTR 1214 Dim i As SIZE_T 1215 For i = 0 To ELM(size) 1216 If s[i] = c Then 1217 Return VarPtr(s[i]) 1218 End If 1219 Next 1220 Return 0 1221 End Function 1222 1223 Function _System_MemChr(s As PCWSTR, c As WCHAR, size As SIZE_T) As PCWSTR 1224 Dim i As SIZE_T 1225 For i = 0 To ELM(size) 1226 If s[i] = c Then 1227 Return VarPtr(s[i]) 1228 End If 1229 Next 1230 Return 0 1231 End Function 1232 1233 Function _System_MemPBrk(str As PCSTR, cStr As SIZE_T, Chars As PCSTR, cChars As SIZE_T) As PCSTR 1234 Dim i As SIZE_T 1235 For i = 0 To ELM(cStr) 1236 If _System_MemChr(Chars, str[i], cChars) Then 1237 Return VarPtr(str[i]) 1238 End If 1239 Next 1240 Return 0 1241 End Function 1242 1243 Function _System_MemPBrk(str As PCWSTR, cStr As SIZE_T, Chars As PCWSTR, cChars As SIZE_T) As PCWSTR 1244 Dim i As SIZE_T 1245 For i = 0 To ELM(cStr) 1246 If _System_MemChr(Chars, str[i], cChars) Then 1247 Return VarPtr(str[i]) 1248 End If 1249 Next 1250 Return 0 1251 End Function 1252 1194 1253 Function _System_GetHashFromWordArray(p As *Word, n As SIZE_T) As Long 1195 1254 Dim hash = 0 As DWord -
Include/system/gc.sbp
r202 r203 139 139 140 140 Function __malloc(size As SIZE_T,flags As Byte) As VoidPtr 141 EnterCriticalSection(CriticalSection)141 ' EnterCriticalSection(CriticalSection) 142 142 Dim dwFlags As DWord 143 143 If flags and _System_GC_FLAG_INITZERO Then … … 149 149 Dim ptr = HeapAlloc(_System_hProcessHeap,dwFlags,size) 150 150 add( ptr, size, flags ) 151 LeaveCriticalSection(CriticalSection)151 ' LeaveCriticalSection(CriticalSection) 152 152 153 153 Return ptr … … 202 202 Exit Sub 203 203 End If 204 isSweeping = True205 204 OutputDebugString( Ex"garbage colletion sweep start!\r\n" ) 206 205 … … 351 350 ExitThread(0) 352 351 End If 352 isSweeping = True 353 353 354 354 ' すべてのスレッドを一時停止
Note:
See TracChangeset
for help on using the changeset viewer.