Changeset 142 for Include/basic/function.sbp
- Timestamp:
- Mar 9, 2007, 10:15:34 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/basic/function.sbp
r137 r142 344 344 '------------ 345 345 346 Function Asc(buf As * Char) AsChar346 Function Asc(buf As *StrChar) As StrChar 347 347 Asc = buf[0] 348 348 End Function 349 349 350 Function Chr$(code As Char) As String350 Function Chr$(code As StrChar) As String 351 351 Chr$ = ZeroString(1) 352 352 Chr$[0] = code 353 353 End Function 354 354 355 #if defUNICODE355 #ifndef __STRING_IS_NOT_UNICODE 356 356 Function AscW(s As *WCHAR) As UCSCHAR 357 357 If s.Length = 0 Then … … 487 487 488 488 Mid$=ZeroString(ReadLength) 489 memcpy(StrPtr(Mid$), VarPtr(buf [StartPos]), SizeOf (Char) * ReadLength)489 memcpy(StrPtr(Mid$), VarPtr(buf.Chars[StartPos]), SizeOf (Char) * ReadLength) 490 490 End Function 491 491 … … 515 515 If i>length Then 516 516 Right$=ZeroString(length) 517 memcpy(StrPtr(Right$), VarPtr(buf [i-length]), SizeOf (Char) * length)517 memcpy(StrPtr(Right$), VarPtr(buf.Chars[i-length]), SizeOf (Char) * length) 518 518 Else 519 519 Right$=buf … … 691 691 Return MakeStr(buffer) 692 692 End Function 693 Function Str$(value As LONG_PTR) As String693 Function Str$(value As Int64) As String 694 694 Dim temp[255] As Char 695 #ifdef _WIN64696 695 _sntprintf(temp, Len (temp) \ SizeOf (Char), "%I64d", value) 697 #else698 _sntprintf(temp, Len (temp) \ SizeOf (Char), "%d", value)699 #endif700 696 Str$ = temp 701 697 End Function … … 881 877 882 878 Function Lof(FileNum As Long) As Long 883 Lof =GetFileSize(_System_hFile(FileNum-1),NULL)879 Lof = GetFileSize(_System_hFile(FileNum-1), 0) 884 880 End Function 885 881 … … 1059 1055 End Function 1060 1056 1057 '-------- 1058 ' 文字列関数その2 1059 '-------- 1061 1060 Function _System_IsSurrogatePair(wcHigh As WCHAR, wcLow As WCHAR) As Boolean 1062 1061 If &hD800 <= wcHigh And wcHigh < &hDC00 Then … … 1068 1067 End Function 1069 1068 1070 Function _System_IsDoubleUnitChar(lead As Char, trail As Char) As Boolean 1071 #ifdef UNICODE 1069 Function _System_IsDoubleUnitChar(lead As WCHAR, trail As WCHAR) As Boolean 1072 1070 Return _System_IsSurrogatePair(lead, trail) 1073 #else 1071 End Function 1072 1073 Function _System_IsDoubleUnitChar(lead As SByte, trail As SByte) As Boolean 1074 1074 Return IsDBCSLeadByte(lead) <> FALSE 1075 #endif 1076 End Function 1077 1078 Sub _System_FillChar(p As *Char, n As SIZE_T, c As Char) 1075 End Function 1076 1077 Sub _System_FillChar(p As PWSTR, n As SIZE_T, c As WCHAR) 1079 1078 Dim i As SIZE_T 1080 1079 For i = 0 To ELM(n) … … 1083 1082 End Sub 1084 1083 1085 Function _System_ASCII_IsUpper(c As Char) As Boolean 1084 Sub _System_FillChar(p As PSTR, n As SIZE_T, c As SByte) 1085 Dim i As SIZE_T 1086 For i = 0 To ELM(n) 1087 p[i] = c 1088 Next 1089 End Sub 1090 1091 Function _System_ASCII_IsUpper(c As WCHAR) As Boolean 1086 1092 Return c As DWord - &h41 < 26 ' &h41 = Asc("A") 1087 1093 End Function 1088 1094 1095 Function _System_ASCII_IsUpper(c As SByte) As Boolean 1096 Return _System_ASCII_IsUpper(c As Byte As WCHAR) 1097 End Function 1098 1099 Function _System_ASCII_IsLower(c As WCHAR) As Boolean 1100 Return c As DWord - &h61 < 26 ' &h61 = Asc("a") 1101 End Function 1102 1089 1103 Function _System_ASCII_IsLower(c As Char) As Boolean 1090 Return c As DWord - &h61 < 26 ' &h61 = Asc("a")1091 End Function 1092 1093 Function _System_ASCII_ToLower(c As Char) As Char1104 Return _System_ASCII_IsLower(c As Byte As WCHAR) 1105 End Function 1106 1107 Function _System_ASCII_ToLower(c As WCHAR) As WCHAR 1094 1108 If _System_ASCII_IsUpper(c) Then 1095 1109 Return c Or &h20 … … 1097 1111 Return c 1098 1112 End If 1113 End Function 1114 1115 Function _System_ASCII_ToLower(c As SByte) As SByte 1116 Return _System_ASCII_ToLower(c As Byte As WCHAR) As Byte As SByte 1099 1117 End Function 1100 1118 … … 1107 1125 End Function 1108 1126 1109 Function _System_WideCharToMultiByte(s As PCWSTR) As PSTR 1110 Return _System_WideCharToMultiByte(s, lstrlenW(s) + 1, 0) 1111 End Function 1112 1113 Function _System_WideCharToMultiByte(s As PCWSTR, size As Long) As PSTR 1114 Return _System_WideCharToMultiByte(s, size, 0) 1115 End Function 1116 1117 Function _System_WideCharToMultiByte(ws As PCWSTR, size As Long, flag As DWord) As PSTR 1118 Dim sizeMBS = WideCharToMultiByte(CP_THREAD_ACP, flag, s, size, 0, 0, 0, 0) 1119 Dim mbs = _System_malloc(sizeMBS) As PSTR 1120 WideCharToMultiByte(CP_THREAD_ACP, flag, s, size, mbs, sizeMBS, 0, 0) 1121 Return mbs 1122 End Function 1123 1124 Function _System_MultiByteToWideChar(s As PCSTR) As PWSTR 1125 Return _System_MultiByteToWideChar(s, lstrlenA(s) + 1, 0) 1126 End Function 1127 1128 Function _System_MultiByteToWideChar(s As PCSTR, size As Long) As PWSTR 1129 Return _System_MultiByteToWideChar(s, size, 0) 1130 End Function 1131 1132 Function _System_MultiByteToWideChar(s As PCSTR, size As Long, flag As DWord) As PWSTR 1133 Dim sizeMBS = MultiByteToWideChar(CP_THREAD_ACP, flag, s, size, 0, 0) 1134 Dim mbs = _System_malloc(SizeOf (WCHAR) * sizeMBS) As PWSTR 1135 MultiByteToWideChar(CP_THREAD_ACP, flag, s, size, mbs, sizeMBS) 1136 Return mbs 1137 End Function 1127 Function _System_ASCII_ToUpper(c As SByte) As SByte 1128 Return _System_ASCII_ToUpper(c As Byte As WCHAR) As Byte As SByte 1129 End Function 1130 1138 1131 1139 1132 Function _System_StrCmp(s1 As PCSTR, s2 As PCSTR) As Long … … 1158 1151 _System_StrCmp = s1[i] - s2[i] 1159 1152 End Function 1153 1160 1154 #endif '_INC_FUNCTION
Note:
See TracChangeset
for help on using the changeset viewer.