- Location:
- /Include
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
/Include/Classes/System/Drawing/Color.ab
r30 r20 18 18 Public 19 19 Sub Color() 20 argb = MakeARGB(255, 0, 0, 0) ' Black 21 End Sub 22 23 Sub Color(ByRef c As Color) 24 argb = c.argb 20 Argb = 0 ' Black 25 21 End Sub 26 22 … … 30 26 31 27 Sub Color(a As Byte, r As Byte, g As Byte, b As Byte) 32 argb = MakeARGB(a, r, g, b)33 End Sub 34 35 Sub Color( newArgb As ARGB)36 argb = newArgb28 Argb = MakeARGB(a, r, g, b) 29 End Sub 30 31 Sub Color(argb As ARGB) 32 Argb = argb 37 33 End Sub 38 34 39 35 Sub Operator =(c As Color) 40 argb = c.argb36 SetValue(c) 41 37 End Sub 42 38 … … 65 61 End Function 66 62 67 Function Value() As ARGB68 Returnargb69 End Function 70 71 Sub Value(value As ARGB)63 Function GetValue() As ARGB 64 GetValue = argb 65 End Function 66 67 Sub SetValue(value As ARGB) 72 68 argb = value 73 69 End Sub 74 70 75 71 Sub SetFromCOLORREF(rgb As COLORREF) 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 72 argb = Color_MakeARGB(255, GetRValue(rgb), GetGValue(rgb), GetBValue(rgb)) 81 73 End Sub 82 74 … … 99 91 End Function 100 92 101 Static Function FromArgb(r As Byte, g As Byte, b As Byte) As Color93 Static Function FromArgb(r As Byte, g As Byte, b As Byte) 102 94 Dim c As Color(r, g, b) 103 95 Return c 104 96 End Function 105 97 106 Static Function FromArgb(a As Byte, r As Byte, g As Byte, b As Byte) As Color98 Static Function FromArgb(a As Byte, r As Byte, g As Byte, b As Byte) 107 99 Dim c As Color(a, r, g, b) 108 100 Return c … … 305 297 End Enum 306 298 */ 307 Static Function MakeARGB(a As Byte, r As Byte, g As Byte, b As Byte) As ARGB 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 308 305 MakeARGB = (((b As ARGB) << Color_BlueShift) Or _ 309 306 ((g As ARGB) << Color_GreenShift) Or _ -
/Include/Classes/System/Drawing/Point.ab
r30 r20 4 4 #define __SYSTEM_DRAWING_POINT_AB__ 5 5 6 #include <Classes/System/Drawing/PointF.ab>7 6 #include <Classes/System/Drawing/Size.ab> 8 7 #include <Classes/System/Drawing/SizeF.ab> … … 65 64 66 65 Function Operator + (pt As Point) As Point 67 Return Add( This,pt)66 Return Add(pt) 68 67 End Function 69 68 70 69 Function Operator + (sz As Size) As Point 71 Return Add( This,sz)70 Return Add(sz) 72 71 End Function 73 72 74 73 Function Operator - (pt As Point) As Point 75 Return Substract( This,pt)74 Return Substract(pt) 76 75 End Function 77 76 78 77 Function Operator - (sz As Size) As Point 79 Return Substract( This,sz)78 Return Substract(sz) 80 79 End Function 81 80 … … 88 87 End Function 89 88 90 Static Function Add(pt1 As Point, pt2As Point) As Point91 Dim ret As Point( pt1.x + pt2.x, pt1.y + pt2.y)89 Function Add(pt As Point) As Point 90 Dim ret As Point(x + pt.x, y + pt.y) 92 91 Return ret 93 92 End Function 94 93 95 Static Function Add(pt As Point,sz As Size) As Point96 Dim ret As Point( pt.x + sz.Width, pt.y + sz.Height)94 Function Add(sz As Size) As Point 95 Dim ret As Point(x + sz.width, y + sz.height) 97 96 Return ret 98 97 End Function … … 100 99 Function Offset(pt As Point) As Point 101 100 Dim ret As Point(x + pt.x, y + pt.y) 101 End Function 102 103 Function Offset(dx As Long, dy As Long) As Point 104 Dim ret As Point(x + dx, y + dy) 105 End Function 106 107 Function Substract(pt As Point) As Point 108 Dim ret As Point(x - pt.x, y - pt.y) 102 109 Return ret 103 110 End Function 104 111 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) 112 Function Substract(sz As Size) As Point 113 Dim ret As Point(x - sz.width, y - sz.height) 117 114 Return ret 118 115 End Function -
/Include/Classes/System/Drawing/PointF.ab
r30 r20 58 58 End Sub 59 59 60 Function Operator () As PointF61 Dim ptf As PointF(X, Y)62 Return ptf63 End Function64 65 60 Function Operator + (pt As PointF) As PointF 66 Return Add( This,pt)61 Return Add(pt) 67 62 End Function 68 63 69 64 Function Operator + (sz As Size) As PointF 70 Return Add( This,sz)65 Return Add(sz) 71 66 End Function 72 67 73 68 Function Operator + (sz As SizeF) As PointF 74 Return Add( This,sz)69 Return Add(sz) 75 70 End Function 76 71 77 72 Function Operator - (pt As PointF) As PointF 78 Return Substract( This,pt)73 Return Substract(pt) 79 74 End Function 80 75 81 76 Function Operator - (sz As Size) As PointF 82 Return Substract( This,sz)77 Return Substract(sz) 83 78 End Function 84 79 85 80 Function Operator - (sz As SizeF) As PointF 86 Return Substract( This,sz)81 Return Substract(sz) 87 82 End Function 88 83 … … 95 90 End Function 96 91 97 Static Function Add(pt1 As PointF, pt2As PointF) As PointF98 Dim ret As PointF( pt1.x + pt2.x, pt1.y + pt2.y)92 Function Add(pt As PointF) As PointF 93 Dim ret As PointF(x + pt.x, y + pt.y) 99 94 Return ret 100 95 End Function 101 96 102 Static Function Add(pt As PointF,sz As Size) As PointF103 Dim ret As PointF( pt.x + sz.Width, pt.y + sz.Height)97 Function Add(sz As Size) As PointF 98 Dim ret As PointF(x + sz.width, y + sz.height) 104 99 Return ret 105 100 End Function 106 101 107 Static Function Add(pt As PointF,sz As SizeF) As PointF108 Dim ret As PointF( pt.x + sz.Width, pt.y + sz.Height)102 Function Add(sz As SizeF) As PointF 103 Dim ret As PointF(x + sz.width, y + sz.height) 109 104 Return ret 110 105 End Function 111 106 112 Static Function Substract((pt1 As PointF, pt2As PointF) As PointF113 Dim ret As PointF( pt1.x - pt2.x, pt1.y - pt2.y)107 Function Substract(pt As PointF) As PointF 108 Dim ret As PointF(x - pt.x, y - pt.y) 114 109 Return ret 115 110 End Function 116 111 117 Static Function Substract(pt As PointF,sz As Size) As PointF118 Dim ret As PointF( pt.x - sz.Width, pt.y - sz.Height)112 Function Substract(sz As Size) As PointF 113 Dim ret As PointF(x - sz.width, y - sz.height) 119 114 Return ret 120 115 End Function 121 116 122 Static Function Substract(pt As PointF,sz As SizeF) As PointF123 Dim ret As PointF( pt.x - sz.Width, pt.y - sz.Height)117 Function Substract(sz As SizeF) As PointF 118 Dim ret As PointF(x - sz.width, y - sz.height) 124 119 Return ret 125 120 End Function -
/Include/Classes/System/Drawing/Rectangle.ab
r30 r20 27 27 Sub Rectangle(location As Point, size As Size) 28 28 x = location.X 29 y = l ocation.Y29 y = lccation.Y 30 30 width = size.Height 31 he ight = size.Height31 hegiht = size.Height 32 32 End Sub 33 33 … … 35 35 x = rc.x 36 36 y = rc.y 37 wid th= rc.width37 widht = rc.width 38 38 height = rc.height 39 39 End Sub … … 107 107 108 108 Function IsEmpty() As BOOL 109 If Width <= 0 Or Height <= 0Then110 IsEmpty = _System_TRUE111 Else 112 IsEmpty = _System_FALSE109 If Width <= Single_EPSILON Or Height <= Single_EPSILON Then 110 IsEmptyArea = _System_TRUE 111 Else 112 IsEmptyArea = _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 ect As Rectangle(l, t, r - l, r - b)148 return r ect147 Dim r As Rectangle(left, top, right - left, bottom - top) 148 return r 149 149 End Function 150 150 … … 162 162 163 163 Function Contains(ByRef rc As Rectangle) As BOOL 164 If X <= rc.X And rc.Right <= Right And Y <= rc.Y Andrc.Bottom <= Bottom Then164 If X <= rc.X && rc.Right <= Right && Y <= rc.Y && 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 Sub 181 182 Sub Inflate(pt As Point) 183 Inflate(pt.X, pt.Y) 180 184 End Sub 181 185 … … 185 189 End Function 186 190 187 Sub Intersect(ByRef rect As Rectangle)188 This = Rectangle.Intersect(This, rect)189 End Sub191 Function Intersect(ByRef rect As Rectangle) As BOOL 192 Intersect = Intersect(This, This, rect) 193 End Function 190 194 191 195 Static Function Intersect(ByRef a As Rectangle, ByRef b As Rectangle) As Rectangle … … 195 199 left = Math.Min(a.Left, b.Left) 196 200 top = Math.Min(a.Top, b.Top) 197 Return Rectangle.FromLTRB(left, top, right, bottom)201 Return FromLTRB(left, top, right, bottom) 198 202 End Function 199 203 … … 211 215 Static Function Union(ByRef a As Rectangle, ByRef b As Rectangle) As Rectangle 212 216 Dim right As Single, bottom As Single, left As Single, top As Single 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())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()) 217 221 Return FromLTRB(left, top, right, bottom) 218 222 End Function -
/Include/Classes/System/Math.ab
r30 r20 546 546 last = Sqrt 547 547 Sqrt = (x /Sqrt + Sqrt) * 0.5 548 Loop While Sqrt<> last548 Loop While s <> last 549 549 End If 550 550 ElseIf x < 0 Then 551 Sqr t= _System_GetNaN()551 Sqr = _System_GetNaN() 552 552 Else 553 553 'x = 0 Or NaN -
/Include/Classes/System/String.ab
r30 r20 1 1 Class String 2 m_Chars As LPSTR3 m_Length As Long4 2 Public 3 Chars As LPSTR 4 Length As Long 5 5 6 6 Sub String() 7 m_Chars = _System_calloc(1)8 m_Length = 07 Chars = _System_calloc(1) 8 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( m_Chars)32 m_Chars = 031 _System_free(Chars) 32 Chars = 0 33 33 #ifdef _DEBUG 34 m_Length = 034 Length = 0 35 35 #endif 36 36 End Sub 37 37 38 Function Chars() As LPSTR39 Return m_Chars40 End Function41 42 Function Length() As Long43 Return m_Length44 End Function45 46 38 Function Operator() As LPSTR 47 Return m_Chars39 Return Chars 48 40 End Function 49 41 50 42 Sub Operator = (ByRef objString As String) 51 Assign(objString. m_Chars, objString.m_Length)43 Assign(objString.Chars, objString.Length) 52 44 End Sub 53 45 … … 57 49 58 50 Function Operator[] (n As Long) As Byte 59 Return m_Chars[n]51 Return Chars[n] 60 52 End Function 61 53 62 54 Sub Operator[]= (n As Long, c As Byte) 63 m_Chars[n] = c55 Chars[n] = c 64 56 End Sub 65 57 … … 69 61 70 62 Function Operator+ (ByRef objString As String) As String 71 Return Concat(objString, objString. m_Length)63 Return Concat(objString, objString.Length) 72 64 End Function 73 65 … … 173 165 174 166 Function StrPtr() As LPSTR 175 Return m_Chars167 Return Chars 176 168 End Function 177 169 178 170 Sub ReSize(allocLength As Long) 179 171 If allocLength < 0 Then Exit Sub 180 If allocLength > m_Length Then172 If allocLength > Length Then 181 173 Dim oldLength As Long 182 oldLength = m_Length174 oldLength = Length 183 175 If AllocStringBuffer(allocLength) <> 0 Then 184 ZeroMemory( m_Chars + oldLength, m_Length - oldLength + 1)176 ZeroMemory(Chars + oldLength, Length - oldLength + 1) 185 177 End If 186 178 Else 187 m_Length = allocLength188 m_Chars[m_Length] = 0179 Length = allocLength 180 Chars[Length] = 0 189 181 End If 190 182 End Sub … … 193 185 If allocLength < 0 Then 194 186 Exit Sub 195 ElseIf allocLength > m_Length Then187 ElseIf allocLength > Length Then 196 188 Dim oldLength As Long 197 oldLength = m_Length189 oldLength = Length 198 190 If AllocStringBuffer(allocLength) <> 0 Then 199 FillMemory( m_Chars + oldLength, m_Length - oldLength, c)191 FillMemory(Chars + oldLength, Length - oldLength, c) 200 192 End If 201 193 Else 202 m_Length = allocLength203 End If 204 m_Chars[m_Length] = 0194 Length = allocLength 195 End If 196 Chars[Length] = 0 205 197 End Sub 206 198 207 199 Sub Assign(lpszText As LPSTR, textLength As Long) 208 If lpszText = m_Chars Then Exit Sub200 If lpszText = Chars Then Exit Sub 209 201 If AllocStringBuffer(textLength) <> 0 Then 210 memcpy( m_Chars, lpszText, textLength)211 m_Chars[m_Length] = 0202 memcpy(Chars, lpszText, textLength) 203 Chars[Length] = 0 212 204 End If 213 205 End Sub 214 206 215 207 Sub Assign(ByRef objString As String) 216 Assign(objString. m_Chars, objString.m_Length)208 Assign(objString.Chars, objString.Length) 217 209 End Sub 218 210 … … 221 213 Assign(lpszText, lstrlen(lpszText)) 222 214 Else 223 ' m_Chars=_System_realloc(m_Chars,1)224 m_Chars[0] = 0225 m_Length = 0215 'Chars=_System_realloc(Chars,1) 216 Chars[0] = 0 217 Length = 0 226 218 End If 227 219 End Sub … … 229 221 Sub Append(lpszText As LPSTR, textLength As Long) 230 222 Dim prevLen As Long 231 prevLen = m_Length232 If AllocStringBuffer( m_Length + textLength) <> 0 Then233 memcpy( m_Chars + prevLen, lpszText, textLength)234 m_Chars[m_Length] = 0223 prevLen = Length 224 If AllocStringBuffer(Length + textLength) <> 0 Then 225 memcpy(Chars + prevLen, lpszText, textLength) 226 Chars[Length] = 0 235 227 End If 236 228 End Sub … … 241 233 242 234 Sub Append(ByRef str As String) 243 Append(str. m_Chars, str.m_Length)235 Append(str.Chars, str.Length) 244 236 End Sub 245 237 … … 247 239 Dim tempString As String 248 240 With tempString 249 .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] = 0241 .AllocStringBuffer(This.Length + textLength) 242 memcpy(.Chars, This.Chars, This.Length) 243 memcpy(.Chars + This.Length, lpszText, textLength) 244 .Chars[.Length] = 0 253 245 End With 254 246 Return tempString … … 256 248 257 249 Function Contains(ByRef objString As String) As BOOL 258 If IndexOf(objString, 0, m_Length) >= 0 Then250 If IndexOf(objString, 0, Length) >= 0 Then 259 251 Return _System_TRUE 260 252 Else … … 264 256 265 257 Function Contains(lpszText As LPSTR) As BOOL 266 If IndexOf(lpszText, 0, m_Length) >= 0 Then258 If IndexOf(lpszText, 0, Length) >= 0 Then 267 259 Return _System_TRUE 268 260 Else … … 272 264 273 265 Function IndexOf(lpszText As LPSTR) As Long 274 Return IndexOf(lpszText, 0, m_Length)266 Return IndexOf(lpszText, 0, Length) 275 267 End Function 276 268 277 269 Function IndexOf(lpszText As LPSTR, startIndex As Long) As Long 278 Return IndexOf(lpszText, startIndex, m_Length - startIndex)270 Return IndexOf(lpszText, startIndex, Length - startIndex) 279 271 End Function 280 272 … … 284 276 285 277 If startIndex < 0 Then Return -1 286 If count < 1 Or count + startIndex > m_Length Then Return -1287 If length > m_Length Then Return -1278 If count < 1 Or count + startIndex > Length Then Return -1 279 If length > Length Then Return -1 288 280 289 281 If length = 0 Then Return startIndex … … 292 284 For i = startIndex To startIndex + count - 1 293 285 For j = 0 To length - 1 294 If m_Chars[i + j] = lpszText[j] Then286 If Chars[i + j] = lpszText[j] Then 295 287 If j = length - 1 Then Return i 296 288 Else … … 303 295 304 296 Function LastIndexOf(lpszText As LPSTR) As Long 305 Return LastIndexOf(lpszText, m_Length - 1, m_Length)297 Return LastIndexOf(lpszText, Length - 1, Length) 306 298 End Function 307 299 … … 314 306 length = lstrlen(lpszText) 315 307 316 If startIndex < 0 Or startIndex > m_Length - 1 Then Return -1308 If startIndex < 0 Or startIndex > Length - 1 Then Return -1 317 309 If count < 1 Or count > startIndex + 2 Then Return -1 318 If length > m_Length Then Return -1310 If length > Length Then Return -1 319 311 320 312 If length = 0 Then Return startIndex … … 323 315 For i = startIndex To startIndex - count + 1 Step -1 324 316 For j = length - 1 To 0 Step -1 325 If m_Chars[i + j] = lpszText[j] Then317 If Chars[i + j] = lpszText[j] Then 326 318 If j = 0 Then Return i 327 319 Else … … 342 334 343 335 Function EndsWith(lpszText As LPSTR) As BOOL 344 If LastIndexOf(lpszText) = m_Length - lstrlen(lpszText) Then336 If LastIndexOf(lpszText) = Length - lstrlen(lpszText) Then 345 337 Return _System_TRUE 346 338 Else … … 353 345 length = lstrlen(lpszText) 354 346 355 If startIndex < 0 Or startIndex > m_Length Then Return -1347 If startIndex < 0 Or startIndex > Length Then Return -1 356 348 357 349 Dim newChars As LPSTR 358 newChars = _System_malloc(length + m_Length + 1)350 newChars = _System_malloc(length + Length + 1) 359 351 If newChars = 0 Then Return -1 360 352 361 memcpy(newChars, m_Chars, startIndex)353 memcpy(newChars, Chars, startIndex) 362 354 memcpy(newChars + startIndex, lpszText, length) 363 memcpy(newChars + startIndex + length, m_Chars + startIndex, m_Length - startIndex + 1)364 365 _System_free( m_Chars)366 m_Chars = newChars367 m_Length = length + m_Length368 Return m_Length355 memcpy(newChars + startIndex + length, Chars + startIndex, Length - startIndex + 1) 356 357 _System_free(Chars) 358 Chars = newChars 359 Length = length + Length 360 Return Length 369 361 End Function 370 362 371 363 Function SubString(startIndex As Long) As String 372 Return SubString(startIndex, m_Length - startIndex)364 Return SubString(startIndex, Length - startIndex) 373 365 End Function 374 366 375 367 Function SubString(startIndex As Long, length As Long) As String 376 368 If startIndex < 0 Or length <= 0 Then Return "" 377 If startIndex + length > m_Length Then Return ""369 If startIndex + length > Length Then Return "" 378 370 379 371 Dim temp As String 380 372 temp.AllocStringBuffer(length) 381 memcpy(temp. m_Chars, VarPtr(m_Chars[startIndex]), length)382 m_Chars[m_Length] = 0373 memcpy(temp.Chars, VarPtr(Chars[startIndex]), length) 374 Chars[Length] = 0 383 375 Return temp 384 376 End Function 385 377 386 378 Function Remove(startIndex As Long) As Long 387 If startIndex < 0 Or startIndex > m_Length Then Return -1388 m_Chars[startIndex] = 0389 m_Length = startIndex390 Return m_Length379 If startIndex < 0 Or startIndex > Length Then Return -1 380 Chars[startIndex] = 0 381 Length = startIndex 382 Return Length 391 383 End Function 392 384 393 385 Function Remove(startIndex As Long, count As Long) As Long 394 386 If startIndex < 0 Or count < 0 Then Return -1 395 If startIndex + count > m_Length Then Return -1387 If startIndex + count > Length Then Return -1 396 388 397 389 Dim newChars As LPSTR 398 newChars = _System_malloc( m_Length - count + 1)390 newChars = _System_malloc(Length - count + 1) 399 391 If newChars = 0 Then Return -1 400 392 401 memcpy(newChars, m_Chars, startIndex)402 memcpy(newChars + startIndex, m_Chars + startIndex + count, m_Length - startIndex - count)403 newChars[ m_Length - count] = 0404 405 _System_free( m_Chars)406 m_Chars = newChars407 m_Length = m_Length - count408 Return m_Length393 memcpy(newChars, Chars, startIndex) 394 memcpy(newChars + startIndex, Chars + startIndex + count, Length - startIndex - count) 395 newChars[Length - count] = 0 396 397 _System_free(Chars) 398 Chars = newChars 399 Length = Length - count 400 Return Length 409 401 End Function 410 402 411 403 Function IsNullOrEmpty() As BOOL 412 If m_Length = 0 Then404 If Length = 0 Then 413 405 Return _System_TRUE 414 406 Else … … 419 411 Sub Replace(oldChar As Byte, newChar As Byte) 420 412 Dim i As Long 421 For i = 0 To ELM( m_Length)422 If m_Chars[i] = oldChar Then423 m_Chars[i] = newChar413 For i = 0 To ELM(Length) 414 If Chars[i] = oldChar Then 415 Chars[i] = newChar 424 416 End If 425 417 Next … … 427 419 428 420 Sub Replace(ByRef oldStr As String, ByRef newStr As String) 429 Replace(oldStr, oldStr. m_Length, newStr, newStr.m_Length)421 Replace(oldStr, oldStr.Length, newStr, newStr.Length) 430 422 End Sub 431 423 … … 444 436 Exit Do 445 437 End If 446 .Append( m_Chars + current, pos - current)438 .Append(Chars + current, pos - current) 447 439 .Append(newStr, newLen) 448 440 current = pos + oldLen 449 441 Loop 450 .Append( m_Chars + current, m_Length - current)442 .Append(Chars + current, Length - current) 451 443 End With 452 444 Swap(tempString) … … 454 446 455 447 Sub ToLower() 456 CharLower( m_Chars)448 CharLower(Chars) 457 449 End Sub 458 450 459 451 Sub ToUpper() 460 CharUpper( m_Chars)452 CharUpper(Chars) 461 453 End Sub 462 454 … … 464 456 Dim tempLen As Long 465 457 Dim tempChars As PSTR 466 tempLen = x. m_Length467 tempChars = x. m_Chars468 x. m_Length = This.m_Length469 x. m_Chars = This.m_Chars470 This. m_Length = tempLen471 This. m_Chars = tempChars458 tempLen = x.Length 459 tempChars = x.Chars 460 x.Length = This.Length 461 x.Chars = This.Chars 462 This.Length = tempLen 463 This.Chars = tempChars 472 464 End Sub 473 465 … … 477 469 If textLength < 0 Then 478 470 Return 0 479 ElseIf textLength > m_Length Then480 AllocStringBuffer = _System_realloc( m_Chars, textLength + 1)471 ElseIf textLength > Length Then 472 AllocStringBuffer = _System_realloc(Chars, textLength + 1) 481 473 If AllocStringBuffer <> 0 Then 482 m_Length = textLength483 m_Chars = AllocStringBuffer474 Length = textLength 475 Chars = AllocStringBuffer 484 476 End If 485 477 Else 486 m_Length = textLength487 AllocStringBuffer = m_Chars478 Length = textLength 479 AllocStringBuffer = Chars 488 480 End If 489 481 End Function -
/Include/api_winsock2.sbp
r30 r20 238 238 Const INADDR_ANY = &h0 239 239 240 Declare Function htons Lib "ws2_32.dll" (netshort As Word) As Word241 Declare Function htonl Lib "ws2_32.dll" (netshort As DWord) As DWord242 Declare Function ntohs Lib "ws2_32.dll" (netshort As Word) As Word243 Declare Function ntohl Lib "ws2_32.dll" (netshort As DWord) As DWord244 240 245 241 #endif '_INC_WINSOCK2 -
/Include/basic/command.sbp
r30 r20 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, lpStr As String)(lpTitle As String, BoxType As DWord, ByRef retAns As DWord)58 Macro MSGBOX(hWnd As HWND, ByRef str As String)(ByRef title As String, boxType As DWord, ByRef retAns As DWord) 59 59 If VarPtr(retAns) Then 60 retAns =MessageBox(hWnd,lpStr,lpTitle,BoxType)60 retAns = MessageBox(hWnd, str, title, boxType) 61 61 Else 62 MessageBox(hWnd, lpStr,lpTitle,BoxType)62 MessageBox(hWnd, str, title, boxType) 63 63 End If 64 64 End Macro 65 65 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)(lpClassAs String, id As DWord, lpFunc As DWord, dwExStyle As DWord)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 className As String, id As DWord, lpFunc As DWord, dwExStyle As DWord) 67 67 If VarPtr(hWnd) Then 68 hWnd =CreateWindowEx(dwExStyle,lpClass,lpTitle,dwStyle,x,y,nWidth,nHeight,hOwner,id,GetModuleHandle(0),NULL)68 hWnd = CreateWindowEx(dwExStyle, className.Chars, title, dwStyle, x, y, nWidth, nHeight, hOwner, id, GetModuleHandle(0), NULL) 69 69 Else 70 CreateWindowEx(dwExStyle, lpClass,lpTitle,dwStyle,x,y,nWidth,nHeight,hOwner,id,GetModuleHandle(0),NULL)70 CreateWindowEx(dwExStyle, className.Chars, title, 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)( lpStringAs String, id As Long, hSubMenu As HMENU, state As Long)78 Macro INSMENU(hMenu As HMENU, PosID As Long, flag As Long)(ByRef str As String, id As Long, hSubMenu As HMENU, state As Long) 79 79 Dim mii As MENUITEMINFO 80 80 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 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 95 98 End If 96 mii.fState=state 97 End If 98 99 InsertMenuItem(hMenu,PosID,flag,mii) 99 End With 100 101 InsertMenuItem(hMenu, PosID, flag, mii) 100 102 End Macro 101 103 … … 105 107 '-------------- 106 108 107 Dim _System_hFile(255) As Long 108 Macro OPEN(lpFileName As String, AccessFor As Long, FileNumber As Long) 109 Dim _System_hFile[255] As HANDLE 110 111 Macro OPEN(ByRef fileName As String, AccessFor As Long, FileNumber As Long) 109 112 Dim dwAccess As Long 110 113 Dim bAppend As Long 111 114 Dim dwCreationDisposition As Long 112 115 113 FileNumber =FileNumber-1116 FileNumber-- 114 117 115 118 bAppend=0 … … 130 133 End Select 131 134 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 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 136 140 Macro CLOSE()(FileNumber As Long) 137 FileNumber =FileNumber-1141 FileNumber-- 138 142 139 143 If _System_hFile(FileNumber) Then 140 CloseHandle(_System_hFile (FileNumber))141 _System_hFile(FileNumber) =0144 CloseHandle(_System_hFile[FileNumber]) 145 _System_hFile(FileNumber) = 0 142 146 End If 143 147 End Macro … … 147 151 Dim _System_InputDataType[_System_MAX_PARMSNUM] As DWord 148 152 Sub INPUT_FromFile(FileNumber As Long) 149 Dim i As Long ,i2 As Long, i3 As Long153 Dim i As Long, i2 As Long, i3 As Long 150 154 Dim buffer As String 151 155 Dim temp[1] As Byte … … 153 157 Dim IsStr As Long 154 158 155 FileNumber =FileNumber-1159 FileNumber-- 156 160 157 161 buffer=ZeroString(GetFileSize(_System_hFile[FileNumber],0)) … … 173 177 IsStr=0 174 178 While 1 175 i3 =i3+1179 i3++ 176 180 177 181 i2=ReadFile(_System_hFile[FileNumber],temp,1,VarPtr(dwAccessBytes),ByVal 0) … … 197 201 If dwAccessBytes=0 Then Exit While 198 202 If temp[0]=Asc(",") Then Exit While 199 If Not(temp[0]=32 or temp[0]=9)Then203 If temp[0] <> 32 And temp[0] <> 9 Then 200 204 SetFilePointer(_System_hFile[FileNumber],-1,0,FILE_CURRENT) 201 205 Exit While … … 227 231 Dim pTempStr As *String 228 232 pTempStr=_System_InputDataPtr[i] As *String 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 233 pTempStr->Assign(buffer.Chars, i3) 234 234 End Select 235 235 236 i =i+1236 i++ 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 =FileNumber-1243 FileNumber-- 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 =i2+1266 i3 =i3+1265 i2++ 266 i3++ 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 =i4+1285 i4++ 286 286 Wend 287 287 If UsingStr[i4]=Asc(".") Then 288 i4 =i4+1288 i4++ 289 289 290 290 dblRoundOff=0.5 291 291 While UsingStr[i4]=Asc("#") 292 i4 =i4+1292 i4++ 293 293 dblRoundOff=dblRoundOff/10 294 294 Wend … … 304 304 305 305 '符号が有る場合は、一文字分のスペースを考慮する 306 If sign Then length_num =length_num+1306 If sign Then length_num++ 307 307 308 308 length_buf=0 309 309 Do 310 i2 =i2+1311 length_buf =length_buf+1310 i2++ 311 length_buf++ 312 312 Loop While UsingStr[i2]=Asc("#") 313 313 … … 315 315 '通常時 316 316 FillMemory(StrPtr(buffer)+i3,length_buf-length_num,Asc(" ")) 317 i3 =i3+(length_buf-length_num)317 i3 += length_buf - length_num 318 318 319 319 If sign Then 320 320 buffer[i3]=Asc("-") 321 i3 =i3+1322 323 length_num =length_num-1321 i3++ 322 323 length_num-- 324 324 End If 325 325 … … 330 330 End If 331 331 332 i3 =i3+length_num332 i3 += length_num 333 333 Else 334 334 '表示桁が足りないとき 335 335 FillMemory(StrPtr(buffer)+i3,length_buf,Asc("#")) 336 i3 =i3+length_buf336 i3 += length_buf 337 337 End If 338 338 339 339 If UsingStr[i2]=Asc(".") Then 340 340 buffer[i3]=UsingStr[i2] 341 i2 =i2+1342 i3 =i3+1341 i2++ 342 i3++ 343 343 344 344 i4=dec … … 349 349 buffer[i3]=temp2[i4] 350 350 End If 351 i3 =i3+1352 i4 =i4+1353 354 i2 =i2+1351 i3++ 352 i4++ 353 354 i2++ 355 355 Wend 356 356 End If 357 357 ElseIf UsingStr[i2]=Asc("@") Then 358 i2 =i2+1358 i2++1 359 359 360 360 lstrcat(StrPtr(buffer)+i3,_System_UsingStrData[ParmNum]) 361 i3 =i3+lstrlen(_System_UsingStrData[ParmNum])361 i3 += lstrlen(_System_UsingStrData[ParmNum]) 362 362 ElseIf UsingStr[i2]=Asc("&") Then 363 363 i4=0 364 364 Do 365 i4 =i4+1366 i2 =i2+1365 i4++ 366 i2++ 367 367 Loop While UsingStr[i2]=Asc(" ") 368 368 369 369 If UsingStr[i2]=Asc("&") Then 370 i4 =i4+1371 i2 =i2+1370 i4++ 371 i2++ 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 =i3+i4379 i3 += i4 380 380 Else 381 i2 =i2-i4381 i2 -= i4 382 382 buffer[i3]=Asc("&") 383 i2 =i2+1384 i3 =i3+1383 i2++ 384 i3++ 385 385 Continue 386 386 End If 387 387 End If 388 388 389 ParmNum =ParmNum+1389 ParmNum++ 390 390 Wend 391 391 392 392 _System_GetUsingFormat=Left$(buffer,lstrlen(buffer)) 393 393 End Function 394 394 395 Sub PRINTUSING_ToFile(FileNumber As Long, UsingStr As String) 395 396 Dim dwAccessByte As DWord 396 397 Dim buf As String 397 398 398 FileNumber =FileNumber-1399 FileNumber-- 399 400 buf=_System_GetUsingFormat(UsingStr) 400 401 … … 403 404 404 405 Dim _System_FieldSize(255) As Long 406 405 407 Macro FIELD(FileNumber As Long, FieldSize As Long) 406 FileNumber =FileNumber-1408 FileNumber-- 407 409 408 410 _System_FieldSize(FileNumber)=FieldSize 409 411 End Macro 412 410 413 Macro GET(FileNumber As Long, RecodeNumber As Long, ByRef lpBuffer As String) 411 414 Dim dwAccessByte As Long 412 415 413 FileNumber =FileNumber-1414 RecodeNumber =RecodeNumber-1416 FileNumber-- 417 RecodeNumber-- 415 418 416 419 SetFilePointer(_System_hFile(FileNumber),RecodeNumber*_System_FieldSize(FileNumber),NULL,FILE_BEGIN) … … 421 424 End If 422 425 End Macro 426 423 427 Macro PUT(FileNumber As Long, RecodeNumber As Long, ByRef lpBuffer As String) 424 428 Dim dwAccessByte As Long 425 429 426 FileNumber =FileNumber-1427 RecodeNumber =RecodeNumber-1430 FileNumber-- 431 RecodeNumber-- 428 432 429 433 SetFilePointer(_System_hFile(FileNumber),RecodeNumber*_System_FieldSize(FileNumber),NULL,FILE_BEGIN) … … 431 435 End Macro 432 436 433 Macro CHDIR( path As String)437 Macro CHDIR(ByRef path As String) 434 438 SetCurrentDirectory(path) 435 439 End Macro 436 Macro MKDIR(path As String) 440 441 Macro MKDIR(ByRef path As String) 437 442 CreateDirectory(path,ByVal 0) 438 443 End Macro 439 Macro KILL(path As String) 444 445 Macro KILL(ByRef path As String) 440 446 DeleteFile(path) 441 447 End Macro -
/Include/basic/function.sbp
r30 r20 769 769 i64data=1 770 770 While i>=2 771 Val += (i64data*TempPtr[i]) As Double771 Val += i64data*TempPtr[i] 772 772 773 773 i64data *= &H10 … … 957 957 Loop 958 958 If dir Then dir[i3]=0 959 i3 += i -i2959 i3 += ii-i2 960 960 961 961 'ファイル名をコピー -
/Include/system/enum.sbp
r30 r20 18 18 Return m_Value 19 19 End Function 20 21 Function Operator == (Value As Long) As Long22 If m_Value = Value Then23 Return _System_TRUE24 Else25 Return _System_FALSE26 End If27 End Function28 20 End Class
Note:
See TracChangeset
for help on using the changeset viewer.