Changeset 175


Ignore:
Timestamp:
Mar 21, 2007, 7:06:34 PM (18 years ago)
Author:
イグトランス (egtra)
Message:

Variant, VBObjectの追加

Location:
Include
Files:
2 added
10 edited

Legend:

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

    r173 r175  
    11' System/OperatingSystem.ab
     2
     3#ifndef _SYSYTEM_OPERATINGSYSTEM_AB_
     4#define _SYSYTEM_OPERATINGSYSTEM_AB_
    25
    36#require <Classes/System/Version.ab>
     
    7982    Unix = 4
    8083End Enum
     84
     85#endif '_SYSYTEM_OPERATINGSYSTEM_AB_
  • Include/Classes/System/String.ab

    r143 r175  
    233233    End Sub
    234234
    235     Sub AssignFromStrChar(text As *StrChar, textLength As Long)
    236         If text = Chars Then Exit Sub
    237         If AllocStringBuffer(textLength) <> 0 Then
    238             memcpy(Chars, text, SizeOf (StrChar) * textLength)
    239             Chars[m_Length] = 0
    240         End If
    241     End Sub
    242 #ifdef __STRCHAR_IS_NOT_UNICODE
    243     Sub AssignFromWideChar(text As PCWSTR, textLengthW As Long)
     235    Sub Assign(text As PCSTR, textLengthA As Long)
     236#ifdef __STRING_IS_NOT_UNICODE
     237        AssignFromStrChar(text, textLengthA)
     238#else
     239        Dim textLengthW = MultiByteToWideChar(CP_THREAD_ACP, 0, text, textLengthA, 0, 0)
     240        If AllocStringBuffer(textLengthW) <> 0 Then
     241            MultiByteToWideChar(CP_THREAD_ACP, 0, text, textLengthA, Chars, textLengthW)
     242        End If
     243#endif
     244    End Sub
     245
     246    Sub Assign(text As PCWSTR, textLengthW As Long)
     247#ifdef __STRING_IS_NOT_UNICODE
    244248        Dim textLengthA = WideCharToMultiByte(CP_THREAD_ACP, 0, text, textLengthW, 0, 0, 0, 0)
    245249        If AllocStringBuffer(textLengthA) <> 0 Then
    246250            WideCharToMultiByte(CP_THREAD_ACP, 0, text, textLengthW, Chars, textLengthA, 0, 0)
    247251        End If
    248     End Sub
    249252#else
    250     Sub AssignFromMultiByte(text As PCSTR, textLengthA As Long)
    251         Dim textLengthW = MultiByteToWideChar(CP_THREAD_ACP, 0, text, textLengthA, 0, 0)
    252         If AllocStringBuffer(textLengthW) <> 0 Then
    253             MultiByteToWideChar(CP_THREAD_ACP, 0, text, textLengthA, Chars, textLengthW)
    254         End If
    255     End Sub
    256 #endif
    257     Sub Assign(text As PCSTR, textLength As Long)
    258 #ifdef __STRING_IS_NOT_UNICODE
    259         AssignFromStrChar(text, textLength)
    260 #else
    261         AssignFromMultiByte(text, textLength)
    262 #endif
    263     End Sub
    264 
    265     Sub Assign(text As PCWSTR, textLength As Long)
    266 #ifdef __STRING_IS_NOT_UNICODE
    267         AssignFromWideChar(text, textLength)
    268 #else
    269         AssignFromStrChar(text, textLength)
     253        AssignFromStrChar(text, textLengthW)
    270254#endif
    271255    End Sub
     
    571555        Dim size = m_Length
    572556#endif
    573         Dim hash = 0 As DWord
    574         Dim p = Chars As *Word
    575         Dim i As Long
    576         For i = 0 To ELM(size)
    577             hash = ((hash << 16) + p[i]) Mod &h7fffffff
    578         Next
    579         Return hash As Long
     557        Return _System_GetHashFromWordArray(Chars As *Word, size)
    580558    End Function
    581559Private
     
    617595    End Function
    618596
     597    Sub AssignFromStrChar(text As *StrChar, textLength As Long)
     598        If text = Chars Then Exit Sub
     599        If AllocStringBuffer(textLength) <> 0 Then
     600            memcpy(Chars, text, SizeOf (StrChar) * textLength)
     601            Chars[m_Length] = 0
     602        End If
     603    End Sub
    619604End Class
  • Include/Classes/System/Version.ab

    r161 r175  
    11' System/Version.ab
     2
     3#ifndef __SYSTEM_VERSION_AB__
     4#define __SYSTEM_VERSION_AB__
     5
     6#require <api_winsock2.sbp>
    27
    38Class Version
     
    7580
    7681    Override Function GetHashCode() As Long
    77         Return htonl(major) Xor minor Xor build Xor htonl(rivision)
     82        Return _System_BSwap(major As DWord) Xor minor Xor build Xor _System_BSwap(rivision As DWord)
    7883    End Function
    7984
     
    143148    rivision As Long
    144149End Class
     150
     151#endif '__SYSTEM_VERSION_AB__
  • Include/Classes/System/index.ab

    r142 r175  
    1 #require "DateTime.ab"
    2 #require "Math.ab"
    3 #require "Object.ab"
    4 #require "String.ab"
    5 #require "TimeSpan.ab"
    6 #require "OperatingSystem.ab"
    7 #require "Version.ab"
    8 #require "Environment.ab"
     1#require <Classes/System/DateTime.ab>
     2#require <Classes/System/Math.ab>
     3#require <Classes/System/Object.ab>
     4#require <Classes/System/String.ab.
     5#require <Classes/System/TimeSpan.ab>
     6#require <Classes/System/OperatingSystem.ab>
     7#require <Classes/System/Version.ab>
     8#require <Classes/System/Environment.ab>
  • Include/basic/command.sbp

    r173 r175  
    3434
    3535Macro END()
     36    Dim exitCode = Environment.ExitCode
    3637    _System_EndProgram()
    37     ExitProcess(Environment.ExitCode)
     38    ExitProcess(exitCode)
    3839End Macro
    3940
  • Include/basic/function.sbp

    r170 r175  
    10861086End Function
    10871087
     1088Function _System_HashFromPtr(p As VoidPtr) As Long
     1089#ifdef _WIN64
     1090    Dim qw = p As QWord
     1091    Return (HIDWORD(qw) Xor LODWORD(qw)) As Long
     1092#else
     1093    Return p As Long
     1094#endif
     1095End Function
     1096
    10881097'--------
    10891098' 文字列関数その2
     
    11831192End Function
    11841193
     1194Function _System_GetHashFromWordArray(p As *Word, n As SIZE_T) As Long
     1195    Dim hash = 0 As DWord
     1196    Dim i As Long
     1197    For i = 0 To ELM(n)
     1198        hash = ((hash << 16) + p[i]) Mod &h7fffffff
     1199    Next
     1200    _System_GetHashFromWordArray = hash As Long
     1201End Function
     1202
    11851203#endif '_INC_FUNCTION
  • Include/com/bstring.ab

    r142 r175  
    6666    Sub AssignFromBStr(bstr As BSTR)
    6767        Clear()
    68         BString(bstr)
     68        String.Copy(bs, bstr)
    6969    End Sub
     70
     71    Const Function Copy() As BSTR
     72        BString.Copy(Copy, bs)
     73    End Function
    7074
    7175    Sub Clear()
     
    7882    Sub Attach(bstr As BSTR)
    7983        Clear()
    80         bs = bstr
     84        BString.Move(bs, bstr)
    8185    End Sub
    8286
    8387    Function Detach() As BSTR
    84         Detach = bs
    85         bs = 0
     88        BString.Move(Detach, bs)
    8689    End Function
    8790
     
    113116
    114117    Override Function ToString() As String
    115         Dim s As String(bs, Length)
     118        Dim s As String(bs As PCWSTR, Length As Long)
    116119        Return s
     120    End Function
     121
     122    Override Function GetHashCode() As Long
     123        Return _System_GetHashFromWordArray(bs, Length)
    117124    End Function
    118125
    119126Private
    120127    bs As BSTR
     128
     129    Static Sub Copy(ByRef dst As BSTR, ByVal src As BSTR)
     130        dst = SysAllocStringLen(src, SysStringLen(src))
     131    End Sub
     132
     133    Static Sub Move(ByRef dst As BSTR, ByRef src As BSTR)
     134        dst = src
     135        src = 0
     136    End Sub
    121137End Class
    122138
  • Include/objbase.sbp

    r170 r175  
    6060Const STGM_PRIORITY           = &h00040000
    6161Const STGM_DELETEONRELEASE    = &h04000000
    62 '#if (WINVER >= 400)
     62'#if (WINVER >= &h400)
    6363Const STGM_NOSCRATCH          = &h00100000
    6464'#endif /* WINVER */
     
    6969
    7070Const STGM_NOSNAPSHOT         = &h00200000
    71 '#if (_WIN32_WINNT >= 0x0500)
     71'#if (_WIN32_WINNT >= &h0500)
    7272Const STGM_DIRECT_SWMR        = &h00400000
    7373'#endif
     
    136136    dwAuthnSvc As DWord
    137137    dwAuthzSvc As DWord
    138     pwszServerPrincName As PWSTR
     138    pwszServerPrincName As LPWSTR
    139139    dwAuthnLevel As DWord
    140140    dwImpersonationLevel As DWord
     
    144144Type COSERVERINFO
    145145    dwReserved1 As DWord
    146     pwszName As PWSTR
     146    pwszName As LPWSTR
    147147    pAuthInfo As *COAUTHINFO
    148148    dwReserved2 As DWord
     
    157157
    158158
    159 '#if (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM)
     159'#if (_WIN32_WINNT >= &h0400) Or defined(_WIN32_DCOM)
    160160#ifdef _WIN32_DCOM
    161161Const Enum COINIT
    162     COINIT_MULTITHREADED     = = &h0
    163     COINIT_APARTMENTTHREADED = = &h2
    164     COINIT_DISABLE_OLE1DDE   = = &h4
    165     COINIT_SPEED_OVER_MEMORY = = &h8
     162    COINIT_MULTITHREADED     = &h0
     163    COINIT_APARTMENTTHREADED = &h2
     164    COINIT_DISABLE_OLE1DDE   = &h4
     165    COINIT_SPEED_OVER_MEMORY = &h8
    166166End Enum
    167167Declare Function CoInitializeEx Lib "ole32" (pvReserved As VoidPtr, dwCoInit As DWord) As HRESULT
     
    170170
    171171#ifdef __UNDECLARED__
    172 '#if (_WIN32_WINNT >= 0x0501)
     172'#if (_WIN32_WINNT >= &h0501)
    173173' 注意:このcokkieは本来ULARGE_INTEGER型
    174174'Declare Function CoRegisterInitializeSpy Lib "ole32" (pSpy As *IInitializeSpy, ByRef uliCokkie As QWord) As HRESULT
     
    191191'#endif
    192192
    193 '#if (_WIN32_WINNT >= 0x0500)
     193'#if (_WIN32_WINNT >= &h0500)
    194194
    195195Type SOleTlsDataPublic
     
    258258Declare Sub CoFreeAllLibraries Lib "ole32" ()
    259259Declare Sub CoFreeUnusedLibraries Lib "ole32" ()
    260 '#if  (_WIN32_WINNT >= 0x0501)
     260'#if  (_WIN32_WINNT >= &h0501)
    261261Declare Sub CoFreeUnusedLibrariesEx Lib "ole32" (dwUnloadDelay As DWord, dwReserved As DWord)
    262262'#endif
    263263
    264 '#if (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) 'DCOM
     264'#if (_WIN32_WINNT >= &h0400) Or defined(_WIN32_DCOM) 'DCOM
    265265#ifdef _WIN32_DCOM
    266266
     
    329329Declare Function CoCreateInstance Lib "ole32" (ByRef clsid As CLSID, pUnknown As *IUnknown, dwClsContext As DWord, ByRef refiid As IID, ByRef pObj As Any) As HRESULT
    330330
    331 '#if (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) 'DCOM
     331'#if (_WIN32_WINNT >= &h0400) Or defined(_WIN32_DCOM) 'DCOM
    332332#ifdef _WIN32_DCOM
    333 /* objidl.hでのMULTI_QIの宣言が必要。
    334333Declare Function CoGetInstanceFromFile Lib "ole32" (
    335334    ByVal pServerInfo As *COSERVERINFO,
     
    356355    ByVal punkOuter As *IUnknown,
    357356    ByVal dwClsCtx As DWord,
    358     ByVal pServerInfo As *COSERVERINFO,
     357    ByVal pServerInfo As COSERVERINFO,
    359358    ByVal dwCount As DWord,
    360359    ByVal pResults As *MULTI_QI) As HRESULT
    361 */
    362360#endif ' DCOM
    363361
    364362/* Call related APIs */
    365 '#if (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) 'DCOM
     363'#if (_WIN32_WINNT >= &h0400) Or defined(_WIN32_DCOM) 'DCOM
    366364#ifdef _WIN32_DCOM
    367365
     
    397395Declare Function CoRegisterMessageFilter Lib "ole32" (pMessageFilter As *IMessageFilter, ByRef pMessageFilter As *IMessageFilter) As HRESULT
    398396
    399 '#if (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) 'DCOM
     397'#if (_WIN32_WINNT >= &h0400) Or defined(_WIN32_DCOM) 'DCOM
    400398#ifdef _WIN32_DCOM
    401399Declare Function CoRegisterChannelHook Lib "ole32" (ByRef ExtensionUuid As GUID, pChannelHook As *IChannelHook) As HRESULT
    402400#endif ' DCOM
    403401
    404 '#if (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) 'DCOM
     402'#if (_WIN32_WINNT >= &h0400) Or defined(_WIN32_DCOM) 'DCOM
    405403#ifdef _WIN32_DCOM
    406404
     
    425423
    426424#ifdef __UNDECLARED__
    427 '#if  (_WIN32_WINNT >= 0x0501)
     425'#if  (_WIN32_WINNT >= &h0501)
    428426Declare Function CoInvalidateRemoteMachineBindings Lib "ole32" (pszMachineName As LPOLESTR) As HRESULT
    429427#endif
     
    519517/*
    520518// STG initialization options for StgCreateStorageEx and StgOpenStorageEx
    521 #if _WIN32_WINNT == 0x500
     519#if _WIN32_WINNT == &h500
    522520#define STGOPTIONS_VERSION 1
    523 #elif _WIN32_WINNT > 0x500
     521#elif _WIN32_WINNT > &h500
    524522#define STGOPTIONS_VERSION 2
    525523#else
  • Include/objidl.sbp

    r173 r175  
    2525' IExternalCennection
    2626
    27 ' IMultiQI
     27Type MULTI_QI
     28    pIID As * /*Const*/ IID
     29    pItf As *IUnknown
     30    hr As HRESULT
     31End Type
     32
     33Dim IID_IMultiQI = [&h00000020, &h0000, &h0000, [&hC0, &h00, &h00, &h00, &h00, &h00, &h00, &h46]] As IID
     34
     35Interface IMultiQI
     36    Inherits IUnknown
     37
     38    Function QueryMultipleInterfaces(
     39        /* [in] */ cMQIs As DWord,
     40        /* [out][in] */ pMQIs As *MULTI_QI) As HRESULT
     41End Interface
    2842
    2943' AsyncIMultiQI
  • Include/system/string.sbp

    r167 r175  
    2828Function GetStr(psz As PSTR, ByRef wcs As PWSTR) As SIZE_T
    2929    If psz <> 0 Then
    30         Return GetStr(psz, lstrlenA(psz), wcs)
     30        Return GetStr(psz, lstrlenA(psz) As SIZE_T, wcs)
    3131    Else
    3232        Return 0
     
    4545    wcs = psz
    4646    If psz <> 0 Then
    47         Return lstrlenW(psz)
     47        Return lstrlenW(psz) As SIZE_T
    4848    Else
    4949        Return 0
     
    6464        Return 0
    6565    Else
    66         Return GetStr(psz, lstrlenW(psz), mbs)
     66        Return GetStr(psz, lstrlenW(psz) As SIZE_T, mbs)
    6767    End If
    6868End Function
     
    7979    mbs = psz
    8080    If psz <> 0 Then
    81         Return lstrlenA(psz)
     81        Return lstrlenA(psz) As SIZE_T
    8282    Else
    8383        Return 0
     
    199199
    200200Function ToWCStr(ByRef s As String) As PWSTR
    201     GetStr(s.Chars As PWSTR, s.Length As SIZE_T, ToWCStr)
     201    GetStr(s.Chars, s.Length As SIZE_T, ToWCStr)
    202202End Function
    203203
Note: See TracChangeset for help on using the changeset viewer.