游戏王残局简化版

Check-in [bcf096bd8f]
Login

Check-in [bcf096bd8f]

Overview
Comment:
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: bcf096bd8f550173a45152413a63f8f31bcd8f54534e6ef70e4ae289c85425e4
User & Date: 顽雨沉风 on 2024-02-13 04:51:58
Other Links: manifest | tags
Context
2024-02-13
05:00
check-in: 5b9fb5e09f user: 顽雨沉风 tags: trunk
04:51
check-in: bcf096bd8f user: 顽雨沉风 tags: trunk
04:49
check-in: d8252d8549 user: 顽雨沉风 tags: trunk
Changes

Modified 残局文料/lua_lib/u8_to_a.lua from [707a929003] to [78713afee6].

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
typedef BOOL* LPBOOL;
int MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCCH lpMultiByteStr, int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar);
int WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWCH lpWideCharStr, int cchWideChar, LPSTR lpMultiByteStr, int cchMultiByte, LPCCH lpDefaultChar, LPBOOL pfUsedDefaultChar);
]])
s.CP_ACP = 0
s.CP_UTF8 = 65001
--~ 算机_基统_窗群
function s.m2w(input, o1)
  local wlen = ffi.C.MultiByteToWideChar(o1 or s.CP_ACP, 0, input, #input, nil, 0)
  local wstr = ffi.new("wchar_t[?]", wlen + 1)
  ffi.C.MultiByteToWideChar(o1 or s.CP_ACP, 0, input, #input, wstr, wlen)
  return wstr, wlen
end
function s.w2m(wstr, wlen, o1)
  local len = ffi.C.WideCharToMultiByte(o1 or s.CP_ACP, 0, wstr, wlen or -1, nil, 0, nil, nil)
  local str = ffi.new("char[?]", len)
  ffi.C.WideCharToMultiByte(o1 or s.CP_ACP, 0, wstr, wlen or -1, str, len, nil, nil)
  return ffi.string(str, len)
end
--~ 通用大字集_八位
function s.u8_to_a(input)
  return s.w2m(s.m2w(input, s.CP_UTF8))
end
function s.a_to_u8(input)
  local k1, k2 = s.m2w(input)
  return s.w2m(k1, k2, s.CP_UTF8)
end
return s







|
|

|


|
|

|







|
|


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
typedef BOOL* LPBOOL;
int MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCCH lpMultiByteStr, int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar);
int WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWCH lpWideCharStr, int cchWideChar, LPSTR lpMultiByteStr, int cchMultiByte, LPCCH lpDefaultChar, LPBOOL pfUsedDefaultChar);
]])
s.CP_ACP = 0
s.CP_UTF8 = 65001
--~ 算机_基统_窗群
function s.m2w(input, u1)
  local wlen = ffi.C.MultiByteToWideChar(u1 or s.CP_ACP, 0, input, #input, nil, 0)
  local wstr = ffi.new("wchar_t[?]", wlen + 1)
  ffi.C.MultiByteToWideChar(u1 or s.CP_ACP, 0, input, #input, wstr, wlen)
  return wstr, wlen
end
function s.w2m(wstr, wlen, u1)
  local len = ffi.C.WideCharToMultiByte(u1 or s.CP_ACP, 0, wstr, wlen or -1, nil, 0, nil, nil)
  local str = ffi.new("char[?]", len)
  ffi.C.WideCharToMultiByte(u1 or s.CP_ACP, 0, wstr, wlen or -1, str, len, nil, nil)
  return ffi.string(str, len)
end
--~ 通用大字集_八位
function s.u8_to_a(input)
  return s.w2m(s.m2w(input, s.CP_UTF8))
end
function s.a_to_u8(input)
  local h1, h2 = s.m2w(input)
  return s.w2m(h1, h2, s.CP_UTF8)
end
return s