Overview
Comment: | (/ω\) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
97579aac1b86c8b597bff35fbef2342b |
User & Date: | 顽雨沉风 on 2024-01-23 05:42:06 |
Other Links: | manifest | tags |
Context
2024-01-23
| ||
05:43 | (/ω\) check-in: 9973312896 user: 顽雨沉风 tags: trunk | |
05:42 | (/ω\) check-in: 97579aac1b user: 顽雨沉风 tags: trunk | |
05:41 | (/ω\) check-in: bb2048dbf7 user: 顽雨沉风 tags: trunk | |
Changes
Added 残局文料/lib_lua/u8_to_a.lua version [61e6f5799a].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 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 | local ffi = require("ffi") local d_3 = {} ffi.cdef([[ typedef unsigned int UINT; typedef unsigned long DWORD; typedef wchar_t WCHAR; typedef WCHAR* LPWSTR; typedef wchar_t* LPCWCH; typedef char CHAR; typedef CHAR* LPSTR; typedef const char* LPCCH; typedef int BOOL; 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); ]]) d_3.CP_ACP = 0 d_3.CP_UTF8 = 65001 function d_3.m2w(input, o1) local wlen = ffi.C.MultiByteToWideChar(o1 or d_3.CP_ACP, 0, input, #input, nil, 0) local wstr = ffi.new("wchar_t[?]", wlen + 1) ffi.C.MultiByteToWideChar(o1 or d_3.CP_ACP, 0, input, #input, wstr, wlen) return wstr, wlen end function d_3.w2m(wstr, wlen, o1) local len = ffi.C.WideCharToMultiByte(o1 or d_3.CP_ACP, 0, wstr, wlen or -1, nil, 0, nil, nil) local str = ffi.new("char[?]", len) ffi.C.WideCharToMultiByte(o1 or d_3.CP_ACP, 0, wstr, wlen or -1, str, len, nil, nil) return ffi.string(str, len) end function d_3.u8_to_a(input) return d_3.w2m(d_3.m2w(input, d_3.CP_UTF8)) end function d_3.a_to_u8(input) local k1, k2 = d_3.m2w(input) return d_3.w2m(k1, k2, d_3.CP_UTF8) end return d_3 |