Changeset 208 for Include


Ignore:
Timestamp:
Apr 7, 2007, 10:20:40 PM (18 years ago)
Author:
イグトランス (egtra)
Message:

[207]参照型変数のNothing初期化に対応する修正

Location:
Include
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • Include/Classes/System/Environment.ab

    r173 r208  
    2121        Dim size = GetCurrentDirectory(0, 0)
    2222        Dim p = _System_malloc(SizeOf (TCHAR) * size) As PCTSTR
    23         GetCurrentDirectory(size, p)
    24         CurrentDirectory = p
    25         _System_free(p)
     23        Dim len = GetCurrentDirectory(size, p)
     24        If len < size Then
     25            CurrentDirectory = New String(p, size As Long)
     26            _System_free(p)
     27        End If
    2628    End Function
    2729
     
    7274            Dim size = GetSystemDirectory(0, 0)
    7375            Dim p = _System_malloc(SizeOf (TCHAR) * size)
    74             GetSystemDirectory(size, p)
    75             sysDir = p
     76            Dim len = GetSystemDirectory(size, p)
     77            sysDir = New String(p, len As Long)
    7678            _System_free(p)
    7779        End IF
     
    117119        Dim dst = _System_malloc(SizeOf (TCHAR) * size)
    118120        ExpandEnvironmentStrings(src, dst, size)
    119         ExpandEnvironmentVariables = dst
     121        ExpandEnvironmentVariables = New String(dst, size - 1)
    120122        _System_free(dst)
    121123    End Function
    122124
    123125    Static Sub FailFast(message As String)
    124         OutputDebugString(ToTCStr(message))
    125         ExitProcess(-1)
     126        FatalAppExit(0, ToTCStr(message))
    126127    End Sub
    127128
  • Include/Classes/System/Math.ab

    r162 r208  
    1717
    1818    Static Function Abs(value As Double) As Double
    19         If value<0 then
    20             return -value
    21         Else
    22             return value
    23         End If
     19        SetQWord(VarPtr(value), GetQWord(VarPtr(value)) And &h7fffffffffffffff)
    2420    End Function
    2521
    2622    Static Function Abs(value As Single) As Single
    27         If value<0 then
    28             return -value
    29         Else
    30             return value
    31         End If
     23        SetDWord(VarPtr(value), GetDWord(VarPtr(value)) And &h7fffffff)
    3224    End Function
    3325
     
    209201    'GetType
    210202
    211     Static Function IEEERemainder(value1 As Double,value2 As Double) As Double
     203    Static Function IEEERemainder(value1 As Double, value2 As Double) As Double
    212204        Dim q As Double
    213205        If value2=0 then return _System_GetNaN()
     
    616608Const _System_Atan_N = 20
    617609Const _System_UrTan_N = 17
    618 Const _System_D  = 4.4544551033807686783083602485579e-6
     610Const _System_D = 4.4544551033807686783083602485579e-6
    619611Const _System_HalfPI = (_System_PI * 0.5)
    620612Const _System_InverseHalfPI = (2 / _System_PI) '1 / (PI / 2)
  • Include/Classes/System/OperatingSystem.ab

    r175 r208  
    1 ' System/OperatingSystem.ab
     1' Classes/System/OperatingSystem.ab
    22
    3 #ifndef _SYSYTEM_OPERATINGSYSTEM_AB_
    4 #define _SYSYTEM_OPERATINGSYSTEM_AB_
     3#ifndef __SYSYTEM_OPERATINGSYSTEM_AB__
     4#define __SYSYTEM_OPERATINGSYSTEM_AB__
    55
    66#require <Classes/System/Version.ab>
     
    8383End Enum
    8484
    85 #endif '_SYSYTEM_OPERATINGSYSTEM_AB_
     85#endif '__SYSYTEM_OPERATINGSYSTEM_AB__
  • Include/Classes/System/Runtime/InteropServices/GCHandle.ab

    r203 r208  
    4646    End Function
    4747
    48     Function Operator = (y As GCHandle) As Boolean
     48    Function Operator == (y As GCHandle) As Boolean
    4949        Return Equals(y)
    5050    End Function
     
    5252    Function Operator <> (y As GCHandle) As Boolean
    5353        Return Not Equals(y)
     54    End Function
     55
     56    Override Function ToString() As String
     57        Return "System.Runtime.InteropServices.GCHandle"
    5458    End Function
    5559
  • Include/basic/function.sbp

    r203 r208  
    528528
    529529Function Space$(length As Long) As String
    530     Space$.ReSize(length, &H20 As StrChar)
     530    Return New String(&h20 As StrChar, length)
    531531End Function
    532532
  • Include/basic/prompt.sbp

    r192 r208  
    509509
    510510    '強制的に終了する
    511     ExitProcess(0)
     511    End 'ExitProcess(0)
    512512
    513513    EnterCriticalSection(_PromptSys_SectionOfBufferAccess)
     
    522522    DeleteCriticalSection(_PromptSys_SectionOfBufferAccess)
    523523
    524     ExitProcess(0)
     524    End 'ExitProcess(0)
    525525End Function
    526526
  • Include/com/bstring.ab

    r192 r208  
    3131
    3232    Sub BString(s As PCSTR, len As DWord)
    33         Dim lenBS = MultiByteToWideChar(CP_THREAD_ACP, 0, s, len, 0, 0)
     33        Dim lenBS = MultiByteToWideChar(CP_THREAD_ACP, 0, s, len As Long, 0, 0)
    3434        bs = SysAllocStringLen(0, lenBS)
    35         MultiByteToWideChar(CP_THREAD_ACP, 0, s, len, bs, lenBS)
     35        MultiByteToWideChar(CP_THREAD_ACP, 0, s, len As Long, bs, lenBS)
    3636    End Sub
    3737
     
    9292        BStr = bs
    9393    End Function
     94/*
     95    Static Function Assgin(bs As BSTR) As BString
     96        Assgin = New BString
     97        Assgin.Assgin(bs)
     98    End Function
    9499
     100    Static Function Attach(bs As BSTR) As BString
     101        Attach = New BString
     102        Attach.Attach(bs)
     103    End Function
     104*/
    95105    Const Function Length() As DWord
    96106        Length = SysStringLen(bs)
     
    116126
    117127    Override Function ToString() As String
    118         Dim s As String(bs As PCWSTR, Length As Long)
    119         Return s
     128        Return New String(bs As PCWSTR, Length As Long)
    120129    End Function
    121130
  • Include/com/currency.ab

    r200 r208  
    7171    End Function
    7272
     73    Static Function Compare(x As Currency, y As Currency) As HRESULT
     74        Return VarCyCmp(x, y)
     75    End Function
     76
     77    Static Function Compare(x As Currency, y As Double) As HRESULT
     78        Return VarCyCmpR8(x, y)
     79    End Function
     80
     81    Static Function Compare(x As Double, y As Currency) As HRESULT
     82        Dim ret = VarCyCmpR8(y, x)
     83        Select Case ret
     84            Case VARCMP_LT
     85                Return VARCMP_GT
     86            Case VARCMP_GT
     87                Return VARCMP_LT
     88            Case Else
     89                Return ret
     90        End Select
     91    End Function
     92
     93    Const Function Operator ==(y As Currency) As Boolean
     94        Dim c = Compare(This, y)
     95        Return c = VARCMP_EQ
     96    End Function
     97
     98    Const Function Operator ==(y As Double) As Boolean
     99        Dim c = Compare(This, y)
     100        Return c = VARCMP_EQ
     101    End Function
     102
     103    Const Function Operator <>(y As Currency) As Boolean
     104        Dim c = Compare(This, y)
     105        Return c <> VARCMP_EQ
     106    End Function
     107
     108    Const Function Operator <>(y As Double) As Boolean
     109        Dim c = Compare(This, y)
     110        Return c <> VARCMP_EQ
     111    End Function
     112
     113    Const Function Operator <(y As Currency) As Boolean
     114        Dim c = Compare(This, y)
     115        Return c = VARCMP_LT
     116    End Function
     117
     118    Const Function Operator <(y As Double) As Boolean
     119        Dim c = Compare(This, y)
     120        Return c = VARCMP_LT
     121    End Function
     122/*
     123    Const Function Operator >(y As Currency) As Boolean
     124        Dim c = Compare(This, y)
     125        Return c = VARCMP_GT
     126    End Function
     127
     128    Const Function Operator >(y As Double) As Boolean
     129        Dim c = Compare(This, y)
     130        Return c = VARCMP_GT
     131    End Function
     132*/
     133    Const Function Operator <=(y As Currency) As Boolean
     134        Dim c = Compare(This, y)
     135        Return result = VARCMP_LT Or result = VARCMP_EQ
     136    End Function
     137
     138    Const Function Operator <=(y As Double) As Boolean
     139        Dim c = Compare(This, y)
     140        Return result = VARCMP_LT Or result = VARCMP_EQ
     141    End Function
     142
     143    Const Function Operator >=(y As Currency) As Boolean
     144        Dim c = Compare(This, y)
     145        Return result = VARCMP_GT Or result = VARCMP_EQ
     146    End Function
     147
     148    Const Function Operator >=(y As Double) As Boolean
     149        Dim c = Compare(This, y)
     150        Return result = VARCMP_GT Or result = VARCMP_EQ
     151    End Function
     152
    73153    Const Function Abs() As Currency
     154        Abs = New Currency
    74155        VarCyAbs(This.cy, Abs.cy)
    75156    End Function
    76157
    77158    Const Function Fix() As Currency
     159        Fix = New Currency
    78160        VarCyFix(This.cy, Fix.cy)
    79161    End Function
    80162
    81163    Const Function Int() As Currency
     164        Int = New Currency
    82165        VarCyInt(This.cy, Int.cy)
    83166    End Function
    84167
    85168    Const Function Round(c = 0 As Long) As Currency
     169        Round = New Currency
    86170        VarCyRound(This.cy, c, Round.cy)
    87171    End Function
  • Include/com/variant.ab

    r200 r208  
    156156        Variant.Move(Detach, v)
    157157    End Function
    158 
     158/*
     159    Static Function Assgin(ByRef from As VARIANT) As Variant
     160        Assign = New Variant
     161        Assgin.Assign(from)
     162    End Function
     163
     164    Static Function Attach(ByRef from As VARIANT) As Variant
     165        Attach = New Variant
     166        Attach.Attach(from)
     167    End Function
     168*/
    159169    'Operators
    160170
    161171    Const Function Operator ^(y As Variant) As Variant
    162         Dim ret As Variant
     172        Dim ret = New Variant
    163173        VarPow(This.v, y.v, ret.v)
    164174        Return ret
     
    170180
    171181    Const Function Operator -() As Variant
    172         Dim ret As Variant
     182        Dim ret = New Variant
    173183        VarNeg(This.v, ret.v)
    174184        Return ret
     
    176186
    177187    Const Function Operator *(y As Variant) As Variant
    178         Dim ret As Variant
     188        Dim ret = New Variant
    179189        VarMul(This.v, y.v, ret.v)
    180190        Return ret
     
    182192
    183193    Const Function Operator /(y As Variant) As Variant
    184         Dim ret As Variant
     194        Dim ret = New Variant
    185195        VarDiv(This.v, y.v, ret.v)
    186196        Return ret
     
    188198
    189199    Const Function Operator \(y As Variant) As Variant
    190         Dim ret As Variant
     200        Dim ret = New Variant
    191201        VarIDiv(This.v, y.v, ret.v)
    192202        Return ret
     
    194204
    195205    Const Function Operator Mod(y As Variant) As Variant
    196         Dim ret As Variant
     206        Dim ret = New Variant
    197207        VarMod(This.v, y.v, ret.v)
    198208        Return ret
     
    200210
    201211    Const Function Operator +(y As Variant) As Variant
    202         Dim ret As Variant
     212        Dim ret = New Variant
    203213        VarAdd(This.v, y.v, ret.v)
    204214        Return ret
     
    206216
    207217    Const Function Operator -(y As Variant) As Variant
    208         Dim ret As Variant
     218        Dim ret = New Variant
    209219        VarSub(This.v, y.v, ret.v)
    210220        Return ret
     
    212222
    213223    Const Function Operator &(y As Variant) As Variant
    214         Dim ret As Variant
     224        Dim ret = New Variant
    215225        VarCat(This.v, y.v, ret.v)
    216226        Return ret
     
    218228
    219229    Const Function Operator And(y As Variant) As Variant
    220         Dim ret As Variant
     230        Dim ret = New Variant
    221231        VarAnd(This.v, y.v, ret.v)
    222232        Return ret
     
    224234
    225235    Const Function Operator Or(y As Variant) As Variant
    226         Dim ret As Variant
     236        Dim ret = New Variant
    227237        VarOr(This.v, y.v, ret.v)
    228238        Return ret
     
    230240
    231241    Const Function Operator Xor(y As Variant) As Variant
    232         Dim ret As Variant
     242        Dim ret = New Variant
    233243        VarXor(This.v, y.v, ret.v)
    234244        Return ret
     
    236246
    237247    Const Function Operator Not() As Variant
    238         Dim ret As Variant
     248        Dim ret = New Variant
    239249        VarNot(This.v, ret.v)
    240250        Return ret
     
    242252
    243253    Static Function Imp(x As Variant, y As Variant) As Variant
    244         Dim ret As Variant
     254        Dim ret = New Variant
    245255        VarImp(x.v, y.v, ret.v)
    246256        Return ret
     
    248258
    249259    Static Function Eqv(x As Variant, y As Variant) As Variant
    250         Dim ret As Variant
     260        Dim ret = New Variant
    251261        VarEqv(x.v, y.v, ret.v)
    252262        Return ret
     
    254264
    255265    Const Function Abs() As Variant
    256         Dim ret As Variant
     266        Dim ret = New Variant
    257267        VarAbs(This.v, ret.v)
    258268        Return ret
     
    260270
    261271    Const Function Fix() As Variant
    262         Dim ret As Variant
     272        Dim ret = New Variant
    263273        VarFix(This.v, ret.v)
    264274        Return ret
     
    266276
    267277    Const Function Int() As Variant
    268         Dim ret As Variant
     278        Dim ret = New Variant
    269279        VarInt(This.v, ret.v)
    270280        Return ret
     
    272282
    273283    Const Function Round(cDecimals As Long) As Variant
    274         Dim ret As Variant
     284        Dim ret = New Variant
    275285        VarRound(This.v, cDecimals, ret)
    276286        Return ret
     
    286296
    287297    Static Function Compare(x As Variant, y As Variant) As HRESULT
    288         Return VarCmp(x.v, y.v, GetUserDefaultLCID(), 0) 'VARCMP_NULL = 3を返す場合があるので注意
     298        Return VarCmp(x.v, y.v, LOCALE_USER_DEFAULT, 0) 'VARCMP_NULL = 3を返す場合があるので注意
    289299    End Function
    290300
     
    344354
    345355    Const Function ChangeType(vt As VARTYPE, flags As Word) As Variant
    346         Dim ret As Variant
     356        Dim ret = New Variant
    347357        ChangeType(ret, flags, vt)
    348358        Return ret
     
    368378        Dim tmp = ChangeType(VT_BSTR)
    369379        Dim bs = ((tmp.v.val As ULONG_PTR) As BSTR)
    370         Dim s As String(bs As PCWSTR, SysStringLen(bs) As Long)
    371         Return s
     380        Return New String(bs As PCWSTR, SysStringLen(bs) As Long)
    372381    End Function
    373382
     
    520529        Dim r As VARIANT
    521530        ChangeType(r, 0, VT_BSTR)
    522         Dim bs As BString
     531        Dim bs = New BString
    523532        bs.Attach(GetPointer(VarPtr(r.val)) As BSTR)
    524533        Return bs
     
    528537        Clear()
    529538        v.vt = VT_BSTR
     539        SetPointer(VarPtr(v.val), x.Copy())
    530540    End Sub
    531541
     
    588598End Class
    589599
    590 Dim _System_VariantOptionalParam = Nothing As Variant
     600'Dim _System_VariantOptionalParam = Nothing As Variant
    591601
    592602/*
  • Include/com/vbobject.ab

    r200 r208  
    157157        Dim hr = pdisp->Invoke(dispid, GUID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET, dispParams, ret, 0, 0)
    158158        Dispose()
    159         Dim v = New Variant
     159        Prop = New Variant
    160160        v.Attach(ret)
    161161        Return v
     
    288288    Dim ret As VARIANT
    289289    hr = obj->Invoke(dispid, GUID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, dispParams, ret, ByVal 0, 0)
     290    CallByName = New Variant
    290291    CallByName.Attach(ret)
    291292    Return CallByName
  • Include/system/string.sbp

    r192 r208  
    1010
    1111Function ZeroString(length As Long) As String
    12     Dim str As String
    13     str.ReSize(length)
    14     Return str
     12    Return New String(0, length)
    1513End Function
    1614
  • Include/windows/WindowHandle.sbp

    r192 r208  
     1' Windows/WindowHandle.sbp
     2
    13#ifndef __WINDOWS_WINDOWHANDLE_SBP__
    24#define __WINDOWS_WINDOWHANDLE_SBP__
     
    6567    End Function
    6668
    67     Const Function ChildFromPoint(x As Long, y As Long) As HWND
    68         Return ChildWindowFromPoint(hwnd, x, y)
    69     End Function
    70 
    71     Const Function ChildFromPointEx(x As Long, y As Long, flags As DWord) As HWND
    72         Return ChildWindowFromPointEx(hwnd, x, y, flags)
     69    Const Function ChildFromPoint(x As Long, y As Long) As WindowHandle
     70        Return New WindowHandle(ChildWindowFromPoint(hwnd, x, y))
     71    End Function
     72
     73    Const Function ChildFromPointEx(x As Long, y As Long, flags As DWord) As WindowHandle
     74        Return New WindowHandle(ChildWindowFromPointEx(hwnd, x, y, flags))
    7375    End Function
    7476
     
    390392    End Function
    391393
    392     Function SetActiveWindow() As HWND
    393         Return SetActiveWindow(hwnd)
     394    Function SetActiveWindow() As WindowHandle
     395        Return New WindowHandle(SetActiveWindow(hwnd))
    394396    End Function
    395397
     
    398400    End Function
    399401
    400     Function SetCapture() As HWND
    401         Return SetCapture(hwnd) As HWND
     402    Function SetCapture() As WindowHandle
     403        Return New WindowHandle(SetCapture(hwnd))
    402404    End Function
    403405
     
    406408    End Function
    407409
    408     Function SetFocus() As HWND
    409         Return SetFocus(hwnd)
     410    Function SetFocus() As WindowHandle
     411        Return New WindowHandle(SetFocus(hwnd))
    410412    End Function
    411413
     
    418420    End Function
    419421
    420     Function SetParent(hwndNewParent As HWND) As HWND
    421         Return _System_SetParent(hwnd, hwndNewParent)
     422    Function SetParent(hwndNewParent As HWND) As WindowHandle
     423        Return New WindowHandle(_System_SetParent(hwnd, hwndNewParent))
    422424    End Function
    423425
Note: See TracChangeset for help on using the changeset viewer.