Ignore:
Timestamp:
Mar 2, 2007, 2:57:09 PM (18 years ago)
Author:
イグトランス (egtra)
Message:

#51完了

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Include/basic/function.sbp

    r123 r125  
    694694    Dim temp[255] As Char
    695695#ifdef _WIN64
    696     _sntprintf(temp, Len (temp) / SizeOf (Char), "%I64d", value)
     696    _sntprintf(temp, Len (temp) \ SizeOf (Char), "%I64d", value)
    697697#else
    698     _sntprintf(temp, Len (temp) / SizeOf (Char), "%d", value)
     698    _sntprintf(temp, Len (temp) \ SizeOf (Char), "%d", value)
    699699#endif
    700700    Str$ = temp
     
    10681068End Function
    10691069
    1070 Function _System_FillChar(p As *Char, n As SIZE_T, c As Char)
     1070Sub _System_FillChar(p As *Char, n As SIZE_T, c As Char)
    10711071    Dim i As SIZE_T
    10721072    For i = 0 To ELM(n)
    10731073        p[i] = c
    10741074    Next
     1075End Sub
     1076
     1077Function _System_ASCII_IsUpper(c As Char) As Boolean
     1078    Return c As DWord - &h41 < 26 ' &h41 = Asc("A")
     1079End Function
     1080
     1081Function _System_ASCII_IsLower(c As Char) As Boolean
     1082    Return c As DWord - &h61 < 26 ' &h61 = Asc("a")
     1083End Function
     1084
     1085Function _System_ASCII_ToLower(c As Char)
     1086    If _System_ASCII_IsUpper(c) Then
     1087        Return c Or &h20
     1088    Else
     1089        Return c
     1090    End If
     1091End Function
     1092
     1093Function _System_ASCII_ToUpper(c As Char)
     1094    If _System_ASCII_IsLower(c) Then
     1095        Return c And (Not &h20)
     1096    Else
     1097        Return c
     1098    End If
     1099End Function
     1100
     1101Function _System_WideCharToMultiByte(s As PCWSTR) As PSTR
     1102    Return _System_WideCharToMultiByte(s, lstrlenW(s) + 1, 0)
     1103End Function
     1104
     1105Function _System_WideCharToMultiByte(s As PCWSTR, size As Long) As PSTR
     1106    Return _System_WideCharToMultiByte(s, size, 0)
     1107End Function
     1108
     1109Function _System_WideCharToMultiByte(ws As PCWSTR, size As Long, flag As DWord) As PSTR
     1110    Dim sizeMBS = WideCharToMultiByte(CP_THREAD_ACP, flag, s, size, 0, 0, 0, 0)
     1111    Dim mbs = malloc(sizeMBS) As PSTR
     1112    WideCharToMultiByte(CP_THREAD_ACP, flag, s, size, mbs, sizeMBS, 0, 0)
     1113    Return mbs
     1114End Function
     1115
     1116Function _System_MultiByteToWideChar(s As PCSTR) As PWSTR
     1117    Return _System_MultiByteToWideChar(s, lstrlenA(s) + 1, 0)
     1118End Function
     1119
     1120Function _System_MultiByteToWideChar(s As PCSTR, size As Long) As PWSTR
     1121    Return _System_MultiByteToWideChar(s, size, 0)
     1122End Function
     1123
     1124Function _System_MultiByteToWideChar(s As PCSTR, size As Long, flag As DWord) As PWSTR
     1125    Dim sizeMBS = MultiByteToWideChar(CP_THREAD_ACP, flag, s, size, 0, 0)
     1126    Dim mbs = malloc(SizeOf (WCHAR) * sizeMBS) As PWSTR
     1127    MultiByteToWideChar(CP_THREAD_ACP, flag, s, size, mbs, sizeMBS)
     1128    Return mbs
    10751129End Function
    10761130
Note: See TracChangeset for help on using the changeset viewer.