- Location:
- /Include
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
/Include/Classes/System/Drawing/Color.ab
r20 r30 18 18 Public 19 19 Sub Color() 20 Argb = 0 ' Black 20 argb = MakeARGB(255, 0, 0, 0) ' Black 21 End Sub 22 23 Sub Color(ByRef c As Color) 24 argb = c.argb 21 25 End Sub 22 26 … … 26 30 27 31 Sub Color(a As Byte, r As Byte, g As Byte, b As Byte) 28 Argb = MakeARGB(a, r, g, b)29 End Sub 30 31 Sub Color( argb As ARGB)32 Argb = argb32 argb = MakeARGB(a, r, g, b) 33 End Sub 34 35 Sub Color(newArgb As ARGB) 36 argb = newArgb 33 37 End Sub 34 38 35 39 Sub Operator =(c As Color) 36 SetValue(c)40 argb = c.argb 37 41 End Sub 38 42 … … 61 65 End Function 62 66 63 Function GetValue() As ARGB64 GetValue =argb65 End Function 66 67 Sub SetValue(value As ARGB)67 Function Value() As ARGB 68 Return argb 69 End Function 70 71 Sub Value(value As ARGB) 68 72 argb = value 69 73 End Sub 70 74 71 75 Sub SetFromCOLORREF(rgb As COLORREF) 72 argb = Color_MakeARGB(255, GetRValue(rgb), GetGValue(rgb), GetBValue(rgb)) 76 If (rgb And &hff000000) = &h01000000 Then 77 Exit Sub ' インデックス指定は無効 78 Else 79 argb = Color_MakeARGB(255, GetRValue(rgb), GetGValue(rgb), GetBValue(rgb)) 80 End If 73 81 End Sub 74 82 … … 91 99 End Function 92 100 93 Static Function FromArgb(r As Byte, g As Byte, b As Byte) 101 Static Function FromArgb(r As Byte, g As Byte, b As Byte) As Color 94 102 Dim c As Color(r, g, b) 95 103 Return c 96 104 End Function 97 105 98 Static Function FromArgb(a As Byte, r As Byte, g As Byte, b As Byte) 106 Static Function FromArgb(a As Byte, r As Byte, g As Byte, b As Byte) As Color 99 107 Dim c As Color(a, r, g, b) 100 108 Return c … … 297 305 End Enum 298 306 */ 299 ' Assemble A, R, G, B values into a 32-bit integer 300 Private 301 Static Function MakeARGB(/*IN*/ a As Byte, 302 /*IN*/ r As Byte, 303 /*IN*/ g As Byte, 304 /*IN*/ b As Byte) As ARGB 307 Static Function MakeARGB(a As Byte, r As Byte, g As Byte, b As Byte) As ARGB 305 308 MakeARGB = (((b As ARGB) << Color_BlueShift) Or _ 306 309 ((g As ARGB) << Color_GreenShift) Or _ -
/Include/Classes/System/Drawing/Point.ab
r20 r30 4 4 #define __SYSTEM_DRAWING_POINT_AB__ 5 5 6 #include <Classes/System/Drawing/PointF.ab> 6 7 #include <Classes/System/Drawing/Size.ab> 7 8 #include <Classes/System/Drawing/SizeF.ab> … … 64 65 65 66 Function Operator + (pt As Point) As Point 66 Return Add( pt)67 Return Add(This, pt) 67 68 End Function 68 69 69 70 Function Operator + (sz As Size) As Point 70 Return Add( sz)71 Return Add(This, sz) 71 72 End Function 72 73 73 74 Function Operator - (pt As Point) As Point 74 Return Substract( pt)75 Return Substract(This, pt) 75 76 End Function 76 77 77 78 Function Operator - (sz As Size) As Point 78 Return Substract( sz)79 Return Substract(This, sz) 79 80 End Function 80 81 … … 87 88 End Function 88 89 89 Function Add(ptAs Point) As Point90 Dim ret As Point( x + pt.x, y + pt.y)90 Static Function Add(pt1 As Point, pt2 As Point) As Point 91 Dim ret As Point(pt1.x + pt2.x, pt1.y + pt2.y) 91 92 Return ret 92 93 End Function 93 94 94 Function Add(sz As Size) As Point95 Dim ret As Point( x + sz.width, y + sz.height)95 Static Function Add(pt As Point, sz As Size) As Point 96 Dim ret As Point(pt.x + sz.Width, pt.y + sz.Height) 96 97 Return ret 97 98 End Function … … 99 100 Function Offset(pt As Point) As Point 100 101 Dim ret As Point(x + pt.x, y + pt.y) 101 End Function102 103 Function Offset(dx As Long, dy As Long) As Point104 Dim ret As Point(x + dx, y + dy)105 End Function106 107 Function Substract(pt As Point) As Point108 Dim ret As Point(x - pt.x, y - pt.y)109 102 Return ret 110 103 End Function 111 104 112 Function Substract(sz As Size) As Point 113 Dim ret As Point(x - sz.width, y - sz.height) 105 Sub Offset(dx As Long, dy As Long) 106 x += dx 107 y += dy 108 End Sub 109 110 Static Function Substract(pt1 As Point, pt2 As Point) As Point 111 Dim ret As Point(pt1.x - pt2.x, pt1.y - pt2.y) 112 Return ret 113 End Function 114 115 Static Function Substract(pt As Point, sz As Size) As Point 116 Dim ret As Point(pt.x - sz.Width, pt.y - sz.Height) 114 117 Return ret 115 118 End Function -
/Include/Classes/System/Drawing/PointF.ab
r20 r30 58 58 End Sub 59 59 60 Function Operator () As PointF 61 Dim ptf As PointF(X, Y) 62 Return ptf 63 End Function 64 60 65 Function Operator + (pt As PointF) As PointF 61 Return Add( pt)66 Return Add(This, pt) 62 67 End Function 63 68 64 69 Function Operator + (sz As Size) As PointF 65 Return Add( sz)70 Return Add(This, sz) 66 71 End Function 67 72 68 73 Function Operator + (sz As SizeF) As PointF 69 Return Add( sz)74 Return Add(This, sz) 70 75 End Function 71 76 72 77 Function Operator - (pt As PointF) As PointF 73 Return Substract( pt)78 Return Substract(This, pt) 74 79 End Function 75 80 76 81 Function Operator - (sz As Size) As PointF 77 Return Substract( sz)82 Return Substract(This, sz) 78 83 End Function 79 84 80 85 Function Operator - (sz As SizeF) As PointF 81 Return Substract( sz)86 Return Substract(This, sz) 82 87 End Function 83 88 … … 90 95 End Function 91 96 92 Function Add(ptAs PointF) As PointF93 Dim ret As PointF( x + pt.x, y + pt.y)97 Static Function Add(pt1 As PointF, pt2 As PointF) As PointF 98 Dim ret As PointF(pt1.x + pt2.x, pt1.y + pt2.y) 94 99 Return ret 95 100 End Function 96 101 97 Function Add(sz As Size) As PointF98 Dim ret As PointF( x + sz.width, y + sz.height)102 Static Function Add(pt As PointF, sz As Size) As PointF 103 Dim ret As PointF(pt.x + sz.Width, pt.y + sz.Height) 99 104 Return ret 100 105 End Function 101 106 102 Function Add(sz As SizeF) As PointF103 Dim ret As PointF( x + sz.width, y + sz.height)107 Static Function Add(pt As PointF, sz As SizeF) As PointF 108 Dim ret As PointF(pt.x + sz.Width, pt.y + sz.Height) 104 109 Return ret 105 110 End Function 106 111 107 Function Substract(ptAs PointF) As PointF108 Dim ret As PointF( x - pt.x, y - pt.y)112 Static Function Substract((pt1 As PointF, pt2 As PointF) As PointF 113 Dim ret As PointF(pt1.x - pt2.x, pt1.y - pt2.y) 109 114 Return ret 110 115 End Function 111 116 112 Function Substract(sz As Size) As PointF113 Dim ret As PointF( x - sz.width, y - sz.height)117 Static Function Substract(pt As PointF, sz As Size) As PointF 118 Dim ret As PointF(pt.x - sz.Width, pt.y - sz.Height) 114 119 Return ret 115 120 End Function 116 121 117 Function Substract(sz As SizeF) As PointF118 Dim ret As PointF( x - sz.width, y - sz.height)122 Static Function Substract(pt As PointF, sz As SizeF) As PointF 123 Dim ret As PointF(pt.x - sz.Width, pt.y - sz.Height) 119 124 Return ret 120 125 End Function -
/Include/Classes/System/Drawing/Rectangle.ab
r20 r30 27 27 Sub Rectangle(location As Point, size As Size) 28 28 x = location.X 29 y = l ccation.Y29 y = location.Y 30 30 width = size.Height 31 he giht = size.Height31 height = size.Height 32 32 End Sub 33 33 … … 35 35 x = rc.x 36 36 y = rc.y 37 wid ht= rc.width37 width = rc.width 38 38 height = rc.height 39 39 End Sub … … 107 107 108 108 Function IsEmpty() As BOOL 109 If Width <= Single_EPSILON Or Height <= Single_EPSILONThen110 IsEmpty Area= _System_TRUE111 Else 112 IsEmpty Area= _System_FALSE109 If Width <= 0 Or Height <= 0 Then 110 IsEmpty = _System_TRUE 111 Else 112 IsEmpty = _System_FALSE 113 113 End If 114 114 End Function … … 145 145 146 146 Static Function FromLTRB(l As Single, t As Single, r As Single, b As Single) As Rectangle 147 Dim r As Rectangle(left, top, right - left, bottom - top)148 return r 147 Dim rect As Rectangle(l, t, r - l, r - b) 148 return rect 149 149 End Function 150 150 … … 162 162 163 163 Function Contains(ByRef rc As Rectangle) As BOOL 164 If X <= rc.X && rc.Right <= Right && Y <= rc.Y &&rc.Bottom <= Bottom Then164 If X <= rc.X And rc.Right <= Right And Y <= rc.Y And rc.Bottom <= Bottom Then 165 165 ContainsRCF = _System_TRUE 166 166 Else … … 172 172 X -= dx 173 173 Y -= dy 174 Width = dx + dx175 Height = dy + dy174 Width += dx + dx 175 Height += dy + dy 176 176 End Sub 177 177 178 178 Sub Inflate(sz As Size) 179 179 Inflate(sz.Width, sz.Height) 180 End Sub181 182 Sub Inflate(pt As Point)183 Inflate(pt.X, pt.Y)184 180 End Sub 185 181 … … 189 185 End Function 190 186 191 Function Intersect(ByRef rect As Rectangle) As BOOL192 Intersect = Intersect(This,This, rect)193 End Function187 Sub Intersect(ByRef rect As Rectangle) 188 This = Rectangle.Intersect(This, rect) 189 End Sub 194 190 195 191 Static Function Intersect(ByRef a As Rectangle, ByRef b As Rectangle) As Rectangle … … 199 195 left = Math.Min(a.Left, b.Left) 200 196 top = Math.Min(a.Top, b.Top) 201 Return FromLTRB(left, top, right, bottom)197 Return Rectangle.FromLTRB(left, top, right, bottom) 202 198 End Function 203 199 … … 215 211 Static Function Union(ByRef a As Rectangle, ByRef b As Rectangle) As Rectangle 216 212 Dim right As Single, bottom As Single, left As Single, top As Single 217 right = Math.Max(a. GetRight(), b.GetRight())218 bottom = Math.Max(a. GetBottom(), b.GetBottom())219 left = Math.Max(a. GetLeft(), b.GetLeft())220 top = Math.Max(a. GetTop(), b.GetTop())213 right = Math.Max(a.Right(), b.Right()) 214 bottom = Math.Max(a.Bottom(), b.Bottom()) 215 left = Math.Max(a.Left(), b.Left()) 216 top = Math.Max(a.Top(), b.Top()) 221 217 Return FromLTRB(left, top, right, bottom) 222 218 End Function -
/Include/Classes/System/Math.ab
r20 r30 546 546 last = Sqrt 547 547 Sqrt = (x /Sqrt + Sqrt) * 0.5 548 Loop While s<> last548 Loop While Sqrt <> last 549 549 End If 550 550 ElseIf x < 0 Then 551 Sqr = _System_GetNaN()551 Sqrt = _System_GetNaN() 552 552 Else 553 553 'x = 0 Or NaN -
/Include/Classes/System/String.ab
r20 r30 1 1 Class String 2 m_Chars As LPSTR 3 m_Length As Long 2 4 Public 3 Chars As LPSTR4 Length As Long5 5 6 6 Sub String() 7 Chars = _System_calloc(1)8 Length = 07 m_Chars = _System_calloc(1) 8 m_Length = 0 9 9 End Sub 10 10 … … 13 13 Assign(initStr) 14 14 End Sub 15 /* 16 Sub String(ByRef initStr As String)15 16 /* Sub String(ByRef initStr As String) 17 17 String() 18 18 Assign(initStr) … … 29 29 30 30 Sub ~String() 31 _System_free( Chars)32 Chars = 031 _System_free(m_Chars) 32 m_Chars = 0 33 33 #ifdef _DEBUG 34 Length = 034 m_Length = 0 35 35 #endif 36 36 End Sub 37 37 38 Function Chars() As LPSTR 39 Return m_Chars 40 End Function 41 42 Function Length() As Long 43 Return m_Length 44 End Function 45 38 46 Function Operator() As LPSTR 39 Return Chars47 Return m_Chars 40 48 End Function 41 49 42 50 Sub Operator = (ByRef objString As String) 43 Assign(objString. Chars, objString.Length)51 Assign(objString.m_Chars, objString.m_Length) 44 52 End Sub 45 53 … … 49 57 50 58 Function Operator[] (n As Long) As Byte 51 Return Chars[n]59 Return m_Chars[n] 52 60 End Function 53 61 54 62 Sub Operator[]= (n As Long, c As Byte) 55 Chars[n] = c63 m_Chars[n] = c 56 64 End Sub 57 65 … … 61 69 62 70 Function Operator+ (ByRef objString As String) As String 63 Return Concat(objString, objString. Length)71 Return Concat(objString, objString.m_Length) 64 72 End Function 65 73 … … 165 173 166 174 Function StrPtr() As LPSTR 167 Return Chars175 Return m_Chars 168 176 End Function 169 177 170 178 Sub ReSize(allocLength As Long) 171 179 If allocLength < 0 Then Exit Sub 172 If allocLength > Length Then180 If allocLength > m_Length Then 173 181 Dim oldLength As Long 174 oldLength = Length182 oldLength = m_Length 175 183 If AllocStringBuffer(allocLength) <> 0 Then 176 ZeroMemory( Chars + oldLength,Length - oldLength + 1)184 ZeroMemory(m_Chars + oldLength, m_Length - oldLength + 1) 177 185 End If 178 186 Else 179 Length = allocLength180 Chars[Length] = 0187 m_Length = allocLength 188 m_Chars[m_Length] = 0 181 189 End If 182 190 End Sub … … 185 193 If allocLength < 0 Then 186 194 Exit Sub 187 ElseIf allocLength > Length Then195 ElseIf allocLength > m_Length Then 188 196 Dim oldLength As Long 189 oldLength = Length197 oldLength = m_Length 190 198 If AllocStringBuffer(allocLength) <> 0 Then 191 FillMemory( Chars + oldLength,Length - oldLength, c)199 FillMemory(m_Chars + oldLength, m_Length - oldLength, c) 192 200 End If 193 201 Else 194 Length = allocLength195 End If 196 Chars[Length] = 0202 m_Length = allocLength 203 End If 204 m_Chars[m_Length] = 0 197 205 End Sub 198 206 199 207 Sub Assign(lpszText As LPSTR, textLength As Long) 200 If lpszText = Chars Then Exit Sub208 If lpszText = m_Chars Then Exit Sub 201 209 If AllocStringBuffer(textLength) <> 0 Then 202 memcpy( Chars, lpszText, textLength)203 Chars[Length] = 0210 memcpy(m_Chars, lpszText, textLength) 211 m_Chars[m_Length] = 0 204 212 End If 205 213 End Sub 206 214 207 215 Sub Assign(ByRef objString As String) 208 Assign(objString. Chars, objString.Length)216 Assign(objString.m_Chars, objString.m_Length) 209 217 End Sub 210 218 … … 213 221 Assign(lpszText, lstrlen(lpszText)) 214 222 Else 215 ' Chars=_System_realloc(Chars,1)216 Chars[0] = 0217 Length = 0223 'm_Chars=_System_realloc(m_Chars,1) 224 m_Chars[0] = 0 225 m_Length = 0 218 226 End If 219 227 End Sub … … 221 229 Sub Append(lpszText As LPSTR, textLength As Long) 222 230 Dim prevLen As Long 223 prevLen = Length224 If AllocStringBuffer( Length + textLength) <> 0 Then225 memcpy( Chars + prevLen, lpszText, textLength)226 Chars[Length] = 0231 prevLen = m_Length 232 If AllocStringBuffer(m_Length + textLength) <> 0 Then 233 memcpy(m_Chars + prevLen, lpszText, textLength) 234 m_Chars[m_Length] = 0 227 235 End If 228 236 End Sub … … 233 241 234 242 Sub Append(ByRef str As String) 235 Append(str. Chars, str.Length)243 Append(str.m_Chars, str.m_Length) 236 244 End Sub 237 245 … … 239 247 Dim tempString As String 240 248 With tempString 241 .AllocStringBuffer(This. Length + textLength)242 memcpy(. Chars, This.Chars, This.Length)243 memcpy(. Chars + This.Length, lpszText, textLength)244 . Chars[.Length] = 0249 .AllocStringBuffer(This.m_Length + textLength) 250 memcpy(.m_Chars, This.m_Chars, This.m_Length) 251 memcpy(.m_Chars + This.m_Length, lpszText, textLength) 252 .m_Chars[.m_Length] = 0 245 253 End With 246 254 Return tempString … … 248 256 249 257 Function Contains(ByRef objString As String) As BOOL 250 If IndexOf(objString, 0, Length) >= 0 Then258 If IndexOf(objString, 0, m_Length) >= 0 Then 251 259 Return _System_TRUE 252 260 Else … … 256 264 257 265 Function Contains(lpszText As LPSTR) As BOOL 258 If IndexOf(lpszText, 0, Length) >= 0 Then266 If IndexOf(lpszText, 0, m_Length) >= 0 Then 259 267 Return _System_TRUE 260 268 Else … … 264 272 265 273 Function IndexOf(lpszText As LPSTR) As Long 266 Return IndexOf(lpszText, 0, Length)274 Return IndexOf(lpszText, 0, m_Length) 267 275 End Function 268 276 269 277 Function IndexOf(lpszText As LPSTR, startIndex As Long) As Long 270 Return IndexOf(lpszText, startIndex, Length - startIndex)278 Return IndexOf(lpszText, startIndex, m_Length - startIndex) 271 279 End Function 272 280 … … 276 284 277 285 If startIndex < 0 Then Return -1 278 If count < 1 Or count + startIndex > Length Then Return -1279 If length > Length Then Return -1286 If count < 1 Or count + startIndex > m_Length Then Return -1 287 If length > m_Length Then Return -1 280 288 281 289 If length = 0 Then Return startIndex … … 284 292 For i = startIndex To startIndex + count - 1 285 293 For j = 0 To length - 1 286 If Chars[i + j] = lpszText[j] Then294 If m_Chars[i + j] = lpszText[j] Then 287 295 If j = length - 1 Then Return i 288 296 Else … … 295 303 296 304 Function LastIndexOf(lpszText As LPSTR) As Long 297 Return LastIndexOf(lpszText, Length - 1,Length)305 Return LastIndexOf(lpszText, m_Length - 1, m_Length) 298 306 End Function 299 307 … … 306 314 length = lstrlen(lpszText) 307 315 308 If startIndex < 0 Or startIndex > Length - 1 Then Return -1316 If startIndex < 0 Or startIndex > m_Length - 1 Then Return -1 309 317 If count < 1 Or count > startIndex + 2 Then Return -1 310 If length > Length Then Return -1318 If length > m_Length Then Return -1 311 319 312 320 If length = 0 Then Return startIndex … … 315 323 For i = startIndex To startIndex - count + 1 Step -1 316 324 For j = length - 1 To 0 Step -1 317 If Chars[i + j] = lpszText[j] Then325 If m_Chars[i + j] = lpszText[j] Then 318 326 If j = 0 Then Return i 319 327 Else … … 334 342 335 343 Function EndsWith(lpszText As LPSTR) As BOOL 336 If LastIndexOf(lpszText) = Length - lstrlen(lpszText) Then344 If LastIndexOf(lpszText) = m_Length - lstrlen(lpszText) Then 337 345 Return _System_TRUE 338 346 Else … … 345 353 length = lstrlen(lpszText) 346 354 347 If startIndex < 0 Or startIndex > Length Then Return -1355 If startIndex < 0 Or startIndex > m_Length Then Return -1 348 356 349 357 Dim newChars As LPSTR 350 newChars = _System_malloc(length + Length + 1)358 newChars = _System_malloc(length + m_Length + 1) 351 359 If newChars = 0 Then Return -1 352 360 353 memcpy(newChars, Chars, startIndex)361 memcpy(newChars, m_Chars, startIndex) 354 362 memcpy(newChars + startIndex, lpszText, length) 355 memcpy(newChars + startIndex + length, Chars + startIndex,Length - startIndex + 1)356 357 _System_free( Chars)358 Chars = newChars359 Length = length +Length360 Return Length363 memcpy(newChars + startIndex + length, m_Chars + startIndex, m_Length - startIndex + 1) 364 365 _System_free(m_Chars) 366 m_Chars = newChars 367 m_Length = length + m_Length 368 Return m_Length 361 369 End Function 362 370 363 371 Function SubString(startIndex As Long) As String 364 Return SubString(startIndex, Length - startIndex)372 Return SubString(startIndex, m_Length - startIndex) 365 373 End Function 366 374 367 375 Function SubString(startIndex As Long, length As Long) As String 368 376 If startIndex < 0 Or length <= 0 Then Return "" 369 If startIndex + length > Length Then Return ""377 If startIndex + length > m_Length Then Return "" 370 378 371 379 Dim temp As String 372 380 temp.AllocStringBuffer(length) 373 memcpy(temp. Chars, VarPtr(Chars[startIndex]), length)374 Chars[Length] = 0381 memcpy(temp.m_Chars, VarPtr(m_Chars[startIndex]), length) 382 m_Chars[m_Length] = 0 375 383 Return temp 376 384 End Function 377 385 378 386 Function Remove(startIndex As Long) As Long 379 If startIndex < 0 Or startIndex > Length Then Return -1380 Chars[startIndex] = 0381 Length = startIndex382 Return Length387 If startIndex < 0 Or startIndex > m_Length Then Return -1 388 m_Chars[startIndex] = 0 389 m_Length = startIndex 390 Return m_Length 383 391 End Function 384 392 385 393 Function Remove(startIndex As Long, count As Long) As Long 386 394 If startIndex < 0 Or count < 0 Then Return -1 387 If startIndex + count > Length Then Return -1395 If startIndex + count > m_Length Then Return -1 388 396 389 397 Dim newChars As LPSTR 390 newChars = _System_malloc( Length - count + 1)398 newChars = _System_malloc(m_Length - count + 1) 391 399 If newChars = 0 Then Return -1 392 400 393 memcpy(newChars, Chars, startIndex)394 memcpy(newChars + startIndex, Chars + startIndex + count,Length - startIndex - count)395 newChars[ Length - count] = 0396 397 _System_free( Chars)398 Chars = newChars399 Length =Length - count400 Return Length401 memcpy(newChars, m_Chars, startIndex) 402 memcpy(newChars + startIndex, m_Chars + startIndex + count, m_Length - startIndex - count) 403 newChars[m_Length - count] = 0 404 405 _System_free(m_Chars) 406 m_Chars = newChars 407 m_Length = m_Length - count 408 Return m_Length 401 409 End Function 402 410 403 411 Function IsNullOrEmpty() As BOOL 404 If Length = 0 Then412 If m_Length = 0 Then 405 413 Return _System_TRUE 406 414 Else … … 411 419 Sub Replace(oldChar As Byte, newChar As Byte) 412 420 Dim i As Long 413 For i = 0 To ELM( Length)414 If Chars[i] = oldChar Then415 Chars[i] = newChar421 For i = 0 To ELM(m_Length) 422 If m_Chars[i] = oldChar Then 423 m_Chars[i] = newChar 416 424 End If 417 425 Next … … 419 427 420 428 Sub Replace(ByRef oldStr As String, ByRef newStr As String) 421 Replace(oldStr, oldStr. Length, newStr, newStr.Length)429 Replace(oldStr, oldStr.m_Length, newStr, newStr.m_Length) 422 430 End Sub 423 431 … … 436 444 Exit Do 437 445 End If 438 .Append( Chars + current, pos - current)446 .Append(m_Chars + current, pos - current) 439 447 .Append(newStr, newLen) 440 448 current = pos + oldLen 441 449 Loop 442 .Append( Chars + current,Length - current)450 .Append(m_Chars + current, m_Length - current) 443 451 End With 444 452 Swap(tempString) … … 446 454 447 455 Sub ToLower() 448 CharLower( Chars)456 CharLower(m_Chars) 449 457 End Sub 450 458 451 459 Sub ToUpper() 452 CharUpper( Chars)460 CharUpper(m_Chars) 453 461 End Sub 454 462 … … 456 464 Dim tempLen As Long 457 465 Dim tempChars As PSTR 458 tempLen = x. Length459 tempChars = x. Chars460 x. Length = This.Length461 x. Chars = This.Chars462 This. Length = tempLen463 This. Chars = tempChars466 tempLen = x.m_Length 467 tempChars = x.m_Chars 468 x.m_Length = This.m_Length 469 x.m_Chars = This.m_Chars 470 This.m_Length = tempLen 471 This.m_Chars = tempChars 464 472 End Sub 465 473 … … 469 477 If textLength < 0 Then 470 478 Return 0 471 ElseIf textLength > Length Then472 AllocStringBuffer = _System_realloc( Chars, textLength + 1)479 ElseIf textLength > m_Length Then 480 AllocStringBuffer = _System_realloc(m_Chars, textLength + 1) 473 481 If AllocStringBuffer <> 0 Then 474 Length = textLength475 Chars = AllocStringBuffer482 m_Length = textLength 483 m_Chars = AllocStringBuffer 476 484 End If 477 485 Else 478 Length = textLength479 AllocStringBuffer = Chars486 m_Length = textLength 487 AllocStringBuffer = m_Chars 480 488 End If 481 489 End Function -
/Include/api_winsock2.sbp
r20 r30 238 238 Const INADDR_ANY = &h0 239 239 240 Declare Function htons Lib "ws2_32.dll" (netshort As Word) As Word 241 Declare Function htonl Lib "ws2_32.dll" (netshort As DWord) As DWord 242 Declare Function ntohs Lib "ws2_32.dll" (netshort As Word) As Word 243 Declare Function ntohl Lib "ws2_32.dll" (netshort As DWord) As DWord 240 244 241 245 #endif '_INC_WINSOCK2 -
/Include/basic/command.sbp
r20 r30 35 35 36 36 Macro EXEC(lpFilePath As *Byte)(lpCmdLine As *Byte) 37 ShellExecute(0, "open", lpFilePath, lpCmdLine, 0,SW_SHOWNORMAL)37 ShellExecute(0,"open",lpFilePath,lpCmdLine,0,SW_SHOWNORMAL) 38 38 End Macro 39 39 … … 56 56 '---------------- 57 57 58 Macro MSGBOX(hWnd As HWND, ByRef str As String)(ByRef title As String, boxType As DWord, ByRef retAns As DWord)58 Macro MSGBOX(hWnd As HWND, lpStr As String)(lpTitle As String, BoxType As DWord, ByRef retAns As DWord) 59 59 If VarPtr(retAns) Then 60 retAns = MessageBox(hWnd, str, title, boxType)60 retAns=MessageBox(hWnd,lpStr,lpTitle,BoxType) 61 61 Else 62 MessageBox(hWnd, str, title, boxType)62 MessageBox(hWnd,lpStr,lpTitle,BoxType) 63 63 End If 64 64 End Macro 65 65 66 Macro WINDOW(ByRef hWnd As Long, hOwner As HWND, x As Long, y As Long, nWidth As Long, nHeight As Long, ByRef title As String, dwStyle As DWord)(ByRef classNameAs String, id As DWord, lpFunc As DWord, dwExStyle As DWord)66 Macro WINDOW(ByRef hWnd As Long, hOwner As Long, x As Long, y As Long, nWidth As Long, nHeight As Long, lpTitle As String, dwStyle As DWord)(lpClass As String, id As DWord, lpFunc As DWord, dwExStyle As DWord) 67 67 If VarPtr(hWnd) Then 68 hWnd = CreateWindowEx(dwExStyle, className.Chars, title, dwStyle, x, y, nWidth, nHeight, hOwner, id, GetModuleHandle(0),NULL)68 hWnd=CreateWindowEx(dwExStyle,lpClass,lpTitle,dwStyle,x,y,nWidth,nHeight,hOwner,id,GetModuleHandle(0),NULL) 69 69 Else 70 CreateWindowEx(dwExStyle, className.Chars, title, dwStyle, x, y, nWidth, nHeight, hOwner, id, GetModuleHandle(0),NULL)70 CreateWindowEx(dwExStyle,lpClass,lpTitle,dwStyle,x,y,nWidth,nHeight,hOwner,id,GetModuleHandle(0),NULL) 71 71 End If 72 72 End Macro … … 76 76 End Macro 77 77 78 Macro INSMENU(hMenu As HMENU, PosID As Long, flag As Long)( ByRef strAs String, id As Long, hSubMenu As HMENU, state As Long)78 Macro INSMENU(hMenu As HMENU, PosID As Long, flag As Long)(lpString As String, id As Long, hSubMenu As HMENU, state As Long) 79 79 Dim mii As MENUITEMINFO 80 80 81 ZeroMemory(VarPtr(mii), Len(mii)) 82 With mii 83 .cbSize = Len(mii) 84 .fMask = IIM_TYPE 85 86 If str.Length = 0 Then 87 .fType = MFT_SEPARATOR 88 Else 89 .fType = MFT_STRING 90 .fMask = .fMask or MIIM_STATE or MIIM_ID 91 .dwTypeData = str.Chars 92 .wID = id 93 If hSubMenu Then 94 .fMask = .fMask or MIIM_SUBMENU 95 .hSubMenu = hSubMenu 96 End If 97 .fState = state 81 FillMemory(VarPtr(mii),Len(mii),0) 82 mii.cbSize=Len(mii) 83 mii.fMask=MIIM_TYPE 84 85 If lpString.Length=0 Then 86 mii.fType=MFT_SEPARATOR 87 Else 88 mii.fType=MFT_STRING 89 mii.fMask=mii.fMask or MIIM_STATE or MIIM_ID 90 mii.dwTypeData=StrPtr(lpString) 91 mii.wID=id 92 If hSubMenu Then 93 mii.fMask=mii.fMask or MIIM_SUBMENU 94 mii.hSubMenu=hSubMenu 98 95 End If 99 End With 100 101 InsertMenuItem(hMenu, PosID, flag, mii) 96 mii.fState=state 97 End If 98 99 InsertMenuItem(hMenu,PosID,flag,mii) 102 100 End Macro 103 101 … … 107 105 '-------------- 108 106 109 Dim _System_hFile[255] As HANDLE 110 111 Macro OPEN(ByRef fileName As String, AccessFor As Long, FileNumber As Long) 107 Dim _System_hFile(255) As Long 108 Macro OPEN(lpFileName As String, AccessFor As Long, FileNumber As Long) 112 109 Dim dwAccess As Long 113 110 Dim bAppend As Long 114 111 Dim dwCreationDisposition As Long 115 112 116 FileNumber --113 FileNumber=FileNumber-1 117 114 118 115 bAppend=0 … … 133 130 End Select 134 131 135 _System_hFile[FileNumber] = CreateFile(fileName, dwAccess, 0, ByVal 0, dwCreationDisposition, FILE_ATTRIBUTE_NORMAL, 0) 136 137 If bAppend Then SetFilePointer(_System_hFile[FileNumber], 0, 0, FILE_END) 138 End Macro 139 132 _System_hFile(FileNumber)=CreateFile(lpFileName,dwAccess,0,ByVal NULL,dwCreationDisposition,FILE_ATTRIBUTE_NORMAL,NULL) 133 134 If bAppend Then SetFilePointer(_System_hFile(FileNumber),0,NULL,FILE_END) 135 End Macro 140 136 Macro CLOSE()(FileNumber As Long) 141 FileNumber --137 FileNumber=FileNumber-1 142 138 143 139 If _System_hFile(FileNumber) Then 144 CloseHandle(_System_hFile [FileNumber])145 _System_hFile(FileNumber) =0140 CloseHandle(_System_hFile(FileNumber)) 141 _System_hFile(FileNumber)=0 146 142 End If 147 143 End Macro … … 151 147 Dim _System_InputDataType[_System_MAX_PARMSNUM] As DWord 152 148 Sub INPUT_FromFile(FileNumber As Long) 153 Dim i As Long ,i2 As Long, i3 As Long149 Dim i As Long ,i2 As Long, i3 As Long 154 150 Dim buffer As String 155 151 Dim temp[1] As Byte … … 157 153 Dim IsStr As Long 158 154 159 FileNumber --155 FileNumber=FileNumber-1 160 156 161 157 buffer=ZeroString(GetFileSize(_System_hFile[FileNumber],0)) … … 177 173 IsStr=0 178 174 While 1 179 i3 ++175 i3=i3+1 180 176 181 177 i2=ReadFile(_System_hFile[FileNumber],temp,1,VarPtr(dwAccessBytes),ByVal 0) … … 201 197 If dwAccessBytes=0 Then Exit While 202 198 If temp[0]=Asc(",") Then Exit While 203 If temp[0] <> 32 And temp[0] <> 9Then199 If Not(temp[0]=32 or temp[0]=9) Then 204 200 SetFilePointer(_System_hFile[FileNumber],-1,0,FILE_CURRENT) 205 201 Exit While … … 231 227 Dim pTempStr As *String 232 228 pTempStr=_System_InputDataPtr[i] As *String 233 pTempStr->Assign(buffer.Chars, i3) 229 230 pTempStr->Length=i3 231 pTempStr->Chars=_System_realloc(pTempStr->Chars,pTempStr->Length+1) 232 memcpy(pTempStr->Chars,buffer.Chars,pTempStr->Length) 233 pTempStr->Chars[pTempStr->Length]=0 234 234 End Select 235 235 236 i ++236 i=i+1 237 237 If _System_InputDataPtr[i]=0 Then Exit While 238 238 Wend … … 241 241 Sub PRINT_ToFile(FileNumber As Long, buf As String) 242 242 Dim dwAccessByte As DWord 243 FileNumber --243 FileNumber=FileNumber-1 244 244 245 245 WriteFile(_System_hFile(FileNumber),buf,Len(buf),VarPtr(dwAccessByte),ByVal NULL) … … 263 263 buffer[i3]=UsingStr[i2] 264 264 If UsingStr[i2]=0 Then Exit While 265 i2 ++266 i3 ++265 i2=i2+1 266 i3=i3+1 267 267 Wend 268 268 … … 274 274 275 275 Dim length_num As Long, length_buf As Long 276 Dim dblRoundOff =0 As Double276 Dim dblRoundOff=0 As Double 277 277 278 278 … … 283 283 i4=i2 284 284 While UsingStr[i4]=Asc("#") 285 i4 ++285 i4=i4+1 286 286 Wend 287 287 If UsingStr[i4]=Asc(".") Then 288 i4 ++288 i4=i4+1 289 289 290 290 dblRoundOff=0.5 291 291 While UsingStr[i4]=Asc("#") 292 i4 ++292 i4=i4+1 293 293 dblRoundOff=dblRoundOff/10 294 294 Wend … … 304 304 305 305 '符号が有る場合は、一文字分のスペースを考慮する 306 If sign Then length_num ++306 If sign Then length_num=length_num+1 307 307 308 308 length_buf=0 309 309 Do 310 i2 ++311 length_buf ++310 i2=i2+1 311 length_buf=length_buf+1 312 312 Loop While UsingStr[i2]=Asc("#") 313 313 … … 315 315 '通常時 316 316 FillMemory(StrPtr(buffer)+i3,length_buf-length_num,Asc(" ")) 317 i3 += length_buf - length_num317 i3=i3+(length_buf-length_num) 318 318 319 319 If sign Then 320 320 buffer[i3]=Asc("-") 321 i3 ++322 323 length_num --321 i3=i3+1 322 323 length_num=length_num-1 324 324 End If 325 325 … … 330 330 End If 331 331 332 i3 +=length_num332 i3=i3+length_num 333 333 Else 334 334 '表示桁が足りないとき 335 335 FillMemory(StrPtr(buffer)+i3,length_buf,Asc("#")) 336 i3 +=length_buf336 i3=i3+length_buf 337 337 End If 338 338 339 339 If UsingStr[i2]=Asc(".") Then 340 340 buffer[i3]=UsingStr[i2] 341 i2 ++342 i3 ++341 i2=i2+1 342 i3=i3+1 343 343 344 344 i4=dec … … 349 349 buffer[i3]=temp2[i4] 350 350 End If 351 i3 ++352 i4 ++353 354 i2 ++351 i3=i3+1 352 i4=i4+1 353 354 i2=i2+1 355 355 Wend 356 356 End If 357 357 ElseIf UsingStr[i2]=Asc("@") Then 358 i2 ++1358 i2=i2+1 359 359 360 360 lstrcat(StrPtr(buffer)+i3,_System_UsingStrData[ParmNum]) 361 i3 +=lstrlen(_System_UsingStrData[ParmNum])361 i3=i3+lstrlen(_System_UsingStrData[ParmNum]) 362 362 ElseIf UsingStr[i2]=Asc("&") Then 363 363 i4=0 364 364 Do 365 i4 ++366 i2 ++365 i4=i4+1 366 i2=i2+1 367 367 Loop While UsingStr[i2]=Asc(" ") 368 368 369 369 If UsingStr[i2]=Asc("&") Then 370 i4 ++371 i2 ++370 i4=i4+1 371 i2=i2+1 372 372 i5=lstrlen(_System_UsingStrData[ParmNum]) 373 373 If i4<=i5 Then … … 377 377 End If 378 378 memcpy(StrPtr(buffer)+i3,_System_UsingStrData[ParmNum],i5) 379 i3 +=i4379 i3=i3+i4 380 380 Else 381 i2 -=i4381 i2=i2-i4 382 382 buffer[i3]=Asc("&") 383 i2 ++384 i3 ++383 i2=i2+1 384 i3=i3+1 385 385 Continue 386 386 End If 387 387 End If 388 388 389 ParmNum ++389 ParmNum=ParmNum+1 390 390 Wend 391 391 392 392 _System_GetUsingFormat=Left$(buffer,lstrlen(buffer)) 393 393 End Function 394 395 394 Sub PRINTUSING_ToFile(FileNumber As Long, UsingStr As String) 396 395 Dim dwAccessByte As DWord 397 396 Dim buf As String 398 397 399 FileNumber --398 FileNumber=FileNumber-1 400 399 buf=_System_GetUsingFormat(UsingStr) 401 400 … … 404 403 405 404 Dim _System_FieldSize(255) As Long 406 407 405 Macro FIELD(FileNumber As Long, FieldSize As Long) 408 FileNumber --406 FileNumber=FileNumber-1 409 407 410 408 _System_FieldSize(FileNumber)=FieldSize 411 409 End Macro 412 413 410 Macro GET(FileNumber As Long, RecodeNumber As Long, ByRef lpBuffer As String) 414 411 Dim dwAccessByte As Long 415 412 416 FileNumber --417 RecodeNumber --413 FileNumber=FileNumber-1 414 RecodeNumber=RecodeNumber-1 418 415 419 416 SetFilePointer(_System_hFile(FileNumber),RecodeNumber*_System_FieldSize(FileNumber),NULL,FILE_BEGIN) … … 424 421 End If 425 422 End Macro 426 427 423 Macro PUT(FileNumber As Long, RecodeNumber As Long, ByRef lpBuffer As String) 428 424 Dim dwAccessByte As Long 429 425 430 FileNumber --431 RecodeNumber --426 FileNumber=FileNumber-1 427 RecodeNumber=RecodeNumber-1 432 428 433 429 SetFilePointer(_System_hFile(FileNumber),RecodeNumber*_System_FieldSize(FileNumber),NULL,FILE_BEGIN) … … 435 431 End Macro 436 432 437 Macro CHDIR( ByRefpath As String)433 Macro CHDIR(path As String) 438 434 SetCurrentDirectory(path) 439 435 End Macro 440 441 Macro MKDIR(ByRef path As String) 436 Macro MKDIR(path As String) 442 437 CreateDirectory(path,ByVal 0) 443 438 End Macro 444 445 Macro KILL(ByRef path As String) 439 Macro KILL(path As String) 446 440 DeleteFile(path) 447 441 End Macro -
/Include/basic/function.sbp
r20 r30 769 769 i64data=1 770 770 While i>=2 771 Val += i64data*TempPtr[i]771 Val += (i64data*TempPtr[i]) As Double 772 772 773 773 i64data *= &H10 … … 957 957 Loop 958 958 If dir Then dir[i3]=0 959 i3 += i i-i2959 i3 += i-i2 960 960 961 961 'ファイル名をコピー -
/Include/system/enum.sbp
r20 r30 18 18 Return m_Value 19 19 End Function 20 21 Function Operator == (Value As Long) As Long 22 If m_Value = Value Then 23 Return _System_TRUE 24 Else 25 Return _System_FALSE 26 End If 27 End Function 20 28 End Class
Note:
See TracChangeset
for help on using the changeset viewer.