Changes in / [20:30]


Ignore:
Location:
/Include
Files:
10 edited

Legend:

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

    r20 r30  
    1818Public
    1919    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
    2125    End Sub
    2226
     
    2630
    2731    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 = argb
     32        argb = MakeARGB(a, r, g, b)
     33    End Sub
     34
     35    Sub Color(newArgb As ARGB)
     36        argb = newArgb
    3337    End Sub
    3438
    3539    Sub Operator =(c As Color)
    36         SetValue(c)
     40        argb = c.argb
    3741    End Sub
    3842
     
    6165    End Function
    6266
    63     Function GetValue() As ARGB
    64         GetValue = argb
    65     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)
    6872        argb = value
    6973    End Sub
    7074
    7175    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
    7381    End Sub
    7482
     
    9199    End Function
    92100
    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
    94102        Dim c As Color(r, g, b)
    95103        Return c
    96104    End Function
    97105
    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
    99107        Dim c As Color(a, r, g, b)
    100108        Return c
     
    297305    End Enum
    298306*/
    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
    305308        MakeARGB = (((b As ARGB) <<  Color_BlueShift) Or _
    306309                    ((g As ARGB) << Color_GreenShift) Or _
  • /Include/Classes/System/Drawing/Point.ab

    r20 r30  
    44#define __SYSTEM_DRAWING_POINT_AB__
    55
     6#include <Classes/System/Drawing/PointF.ab>
    67#include <Classes/System/Drawing/Size.ab>
    78#include <Classes/System/Drawing/SizeF.ab>
     
    6465
    6566    Function Operator + (pt As Point) As Point
    66         Return Add(pt)
     67        Return Add(This, pt)
    6768    End Function
    6869
    6970    Function Operator + (sz As Size) As Point
    70         Return Add(sz)
     71        Return Add(This, sz)
    7172    End Function
    7273
    7374    Function Operator - (pt As Point) As Point
    74         Return Substract(pt)
     75        Return Substract(This, pt)
    7576    End Function
    7677
    7778    Function Operator - (sz As Size) As Point
    78         Return Substract(sz)
     79        Return Substract(This, sz)
    7980    End Function
    8081
     
    8788    End Function
    8889
    89     Function Add(pt As Point) As Point
    90         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)
    9192        Return ret
    9293    End Function
    9394
    94     Function Add(sz As Size) As Point
    95         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)
    9697        Return ret
    9798    End Function
     
    99100    Function Offset(pt As Point) As Point
    100101        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)
    109102        Return ret
    110103    End Function
    111104
    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)
    114117        Return ret
    115118    End Function
  • /Include/Classes/System/Drawing/PointF.ab

    r20 r30  
    5858    End Sub
    5959
     60    Function Operator () As PointF
     61        Dim ptf As PointF(X, Y)
     62        Return ptf
     63    End Function
     64
    6065    Function Operator + (pt As PointF) As PointF
    61         Return Add(pt)
     66        Return Add(This, pt)
    6267    End Function
    6368
    6469    Function Operator + (sz As Size) As PointF
    65         Return Add(sz)
     70        Return Add(This, sz)
    6671    End Function
    6772
    6873    Function Operator + (sz As SizeF) As PointF
    69         Return Add(sz)
     74        Return Add(This, sz)
    7075    End Function
    7176
    7277    Function Operator - (pt As PointF) As PointF
    73         Return Substract(pt)
     78        Return Substract(This, pt)
    7479    End Function
    7580
    7681    Function Operator - (sz As Size) As PointF
    77         Return Substract(sz)
     82        Return Substract(This, sz)
    7883    End Function
    7984
    8085    Function Operator - (sz As SizeF) As PointF
    81         Return Substract(sz)
     86        Return Substract(This, sz)
    8287    End Function
    8388
     
    9095    End Function
    9196
    92     Function Add(pt As PointF) As PointF
    93         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)
    9499        Return ret
    95100    End Function
    96101
    97     Function Add(sz As Size) As PointF
    98         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)
    99104        Return ret
    100105    End Function
    101106
    102     Function Add(sz As SizeF) As PointF
    103         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)
    104109        Return ret
    105110    End Function
    106111
    107     Function Substract(pt As PointF) As PointF
    108         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)
    109114        Return ret
    110115    End Function
    111116
    112     Function Substract(sz As Size) As PointF
    113         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)
    114119        Return ret
    115120    End Function
    116121
    117     Function Substract(sz As SizeF) As PointF
    118         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)
    119124        Return ret
    120125    End Function
  • /Include/Classes/System/Drawing/Rectangle.ab

    r20 r30  
    2727    Sub Rectangle(location As Point, size As Size)
    2828        x = location.X
    29         y = lccation.Y
     29        y = location.Y
    3030        width = size.Height
    31         hegiht = size.Height
     31        height = size.Height
    3232    End Sub
    3333
     
    3535        x = rc.x
    3636        y = rc.y
    37         widht = rc.width
     37        width = rc.width
    3838        height = rc.height
    3939    End Sub
     
    107107
    108108    Function IsEmpty() As BOOL
    109         If Width <= Single_EPSILON Or Height <= Single_EPSILON Then
    110             IsEmptyArea = _System_TRUE
    111         Else
    112             IsEmptyArea = _System_FALSE
     109        If Width <= 0 Or Height <= 0 Then
     110            IsEmpty = _System_TRUE
     111        Else
     112            IsEmpty = _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 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
    149149    End Function
    150150
     
    162162
    163163    Function Contains(ByRef rc As Rectangle) As BOOL
    164         If X <= rc.X && rc.Right <= Right && Y <= rc.Y && rc.Bottom <= Bottom Then
     164        If X <= rc.X And rc.Right <= Right And Y <= rc.Y And 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)
    184180    End Sub
    185181
     
    189185    End Function
    190186
    191     Function Intersect(ByRef rect As Rectangle) As BOOL
    192         Intersect = Intersect(This, This, rect)
    193     End Function
     187    Sub Intersect(ByRef rect As Rectangle)
     188        This = Rectangle.Intersect(This, rect)
     189    End Sub
    194190
    195191    Static Function Intersect(ByRef a As Rectangle, ByRef b As Rectangle) As Rectangle
     
    199195        left = Math.Min(a.Left, b.Left)
    200196        top = Math.Min(a.Top, b.Top)
    201         Return FromLTRB(left, top, right, bottom)
     197        Return Rectangle.FromLTRB(left, top, right, bottom)
    202198    End Function
    203199
     
    215211    Static Function Union(ByRef a As Rectangle, ByRef b As Rectangle) As Rectangle
    216212        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())
    221217        Return FromLTRB(left, top, right, bottom)
    222218    End Function
  • /Include/Classes/System/Math.ab

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

    r20 r30  
    11Class String
     2    m_Chars As LPSTR
     3    m_Length As Long
    24Public
    3     Chars As LPSTR
    4     Length As Long
    55
    66    Sub String()
    7         Chars = _System_calloc(1)
    8         Length = 0
     7        m_Chars = _System_calloc(1)
     8        m_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(Chars)
    32         Chars = 0
     31        _System_free(m_Chars)
     32        m_Chars = 0
    3333#ifdef _DEBUG
    34         Length = 0
     34        m_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
    3846    Function Operator() As LPSTR
    39         Return Chars
     47        Return m_Chars
    4048    End Function
    4149
    4250    Sub Operator = (ByRef objString As String)
    43         Assign(objString.Chars, objString.Length)
     51        Assign(objString.m_Chars, objString.m_Length)
    4452    End Sub
    4553
     
    4957
    5058    Function Operator[] (n As Long) As Byte
    51         Return Chars[n]
     59        Return m_Chars[n]
    5260    End Function
    5361
    5462    Sub Operator[]= (n As Long, c As Byte)
    55         Chars[n] = c
     63        m_Chars[n] = c
    5664    End Sub
    5765
     
    6169
    6270    Function Operator+ (ByRef objString As String) As String
    63         Return Concat(objString, objString.Length)
     71        Return Concat(objString, objString.m_Length)
    6472    End Function
    6573
     
    165173
    166174    Function StrPtr() As LPSTR
    167         Return Chars
     175        Return m_Chars
    168176    End Function
    169177
    170178    Sub ReSize(allocLength As Long)
    171179        If allocLength < 0 Then Exit Sub
    172         If allocLength > Length Then
     180        If allocLength > m_Length Then
    173181            Dim oldLength As Long
    174             oldLength = Length
     182            oldLength = m_Length
    175183            If AllocStringBuffer(allocLength) <> 0 Then
    176                 ZeroMemory(Chars + oldLength, Length - oldLength + 1)
     184                ZeroMemory(m_Chars + oldLength, m_Length - oldLength + 1)
    177185            End If
    178186        Else
    179             Length = allocLength
    180             Chars[Length] = 0
     187            m_Length = allocLength
     188            m_Chars[m_Length] = 0
    181189        End If
    182190    End Sub
     
    185193        If allocLength < 0 Then
    186194            Exit Sub
    187         ElseIf allocLength > Length Then
     195        ElseIf allocLength > m_Length Then
    188196            Dim oldLength As Long
    189             oldLength = Length
     197            oldLength = m_Length
    190198            If AllocStringBuffer(allocLength) <> 0 Then
    191                 FillMemory(Chars + oldLength, Length - oldLength, c)
     199                FillMemory(m_Chars + oldLength, m_Length - oldLength, c)
    192200            End If
    193201        Else
    194             Length = allocLength
    195         End If
    196         Chars[Length] = 0
     202            m_Length = allocLength
     203        End If
     204        m_Chars[m_Length] = 0
    197205    End Sub
    198206
    199207    Sub Assign(lpszText As LPSTR, textLength As Long)
    200         If lpszText = Chars Then Exit Sub
     208        If lpszText = m_Chars Then Exit Sub
    201209        If AllocStringBuffer(textLength) <> 0 Then
    202             memcpy(Chars, lpszText, textLength)
    203             Chars[Length] = 0
     210            memcpy(m_Chars, lpszText, textLength)
     211            m_Chars[m_Length] = 0
    204212        End If     
    205213    End Sub
    206214
    207215    Sub Assign(ByRef objString As String)
    208         Assign(objString.Chars, objString.Length)
     216        Assign(objString.m_Chars, objString.m_Length)
    209217    End Sub
    210218
     
    213221            Assign(lpszText, lstrlen(lpszText))
    214222        Else
    215             'Chars=_System_realloc(Chars,1)
    216             Chars[0] = 0
    217             Length = 0
     223            'm_Chars=_System_realloc(m_Chars,1)
     224            m_Chars[0] = 0
     225            m_Length = 0
    218226        End If
    219227    End Sub
     
    221229    Sub Append(lpszText As LPSTR, textLength As Long)
    222230        Dim prevLen As Long
    223         prevLen = Length
    224         If AllocStringBuffer(Length + textLength) <> 0 Then
    225             memcpy(Chars + prevLen, lpszText, textLength)
    226             Chars[Length] = 0
     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
    227235        End If
    228236    End Sub
     
    233241
    234242    Sub Append(ByRef str As String)
    235         Append(str.Chars, str.Length)
     243        Append(str.m_Chars, str.m_Length)
    236244    End Sub
    237245
     
    239247        Dim tempString As String
    240248        With tempString
    241             .AllocStringBuffer(This.Length + textLength)
    242             memcpy(.Chars, This.Chars, This.Length)
    243             memcpy(.Chars + This.Length, lpszText, textLength)
    244             .Chars[.Length] = 0
     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
    245253        End With
    246254        Return tempString
     
    248256
    249257    Function Contains(ByRef objString As String) As BOOL
    250         If IndexOf(objString, 0, Length) >= 0 Then
     258        If IndexOf(objString, 0, m_Length) >= 0 Then
    251259            Return _System_TRUE
    252260        Else
     
    256264
    257265    Function Contains(lpszText As LPSTR) As BOOL
    258         If IndexOf(lpszText, 0, Length) >= 0 Then
     266        If IndexOf(lpszText, 0, m_Length) >= 0 Then
    259267            Return _System_TRUE
    260268        Else
     
    264272
    265273    Function IndexOf(lpszText As LPSTR) As Long
    266         Return IndexOf(lpszText, 0, Length)
     274        Return IndexOf(lpszText, 0, m_Length)
    267275    End Function
    268276
    269277    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)
    271279    End Function
    272280
     
    276284
    277285        If startIndex < 0 Then Return -1
    278         If count < 1 Or count + startIndex > Length Then Return -1
    279         If length > Length Then Return -1
     286        If count < 1 Or count + startIndex > m_Length Then Return -1
     287        If length > m_Length Then Return -1
    280288
    281289        If length = 0 Then Return startIndex
     
    284292        For i = startIndex To startIndex + count - 1
    285293            For j = 0 To length - 1
    286                 If Chars[i + j] = lpszText[j] Then
     294                If m_Chars[i + j] = lpszText[j] Then
    287295                    If j = length - 1 Then Return i
    288296                Else
     
    295303
    296304    Function LastIndexOf(lpszText As LPSTR) As Long
    297         Return LastIndexOf(lpszText, Length - 1, Length)
     305        Return LastIndexOf(lpszText, m_Length - 1, m_Length)
    298306    End Function
    299307
     
    306314        length = lstrlen(lpszText)
    307315
    308         If startIndex < 0 Or startIndex > Length - 1 Then Return -1
     316        If startIndex < 0 Or startIndex > m_Length - 1 Then Return -1
    309317        If count < 1 Or count > startIndex + 2 Then Return -1
    310         If length > Length Then Return -1
     318        If length > m_Length Then Return -1
    311319
    312320        If length = 0 Then Return startIndex
     
    315323        For i = startIndex To  startIndex - count + 1 Step -1
    316324            For j = length - 1 To 0 Step -1
    317                 If Chars[i + j] = lpszText[j] Then
     325                If m_Chars[i + j] = lpszText[j] Then
    318326                    If j = 0 Then Return i
    319327                Else
     
    334342
    335343    Function EndsWith(lpszText As LPSTR) As BOOL
    336         If LastIndexOf(lpszText) = Length - lstrlen(lpszText) Then
     344        If LastIndexOf(lpszText) = m_Length - lstrlen(lpszText) Then
    337345            Return _System_TRUE
    338346        Else
     
    345353        length = lstrlen(lpszText)
    346354
    347         If startIndex < 0 Or startIndex > Length Then Return -1
     355        If startIndex < 0 Or startIndex > m_Length Then Return -1
    348356
    349357        Dim newChars As LPSTR
    350         newChars = _System_malloc(length + Length + 1)
     358        newChars = _System_malloc(length + m_Length + 1)
    351359        If newChars = 0 Then Return -1
    352360
    353         memcpy(newChars, Chars, startIndex)
     361        memcpy(newChars, m_Chars, startIndex)
    354362        memcpy(newChars + startIndex, lpszText, 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
     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
    361369    End Function
    362370
    363371    Function SubString(startIndex As Long) As String
    364         Return SubString(startIndex, Length - startIndex)
     372        Return SubString(startIndex, m_Length - startIndex)
    365373    End Function
    366374
    367375    Function SubString(startIndex As Long, length As Long) As String
    368376        If startIndex < 0 Or length <= 0 Then Return ""
    369         If startIndex + length > Length Then Return ""
     377        If startIndex + length > m_Length Then Return ""
    370378
    371379        Dim temp As String
    372380        temp.AllocStringBuffer(length)
    373         memcpy(temp.Chars, VarPtr(Chars[startIndex]), length)
    374         Chars[Length] = 0
     381        memcpy(temp.m_Chars, VarPtr(m_Chars[startIndex]), length)
     382        m_Chars[m_Length] = 0
    375383        Return temp
    376384    End Function
    377385
    378386    Function Remove(startIndex As Long) As Long
    379         If startIndex < 0 Or startIndex > Length Then Return -1
    380         Chars[startIndex] = 0
    381         Length = startIndex
    382         Return Length
     387        If startIndex < 0 Or startIndex > m_Length Then Return -1
     388        m_Chars[startIndex] = 0
     389        m_Length = startIndex
     390        Return m_Length
    383391    End Function
    384392
    385393    Function Remove(startIndex As Long, count As Long) As Long
    386394        If startIndex < 0 Or count < 0 Then Return -1
    387         If startIndex + count > Length Then Return -1
     395        If startIndex + count > m_Length Then Return -1
    388396
    389397        Dim newChars As LPSTR
    390         newChars = _System_malloc(Length - count + 1)
     398        newChars = _System_malloc(m_Length - count + 1)
    391399        If newChars = 0 Then Return -1
    392400
    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
     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
    401409    End Function
    402410
    403411    Function IsNullOrEmpty() As BOOL
    404         If Length = 0 Then
     412        If m_Length = 0 Then
    405413            Return _System_TRUE
    406414        Else
     
    411419    Sub Replace(oldChar As Byte, newChar As Byte)
    412420        Dim i As Long
    413         For i = 0 To ELM(Length)
    414             If Chars[i] = oldChar Then
    415                 Chars[i] = newChar
     421        For i = 0 To ELM(m_Length)
     422            If m_Chars[i] = oldChar Then
     423                m_Chars[i] = newChar
    416424            End If
    417425        Next
     
    419427
    420428    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)
    422430    End Sub
    423431
     
    436444                    Exit Do
    437445                End If
    438                 .Append(Chars + current, pos - current)
     446                .Append(m_Chars + current, pos - current)
    439447                .Append(newStr, newLen)
    440448                current = pos + oldLen
    441449            Loop
    442             .Append(Chars + current, Length - current)
     450            .Append(m_Chars + current, m_Length - current)
    443451        End With
    444452        Swap(tempString)
     
    446454
    447455    Sub ToLower()
    448         CharLower(Chars)
     456        CharLower(m_Chars)
    449457    End Sub
    450458
    451459    Sub ToUpper()
    452         CharUpper(Chars)
     460        CharUpper(m_Chars)
    453461    End Sub
    454462
     
    456464        Dim tempLen As Long
    457465        Dim tempChars As PSTR
    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
     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
    464472    End Sub
    465473
     
    469477        If textLength < 0 Then
    470478            Return 0
    471         ElseIf textLength > Length Then
    472             AllocStringBuffer = _System_realloc(Chars, textLength + 1)
     479        ElseIf textLength > m_Length Then
     480            AllocStringBuffer = _System_realloc(m_Chars, textLength + 1)
    473481            If AllocStringBuffer <> 0 Then
    474                 Length = textLength
    475                 Chars = AllocStringBuffer
     482                m_Length = textLength
     483                m_Chars = AllocStringBuffer
    476484            End If
    477485        Else
    478             Length = textLength
    479             AllocStringBuffer = Chars
     486            m_Length = textLength
     487            AllocStringBuffer = m_Chars
    480488        End If
    481489    End Function
  • /Include/api_winsock2.sbp

    r20 r30  
    238238Const INADDR_ANY = &h0
    239239
     240Declare Function htons Lib "ws2_32.dll" (netshort As Word) As Word
     241Declare Function htonl Lib "ws2_32.dll" (netshort As DWord)  As DWord
     242Declare Function ntohs Lib "ws2_32.dll" (netshort As Word) As Word
     243Declare Function ntohl Lib "ws2_32.dll" (netshort As DWord)  As DWord
    240244
    241245#endif '_INC_WINSOCK2
  • /Include/basic/command.sbp

    r20 r30  
    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, ByRef str As String)(ByRef title As String, boxType As DWord, ByRef retAns As DWord)
     58Macro MSGBOX(hWnd As HWND, lpStr As String)(lpTitle As String, BoxType As DWord, ByRef retAns As DWord)
    5959    If VarPtr(retAns) Then
    60         retAns = MessageBox(hWnd, str, title, boxType)
     60        retAns=MessageBox(hWnd,lpStr,lpTitle,BoxType)
    6161    Else
    62         MessageBox(hWnd, str, title, boxType)
     62        MessageBox(hWnd,lpStr,lpTitle,BoxType)
    6363    End If
    6464End Macro
    6565
    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)
     66Macro 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)
    6767    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)
    6969    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)
    7171    End If
    7272End Macro
     
    7676End Macro
    7777
    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)
     78Macro INSMENU(hMenu As HMENU, PosID As Long, flag As Long)(lpString As String, id As Long, hSubMenu As HMENU, state As Long)
    7979    Dim mii As MENUITEMINFO
    8080
    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
    9895        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)
    102100End Macro
    103101
     
    107105'--------------
    108106
    109 Dim _System_hFile[255] As HANDLE
    110 
    111 Macro OPEN(ByRef fileName As String, AccessFor As Long, FileNumber As Long)
     107Dim _System_hFile(255) As Long
     108Macro OPEN(lpFileName As String, AccessFor As Long, FileNumber As Long)
    112109    Dim dwAccess As Long
    113110    Dim bAppend As Long
    114111    Dim dwCreationDisposition As Long
    115112
    116     FileNumber--
     113    FileNumber=FileNumber-1
    117114
    118115    bAppend=0
     
    133130    End Select
    134131
    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)
     135End Macro
    140136Macro CLOSE()(FileNumber As Long)
    141     FileNumber--
     137    FileNumber=FileNumber-1
    142138
    143139    If _System_hFile(FileNumber) Then
    144         CloseHandle(_System_hFile[FileNumber])
    145         _System_hFile(FileNumber) = 0
     140        CloseHandle(_System_hFile(FileNumber))
     141        _System_hFile(FileNumber)=0
    146142    End If
    147143End Macro
     
    151147Dim _System_InputDataType[_System_MAX_PARMSNUM] As DWord
    152148Sub INPUT_FromFile(FileNumber As Long)
    153     Dim i As Long, i2 As Long, i3 As Long
     149    Dim i As Long ,i2 As Long, i3 As Long
    154150    Dim buffer As String
    155151    Dim temp[1] As Byte
     
    157153    Dim IsStr As Long
    158154
    159     FileNumber--
     155    FileNumber=FileNumber-1
    160156
    161157    buffer=ZeroString(GetFileSize(_System_hFile[FileNumber],0))
     
    177173        IsStr=0
    178174        While 1
    179             i3++
     175            i3=i3+1
    180176
    181177            i2=ReadFile(_System_hFile[FileNumber],temp,1,VarPtr(dwAccessBytes),ByVal 0)
     
    201197                        If dwAccessBytes=0 Then Exit While
    202198                        If temp[0]=Asc(",") Then Exit While
    203                         If temp[0] <> 32 And temp[0] <> 9 Then
     199                        If Not(temp[0]=32 or temp[0]=9) Then
    204200                            SetFilePointer(_System_hFile[FileNumber],-1,0,FILE_CURRENT)
    205201                            Exit While
     
    231227                Dim pTempStr As *String
    232228                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
    234234        End Select
    235235
    236         i++
     236        i=i+1
    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--
     243    FileNumber=FileNumber-1
    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++
    266             i3++
     265            i2=i2+1
     266            i3=i3+1
    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++
     285                i4=i4+1
    286286            Wend
    287287            If UsingStr[i4]=Asc(".") Then
    288                 i4++
     288                i4=i4+1
    289289
    290290                dblRoundOff=0.5
    291291                While UsingStr[i4]=Asc("#")
    292                     i4++
     292                    i4=i4+1
    293293                    dblRoundOff=dblRoundOff/10
    294294                Wend
     
    304304
    305305            '符号が有る場合は、一文字分のスペースを考慮する
    306             If sign Then length_num++
     306            If sign Then length_num=length_num+1
    307307
    308308            length_buf=0
    309309            Do
    310                 i2++
    311                 length_buf++
     310                i2=i2+1
     311                length_buf=length_buf+1
    312312            Loop While UsingStr[i2]=Asc("#")
    313313
     
    315315                '通常時
    316316                FillMemory(StrPtr(buffer)+i3,length_buf-length_num,Asc(" "))
    317                 i3 += length_buf - length_num
     317                i3=i3+(length_buf-length_num)
    318318
    319319                If sign Then
    320320                    buffer[i3]=Asc("-")
    321                     i3++
    322 
    323                     length_num--
     321                    i3=i3+1
     322
     323                    length_num=length_num-1
    324324                End If
    325325
     
    330330                End If
    331331
    332                 i3 += length_num
     332                i3=i3+length_num
    333333            Else
    334334                '表示桁が足りないとき
    335335                FillMemory(StrPtr(buffer)+i3,length_buf,Asc("#"))
    336                 i3 += length_buf
     336                i3=i3+length_buf
    337337            End If
    338338
    339339            If UsingStr[i2]=Asc(".") Then
    340340                buffer[i3]=UsingStr[i2]
    341                 i2++
    342                 i3++
     341                i2=i2+1
     342                i3=i3+1
    343343
    344344                i4=dec
     
    349349                        buffer[i3]=temp2[i4]
    350350                    End If
    351                     i3++
    352                     i4++
    353 
    354                     i2++
     351                    i3=i3+1
     352                    i4=i4+1
     353
     354                    i2=i2+1
    355355                Wend
    356356            End If
    357357        ElseIf UsingStr[i2]=Asc("@") Then
    358             i2++1
     358            i2=i2+1
    359359
    360360            lstrcat(StrPtr(buffer)+i3,_System_UsingStrData[ParmNum])
    361             i3 += lstrlen(_System_UsingStrData[ParmNum])
     361            i3=i3+lstrlen(_System_UsingStrData[ParmNum])
    362362        ElseIf UsingStr[i2]=Asc("&") Then
    363363            i4=0
    364364            Do
    365                 i4++
    366                 i2++
     365                i4=i4+1
     366                i2=i2+1
    367367            Loop While UsingStr[i2]=Asc(" ")
    368368
    369369            If UsingStr[i2]=Asc("&") Then
    370                 i4++
    371                 i2++
     370                i4=i4+1
     371                i2=i2+1
    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 += i4
     379                i3=i3+i4
    380380            Else
    381                 i2 -= i4
     381                i2=i2-i4
    382382                buffer[i3]=Asc("&")
    383                 i2++
    384                 i3++
     383                i2=i2+1
     384                i3=i3+1
    385385                Continue
    386386            End If
    387387        End If
    388388
    389         ParmNum++
     389        ParmNum=ParmNum+1
    390390    Wend
    391391
    392392    _System_GetUsingFormat=Left$(buffer,lstrlen(buffer))
    393393End Function
    394 
    395394Sub PRINTUSING_ToFile(FileNumber As Long, UsingStr As String)
    396395    Dim dwAccessByte As DWord
    397396    Dim buf As String
    398397
    399     FileNumber--
     398    FileNumber=FileNumber-1
    400399    buf=_System_GetUsingFormat(UsingStr)
    401400
     
    404403
    405404Dim _System_FieldSize(255) As Long
    406 
    407405Macro FIELD(FileNumber As Long, FieldSize As Long)
    408     FileNumber--
     406    FileNumber=FileNumber-1
    409407
    410408    _System_FieldSize(FileNumber)=FieldSize
    411409End Macro
    412 
    413410Macro GET(FileNumber As Long, RecodeNumber As Long, ByRef lpBuffer As String)
    414411    Dim dwAccessByte As Long
    415412
    416     FileNumber--
    417     RecodeNumber--
     413    FileNumber=FileNumber-1
     414    RecodeNumber=RecodeNumber-1
    418415
    419416    SetFilePointer(_System_hFile(FileNumber),RecodeNumber*_System_FieldSize(FileNumber),NULL,FILE_BEGIN)
     
    424421    End If
    425422End Macro
    426 
    427423Macro PUT(FileNumber As Long, RecodeNumber As Long, ByRef lpBuffer As String)
    428424    Dim dwAccessByte As Long
    429425
    430     FileNumber--
    431     RecodeNumber--
     426    FileNumber=FileNumber-1
     427    RecodeNumber=RecodeNumber-1
    432428
    433429    SetFilePointer(_System_hFile(FileNumber),RecodeNumber*_System_FieldSize(FileNumber),NULL,FILE_BEGIN)
     
    435431End Macro
    436432
    437 Macro CHDIR(ByRef path As String)
     433Macro CHDIR(path As String)
    438434    SetCurrentDirectory(path)
    439435End Macro
    440 
    441 Macro MKDIR(ByRef path As String)
     436Macro MKDIR(path As String)
    442437    CreateDirectory(path,ByVal 0)
    443438End Macro
    444 
    445 Macro KILL(ByRef path As String)
     439Macro KILL(path As String)
    446440    DeleteFile(path)
    447441End Macro
  • /Include/basic/function.sbp

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

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