Changes in / [30:20]


Ignore:
Location:
/Include
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • /Include/Classes/System/Drawing/Color.ab

    r30 r20  
    1818Public
    1919    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
    2521    End Sub
    2622
     
    3026
    3127    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 = newArgb
     28        Argb = MakeARGB(a, r, g, b)
     29    End Sub
     30
     31    Sub Color(argb As ARGB)
     32        Argb = argb
    3733    End Sub
    3834
    3935    Sub Operator =(c As Color)
    40         argb = c.argb
     36        SetValue(c)
    4137    End Sub
    4238
     
    6561    End Function
    6662
    67     Function Value() As ARGB
    68         Return argb
    69     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)
    7268        argb = value
    7369    End Sub
    7470
    7571    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))
    8173    End Sub
    8274
     
    9991    End Function
    10092
    101     Static Function FromArgb(r As Byte, g As Byte, b As Byte) As Color
     93    Static Function FromArgb(r As Byte, g As Byte, b As Byte)
    10294        Dim c As Color(r, g, b)
    10395        Return c
    10496    End Function
    10597
    106     Static Function FromArgb(a As Byte, r As Byte, g As Byte, b As Byte) As Color
     98    Static Function FromArgb(a As Byte, r As Byte, g As Byte, b As Byte)
    10799        Dim c As Color(a, r, g, b)
    108100        Return c
     
    305297    End Enum
    306298*/
    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
     300Private
     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
    308305        MakeARGB = (((b As ARGB) <<  Color_BlueShift) Or _
    309306                    ((g As ARGB) << Color_GreenShift) Or _
  • /Include/Classes/System/Drawing/Point.ab

    r30 r20  
    44#define __SYSTEM_DRAWING_POINT_AB__
    55
    6 #include <Classes/System/Drawing/PointF.ab>
    76#include <Classes/System/Drawing/Size.ab>
    87#include <Classes/System/Drawing/SizeF.ab>
     
    6564
    6665    Function Operator + (pt As Point) As Point
    67         Return Add(This, pt)
     66        Return Add(pt)
    6867    End Function
    6968
    7069    Function Operator + (sz As Size) As Point
    71         Return Add(This, sz)
     70        Return Add(sz)
    7271    End Function
    7372
    7473    Function Operator - (pt As Point) As Point
    75         Return Substract(This, pt)
     74        Return Substract(pt)
    7675    End Function
    7776
    7877    Function Operator - (sz As Size) As Point
    79         Return Substract(This, sz)
     78        Return Substract(sz)
    8079    End Function
    8180
     
    8887    End Function
    8988
    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)
     89    Function Add(pt As Point) As Point
     90        Dim ret As Point(x + pt.x, y + pt.y)
    9291        Return ret
    9392    End Function
    9493
    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)
     94    Function Add(sz As Size) As Point
     95        Dim ret As Point(x + sz.width, y + sz.height)
    9796        Return ret
    9897    End Function
     
    10099    Function Offset(pt As Point) As Point
    101100        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)
    102109        Return ret
    103110    End Function
    104111
    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)
    117114        Return ret
    118115    End Function
  • /Include/Classes/System/Drawing/PointF.ab

    r30 r20  
    5858    End Sub
    5959
    60     Function Operator () As PointF
    61         Dim ptf As PointF(X, Y)
    62         Return ptf
    63     End Function
    64 
    6560    Function Operator + (pt As PointF) As PointF
    66         Return Add(This, pt)
     61        Return Add(pt)
    6762    End Function
    6863
    6964    Function Operator + (sz As Size) As PointF
    70         Return Add(This, sz)
     65        Return Add(sz)
    7166    End Function
    7267
    7368    Function Operator + (sz As SizeF) As PointF
    74         Return Add(This, sz)
     69        Return Add(sz)
    7570    End Function
    7671
    7772    Function Operator - (pt As PointF) As PointF
    78         Return Substract(This, pt)
     73        Return Substract(pt)
    7974    End Function
    8075
    8176    Function Operator - (sz As Size) As PointF
    82         Return Substract(This, sz)
     77        Return Substract(sz)
    8378    End Function
    8479
    8580    Function Operator - (sz As SizeF) As PointF
    86         Return Substract(This, sz)
     81        Return Substract(sz)
    8782    End Function
    8883
     
    9590    End Function
    9691
    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)
     92    Function Add(pt As PointF) As PointF
     93        Dim ret As PointF(x + pt.x, y + pt.y)
    9994        Return ret
    10095    End Function
    10196
    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)
     97    Function Add(sz As Size) As PointF
     98        Dim ret As PointF(x + sz.width, y + sz.height)
    10499        Return ret
    105100    End Function
    106101
    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)
     102    Function Add(sz As SizeF) As PointF
     103        Dim ret As PointF(x + sz.width, y + sz.height)
    109104        Return ret
    110105    End Function
    111106
    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)
     107    Function Substract(pt As PointF) As PointF
     108        Dim ret As PointF(x - pt.x, y - pt.y)
    114109        Return ret
    115110    End Function
    116111
    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)
     112    Function Substract(sz As Size) As PointF
     113        Dim ret As PointF(x - sz.width, y - sz.height)
    119114        Return ret
    120115    End Function
    121116
    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)
     117    Function Substract(sz As SizeF) As PointF
     118        Dim ret As PointF(x - sz.width, y - sz.height)
    124119        Return ret
    125120    End Function
  • /Include/Classes/System/Drawing/Rectangle.ab

    r30 r20  
    2727    Sub Rectangle(location As Point, size As Size)
    2828        x = location.X
    29         y = location.Y
     29        y = lccation.Y
    3030        width = size.Height
    31         height = size.Height
     31        hegiht = size.Height
    3232    End Sub
    3333
     
    3535        x = rc.x
    3636        y = rc.y
    37         width = rc.width
     37        widht = rc.width
    3838        height = rc.height
    3939    End Sub
     
    107107
    108108    Function IsEmpty() As BOOL
    109         If Width <= 0 Or Height <= 0 Then
    110             IsEmpty = _System_TRUE
    111         Else
    112             IsEmpty = _System_FALSE
     109        If Width <= Single_EPSILON Or Height <= Single_EPSILON Then
     110            IsEmptyArea = _System_TRUE
     111        Else
     112            IsEmptyArea = _System_FALSE
    113113        End If
    114114    End Function
     
    145145
    146146    Static Function FromLTRB(l As Single, t As Single, r As Single, b As Single) As Rectangle
    147         Dim rect As Rectangle(l, t, r - l, r - b)
    148         return rect
     147        Dim r As Rectangle(left, top, right - left, bottom - top)
     148        return r
    149149    End Function
    150150
     
    162162
    163163    Function Contains(ByRef rc As Rectangle) As BOOL
    164         If X <= rc.X And rc.Right <= Right And Y <= rc.Y And rc.Bottom <= Bottom Then
     164        If X <= rc.X && rc.Right <= Right && Y <= rc.Y && rc.Bottom <= Bottom Then
    165165            ContainsRCF = _System_TRUE
    166166        Else
     
    172172        X -= dx
    173173        Y -= dy
    174         Width += dx + dx
    175         Height += dy + dy
     174        Width = dx + dx
     175        Height = dy + dy
    176176    End Sub
    177177
    178178    Sub Inflate(sz As Size)
    179179        Inflate(sz.Width, sz.Height)
     180    End Sub
     181
     182    Sub Inflate(pt As Point)
     183        Inflate(pt.X, pt.Y)
    180184    End Sub
    181185
     
    185189    End Function
    186190
    187     Sub Intersect(ByRef rect As Rectangle)
    188         This = Rectangle.Intersect(This, rect)
    189     End Sub
     191    Function Intersect(ByRef rect As Rectangle) As BOOL
     192        Intersect = Intersect(This, This, rect)
     193    End Function
    190194
    191195    Static Function Intersect(ByRef a As Rectangle, ByRef b As Rectangle) As Rectangle
     
    195199        left = Math.Min(a.Left, b.Left)
    196200        top = Math.Min(a.Top, b.Top)
    197         Return Rectangle.FromLTRB(left, top, right, bottom)
     201        Return FromLTRB(left, top, right, bottom)
    198202    End Function
    199203
     
    211215    Static Function Union(ByRef a As Rectangle, ByRef b As Rectangle) As Rectangle
    212216        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())
    217221        Return FromLTRB(left, top, right, bottom)
    218222    End Function
  • /Include/Classes/System/Math.ab

    r30 r20  
    546546                    last = Sqrt
    547547                    Sqrt = (x /Sqrt + Sqrt) * 0.5
    548                 Loop While Sqrt <> last
     548                Loop While s <> last
    549549            End If
    550550        ElseIf x < 0 Then
    551             Sqrt = _System_GetNaN()
     551            Sqr = _System_GetNaN()
    552552        Else
    553553            'x = 0 Or NaN
  • /Include/Classes/System/String.ab

    r30 r20  
    11Class String
    2     m_Chars As LPSTR
    3     m_Length As Long
    42Public
     3    Chars As LPSTR
     4    Length As Long
    55
    66    Sub String()
    7         m_Chars = _System_calloc(1)
    8         m_Length = 0
     7        Chars = _System_calloc(1)
     8        Length = 0
    99    End Sub
    1010
     
    1313        Assign(initStr)
    1414    End Sub
    15 
    16 /*  Sub String(ByRef initStr As String)
     15/*
     16    Sub String(ByRef initStr As String)
    1717        String()
    1818        Assign(initStr)
     
    2929
    3030    Sub ~String()
    31         _System_free(m_Chars)
    32         m_Chars = 0
     31        _System_free(Chars)
     32        Chars = 0
    3333#ifdef _DEBUG
    34         m_Length = 0
     34        Length = 0
    3535#endif
    3636    End Sub
    3737
    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 
    4638    Function Operator() As LPSTR
    47         Return m_Chars
     39        Return Chars
    4840    End Function
    4941
    5042    Sub Operator = (ByRef objString As String)
    51         Assign(objString.m_Chars, objString.m_Length)
     43        Assign(objString.Chars, objString.Length)
    5244    End Sub
    5345
     
    5749
    5850    Function Operator[] (n As Long) As Byte
    59         Return m_Chars[n]
     51        Return Chars[n]
    6052    End Function
    6153
    6254    Sub Operator[]= (n As Long, c As Byte)
    63         m_Chars[n] = c
     55        Chars[n] = c
    6456    End Sub
    6557
     
    6961
    7062    Function Operator+ (ByRef objString As String) As String
    71         Return Concat(objString, objString.m_Length)
     63        Return Concat(objString, objString.Length)
    7264    End Function
    7365
     
    173165
    174166    Function StrPtr() As LPSTR
    175         Return m_Chars
     167        Return Chars
    176168    End Function
    177169
    178170    Sub ReSize(allocLength As Long)
    179171        If allocLength < 0 Then Exit Sub
    180         If allocLength > m_Length Then
     172        If allocLength > Length Then
    181173            Dim oldLength As Long
    182             oldLength = m_Length
     174            oldLength = Length
    183175            If AllocStringBuffer(allocLength) <> 0 Then
    184                 ZeroMemory(m_Chars + oldLength, m_Length - oldLength + 1)
     176                ZeroMemory(Chars + oldLength, Length - oldLength + 1)
    185177            End If
    186178        Else
    187             m_Length = allocLength
    188             m_Chars[m_Length] = 0
     179            Length = allocLength
     180            Chars[Length] = 0
    189181        End If
    190182    End Sub
     
    193185        If allocLength < 0 Then
    194186            Exit Sub
    195         ElseIf allocLength > m_Length Then
     187        ElseIf allocLength > Length Then
    196188            Dim oldLength As Long
    197             oldLength = m_Length
     189            oldLength = Length
    198190            If AllocStringBuffer(allocLength) <> 0 Then
    199                 FillMemory(m_Chars + oldLength, m_Length - oldLength, c)
     191                FillMemory(Chars + oldLength, Length - oldLength, c)
    200192            End If
    201193        Else
    202             m_Length = allocLength
    203         End If
    204         m_Chars[m_Length] = 0
     194            Length = allocLength
     195        End If
     196        Chars[Length] = 0
    205197    End Sub
    206198
    207199    Sub Assign(lpszText As LPSTR, textLength As Long)
    208         If lpszText = m_Chars Then Exit Sub
     200        If lpszText = Chars Then Exit Sub
    209201        If AllocStringBuffer(textLength) <> 0 Then
    210             memcpy(m_Chars, lpszText, textLength)
    211             m_Chars[m_Length] = 0
     202            memcpy(Chars, lpszText, textLength)
     203            Chars[Length] = 0
    212204        End If     
    213205    End Sub
    214206
    215207    Sub Assign(ByRef objString As String)
    216         Assign(objString.m_Chars, objString.m_Length)
     208        Assign(objString.Chars, objString.Length)
    217209    End Sub
    218210
     
    221213            Assign(lpszText, lstrlen(lpszText))
    222214        Else
    223             'm_Chars=_System_realloc(m_Chars,1)
    224             m_Chars[0] = 0
    225             m_Length = 0
     215            'Chars=_System_realloc(Chars,1)
     216            Chars[0] = 0
     217            Length = 0
    226218        End If
    227219    End Sub
     
    229221    Sub Append(lpszText As LPSTR, textLength As Long)
    230222        Dim prevLen As Long
    231         prevLen = m_Length
    232         If AllocStringBuffer(m_Length + textLength) <> 0 Then
    233             memcpy(m_Chars + prevLen, lpszText, textLength)
    234             m_Chars[m_Length] = 0
     223        prevLen = Length
     224        If AllocStringBuffer(Length + textLength) <> 0 Then
     225            memcpy(Chars + prevLen, lpszText, textLength)
     226            Chars[Length] = 0
    235227        End If
    236228    End Sub
     
    241233
    242234    Sub Append(ByRef str As String)
    243         Append(str.m_Chars, str.m_Length)
     235        Append(str.Chars, str.Length)
    244236    End Sub
    245237
     
    247239        Dim tempString As String
    248240        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] = 0
     241            .AllocStringBuffer(This.Length + textLength)
     242            memcpy(.Chars, This.Chars, This.Length)
     243            memcpy(.Chars + This.Length, lpszText, textLength)
     244            .Chars[.Length] = 0
    253245        End With
    254246        Return tempString
     
    256248
    257249    Function Contains(ByRef objString As String) As BOOL
    258         If IndexOf(objString, 0, m_Length) >= 0 Then
     250        If IndexOf(objString, 0, Length) >= 0 Then
    259251            Return _System_TRUE
    260252        Else
     
    264256
    265257    Function Contains(lpszText As LPSTR) As BOOL
    266         If IndexOf(lpszText, 0, m_Length) >= 0 Then
     258        If IndexOf(lpszText, 0, Length) >= 0 Then
    267259            Return _System_TRUE
    268260        Else
     
    272264
    273265    Function IndexOf(lpszText As LPSTR) As Long
    274         Return IndexOf(lpszText, 0, m_Length)
     266        Return IndexOf(lpszText, 0, Length)
    275267    End Function
    276268
    277269    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)
    279271    End Function
    280272
     
    284276
    285277        If startIndex < 0 Then Return -1
    286         If count < 1 Or count + startIndex > m_Length Then Return -1
    287         If length > m_Length Then Return -1
     278        If count < 1 Or count + startIndex > Length Then Return -1
     279        If length > Length Then Return -1
    288280
    289281        If length = 0 Then Return startIndex
     
    292284        For i = startIndex To startIndex + count - 1
    293285            For j = 0 To length - 1
    294                 If m_Chars[i + j] = lpszText[j] Then
     286                If Chars[i + j] = lpszText[j] Then
    295287                    If j = length - 1 Then Return i
    296288                Else
     
    303295
    304296    Function LastIndexOf(lpszText As LPSTR) As Long
    305         Return LastIndexOf(lpszText, m_Length - 1, m_Length)
     297        Return LastIndexOf(lpszText, Length - 1, Length)
    306298    End Function
    307299
     
    314306        length = lstrlen(lpszText)
    315307
    316         If startIndex < 0 Or startIndex > m_Length - 1 Then Return -1
     308        If startIndex < 0 Or startIndex > Length - 1 Then Return -1
    317309        If count < 1 Or count > startIndex + 2 Then Return -1
    318         If length > m_Length Then Return -1
     310        If length > Length Then Return -1
    319311
    320312        If length = 0 Then Return startIndex
     
    323315        For i = startIndex To  startIndex - count + 1 Step -1
    324316            For j = length - 1 To 0 Step -1
    325                 If m_Chars[i + j] = lpszText[j] Then
     317                If Chars[i + j] = lpszText[j] Then
    326318                    If j = 0 Then Return i
    327319                Else
     
    342334
    343335    Function EndsWith(lpszText As LPSTR) As BOOL
    344         If LastIndexOf(lpszText) = m_Length - lstrlen(lpszText) Then
     336        If LastIndexOf(lpszText) = Length - lstrlen(lpszText) Then
    345337            Return _System_TRUE
    346338        Else
     
    353345        length = lstrlen(lpszText)
    354346
    355         If startIndex < 0 Or startIndex > m_Length Then Return -1
     347        If startIndex < 0 Or startIndex > Length Then Return -1
    356348
    357349        Dim newChars As LPSTR
    358         newChars = _System_malloc(length + m_Length + 1)
     350        newChars = _System_malloc(length + Length + 1)
    359351        If newChars = 0 Then Return -1
    360352
    361         memcpy(newChars, m_Chars, startIndex)
     353        memcpy(newChars, Chars, startIndex)
    362354        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 = newChars
    367         m_Length = length + m_Length
    368         Return m_Length
     355        memcpy(newChars + startIndex + length, Chars + startIndex, Length - startIndex + 1)
     356
     357        _System_free(Chars)
     358        Chars = newChars
     359        Length = length + Length
     360        Return Length
    369361    End Function
    370362
    371363    Function SubString(startIndex As Long) As String
    372         Return SubString(startIndex, m_Length - startIndex)
     364        Return SubString(startIndex, Length - startIndex)
    373365    End Function
    374366
    375367    Function SubString(startIndex As Long, length As Long) As String
    376368        If startIndex < 0 Or length <= 0 Then Return ""
    377         If startIndex + length > m_Length Then Return ""
     369        If startIndex + length > Length Then Return ""
    378370
    379371        Dim temp As String
    380372        temp.AllocStringBuffer(length)
    381         memcpy(temp.m_Chars, VarPtr(m_Chars[startIndex]), length)
    382         m_Chars[m_Length] = 0
     373        memcpy(temp.Chars, VarPtr(Chars[startIndex]), length)
     374        Chars[Length] = 0
    383375        Return temp
    384376    End Function
    385377
    386378    Function Remove(startIndex As Long) As Long
    387         If startIndex < 0 Or startIndex > m_Length Then Return -1
    388         m_Chars[startIndex] = 0
    389         m_Length = startIndex
    390         Return m_Length
     379        If startIndex < 0 Or startIndex > Length Then Return -1
     380        Chars[startIndex] = 0
     381        Length = startIndex
     382        Return Length
    391383    End Function
    392384
    393385    Function Remove(startIndex As Long, count As Long) As Long
    394386        If startIndex < 0 Or count < 0 Then Return -1
    395         If startIndex + count > m_Length Then Return -1
     387        If startIndex + count > Length Then Return -1
    396388
    397389        Dim newChars As LPSTR
    398         newChars = _System_malloc(m_Length - count + 1)
     390        newChars = _System_malloc(Length - count + 1)
    399391        If newChars = 0 Then Return -1
    400392
    401         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
     393        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
    409401    End Function
    410402
    411403    Function IsNullOrEmpty() As BOOL
    412         If m_Length = 0 Then
     404        If Length = 0 Then
    413405            Return _System_TRUE
    414406        Else
     
    419411    Sub Replace(oldChar As Byte, newChar As Byte)
    420412        Dim i As Long
    421         For i = 0 To ELM(m_Length)
    422             If m_Chars[i] = oldChar Then
    423                 m_Chars[i] = newChar
     413        For i = 0 To ELM(Length)
     414            If Chars[i] = oldChar Then
     415                Chars[i] = newChar
    424416            End If
    425417        Next
     
    427419
    428420    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)
    430422    End Sub
    431423
     
    444436                    Exit Do
    445437                End If
    446                 .Append(m_Chars + current, pos - current)
     438                .Append(Chars + current, pos - current)
    447439                .Append(newStr, newLen)
    448440                current = pos + oldLen
    449441            Loop
    450             .Append(m_Chars + current, m_Length - current)
     442            .Append(Chars + current, Length - current)
    451443        End With
    452444        Swap(tempString)
     
    454446
    455447    Sub ToLower()
    456         CharLower(m_Chars)
     448        CharLower(Chars)
    457449    End Sub
    458450
    459451    Sub ToUpper()
    460         CharUpper(m_Chars)
     452        CharUpper(Chars)
    461453    End Sub
    462454
     
    464456        Dim tempLen As Long
    465457        Dim tempChars As PSTR
    466         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
     458        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
    472464    End Sub
    473465
     
    477469        If textLength < 0 Then
    478470            Return 0
    479         ElseIf textLength > m_Length Then
    480             AllocStringBuffer = _System_realloc(m_Chars, textLength + 1)
     471        ElseIf textLength > Length Then
     472            AllocStringBuffer = _System_realloc(Chars, textLength + 1)
    481473            If AllocStringBuffer <> 0 Then
    482                 m_Length = textLength
    483                 m_Chars = AllocStringBuffer
     474                Length = textLength
     475                Chars = AllocStringBuffer
    484476            End If
    485477        Else
    486             m_Length = textLength
    487             AllocStringBuffer = m_Chars
     478            Length = textLength
     479            AllocStringBuffer = Chars
    488480        End If
    489481    End Function
  • /Include/api_winsock2.sbp

    r30 r20  
    238238Const INADDR_ANY = &h0
    239239
    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
    244240
    245241#endif '_INC_WINSOCK2
  • /Include/basic/command.sbp

    r30 r20  
    3535
    3636Macro 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)
    3838End Macro
    3939
     
    5656'----------------
    5757
    58 Macro MSGBOX(hWnd As HWND, lpStr As String)(lpTitle As String, BoxType As DWord, ByRef retAns As DWord)
     58Macro MSGBOX(hWnd As HWND, ByRef str As String)(ByRef title As String, boxType As DWord, ByRef retAns As DWord)
    5959    If VarPtr(retAns) Then
    60         retAns=MessageBox(hWnd,lpStr,lpTitle,BoxType)
     60        retAns = MessageBox(hWnd, str, title, boxType)
    6161    Else
    62         MessageBox(hWnd,lpStr,lpTitle,BoxType)
     62        MessageBox(hWnd, str, title, boxType)
    6363    End If
    6464End Macro
    6565
    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)
     66Macro 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)
    6767    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)
    6969    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)
    7171    End If
    7272End Macro
     
    7676End Macro
    7777
    78 Macro INSMENU(hMenu As HMENU, PosID As Long, flag As Long)(lpString As String, id As Long, hSubMenu As HMENU, state As Long)
     78Macro INSMENU(hMenu As HMENU, PosID As Long, flag As Long)(ByRef str As String, id As Long, hSubMenu As HMENU, state As Long)
    7979    Dim mii As MENUITEMINFO
    8080
    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
    9598        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)
    100102End Macro
    101103
     
    105107'--------------
    106108
    107 Dim _System_hFile(255) As Long
    108 Macro OPEN(lpFileName As String, AccessFor As Long, FileNumber As Long)
     109Dim _System_hFile[255] As HANDLE
     110
     111Macro OPEN(ByRef fileName As String, AccessFor As Long, FileNumber As Long)
    109112    Dim dwAccess As Long
    110113    Dim bAppend As Long
    111114    Dim dwCreationDisposition As Long
    112115
    113     FileNumber=FileNumber-1
     116    FileNumber--
    114117
    115118    bAppend=0
     
    130133    End Select
    131134
    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)
     138End Macro
     139
    136140Macro CLOSE()(FileNumber As Long)
    137     FileNumber=FileNumber-1
     141    FileNumber--
    138142
    139143    If _System_hFile(FileNumber) Then
    140         CloseHandle(_System_hFile(FileNumber))
    141         _System_hFile(FileNumber)=0
     144        CloseHandle(_System_hFile[FileNumber])
     145        _System_hFile(FileNumber) = 0
    142146    End If
    143147End Macro
     
    147151Dim _System_InputDataType[_System_MAX_PARMSNUM] As DWord
    148152Sub INPUT_FromFile(FileNumber As Long)
    149     Dim i As Long ,i2 As Long, i3 As Long
     153    Dim i As Long, i2 As Long, i3 As Long
    150154    Dim buffer As String
    151155    Dim temp[1] As Byte
     
    153157    Dim IsStr As Long
    154158
    155     FileNumber=FileNumber-1
     159    FileNumber--
    156160
    157161    buffer=ZeroString(GetFileSize(_System_hFile[FileNumber],0))
     
    173177        IsStr=0
    174178        While 1
    175             i3=i3+1
     179            i3++
    176180
    177181            i2=ReadFile(_System_hFile[FileNumber],temp,1,VarPtr(dwAccessBytes),ByVal 0)
     
    197201                        If dwAccessBytes=0 Then Exit While
    198202                        If temp[0]=Asc(",") Then Exit While
    199                         If Not(temp[0]=32 or temp[0]=9) Then
     203                        If temp[0] <> 32 And temp[0] <> 9 Then
    200204                            SetFilePointer(_System_hFile[FileNumber],-1,0,FILE_CURRENT)
    201205                            Exit While
     
    227231                Dim pTempStr As *String
    228232                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)
    234234        End Select
    235235
    236         i=i+1
     236        i++
    237237        If _System_InputDataPtr[i]=0 Then Exit While
    238238    Wend
     
    241241Sub PRINT_ToFile(FileNumber As Long, buf As String)
    242242    Dim dwAccessByte As DWord
    243     FileNumber=FileNumber-1
     243    FileNumber--
    244244
    245245    WriteFile(_System_hFile(FileNumber),buf,Len(buf),VarPtr(dwAccessByte),ByVal NULL)
     
    263263            buffer[i3]=UsingStr[i2]
    264264            If UsingStr[i2]=0 Then Exit While
    265             i2=i2+1
    266             i3=i3+1
     265            i2++
     266            i3++
    267267        Wend
    268268
     
    274274
    275275            Dim length_num As Long, length_buf As Long
    276             Dim dblRoundOff=0 As Double
     276            Dim dblRoundOff = 0 As Double
    277277
    278278
     
    283283            i4=i2
    284284            While UsingStr[i4]=Asc("#")
    285                 i4=i4+1
     285                i4++
    286286            Wend
    287287            If UsingStr[i4]=Asc(".") Then
    288                 i4=i4+1
     288                i4++
    289289
    290290                dblRoundOff=0.5
    291291                While UsingStr[i4]=Asc("#")
    292                     i4=i4+1
     292                    i4++
    293293                    dblRoundOff=dblRoundOff/10
    294294                Wend
     
    304304
    305305            '符号が有る場合は、一文字分のスペースを考慮する
    306             If sign Then length_num=length_num+1
     306            If sign Then length_num++
    307307
    308308            length_buf=0
    309309            Do
    310                 i2=i2+1
    311                 length_buf=length_buf+1
     310                i2++
     311                length_buf++
    312312            Loop While UsingStr[i2]=Asc("#")
    313313
     
    315315                '通常時
    316316                FillMemory(StrPtr(buffer)+i3,length_buf-length_num,Asc(" "))
    317                 i3=i3+(length_buf-length_num)
     317                i3 += length_buf - length_num
    318318
    319319                If sign Then
    320320                    buffer[i3]=Asc("-")
    321                     i3=i3+1
    322 
    323                     length_num=length_num-1
     321                    i3++
     322
     323                    length_num--
    324324                End If
    325325
     
    330330                End If
    331331
    332                 i3=i3+length_num
     332                i3 += length_num
    333333            Else
    334334                '表示桁が足りないとき
    335335                FillMemory(StrPtr(buffer)+i3,length_buf,Asc("#"))
    336                 i3=i3+length_buf
     336                i3 += length_buf
    337337            End If
    338338
    339339            If UsingStr[i2]=Asc(".") Then
    340340                buffer[i3]=UsingStr[i2]
    341                 i2=i2+1
    342                 i3=i3+1
     341                i2++
     342                i3++
    343343
    344344                i4=dec
     
    349349                        buffer[i3]=temp2[i4]
    350350                    End If
    351                     i3=i3+1
    352                     i4=i4+1
    353 
    354                     i2=i2+1
     351                    i3++
     352                    i4++
     353
     354                    i2++
    355355                Wend
    356356            End If
    357357        ElseIf UsingStr[i2]=Asc("@") Then
    358             i2=i2+1
     358            i2++1
    359359
    360360            lstrcat(StrPtr(buffer)+i3,_System_UsingStrData[ParmNum])
    361             i3=i3+lstrlen(_System_UsingStrData[ParmNum])
     361            i3 += lstrlen(_System_UsingStrData[ParmNum])
    362362        ElseIf UsingStr[i2]=Asc("&") Then
    363363            i4=0
    364364            Do
    365                 i4=i4+1
    366                 i2=i2+1
     365                i4++
     366                i2++
    367367            Loop While UsingStr[i2]=Asc(" ")
    368368
    369369            If UsingStr[i2]=Asc("&") Then
    370                 i4=i4+1
    371                 i2=i2+1
     370                i4++
     371                i2++
    372372                i5=lstrlen(_System_UsingStrData[ParmNum])
    373373                If i4<=i5 Then
     
    377377                End If
    378378                memcpy(StrPtr(buffer)+i3,_System_UsingStrData[ParmNum],i5)
    379                 i3=i3+i4
     379                i3 += i4
    380380            Else
    381                 i2=i2-i4
     381                i2 -= i4
    382382                buffer[i3]=Asc("&")
    383                 i2=i2+1
    384                 i3=i3+1
     383                i2++
     384                i3++
    385385                Continue
    386386            End If
    387387        End If
    388388
    389         ParmNum=ParmNum+1
     389        ParmNum++
    390390    Wend
    391391
    392392    _System_GetUsingFormat=Left$(buffer,lstrlen(buffer))
    393393End Function
     394
    394395Sub PRINTUSING_ToFile(FileNumber As Long, UsingStr As String)
    395396    Dim dwAccessByte As DWord
    396397    Dim buf As String
    397398
    398     FileNumber=FileNumber-1
     399    FileNumber--
    399400    buf=_System_GetUsingFormat(UsingStr)
    400401
     
    403404
    404405Dim _System_FieldSize(255) As Long
     406
    405407Macro FIELD(FileNumber As Long, FieldSize As Long)
    406     FileNumber=FileNumber-1
     408    FileNumber--
    407409
    408410    _System_FieldSize(FileNumber)=FieldSize
    409411End Macro
     412
    410413Macro GET(FileNumber As Long, RecodeNumber As Long, ByRef lpBuffer As String)
    411414    Dim dwAccessByte As Long
    412415
    413     FileNumber=FileNumber-1
    414     RecodeNumber=RecodeNumber-1
     416    FileNumber--
     417    RecodeNumber--
    415418
    416419    SetFilePointer(_System_hFile(FileNumber),RecodeNumber*_System_FieldSize(FileNumber),NULL,FILE_BEGIN)
     
    421424    End If
    422425End Macro
     426
    423427Macro PUT(FileNumber As Long, RecodeNumber As Long, ByRef lpBuffer As String)
    424428    Dim dwAccessByte As Long
    425429
    426     FileNumber=FileNumber-1
    427     RecodeNumber=RecodeNumber-1
     430    FileNumber--
     431    RecodeNumber--
    428432
    429433    SetFilePointer(_System_hFile(FileNumber),RecodeNumber*_System_FieldSize(FileNumber),NULL,FILE_BEGIN)
     
    431435End Macro
    432436
    433 Macro CHDIR(path As String)
     437Macro CHDIR(ByRef path As String)
    434438    SetCurrentDirectory(path)
    435439End Macro
    436 Macro MKDIR(path As String)
     440
     441Macro MKDIR(ByRef path As String)
    437442    CreateDirectory(path,ByVal 0)
    438443End Macro
    439 Macro KILL(path As String)
     444
     445Macro KILL(ByRef path As String)
    440446    DeleteFile(path)
    441447End Macro
  • /Include/basic/function.sbp

    r30 r20  
    769769            i64data=1
    770770            While i>=2
    771                 Val += (i64data*TempPtr[i]) As Double
     771                Val += i64data*TempPtr[i]
    772772
    773773                i64data *= &H10
     
    957957    Loop
    958958    If dir Then dir[i3]=0
    959     i3 += i-i2
     959    i3 += ii-i2
    960960
    961961    'ファイル名をコピー
  • /Include/system/enum.sbp

    r30 r20  
    1818        Return m_Value
    1919    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
    2820End Class
Note: See TracChangeset for help on using the changeset viewer.