Changeset 237 for Include/Classes


Ignore:
Timestamp:
May 7, 2007, 4:22:52 PM (18 years ago)
Author:
イグトランス (egtra)
Message:

#_fullcompileで検出されたエラーの修正(明らかに判るもののみ)

Location:
Include/Classes/System
Files:
8 edited

Legend:

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

    r228 r237  
    157157
    158158    Function DayOfWeek() As Long 'As DayOfWeek
    159         Return (Ticks \ TimeSpan.TicksPerDay) Mod 7 - 1
     159        Return ((Ticks \ TimeSpan.TicksPerDay) Mod 7) As Long - 1
    160160    End Function
    161161
  • Include/Classes/System/Environment.ab

    r233 r237  
    11' System/Environment.ab
    22
     3#require <api_psapi.sbp>
    34#require <Classes/System/OperatingSystem.ab>
    45
     
    89
    910    Static Function CommandLine() As String
    10         If cmdLine = Nothing Then
     11        If Object.ReferenceEquals(cmdLine, Nothing) Then
    1112#ifdef __STRING_IS_NOT_UNICODE
    1213            cmdLine = New String(GetCommandLineA())
     
    5152
    5253    Static Function OSVersion() As OperatingSystem
    53         If osVer = Nothing Then
     54        If Object.ReferenceEquals(osVer, Nothing) Then
    5455            Dim vi As OSVERSIONINFO
    5556            GetVersionEx(vi)
     
    7172
    7273    Static Function SystemDirectory() As String
    73         If sysDir = Nothing Then
     74        If Object.ReferenceEquals(sysDir, Nothing) Then
    7475            Dim size = GetSystemDirectory(0, 0)
    75             Dim p = _System_malloc(SizeOf (TCHAR) * size)
    76             Dim len = GetSystemDirectory(size, p)
     76            Dim p = _System_malloc(SizeOf (TCHAR) * size) As PTSTR
     77            Dim len = GetSystemDirectory(p, size)
    7778            sysDir = New String(p, len As Long)
    7879            _System_free(p)
     
    9495
    9596    Static Function WorkingSet() As Int64
    96         Dim pGetProcessMemoryInfo As *Function(Process As HANDLE, ByRef mc As PPROCESS_MEMORY_COUNTERS, cb As DWord) As BOOL
     97        TypeDef PFNGetProcessMemoryInfo = *Function(Process As HANDLE, ByRef mc As PROCESS_MEMORY_COUNTERS, cb As DWord) As BOOL
     98        Dim pGetProcessMemoryInfo As PFNGetProcessMemoryInfo
    9799        Dim hmodPSAPI = LoadLibrary("PSAPI.DLL")
    98100        If hmodPSAPI = 0 Then Return 0
    99         pGetProcessMemoryInfo = GetProcAddress(hmodPSAPI, ToMBStr("GetProcessMemoryInfo"))
     101        pGetProcessMemoryInfo = GetProcAddress(hmodPSAPI, ToMBStr("GetProcessMemoryInfo")) As PFNGetProcessMemoryInfo
    100102        If pGetProcessMemoryInfo <> 0 Then
    101             Dim mc As PPROCESS_MEMORY_COUNTERS
     103            Dim mc As PROCESS_MEMORY_COUNTERS
    102104            If pGetProcessMemoryInfo(GetCurrentProcess(), mc, Len (mc)) <> FALSE Then
    103105                WorkingSet = mc.WorkingSetSize
     106               
    104107            End If
    105108        End If
     
    117120        Dim src = ToTCStr(s)
    118121        Dim size = ExpandEnvironmentStrings(src, 0, 0)
    119         Dim dst = _System_malloc(SizeOf (TCHAR) * size)
     122        Dim dst = _System_malloc(SizeOf (TCHAR) * size) As PTSTR
    120123        ExpandEnvironmentStrings(src, dst, size)
    121124        ExpandEnvironmentVariables = New String(dst, size - 1)
  • Include/Classes/System/Math.ab

    r233 r237  
    194194
    195195    Static Function Floor(value As Double) As Long
    196         return Int(value)
     196        Return Int(value)
    197197    End Function
    198198
     
    201201    'GetType
    202202
    203     Static Function IEEERemainder(value1 As Double, value2 As Double) As Double
    204         Dim q As Double
    205         If value2=0 then return _System_GetNaN()
    206         q=value1/value2
    207         If q<>Int(q) then
    208             If q+0.5<>Int(q+0.5) then
    209                 q=Int(q+0.5)
    210             ElseIf Int(q+0.5)=Int(q*2+1)/2 then
    211                 q=Int(q+0.5)
     203    Static Function IEEERemainder(x As Double, y As Double) As Double
     204        If y = 0 Then Return _System_GetNaN()
     205        Dim q = x / y
     206        If q <> Int(q) Then
     207            If q + 0.5 <> Int(q + 0.5) Then
     208                q = Int(q + 0.5)
     209            ElseIf Int(q + 0.5) = Int(q * 2 + 1) / 2 Then
     210                q = Int(q + 0.5)
    212211            Else
    213                 q=Int(q-0.5)
     212                q = Int(q - 0.5)
    214213            End If
    215214        End If
    216         If x-y*q=0 then
    217             If x>0 then
    218                 return +0
     215        If x - y * q = 0 Then
     216            If x > 0 Then
     217                Return +0
    219218            Else
    220                 return -0
     219                Return -0
    221220            End If
    222221        Else
    223             return x-y*q
     222            Return x-y*q
    224223        End If
    225224    End Function
     
    252251
    253252    Static Function Log10(x As Double) As Double
    254         Return Math.Log(x) / Math.Log(10)
     253        Return Math.Log(x) / _System_Ln10
    255254    End Function
    256255
     
    582581
    583582    Static Function Truncate(x As Double) As Double
    584         return Fix(x)
     583        Return Fix(x)
    585584    End Function
    586585
     
    611610Const _System_HalfPI = (_System_PI * 0.5)
    612611Const _System_InverseHalfPI = (2 / _System_PI) '1 / (PI / 2)
     612Const _System_Ln10 = 2.3025850929940456840179914546844 '10の自然対数
    613613
    614614#endif '__SYSTEM_MATH_AB__
  • Include/Classes/System/Object.ab

    r232 r237  
    1010    ' 2つのオブジェクトが等しいかどうかを判断する
    1111    Virtual Function Equals( object As Object ) As Boolean
    12         If This.GetHashCode() = object.GetHashCode() Then
     12        If ObjPtr(This) = ObjPtr(object) Then
     13'       If This.GetHashCode() = object.GetHashCode() Then
    1314            Return True
    1415        Else
     
    1617        End If
    1718    End Function
     19   
    1820    Static Function Equals( objectA As Object, objectB As Object ) As Boolean
    1921        If ObjPtr(objectA) = NULL /*objectA = Nothing*/ Then
    2022            Return ObjPtr(objectB) = NULL 'objectB = Nothing
    2123        Else
    22             Return objectA.Equals( objectB )
     24            Return objectA.Equals(objectB)
    2325        End If
    2426    End Function
     
    3537    ' ハッシュコードを取得する
    3638    Virtual Function GetHashCode() As Long
    37         Return VarPtr( This ) As Long
     39        Return ObjPtr( This ) As Long
    3840    End Function
    3941
  • Include/Classes/System/OperatingSystem.ab

    r233 r237  
    1717
    1818    Sub OperatingSystem(vi As OSVERSIONINFOA)
    19         pf = vi.dwPlatformId As PlatformID,
     19        pf = vi.dwPlatformId As PlatformID
    2020        ver = New Version(vi.dwMajorVersion, vi.dwMinorVersion, vi.dwBuildNumber)
    21         sp = vi.szCSDVersion
     21        sp = New String(vi.szCSDVersion As PCSTR)
    2222    End Sub
    2323
    2424    Sub OperatingSystem(vi As OSVERSIONINFOW)
    25         pf = vi.dwPlatformId As PlatformID,
     25        pf = vi.dwPlatformId As PlatformID
    2626        ver = New Version(vi.dwMajorVersion, vi.dwMinorVersion, vi.dwBuildNumber)
    27         sp = vi.szCSDVersion
     27        sp = New String(vi.szCSDVersion As PCSTR)
    2828    End Sub
    2929
  • Include/Classes/System/String.ab

    r227 r237  
    184184
    185185    Static Function CompareOrdinal(x As String, indexX As Long, y As String, indexY As Long, length As Long) As Long
    186         If x = Nothing Then
    187             If y = Nothing Then
     186        If Object.ReferenceEquals(x, Nothing) Then
     187            If Object.ReferenceEquals(y, Nothing) Then
    188188                Return 0
    189189            Else
    190190                Return -1
    191191            End If
    192         ElseIf y = Nothing Then
     192        ElseIf Object.ReferenceEquals(y, Nothing) Then
    193193            Return 1
    194194        End If
    195         Return _System_StrCmpN(VarPtr(x.Chars[indexX]), VarPtr(y.Chars[indexY]), length)
     195        Return _System_StrCmpN(VarPtr(x.Chars[indexX]), VarPtr(y.Chars[indexY]), length As SIZE_T)
    196196    End Function
    197197
     
    344344#ifdef __STRING_IS_NOT_UNICODE
    345345        With Concat
    346             Dim lenA = MultiByteToWideChar(CP_THREAD_ACP, 0, text, len, 0, 0, 0, 0)
     346            Dim lenA = WideCharToMultiByte(CP_THREAD_ACP, 0, text, len, 0, 0, 0, 0)
    347347            .AllocStringBuffer(m_Length + lenA)
    348348            memcpy(.Chars, This.Chars, m_Length)
    349             MultiByteToWideChar(CP_THREAD_ACP, 0, text, len, VarPtr(.Chars[m_Length]), lenA, 0, 0)
     349            WideCharToMultiByte(CP_THREAD_ACP, 0, text, len, VarPtr(.Chars[m_Length]), lenA, 0, 0)
    350350            .Chars[m_Length + lenA] = 0
    351351        End With
     
    473473        temp.AllocStringBuffer(length)
    474474        memcpy(temp.Chars, VarPtr(Chars[startIndex]), SizeOf (StrChar) * length)
    475         Chars[m_Length] = 0
     475        temp.Chars[m_Length] = 0
    476476        Return temp
    477477    End Function
     
    527527    End Function
    528528
    529     Const Function Replace(oldStr As *StrChar, newStr As *StrChar)
     529    Const Function Replace(oldStr As *StrChar, newStr As *StrChar) As String
    530530        If oldStr = 0 Then Debug 'Throw ArgumentNullException
    531531        If newStr = 0 Then newStr = ""
    532         Return ReplaceCore(oldStr, lstrlen(oldStr), newStr, lstrlen(newStr)) As String
     532        Return ReplaceCore(oldStr, lstrlen(oldStr), newStr, lstrlen(newStr))
    533533    End Function
    534534
  • Include/Classes/System/Threading/Thread.ab

    r234 r237  
    5252    End Sub
    5353
    54     Sub Thread(hThread As HANDLE,dwThreadId As DWord,dummy As Long)
     54    Sub Thread(hThread As HANDLE, dwThreadId As DWord, dummy As Long)
    5555        m_hThread=hThread
    5656        m_dwThreadId=dwThreadId
     
    6161
    6262
    63     Function Equals( thread As Thread ) As Boolean
    64         If m_dwThreadId = thread.m_dwThreadId Then
    65             Return True
    66         End If
    67         Return False
    68     End Function
    69 
    70 
     63    Function Equals(thread As Thread) As Boolean
     64        Return m_dwThreadId = thread.m_dwThreadId
     65    End Function
    7166
    7267    '-----------------------
     
    7469    '-----------------------
    7570
     71   
    7672    'Priority Property
    7773    Sub Priority(value As ThreadPriority)
     
    8783        Return m_dwThreadId
    8884    End Function
     85
    8986
    9087
     
    314311
    315312    'カレントスレッドを取得
    316     Function CurrentThread(ByRef obj_Thread As Thread) As BOOL
     313    Function CurrentThread(ByRef obj_Thread As Thread) As Boolean
    317314        Dim dwNowThreadId As DWord
    318315        dwNowThreadId=GetCurrentThreadId()
     
    322319            If ppobj_Thread[i]->ThreadId=dwNowThreadId Then
    323320                obj_Thread.Thread(ByVal ppobj_Thread[i])
    324                 Return 1
    325             End If
    326         Next
    327 
    328         Return 0
     321                Return True
     322            End If
     323        Next
     324
     325        Return False
    329326    End Function
    330327
  • Include/Classes/System/Threading/WaitHandle.ab

    r119 r237  
    6363
    6464    Static Function SignalAndWait(ByRef toSignal As WaitHandle, ByRef toWaitOn As WaitHandle, millisecondsTimeout As Long, exitContext As BOOL) As BOOL
    65         Dim pSignalObjectAndWait = GetProcAddress(GetModuleHandle("Kernel32.dll"), "SignalObjectAndWait") _
    66             As *Function(hObjectToSignal As HANDLE, hObjectToWaitOn As HANDLE, dwMilliseconds As DWord, bAlertable As DWord) As DWord
     65        TypeDef PFNSignalObjectAndWait = *Function(hObjectToSignal As HANDLE, hObjectToWaitOn As HANDLE, dwMilliseconds As DWord, bAlertable As DWord) As DWord
     66        Dim pSignalObjectAndWait = GetProcAddress(GetModuleHandle("Kernel32.dll"), "SignalObjectAndWait") As PFNSignalObjectAndWait
    6767        If pSignalObjectAndWait = 0 Then
    6868            ' PlatformNotSupportedException
    6969            Debug
    70             ExitThread(0)
     70            ExitThread(-1)
    7171        End If
    72         Return WaitHandle.AfterWait(pSignalAndWait(toSignal.Handle, toWaitOn.Handle, millisecondsTimeout As DWord), 1)
     72        Return WaitHandle.AfterWait(pSignalObjectAndWait(toSignal.Handle, toWaitOn.Handle, millisecondsTimeout As DWord, FALSE), 1)
    7373    End Function
    7474
Note: See TracChangeset for help on using the changeset viewer.