| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| local CP_ACP = 0 |
| local CP_OEM = 1 |
| local CP_MAC = 2 |
| local CP_THREAD_ACP = 3 |
| local CP_SYMBOL = 42 |
| local CP_UTF7 = 65000 |
| local CP_UTF8 = 65001 |
|
|
| local LOADED = {} |
|
|
| local function load(type) |
| if LOADED[type] then return LOADED[type] end |
| local IMPL = require("path.win32." .. type ..".wcs") |
|
|
|
|
| local wcstoutf8 = function (str) return IMPL.wcstombs(str, CP_UTF8) end |
| local utf8towcs = function (str) return IMPL.mbstowcs(str, CP_UTF8) end |
|
|
| local wcstoansi = function (str) return IMPL.wcstombs(str, CP_ACP) end |
| local ansitowcs = function (str) return IMPL.mbstowcs(str, CP_ACP) end |
|
|
| local wcstooem = function (str) return IMPL.wcstombs(str, CP_OEM) end |
| local oemtowcs = function (str) return IMPL.mbstowcs(str, CP_OEM) end |
|
|
| local _M = { |
| MultiByteToWideChar = IMPL.MultiByteToWideChar; |
| WideCharToMultiByte = IMPL.WideCharToMultiByte; |
| mbstowcs = IMPL.mbstowcs; |
| wcstombs = IMPL.wcstombs; |
| wcstoutf8 = wcstoutf8; |
| utf8towcs = utf8towcs; |
| wcstoansi = wcstoansi; |
| ansitowcs = ansitowcs; |
| wcstooem = wcstooem; |
| oemtowcs = oemtowcs; |
| CP = { |
| ACP = CP_ACP; |
| OEM = CP_OEM; |
| MAC = CP_MAC; |
| THREAD_ACP = CP_THREAD_ACP; |
| SYMBOL = CP_SYMBOL; |
| UTF7 = CP_UTF7; |
| UTF8 = CP_UTF8; |
| } |
| } |
|
|
| LOADED[type] = _M |
| return _M |
| end |
|
|
| return { |
| load = load |
| } |