Index: Include/basic/function.sbp
===================================================================
--- Include/basic/function.sbp	(revision 137)
+++ Include/basic/function.sbp	(revision 142)
@@ -344,14 +344,14 @@
 '------------
 
-Function Asc(buf As *Char) As Char
+Function Asc(buf As *StrChar) As StrChar
 	Asc = buf[0]
 End Function
 
-Function Chr$(code As Char) As String
+Function Chr$(code As StrChar) As String
 	Chr$ = ZeroString(1)
 	Chr$[0] = code
 End Function
 
-#ifdef UNICODE
+#ifndef __STRING_IS_NOT_UNICODE
 Function AscW(s As *WCHAR) As UCSCHAR
 	If s.Length = 0 Then
@@ -487,5 +487,5 @@
 
 	Mid$=ZeroString(ReadLength)
-	memcpy(StrPtr(Mid$), VarPtr(buf[StartPos]), SizeOf (Char) * ReadLength)
+	memcpy(StrPtr(Mid$), VarPtr(buf.Chars[StartPos]), SizeOf (Char) * ReadLength)
 End Function
 
@@ -515,5 +515,5 @@
 	If i>length Then
 		Right$=ZeroString(length)
-		memcpy(StrPtr(Right$), VarPtr(buf[i-length]), SizeOf (Char) * length)
+		memcpy(StrPtr(Right$), VarPtr(buf.Chars[i-length]), SizeOf (Char) * length)
 	Else
 		Right$=buf
@@ -691,11 +691,7 @@
 	Return MakeStr(buffer)
 End Function
-Function Str$(value As LONG_PTR) As String
+Function Str$(value As Int64) As String
 	Dim temp[255] As Char
-#ifdef _WIN64
 	_sntprintf(temp, Len (temp) \ SizeOf (Char), "%I64d", value)
-#else
-	_sntprintf(temp, Len (temp) \ SizeOf (Char), "%d", value)
-#endif
 	Str$ = temp
 End Function
@@ -881,5 +877,5 @@
 
 Function Lof(FileNum As Long) As Long
-	Lof=GetFileSize(_System_hFile(FileNum-1),NULL)
+	Lof = GetFileSize(_System_hFile(FileNum-1), 0)
 End Function
 
@@ -1059,4 +1055,7 @@
 End Function
 
+'--------
+' 文字列関数その2
+'--------
 Function _System_IsSurrogatePair(wcHigh As WCHAR, wcLow As WCHAR) As Boolean
 	If &hD800 <= wcHigh And wcHigh < &hDC00 Then
@@ -1068,13 +1067,13 @@
 End Function
 
-Function _System_IsDoubleUnitChar(lead As Char, trail As Char) As Boolean
-#ifdef UNICODE
+Function _System_IsDoubleUnitChar(lead As WCHAR, trail As WCHAR) As Boolean
 	Return _System_IsSurrogatePair(lead, trail)
-#else
+End Function
+
+Function _System_IsDoubleUnitChar(lead As SByte, trail As SByte) As Boolean
 	Return IsDBCSLeadByte(lead) <> FALSE
-#endif
-End Function
-
-Sub _System_FillChar(p As *Char, n As SIZE_T, c As Char)
+End Function
+
+Sub _System_FillChar(p As PWSTR, n As SIZE_T, c As WCHAR)
 	Dim i As SIZE_T
 	For i = 0 To ELM(n)
@@ -1083,13 +1082,28 @@
 End Sub
 
-Function _System_ASCII_IsUpper(c As Char) As Boolean
+Sub _System_FillChar(p As PSTR, n As SIZE_T, c As SByte)
+	Dim i As SIZE_T
+	For i = 0 To ELM(n)
+		p[i] = c
+	Next
+End Sub
+
+Function _System_ASCII_IsUpper(c As WCHAR) As Boolean
 	Return c As DWord - &h41 < 26 ' &h41 = Asc("A")
 End Function
 
+Function _System_ASCII_IsUpper(c As SByte) As Boolean
+	Return _System_ASCII_IsUpper(c As Byte As WCHAR)
+End Function
+
+Function _System_ASCII_IsLower(c As WCHAR) As Boolean
+	Return c As DWord - &h61 < 26 ' &h61 = Asc("a")
+End Function
+
 Function _System_ASCII_IsLower(c As Char) As Boolean
-	Return c As DWord - &h61 < 26 ' &h61 = Asc("a")
-End Function
-
-Function _System_ASCII_ToLower(c As Char) As Char
+	Return _System_ASCII_IsLower(c As Byte As WCHAR)
+End Function
+
+Function _System_ASCII_ToLower(c As WCHAR) As WCHAR
 	If _System_ASCII_IsUpper(c) Then
 		Return c Or &h20
@@ -1097,4 +1111,8 @@
 		Return c
 	End If
+End Function
+
+Function _System_ASCII_ToLower(c As SByte) As SByte
+	Return _System_ASCII_ToLower(c As Byte As WCHAR) As Byte As SByte
 End Function
 
@@ -1107,33 +1125,8 @@
 End Function
 
-Function _System_WideCharToMultiByte(s As PCWSTR) As PSTR
-	Return _System_WideCharToMultiByte(s, lstrlenW(s) + 1, 0)
-End Function
-
-Function _System_WideCharToMultiByte(s As PCWSTR, size As Long) As PSTR
-	Return _System_WideCharToMultiByte(s, size, 0)
-End Function
-
-Function _System_WideCharToMultiByte(ws As PCWSTR, size As Long, flag As DWord) As PSTR
-	Dim sizeMBS = WideCharToMultiByte(CP_THREAD_ACP, flag, s, size, 0, 0, 0, 0)
-	Dim mbs = _System_malloc(sizeMBS) As PSTR
-	WideCharToMultiByte(CP_THREAD_ACP, flag, s, size, mbs, sizeMBS, 0, 0)
-	Return mbs
-End Function
-
-Function _System_MultiByteToWideChar(s As PCSTR) As PWSTR
-	Return _System_MultiByteToWideChar(s, lstrlenA(s) + 1, 0)
-End Function
-
-Function _System_MultiByteToWideChar(s As PCSTR, size As Long) As PWSTR
-	Return _System_MultiByteToWideChar(s, size, 0)
-End Function
-
-Function _System_MultiByteToWideChar(s As PCSTR, size As Long, flag As DWord) As PWSTR
-	Dim sizeMBS = MultiByteToWideChar(CP_THREAD_ACP, flag, s, size, 0, 0)
-	Dim mbs = _System_malloc(SizeOf (WCHAR) * sizeMBS) As PWSTR
-	MultiByteToWideChar(CP_THREAD_ACP, flag, s, size, mbs, sizeMBS)
-	Return mbs
-End Function
+Function _System_ASCII_ToUpper(c As SByte) As SByte
+	Return _System_ASCII_ToUpper(c As Byte As WCHAR) As Byte As SByte
+End Function
+
 
 Function _System_StrCmp(s1 As PCSTR, s2 As PCSTR) As Long
@@ -1158,3 +1151,4 @@
 	_System_StrCmp = s1[i] - s2[i]
 End Function
+
 #endif '_INC_FUNCTION
