Changeset 125 for Include/basic/function.sbp
- Timestamp:
- Mar 2, 2007, 2:57:09 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/basic/function.sbp
r123 r125 694 694 Dim temp[255] As Char 695 695 #ifdef _WIN64 696 _sntprintf(temp, Len (temp) /SizeOf (Char), "%I64d", value)696 _sntprintf(temp, Len (temp) \ SizeOf (Char), "%I64d", value) 697 697 #else 698 _sntprintf(temp, Len (temp) /SizeOf (Char), "%d", value)698 _sntprintf(temp, Len (temp) \ SizeOf (Char), "%d", value) 699 699 #endif 700 700 Str$ = temp … … 1068 1068 End Function 1069 1069 1070 Function_System_FillChar(p As *Char, n As SIZE_T, c As Char)1070 Sub _System_FillChar(p As *Char, n As SIZE_T, c As Char) 1071 1071 Dim i As SIZE_T 1072 1072 For i = 0 To ELM(n) 1073 1073 p[i] = c 1074 1074 Next 1075 End Sub 1076 1077 Function _System_ASCII_IsUpper(c As Char) As Boolean 1078 Return c As DWord - &h41 < 26 ' &h41 = Asc("A") 1079 End Function 1080 1081 Function _System_ASCII_IsLower(c As Char) As Boolean 1082 Return c As DWord - &h61 < 26 ' &h61 = Asc("a") 1083 End Function 1084 1085 Function _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 1091 End Function 1092 1093 Function _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 1099 End Function 1100 1101 Function _System_WideCharToMultiByte(s As PCWSTR) As PSTR 1102 Return _System_WideCharToMultiByte(s, lstrlenW(s) + 1, 0) 1103 End Function 1104 1105 Function _System_WideCharToMultiByte(s As PCWSTR, size As Long) As PSTR 1106 Return _System_WideCharToMultiByte(s, size, 0) 1107 End Function 1108 1109 Function _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 1114 End Function 1115 1116 Function _System_MultiByteToWideChar(s As PCSTR) As PWSTR 1117 Return _System_MultiByteToWideChar(s, lstrlenA(s) + 1, 0) 1118 End Function 1119 1120 Function _System_MultiByteToWideChar(s As PCSTR, size As Long) As PWSTR 1121 Return _System_MultiByteToWideChar(s, size, 0) 1122 End Function 1123 1124 Function _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 1075 1129 End Function 1076 1130
Note:
See TracChangeset
for help on using the changeset viewer.