├── .gitignore ├── LICENSE.TXT ├── README.md ├── common ├── common.cpp ├── common.h ├── common.vcxproj ├── common.vcxproj.filters ├── configxml.cpp ├── configxml.h ├── convtype.h ├── cpp.hint ├── eucjis2004.cpp ├── eucjis2004.h ├── eucjis2004table.cpp ├── eucjis2004table.h ├── eucjp.cpp ├── eucjp.h ├── eucjptable.cpp ├── eucjptable.h ├── parseskkdic.cpp ├── parseskkdic.h ├── pch.cpp ├── pch.h ├── utf8.cpp ├── utf8.h └── version.h ├── imcrvcnf ├── ConfigCnf.cpp ├── DlgDicAddUrl.cpp ├── DlgDicMake.cpp ├── DlgProcBehavior1.cpp ├── DlgProcBehavior2.cpp ├── DlgProcConvPoint.cpp ├── DlgProcDictionary1.cpp ├── DlgProcDictionary2.cpp ├── DlgProcDisplay1.cpp ├── DlgProcDisplay2.cpp ├── DlgProcDisplayAttr.cpp ├── DlgProcJLatin.cpp ├── DlgProcKana.cpp ├── DlgProcKeyMap.cpp ├── DlgProcPreservedKey.cpp ├── DlgProcSelKey.cpp ├── convtable.cpp ├── convtable.h ├── cpp.hint ├── imcrvcnf.cpp ├── imcrvcnf.h ├── imcrvcnf.ico ├── imcrvcnf.manifest ├── imcrvcnf.rc ├── imcrvcnf.vcxproj ├── imcrvcnf.vcxproj.filters ├── pch.cpp ├── pch.h └── resource.h ├── imcrvmgr ├── ConfigMgr.cpp ├── SearchCharacter.cpp ├── SearchDictionary.cpp ├── SearchSKKServer.cpp ├── SearchUserDictionary.cpp ├── Server.cpp ├── cpp.hint ├── imcrvmgr.cpp ├── imcrvmgr.h ├── imcrvmgr.manifest ├── imcrvmgr.rc ├── imcrvmgr.vcxproj ├── imcrvmgr.vcxproj.filters ├── lcrvmgr.cpp ├── pch.cpp └── pch.h ├── imcrvskk.sln ├── imcrvtip ├── CandidateKeyHandler.cpp ├── CandidateList.cpp ├── CandidateList.h ├── CandidatePaint.cpp ├── CandidateUIElement.cpp ├── CandidateWindow.cpp ├── CandidateWindow.h ├── Compartment.cpp ├── CompartmentEventSink.cpp ├── Composition.cpp ├── ConfigTip.cpp ├── DisplayAttributeInfo.h ├── DisplayAttributeProvider.cpp ├── DllMain.cpp ├── EditSession.h ├── EnumDisplayAttributeInfo.h ├── FnCandidateList.h ├── FnCandidateString.h ├── FnEnumCandidates.h ├── FunctionProvider.cpp ├── Globals.cpp ├── Icon │ ├── imcrvskk.ico │ ├── imdebug.ico │ ├── pxAscii.ico │ ├── pxHiragana.ico │ ├── pxJLatin.ico │ ├── pxKatakana.ico │ ├── pxKatakana1.ico │ ├── pzAscii.ico │ ├── pzHiragana.ico │ ├── pzJLatin.ico │ ├── pzKatakana.ico │ ├── pzKatakana1.ico │ ├── xAscii.ico │ ├── xDefault.ico │ ├── xHiragana.ico │ ├── xJLatin.ico │ ├── xKatakana.ico │ ├── xKatakana1.ico │ ├── zAscii.ico │ ├── zDefault.ico │ ├── zHiragana.ico │ ├── zJLatin.ico │ ├── zKatakana.ico │ └── zKatakana1.ico ├── InputModeWindow.cpp ├── InputModeWindow.h ├── KeyEventSink.cpp ├── KeyHandler.cpp ├── KeyHandlerCharacter.cpp ├── KeyHandlerComposition.cpp ├── KeyHandlerControl.cpp ├── KeyHandlerConversion.cpp ├── KeyHandlerDictionary.cpp ├── LanguageBar.cpp ├── LanguageBar.h ├── Property.cpp ├── Register.cpp ├── Server.cpp ├── TextEditSink.cpp ├── TextService.cpp ├── TextService.h ├── ThreadFocusSink.cpp ├── ThreadMgrEventSink.cpp ├── cpp.hint ├── imcrvtip.def ├── imcrvtip.h ├── imcrvtip.rc ├── imcrvtip.vcxproj ├── imcrvtip.vcxproj.filters ├── pch.cpp ├── pch.h └── resource.h ├── installer ├── _build.cmd ├── _build_bundle.cmd ├── _build_doc.cmd ├── _build_msi.cmd ├── _clean.cmd ├── _debug_reg.cmd ├── _debug_unreg.cmd ├── _env.cmd ├── _sign.cmd ├── _solution_build.cmd ├── _solution_build_debug.cmd ├── _solution_clean.cmd ├── _verify.cmd ├── _vsdev.cmd ├── config-lua │ ├── init.lua │ ├── test_c.lua │ ├── test_gadget.lua │ ├── test_num.lua │ ├── test_search.lua │ └── test_time.lua ├── config-sample │ ├── config - act.xml │ ├── config - azik-jpkbd.xml │ ├── config - azik-uskbd.xml │ ├── config - gact10.xml │ ├── config - kana.xml │ ├── config - roman.xml │ ├── config - tsuki-2-263-jpkbd.xml │ ├── config - tsuki-2-263-uskbd.xml │ ├── config - wait-sample.xml │ ├── kanatable.txt │ ├── skk-omikuji.txt │ └── skk-strftime.txt ├── config-share │ ├── config.xml │ └── skkdict.txt ├── installer-arm32.wxs ├── installer-arm64.wxs ├── installer-bundle.wixproj ├── installer-bundle.wxs ├── installer-msi.wixproj ├── installer-x64.wxs ├── installer-x86.wxs ├── installer.vcxproj ├── installer.vcxproj.filters ├── resource-md │ ├── 00_input_mode_ascii.png │ ├── 00_input_mode_default.png │ ├── 00_input_mode_hiragana.png │ ├── 00_input_mode_jlatin.png │ ├── 00_input_mode_katakana.png │ ├── 00_input_mode_katakana1.png │ ├── 00_input_mode_p_ascii.png │ ├── 00_input_mode_p_hiragana.png │ ├── 00_input_mode_p_jlatin.png │ ├── 00_input_mode_p_katakana.png │ ├── 00_input_mode_p_katakana1.png │ ├── 01_input_menu_0.png │ ├── 01_input_menu_1.png │ ├── 02_key_and_mode.png │ ├── 101_dictionary_1.png │ ├── 102_dictionary_2.png │ ├── 103_behavior_1.png │ ├── 104_behavior_2.png │ ├── 105_display_1.png │ ├── 106_display_2.png │ ├── 107_display_attribute_1.png │ ├── 108_display_attribute_2.png │ ├── 109_select_key.png │ ├── 110_on_off_key.png │ ├── 111_key1_character.png │ ├── 112_key2_virtual_key.png │ ├── 113_conversion_point.png │ ├── 114_kana.png │ ├── 115_full_width_latin.png │ ├── 201_convert_program.png │ ├── 202_convert_number.png │ ├── 203_convert_unicode_codepoint.png │ ├── 204_convert_unicode_jisx0213.png │ ├── 205_convert_character_display.png │ ├── 206_register_annotation.png │ ├── logo.png │ └── markdown.css └── theme-bundle │ ├── banner.bmp │ ├── dialog.bmp │ ├── license.rtf │ ├── logo.png │ └── thm.wxl ├── libinput ├── input.cpp ├── input.def ├── input.h ├── libinput.vcxproj └── libinput.vcxproj.filters ├── liblua ├── lapi.c ├── lapi.h ├── lauxlib.c ├── lauxlib.h ├── lbaselib.c ├── lcode.c ├── lcode.h ├── lcorolib.c ├── lctype.c ├── lctype.h ├── ldblib.c ├── ldebug.c ├── ldebug.h ├── ldo.c ├── ldo.h ├── ldump.c ├── lfunc.c ├── lfunc.h ├── lgc.c ├── lgc.h ├── liblua.rc ├── liblua.vcxproj ├── liblua.vcxproj.filters ├── linit.c ├── liolib.c ├── ljumptab.h ├── llex.c ├── llex.h ├── llimits.h ├── lmathlib.c ├── lmem.c ├── lmem.h ├── loadlib.c ├── lobject.c ├── lobject.h ├── lopcodes.c ├── lopcodes.h ├── lopnames.h ├── loslib.c ├── lparser.c ├── lparser.h ├── lprefix.h ├── lstate.c ├── lstate.h ├── lstring.c ├── lstring.h ├── lstrlib.c ├── ltable.c ├── ltable.h ├── ltablib.c ├── ltm.c ├── ltm.h ├── lu8w.c ├── lu8w.h ├── lua.h ├── lua.hpp ├── luaconf.h ├── lualib.h ├── lundump.c ├── lundump.h ├── lutf8lib.c ├── lvm.c ├── lvm.h ├── lzio.c ├── lzio.h ├── pch.c └── pch.h ├── libz ├── adler32.c ├── compress.c ├── crc32.c ├── crc32.h ├── deflate.c ├── deflate.h ├── gzclose.c ├── gzguts.h ├── gzlib.c ├── gzread.c ├── gzwrite.c ├── infback.c ├── inffast.c ├── inffast.h ├── inffixed.h ├── inflate.c ├── inflate.h ├── inftrees.c ├── inftrees.h ├── libz.vcxproj ├── libz.vcxproj.filters ├── pch.c ├── pch.h ├── trees.c ├── trees.h ├── uncompr.c ├── zconf.h ├── zlib.def ├── zlib.h ├── zlib1.rc ├── zutil.c └── zutil.h ├── lua ├── lua.c ├── lua.manifest ├── lua.rc ├── lua.vcxproj ├── lua.vcxproj.filters ├── pch.c └── pch.h └── test └── imcrvmgr_test ├── cpp.hint ├── dictionary.cpp ├── dictionary.h ├── imcrvmgr_test.cpp ├── imcrvmgr_test.vcxproj ├── imcrvmgr_test.vcxproj.filters ├── pch.cpp └── pch.h /common/common.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | Header Files 38 | 39 | 40 | Header Files 41 | 42 | 43 | Header Files 44 | 45 | 46 | Header Files 47 | 48 | 49 | Header Files 50 | 51 | 52 | 53 | 54 | Source Files 55 | 56 | 57 | Source Files 58 | 59 | 60 | Source Files 61 | 62 | 63 | Source Files 64 | 65 | 66 | Source Files 67 | 68 | 69 | Source Files 70 | 71 | 72 | Source Files 73 | 74 | 75 | Source Files 76 | 77 | 78 | Source Files 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /common/convtype.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define ROMAN_NUM 8 4 | #define KANA_NUM 8 5 | #define JLATIN_NUM 2 6 | 7 | //ローマ字仮名変換 8 | typedef struct { 9 | WCHAR roman[ROMAN_NUM]; 10 | WCHAR hiragana[KANA_NUM]; 11 | WCHAR katakana[KANA_NUM]; 12 | WCHAR katakana_ank[KANA_NUM]; 13 | BOOL soku; 14 | BOOL wait; 15 | } ROMAN_KANA_CONV; 16 | 17 | //ASCII全英変換 18 | typedef struct { 19 | WCHAR ascii[JLATIN_NUM]; 20 | WCHAR jlatin[JLATIN_NUM]; 21 | } ASCII_JLATIN_CONV; 22 | 23 | #define ROMAN_KANA_TBL_MAX 32768 24 | #define ASCII_JLATIN_TBL_NUM 128 25 | -------------------------------------------------------------------------------- /common/cpp.hint: -------------------------------------------------------------------------------- 1 | // common.h 2 | #define FORWARD_ITERATION_I(iterator, container) for (auto (iterator) = (container).begin(); (iterator) != (container).end(); ++(iterator)) 3 | #define FORWARD_ITERATION(iterator, container) for (auto (iterator) = (container).begin(); (iterator) != (container).end(); ) 4 | #define REVERSE_ITERATION_I(reverse_iterator, container) for (auto (reverse_iterator) = (container).rbegin(); (reverse_iterator) != (container).rend(); ++(reverse_iterator)) 5 | #define REVERSE_ITERATION(reverse_iterator, container) for (auto (reverse_iterator) = (container).rbegin(); (reverse_iterator) != (container).rend(); ) 6 | -------------------------------------------------------------------------------- /common/eucjis2004.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Unicode Code PointをUTF-16へ変換 4 | // 戻り値 5 | // 0 : ucpがU+10FFFFより大きい 6 | // firstまたはsecondがnullptr 7 | // 1 : BMP内 8 | // 2 : BMP外 9 | // 引数 10 | // ucp : Unicode符号位置 11 | // first : BMPの文字または上位サロゲート 12 | // second : 下位サロゲート 13 | size_t UcpToWideChar(UCSCHAR ucp, PWCHAR first, PWCHAR second); 14 | 15 | // EUC 1文字分をUnicode Code Pointへ変換 16 | // 戻り値 17 | // 変換に使用されたサイズ(char単位) 18 | // 引数 19 | // src : 変換元のEUC-JIS-2004文字列 20 | // srcsize : 変換元のEUC-JIS-2004文字列のサイズ 21 | // ucp1 : Unicode符号位置1つ目 22 | // ucp2 : Unicode符号位置2つ目(結合文字がある場合、なければ0) 23 | size_t EucJis2004ToUcp(LPCSTR src, size_t srcsize, PUCSCHAR ucp1, PUCSCHAR ucp2); 24 | 25 | // EUC-JIS-2004をUTF-16へ変換 26 | // 戻り値 27 | // TRUE : 成功 28 | // FALSE : 失敗 29 | // 引数 30 | // src : 変換元のEUC-JIS-2004文字列 31 | // nullptrのとき戻り値はFALSEになる 32 | // srcsize : nullptrのときsrcの終端NULLまで変換する 33 | // nullptr以外のとき指定されたサイズまたはsrcの終端NULLの短いほうまで変換する 34 | // 変換に使用されたサイズ(char単位)が戻る 35 | // dst : 変換先のUTF-16LE文字列バッファ 36 | // nullptrは許容される 37 | // dstsize : dstのサイズ 38 | // 変換結果の終端NULLを含むサイズ(wchar_t単位)が戻る 39 | // nullptrのとき戻り値はFALSEになる 40 | BOOL EucJis2004ToWideChar(LPCSTR src, size_t *srcsize, LPWSTR dst, size_t *dstsize); 41 | 42 | // UTF-16をEUC-JIS-2004へ変換 43 | // 戻り値 44 | // TRUE : 成功 45 | // FALSE : 失敗 46 | // 引数 47 | // src : 変換元のUTF-16LE文字列 48 | // nullptrのとき戻り値はFALSEになる 49 | // srcsize : nullptrのときsrcの終端NULLまで変換する 50 | // nullptr以外のとき指定されたサイズまたはsrcの終端NULLの短いほうまで変換する 51 | // 変換に使用されたサイズ(wchar_t単位)が戻る 52 | // dst : 変換先のEUC-JIS-2004文字列バッファ 53 | // nullptrは許容される 54 | // dstsize : dstのサイズ 55 | // 変換結果の終端NULLを含むサイズ(char単位)が戻る 56 | // nullptrのとき戻り値はFALSEになる 57 | BOOL WideCharToEucJis2004(LPCWSTR src, size_t *srcsize, LPSTR dst, size_t *dstsize); 58 | 59 | void AddNullWideChar(size_t *srcsize, size_t si, LPWSTR dst, size_t *dstsize, size_t di); 60 | void AddNullMultiByte(size_t *srcsize, size_t si, LPSTR dst, size_t *dstsize, size_t di); 61 | 62 | std::wstring eucjis2004_string_to_wstring(const std::string &s); 63 | std::string wstring_to_eucjis2004_string(const std::wstring &s); 64 | -------------------------------------------------------------------------------- /common/eucjis2004table.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define CMBCHARNUM 25 // Unicode結合文字 4 | #define ROWNUM 94 // 区 5 | #define CELLNUM 94 // 点 6 | #define ANKNUM 94 // JIS X 0201 片仮名 7 | #define ROW2NUM 26 // JIS X 0213 第二面 区数 8 | #define CMPEUCNUM 2 // Unicode -> EUC-JIS-2004 互換性 9 | 10 | // Unicode結合文字 11 | typedef struct { 12 | USHORT euc; 13 | UCSCHAR ucp[2]; 14 | } EUCCMB; 15 | 16 | // Unicode互換性 17 | typedef struct { 18 | USHORT euc; 19 | UCSCHAR ucp; 20 | } EUCCMP; 21 | 22 | // 変換テーブル 23 | 24 | // Unicode結合文字 25 | extern const EUCCMB euccmb[CMBCHARNUM]; 26 | // JIS X 0213 第一面 27 | extern const UCSCHAR euc1[ROWNUM][CELLNUM]; 28 | // JIS X 0201 片仮名 29 | extern const UCSCHAR eucK[ANKNUM]; 30 | // JIS X 0213 第二面 31 | extern const BYTE euc2i[ROWNUM]; 32 | // JIS X 0213 第二面 33 | extern const UCSCHAR euc2[ROW2NUM][CELLNUM]; 34 | // Unicode -> EUC-JIS-2004 互換性 35 | extern const EUCCMP euccmp[CMPEUCNUM]; 36 | -------------------------------------------------------------------------------- /common/eucjp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // EUC 1文字分をUnicode Code Pointへ変換 4 | // 戻り値 5 | // 変換に使用されたサイズ(char単位) 6 | // 引数 7 | // src : 変換元のEUC-JP文字列 8 | // srcsize : 変換元のEUC-JP文字列のサイズ 9 | // ucp1 : Unicode符号位置1つ目 10 | // ucp2 : Unicode符号位置2つ目(結合文字がある場合、なければ0) 11 | size_t EucJPToUcp(LPCSTR src, size_t srcsize, PUCSCHAR ucp1, PUCSCHAR ucp2); 12 | 13 | // EUC-JPをUTF-16へ変換 14 | // 戻り値 15 | // TRUE : 成功 16 | // FALSE : 失敗 17 | // 引数 18 | // src : 変換元のEUC-JP文字列 19 | // nullptrのとき戻り値はFALSEになる 20 | // srcsize : nullptrのときsrcの終端NULLまで変換する 21 | // nullptr以外のとき指定されたサイズまたはsrcの終端NULLの短いほうまで変換する 22 | // 変換に使用されたサイズ(char単位)が戻る 23 | // dst : 変換先のUTF-16LE文字列バッファ 24 | // nullptrは許容される 25 | // dstsize : dstのサイズ 26 | // 変換結果の終端NULLを含むサイズ(wchar_t単位)が戻る 27 | // nullptrのとき戻り値はFALSEになる 28 | BOOL EucJPToWideChar(LPCSTR src, size_t *srcsize, LPWSTR dst, size_t *dstsize); 29 | 30 | // UTF-16をEUC-JPへ変換 31 | // 戻り値 32 | // TRUE : 成功 33 | // FALSE : 失敗 34 | // 引数 35 | // src : 変換元のUTF-16LE文字列 36 | // nullptrのとき戻り値はFALSEになる 37 | // srcsize : nullptrのときsrcの終端NULLまで変換する 38 | // nullptr以外のとき指定されたサイズまたはsrcの終端NULLの短いほうまで変換する 39 | // 変換に使用されたサイズ(wchar_t単位)が戻る 40 | // dst : 変換先のEUC-JP文字列バッファ 41 | // nullptrは許容される 42 | // dstsize : dstのサイズ 43 | // 変換結果の終端NULLを含むサイズ(char単位)が戻る 44 | // nullptrのとき戻り値はFALSEになる 45 | BOOL WideCharToEucJP(LPCWSTR src, size_t *srcsize, LPSTR dst, size_t *dstsize); 46 | 47 | std::wstring eucjp_string_to_wstring(const std::string &s); 48 | std::string wstring_to_eucjp_string(const std::wstring &s); 49 | -------------------------------------------------------------------------------- /common/eucjptable.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "eucjis2004table.h" 4 | 5 | #define ROW0212NUM 68 // JIS X 0212 区数 6 | #define COLNUM 6 // JIS X 0208 有効区点要素数 (区数+2)/16 7 | #define CMPEUCJPNUM 9 // Unicode -> EUC-JP 互換性 8 | 9 | //変換テーブル 10 | 11 | // JIS X 0208 有効区点 12 | extern const USHORT jisx0208e[ROWNUM][COLNUM]; 13 | // JIS X 0212 インデックス 14 | extern const BYTE euc0212i[ROWNUM]; 15 | // JIS X 0212 16 | extern const UCSCHAR euc0212[ROW0212NUM][CELLNUM]; 17 | // Unicode -> EUC-JP 互換性 18 | extern const EUCCMP eucjpcmp[CMPEUCJPNUM]; 19 | -------------------------------------------------------------------------------- /common/parseskkdic.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //変換済み検索結果 4 | typedef std::pair< std::wstring, std::wstring > CANDIDATEBASE; //候補、注釈 5 | typedef std::pair< CANDIDATEBASE, CANDIDATEBASE > CANDIDATE; //表示用、辞書登録用 6 | typedef std::vector< CANDIDATE > CANDIDATES; 7 | 8 | //検索結果 9 | typedef std::pair< std::wstring, std::wstring > SKKDICCANDIDATE; //候補、注釈 10 | typedef std::vector< SKKDICCANDIDATE > SKKDICCANDIDATES; 11 | 12 | //送りありエントリのブロック 13 | typedef std::pair< std::wstring, SKKDICCANDIDATES > SKKDICOKURIBLOCK; //送り仮名、候補 14 | typedef std::vector< SKKDICOKURIBLOCK > SKKDICOKURIBLOCKS; 15 | typedef std::pair< std::wstring, SKKDICOKURIBLOCKS > USEROKURIENTRY; //見出し語、送りブロック 16 | typedef std::map< std::wstring, SKKDICOKURIBLOCKS > USEROKURI; 17 | 18 | //見出し語順序 19 | typedef std::vector< std::wstring > KEYORDER; 20 | 21 | //辞書 22 | typedef std::pair< std::wstring, SKKDICCANDIDATES > SKKDICENTRY; //見出し語、候補 23 | typedef std::map< std::wstring, SKKDICCANDIDATES > SKKDIC; 24 | 25 | extern LPCWSTR EntriesAri; 26 | extern LPCWSTR EntriesNasi; 27 | 28 | enum SKKDICENCODING 29 | { 30 | enc_error = -1, 31 | enc_none = 0, 32 | enc_euc_jis_2004 = 1, 33 | enc_euc_jp = 2, 34 | enc_utf_8 = 8, 35 | enc_utf_16 = 16 36 | }; 37 | 38 | int ReadSKKDicLine(FILE *fp, SKKDICENCODING encoding, int &okuri, std::wstring &key, 39 | SKKDICCANDIDATES &c, SKKDICOKURIBLOCKS &o); 40 | void ParseSKKDicCandiate(const std::wstring &s, SKKDICCANDIDATES &c); 41 | void ParseSKKDicOkuriBlock(const std::wstring &s, SKKDICOKURIBLOCKS &o); 42 | std::wstring ParseConcat(const std::wstring &s); 43 | std::wstring MakeConcat(const std::wstring &s); 44 | std::wstring EscapeGadgetString(const std::wstring &s); 45 | -------------------------------------------------------------------------------- /common/pch.cpp: -------------------------------------------------------------------------------- 1 |  2 | -------------------------------------------------------------------------------- /common/pch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /common/utf8.cpp: -------------------------------------------------------------------------------- 1 |  2 | std::string wstring_to_utf8_string(const std::wstring &s) 3 | { 4 | std::string ret; 5 | 6 | int len = WideCharToMultiByte(CP_UTF8, 0, s.c_str(), -1, nullptr, 0, nullptr, nullptr); 7 | if (len > 0) 8 | { 9 | try 10 | { 11 | LPSTR utf8 = new CHAR[len]; 12 | if (WideCharToMultiByte(CP_UTF8, 0, s.c_str(), -1, utf8, len, nullptr, nullptr) > 0) 13 | { 14 | ret = utf8; 15 | } 16 | delete[] utf8; 17 | } 18 | catch (...) 19 | { 20 | } 21 | } 22 | 23 | return ret; 24 | } 25 | 26 | std::wstring utf8_string_to_wstring(const std::string &s) 27 | { 28 | std::wstring ret; 29 | 30 | int len = MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, nullptr, 0); 31 | if (len > 0) 32 | { 33 | try 34 | { 35 | LPWSTR wcs = new WCHAR[len]; 36 | if (MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, wcs, len) > 0) 37 | { 38 | ret = wcs; 39 | } 40 | delete[] wcs; 41 | } 42 | catch (...) 43 | { 44 | } 45 | } 46 | 47 | return ret; 48 | } 49 | -------------------------------------------------------------------------------- /common/utf8.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | std::string wstring_to_utf8_string(const std::wstring &s); 4 | std::wstring utf8_string_to_wstring(const std::string &s); 5 | 6 | #define WCTOU8(w) wstring_to_utf8_string(w).c_str() 7 | #define U8TOWC(u) utf8_string_to_wstring(u).c_str() 8 | 9 | #define TOWELLFORMED(w) U8TOWC(WCTOU8(w)) 10 | -------------------------------------------------------------------------------- /common/version.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define TEXTSERVICE_NAME L"CorvusSKK" 4 | #ifndef _DEBUG 5 | #define TEXTSERVICE_DESC TEXTSERVICE_NAME 6 | #else 7 | #define TEXTSERVICE_DESC TEXTSERVICE_NAME L"_DEBUG" 8 | #endif 9 | #define TEXTSERVICE_DIR L"IMCRVSKK" 10 | #define TEXTSERVICE_VER L"3.3.0" 11 | 12 | //for resource 13 | #define RC_AUTHOR "nathancorvussolis" 14 | #define RC_PRODUCT "CorvusSKK" 15 | #define RC_VERSION "3.3.0" 16 | #define RC_VERSION_D 3,3,0,0 17 | -------------------------------------------------------------------------------- /imcrvcnf/DlgDicAddUrl.cpp: -------------------------------------------------------------------------------- 1 |  2 | #include "configxml.h" 3 | #include "imcrvcnf.h" 4 | #include "resource.h" 5 | 6 | WCHAR urlskkdic[INTERNET_MAX_URL_LENGTH]; 7 | 8 | INT_PTR CALLBACK DlgProcSKKDicAddUrl(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) 9 | { 10 | switch (message) 11 | { 12 | case WM_INITDIALOG: 13 | return TRUE; 14 | case WM_CTLCOLORDLG: 15 | case WM_CTLCOLORSTATIC: 16 | case WM_CTLCOLORBTN: 17 | SetBkMode((HDC)wParam, TRANSPARENT); 18 | SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT)); 19 | return (INT_PTR)GetSysColorBrush(COLOR_WINDOW); 20 | case WM_COMMAND: 21 | switch (LOWORD(wParam)) 22 | { 23 | case IDOK: 24 | GetDlgItemTextW(hDlg, IDC_EDIT_SKK_DIC_URL, urlskkdic, _countof(urlskkdic)); 25 | { 26 | // trim 27 | std::wstring strurl = std::regex_replace(urlskkdic, RegExp(L"^\\s+|\\s+$"), L""); 28 | _snwprintf_s(urlskkdic, _TRUNCATE, L"%s", strurl.c_str()); 29 | 30 | if (urlskkdic[0] == L'\0') 31 | { 32 | EndDialog(hDlg, IDCANCEL); 33 | } 34 | } 35 | EndDialog(hDlg, IDOK); 36 | return TRUE; 37 | case IDCANCEL: 38 | urlskkdic[0] = L'\0'; 39 | EndDialog(hDlg, IDCANCEL); 40 | return TRUE; 41 | default: 42 | break; 43 | } 44 | break; 45 | default: 46 | break; 47 | } 48 | return FALSE; 49 | } 50 | -------------------------------------------------------------------------------- /imcrvcnf/DlgProcBehavior1.cpp: -------------------------------------------------------------------------------- 1 |  2 | #include "configxml.h" 3 | #include "imcrvcnf.h" 4 | #include "resource.h" 5 | 6 | INT_PTR CALLBACK DlgProcBehavior1(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) 7 | { 8 | switch (message) 9 | { 10 | case WM_INITDIALOG: 11 | LoadCheckButton(hDlg, IDC_CHECKBOX_DEFAULTMODE, SectionBehavior, ValueDefaultMode); 12 | LoadCheckButton(hDlg, IDC_RADIO_DEFMODEASCII, SectionBehavior, ValueDefModeAscii); 13 | if (!IsDlgButtonChecked(hDlg, IDC_RADIO_DEFMODEASCII)) 14 | { 15 | CheckDlgButton(hDlg, IDC_RADIO_DEFMODEHIRA, BST_CHECKED); 16 | } 17 | LoadCheckButton(hDlg, IDC_CHECKBOX_BEGINCVOKURI, SectionBehavior, ValueBeginCvOkuri, L"1"); 18 | LoadCheckButton(hDlg, IDC_CHECKBOX_PRECEDEOKURI, SectionBehavior, ValuePrecedeOkuri); 19 | LoadCheckButton(hDlg, IDC_CHECKBOX_SHIFTNNOKURI, SectionBehavior, ValueShiftNNOkuri, L"1"); 20 | LoadCheckButton(hDlg, IDC_CHECKBOX_SRCHALLOKURI, SectionBehavior, ValueSrchAllOkuri); 21 | LoadCheckButton(hDlg, IDC_CHECKBOX_DELCVPOSCNCL, SectionBehavior, ValueDelCvPosCncl, L"1"); 22 | LoadCheckButton(hDlg, IDC_CHECKBOX_DELOKURICNCL, SectionBehavior, ValueDelOkuriCncl); 23 | LoadCheckButton(hDlg, IDC_CHECKBOX_BACKINCENTER, SectionBehavior, ValueBackIncEnter, L"1"); 24 | LoadCheckButton(hDlg, IDC_CHECKBOX_ADDCANDKTKN, SectionBehavior, ValueAddCandKtkn); 25 | LoadCheckButton(hDlg, IDC_CHECKBOX_ENTOGGLEKANA, SectionBehavior, ValueEnToggleKana, L"1"); 26 | LoadCheckButton(hDlg, IDC_CHECKBOX_SETBYDIRECT, SectionBehavior, ValueSetByDirect); 27 | 28 | return TRUE; 29 | 30 | case WM_COMMAND: 31 | switch (LOWORD(wParam)) 32 | { 33 | case IDC_CHECKBOX_DEFAULTMODE: 34 | case IDC_RADIO_DEFMODEHIRA: 35 | case IDC_RADIO_DEFMODEASCII: 36 | case IDC_CHECKBOX_BEGINCVOKURI: 37 | case IDC_CHECKBOX_PRECEDEOKURI: 38 | case IDC_CHECKBOX_SHIFTNNOKURI: 39 | case IDC_CHECKBOX_SRCHALLOKURI: 40 | case IDC_CHECKBOX_DELCVPOSCNCL: 41 | case IDC_CHECKBOX_DELOKURICNCL: 42 | case IDC_CHECKBOX_BACKINCENTER: 43 | case IDC_CHECKBOX_ADDCANDKTKN: 44 | case IDC_CHECKBOX_ENTOGGLEKANA: 45 | case IDC_CHECKBOX_SETBYDIRECT: 46 | 47 | PropSheet_Changed(GetParent(hDlg), hDlg); 48 | 49 | return TRUE; 50 | 51 | default: 52 | break; 53 | } 54 | break; 55 | 56 | default: 57 | break; 58 | } 59 | 60 | return FALSE; 61 | } 62 | 63 | void SaveBehavior1(IXmlWriter *pWriter, HWND hDlg) 64 | { 65 | SaveCheckButton(pWriter, hDlg, IDC_CHECKBOX_DEFAULTMODE, ValueDefaultMode); 66 | SaveCheckButton(pWriter, hDlg, IDC_RADIO_DEFMODEASCII, ValueDefModeAscii); 67 | SaveCheckButton(pWriter, hDlg, IDC_CHECKBOX_BEGINCVOKURI, ValueBeginCvOkuri); 68 | SaveCheckButton(pWriter, hDlg, IDC_CHECKBOX_PRECEDEOKURI, ValuePrecedeOkuri); 69 | SaveCheckButton(pWriter, hDlg, IDC_CHECKBOX_SHIFTNNOKURI, ValueShiftNNOkuri); 70 | SaveCheckButton(pWriter, hDlg, IDC_CHECKBOX_SRCHALLOKURI, ValueSrchAllOkuri); 71 | SaveCheckButton(pWriter, hDlg, IDC_CHECKBOX_DELCVPOSCNCL, ValueDelCvPosCncl); 72 | SaveCheckButton(pWriter, hDlg, IDC_CHECKBOX_DELOKURICNCL, ValueDelOkuriCncl); 73 | SaveCheckButton(pWriter, hDlg, IDC_CHECKBOX_BACKINCENTER, ValueBackIncEnter); 74 | SaveCheckButton(pWriter, hDlg, IDC_CHECKBOX_ADDCANDKTKN, ValueAddCandKtkn); 75 | SaveCheckButton(pWriter, hDlg, IDC_CHECKBOX_ENTOGGLEKANA, ValueEnToggleKana); 76 | SaveCheckButton(pWriter, hDlg, IDC_CHECKBOX_SETBYDIRECT, ValueSetByDirect); 77 | } 78 | -------------------------------------------------------------------------------- /imcrvcnf/DlgProcBehavior2.cpp: -------------------------------------------------------------------------------- 1 |  2 | #include "configxml.h" 3 | #include "imcrvcnf.h" 4 | #include "resource.h" 5 | 6 | INT_PTR CALLBACK DlgProcBehavior2(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) 7 | { 8 | HWND hwnd; 9 | WCHAR num[2] = {}; 10 | std::wstring strxmlval; 11 | int count; 12 | 13 | switch (message) 14 | { 15 | case WM_INITDIALOG: 16 | hwnd = GetDlgItem(hDlg, IDC_COMBO_COMPMULTINUM); 17 | num[1] = L'\0'; 18 | for (int i = 1; i <= MAX_SELKEY_C; i++) 19 | { 20 | num[0] = L'0' + (WCHAR)i; 21 | SendMessageW(hwnd, CB_ADDSTRING, 0, (LPARAM)num); 22 | } 23 | ReadValue(pathconfigxml, SectionBehavior, ValueCompMultiNum, strxmlval); 24 | count = strxmlval.empty() ? COMPMULTIDISP_DEF : _wtoi(strxmlval.c_str()); 25 | if (count > MAX_SELKEY_C || count < 1) 26 | { 27 | count = COMPMULTIDISP_DEF; 28 | } 29 | SendMessageW(hwnd, CB_SETCURSEL, (WPARAM)(count - 1), 0); 30 | 31 | LoadCheckButton(hDlg, IDC_CHECKBOX_STACOMPMULTI, SectionBehavior, ValueStaCompMulti); 32 | LoadCheckButton(hDlg, IDC_CHECKBOX_DYNAMINCOMP, SectionBehavior, ValueDynamicComp); 33 | LoadCheckButton(hDlg, IDC_CHECKBOX_DYNCOMPMULTI, SectionBehavior, ValueDynCompMulti); 34 | LoadCheckButton(hDlg, IDC_CHECKBOX_COMPUSERDIC, SectionBehavior, ValueCompUserDic); 35 | LoadCheckButton(hDlg, IDC_CHECKBOX_COMPINCBACK, SectionBehavior, ValueCompIncBack); 36 | 37 | return TRUE; 38 | 39 | case WM_COMMAND: 40 | switch (LOWORD(wParam)) 41 | { 42 | case IDC_COMBO_COMPMULTINUM: 43 | switch (HIWORD(wParam)) 44 | { 45 | case CBN_SELCHANGE: 46 | PropSheet_Changed(GetParent(hDlg), hDlg); 47 | return TRUE; 48 | default: 49 | break; 50 | } 51 | break; 52 | 53 | case IDC_CHECKBOX_STACOMPMULTI: 54 | case IDC_CHECKBOX_DYNAMINCOMP: 55 | case IDC_CHECKBOX_DYNCOMPMULTI: 56 | case IDC_CHECKBOX_COMPUSERDIC: 57 | case IDC_CHECKBOX_COMPINCBACK: 58 | 59 | PropSheet_Changed(GetParent(hDlg), hDlg); 60 | 61 | return TRUE; 62 | 63 | default: 64 | break; 65 | } 66 | break; 67 | 68 | default: 69 | break; 70 | } 71 | 72 | return FALSE; 73 | } 74 | 75 | void SaveBehavior2(IXmlWriter *pWriter, HWND hDlg) 76 | { 77 | WCHAR num[2] = {}; 78 | 79 | HWND hwnd = GetDlgItem(hDlg, IDC_COMBO_COMPMULTINUM); 80 | int count = 1 + (int)SendMessageW(hwnd, CB_GETCURSEL, 0, 0); 81 | if (count > MAX_SELKEY_C || count < 1) 82 | { 83 | count = COMPMULTIDISP_DEF; 84 | } 85 | num[0] = L'0' + (WCHAR)count; 86 | num[1] = L'\0'; 87 | WriterKey(pWriter, ValueCompMultiNum, num); 88 | 89 | SaveCheckButton(pWriter, hDlg, IDC_CHECKBOX_STACOMPMULTI, ValueStaCompMulti); 90 | SaveCheckButton(pWriter, hDlg, IDC_CHECKBOX_DYNAMINCOMP, ValueDynamicComp); 91 | SaveCheckButton(pWriter, hDlg, IDC_CHECKBOX_DYNCOMPMULTI, ValueDynCompMulti); 92 | SaveCheckButton(pWriter, hDlg, IDC_CHECKBOX_COMPUSERDIC, ValueCompUserDic); 93 | SaveCheckButton(pWriter, hDlg, IDC_CHECKBOX_COMPINCBACK, ValueCompIncBack); 94 | } 95 | -------------------------------------------------------------------------------- /imcrvcnf/convtable.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "convtype.h" 4 | 5 | #define ROMAN_KANA_TBL_DEF_NUM 384 6 | 7 | //変換テーブル 8 | extern const ROMAN_KANA_CONV roman_kana_conv_default[ROMAN_KANA_TBL_DEF_NUM]; 9 | extern const ASCII_JLATIN_CONV ascii_jlatin_conv_default[ASCII_JLATIN_TBL_NUM]; 10 | -------------------------------------------------------------------------------- /imcrvcnf/cpp.hint: -------------------------------------------------------------------------------- 1 | // common.h 2 | #define FORWARD_ITERATION_I(iterator, container) for (auto (iterator) = (container).begin(); (iterator) != (container).end(); ++(iterator)) 3 | #define FORWARD_ITERATION(iterator, container) for (auto (iterator) = (container).begin(); (iterator) != (container).end(); ) 4 | #define REVERSE_ITERATION_I(reverse_iterator, container) for (auto (reverse_iterator) = (container).rbegin(); (reverse_iterator) != (container).rend(); ++(reverse_iterator)) 5 | #define REVERSE_ITERATION(reverse_iterator, container) for (auto (reverse_iterator) = (container).rbegin(); (reverse_iterator) != (container).rend(); ) 6 | -------------------------------------------------------------------------------- /imcrvcnf/imcrvcnf.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "common.h" 4 | 5 | // imcrvcnf 6 | void CreateProperty(); 7 | int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam); 8 | // ConfigCnf 9 | void CreateConfigPath(); 10 | void CreateIpcName(); 11 | BOOL SetFileDacl(LPWSTR path); 12 | int GetScaledSize(HWND hwnd, int size); 13 | int GetFontHeight(HWND hwnd, int size); 14 | void DrawSelectColor(HWND hDlg, int id, COLORREF col); 15 | void LoadCheckButton(HWND hDlg, int nIDDlgItem, LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault = L""); 16 | void SaveCheckButton(IXmlWriter *pWriter, HWND hDlg, int nIDDlgItem, LPCWSTR lpKeyName); 17 | BOOL SaveConfigXml(HWND hDlg); 18 | void ReplaceWellFormed(LPWSTR str, SIZE_T size); 19 | // DlgDicMake 20 | void MakeSKKDic(HWND hDlg); 21 | // DlgDicAddUrl 22 | INT_PTR CALLBACK DlgProcSKKDicAddUrl(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 23 | // DlgProcDictionary1 24 | INT_PTR CALLBACK DlgProcDictionary1(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 25 | void SaveDictionary1(IXmlWriter *pWriter, HWND hDlg); 26 | void SaveDictionary1Server(IXmlWriter *pWriter, HWND hDlg); 27 | // DlgProcDictionary2 28 | INT_PTR CALLBACK DlgProcDictionary2(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 29 | void SaveDictionary2(IXmlWriter *pWriter, HWND hDlg); 30 | // DlgProcBehavior1 31 | INT_PTR CALLBACK DlgProcBehavior1(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 32 | void SaveFont(IXmlWriter *pWriter, HWND hDlg); 33 | void SaveBehavior1(IXmlWriter *pWriter, HWND hDlg); 34 | // DlgProcBehavior2 35 | INT_PTR CALLBACK DlgProcBehavior2(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 36 | void SaveBehavior2(IXmlWriter *pWriter, HWND hDlg); 37 | // DlgProcDisplay1 38 | INT_PTR CALLBACK DlgProcDisplay1(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 39 | void SaveDisplay1(IXmlWriter *pWriter, HWND hDlg); 40 | // DlgProcDisplay2 41 | INT_PTR CALLBACK DlgProcDisplay2(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 42 | void SaveDisplay2(IXmlWriter *pWriter, HWND hDlg); 43 | // DlgProcDisplayAttr 44 | INT_PTR CALLBACK DlgProcDisplayAttr1(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 45 | INT_PTR CALLBACK DlgProcDisplayAttr2(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 46 | void SaveDisplayAttr1(IXmlWriter *pWriter, HWND hDlg); 47 | void SaveDisplayAttr2(IXmlWriter *pWriter, HWND hDlg); 48 | // DlgProcSelKey 49 | INT_PTR CALLBACK DlgProcSelKey(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 50 | void SaveSelKey(IXmlWriter *pWriter, HWND hDlg); 51 | // DlgProcPreservedKey 52 | INT_PTR CALLBACK DlgProcPreservedKey(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 53 | void SavePreservedKeyON(IXmlWriter *pWriter, HWND hDlg); 54 | void SavePreservedKeyOFF(IXmlWriter *pWriter, HWND hDlg); 55 | // DlgProcKeyMap 56 | INT_PTR CALLBACK DlgProcKeyMap1(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 57 | INT_PTR CALLBACK DlgProcKeyMap2(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 58 | void SaveCKeyMap(IXmlWriter *pWriter, HWND hDlg); 59 | void SaveVKeyMap(IXmlWriter *pWriter, HWND hDlg); 60 | // DlgProcConvPoint 61 | INT_PTR CALLBACK DlgProcConvPoint(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 62 | void SaveConvPoint(IXmlWriter *pWriter, HWND hDlg); 63 | // DlgProcKana 64 | INT_PTR CALLBACK DlgProcKana(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 65 | void SaveKana(IXmlWriter *pWriter, HWND hDlg); 66 | // DlgProcJLatin 67 | INT_PTR CALLBACK DlgProcJLatin(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 68 | void SaveJLatin(IXmlWriter *pWriter, HWND hDlg); 69 | 70 | extern LPCWSTR TextServiceDesc; 71 | extern HINSTANCE hInst; 72 | extern WCHAR cnfmutexname[MAX_PATH]; //ミューテックス 73 | extern WCHAR cnfcanceldiceventname[MAX_PATH]; //辞書取込キャンセルイベント 74 | extern WCHAR mgrpipename[MAX_PIPENAME]; //名前付きパイプ 75 | extern WCHAR pathconfigxml[MAX_PATH]; //設定 76 | extern WCHAR pathskkdic[MAX_PATH]; //取込SKK辞書 77 | extern WCHAR urlskkdic[INTERNET_MAX_URL_LENGTH]; //URL 78 | 79 | #define PROPSHEET_IDTOHWND(hDlg, id) PropSheet_IndexToHwnd(hDlg, PropSheet_IdToIndex(hDlg, id)) 80 | 81 | #define REPLACE_WELLFORMED(str) ReplaceWellFormed(str, _countof(str)) 82 | -------------------------------------------------------------------------------- /imcrvcnf/imcrvcnf.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvcnf/imcrvcnf.ico -------------------------------------------------------------------------------- /imcrvcnf/imcrvcnf.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | True 34 | PerMonitorV2 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /imcrvcnf/imcrvcnf.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | Source Files 46 | 47 | 48 | Source Files 49 | 50 | 51 | Source Files 52 | 53 | 54 | Source Files 55 | 56 | 57 | Source Files 58 | 59 | 60 | Source Files 61 | 62 | 63 | Source Files 64 | 65 | 66 | Source Files 67 | 68 | 69 | Source Files 70 | 71 | 72 | Source Files 73 | 74 | 75 | Source Files 76 | 77 | 78 | Source Files 79 | 80 | 81 | Source Files 82 | 83 | 84 | Source Files 85 | 86 | 87 | Source Files 88 | 89 | 90 | 91 | 92 | Resource Files 93 | 94 | 95 | 96 | 97 | Resource Files 98 | 99 | 100 | 101 | 102 | Resource Files 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /imcrvcnf/pch.cpp: -------------------------------------------------------------------------------- 1 |  2 | -------------------------------------------------------------------------------- /imcrvcnf/pch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include 30 | -------------------------------------------------------------------------------- /imcrvmgr/cpp.hint: -------------------------------------------------------------------------------- 1 | // common.h 2 | #define FORWARD_ITERATION_I(iterator, container) for (auto (iterator) = (container).begin(); (iterator) != (container).end(); ++(iterator)) 3 | #define FORWARD_ITERATION(iterator, container) for (auto (iterator) = (container).begin(); (iterator) != (container).end(); ) 4 | #define REVERSE_ITERATION_I(reverse_iterator, container) for (auto (reverse_iterator) = (container).rbegin(); (reverse_iterator) != (container).rend(); ++(reverse_iterator)) 5 | #define REVERSE_ITERATION(reverse_iterator, container) for (auto (reverse_iterator) = (container).rbegin(); (reverse_iterator) != (container).rend(); ) 6 | -------------------------------------------------------------------------------- /imcrvmgr/imcrvmgr.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | True 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /imcrvmgr/imcrvmgr.rc: -------------------------------------------------------------------------------- 1 |  2 | #include 3 | #include "version.h" 4 | 5 | VS_VERSION_INFO VERSIONINFO 6 | FILEVERSION RC_VERSION_D 7 | PRODUCTVERSION RC_VERSION_D 8 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 9 | #ifndef _DEBUG 10 | FILEFLAGS 0x00000000L 11 | #else 12 | FILEFLAGS VS_FF_DEBUG 13 | #endif 14 | FILEOS VOS_NT_WINDOWS32 15 | FILETYPE VFT_APP 16 | FILESUBTYPE VFT2_UNKNOWN 17 | { 18 | BLOCK "StringFileInfo" 19 | { 20 | BLOCK "000004B0" 21 | { 22 | VALUE "CompanyName", RC_AUTHOR 23 | VALUE "FileDescription", RC_PRODUCT " Dictionary Manager" 24 | VALUE "FileVersion", RC_VERSION 25 | VALUE "InternalName", "imcrvmgr" 26 | VALUE "LegalCopyright", "© 2011 " RC_AUTHOR 27 | VALUE "OriginalFilename", "imcrvmgr.exe" 28 | VALUE "ProductName", RC_PRODUCT 29 | VALUE "ProductVersion", RC_VERSION 30 | } 31 | } 32 | BLOCK "VarFileInfo" 33 | { 34 | VALUE "Translation", 0x0000, 1200 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /imcrvmgr/imcrvmgr.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | 26 | 27 | Source Files 28 | 29 | 30 | Source Files 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | Source Files 46 | 47 | 48 | Source Files 49 | 50 | 51 | Source Files 52 | 53 | 54 | 55 | 56 | Resource Files 57 | 58 | 59 | 60 | 61 | Resource Files 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /imcrvmgr/pch.cpp: -------------------------------------------------------------------------------- 1 |  2 | -------------------------------------------------------------------------------- /imcrvmgr/pch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include 27 | -------------------------------------------------------------------------------- /imcrvtip/CandidateList.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CCandidateWindow; 4 | 5 | class CCandidateList : 6 | public ITfContextKeyEventSink, 7 | public ITfTextLayoutSink 8 | { 9 | public: 10 | CCandidateList(CTextService *pTextService); 11 | ~CCandidateList(); 12 | 13 | // IUnknown 14 | STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj); 15 | STDMETHODIMP_(ULONG) AddRef(void); 16 | STDMETHODIMP_(ULONG) Release(void); 17 | 18 | // ITfContextKeyEventSink 19 | STDMETHODIMP OnKeyDown(WPARAM wParam, LPARAM lParam, BOOL *pfEaten); 20 | STDMETHODIMP OnKeyUp(WPARAM wParam, LPARAM lParam, BOOL *pfEaten); 21 | STDMETHODIMP OnTestKeyDown(WPARAM wParam, LPARAM lParam, BOOL *pfEaten); 22 | STDMETHODIMP OnTestKeyUp(WPARAM wParam, LPARAM lParam, BOOL *pfEaten); 23 | 24 | // ITfTextLayoutSink 25 | STDMETHODIMP OnLayoutChange(ITfContext *pContext, TfLayoutCode lcode, ITfContextView *pContextView); 26 | 27 | HRESULT _StartCandidateList(TfClientId tid, ITfDocumentMgr *pDocumentMgr, 28 | ITfContext *pContext, TfEditCookie ec, ITfRange *pRange, int mode); 29 | void _EndCandidateList(); 30 | 31 | BOOL _IsShowCandidateWindow(); 32 | BOOL _IsContextCandidateWindow(ITfContext *pContext); 33 | 34 | void _InvokeKeyHandler(WPARAM key); 35 | void _InvokeSfHandler(BYTE sf); 36 | void _Show(BOOL bShow); 37 | void _Redraw(); 38 | void _SetText(const std::wstring &text, BOOL fixed, int mode); 39 | void _Move(LPRECT lpr, TfEditCookie ec = TF_INVALID_EDIT_COOKIE, ITfContext *pContext = nullptr); 40 | void _UpdateComp(); 41 | 42 | private: 43 | LONG _cRef; 44 | 45 | HRESULT _AdviseContextKeyEventSink(); 46 | HRESULT _UnadviseContextKeyEventSink(); 47 | HRESULT _AdviseTextLayoutSink(); 48 | HRESULT _UnadviseTextLayoutSink(); 49 | 50 | DWORD _dwCookieContextKeyEventSink; 51 | DWORD _dwCookieTextLayoutSink; 52 | 53 | CComPtr _pTextService; 54 | CComPtr _pRangeComposition; 55 | CComPtr _pContextCandidateWindow; 56 | CComPtr _pContextDocument; 57 | CComPtr _pDocumentMgr; 58 | TfEditCookie _ec; 59 | 60 | CComPtr _pCandidateWindow; 61 | }; 62 | -------------------------------------------------------------------------------- /imcrvtip/Compartment.cpp: -------------------------------------------------------------------------------- 1 |  2 | #include "imcrvtip.h" 3 | #include "TextService.h" 4 | 5 | HRESULT CTextService::_SetCompartment(REFGUID rguid, const VARIANT *pvar) 6 | { 7 | HRESULT hr = E_FAIL; 8 | 9 | CComPtr pCompartmentMgr; 10 | if (SUCCEEDED(_pThreadMgr->QueryInterface(IID_PPV_ARGS(&pCompartmentMgr))) && (pCompartmentMgr != nullptr)) 11 | { 12 | CComPtr pCompartment; 13 | if (SUCCEEDED(pCompartmentMgr->GetCompartment(rguid, &pCompartment)) && (pCompartment != nullptr)) 14 | { 15 | hr = pCompartment->SetValue(_ClientId, pvar); 16 | } 17 | } 18 | 19 | return hr; 20 | } 21 | 22 | HRESULT CTextService::_GetCompartment(REFGUID rguid, VARIANT *pvar) 23 | { 24 | HRESULT hr = E_FAIL; 25 | 26 | if (pvar == nullptr) 27 | { 28 | return hr; 29 | } 30 | 31 | CComPtr pCompartmentMgr; 32 | if (SUCCEEDED(_pThreadMgr->QueryInterface(IID_PPV_ARGS(&pCompartmentMgr))) && (pCompartmentMgr != nullptr)) 33 | { 34 | CComPtr pCompartment; 35 | if (SUCCEEDED(pCompartmentMgr->GetCompartment(rguid, &pCompartment)) && (pCompartment != nullptr)) 36 | { 37 | CComVariant var; 38 | if (SUCCEEDED(pCompartment->GetValue(&var))) 39 | { 40 | if (V_VT(&var) == VT_I4) 41 | { 42 | V_VT(pvar) = V_VT(&var); 43 | V_I4(pvar) = V_I4(&var); 44 | 45 | hr = S_OK; 46 | } 47 | } 48 | } 49 | } 50 | 51 | return hr; 52 | } 53 | 54 | BOOL CTextService::_IsKeyboardDisabled() 55 | { 56 | BOOL fDisabled = FALSE; 57 | 58 | CComPtr pDocumentMgr; 59 | if (SUCCEEDED(_pThreadMgr->GetFocus(&pDocumentMgr)) && (pDocumentMgr != nullptr)) 60 | { 61 | CComPtr pContext; 62 | if (SUCCEEDED(pDocumentMgr->GetTop(&pContext)) && (pContext != nullptr)) 63 | { 64 | CComPtr pCompartmentMgr; 65 | if (SUCCEEDED(pContext->QueryInterface(IID_PPV_ARGS(&pCompartmentMgr))) && (pCompartmentMgr != nullptr)) 66 | { 67 | { 68 | CComPtr pCompartment; 69 | if (SUCCEEDED(pCompartmentMgr->GetCompartment(GUID_COMPARTMENT_KEYBOARD_DISABLED, &pCompartment)) && (pCompartment != nullptr)) 70 | { 71 | CComVariant var; 72 | if (SUCCEEDED(pCompartment->GetValue(&var))) 73 | { 74 | if (V_VT(&var) == VT_I4) 75 | { 76 | fDisabled = ((V_I4(&var) == 0) ? FALSE : TRUE); 77 | } 78 | } 79 | } 80 | } 81 | { 82 | CComPtr pCompartment; 83 | if (SUCCEEDED(pCompartmentMgr->GetCompartment(GUID_COMPARTMENT_EMPTYCONTEXT, &pCompartment)) && (pCompartment != nullptr)) 84 | { 85 | CComVariant var; 86 | if (SUCCEEDED(pCompartment->GetValue(&var))) 87 | { 88 | if (V_VT(&var) == VT_I4) 89 | { 90 | fDisabled = ((V_I4(&var) == 0) ? FALSE : TRUE); 91 | } 92 | } 93 | } 94 | } 95 | } 96 | } 97 | else 98 | { 99 | fDisabled = TRUE; 100 | } 101 | } 102 | else 103 | { 104 | fDisabled = TRUE; 105 | } 106 | 107 | return fDisabled; 108 | } 109 | 110 | BOOL CTextService::_IsKeyboardOpen() 111 | { 112 | BOOL fOpen = FALSE; 113 | 114 | CComPtr pCompartmentMgr; 115 | if (SUCCEEDED(_pThreadMgr->QueryInterface(IID_PPV_ARGS(&pCompartmentMgr))) && (pCompartmentMgr != nullptr)) 116 | { 117 | CComPtr pCompartment; 118 | if (SUCCEEDED(pCompartmentMgr->GetCompartment(GUID_COMPARTMENT_KEYBOARD_OPENCLOSE, &pCompartment)) && (pCompartment != nullptr)) 119 | { 120 | CComVariant var; 121 | if (SUCCEEDED(pCompartment->GetValue(&var))) 122 | { 123 | if (V_VT(&var) == VT_I4) 124 | { 125 | fOpen = ((V_I4(&var) == 0) ? FALSE : TRUE); 126 | } 127 | } 128 | } 129 | } 130 | 131 | return fOpen; 132 | } 133 | 134 | HRESULT CTextService::_SetKeyboardOpen(BOOL fOpen) 135 | { 136 | HRESULT hr = E_FAIL; 137 | 138 | CComPtr pCompartmentMgr; 139 | if (SUCCEEDED(_pThreadMgr->QueryInterface(IID_PPV_ARGS(&pCompartmentMgr))) && (pCompartmentMgr != nullptr)) 140 | { 141 | CComPtr pCompartment; 142 | if (SUCCEEDED(pCompartmentMgr->GetCompartment(GUID_COMPARTMENT_KEYBOARD_OPENCLOSE, &pCompartment)) && (pCompartment != nullptr)) 143 | { 144 | CComVariant var; 145 | V_VT(&var) = VT_I4; 146 | V_I4(&var) = fOpen; 147 | hr = pCompartment->SetValue(_ClientId, &var); 148 | } 149 | } 150 | 151 | return hr; 152 | } 153 | -------------------------------------------------------------------------------- /imcrvtip/CompartmentEventSink.cpp: -------------------------------------------------------------------------------- 1 |  2 | #include "imcrvtip.h" 3 | #include "TextService.h" 4 | 5 | STDAPI CTextService::OnChange(REFGUID rguid) 6 | { 7 | if (IsEqualGUID(rguid, GUID_COMPARTMENT_KEYBOARD_OPENCLOSE)) 8 | { 9 | _KeyboardOpenCloseChanged(); 10 | } 11 | else if (IsEqualGUID(rguid, GUID_COMPARTMENT_KEYBOARD_INPUTMODE_CONVERSION)) 12 | { 13 | _KeyboardInputConversionChanged(); 14 | } 15 | 16 | return S_OK; 17 | } 18 | 19 | BOOL CTextService::_InitCompartmentEventSink() 20 | { 21 | CComPtr pCompartmentMgr; 22 | if (SUCCEEDED(_pThreadMgr->QueryInterface(IID_PPV_ARGS(&pCompartmentMgr))) && (pCompartmentMgr != nullptr)) 23 | { 24 | { 25 | CComPtr pCompartment; 26 | if (SUCCEEDED(pCompartmentMgr->GetCompartment(GUID_COMPARTMENT_KEYBOARD_OPENCLOSE, &pCompartment)) && (pCompartment != nullptr)) 27 | { 28 | CComPtr pSource; 29 | if (SUCCEEDED(pCompartment->QueryInterface(IID_PPV_ARGS(&pSource))) && (pSource != nullptr)) 30 | { 31 | if (FAILED(pSource->AdviseSink(IID_IUNK_ARGS(static_cast(this)), &_dwCompartmentEventSinkOpenCloseCookie))) 32 | { 33 | _dwCompartmentEventSinkOpenCloseCookie = TF_INVALID_COOKIE; 34 | } 35 | } 36 | } 37 | } 38 | { 39 | CComPtr pCompartment; 40 | if (SUCCEEDED(pCompartmentMgr->GetCompartment(GUID_COMPARTMENT_KEYBOARD_INPUTMODE_CONVERSION, &pCompartment)) && (pCompartment != nullptr)) 41 | { 42 | CComPtr pSource; 43 | if (SUCCEEDED(pCompartment->QueryInterface(IID_PPV_ARGS(&pSource))) && (pSource != nullptr)) 44 | { 45 | if (FAILED(pSource->AdviseSink(IID_IUNK_ARGS(static_cast(this)), &_dwCompartmentEventSinkInputmodeConversionCookie))) 46 | { 47 | _dwCompartmentEventSinkInputmodeConversionCookie = TF_INVALID_COOKIE; 48 | } 49 | } 50 | } 51 | } 52 | } 53 | 54 | return (_dwCompartmentEventSinkOpenCloseCookie != TF_INVALID_COOKIE && _dwCompartmentEventSinkInputmodeConversionCookie != TF_INVALID_COOKIE); 55 | } 56 | 57 | void CTextService::_UninitCompartmentEventSink() 58 | { 59 | CComPtr pCompartmentMgr; 60 | if (SUCCEEDED(_pThreadMgr->QueryInterface(IID_PPV_ARGS(&pCompartmentMgr))) && (pCompartmentMgr != nullptr)) 61 | { 62 | { 63 | CComPtr pCompartment; 64 | if (SUCCEEDED(pCompartmentMgr->GetCompartment(GUID_COMPARTMENT_KEYBOARD_OPENCLOSE, &pCompartment)) && (pCompartment != nullptr)) 65 | { 66 | CComPtr pSource; 67 | if (SUCCEEDED(pCompartment->QueryInterface(IID_PPV_ARGS(&pSource))) && (pSource != nullptr)) 68 | { 69 | pSource->UnadviseSink(_dwCompartmentEventSinkOpenCloseCookie); 70 | } 71 | } 72 | } 73 | { 74 | CComPtr pCompartment; 75 | if (SUCCEEDED(pCompartmentMgr->GetCompartment(GUID_COMPARTMENT_KEYBOARD_INPUTMODE_CONVERSION, &pCompartment)) && (pCompartment != nullptr)) 76 | { 77 | CComPtr pSource; 78 | if (SUCCEEDED(pCompartment->QueryInterface(IID_PPV_ARGS(&pSource))) && (pSource != nullptr)) 79 | { 80 | pSource->UnadviseSink(_dwCompartmentEventSinkInputmodeConversionCookie); 81 | } 82 | } 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /imcrvtip/DisplayAttributeInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CDisplayAttributeInfo : public ITfDisplayAttributeInfo 4 | { 5 | public: 6 | CDisplayAttributeInfo(const GUID &guid, const TF_DISPLAYATTRIBUTE *pDisplayAttribute) 7 | { 8 | DllAddRef(); 9 | 10 | _cRef = 1; 11 | 12 | _pguid = &guid; 13 | _pDisplayAttribute = pDisplayAttribute; 14 | } 15 | 16 | ~CDisplayAttributeInfo() 17 | { 18 | DllRelease(); 19 | } 20 | 21 | // IUnknown 22 | STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj) 23 | { 24 | if(ppvObj == nullptr) 25 | { 26 | return E_INVALIDARG; 27 | } 28 | 29 | *ppvObj = nullptr; 30 | 31 | if(IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfDisplayAttributeInfo)) 32 | { 33 | *ppvObj = static_cast(this); 34 | } 35 | 36 | if(*ppvObj) 37 | { 38 | AddRef(); 39 | return S_OK; 40 | } 41 | 42 | return E_NOINTERFACE; 43 | } 44 | 45 | STDMETHODIMP_(ULONG) AddRef(void) 46 | { 47 | return ++_cRef; 48 | } 49 | 50 | STDMETHODIMP_(ULONG) Release(void) 51 | { 52 | if(--_cRef == 0) 53 | { 54 | delete this; 55 | return 0; 56 | } 57 | 58 | return _cRef; 59 | } 60 | 61 | // ITfDisplayAttributeInfo 62 | STDMETHODIMP GetGUID(GUID *pguid) 63 | { 64 | if(pguid == nullptr) 65 | { 66 | return E_INVALIDARG; 67 | } 68 | 69 | if(_pguid == nullptr) 70 | { 71 | return E_FAIL; 72 | } 73 | 74 | *pguid = *_pguid; 75 | 76 | return S_OK; 77 | } 78 | 79 | STDMETHODIMP GetDescription(BSTR *pbstrDesc) 80 | { 81 | BSTR bstrDesc = nullptr; 82 | 83 | if(pbstrDesc == nullptr) 84 | { 85 | return E_INVALIDARG; 86 | } 87 | 88 | *pbstrDesc = nullptr; 89 | 90 | bstrDesc = SysAllocString(TextServiceDesc); 91 | 92 | if(bstrDesc == nullptr) 93 | { 94 | return E_OUTOFMEMORY; 95 | } 96 | 97 | *pbstrDesc = bstrDesc; 98 | 99 | return S_OK; 100 | } 101 | 102 | STDMETHODIMP GetAttributeInfo(TF_DISPLAYATTRIBUTE *pda) 103 | { 104 | if(pda == nullptr) 105 | { 106 | return E_INVALIDARG; 107 | } 108 | 109 | *pda = *_pDisplayAttribute; 110 | 111 | return S_OK; 112 | } 113 | 114 | STDMETHODIMP SetAttributeInfo(const TF_DISPLAYATTRIBUTE *pda) 115 | { 116 | return S_OK; 117 | } 118 | 119 | STDMETHODIMP Reset() 120 | { 121 | return SetAttributeInfo(_pDisplayAttribute); 122 | } 123 | 124 | protected: 125 | const GUID *_pguid; 126 | const TF_DISPLAYATTRIBUTE *_pDisplayAttribute; 127 | 128 | private: 129 | LONG _cRef; 130 | }; 131 | -------------------------------------------------------------------------------- /imcrvtip/DllMain.cpp: -------------------------------------------------------------------------------- 1 |  2 | #include "imcrvtip.h" 3 | #include "CandidateWindow.h" 4 | #include "InputModeWindow.h" 5 | 6 | BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) 7 | { 8 | switch (fdwReason) 9 | { 10 | case DLL_PROCESS_ATTACH: 11 | g_hInst = hinstDLL; 12 | 13 | CCandidateWindow::_UninitClass(); 14 | if (!CCandidateWindow::_InitClass()) 15 | { 16 | return FALSE; 17 | } 18 | 19 | CInputModeWindow::_UninitClass(); 20 | if (!CInputModeWindow::_InitClass()) 21 | { 22 | return FALSE; 23 | } 24 | break; 25 | 26 | case DLL_THREAD_ATTACH: 27 | break; 28 | 29 | case DLL_THREAD_DETACH: 30 | break; 31 | 32 | case DLL_PROCESS_DETACH: 33 | CCandidateWindow::_UninitClass(); 34 | CInputModeWindow::_UninitClass(); 35 | break; 36 | 37 | default: 38 | break; 39 | } 40 | 41 | return TRUE; 42 | } 43 | -------------------------------------------------------------------------------- /imcrvtip/EditSession.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "imcrvtip.h" 4 | #include "TextService.h" 5 | 6 | class CEditSessionBase : public ITfEditSession 7 | { 8 | public: 9 | CEditSessionBase(CTextService *pTextService, ITfContext *pContext) 10 | { 11 | _cRef = 1; 12 | 13 | _pContext = pContext; 14 | _pTextService = pTextService; 15 | } 16 | 17 | virtual ~CEditSessionBase() 18 | { 19 | _pContext.Release(); 20 | _pTextService.Release(); 21 | } 22 | 23 | // IUnknown 24 | STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj) 25 | { 26 | if(ppvObj == nullptr) 27 | { 28 | return E_INVALIDARG; 29 | } 30 | 31 | *ppvObj = nullptr; 32 | 33 | if(IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfEditSession)) 34 | { 35 | *ppvObj = static_cast(this); 36 | } 37 | 38 | if(*ppvObj) 39 | { 40 | AddRef(); 41 | return S_OK; 42 | } 43 | 44 | return E_NOINTERFACE; 45 | } 46 | 47 | STDMETHODIMP_(ULONG) AddRef(void) 48 | { 49 | return ++_cRef; 50 | } 51 | 52 | STDMETHODIMP_(ULONG) Release(void) 53 | { 54 | if(--_cRef == 0) 55 | { 56 | delete this; 57 | return 0; 58 | } 59 | 60 | return _cRef; 61 | } 62 | 63 | // ITfEditSession 64 | virtual STDMETHODIMP DoEditSession(TfEditCookie ec) = 0; 65 | 66 | protected: 67 | CComPtr _pContext; 68 | CComPtr _pTextService; 69 | 70 | private: 71 | LONG _cRef; 72 | }; 73 | -------------------------------------------------------------------------------- /imcrvtip/EnumDisplayAttributeInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CEnumDisplayAttributeInfo : public IEnumTfDisplayAttributeInfo 4 | { 5 | public: 6 | CEnumDisplayAttributeInfo() 7 | { 8 | DllAddRef(); 9 | 10 | _cRef = 1; 11 | _nIndex = 0; 12 | } 13 | 14 | ~CEnumDisplayAttributeInfo() 15 | { 16 | DllRelease(); 17 | } 18 | 19 | // IUnknown 20 | STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj) 21 | { 22 | if(ppvObj == nullptr) 23 | { 24 | return E_INVALIDARG; 25 | } 26 | 27 | *ppvObj = nullptr; 28 | 29 | if(IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IEnumTfDisplayAttributeInfo)) 30 | { 31 | *ppvObj = static_cast(this); 32 | } 33 | 34 | if(*ppvObj) 35 | { 36 | AddRef(); 37 | return S_OK; 38 | } 39 | 40 | return E_NOINTERFACE; 41 | } 42 | 43 | STDMETHODIMP_(ULONG) AddRef(void) 44 | { 45 | return ++_cRef; 46 | } 47 | 48 | STDMETHODIMP_(ULONG) Release(void) 49 | { 50 | if(--_cRef == 0) 51 | { 52 | delete this; 53 | return 0; 54 | } 55 | 56 | return _cRef; 57 | } 58 | 59 | // IEnumTfDisplayAttributeInfo 60 | STDMETHODIMP Clone(IEnumTfDisplayAttributeInfo **ppEnum) 61 | { 62 | CEnumDisplayAttributeInfo *pClone = nullptr; 63 | 64 | if(ppEnum == nullptr) 65 | { 66 | return E_INVALIDARG; 67 | } 68 | 69 | *ppEnum = nullptr; 70 | 71 | try 72 | { 73 | pClone = new CEnumDisplayAttributeInfo(); 74 | } 75 | catch(...) 76 | { 77 | return E_OUTOFMEMORY; 78 | } 79 | 80 | pClone->_nIndex = _nIndex; 81 | 82 | *ppEnum = pClone; 83 | 84 | return S_OK; 85 | } 86 | 87 | STDMETHODIMP Next(ULONG ulCount, ITfDisplayAttributeInfo **rgInfo, ULONG *pcFetched) 88 | { 89 | ULONG cFetched = 0; 90 | ITfDisplayAttributeInfo *pDisplayAttributeInfo = nullptr; 91 | 92 | if(rgInfo == nullptr) 93 | { 94 | return E_INVALIDARG; 95 | } 96 | 97 | if(ulCount == 0) 98 | { 99 | return S_OK; 100 | } 101 | 102 | for (ULONG i = 0; i < ulCount; i++) 103 | { 104 | *(rgInfo + i) = nullptr; 105 | } 106 | 107 | if (pcFetched != nullptr) 108 | { 109 | *pcFetched = 0; 110 | } 111 | 112 | while(cFetched < ulCount) 113 | { 114 | if(_nIndex >= DISPLAYATTRIBUTE_INFO_NUM) 115 | { 116 | break; 117 | } 118 | 119 | try 120 | { 121 | pDisplayAttributeInfo = new CDisplayAttributeInfo( 122 | c_gdDisplayAttributeInfo[_nIndex].guid, &CTextService::display_attribute_info[_nIndex]); 123 | } 124 | catch(...) 125 | { 126 | for(ULONG i = 0; i < cFetched; i++) 127 | { 128 | ITfDisplayAttributeInfo *pdai = *(rgInfo + i); 129 | if (pdai != nullptr) 130 | { 131 | pdai->Release(); 132 | *(rgInfo + i) = nullptr; 133 | } 134 | } 135 | return E_OUTOFMEMORY; 136 | } 137 | 138 | *(rgInfo + cFetched) = pDisplayAttributeInfo; 139 | cFetched++; 140 | _nIndex++; 141 | } 142 | 143 | if(pcFetched != nullptr) 144 | { 145 | *pcFetched = cFetched; 146 | } 147 | 148 | return (cFetched == ulCount) ? S_OK : S_FALSE; 149 | } 150 | 151 | STDMETHODIMP Reset() 152 | { 153 | _nIndex = 0; 154 | return S_OK; 155 | } 156 | 157 | STDMETHODIMP Skip(ULONG ulCount) 158 | { 159 | if((_nIndex + ulCount) >= DISPLAYATTRIBUTE_INFO_NUM) 160 | { 161 | _nIndex = DISPLAYATTRIBUTE_INFO_NUM; 162 | return S_FALSE; 163 | } 164 | 165 | _nIndex += ulCount; 166 | return S_OK; 167 | } 168 | 169 | private: 170 | LONG _cRef; 171 | ULONG _nIndex; 172 | }; 173 | -------------------------------------------------------------------------------- /imcrvtip/FnCandidateList.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "TextService.h" 4 | #include "FnCandidateString.h" 5 | #include "FnEnumCandidates.h" 6 | 7 | class CFnCandidateList : public ITfCandidateList 8 | { 9 | public: 10 | CFnCandidateList(CTextService *pTextService, const std::wstring &searchkey, const CANDIDATES &candidates) 11 | { 12 | DllAddRef(); 13 | 14 | _cRef = 1; 15 | 16 | _pTextService = pTextService; 17 | 18 | _searchkey = searchkey; 19 | _candidates = candidates; 20 | } 21 | 22 | ~CFnCandidateList() 23 | { 24 | _pTextService.Release(); 25 | 26 | DllRelease(); 27 | } 28 | 29 | // IUnknown 30 | STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj) 31 | { 32 | if(ppvObj == nullptr) 33 | { 34 | return E_INVALIDARG; 35 | } 36 | 37 | *ppvObj = nullptr; 38 | 39 | if(IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfCandidateList)) 40 | { 41 | *ppvObj = static_cast(this); 42 | } 43 | 44 | if(*ppvObj) 45 | { 46 | AddRef(); 47 | return S_OK; 48 | } 49 | 50 | return E_NOINTERFACE; 51 | } 52 | 53 | STDMETHODIMP_(ULONG) AddRef(void) 54 | { 55 | return ++_cRef; 56 | } 57 | 58 | STDMETHODIMP_(ULONG) Release(void) 59 | { 60 | if(--_cRef == 0) 61 | { 62 | delete this; 63 | return 0; 64 | } 65 | 66 | return _cRef; 67 | } 68 | 69 | // ITfCandidateList 70 | STDMETHODIMP EnumCandidates(IEnumTfCandidates **ppEnum) 71 | { 72 | IEnumTfCandidates *pEnumCandidates = nullptr; 73 | 74 | if(ppEnum == nullptr) 75 | { 76 | return E_INVALIDARG; 77 | } 78 | 79 | *ppEnum = nullptr; 80 | 81 | try 82 | { 83 | pEnumCandidates = new CFnEnumCandidates(_candidates); 84 | } 85 | catch(...) 86 | { 87 | return E_OUTOFMEMORY; 88 | } 89 | 90 | *ppEnum = pEnumCandidates; 91 | 92 | return S_OK; 93 | } 94 | 95 | STDMETHODIMP GetCandidate(ULONG nIndex, ITfCandidateString **ppCand) 96 | { 97 | ITfCandidateString *pCandidateString = nullptr; 98 | 99 | if(ppCand == nullptr) 100 | { 101 | return E_INVALIDARG; 102 | } 103 | 104 | *ppCand = nullptr; 105 | 106 | if(nIndex >= (ULONG)_candidates.size()) 107 | { 108 | return E_FAIL; 109 | } 110 | 111 | try 112 | { 113 | pCandidateString = new CFnCandidateString(nIndex, _candidates[nIndex].first.first); 114 | } 115 | catch(...) 116 | { 117 | return E_OUTOFMEMORY; 118 | } 119 | 120 | *ppCand = pCandidateString; 121 | 122 | return S_OK; 123 | } 124 | 125 | STDMETHODIMP GetCandidateNum(ULONG *pnCnt) 126 | { 127 | if(pnCnt == nullptr) 128 | { 129 | return E_INVALIDARG; 130 | } 131 | 132 | *pnCnt = (ULONG)_candidates.size(); 133 | 134 | return S_OK; 135 | } 136 | 137 | STDMETHODIMP SetResult(ULONG nIndex, TfCandidateResult imcr) 138 | { 139 | HRESULT hr = S_OK; 140 | if(imcr == CAND_FINALIZED) 141 | { 142 | hr = _pTextService->_SetResult(_searchkey, _candidates, nIndex); 143 | } 144 | 145 | return hr; 146 | } 147 | 148 | private: 149 | LONG _cRef; 150 | CComPtr _pTextService; 151 | std::wstring _searchkey; 152 | CANDIDATES _candidates; 153 | }; 154 | -------------------------------------------------------------------------------- /imcrvtip/FnCandidateString.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CFnCandidateString : public ITfCandidateString 4 | { 5 | public: 6 | CFnCandidateString(ULONG index, const std::wstring &candidate) 7 | { 8 | DllAddRef(); 9 | 10 | _cRef = 1; 11 | _nIndex = index; 12 | _candidate = candidate; 13 | } 14 | 15 | ~CFnCandidateString() 16 | { 17 | DllRelease(); 18 | } 19 | 20 | // IUnknown 21 | STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj) 22 | { 23 | if(ppvObj == nullptr) 24 | { 25 | return E_INVALIDARG; 26 | } 27 | 28 | *ppvObj = nullptr; 29 | 30 | if(IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfCandidateString)) 31 | { 32 | *ppvObj = static_cast(this); 33 | } 34 | 35 | if(*ppvObj) 36 | { 37 | AddRef(); 38 | return S_OK; 39 | } 40 | 41 | return E_NOINTERFACE; 42 | } 43 | 44 | STDMETHODIMP_(ULONG) AddRef(void) 45 | { 46 | return ++_cRef; 47 | } 48 | 49 | STDMETHODIMP_(ULONG) Release(void) 50 | { 51 | if(--_cRef == 0) 52 | { 53 | delete this; 54 | return 0; 55 | } 56 | 57 | return _cRef; 58 | } 59 | 60 | // ITfCandidateString 61 | STDMETHODIMP GetString(BSTR *pbstr) 62 | { 63 | BSTR bstr = nullptr; 64 | 65 | if(pbstr == nullptr) 66 | { 67 | return E_INVALIDARG; 68 | } 69 | 70 | *pbstr = nullptr; 71 | 72 | bstr = SysAllocString(_candidate.c_str()); 73 | 74 | if(bstr == nullptr) 75 | { 76 | return E_OUTOFMEMORY; 77 | } 78 | 79 | *pbstr = bstr; 80 | 81 | return S_OK; 82 | } 83 | 84 | STDMETHODIMP GetIndex(ULONG *pnIndex) 85 | { 86 | if(pnIndex == nullptr) 87 | { 88 | return E_INVALIDARG; 89 | } 90 | 91 | *pnIndex = _nIndex; 92 | 93 | return S_OK; 94 | } 95 | 96 | private: 97 | LONG _cRef; 98 | ULONG _nIndex; 99 | std::wstring _candidate; 100 | }; 101 | -------------------------------------------------------------------------------- /imcrvtip/FnEnumCandidates.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "FnCandidateString.h" 4 | 5 | class CFnEnumCandidates : public IEnumTfCandidates 6 | { 7 | public: 8 | CFnEnumCandidates(const CANDIDATES &candidates) 9 | { 10 | DllAddRef(); 11 | 12 | _cRef = 1; 13 | _nIndex = 0; 14 | _candidates = candidates; 15 | } 16 | 17 | ~CFnEnumCandidates() 18 | { 19 | DllRelease(); 20 | } 21 | 22 | // IUnknown 23 | STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj) 24 | { 25 | if(ppvObj == nullptr) 26 | { 27 | return E_INVALIDARG; 28 | } 29 | 30 | *ppvObj = nullptr; 31 | 32 | if(IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IEnumTfCandidates)) 33 | { 34 | *ppvObj = static_cast(this); 35 | } 36 | 37 | if(*ppvObj) 38 | { 39 | AddRef(); 40 | return S_OK; 41 | } 42 | 43 | return E_NOINTERFACE; 44 | } 45 | 46 | STDMETHODIMP_(ULONG) AddRef(void) 47 | { 48 | return ++_cRef; 49 | } 50 | 51 | STDMETHODIMP_(ULONG) Release(void) 52 | { 53 | if(--_cRef == 0) 54 | { 55 | delete this; 56 | return 0; 57 | } 58 | 59 | return _cRef; 60 | } 61 | 62 | // IEnumTfCandidates 63 | STDMETHODIMP Clone(IEnumTfCandidates **ppEnum) 64 | { 65 | CFnEnumCandidates *pClone = nullptr; 66 | 67 | if(ppEnum == nullptr) 68 | { 69 | return E_INVALIDARG; 70 | } 71 | 72 | *ppEnum = nullptr; 73 | 74 | try 75 | { 76 | pClone = new CFnEnumCandidates(_candidates); 77 | } 78 | catch(...) 79 | { 80 | return E_OUTOFMEMORY; 81 | } 82 | 83 | pClone->_nIndex = _nIndex; 84 | 85 | *ppEnum = pClone; 86 | 87 | return S_OK; 88 | } 89 | 90 | STDMETHODIMP Next(ULONG ulCount, ITfCandidateString **ppCand, ULONG *pcFetched) 91 | { 92 | ULONG cFetched = 0; 93 | ITfCandidateString *pCandidateString = nullptr; 94 | 95 | if(ppCand == nullptr) 96 | { 97 | return E_INVALIDARG; 98 | } 99 | 100 | if(ulCount == 0) 101 | { 102 | return S_OK; 103 | } 104 | 105 | for (ULONG i = 0; i < ulCount; i++) 106 | { 107 | *(ppCand + i) = nullptr; 108 | } 109 | 110 | if (pcFetched != nullptr) 111 | { 112 | *pcFetched = 0; 113 | } 114 | 115 | while(cFetched < ulCount) 116 | { 117 | if(_nIndex >= (ULONG)_candidates.size()) 118 | { 119 | break; 120 | } 121 | 122 | try 123 | { 124 | pCandidateString = new CFnCandidateString(_nIndex, _candidates[_nIndex].first.first); 125 | } 126 | catch(...) 127 | { 128 | for(ULONG i = 0; i < cFetched; i++) 129 | { 130 | ITfCandidateString *pcs = *(ppCand + i); 131 | if (pcs != nullptr) 132 | { 133 | pcs->Release(); 134 | *(ppCand + i) = nullptr; 135 | } 136 | } 137 | return E_OUTOFMEMORY; 138 | } 139 | 140 | *(ppCand + cFetched) = pCandidateString; 141 | cFetched++; 142 | _nIndex++; 143 | } 144 | 145 | if(pcFetched != nullptr) 146 | { 147 | *pcFetched = cFetched; 148 | } 149 | 150 | return (cFetched == ulCount) ? S_OK : S_FALSE; 151 | } 152 | 153 | STDMETHODIMP Reset(void) 154 | { 155 | _nIndex = 0; 156 | return S_OK; 157 | } 158 | 159 | STDMETHODIMP Skip(ULONG ulCount) 160 | { 161 | if((_nIndex + ulCount) >= (ULONG)_candidates.size()) 162 | { 163 | _nIndex = (ULONG)_candidates.size(); 164 | return S_FALSE; 165 | } 166 | 167 | _nIndex += ulCount; 168 | return S_OK; 169 | } 170 | 171 | private: 172 | LONG _cRef; 173 | ULONG _nIndex; 174 | CANDIDATES _candidates; 175 | }; 176 | -------------------------------------------------------------------------------- /imcrvtip/Icon/imcrvskk.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvtip/Icon/imcrvskk.ico -------------------------------------------------------------------------------- /imcrvtip/Icon/imdebug.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvtip/Icon/imdebug.ico -------------------------------------------------------------------------------- /imcrvtip/Icon/pxAscii.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvtip/Icon/pxAscii.ico -------------------------------------------------------------------------------- /imcrvtip/Icon/pxHiragana.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvtip/Icon/pxHiragana.ico -------------------------------------------------------------------------------- /imcrvtip/Icon/pxJLatin.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvtip/Icon/pxJLatin.ico -------------------------------------------------------------------------------- /imcrvtip/Icon/pxKatakana.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvtip/Icon/pxKatakana.ico -------------------------------------------------------------------------------- /imcrvtip/Icon/pxKatakana1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvtip/Icon/pxKatakana1.ico -------------------------------------------------------------------------------- /imcrvtip/Icon/pzAscii.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvtip/Icon/pzAscii.ico -------------------------------------------------------------------------------- /imcrvtip/Icon/pzHiragana.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvtip/Icon/pzHiragana.ico -------------------------------------------------------------------------------- /imcrvtip/Icon/pzJLatin.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvtip/Icon/pzJLatin.ico -------------------------------------------------------------------------------- /imcrvtip/Icon/pzKatakana.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvtip/Icon/pzKatakana.ico -------------------------------------------------------------------------------- /imcrvtip/Icon/pzKatakana1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvtip/Icon/pzKatakana1.ico -------------------------------------------------------------------------------- /imcrvtip/Icon/xAscii.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvtip/Icon/xAscii.ico -------------------------------------------------------------------------------- /imcrvtip/Icon/xDefault.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvtip/Icon/xDefault.ico -------------------------------------------------------------------------------- /imcrvtip/Icon/xHiragana.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvtip/Icon/xHiragana.ico -------------------------------------------------------------------------------- /imcrvtip/Icon/xJLatin.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvtip/Icon/xJLatin.ico -------------------------------------------------------------------------------- /imcrvtip/Icon/xKatakana.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvtip/Icon/xKatakana.ico -------------------------------------------------------------------------------- /imcrvtip/Icon/xKatakana1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvtip/Icon/xKatakana1.ico -------------------------------------------------------------------------------- /imcrvtip/Icon/zAscii.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvtip/Icon/zAscii.ico -------------------------------------------------------------------------------- /imcrvtip/Icon/zDefault.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvtip/Icon/zDefault.ico -------------------------------------------------------------------------------- /imcrvtip/Icon/zHiragana.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvtip/Icon/zHiragana.ico -------------------------------------------------------------------------------- /imcrvtip/Icon/zJLatin.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvtip/Icon/zJLatin.ico -------------------------------------------------------------------------------- /imcrvtip/Icon/zKatakana.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvtip/Icon/zKatakana.ico -------------------------------------------------------------------------------- /imcrvtip/Icon/zKatakana1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/imcrvtip/Icon/zKatakana1.ico -------------------------------------------------------------------------------- /imcrvtip/InputModeWindow.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "TextService.h" 4 | #include "EditSession.h" 5 | 6 | class CInputModeWindow : public ITfTextLayoutSink 7 | { 8 | public: 9 | CInputModeWindow(); 10 | ~CInputModeWindow(); 11 | 12 | // IUnknown 13 | STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj); 14 | STDMETHODIMP_(ULONG) AddRef(void); 15 | STDMETHODIMP_(ULONG) Release(void); 16 | 17 | // ITfTextLayoutSink 18 | STDMETHODIMP OnLayoutChange(ITfContext *pContext, TfLayoutCode lcode, ITfContextView *pContextView); 19 | 20 | BOOL _Create(CTextService *pTextService, ITfContext *pContext, BOOL bCandidateWindow, HWND hWnd); 21 | void _Destroy(); 22 | static BOOL _InitClass(); 23 | static void _UninitClass(); 24 | static LRESULT CALLBACK _WindowPreProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 25 | LRESULT CALLBACK _WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 26 | 27 | void _Move(int x, int y); 28 | void _Show(BOOL bShow); 29 | void _Redraw(); 30 | void _GetRect(LPRECT lpRect); 31 | 32 | private: 33 | LONG _cRef; 34 | 35 | HRESULT _AdviseTextLayoutSink(); 36 | HRESULT _UnadviseTextLayoutSink(); 37 | 38 | CComPtr _pContext; 39 | 40 | DWORD _dwCookieTextLayoutSink; 41 | 42 | CComPtr _pTextService; 43 | HWND _hwndParent; 44 | HWND _hwnd; 45 | BOOL _bCandidateWindow; 46 | 47 | int _size; 48 | int _dpi; 49 | }; 50 | -------------------------------------------------------------------------------- /imcrvtip/LanguageBar.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CLangBarItemButton : 4 | public ITfLangBarItemButton, 5 | public ITfSource 6 | { 7 | public: 8 | CLangBarItemButton(CTextService *pTextService, REFGUID guid); 9 | ~CLangBarItemButton(); 10 | 11 | // IUnknown 12 | STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj); 13 | STDMETHODIMP_(ULONG) AddRef(void); 14 | STDMETHODIMP_(ULONG) Release(void); 15 | 16 | // ITfLangBarItem 17 | STDMETHODIMP GetInfo(TF_LANGBARITEMINFO *pInfo); 18 | STDMETHODIMP GetStatus(DWORD *pdwStatus); 19 | STDMETHODIMP Show(BOOL fShow); 20 | STDMETHODIMP GetTooltipString(BSTR *pbstrToolTip); 21 | 22 | // ITfLangBarItemButton 23 | STDMETHODIMP OnClick(TfLBIClick click, POINT pt, const RECT *prcArea); 24 | STDMETHODIMP InitMenu(ITfMenu *pMenu); 25 | STDMETHODIMP OnMenuSelect(UINT wID); 26 | STDMETHODIMP GetIcon(HICON *phIcon); 27 | STDMETHODIMP GetText(BSTR *pbstrText); 28 | 29 | // ITfSource 30 | STDMETHODIMP AdviseSink(REFIID riid, IUnknown *punk, DWORD *pdwCookie); 31 | STDMETHODIMP UnadviseSink(DWORD dwCookie); 32 | 33 | HRESULT _Update(); 34 | HRESULT _GetIcon(HICON *phIcon, INT size, BOOL bNT62); 35 | HRESULT _AddMenuItem(ITfMenu *pMenu, UINT uId, DWORD dwFlags, LPCWSTR pch, ULONG cch); 36 | 37 | private: 38 | LONG _cRef; 39 | 40 | CComPtr _pTextService; 41 | 42 | CComPtr _pLangBarItemSink; 43 | TF_LANGBARITEMINFO _LangBarItemInfo; 44 | }; 45 | -------------------------------------------------------------------------------- /imcrvtip/Server.cpp: -------------------------------------------------------------------------------- 1 |  2 | #include "imcrvtip.h" 3 | #include "TextService.h" 4 | 5 | // Register 6 | BOOL RegisterProfiles(); 7 | void UnregisterProfiles(); 8 | BOOL RegisterCategories(); 9 | void UnregisterCategories(); 10 | BOOL RegisterServer(); 11 | void UnregisterServer(); 12 | BOOL EnableTextService(); 13 | void DisableTextService(); 14 | 15 | static LONG g_cRefDll = 0; 16 | 17 | class CClassFactory : public IClassFactory 18 | { 19 | public: 20 | // IUnknown 21 | STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj); 22 | STDMETHODIMP_(ULONG) AddRef(void); 23 | STDMETHODIMP_(ULONG) Release(void); 24 | 25 | // IClassFactory 26 | STDMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppvObj); 27 | STDMETHODIMP LockServer(BOOL fLock); 28 | }; 29 | 30 | STDAPI CClassFactory::QueryInterface(REFIID riid, void **ppvObj) 31 | { 32 | if (ppvObj == nullptr) 33 | { 34 | return E_INVALIDARG; 35 | } 36 | 37 | *ppvObj = nullptr; 38 | 39 | if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IClassFactory)) 40 | { 41 | *ppvObj = this; 42 | DllAddRef(); 43 | } 44 | else 45 | { 46 | return E_NOINTERFACE; 47 | } 48 | 49 | return S_OK; 50 | } 51 | 52 | STDAPI_(ULONG) CClassFactory::AddRef() 53 | { 54 | return DllAddRef(); 55 | } 56 | 57 | STDAPI_(ULONG) CClassFactory::Release() 58 | { 59 | return DllRelease(); 60 | } 61 | 62 | STDAPI CClassFactory::CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppvObj) 63 | { 64 | HRESULT hr; 65 | CComPtr pTextService; 66 | 67 | if (ppvObj == nullptr) 68 | { 69 | return E_INVALIDARG; 70 | } 71 | 72 | *ppvObj = nullptr; 73 | 74 | if (nullptr != pUnkOuter) 75 | { 76 | return CLASS_E_NOAGGREGATION; 77 | } 78 | 79 | try 80 | { 81 | pTextService.Attach(new CTextService()); 82 | } 83 | catch (...) 84 | { 85 | return E_OUTOFMEMORY; 86 | } 87 | 88 | hr = pTextService->QueryInterface(riid, ppvObj); 89 | 90 | pTextService.Release(); 91 | 92 | return hr; 93 | } 94 | 95 | STDAPI CClassFactory::LockServer(BOOL fLock) 96 | { 97 | if (fLock) 98 | { 99 | DllAddRef(); 100 | } 101 | else 102 | { 103 | DllRelease(); 104 | } 105 | 106 | return S_OK; 107 | } 108 | 109 | __control_entrypoint(DllExport) 110 | STDAPI DllCanUnloadNow(void) 111 | { 112 | return g_cRefDll <= 0 ? S_OK : S_FALSE; 113 | } 114 | 115 | _Check_return_ 116 | STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ LPVOID FAR *ppvObj) 117 | { 118 | static CClassFactory factory; 119 | 120 | if (ppvObj == nullptr) 121 | { 122 | return E_INVALIDARG; 123 | } 124 | 125 | *ppvObj = nullptr; 126 | 127 | if ((IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IClassFactory)) && 128 | IsEqualGUID(rclsid, c_clsidTextService)) 129 | { 130 | *ppvObj = &factory; 131 | DllAddRef(); 132 | return S_OK; 133 | } 134 | 135 | return CLASS_E_CLASSNOTAVAILABLE; 136 | } 137 | 138 | STDAPI DllRegisterServer(void) 139 | { 140 | if (!RegisterServer() || !RegisterCategories() || !RegisterProfiles()) 141 | { 142 | DllUnregisterServer(); 143 | return E_FAIL; 144 | } 145 | 146 | if (IsWindowsVersion62OrLater()) 147 | { 148 | EnableTextService(); 149 | } 150 | 151 | return S_OK; 152 | } 153 | 154 | STDAPI DllUnregisterServer(void) 155 | { 156 | if (IsWindowsVersion62OrLater()) 157 | { 158 | DisableTextService(); 159 | } 160 | 161 | UnregisterProfiles(); 162 | UnregisterCategories(); 163 | UnregisterServer(); 164 | 165 | return S_OK; 166 | } 167 | 168 | LONG DllAddRef(void) 169 | { 170 | return InterlockedIncrement(&g_cRefDll); 171 | } 172 | 173 | LONG DllRelease(void) 174 | { 175 | return InterlockedDecrement(&g_cRefDll); 176 | } 177 | -------------------------------------------------------------------------------- /imcrvtip/TextEditSink.cpp: -------------------------------------------------------------------------------- 1 |  2 | #include "imcrvtip.h" 3 | #include "TextService.h" 4 | #include "CandidateList.h" 5 | 6 | STDAPI CTextService::OnEndEdit(ITfContext *pic, TfEditCookie ecReadOnly, ITfEditRecord *pEditRecord) 7 | { 8 | if (_IsComposing() && pic != nullptr) 9 | { 10 | CComPtr pRange; 11 | if (SUCCEEDED(_pComposition->GetRange(&pRange)) && (pRange != nullptr)) 12 | { 13 | // clear when auto completion 14 | BOOL fEmpty = FALSE; 15 | if (SUCCEEDED(pRange->IsEmpty(ecReadOnly, &fEmpty)) && fEmpty) 16 | { 17 | if (!roman.empty() || !kana.empty()) 18 | { 19 | _ResetStatus(); 20 | _EndComposition(pic); 21 | } 22 | } 23 | 24 | // reposition candidate window 25 | if (_pCandidateList != nullptr) 26 | { 27 | CComPtr pContextView; 28 | if (SUCCEEDED(pic->GetActiveView(&pContextView)) && (pContextView != nullptr)) 29 | { 30 | RECT rc = {}; 31 | BOOL fClipped; 32 | if (SUCCEEDED(pContextView->GetTextExt(ecReadOnly, pRange, &rc, &fClipped))) 33 | { 34 | _pCandidateList->_Move(&rc, ecReadOnly, pic); 35 | } 36 | } 37 | } 38 | } 39 | } 40 | 41 | return S_OK; 42 | } 43 | 44 | BOOL CTextService::_InitTextEditSink(ITfDocumentMgr *pDocumentMgr) 45 | { 46 | BOOL fRet = FALSE; 47 | 48 | if (_pTextEditSinkContext != nullptr && _dwTextEditSinkCookie != TF_INVALID_COOKIE) 49 | { 50 | CComPtr pSource; 51 | if (SUCCEEDED(_pTextEditSinkContext->QueryInterface(IID_PPV_ARGS(&pSource))) && (pSource != nullptr)) 52 | { 53 | pSource->UnadviseSink(_dwTextEditSinkCookie); 54 | } 55 | 56 | _pTextEditSinkContext.Release(); 57 | _dwTextEditSinkCookie = TF_INVALID_COOKIE; 58 | } 59 | 60 | if (pDocumentMgr == nullptr) 61 | { 62 | return TRUE; 63 | } 64 | 65 | if (FAILED(pDocumentMgr->GetTop(&_pTextEditSinkContext))) 66 | { 67 | return FALSE; 68 | } 69 | 70 | if (_pTextEditSinkContext == nullptr) 71 | { 72 | return TRUE; 73 | } 74 | 75 | { 76 | CComPtr pSource; 77 | if (SUCCEEDED(_pTextEditSinkContext->QueryInterface(IID_PPV_ARGS(&pSource))) && (pSource != nullptr)) 78 | { 79 | if (SUCCEEDED(pSource->AdviseSink(IID_IUNK_ARGS(static_cast(this)), &_dwTextEditSinkCookie))) 80 | { 81 | fRet = TRUE; 82 | } 83 | else 84 | { 85 | _dwTextEditSinkCookie = TF_INVALID_COOKIE; 86 | } 87 | } 88 | } 89 | 90 | if (fRet == FALSE) 91 | { 92 | _pTextEditSinkContext.Release(); 93 | } 94 | 95 | return fRet; 96 | } 97 | -------------------------------------------------------------------------------- /imcrvtip/ThreadFocusSink.cpp: -------------------------------------------------------------------------------- 1 |  2 | #include "imcrvtip.h" 3 | #include "TextService.h" 4 | #include "CandidateList.h" 5 | #include "InputModeWindow.h" 6 | 7 | STDAPI CTextService::OnSetThreadFocus() 8 | { 9 | if (_pCandidateList != nullptr) 10 | { 11 | _pCandidateList->_Show(TRUE); 12 | } 13 | 14 | if (_pInputModeWindow != nullptr) 15 | { 16 | _pInputModeWindow->_Show(TRUE); 17 | } 18 | 19 | return S_OK; 20 | } 21 | 22 | STDAPI CTextService::OnKillThreadFocus() 23 | { 24 | _SaveUserDic(); 25 | 26 | if (_pCandidateList != nullptr) 27 | { 28 | _pCandidateList->_Show(FALSE); 29 | } 30 | 31 | if (_pInputModeWindow != nullptr) 32 | { 33 | _pInputModeWindow->_Show(FALSE); 34 | } 35 | 36 | return S_OK; 37 | } 38 | 39 | BOOL CTextService::_InitThreadFocusSink() 40 | { 41 | BOOL fRet = FALSE; 42 | 43 | CComPtr pSource; 44 | if (SUCCEEDED(_pThreadMgr->QueryInterface(IID_PPV_ARGS(&pSource))) && (pSource != nullptr)) 45 | { 46 | if (SUCCEEDED(pSource->AdviseSink(IID_IUNK_ARGS(static_cast(this)), &_dwThreadFocusSinkCookie))) 47 | { 48 | fRet = TRUE; 49 | } 50 | else 51 | { 52 | _dwThreadFocusSinkCookie = TF_INVALID_COOKIE; 53 | } 54 | } 55 | 56 | return fRet; 57 | } 58 | 59 | void CTextService::_UninitThreadFocusSink() 60 | { 61 | CComPtr pSource; 62 | if (SUCCEEDED(_pThreadMgr->QueryInterface(IID_PPV_ARGS(&pSource))) && (pSource != nullptr)) 63 | { 64 | pSource->UnadviseSink(_dwThreadFocusSinkCookie); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /imcrvtip/ThreadMgrEventSink.cpp: -------------------------------------------------------------------------------- 1 |  2 | #include "imcrvtip.h" 3 | #include "TextService.h" 4 | #include "CandidateList.h" 5 | 6 | STDAPI CTextService::OnInitDocumentMgr(ITfDocumentMgr *pdim) 7 | { 8 | return S_OK; 9 | } 10 | 11 | STDAPI CTextService::OnUninitDocumentMgr(ITfDocumentMgr *pdim) 12 | { 13 | return S_OK; 14 | } 15 | 16 | STDAPI CTextService::OnSetFocus(ITfDocumentMgr *pdim, ITfDocumentMgr *pdimPrevFocus) 17 | { 18 | _InitTextEditSink(pdim); 19 | 20 | { 21 | _UninitPrivateModeKey(0); //ON 22 | _UninitPrivateModeKey(1); //OFF 23 | 24 | _GetAppPrivateMode(); 25 | 26 | BOOL p = _IsPrivateMode(); 27 | _InitPrivateModeKey(p ? 1 : 0); //OFF or ON 28 | _InitPrivateModeKey(p ? 0 : 1); //ON or OFF 未使用だがキーは拾う 重複するキーは上書きされない 29 | } 30 | 31 | if (_pCandidateList != nullptr) 32 | { 33 | _pCandidateList->_Redraw(); 34 | } 35 | 36 | _UpdateLanguageBar(FALSE); 37 | 38 | return S_OK; 39 | } 40 | 41 | STDAPI CTextService::OnPushContext(ITfContext *pic) 42 | { 43 | return S_OK; 44 | } 45 | 46 | STDAPI CTextService::OnPopContext(ITfContext *pic) 47 | { 48 | return S_OK; 49 | } 50 | 51 | BOOL CTextService::_InitThreadMgrEventSink() 52 | { 53 | BOOL fRet = FALSE; 54 | 55 | CComPtr pSource; 56 | if (SUCCEEDED(_pThreadMgr->QueryInterface(IID_PPV_ARGS(&pSource))) && (pSource != nullptr)) 57 | { 58 | if (SUCCEEDED(pSource->AdviseSink(IID_IUNK_ARGS(static_cast(this)), &_dwThreadMgrEventSinkCookie))) 59 | { 60 | fRet = TRUE; 61 | } 62 | else 63 | { 64 | _dwThreadMgrEventSinkCookie = TF_INVALID_COOKIE; 65 | } 66 | } 67 | 68 | return fRet; 69 | } 70 | 71 | void CTextService::_UninitThreadMgrEventSink() 72 | { 73 | HRESULT hr = E_FAIL; 74 | 75 | if (_dwThreadMgrEventSinkCookie != TF_INVALID_COOKIE) 76 | { 77 | CComPtr pSource; 78 | if (SUCCEEDED(_pThreadMgr->QueryInterface(IID_PPV_ARGS(&pSource))) && (pSource != nullptr)) 79 | { 80 | hr = pSource->UnadviseSink(_dwThreadMgrEventSinkCookie); 81 | } 82 | _dwThreadMgrEventSinkCookie = TF_INVALID_COOKIE; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /imcrvtip/cpp.hint: -------------------------------------------------------------------------------- 1 | // common.h 2 | #define FORWARD_ITERATION_I(iterator, container) for (auto (iterator) = (container).begin(); (iterator) != (container).end(); ++(iterator)) 3 | #define FORWARD_ITERATION(iterator, container) for (auto (iterator) = (container).begin(); (iterator) != (container).end(); ) 4 | #define REVERSE_ITERATION_I(reverse_iterator, container) for (auto (reverse_iterator) = (container).rbegin(); (reverse_iterator) != (container).rend(); ++(reverse_iterator)) 5 | #define REVERSE_ITERATION(reverse_iterator, container) for (auto (reverse_iterator) = (container).rbegin(); (reverse_iterator) != (container).rend(); ) 6 | -------------------------------------------------------------------------------- /imcrvtip/imcrvtip.def: -------------------------------------------------------------------------------- 1 | LIBRARY imcrvtip.dll 2 | 3 | EXPORTS 4 | DllCanUnloadNow PRIVATE 5 | DllGetClassObject PRIVATE 6 | DllRegisterServer PRIVATE 7 | DllUnregisterServer PRIVATE 8 | -------------------------------------------------------------------------------- /imcrvtip/imcrvtip.rc: -------------------------------------------------------------------------------- 1 |  2 | #include 3 | #include "version.h" 4 | #include "resource.h" 5 | 6 | VS_VERSION_INFO VERSIONINFO 7 | FILEVERSION RC_VERSION_D 8 | PRODUCTVERSION RC_VERSION_D 9 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 10 | #ifndef _DEBUG 11 | FILEFLAGS 0x00000000L 12 | #else 13 | FILEFLAGS VS_FF_DEBUG 14 | #endif 15 | FILEOS VOS_NT_WINDOWS32 16 | FILETYPE VFT_DLL 17 | FILESUBTYPE VFT2_UNKNOWN 18 | { 19 | BLOCK "StringFileInfo" 20 | { 21 | BLOCK "000004B0" 22 | { 23 | VALUE "CompanyName", RC_AUTHOR 24 | VALUE "FileDescription", RC_PRODUCT " Text Input Processor" 25 | VALUE "FileVersion", RC_VERSION 26 | VALUE "InternalName", "imcrvtip" 27 | VALUE "LegalCopyright", "© 2011 " RC_AUTHOR 28 | VALUE "OriginalFilename", "imcrvtip.dll" 29 | VALUE "ProductName", RC_PRODUCT 30 | VALUE "ProductVersion", RC_VERSION 31 | } 32 | } 33 | BLOCK "VarFileInfo" 34 | { 35 | VALUE "Translation", 0x0000, 1200 36 | } 37 | } 38 | 39 | #ifndef _DEBUG 40 | IDI_0_IME ICON "Icon\\imcrvskk.ico" 41 | #else 42 | IDI_0_IME ICON "Icon\\imdebug.ico" 43 | #endif 44 | 45 | IDI_X_DEFAULT ICON "Icon\\xDefault.ico" 46 | IDI_X_HIRAGANA ICON "Icon\\xHiragana.ico" 47 | IDI_X_KATAKANA ICON "Icon\\xKatakana.ico" 48 | IDI_X_KATAKANA1 ICON "Icon\\xKatakana1.ico" 49 | IDI_X_JLATIN ICON "Icon\\xJLatin.ico" 50 | IDI_X_ASCII ICON "Icon\\xAscii.ico" 51 | 52 | IDI_Z_DEFAULT ICON "Icon\\zDefault.ico" 53 | IDI_Z_HIRAGANA ICON "Icon\\zHiragana.ico" 54 | IDI_Z_KATAKANA ICON "Icon\\zKatakana.ico" 55 | IDI_Z_KATAKANA1 ICON "Icon\\zKatakana1.ico" 56 | IDI_Z_JLATIN ICON "Icon\\zJLatin.ico" 57 | IDI_Z_ASCII ICON "Icon\\zAscii.ico" 58 | 59 | IDI_PX_HIRAGANA ICON "Icon\\pxHiragana.ico" 60 | IDI_PX_KATAKANA ICON "Icon\\pxKatakana.ico" 61 | IDI_PX_KATAKANA1 ICON "Icon\\pxKatakana1.ico" 62 | IDI_PX_JLATIN ICON "Icon\\pxJLatin.ico" 63 | IDI_PX_ASCII ICON "Icon\\pxAscii.ico" 64 | 65 | IDI_PZ_HIRAGANA ICON "Icon\\pzHiragana.ico" 66 | IDI_PZ_KATAKANA ICON "Icon\\pzKatakana.ico" 67 | IDI_PZ_KATAKANA1 ICON "Icon\\pzKatakana1.ico" 68 | IDI_PZ_JLATIN ICON "Icon\\pzJLatin.ico" 69 | IDI_PZ_ASCII ICON "Icon\\pzAscii.ico" 70 | 71 | IDR_SYSTRAY_MENU MENU 72 | { 73 | POPUP "" 74 | { 75 | MENUITEM "CAPS", IDM_CAPSLOCK 76 | MENUITEM "KANA", IDM_KANALOCK 77 | MENUITEM SEPARATOR 78 | MENUITEM "Private", IDM_PRIVATE 79 | MENUITEM SEPARATOR 80 | MENUITEM "[かな]", IDM_HIRAGANA 81 | MENUITEM "[カナ]", IDM_KATAKANA 82 | MENUITEM "[-カナ]", IDM_KATAKANA_ANK 83 | MENUITEM "[全英]", IDM_JLATIN 84 | MENUITEM "[SKK]", IDM_ASCII 85 | MENUITEM "[--]", IDM_DIRECT 86 | MENUITEM SEPARATOR 87 | MENUITEM "設定", IDM_CONFIG 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /imcrvtip/pch.cpp: -------------------------------------------------------------------------------- 1 |  2 | -------------------------------------------------------------------------------- /imcrvtip/pch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include 30 | -------------------------------------------------------------------------------- /imcrvtip/resource.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define IDI_0_IME 100 4 | 5 | #define IDI_X_DEFAULT 201 6 | #define IDI_X_HIRAGANA 202 7 | #define IDI_X_KATAKANA 203 8 | #define IDI_X_KATAKANA1 204 9 | #define IDI_X_JLATIN 205 10 | #define IDI_X_ASCII 206 11 | 12 | #define IDI_Z_DEFAULT 301 13 | #define IDI_Z_HIRAGANA 302 14 | #define IDI_Z_KATAKANA 303 15 | #define IDI_Z_KATAKANA1 304 16 | #define IDI_Z_JLATIN 305 17 | #define IDI_Z_ASCII 306 18 | 19 | #define IDI_PX_HIRAGANA 402 20 | #define IDI_PX_KATAKANA 403 21 | #define IDI_PX_KATAKANA1 404 22 | #define IDI_PX_JLATIN 405 23 | #define IDI_PX_ASCII 406 24 | 25 | #define IDI_PZ_HIRAGANA 502 26 | #define IDI_PZ_KATAKANA 503 27 | #define IDI_PZ_KATAKANA1 504 28 | #define IDI_PZ_JLATIN 505 29 | #define IDI_PZ_ASCII 506 30 | 31 | #define IDR_SYSTRAY_MENU 1000 32 | #define IDM_NONE 1001 33 | #define IDM_HIRAGANA 1011 34 | #define IDM_KATAKANA 1012 35 | #define IDM_KATAKANA_ANK 1013 36 | #define IDM_JLATIN 1014 37 | #define IDM_ASCII 1015 38 | #define IDM_DIRECT 1020 39 | #define IDM_CONFIG 1021 40 | #define IDM_CAPSLOCK 1022 41 | #define IDM_KANALOCK 1023 42 | #define IDM_PRIVATE 1024 43 | -------------------------------------------------------------------------------- /installer/_build.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | pushd "%~dp0" 4 | 5 | call _clean.cmd 6 | 7 | set SignOutput=false 8 | 9 | call _build_msi.cmd 10 | 11 | call _build_bundle.cmd 12 | 13 | popd 14 | endlocal 15 | -------------------------------------------------------------------------------- /installer/_build_bundle.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | pushd "%~dp0" 4 | 5 | call _vsdev.cmd 6 | 7 | call _env.cmd 8 | 9 | if not defined SIGNCOMMAND set SignOutput=false 10 | 11 | set BUILDCOMMAND=dotnet build installer-bundle.wixproj -nologo -verbosity:normal -target:Build 12 | 13 | echo build bundle 14 | %BUILDCOMMAND% -property:BaseIntermediateOutputPath=%OutDir%\bundle\ 15 | 16 | popd 17 | endlocal 18 | -------------------------------------------------------------------------------- /installer/_build_doc.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | pushd "%~dp0" 4 | 5 | call _env.cmd 6 | 7 | if not exist "%OutDir%" mkdir "%OutDir%" 8 | 9 | pushd .. 10 | 11 | set PATH=%PATH%;%LocalAppData%\Pandoc;%ProgramFiles%\Pandoc 12 | 13 | set DESCRIPTION=CorvusSKK 14 | 15 | pandoc.exe ^ 16 | -s ^ 17 | -f gfm-ascii_identifiers ^ 18 | -t html5 ^ 19 | -V lang:"ja" ^ 20 | -V title-prefix:"%DESCRIPTION%" ^ 21 | -V pagetitle:"Manual" ^ 22 | -V title:"%DESCRIPTION% Manual" ^ 23 | --embed-resources ^ 24 | --standalone ^ 25 | -c "installer\resource-md\markdown.css" ^ 26 | --toc ^ 27 | -o "installer\%OutDir%\README.html" ^ 28 | README.md 29 | 30 | popd 31 | 32 | copy /y /b "..\LICENSE.TXT" "%OutDir%\LICENSE.txt" > nul 33 | copy /y /b "config-lua\init.lua" "%OutDir%\init.lua" > nul 34 | copy /y /b "config-share\config.xml" "%OutDir%\config.xml" > nul 35 | copy /y /b "config-share\skkdict.txt" "%OutDir%\skkdict.txt" > nul 36 | 37 | pushd "%OutDir%" 38 | 39 | copy /b LICENSE.txt + > nul 40 | copy /b init.lua + > nul 41 | copy /b config.xml + > nul 42 | copy /b skkdict.txt + > nul 43 | 44 | popd 45 | 46 | popd 47 | endlocal 48 | -------------------------------------------------------------------------------- /installer/_build_msi.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | pushd "%~dp0" 4 | 5 | call _vsdev.cmd 6 | 7 | call _env.cmd 8 | 9 | call _build_doc.cmd 10 | 11 | if not defined SIGNCOMMAND set SignOutput=false 12 | 13 | set BUILDCOMMAND=dotnet build installer-msi.wixproj -nologo -verbosity:normal -target:Build 14 | 15 | echo build x86.msi 16 | %BUILDCOMMAND% -property:PackagePlatform=x86 -property:InstallerPlatform=x86 -property:BaseIntermediateOutputPath=%OutDir%\x86\ 17 | 18 | echo build x64.msi 19 | %BUILDCOMMAND% -property:PackagePlatform=x64 -property:InstallerPlatform=x64 -property:BaseIntermediateOutputPath=%OutDir%\x64\ 20 | 21 | echo build arm32.msi 22 | %BUILDCOMMAND% -property:PackagePlatform=arm32 -property:InstallerPlatform=arm64 -property:BaseIntermediateOutputPath=%OutDir%\arm32\ 23 | 24 | echo build arm64.msi 25 | %BUILDCOMMAND% -property:PackagePlatform=arm64 -property:InstallerPlatform=arm64 -property:BaseIntermediateOutputPath=%OutDir%\arm64\ 26 | 27 | popd 28 | endlocal 29 | -------------------------------------------------------------------------------- /installer/_clean.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | pushd "%~dp0" 4 | 5 | call _env.cmd 6 | 7 | if exist "%OutDir%" rd /s /q "%OutDir%" 8 | 9 | popd 10 | endlocal 11 | -------------------------------------------------------------------------------- /installer/_debug_reg.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | pushd "%~dp0" 4 | 5 | openfiles > nul 2>&1 6 | if %errorlevel% equ 1 ( 7 | powershell start-process "%~nx0" -verb runas 8 | ) else ( 9 | regsvr32 /s "..\build\Win32\Debug\imcrvtip.dll" 10 | regsvr32 /s "..\build\x64\Debug\imcrvtip.dll" 11 | ) 12 | 13 | popd 14 | endlocal 15 | -------------------------------------------------------------------------------- /installer/_debug_unreg.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | pushd "%~dp0" 4 | 5 | openfiles > nul 2>&1 6 | if %errorlevel% equ 1 ( 7 | powershell start-process "%~nx0" -verb runas 8 | ) else ( 9 | regsvr32 /s /u "..\build\Win32\Debug\imcrvtip.dll" 10 | regsvr32 /s /u "..\build\x64\Debug\imcrvtip.dll" 11 | ) 12 | 13 | popd 14 | endlocal 15 | -------------------------------------------------------------------------------- /installer/_env.cmd: -------------------------------------------------------------------------------- 1 | 2 | set VERSION=3.3.0 3 | 4 | set WIXTOOLSET_VERSION=6.0.0 5 | 6 | set OutDir=build 7 | -------------------------------------------------------------------------------- /installer/_sign.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | pushd "%~dp0" 4 | 5 | call _vsdev.cmd 6 | 7 | call _env.cmd 8 | 9 | 10 | 11 | rem > _sign.cmd 12 | rem * : SHA-1 thumbprint of certificate 13 | rem * : RFC-3161 timestamp server 14 | 15 | set DESCRIPTION="CorvusSKK" 16 | 17 | set SHA1HASH=%1 18 | set TIMESTAMPSERVER=%2 19 | 20 | set SIGNCOMMAND=signtool sign /v /d %DESCRIPTION% /sha1 %SHA1HASH% /fd sha256 /tr %TIMESTAMPSERVER% /td sha256 21 | 22 | set BINFILES= 23 | rem x86 24 | set BINFILES=%BINFILES% "..\build\Win32\Release\*.dll" "..\build\Win32\Release\*.exe" 25 | rem x64 26 | set BINFILES=%BINFILES% "..\build\x64\Release\*.dll" "..\build\x64\Release\*.exe" 27 | rem ARM32 TIP only 28 | set BINFILES=%BINFILES% "..\build\ARM\Release\*.dll" 29 | rem ARM64 30 | set BINFILES=%BINFILES% "..\build\ARM64\Release\*.dll" "..\build\ARM64\Release\*.exe" 31 | rem ARM64EC TIP only 32 | set BINFILES=%BINFILES% "..\build\ARM64EC\Release\*.dll" 33 | 34 | 35 | 36 | call _clean.cmd 37 | 38 | echo sign binary files 39 | %SIGNCOMMAND% %BINFILES% 40 | 41 | set SignOutput=true 42 | 43 | call _build_msi.cmd 44 | 45 | call _build_bundle.cmd 46 | 47 | 48 | 49 | popd 50 | endlocal 51 | -------------------------------------------------------------------------------- /installer/_solution_build.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | pushd "%~dp0" 4 | 5 | call _vsdev.cmd 6 | 7 | call _env.cmd 8 | 9 | set BUILDCOMMAND=msbuild "..\imcrvskk.sln" -nologo -maxcpucount -verbosity:normal 10 | set BUILDCOMMAND=%BUILDCOMMAND% -target:Build -property:Configuration=Release 11 | 12 | rem x86 13 | %BUILDCOMMAND% -property:Platform=x86 14 | 15 | rem x64 16 | %BUILDCOMMAND% -property:Platform=x64 17 | 18 | rem ARM32 19 | %BUILDCOMMAND% -property:Platform=ARM -property:WindowsTargetPlatformVersion=10.0.22621.0 20 | 21 | rem ARM64 22 | %BUILDCOMMAND% -property:Platform=ARM64 23 | 24 | rem ARM64EC 25 | %BUILDCOMMAND% -property:Platform=ARM64EC 26 | 27 | popd 28 | endlocal 29 | -------------------------------------------------------------------------------- /installer/_solution_build_debug.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | pushd "%~dp0" 4 | 5 | call _vsdev.cmd 6 | 7 | call _env.cmd 8 | 9 | set BUILDCOMMAND=msbuild "..\imcrvskk.sln" -nologo -maxcpucount -verbosity:normal 10 | set BUILDCOMMAND=%BUILDCOMMAND% -target:Build -property:Configuration=Debug 11 | 12 | rem x86 13 | %BUILDCOMMAND% -property:Platform=x86 14 | 15 | rem x64 16 | %BUILDCOMMAND% -property:Platform=x64 17 | 18 | rem ARM32 19 | %BUILDCOMMAND% -property:Platform=ARM -property:WindowsTargetPlatformVersion=10.0.22621.0 20 | 21 | rem ARM64 22 | %BUILDCOMMAND% -property:Platform=ARM64 23 | 24 | rem ARM64EC 25 | %BUILDCOMMAND% -property:Platform=ARM64EC 26 | 27 | popd 28 | endlocal 29 | -------------------------------------------------------------------------------- /installer/_solution_clean.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | pushd "%~dp0" 4 | 5 | if exist "..\build" rd /s /q "..\build" 6 | 7 | popd 8 | endlocal 9 | -------------------------------------------------------------------------------- /installer/_verify.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | pushd "%~dp0" 4 | 5 | call _vsdev.cmd 6 | 7 | call _env.cmd 8 | 9 | 10 | 11 | set BINFILES= 12 | rem x86 13 | set BINFILES=%BINFILES% "..\build\Win32\Release\*.dll" "..\build\Win32\Release\*.exe" 14 | rem x64 15 | set BINFILES=%BINFILES% "..\build\x64\Release\*.dll" "..\build\x64\Release\*.exe" 16 | rem ARM32 TIP only 17 | set BINFILES=%BINFILES% "..\build\ARM\Release\*.dll" 18 | rem ARM64 19 | set BINFILES=%BINFILES% "..\build\ARM64\Release\*.dll" "..\build\ARM64\Release\*.exe" 20 | rem ARM64EC TIP only 21 | set BINFILES=%BINFILES% "..\build\ARM64EC\Release\*.dll" 22 | 23 | set MSIFILES= 24 | rem x86 25 | set MSIFILES=%MSIFILES% "%OutDir%\x86.msi" 26 | rem x64 27 | set MSIFILES=%MSIFILES% "%OutDir%\x64.msi" 28 | rem ARM32 29 | set MSIFILES=%MSIFILES% "%OutDir%\arm32.msi" 30 | rem ARM64 31 | set MSIFILES=%MSIFILES% "%OutDir%\arm64.msi" 32 | 33 | rem bundle 34 | set BEFILE="%OutDir%\corvusskk-%VERSION%-engine.exe" 35 | set BSFILE="%OutDir%\corvusskk-%VERSION%.exe" 36 | 37 | 38 | 39 | signtool verify /all /v /d /pa /tw %BINFILES% %MSIFILES% %BEFILE% %BSFILE% 40 | 41 | set SIGNCOUNT=0 42 | for %%i in (%BINFILES% %MSIFILES% %BEFILE% %BSFILE%) do set /a "SIGNCOUNT = SIGNCOUNT + 1" 43 | 44 | echo; 45 | echo %SIGNCOUNT% signatures in all. 46 | 47 | 48 | 49 | popd 50 | endlocal 51 | -------------------------------------------------------------------------------- /installer/_vsdev.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set VSWHEREEXE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" 4 | set VSWHEREOPT=-version [17^^,18^^) -requires Microsoft.Component.MSBuild -property installationPath 5 | 6 | for /f "usebackq tokens=*" %%i in (`%VSWHEREEXE% %VSWHEREOPT%`) do ( 7 | set VSDEVCMDBAT=%%i\Common7\Tools\VsDevCmd.bat 8 | ) 9 | 10 | if exist "%VSDEVCMDBAT%" ( 11 | call "%VSDEVCMDBAT%" %* > nul 12 | ) 13 | 14 | set VSWHEREEXE= 15 | set VSWHEREOPT= 16 | set VSDEVCMDBAT= 17 | -------------------------------------------------------------------------------- /installer/config-lua/test_c.lua: -------------------------------------------------------------------------------- 1 |  2 | SKK_VERSION="CorvusSKK X.Y.Z" 3 | 4 | local _M = {} 5 | 6 | function _M.search_user_dictionary(key, okuri) 7 | local ret = "" 8 | 9 | if (key == "p#") then 10 | ret = "/#4/\n" 11 | elseif (key == "125") then 12 | ret = "/東京都葛飾区;サンプル/\n" 13 | else 14 | end 15 | 16 | return ret 17 | end 18 | 19 | function _M.search_skk_dictionary(key, okuri) 20 | local ret = "" 21 | 22 | if (key == "かくてい") then 23 | ret = "/(skk-ignore-dic-word \"確定\");yyy/各停;zzz/確定;xxx/\n" 24 | elseif (key == "きr" and okuri) then 25 | ret = "/切;紙を-/着;服を-/斬;人を-/伐;木を-/剪;盆栽を-/截;布地を-/(skk-ignore-dic-word \"斬\")/\n" 26 | elseif (key == "き") then 27 | ret = "/気/機/器/木/\n" 28 | 29 | elseif (key == "p#") then 30 | ret = "/#4/\n" 31 | elseif (key == "125") then 32 | ret = "/東京都葛飾区(テスト);サンプル/\n" 33 | 34 | else 35 | end 36 | 37 | return ret 38 | end 39 | 40 | function _M.search_skk_server(key) 41 | return "" 42 | end 43 | 44 | function _M.search_skk_server_info() 45 | return "", "" 46 | end 47 | 48 | function _M.search_unicode(key) 49 | return "" 50 | end 51 | 52 | function _M.search_jisx0213(key) 53 | return "" 54 | end 55 | 56 | function _M.search_jisx0208(key) 57 | return "" 58 | end 59 | 60 | function _M.search_character_code(key) 61 | return "" 62 | end 63 | 64 | function _M.complement(key) 65 | return "/きあい/きけん/きき/きかい/\n" 66 | end 67 | 68 | function _M.reverse(candidate) 69 | return "" 70 | end 71 | 72 | function _M.add(okuriari, key, candidate, annotation, okuri) 73 | return 74 | end 75 | 76 | function _M.delete(okuriari, key, candidate) 77 | return 78 | end 79 | 80 | function _M.save() 81 | return 82 | end 83 | 84 | return _M 85 | -------------------------------------------------------------------------------- /installer/config-lua/test_search.lua: -------------------------------------------------------------------------------- 1 | package.path = ".\\?.lua;" .. package.path 2 | package.cpath = ".\\?.dll;" .. package.cpath 3 | 4 | crvmgr = require("test_c") 5 | require("init") 6 | 7 | 8 | key = "かくてい" 9 | okuri = "" 10 | print("key : \"" .. key .. "\" okuri : \"" .. okuri .. "\"\n") 11 | print(" enable_skk_ignore_dic_word : false") 12 | print(" " .. lua_skk_search(key, okuri)) 13 | enable_skk_ignore_dic_word = true 14 | print(" enable_skk_ignore_dic_word : true") 15 | print(" " .. lua_skk_search(key, okuri)) 16 | enable_skk_ignore_dic_word = false 17 | 18 | 19 | key = "きr" 20 | okuri = "る" 21 | print("key : \"" .. key .. "\" okuri : \"" .. okuri .. "\"\n") 22 | print(" enable_skk_ignore_dic_word : false") 23 | print(" " .. lua_skk_search(key, okuri)) 24 | enable_skk_ignore_dic_word = true 25 | print(" enable_skk_ignore_dic_word : true") 26 | print(" " .. lua_skk_search(key, okuri)) 27 | enable_skk_ignore_dic_word = false 28 | 29 | 30 | key = "かx" 31 | okuri = "っ" 32 | print("key : \"" .. key .. "\" okuri : \"" .. okuri .. "\"\n") 33 | print(" > " .. lua_skk_convert_key(key, okuri) .. "\n") 34 | 35 | 36 | key = "きr" 37 | okuri = "る" 38 | print("key : \"" .. key .. "\" okuri : \"" .. okuri .. "\"\n") 39 | print(" enable_skk_search_sagyo_only : true") 40 | print(" " .. lua_skk_search(key, okuri) .. "\n") 41 | 42 | key = "きr" 43 | okuri = "る" 44 | enable_skk_search_sagyo_only = false 45 | print(" enable_skk_search_sagyo_only : false") 46 | print(" " .. lua_skk_search(key, okuri)) 47 | -- //送りあり変換で送りなし候補も検索する : ON 48 | key = "き" 49 | okuri = "" 50 | print(" " .. lua_skk_search(key, okuri) .. "\n") 51 | enable_skk_search_sagyo_only = true 52 | 53 | 54 | print("check results by yourself.") 55 | -------------------------------------------------------------------------------- /installer/config-sample/skk-omikuji.txt: -------------------------------------------------------------------------------- 1 | ;; licensed under CC0. 2 | ;; https://creativecommons.org/publicdomain/zero/1.0/ 3 | ;; 4 | ;; okuri-ari entries. 5 | ;; okuri-nasi entries. 6 | おみくじ /(skk-omikuji)/ 7 | -------------------------------------------------------------------------------- /installer/config-sample/skk-strftime.txt: -------------------------------------------------------------------------------- 1 | ;; licensed under CC0. 2 | ;; https://creativecommons.org/publicdomain/zero/1.0/ 3 | ;; 4 | ;; okuri-ari entries. 5 | ;; okuri-nasi entries. 6 | datetime /(skk-strftime "!%Y%m%dT%H%M%SZ")/(skk-strftime "%Y%m%dT%H%M%S%z")/(skk-strftime "!%FT%TZ")/(concat (skk-strftime "%FT%T") (substring (skk-strftime "%z") 0 3) ":" (substring (skk-strftime "%z") 3 5))/ 7 | いま /(skk-strftime "%Y年%#m月%#d日(%a) %#H時%#M分%#S秒")/ 8 | #びょうご /(skk-strftime "%Y年%#m月%#d日(%a) %#H時%#M分%#S秒" "sec" #0)/ 9 | #びょうまえ /(skk-strftime "%Y年%#m月%#d日(%a) %#H時%#M分%#S秒" "sec" -#0)/ 10 | #ふんご /(skk-strftime "%Y年%#m月%#d日(%a) %#H時%#M分%#S秒" "min" #0)/ 11 | #ふんまえ /(skk-strftime "%Y年%#m月%#d日(%a) %#H時%#M分%#S秒" "min" -#0)/ 12 | #じかんご /(skk-strftime "%Y年%#m月%#d日(%a) %#H時%#M分%#S秒" "hour" #0)/ 13 | #じかんまえ /(skk-strftime "%Y年%#m月%#d日(%a) %#H時%#M分%#S秒" "hour" -#0)/ 14 | きょう /(skk-strftime "%Y年%#m月%#d日(%a)")/ 15 | あした /(skk-strftime "%Y年%#m月%#d日(%a)" "day" 1)/ 16 | あす /(skk-strftime "%Y年%#m月%#d日(%a)" "day" 1)/ 17 | みょうごにち /(skk-strftime "%Y年%#m月%#d日(%a)" "day" 2)/ 18 | あさって /(skk-strftime "%Y年%#m月%#d日(%a)" "day" 2)/ 19 | しあさって /(skk-strftime "%Y年%#m月%#d日(%a)" "day" 3)/ 20 | みょうみょうごにち /(skk-strftime "%Y年%#m月%#d日(%a)" "day" 3)/ 21 | きのう /(skk-strftime "%Y年%#m月%#d日(%a)" "day" -1)/ 22 | おととい /(skk-strftime "%Y年%#m月%#d日(%a)" "day" -2)/ 23 | おとつい /(skk-strftime "%Y年%#m月%#d日(%a)" "day" -2)/ 24 | いっさくじつ /(skk-strftime "%Y年%#m月%#d日(%a)" "day" -2)/ 25 | #にちご /(skk-strftime "%Y年%#m月%#d日(%a)" "day" #0)/ 26 | #にちまえ /(skk-strftime "%Y年%#m月%#d日(%a)" "day" -#0)/ 27 | こんげつ /(skk-strftime "%Y年%#m月")/ 28 | らいげつ /(skk-strftime "%Y年%#m月" "month" 1)/ 29 | さらいげつ /(skk-strftime "%Y年%#m月" "month" 2)/ 30 | せんげつ /(skk-strftime "%Y年%#m月" "month" -1)/ 31 | せんせんげつ /(skk-strftime "%Y年%#m月" "month" -2)/ 32 | #かげつご /(skk-strftime "%Y年%#m月" "month" #0)/ 33 | #かげつまえ /(skk-strftime "%Y年%#m月" "month" -#0)/ 34 | ことし /(skk-strftime "%Y年")/ 35 | らいねん /(skk-strftime "%Y年" "year" 1)/ 36 | みょうねん /(skk-strftime "%Y年" "year" 1)/ 37 | さらいねん /(skk-strftime "%Y年" "year" 2)/ 38 | みょうごねん /(skk-strftime "%Y年" "year" 2)/ 39 | きょねん /(skk-strftime "%Y年" "year" -1)/ 40 | さくねん /(skk-strftime "%Y年" "year" -1)/ 41 | おととし /(skk-strftime "%Y年" "year" -2)/ 42 | いっさくねん /(skk-strftime "%Y年" "year" -2)/ 43 | #ねんご /(skk-strftime "%Y年" "year" #0)/ 44 | #ねんまえ /(skk-strftime "%Y年" "year" -#0)/ 45 | -------------------------------------------------------------------------------- /installer/config-share/skkdict.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/config-share/skkdict.txt -------------------------------------------------------------------------------- /installer/installer-arm32.wxs: -------------------------------------------------------------------------------- 1 | 3 | 4 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 58 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /installer/installer-bundle.wixproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Bundle 4 | x86 5 | none 6 | Release 7 | true 8 | false 9 | corvusskk-$(VERSION) 10 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /installer/installer-bundle.wxs: -------------------------------------------------------------------------------- 1 | 4 | 5 | 14 | 15 | 16 | 17 | 18 | 25 | 26 | 27 | 28 | 35 | 36 | 37 | 38 | 39 | 45 | 46 | 47 | 54 | 55 | 56 | 57 | 64 | 65 | 66 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /installer/installer-msi.wixproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Package 4 | none 5 | Release 6 | true 7 | false 8 | 14 | 15 | 16 | x86 17 | 18 | 19 | x64 20 | 21 | 22 | arm32 23 | 24 | 25 | arm64 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /installer/resource-md/00_input_mode_ascii.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/00_input_mode_ascii.png -------------------------------------------------------------------------------- /installer/resource-md/00_input_mode_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/00_input_mode_default.png -------------------------------------------------------------------------------- /installer/resource-md/00_input_mode_hiragana.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/00_input_mode_hiragana.png -------------------------------------------------------------------------------- /installer/resource-md/00_input_mode_jlatin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/00_input_mode_jlatin.png -------------------------------------------------------------------------------- /installer/resource-md/00_input_mode_katakana.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/00_input_mode_katakana.png -------------------------------------------------------------------------------- /installer/resource-md/00_input_mode_katakana1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/00_input_mode_katakana1.png -------------------------------------------------------------------------------- /installer/resource-md/00_input_mode_p_ascii.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/00_input_mode_p_ascii.png -------------------------------------------------------------------------------- /installer/resource-md/00_input_mode_p_hiragana.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/00_input_mode_p_hiragana.png -------------------------------------------------------------------------------- /installer/resource-md/00_input_mode_p_jlatin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/00_input_mode_p_jlatin.png -------------------------------------------------------------------------------- /installer/resource-md/00_input_mode_p_katakana.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/00_input_mode_p_katakana.png -------------------------------------------------------------------------------- /installer/resource-md/00_input_mode_p_katakana1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/00_input_mode_p_katakana1.png -------------------------------------------------------------------------------- /installer/resource-md/01_input_menu_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/01_input_menu_0.png -------------------------------------------------------------------------------- /installer/resource-md/01_input_menu_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/01_input_menu_1.png -------------------------------------------------------------------------------- /installer/resource-md/02_key_and_mode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/02_key_and_mode.png -------------------------------------------------------------------------------- /installer/resource-md/101_dictionary_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/101_dictionary_1.png -------------------------------------------------------------------------------- /installer/resource-md/102_dictionary_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/102_dictionary_2.png -------------------------------------------------------------------------------- /installer/resource-md/103_behavior_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/103_behavior_1.png -------------------------------------------------------------------------------- /installer/resource-md/104_behavior_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/104_behavior_2.png -------------------------------------------------------------------------------- /installer/resource-md/105_display_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/105_display_1.png -------------------------------------------------------------------------------- /installer/resource-md/106_display_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/106_display_2.png -------------------------------------------------------------------------------- /installer/resource-md/107_display_attribute_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/107_display_attribute_1.png -------------------------------------------------------------------------------- /installer/resource-md/108_display_attribute_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/108_display_attribute_2.png -------------------------------------------------------------------------------- /installer/resource-md/109_select_key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/109_select_key.png -------------------------------------------------------------------------------- /installer/resource-md/110_on_off_key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/110_on_off_key.png -------------------------------------------------------------------------------- /installer/resource-md/111_key1_character.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/111_key1_character.png -------------------------------------------------------------------------------- /installer/resource-md/112_key2_virtual_key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/112_key2_virtual_key.png -------------------------------------------------------------------------------- /installer/resource-md/113_conversion_point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/113_conversion_point.png -------------------------------------------------------------------------------- /installer/resource-md/114_kana.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/114_kana.png -------------------------------------------------------------------------------- /installer/resource-md/115_full_width_latin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/115_full_width_latin.png -------------------------------------------------------------------------------- /installer/resource-md/201_convert_program.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/201_convert_program.png -------------------------------------------------------------------------------- /installer/resource-md/202_convert_number.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/202_convert_number.png -------------------------------------------------------------------------------- /installer/resource-md/203_convert_unicode_codepoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/203_convert_unicode_codepoint.png -------------------------------------------------------------------------------- /installer/resource-md/204_convert_unicode_jisx0213.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/204_convert_unicode_jisx0213.png -------------------------------------------------------------------------------- /installer/resource-md/205_convert_character_display.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/205_convert_character_display.png -------------------------------------------------------------------------------- /installer/resource-md/206_register_annotation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/206_register_annotation.png -------------------------------------------------------------------------------- /installer/resource-md/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/resource-md/logo.png -------------------------------------------------------------------------------- /installer/theme-bundle/banner.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/theme-bundle/banner.bmp -------------------------------------------------------------------------------- /installer/theme-bundle/dialog.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/theme-bundle/dialog.bmp -------------------------------------------------------------------------------- /installer/theme-bundle/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nathancorvussolis/corvusskk/56c41b51c252523fe74f293cc0b79c921f8d02f9/installer/theme-bundle/logo.png -------------------------------------------------------------------------------- /libinput/input.cpp: -------------------------------------------------------------------------------- 1 |  2 | #include "input.h" 3 | 4 | // input.dll dummy functions 5 | 6 | UINT WINAPI EnumEnabledLayoutOrTip( 7 | _In_opt_ LPCWSTR pszUserReg, 8 | _In_opt_ LPCWSTR pszSystemReg, 9 | _In_opt_ LPCWSTR pszSoftwareReg, 10 | _Out_ LAYOUTORTIPPROFILE *pLayoutOrTipProfile, 11 | _In_ UINT uBufLength 12 | ) { 13 | pLayoutOrTipProfile = nullptr; 14 | return 0; 15 | } 16 | 17 | UINT WINAPI EnumLayoutOrTipForSetup( 18 | _In_ LANGID langid, 19 | _Out_ LAYOUTORTIP *pLayoutOrTip, 20 | _In_ UINT uBufLength, 21 | _In_ DWORD dwFlags 22 | ) { 23 | pLayoutOrTip = nullptr; 24 | return 0; 25 | } 26 | 27 | BOOL WINAPI InstallLayoutOrTip( 28 | _In_ LPCWSTR psz, 29 | _In_ DWORD dwFlags 30 | ) { 31 | return TRUE; 32 | } 33 | 34 | BOOL WINAPI InstallLayoutOrTipUserReg( 35 | _In_opt_ LPCWSTR pszUserReg, 36 | _In_opt_ LPCWSTR pszSystemReg, 37 | _In_opt_ LPCWSTR pszSoftwareReg, 38 | _In_ LPCWSTR psz, 39 | _In_ DWORD dwFlags 40 | ) { 41 | return TRUE; 42 | } 43 | 44 | HRESULT WINAPI QueryLayoutOrTipString( 45 | _In_ LPCWSTR psz, 46 | _In_ DWORD dwFlags 47 | ) { 48 | return S_OK; 49 | } 50 | 51 | HRESULT WINAPI QueryLayoutOrTipStringUserReg( 52 | _In_ LPCWSTR pszUserReg, 53 | _In_ LPCWSTR pszSystemReg, 54 | _In_ LPCWSTR pszSoftwareReg, 55 | _In_ LPCWSTR psz, 56 | _In_ DWORD dwFlags 57 | ) { 58 | return S_OK; 59 | } 60 | 61 | BOOL WINAPI SaveDefaultUserInputSettings( 62 | _In_ HWND hwndParent, 63 | _In_ HKEY hSourceRegKey 64 | ) { 65 | return TRUE; 66 | } 67 | 68 | BOOL WINAPI SaveSystemAcctInputSettings( 69 | _In_ HWND hwndParent, 70 | _In_ HKEY hSourceRegKey 71 | ) { 72 | return TRUE; 73 | } 74 | 75 | BOOL WINAPI SetDefaultLayoutOrTip( 76 | _In_ LPCWSTR psz, 77 | _In_ DWORD dwFlags 78 | ) { 79 | return TRUE; 80 | } 81 | 82 | BOOL WINAPI SetDefaultLayoutOrTipUserReg( 83 | _In_opt_ LPCWSTR pszUserReg, 84 | _In_opt_ LPCWSTR pszSystemReg, 85 | _In_opt_ LPCWSTR pszSoftwareReg, 86 | _In_ LPCWSTR psz, 87 | _In_ DWORD dwFlags 88 | ) { 89 | return TRUE; 90 | } 91 | -------------------------------------------------------------------------------- /libinput/input.def: -------------------------------------------------------------------------------- 1 | LIBRARY input.dll 2 | 3 | EXPORTS 4 | EnumEnabledLayoutOrTip 5 | EnumLayoutOrTipForSetup 6 | InstallLayoutOrTip 7 | InstallLayoutOrTipUserReg 8 | QueryLayoutOrTipString 9 | QueryLayoutOrTipStringUserReg 10 | SaveDefaultUserInputSettings 11 | SaveSystemAcctInputSettings 12 | SetDefaultLayoutOrTip 13 | SetDefaultLayoutOrTipUserReg 14 | -------------------------------------------------------------------------------- /libinput/input.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | // input.dll dummy functions 6 | 7 | EXTERN_C_START 8 | 9 | typedef struct tagLAYOUTORTIPPROFILE { 10 | DWORD dwProfileType; // InputProcessor or HKL 11 | #define LOTP_INPUTPROCESSOR 1 12 | #define LOTP_KEYBOARDLAYOUT 2 13 | LANGID langid; // language id 14 | CLSID clsid; // CLSID of tip 15 | GUID guidProfile; // profile description 16 | GUID catid; // category of tip 17 | DWORD dwSubstituteLayout; // substitute hkl 18 | DWORD dwFlags; // Flags 19 | WCHAR szId[MAX_PATH]; // KLID or TIP profile for string 20 | } LAYOUTORTIPPROFILE; 21 | 22 | UINT WINAPI EnumEnabledLayoutOrTip( 23 | _In_opt_ LPCWSTR pszUserReg, 24 | _In_opt_ LPCWSTR pszSystemReg, 25 | _In_opt_ LPCWSTR pszSoftwareReg, 26 | _Out_ LAYOUTORTIPPROFILE *pLayoutOrTipProfile, 27 | _In_ UINT uBufLength 28 | ); 29 | 30 | typedef struct tagLAYOUTORTIP { 31 | DWORD dwFlags; 32 | #define LOT_DEFAULT 0x0001 // If this is on, this is a default item. 33 | #define LOT_DISABLED 0x0002 // if this is on, this is not enabled. 34 | WCHAR szId[MAX_PATH]; // Id of the keyboard item in the string format. 35 | WCHAR szName[MAX_PATH]; // The description of the keyboard item. 36 | } LAYOUTORTIP; 37 | 38 | UINT WINAPI EnumLayoutOrTipForSetup( 39 | _In_ LANGID langid, 40 | _Out_ LAYOUTORTIP *pLayoutOrTip, 41 | _In_ UINT uBufLength, 42 | _In_ DWORD dwFlags 43 | ); 44 | 45 | #define ILOT_INSTALL 0x00000000 // Enables the specified keyboard layout and text service. 46 | #define ILOT_UNINSTALL 0x00000001 // Same as ILOT_DISABLED. 47 | #define ILOT_DEFPROFILE 0x00000002 // Sets the specified layout or tip as a default item. 48 | #define ILOT_DEFUSER4 0x00000004 // Changes the setting of .Default. 49 | #define ILOT_SYSLOCALE 0x00000008 // Unused. 50 | #define ILOT_NOLOCALETOENUMERATE 0x00000010 // Unused. 51 | #define ILOT_NOAPPLYTOCURRENTSESSION 0x00000020 // The setting is saved but is not applied to the current session. 52 | #define ILOT_CLEANINSTALL 0x00000040 // Disables all of the current keyboard layouts and text services. 53 | #define ILOT_DISABLED 0x00000080 // Disables the specified keyboard layout and text service. 54 | 55 | BOOL WINAPI InstallLayoutOrTip( 56 | _In_ LPCWSTR psz, 57 | _In_ DWORD dwFlags 58 | ); 59 | 60 | BOOL WINAPI InstallLayoutOrTipUserReg( 61 | _In_opt_ LPCWSTR pszUserReg, 62 | _In_opt_ LPCWSTR pszSystemReg, 63 | _In_opt_ LPCWSTR pszSoftwareReg, 64 | _In_ LPCWSTR psz, 65 | _In_ DWORD dwFlags 66 | ); 67 | 68 | HRESULT WINAPI QueryLayoutOrTipString( 69 | _In_ LPCWSTR psz, 70 | _In_ DWORD dwFlags // This must be 0. 71 | ); 72 | 73 | HRESULT WINAPI QueryLayoutOrTipStringUserReg( 74 | _In_ LPCWSTR pszUserReg, 75 | _In_ LPCWSTR pszSystemReg, 76 | _In_ LPCWSTR pszSoftwareReg, 77 | _In_ LPCWSTR psz, 78 | _In_ DWORD dwFlags // This must be 0. 79 | ); 80 | 81 | BOOL WINAPI SaveDefaultUserInputSettings( 82 | _In_ HWND hwndParent, 83 | _In_ HKEY hSourceRegKey 84 | ); 85 | 86 | BOOL WINAPI SaveSystemAcctInputSettings( 87 | _In_ HWND hwndParent, 88 | _In_ HKEY hSourceRegKey 89 | ); 90 | 91 | // Stores the setting in the registry but dose not update the runtime keyboard setting of the current session. 92 | // If the alternative registry path is set in SetDefaultLayoutOrTipUserReg, this flag should be set. 93 | #define SDLOT_NOAPPLYTOCURRENTSESSION 0x00000001 94 | // Applies the setting immediately on the current thread. 95 | #define SDLOT_APPLYTOCURRENTTHREAD 0x00000002 96 | 97 | BOOL WINAPI SetDefaultLayoutOrTip( 98 | _In_ LPCWSTR psz, 99 | _In_ DWORD dwFlags 100 | ); 101 | 102 | BOOL WINAPI SetDefaultLayoutOrTipUserReg( 103 | _In_opt_ LPCWSTR pszUserReg, 104 | _In_opt_ LPCWSTR pszSystemReg, 105 | _In_opt_ LPCWSTR pszSoftwareReg, 106 | _In_ LPCWSTR psz, 107 | _In_ DWORD dwFlags 108 | ); 109 | 110 | EXTERN_C_END 111 | -------------------------------------------------------------------------------- /libinput/libinput.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 6 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 7 | 8 | 9 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 10 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 11 | 12 | 13 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 14 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | 23 | 24 | Source Files 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /liblua/lapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lapi.h $ 3 | ** Auxiliary functions from Lua API 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lapi_h 8 | #define lapi_h 9 | 10 | 11 | #include "llimits.h" 12 | #include "lstate.h" 13 | 14 | 15 | /* Increments 'L->top.p', checking for stack overflows */ 16 | #define api_incr_top(L) {L->top.p++; \ 17 | api_check(L, L->top.p <= L->ci->top.p, \ 18 | "stack overflow");} 19 | 20 | 21 | /* 22 | ** If a call returns too many multiple returns, the callee may not have 23 | ** stack space to accommodate all results. In this case, this macro 24 | ** increases its stack space ('L->ci->top.p'). 25 | */ 26 | #define adjustresults(L,nres) \ 27 | { if ((nres) <= LUA_MULTRET && L->ci->top.p < L->top.p) \ 28 | L->ci->top.p = L->top.p; } 29 | 30 | 31 | /* Ensure the stack has at least 'n' elements */ 32 | #define api_checknelems(L,n) \ 33 | api_check(L, (n) < (L->top.p - L->ci->func.p), \ 34 | "not enough elements in the stack") 35 | 36 | 37 | /* 38 | ** To reduce the overhead of returning from C functions, the presence of 39 | ** to-be-closed variables in these functions is coded in the CallInfo's 40 | ** field 'nresults', in a way that functions with no to-be-closed variables 41 | ** with zero, one, or "all" wanted results have no overhead. Functions 42 | ** with other number of wanted results, as well as functions with 43 | ** variables to be closed, have an extra check. 44 | */ 45 | 46 | #define hastocloseCfunc(n) ((n) < LUA_MULTRET) 47 | 48 | /* Map [-1, inf) (range of 'nresults') into (-inf, -2] */ 49 | #define codeNresults(n) (-(n) - 3) 50 | #define decodeNresults(n) (-(n) - 3) 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /liblua/lcode.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lcode.h $ 3 | ** Code generator for Lua 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lcode_h 8 | #define lcode_h 9 | 10 | #include "llex.h" 11 | #include "lobject.h" 12 | #include "lopcodes.h" 13 | #include "lparser.h" 14 | 15 | 16 | /* 17 | ** Marks the end of a patch list. It is an invalid value both as an absolute 18 | ** address, and as a list link (would link an element to itself). 19 | */ 20 | #define NO_JUMP (-1) 21 | 22 | 23 | /* 24 | ** grep "ORDER OPR" if you change these enums (ORDER OP) 25 | */ 26 | typedef enum BinOpr { 27 | /* arithmetic operators */ 28 | OPR_ADD, OPR_SUB, OPR_MUL, OPR_MOD, OPR_POW, 29 | OPR_DIV, OPR_IDIV, 30 | /* bitwise operators */ 31 | OPR_BAND, OPR_BOR, OPR_BXOR, 32 | OPR_SHL, OPR_SHR, 33 | /* string operator */ 34 | OPR_CONCAT, 35 | /* comparison operators */ 36 | OPR_EQ, OPR_LT, OPR_LE, 37 | OPR_NE, OPR_GT, OPR_GE, 38 | /* logical operators */ 39 | OPR_AND, OPR_OR, 40 | OPR_NOBINOPR 41 | } BinOpr; 42 | 43 | 44 | /* true if operation is foldable (that is, it is arithmetic or bitwise) */ 45 | #define foldbinop(op) ((op) <= OPR_SHR) 46 | 47 | 48 | #define luaK_codeABC(fs,o,a,b,c) luaK_codeABCk(fs,o,a,b,c,0) 49 | 50 | 51 | typedef enum UnOpr { OPR_MINUS, OPR_BNOT, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr; 52 | 53 | 54 | /* get (pointer to) instruction of given 'expdesc' */ 55 | #define getinstruction(fs,e) ((fs)->f->code[(e)->u.info]) 56 | 57 | 58 | #define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET) 59 | 60 | #define luaK_jumpto(fs,t) luaK_patchlist(fs, luaK_jump(fs), t) 61 | 62 | LUAI_FUNC int luaK_code (FuncState *fs, Instruction i); 63 | LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx); 64 | LUAI_FUNC int luaK_codeABCk (FuncState *fs, OpCode o, int A, 65 | int B, int C, int k); 66 | LUAI_FUNC int luaK_exp2const (FuncState *fs, const expdesc *e, TValue *v); 67 | LUAI_FUNC void luaK_fixline (FuncState *fs, int line); 68 | LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n); 69 | LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n); 70 | LUAI_FUNC void luaK_checkstack (FuncState *fs, int n); 71 | LUAI_FUNC void luaK_int (FuncState *fs, int reg, lua_Integer n); 72 | LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e); 73 | LUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e); 74 | LUAI_FUNC void luaK_exp2anyregup (FuncState *fs, expdesc *e); 75 | LUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e); 76 | LUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e); 77 | LUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key); 78 | LUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k); 79 | LUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e); 80 | LUAI_FUNC void luaK_goiffalse (FuncState *fs, expdesc *e); 81 | LUAI_FUNC void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e); 82 | LUAI_FUNC void luaK_setreturns (FuncState *fs, expdesc *e, int nresults); 83 | LUAI_FUNC void luaK_setoneret (FuncState *fs, expdesc *e); 84 | LUAI_FUNC int luaK_jump (FuncState *fs); 85 | LUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret); 86 | LUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target); 87 | LUAI_FUNC void luaK_patchtohere (FuncState *fs, int list); 88 | LUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2); 89 | LUAI_FUNC int luaK_getlabel (FuncState *fs); 90 | LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v, int line); 91 | LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v); 92 | LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, 93 | expdesc *v2, int line); 94 | LUAI_FUNC void luaK_settablesize (FuncState *fs, int pc, 95 | int ra, int asize, int hsize); 96 | LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore); 97 | LUAI_FUNC void luaK_finish (FuncState *fs); 98 | LUAI_FUNC l_noret luaK_semerror (LexState *ls, const char *msg); 99 | 100 | 101 | #endif 102 | -------------------------------------------------------------------------------- /liblua/lctype.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lctype.c $ 3 | ** 'ctype' functions for Lua 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #define lctype_c 8 | #define LUA_CORE 9 | 10 | #include "lprefix.h" 11 | 12 | 13 | #include "lctype.h" 14 | 15 | #if !LUA_USE_CTYPE /* { */ 16 | 17 | #include 18 | 19 | 20 | #if defined (LUA_UCID) /* accept UniCode IDentifiers? */ 21 | /* consider all non-ascii codepoints to be alphabetic */ 22 | #define NONA 0x01 23 | #else 24 | #define NONA 0x00 /* default */ 25 | #endif 26 | 27 | 28 | LUAI_DDEF const lu_byte luai_ctype_[UCHAR_MAX + 2] = { 29 | 0x00, /* EOZ */ 30 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0. */ 31 | 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 32 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 1. */ 33 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 34 | 0x0c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, /* 2. */ 35 | 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 36 | 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, /* 3. */ 37 | 0x16, 0x16, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 38 | 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* 4. */ 39 | 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 40 | 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 5. */ 41 | 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x05, 42 | 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* 6. */ 43 | 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 44 | 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 7. */ 45 | 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x00, 46 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* 8. */ 47 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, 48 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* 9. */ 49 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, 50 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* a. */ 51 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, 52 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* b. */ 53 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, 54 | 0x00, 0x00, NONA, NONA, NONA, NONA, NONA, NONA, /* c. */ 55 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, 56 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* d. */ 57 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, 58 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* e. */ 59 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, 60 | NONA, NONA, NONA, NONA, NONA, 0x00, 0x00, 0x00, /* f. */ 61 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 62 | }; 63 | 64 | #endif /* } */ 65 | -------------------------------------------------------------------------------- /liblua/lctype.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lctype.h $ 3 | ** 'ctype' functions for Lua 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lctype_h 8 | #define lctype_h 9 | 10 | #include "lua.h" 11 | 12 | 13 | /* 14 | ** WARNING: the functions defined here do not necessarily correspond 15 | ** to the similar functions in the standard C ctype.h. They are 16 | ** optimized for the specific needs of Lua. 17 | */ 18 | 19 | #if !defined(LUA_USE_CTYPE) 20 | 21 | #if 'A' == 65 && '0' == 48 22 | /* ASCII case: can use its own tables; faster and fixed */ 23 | #define LUA_USE_CTYPE 0 24 | #else 25 | /* must use standard C ctype */ 26 | #define LUA_USE_CTYPE 1 27 | #endif 28 | 29 | #endif 30 | 31 | 32 | #if !LUA_USE_CTYPE /* { */ 33 | 34 | #include 35 | 36 | #include "llimits.h" 37 | 38 | 39 | #define ALPHABIT 0 40 | #define DIGITBIT 1 41 | #define PRINTBIT 2 42 | #define SPACEBIT 3 43 | #define XDIGITBIT 4 44 | 45 | 46 | #define MASK(B) (1 << (B)) 47 | 48 | 49 | /* 50 | ** add 1 to char to allow index -1 (EOZ) 51 | */ 52 | #define testprop(c,p) (luai_ctype_[(c)+1] & (p)) 53 | 54 | /* 55 | ** 'lalpha' (Lua alphabetic) and 'lalnum' (Lua alphanumeric) both include '_' 56 | */ 57 | #define lislalpha(c) testprop(c, MASK(ALPHABIT)) 58 | #define lislalnum(c) testprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT))) 59 | #define lisdigit(c) testprop(c, MASK(DIGITBIT)) 60 | #define lisspace(c) testprop(c, MASK(SPACEBIT)) 61 | #define lisprint(c) testprop(c, MASK(PRINTBIT)) 62 | #define lisxdigit(c) testprop(c, MASK(XDIGITBIT)) 63 | 64 | 65 | /* 66 | ** In ASCII, this 'ltolower' is correct for alphabetic characters and 67 | ** for '.'. That is enough for Lua needs. ('check_exp' ensures that 68 | ** the character either is an upper-case letter or is unchanged by 69 | ** the transformation, which holds for lower-case letters and '.'.) 70 | */ 71 | #define ltolower(c) \ 72 | check_exp(('A' <= (c) && (c) <= 'Z') || (c) == ((c) | ('A' ^ 'a')), \ 73 | (c) | ('A' ^ 'a')) 74 | 75 | 76 | /* one entry for each character and for -1 (EOZ) */ 77 | LUAI_DDEC(const lu_byte luai_ctype_[UCHAR_MAX + 2];) 78 | 79 | 80 | #else /* }{ */ 81 | 82 | /* 83 | ** use standard C ctypes 84 | */ 85 | 86 | #include 87 | 88 | 89 | #define lislalpha(c) (isalpha(c) || (c) == '_') 90 | #define lislalnum(c) (isalnum(c) || (c) == '_') 91 | #define lisdigit(c) (isdigit(c)) 92 | #define lisspace(c) (isspace(c)) 93 | #define lisprint(c) (isprint(c)) 94 | #define lisxdigit(c) (isxdigit(c)) 95 | 96 | #define ltolower(c) (tolower(c)) 97 | 98 | #endif /* } */ 99 | 100 | #endif 101 | 102 | -------------------------------------------------------------------------------- /liblua/ldebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ldebug.h $ 3 | ** Auxiliary functions from Debug Interface module 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ldebug_h 8 | #define ldebug_h 9 | 10 | 11 | #include "lstate.h" 12 | 13 | 14 | #define pcRel(pc, p) (cast_int((pc) - (p)->code) - 1) 15 | 16 | 17 | /* Active Lua function (given call info) */ 18 | #define ci_func(ci) (clLvalue(s2v((ci)->func.p))) 19 | 20 | 21 | #define resethookcount(L) (L->hookcount = L->basehookcount) 22 | 23 | /* 24 | ** mark for entries in 'lineinfo' array that has absolute information in 25 | ** 'abslineinfo' array 26 | */ 27 | #define ABSLINEINFO (-0x80) 28 | 29 | 30 | /* 31 | ** MAXimum number of successive Instructions WiTHout ABSolute line 32 | ** information. (A power of two allows fast divisions.) 33 | */ 34 | #if !defined(MAXIWTHABS) 35 | #define MAXIWTHABS 128 36 | #endif 37 | 38 | 39 | LUAI_FUNC int luaG_getfuncline (const Proto *f, int pc); 40 | LUAI_FUNC const char *luaG_findlocal (lua_State *L, CallInfo *ci, int n, 41 | StkId *pos); 42 | LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o, 43 | const char *opname); 44 | LUAI_FUNC l_noret luaG_callerror (lua_State *L, const TValue *o); 45 | LUAI_FUNC l_noret luaG_forerror (lua_State *L, const TValue *o, 46 | const char *what); 47 | LUAI_FUNC l_noret luaG_concaterror (lua_State *L, const TValue *p1, 48 | const TValue *p2); 49 | LUAI_FUNC l_noret luaG_opinterror (lua_State *L, const TValue *p1, 50 | const TValue *p2, 51 | const char *msg); 52 | LUAI_FUNC l_noret luaG_tointerror (lua_State *L, const TValue *p1, 53 | const TValue *p2); 54 | LUAI_FUNC l_noret luaG_ordererror (lua_State *L, const TValue *p1, 55 | const TValue *p2); 56 | LUAI_FUNC l_noret luaG_runerror (lua_State *L, const char *fmt, ...); 57 | LUAI_FUNC const char *luaG_addinfo (lua_State *L, const char *msg, 58 | TString *src, int line); 59 | LUAI_FUNC l_noret luaG_errormsg (lua_State *L); 60 | LUAI_FUNC int luaG_traceexec (lua_State *L, const Instruction *pc); 61 | LUAI_FUNC int luaG_tracecall (lua_State *L); 62 | 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /liblua/ldo.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ldo.h $ 3 | ** Stack and Call structure of Lua 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ldo_h 8 | #define ldo_h 9 | 10 | 11 | #include "llimits.h" 12 | #include "lobject.h" 13 | #include "lstate.h" 14 | #include "lzio.h" 15 | 16 | 17 | /* 18 | ** Macro to check stack size and grow stack if needed. Parameters 19 | ** 'pre'/'pos' allow the macro to preserve a pointer into the 20 | ** stack across reallocations, doing the work only when needed. 21 | ** It also allows the running of one GC step when the stack is 22 | ** reallocated. 23 | ** 'condmovestack' is used in heavy tests to force a stack reallocation 24 | ** at every check. 25 | */ 26 | #define luaD_checkstackaux(L,n,pre,pos) \ 27 | if (l_unlikely(L->stack_last.p - L->top.p <= (n))) \ 28 | { pre; luaD_growstack(L, n, 1); pos; } \ 29 | else { condmovestack(L,pre,pos); } 30 | 31 | /* In general, 'pre'/'pos' are empty (nothing to save) */ 32 | #define luaD_checkstack(L,n) luaD_checkstackaux(L,n,(void)0,(void)0) 33 | 34 | 35 | 36 | #define savestack(L,pt) (cast_charp(pt) - cast_charp(L->stack.p)) 37 | #define restorestack(L,n) cast(StkId, cast_charp(L->stack.p) + (n)) 38 | 39 | 40 | /* macro to check stack size, preserving 'p' */ 41 | #define checkstackp(L,n,p) \ 42 | luaD_checkstackaux(L, n, \ 43 | ptrdiff_t t__ = savestack(L, p), /* save 'p' */ \ 44 | p = restorestack(L, t__)) /* 'pos' part: restore 'p' */ 45 | 46 | 47 | /* macro to check stack size and GC, preserving 'p' */ 48 | #define checkstackGCp(L,n,p) \ 49 | luaD_checkstackaux(L, n, \ 50 | ptrdiff_t t__ = savestack(L, p); /* save 'p' */ \ 51 | luaC_checkGC(L), /* stack grow uses memory */ \ 52 | p = restorestack(L, t__)) /* 'pos' part: restore 'p' */ 53 | 54 | 55 | /* macro to check stack size and GC */ 56 | #define checkstackGC(L,fsize) \ 57 | luaD_checkstackaux(L, (fsize), luaC_checkGC(L), (void)0) 58 | 59 | 60 | /* type of protected functions, to be ran by 'runprotected' */ 61 | typedef void (*Pfunc) (lua_State *L, void *ud); 62 | 63 | LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop); 64 | LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, 65 | const char *mode); 66 | LUAI_FUNC void luaD_hook (lua_State *L, int event, int line, 67 | int fTransfer, int nTransfer); 68 | LUAI_FUNC void luaD_hookcall (lua_State *L, CallInfo *ci); 69 | LUAI_FUNC int luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func, 70 | int narg1, int delta); 71 | LUAI_FUNC CallInfo *luaD_precall (lua_State *L, StkId func, int nResults); 72 | LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); 73 | LUAI_FUNC void luaD_callnoyield (lua_State *L, StkId func, int nResults); 74 | LUAI_FUNC int luaD_closeprotected (lua_State *L, ptrdiff_t level, int status); 75 | LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, 76 | ptrdiff_t oldtop, ptrdiff_t ef); 77 | LUAI_FUNC void luaD_poscall (lua_State *L, CallInfo *ci, int nres); 78 | LUAI_FUNC int luaD_reallocstack (lua_State *L, int newsize, int raiseerror); 79 | LUAI_FUNC int luaD_growstack (lua_State *L, int n, int raiseerror); 80 | LUAI_FUNC void luaD_shrinkstack (lua_State *L); 81 | LUAI_FUNC void luaD_inctop (lua_State *L); 82 | 83 | LUAI_FUNC l_noret luaD_throw (lua_State *L, int errcode); 84 | LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); 85 | 86 | #endif 87 | 88 | -------------------------------------------------------------------------------- /liblua/lfunc.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lfunc.h $ 3 | ** Auxiliary functions to manipulate prototypes and closures 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lfunc_h 8 | #define lfunc_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | #define sizeCclosure(n) (cast_int(offsetof(CClosure, upvalue)) + \ 15 | cast_int(sizeof(TValue)) * (n)) 16 | 17 | #define sizeLclosure(n) (cast_int(offsetof(LClosure, upvals)) + \ 18 | cast_int(sizeof(TValue *)) * (n)) 19 | 20 | 21 | /* test whether thread is in 'twups' list */ 22 | #define isintwups(L) (L->twups != L) 23 | 24 | 25 | /* 26 | ** maximum number of upvalues in a closure (both C and Lua). (Value 27 | ** must fit in a VM register.) 28 | */ 29 | #define MAXUPVAL 255 30 | 31 | 32 | #define upisopen(up) ((up)->v.p != &(up)->u.value) 33 | 34 | 35 | #define uplevel(up) check_exp(upisopen(up), cast(StkId, (up)->v.p)) 36 | 37 | 38 | /* 39 | ** maximum number of misses before giving up the cache of closures 40 | ** in prototypes 41 | */ 42 | #define MAXMISS 10 43 | 44 | 45 | 46 | /* special status to close upvalues preserving the top of the stack */ 47 | #define CLOSEKTOP (-1) 48 | 49 | 50 | LUAI_FUNC Proto *luaF_newproto (lua_State *L); 51 | LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nupvals); 52 | LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nupvals); 53 | LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); 54 | LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); 55 | LUAI_FUNC void luaF_newtbcupval (lua_State *L, StkId level); 56 | LUAI_FUNC void luaF_closeupval (lua_State *L, StkId level); 57 | LUAI_FUNC StkId luaF_close (lua_State *L, StkId level, int status, int yy); 58 | LUAI_FUNC void luaF_unlinkupval (UpVal *uv); 59 | LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); 60 | LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, 61 | int pc); 62 | 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /liblua/liblua.rc: -------------------------------------------------------------------------------- 1 |  2 | #include 3 | 4 | VS_VERSION_INFO VERSIONINFO 5 | FILEVERSION 5,4,7,0 6 | PRODUCTVERSION 5,4,7,0 7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 8 | #ifndef _DEBUG 9 | FILEFLAGS 0x00000000L 10 | #else 11 | FILEFLAGS VS_FF_DEBUG 12 | #endif 13 | FILEOS VOS_NT_WINDOWS32 14 | FILETYPE VFT_DLL 15 | FILESUBTYPE VFT2_UNKNOWN 16 | { 17 | BLOCK "StringFileInfo" 18 | { 19 | BLOCK "000004B0" 20 | { 21 | VALUE "CompanyName", "Lua.org, PUC-Rio" 22 | VALUE "FileDescription", "Lua Language Library with Wide Character Patch" 23 | VALUE "FileVersion", "5.4.7" 24 | VALUE "InternalName", "lua54" 25 | VALUE "LegalCopyright", "Copyright (C) 1994-2024 Lua.org, PUC-Rio." 26 | VALUE "OriginalFilename", "lua54.dll" 27 | VALUE "ProductName", "Lua Language" 28 | VALUE "ProductVersion", "5.4.7" 29 | } 30 | } 31 | BLOCK "VarFileInfo" 32 | { 33 | VALUE "Translation", 0x0000, 1200 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /liblua/linit.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: linit.c $ 3 | ** Initialization of libraries for lua.c and other clients 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #define linit_c 9 | #define LUA_LIB 10 | 11 | /* 12 | ** If you embed Lua in your program and need to open the standard 13 | ** libraries, call luaL_openlibs in your program. If you need a 14 | ** different set of libraries, copy this file to your project and edit 15 | ** it to suit your needs. 16 | ** 17 | ** You can also *preload* libraries, so that a later 'require' can 18 | ** open the library, which is already linked to the application. 19 | ** For that, do the following code: 20 | ** 21 | ** luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE); 22 | ** lua_pushcfunction(L, luaopen_modname); 23 | ** lua_setfield(L, -2, modname); 24 | ** lua_pop(L, 1); // remove PRELOAD table 25 | */ 26 | 27 | #include "lprefix.h" 28 | 29 | 30 | #include 31 | 32 | #include "lua.h" 33 | 34 | #include "lualib.h" 35 | #include "lauxlib.h" 36 | 37 | 38 | /* 39 | ** these libs are loaded by lua.c and are readily available to any Lua 40 | ** program 41 | */ 42 | static const luaL_Reg loadedlibs[] = { 43 | {LUA_GNAME, luaopen_base}, 44 | {LUA_LOADLIBNAME, luaopen_package}, 45 | {LUA_COLIBNAME, luaopen_coroutine}, 46 | {LUA_TABLIBNAME, luaopen_table}, 47 | {LUA_IOLIBNAME, luaopen_io}, 48 | {LUA_OSLIBNAME, luaopen_os}, 49 | {LUA_STRLIBNAME, luaopen_string}, 50 | {LUA_MATHLIBNAME, luaopen_math}, 51 | {LUA_UTF8LIBNAME, luaopen_utf8}, 52 | {LUA_DBLIBNAME, luaopen_debug}, 53 | {NULL, NULL} 54 | }; 55 | 56 | 57 | LUALIB_API void luaL_openlibs (lua_State *L) { 58 | const luaL_Reg *lib; 59 | /* "require" functions from 'loadedlibs' and set results to global table */ 60 | for (lib = loadedlibs; lib->func; lib++) { 61 | luaL_requiref(L, lib->name, lib->func, 1); 62 | lua_pop(L, 1); /* remove lib */ 63 | } 64 | } 65 | 66 | -------------------------------------------------------------------------------- /liblua/ljumptab.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ljumptab.h $ 3 | ** Jump Table for the Lua interpreter 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #undef vmdispatch 9 | #undef vmcase 10 | #undef vmbreak 11 | 12 | #define vmdispatch(x) goto *disptab[x]; 13 | 14 | #define vmcase(l) L_##l: 15 | 16 | #define vmbreak vmfetch(); vmdispatch(GET_OPCODE(i)); 17 | 18 | 19 | static const void *const disptab[NUM_OPCODES] = { 20 | 21 | #if 0 22 | ** you can update the following list with this command: 23 | ** 24 | ** sed -n '/^OP_/\!d; s/OP_/\&\&L_OP_/ ; s/,.*/,/ ; s/\/.*// ; p' lopcodes.h 25 | ** 26 | #endif 27 | 28 | &&L_OP_MOVE, 29 | &&L_OP_LOADI, 30 | &&L_OP_LOADF, 31 | &&L_OP_LOADK, 32 | &&L_OP_LOADKX, 33 | &&L_OP_LOADFALSE, 34 | &&L_OP_LFALSESKIP, 35 | &&L_OP_LOADTRUE, 36 | &&L_OP_LOADNIL, 37 | &&L_OP_GETUPVAL, 38 | &&L_OP_SETUPVAL, 39 | &&L_OP_GETTABUP, 40 | &&L_OP_GETTABLE, 41 | &&L_OP_GETI, 42 | &&L_OP_GETFIELD, 43 | &&L_OP_SETTABUP, 44 | &&L_OP_SETTABLE, 45 | &&L_OP_SETI, 46 | &&L_OP_SETFIELD, 47 | &&L_OP_NEWTABLE, 48 | &&L_OP_SELF, 49 | &&L_OP_ADDI, 50 | &&L_OP_ADDK, 51 | &&L_OP_SUBK, 52 | &&L_OP_MULK, 53 | &&L_OP_MODK, 54 | &&L_OP_POWK, 55 | &&L_OP_DIVK, 56 | &&L_OP_IDIVK, 57 | &&L_OP_BANDK, 58 | &&L_OP_BORK, 59 | &&L_OP_BXORK, 60 | &&L_OP_SHRI, 61 | &&L_OP_SHLI, 62 | &&L_OP_ADD, 63 | &&L_OP_SUB, 64 | &&L_OP_MUL, 65 | &&L_OP_MOD, 66 | &&L_OP_POW, 67 | &&L_OP_DIV, 68 | &&L_OP_IDIV, 69 | &&L_OP_BAND, 70 | &&L_OP_BOR, 71 | &&L_OP_BXOR, 72 | &&L_OP_SHL, 73 | &&L_OP_SHR, 74 | &&L_OP_MMBIN, 75 | &&L_OP_MMBINI, 76 | &&L_OP_MMBINK, 77 | &&L_OP_UNM, 78 | &&L_OP_BNOT, 79 | &&L_OP_NOT, 80 | &&L_OP_LEN, 81 | &&L_OP_CONCAT, 82 | &&L_OP_CLOSE, 83 | &&L_OP_TBC, 84 | &&L_OP_JMP, 85 | &&L_OP_EQ, 86 | &&L_OP_LT, 87 | &&L_OP_LE, 88 | &&L_OP_EQK, 89 | &&L_OP_EQI, 90 | &&L_OP_LTI, 91 | &&L_OP_LEI, 92 | &&L_OP_GTI, 93 | &&L_OP_GEI, 94 | &&L_OP_TEST, 95 | &&L_OP_TESTSET, 96 | &&L_OP_CALL, 97 | &&L_OP_TAILCALL, 98 | &&L_OP_RETURN, 99 | &&L_OP_RETURN0, 100 | &&L_OP_RETURN1, 101 | &&L_OP_FORLOOP, 102 | &&L_OP_FORPREP, 103 | &&L_OP_TFORPREP, 104 | &&L_OP_TFORCALL, 105 | &&L_OP_TFORLOOP, 106 | &&L_OP_SETLIST, 107 | &&L_OP_CLOSURE, 108 | &&L_OP_VARARG, 109 | &&L_OP_VARARGPREP, 110 | &&L_OP_EXTRAARG 111 | 112 | }; 113 | -------------------------------------------------------------------------------- /liblua/llex.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: llex.h $ 3 | ** Lexical Analyzer 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef llex_h 8 | #define llex_h 9 | 10 | #include 11 | 12 | #include "lobject.h" 13 | #include "lzio.h" 14 | 15 | 16 | /* 17 | ** Single-char tokens (terminal symbols) are represented by their own 18 | ** numeric code. Other tokens start at the following value. 19 | */ 20 | #define FIRST_RESERVED (UCHAR_MAX + 1) 21 | 22 | 23 | #if !defined(LUA_ENV) 24 | #define LUA_ENV "_ENV" 25 | #endif 26 | 27 | 28 | /* 29 | * WARNING: if you change the order of this enumeration, 30 | * grep "ORDER RESERVED" 31 | */ 32 | enum RESERVED { 33 | /* terminal symbols denoted by reserved words */ 34 | TK_AND = FIRST_RESERVED, TK_BREAK, 35 | TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, 36 | TK_GOTO, TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, 37 | TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, 38 | /* other terminal symbols */ 39 | TK_IDIV, TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, 40 | TK_SHL, TK_SHR, 41 | TK_DBCOLON, TK_EOS, 42 | TK_FLT, TK_INT, TK_NAME, TK_STRING 43 | }; 44 | 45 | /* number of reserved words */ 46 | #define NUM_RESERVED (cast_int(TK_WHILE-FIRST_RESERVED + 1)) 47 | 48 | 49 | typedef union { 50 | lua_Number r; 51 | lua_Integer i; 52 | TString *ts; 53 | } SemInfo; /* semantics information */ 54 | 55 | 56 | typedef struct Token { 57 | int token; 58 | SemInfo seminfo; 59 | } Token; 60 | 61 | 62 | /* state of the lexer plus state of the parser when shared by all 63 | functions */ 64 | typedef struct LexState { 65 | int current; /* current character (charint) */ 66 | int linenumber; /* input line counter */ 67 | int lastline; /* line of last token 'consumed' */ 68 | Token t; /* current token */ 69 | Token lookahead; /* look ahead token */ 70 | struct FuncState *fs; /* current function (parser) */ 71 | struct lua_State *L; 72 | ZIO *z; /* input stream */ 73 | Mbuffer *buff; /* buffer for tokens */ 74 | Table *h; /* to avoid collection/reuse strings */ 75 | struct Dyndata *dyd; /* dynamic structures used by the parser */ 76 | TString *source; /* current source name */ 77 | TString *envn; /* environment variable name */ 78 | } LexState; 79 | 80 | 81 | LUAI_FUNC void luaX_init (lua_State *L); 82 | LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, 83 | TString *source, int firstchar); 84 | LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l); 85 | LUAI_FUNC void luaX_next (LexState *ls); 86 | LUAI_FUNC int luaX_lookahead (LexState *ls); 87 | LUAI_FUNC l_noret luaX_syntaxerror (LexState *ls, const char *s); 88 | LUAI_FUNC const char *luaX_token2str (LexState *ls, int token); 89 | 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /liblua/lmem.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lmem.h $ 3 | ** Interface to Memory Manager 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lmem_h 8 | #define lmem_h 9 | 10 | 11 | #include 12 | 13 | #include "llimits.h" 14 | #include "lua.h" 15 | 16 | 17 | #define luaM_error(L) luaD_throw(L, LUA_ERRMEM) 18 | 19 | 20 | /* 21 | ** This macro tests whether it is safe to multiply 'n' by the size of 22 | ** type 't' without overflows. Because 'e' is always constant, it avoids 23 | ** the runtime division MAX_SIZET/(e). 24 | ** (The macro is somewhat complex to avoid warnings: The 'sizeof' 25 | ** comparison avoids a runtime comparison when overflow cannot occur. 26 | ** The compiler should be able to optimize the real test by itself, but 27 | ** when it does it, it may give a warning about "comparison is always 28 | ** false due to limited range of data type"; the +1 tricks the compiler, 29 | ** avoiding this warning but also this optimization.) 30 | */ 31 | #define luaM_testsize(n,e) \ 32 | (sizeof(n) >= sizeof(size_t) && cast_sizet((n)) + 1 > MAX_SIZET/(e)) 33 | 34 | #define luaM_checksize(L,n,e) \ 35 | (luaM_testsize(n,e) ? luaM_toobig(L) : cast_void(0)) 36 | 37 | 38 | /* 39 | ** Computes the minimum between 'n' and 'MAX_SIZET/sizeof(t)', so that 40 | ** the result is not larger than 'n' and cannot overflow a 'size_t' 41 | ** when multiplied by the size of type 't'. (Assumes that 'n' is an 42 | ** 'int' or 'unsigned int' and that 'int' is not larger than 'size_t'.) 43 | */ 44 | #define luaM_limitN(n,t) \ 45 | ((cast_sizet(n) <= MAX_SIZET/sizeof(t)) ? (n) : \ 46 | cast_uint((MAX_SIZET/sizeof(t)))) 47 | 48 | 49 | /* 50 | ** Arrays of chars do not need any test 51 | */ 52 | #define luaM_reallocvchar(L,b,on,n) \ 53 | cast_charp(luaM_saferealloc_(L, (b), (on)*sizeof(char), (n)*sizeof(char))) 54 | 55 | #define luaM_freemem(L, b, s) luaM_free_(L, (b), (s)) 56 | #define luaM_free(L, b) luaM_free_(L, (b), sizeof(*(b))) 57 | #define luaM_freearray(L, b, n) luaM_free_(L, (b), (n)*sizeof(*(b))) 58 | 59 | #define luaM_new(L,t) cast(t*, luaM_malloc_(L, sizeof(t), 0)) 60 | #define luaM_newvector(L,n,t) cast(t*, luaM_malloc_(L, (n)*sizeof(t), 0)) 61 | #define luaM_newvectorchecked(L,n,t) \ 62 | (luaM_checksize(L,n,sizeof(t)), luaM_newvector(L,n,t)) 63 | 64 | #define luaM_newobject(L,tag,s) luaM_malloc_(L, (s), tag) 65 | 66 | #define luaM_growvector(L,v,nelems,size,t,limit,e) \ 67 | ((v)=cast(t *, luaM_growaux_(L,v,nelems,&(size),sizeof(t), \ 68 | luaM_limitN(limit,t),e))) 69 | 70 | #define luaM_reallocvector(L, v,oldn,n,t) \ 71 | (cast(t *, luaM_realloc_(L, v, cast_sizet(oldn) * sizeof(t), \ 72 | cast_sizet(n) * sizeof(t)))) 73 | 74 | #define luaM_shrinkvector(L,v,size,fs,t) \ 75 | ((v)=cast(t *, luaM_shrinkvector_(L, v, &(size), fs, sizeof(t)))) 76 | 77 | LUAI_FUNC l_noret luaM_toobig (lua_State *L); 78 | 79 | /* not to be called directly */ 80 | LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, 81 | size_t size); 82 | LUAI_FUNC void *luaM_saferealloc_ (lua_State *L, void *block, size_t oldsize, 83 | size_t size); 84 | LUAI_FUNC void luaM_free_ (lua_State *L, void *block, size_t osize); 85 | LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int nelems, 86 | int *size, int size_elem, int limit, 87 | const char *what); 88 | LUAI_FUNC void *luaM_shrinkvector_ (lua_State *L, void *block, int *nelem, 89 | int final_n, int size_elem); 90 | LUAI_FUNC void *luaM_malloc_ (lua_State *L, size_t size, int tag); 91 | 92 | #endif 93 | 94 | -------------------------------------------------------------------------------- /liblua/lopnames.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lopnames.h $ 3 | ** Opcode names 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #if !defined(lopnames_h) 8 | #define lopnames_h 9 | 10 | #include 11 | 12 | 13 | /* ORDER OP */ 14 | 15 | static const char *const opnames[] = { 16 | "MOVE", 17 | "LOADI", 18 | "LOADF", 19 | "LOADK", 20 | "LOADKX", 21 | "LOADFALSE", 22 | "LFALSESKIP", 23 | "LOADTRUE", 24 | "LOADNIL", 25 | "GETUPVAL", 26 | "SETUPVAL", 27 | "GETTABUP", 28 | "GETTABLE", 29 | "GETI", 30 | "GETFIELD", 31 | "SETTABUP", 32 | "SETTABLE", 33 | "SETI", 34 | "SETFIELD", 35 | "NEWTABLE", 36 | "SELF", 37 | "ADDI", 38 | "ADDK", 39 | "SUBK", 40 | "MULK", 41 | "MODK", 42 | "POWK", 43 | "DIVK", 44 | "IDIVK", 45 | "BANDK", 46 | "BORK", 47 | "BXORK", 48 | "SHRI", 49 | "SHLI", 50 | "ADD", 51 | "SUB", 52 | "MUL", 53 | "MOD", 54 | "POW", 55 | "DIV", 56 | "IDIV", 57 | "BAND", 58 | "BOR", 59 | "BXOR", 60 | "SHL", 61 | "SHR", 62 | "MMBIN", 63 | "MMBINI", 64 | "MMBINK", 65 | "UNM", 66 | "BNOT", 67 | "NOT", 68 | "LEN", 69 | "CONCAT", 70 | "CLOSE", 71 | "TBC", 72 | "JMP", 73 | "EQ", 74 | "LT", 75 | "LE", 76 | "EQK", 77 | "EQI", 78 | "LTI", 79 | "LEI", 80 | "GTI", 81 | "GEI", 82 | "TEST", 83 | "TESTSET", 84 | "CALL", 85 | "TAILCALL", 86 | "RETURN", 87 | "RETURN0", 88 | "RETURN1", 89 | "FORLOOP", 90 | "FORPREP", 91 | "TFORPREP", 92 | "TFORCALL", 93 | "TFORLOOP", 94 | "SETLIST", 95 | "CLOSURE", 96 | "VARARG", 97 | "VARARGPREP", 98 | "EXTRAARG", 99 | NULL 100 | }; 101 | 102 | #endif 103 | 104 | -------------------------------------------------------------------------------- /liblua/lprefix.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lprefix.h $ 3 | ** Definitions for Lua code that must come before any other header file 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lprefix_h 8 | #define lprefix_h 9 | 10 | 11 | /* 12 | ** Allows POSIX/XSI stuff 13 | */ 14 | #if !defined(LUA_USE_C89) /* { */ 15 | 16 | #if !defined(_XOPEN_SOURCE) 17 | #define _XOPEN_SOURCE 600 18 | #elif _XOPEN_SOURCE == 0 19 | #undef _XOPEN_SOURCE /* use -D_XOPEN_SOURCE=0 to undefine it */ 20 | #endif 21 | 22 | /* 23 | ** Allows manipulation of large files in gcc and some other compilers 24 | */ 25 | #if !defined(LUA_32BITS) && !defined(_FILE_OFFSET_BITS) 26 | #define _LARGEFILE_SOURCE 1 27 | #define _FILE_OFFSET_BITS 64 28 | #endif 29 | 30 | #endif /* } */ 31 | 32 | 33 | /* 34 | ** Windows stuff 35 | */ 36 | #if defined(_WIN32) /* { */ 37 | 38 | #if !defined(_CRT_SECURE_NO_WARNINGS) 39 | #define _CRT_SECURE_NO_WARNINGS /* avoid warnings about ISO C functions */ 40 | #endif 41 | 42 | #endif /* } */ 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /liblua/lstring.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lstring.h $ 3 | ** String table (keep all strings handled by Lua) 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lstring_h 8 | #define lstring_h 9 | 10 | #include "lgc.h" 11 | #include "lobject.h" 12 | #include "lstate.h" 13 | 14 | 15 | /* 16 | ** Memory-allocation error message must be preallocated (it cannot 17 | ** be created after memory is exhausted) 18 | */ 19 | #define MEMERRMSG "not enough memory" 20 | 21 | 22 | /* 23 | ** Size of a TString: Size of the header plus space for the string 24 | ** itself (including final '\0'). 25 | */ 26 | #define sizelstring(l) (offsetof(TString, contents) + ((l) + 1) * sizeof(char)) 27 | 28 | #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ 29 | (sizeof(s)/sizeof(char))-1)) 30 | 31 | 32 | /* 33 | ** test whether a string is a reserved word 34 | */ 35 | #define isreserved(s) ((s)->tt == LUA_VSHRSTR && (s)->extra > 0) 36 | 37 | 38 | /* 39 | ** equality for short strings, which are always internalized 40 | */ 41 | #define eqshrstr(a,b) check_exp((a)->tt == LUA_VSHRSTR, (a) == (b)) 42 | 43 | 44 | LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed); 45 | LUAI_FUNC unsigned int luaS_hashlongstr (TString *ts); 46 | LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b); 47 | LUAI_FUNC void luaS_resize (lua_State *L, int newsize); 48 | LUAI_FUNC void luaS_clearcache (global_State *g); 49 | LUAI_FUNC void luaS_init (lua_State *L); 50 | LUAI_FUNC void luaS_remove (lua_State *L, TString *ts); 51 | LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, int nuvalue); 52 | LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); 53 | LUAI_FUNC TString *luaS_new (lua_State *L, const char *str); 54 | LUAI_FUNC TString *luaS_createlngstrobj (lua_State *L, size_t l); 55 | 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /liblua/ltable.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ltable.h $ 3 | ** Lua tables (hash) 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ltable_h 8 | #define ltable_h 9 | 10 | #include "lobject.h" 11 | 12 | 13 | #define gnode(t,i) (&(t)->node[i]) 14 | #define gval(n) (&(n)->i_val) 15 | #define gnext(n) ((n)->u.next) 16 | 17 | 18 | /* 19 | ** Clear all bits of fast-access metamethods, which means that the table 20 | ** may have any of these metamethods. (First access that fails after the 21 | ** clearing will set the bit again.) 22 | */ 23 | #define invalidateTMcache(t) ((t)->flags &= ~maskflags) 24 | 25 | 26 | /* true when 't' is using 'dummynode' as its hash part */ 27 | #define isdummy(t) ((t)->lastfree == NULL) 28 | 29 | 30 | /* allocated size for hash nodes */ 31 | #define allocsizenode(t) (isdummy(t) ? 0 : sizenode(t)) 32 | 33 | 34 | /* returns the Node, given the value of a table entry */ 35 | #define nodefromval(v) cast(Node *, (v)) 36 | 37 | 38 | LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key); 39 | LUAI_FUNC void luaH_setint (lua_State *L, Table *t, lua_Integer key, 40 | TValue *value); 41 | LUAI_FUNC const TValue *luaH_getshortstr (Table *t, TString *key); 42 | LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); 43 | LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); 44 | LUAI_FUNC void luaH_set (lua_State *L, Table *t, const TValue *key, 45 | TValue *value); 46 | LUAI_FUNC void luaH_finishset (lua_State *L, Table *t, const TValue *key, 47 | const TValue *slot, TValue *value); 48 | LUAI_FUNC Table *luaH_new (lua_State *L); 49 | LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned int nasize, 50 | unsigned int nhsize); 51 | LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize); 52 | LUAI_FUNC void luaH_free (lua_State *L, Table *t); 53 | LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); 54 | LUAI_FUNC lua_Unsigned luaH_getn (Table *t); 55 | LUAI_FUNC unsigned int luaH_realasize (const Table *t); 56 | 57 | 58 | #if defined(LUA_DEBUG) 59 | LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); 60 | #endif 61 | 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /liblua/ltm.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ltm.h $ 3 | ** Tag methods 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ltm_h 8 | #define ltm_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | /* 15 | * WARNING: if you change the order of this enumeration, 16 | * grep "ORDER TM" and "ORDER OP" 17 | */ 18 | typedef enum { 19 | TM_INDEX, 20 | TM_NEWINDEX, 21 | TM_GC, 22 | TM_MODE, 23 | TM_LEN, 24 | TM_EQ, /* last tag method with fast access */ 25 | TM_ADD, 26 | TM_SUB, 27 | TM_MUL, 28 | TM_MOD, 29 | TM_POW, 30 | TM_DIV, 31 | TM_IDIV, 32 | TM_BAND, 33 | TM_BOR, 34 | TM_BXOR, 35 | TM_SHL, 36 | TM_SHR, 37 | TM_UNM, 38 | TM_BNOT, 39 | TM_LT, 40 | TM_LE, 41 | TM_CONCAT, 42 | TM_CALL, 43 | TM_CLOSE, 44 | TM_N /* number of elements in the enum */ 45 | } TMS; 46 | 47 | 48 | /* 49 | ** Mask with 1 in all fast-access methods. A 1 in any of these bits 50 | ** in the flag of a (meta)table means the metatable does not have the 51 | ** corresponding metamethod field. (Bit 7 of the flag is used for 52 | ** 'isrealasize'.) 53 | */ 54 | #define maskflags (~(~0u << (TM_EQ + 1))) 55 | 56 | 57 | /* 58 | ** Test whether there is no tagmethod. 59 | ** (Because tagmethods use raw accesses, the result may be an "empty" nil.) 60 | */ 61 | #define notm(tm) ttisnil(tm) 62 | 63 | 64 | #define gfasttm(g,et,e) ((et) == NULL ? NULL : \ 65 | ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) 66 | 67 | #define fasttm(l,et,e) gfasttm(G(l), et, e) 68 | 69 | #define ttypename(x) luaT_typenames_[(x) + 1] 70 | 71 | LUAI_DDEC(const char *const luaT_typenames_[LUA_TOTALTYPES];) 72 | 73 | 74 | LUAI_FUNC const char *luaT_objtypename (lua_State *L, const TValue *o); 75 | 76 | LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); 77 | LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, 78 | TMS event); 79 | LUAI_FUNC void luaT_init (lua_State *L); 80 | 81 | LUAI_FUNC void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1, 82 | const TValue *p2, const TValue *p3); 83 | LUAI_FUNC void luaT_callTMres (lua_State *L, const TValue *f, 84 | const TValue *p1, const TValue *p2, StkId p3); 85 | LUAI_FUNC void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, 86 | StkId res, TMS event); 87 | LUAI_FUNC void luaT_tryconcatTM (lua_State *L); 88 | LUAI_FUNC void luaT_trybinassocTM (lua_State *L, const TValue *p1, 89 | const TValue *p2, int inv, StkId res, TMS event); 90 | LUAI_FUNC void luaT_trybiniTM (lua_State *L, const TValue *p1, lua_Integer i2, 91 | int inv, StkId res, TMS event); 92 | LUAI_FUNC int luaT_callorderTM (lua_State *L, const TValue *p1, 93 | const TValue *p2, TMS event); 94 | LUAI_FUNC int luaT_callorderiTM (lua_State *L, const TValue *p1, int v2, 95 | int inv, int isfloat, TMS event); 96 | 97 | LUAI_FUNC void luaT_adjustvarargs (lua_State *L, int nfixparams, 98 | struct CallInfo *ci, const Proto *p); 99 | LUAI_FUNC void luaT_getvarargs (lua_State *L, struct CallInfo *ci, 100 | StkId where, int wanted); 101 | 102 | 103 | #endif 104 | -------------------------------------------------------------------------------- /liblua/lu8w.h: -------------------------------------------------------------------------------- 1 | /* 2 | Lua with UTF-8 Wrapper for Windows 3 | 4 | Released under the MIT license 5 | Copyright (C) 2014-2023 SASAKI Nobuyuki 6 | */ 7 | 8 | #ifndef U8W_H 9 | #define U8W_H 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | /* from utf-8 to utf-16 */ 16 | wchar_t *u8stows(const char *s); /* call free function to deallocate */ 17 | /* from utf-16 to utf-8 */ 18 | char *u8wstos(const wchar_t *s); /* call free function to deallocate */ 19 | 20 | char **make_u8argv(int argc, wchar_t **wargv); 21 | void free_u8argv(int argc, char **argv); 22 | 23 | DWORD u8GetModuleFileName(HMODULE hModule, LPSTR lpFilename, DWORD nSize); 24 | DWORD u8FormatMessage(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, 25 | LPSTR lpBuffer, DWORD nSize, va_list *Arguments); 26 | HMODULE u8LoadLibraryEx(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags); 27 | 28 | FILE *u8fopen(const char *fname, const char *mode); 29 | FILE *u8freopen(const char *fname, const char *mode, FILE *oldfp); 30 | FILE *u8popen(const char *command, const char *mode); 31 | int u8fprintf(FILE *file, const char *format, ...); 32 | int u8printf(const char *format, ...); 33 | char *u8fgets(char *buf, int len, FILE *file); 34 | int u8fputs(const char *buf, FILE *file); 35 | char *u8getenv(const char *varname); /* call free function to deallocate */ 36 | char *u8tmpnam(char *str); 37 | int u8system(const char *command); 38 | int u8remove(const char *fname); 39 | int u8rename(const char *oldfname, const char *newfname); 40 | size_t u8strftime(char *buf, size_t len, const char *format, const struct tm *ptm); 41 | 42 | #if !defined(lu8w_c) 43 | #if defined(LUA_U8W) || defined(LUA_CORE) || defined(LUA_LIB) || defined(lua_c) || defined(luac_c) 44 | 45 | #undef LoadString 46 | #define GetModuleFileNameA u8GetModuleFileName 47 | #define FormatMessageA u8FormatMessage 48 | #define LoadLibraryExA u8LoadLibraryEx 49 | 50 | #define fopen u8fopen 51 | #define freopen u8freopen 52 | #define _popen u8popen 53 | #define fprintf u8fprintf 54 | #define printf u8printf 55 | #define fgets u8fgets 56 | #define fputs u8fputs 57 | #define getenv u8getenv 58 | #define tmpnam u8tmpnam 59 | #define system u8system 60 | #define remove u8remove 61 | #define rename u8rename 62 | #define strftime u8strftime 63 | 64 | /* in lauxlib.h */ 65 | /* print a string */ 66 | #define lua_writestring(s,l) u8fprintf(stdout, "%s", s) 67 | 68 | /* in loslib.c */ 69 | /* strftime function options for Visual Studio 2015-2022 */ 70 | #define LUA_STRFTIMEOPTIONS \ 71 | "aAbBcCdDeFgGhHIjmMnprRStTuUVwWxXyYzZ%" \ 72 | "||" "#a#A#b#B#g#G#h#n#p#t#u#w#X#z#Z#%" \ 73 | "#c" \ 74 | "#x" \ 75 | "#d#D#e#F#H#I#j#m#M#r#R#S#T#U#V#W#y#Y" 76 | 77 | #endif /* LUA_U8W or LUA_CORE or LUA_LIB or lua_c or luac_c */ 78 | #endif /* not lu8w_c */ 79 | 80 | #endif /* U8W_H */ 81 | -------------------------------------------------------------------------------- /liblua/lua.hpp: -------------------------------------------------------------------------------- 1 | // lua.hpp 2 | // Lua header files for C++ 3 | // <> not supplied automatically because Lua also compiles as C++ 4 | 5 | extern "C" { 6 | #include "lua.h" 7 | #include "lualib.h" 8 | #include "lauxlib.h" 9 | } 10 | -------------------------------------------------------------------------------- /liblua/lualib.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lualib.h $ 3 | ** Lua standard libraries 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #ifndef lualib_h 9 | #define lualib_h 10 | 11 | #include "lua.h" 12 | 13 | 14 | /* version suffix for environment variable names */ 15 | #define LUA_VERSUFFIX "_" LUA_VERSION_MAJOR "_" LUA_VERSION_MINOR 16 | 17 | 18 | LUAMOD_API int (luaopen_base) (lua_State *L); 19 | 20 | #define LUA_COLIBNAME "coroutine" 21 | LUAMOD_API int (luaopen_coroutine) (lua_State *L); 22 | 23 | #define LUA_TABLIBNAME "table" 24 | LUAMOD_API int (luaopen_table) (lua_State *L); 25 | 26 | #define LUA_IOLIBNAME "io" 27 | LUAMOD_API int (luaopen_io) (lua_State *L); 28 | 29 | #define LUA_OSLIBNAME "os" 30 | LUAMOD_API int (luaopen_os) (lua_State *L); 31 | 32 | #define LUA_STRLIBNAME "string" 33 | LUAMOD_API int (luaopen_string) (lua_State *L); 34 | 35 | #define LUA_UTF8LIBNAME "utf8" 36 | LUAMOD_API int (luaopen_utf8) (lua_State *L); 37 | 38 | #define LUA_MATHLIBNAME "math" 39 | LUAMOD_API int (luaopen_math) (lua_State *L); 40 | 41 | #define LUA_DBLIBNAME "debug" 42 | LUAMOD_API int (luaopen_debug) (lua_State *L); 43 | 44 | #define LUA_LOADLIBNAME "package" 45 | LUAMOD_API int (luaopen_package) (lua_State *L); 46 | 47 | 48 | /* open all previous libraries */ 49 | LUALIB_API void (luaL_openlibs) (lua_State *L); 50 | 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /liblua/lundump.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lundump.h $ 3 | ** load precompiled Lua chunks 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lundump_h 8 | #define lundump_h 9 | 10 | #include "llimits.h" 11 | #include "lobject.h" 12 | #include "lzio.h" 13 | 14 | 15 | /* data to catch conversion errors */ 16 | #define LUAC_DATA "\x19\x93\r\n\x1a\n" 17 | 18 | #define LUAC_INT 0x5678 19 | #define LUAC_NUM cast_num(370.5) 20 | 21 | /* 22 | ** Encode major-minor version in one byte, one nibble for each 23 | */ 24 | #define LUAC_VERSION (((LUA_VERSION_NUM / 100) * 16) + LUA_VERSION_NUM % 100) 25 | 26 | #define LUAC_FORMAT 0 /* this is the official format */ 27 | 28 | /* load one chunk; from lundump.c */ 29 | LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name); 30 | 31 | /* dump one chunk; from ldump.c */ 32 | LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, 33 | void* data, int strip); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /liblua/lzio.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lzio.c $ 3 | ** Buffered streams 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #define lzio_c 8 | #define LUA_CORE 9 | 10 | #include "lprefix.h" 11 | 12 | 13 | #include 14 | 15 | #include "lua.h" 16 | 17 | #include "llimits.h" 18 | #include "lmem.h" 19 | #include "lstate.h" 20 | #include "lzio.h" 21 | 22 | 23 | int luaZ_fill (ZIO *z) { 24 | size_t size; 25 | lua_State *L = z->L; 26 | const char *buff; 27 | lua_unlock(L); 28 | buff = z->reader(L, z->data, &size); 29 | lua_lock(L); 30 | if (buff == NULL || size == 0) 31 | return EOZ; 32 | z->n = size - 1; /* discount char being returned */ 33 | z->p = buff; 34 | return cast_uchar(*(z->p++)); 35 | } 36 | 37 | 38 | void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) { 39 | z->L = L; 40 | z->reader = reader; 41 | z->data = data; 42 | z->n = 0; 43 | z->p = NULL; 44 | } 45 | 46 | 47 | /* --------------------------------------------------------------- read --- */ 48 | size_t luaZ_read (ZIO *z, void *b, size_t n) { 49 | while (n) { 50 | size_t m; 51 | if (z->n == 0) { /* no bytes in buffer? */ 52 | if (luaZ_fill(z) == EOZ) /* try to read more */ 53 | return n; /* no more input; return number of missing bytes */ 54 | else { 55 | z->n++; /* luaZ_fill consumed first byte; put it back */ 56 | z->p--; 57 | } 58 | } 59 | m = (n <= z->n) ? n : z->n; /* min. between n and z->n */ 60 | memcpy(b, z->p, m); 61 | z->n -= m; 62 | z->p += m; 63 | b = (char *)b + m; 64 | n -= m; 65 | } 66 | return 0; 67 | } 68 | 69 | -------------------------------------------------------------------------------- /liblua/lzio.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lzio.h $ 3 | ** Buffered streams 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #ifndef lzio_h 9 | #define lzio_h 10 | 11 | #include "lua.h" 12 | 13 | #include "lmem.h" 14 | 15 | 16 | #define EOZ (-1) /* end of stream */ 17 | 18 | typedef struct Zio ZIO; 19 | 20 | #define zgetc(z) (((z)->n--)>0 ? cast_uchar(*(z)->p++) : luaZ_fill(z)) 21 | 22 | 23 | typedef struct Mbuffer { 24 | char *buffer; 25 | size_t n; 26 | size_t buffsize; 27 | } Mbuffer; 28 | 29 | #define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) 30 | 31 | #define luaZ_buffer(buff) ((buff)->buffer) 32 | #define luaZ_sizebuffer(buff) ((buff)->buffsize) 33 | #define luaZ_bufflen(buff) ((buff)->n) 34 | 35 | #define luaZ_buffremove(buff,i) ((buff)->n -= (i)) 36 | #define luaZ_resetbuffer(buff) ((buff)->n = 0) 37 | 38 | 39 | #define luaZ_resizebuffer(L, buff, size) \ 40 | ((buff)->buffer = luaM_reallocvchar(L, (buff)->buffer, \ 41 | (buff)->buffsize, size), \ 42 | (buff)->buffsize = size) 43 | 44 | #define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) 45 | 46 | 47 | LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, 48 | void *data); 49 | LUAI_FUNC size_t luaZ_read (ZIO* z, void *b, size_t n); /* read next n bytes */ 50 | 51 | 52 | 53 | /* --------- Private Part ------------------ */ 54 | 55 | struct Zio { 56 | size_t n; /* bytes still unread */ 57 | const char *p; /* current position in buffer */ 58 | lua_Reader reader; /* reader function */ 59 | void *data; /* additional data */ 60 | lua_State *L; /* Lua state (for reader) */ 61 | }; 62 | 63 | 64 | LUAI_FUNC int luaZ_fill (ZIO *z); 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /liblua/pch.c: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /liblua/pch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | 5 | #include "lprefix.h" 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include 24 | #include 25 | -------------------------------------------------------------------------------- /libz/compress.c: -------------------------------------------------------------------------------- 1 | /* compress.c -- compress a memory buffer 2 | * Copyright (C) 1995-2005, 2014, 2016 Jean-loup Gailly, Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #define ZLIB_INTERNAL 9 | #include "zlib.h" 10 | 11 | /* =========================================================================== 12 | Compresses the source buffer into the destination buffer. The level 13 | parameter has the same meaning as in deflateInit. sourceLen is the byte 14 | length of the source buffer. Upon entry, destLen is the total size of the 15 | destination buffer, which must be at least 0.1% larger than sourceLen plus 16 | 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. 17 | 18 | compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough 19 | memory, Z_BUF_ERROR if there was not enough room in the output buffer, 20 | Z_STREAM_ERROR if the level parameter is invalid. 21 | */ 22 | int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source, 23 | uLong sourceLen, int level) { 24 | z_stream stream; 25 | int err; 26 | const uInt max = (uInt)-1; 27 | uLong left; 28 | 29 | left = *destLen; 30 | *destLen = 0; 31 | 32 | stream.zalloc = (alloc_func)0; 33 | stream.zfree = (free_func)0; 34 | stream.opaque = (voidpf)0; 35 | 36 | err = deflateInit(&stream, level); 37 | if (err != Z_OK) return err; 38 | 39 | stream.next_out = dest; 40 | stream.avail_out = 0; 41 | stream.next_in = (z_const Bytef *)source; 42 | stream.avail_in = 0; 43 | 44 | do { 45 | if (stream.avail_out == 0) { 46 | stream.avail_out = left > (uLong)max ? max : (uInt)left; 47 | left -= stream.avail_out; 48 | } 49 | if (stream.avail_in == 0) { 50 | stream.avail_in = sourceLen > (uLong)max ? max : (uInt)sourceLen; 51 | sourceLen -= stream.avail_in; 52 | } 53 | err = deflate(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH); 54 | } while (err == Z_OK); 55 | 56 | *destLen = stream.total_out; 57 | deflateEnd(&stream); 58 | return err == Z_STREAM_END ? Z_OK : err; 59 | } 60 | 61 | /* =========================================================================== 62 | */ 63 | int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source, 64 | uLong sourceLen) { 65 | return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); 66 | } 67 | 68 | /* =========================================================================== 69 | If the default memLevel or windowBits for deflateInit() is changed, then 70 | this function needs to be updated. 71 | */ 72 | uLong ZEXPORT compressBound(uLong sourceLen) { 73 | return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 74 | (sourceLen >> 25) + 13; 75 | } 76 | -------------------------------------------------------------------------------- /libz/gzclose.c: -------------------------------------------------------------------------------- 1 | /* gzclose.c -- zlib gzclose() function 2 | * Copyright (C) 2004, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | #include "gzguts.h" 7 | 8 | /* gzclose() is in a separate file so that it is linked in only if it is used. 9 | That way the other gzclose functions can be used instead to avoid linking in 10 | unneeded compression or decompression routines. */ 11 | int ZEXPORT gzclose(gzFile file) { 12 | #ifndef NO_GZCOMPRESS 13 | gz_statep state; 14 | 15 | if (file == NULL) 16 | return Z_STREAM_ERROR; 17 | state = (gz_statep)file; 18 | 19 | return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); 20 | #else 21 | return gzclose_r(file); 22 | #endif 23 | } 24 | -------------------------------------------------------------------------------- /libz/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start); 12 | -------------------------------------------------------------------------------- /libz/inftrees.h: -------------------------------------------------------------------------------- 1 | /* inftrees.h -- header to use inftrees.c 2 | * Copyright (C) 1995-2005, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | /* Structure for decoding tables. Each entry provides either the 12 | information needed to do the operation requested by the code that 13 | indexed that table entry, or it provides a pointer to another 14 | table that indexes more bits of the code. op indicates whether 15 | the entry is a pointer to another table, a literal, a length or 16 | distance, an end-of-block, or an invalid code. For a table 17 | pointer, the low four bits of op is the number of index bits of 18 | that table. For a length or distance, the low four bits of op 19 | is the number of extra bits to get after the code. bits is 20 | the number of bits in this code or part of the code to drop off 21 | of the bit buffer. val is the actual byte to output in the case 22 | of a literal, the base length or distance, or the offset from 23 | the current table to the next table. Each entry is four bytes. */ 24 | typedef struct { 25 | unsigned char op; /* operation, extra bits, table bits */ 26 | unsigned char bits; /* bits in this part of the code */ 27 | unsigned short val; /* offset in table or code value */ 28 | } code; 29 | 30 | /* op values as set by inflate_table(): 31 | 00000000 - literal 32 | 0000tttt - table link, tttt != 0 is the number of table index bits 33 | 0001eeee - length or distance, eeee is the number of extra bits 34 | 01100000 - end of block 35 | 01000000 - invalid code 36 | */ 37 | 38 | /* Maximum size of the dynamic table. The maximum number of code structures is 39 | 1444, which is the sum of 852 for literal/length codes and 592 for distance 40 | codes. These values were found by exhaustive searches using the program 41 | examples/enough.c found in the zlib distribution. The arguments to that 42 | program are the number of symbols, the initial root table size, and the 43 | maximum bit length of a code. "enough 286 9 15" for literal/length codes 44 | returns 852, and "enough 30 6 15" for distance codes returns 592. The 45 | initial root table size (9 or 6) is found in the fifth argument of the 46 | inflate_table() calls in inflate.c and infback.c. If the root table size is 47 | changed, then these maximum sizes would be need to be recalculated and 48 | updated. */ 49 | #define ENOUGH_LENS 852 50 | #define ENOUGH_DISTS 592 51 | #define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS) 52 | 53 | /* Type of code to build for inflate_table() */ 54 | typedef enum { 55 | CODES, 56 | LENS, 57 | DISTS 58 | } codetype; 59 | 60 | int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens, 61 | unsigned codes, code FAR * FAR *table, 62 | unsigned FAR *bits, unsigned short FAR *work); 63 | -------------------------------------------------------------------------------- /libz/libz.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | Header Files 38 | 39 | 40 | Header Files 41 | 42 | 43 | Header Files 44 | 45 | 46 | Header Files 47 | 48 | 49 | Header Files 50 | 51 | 52 | Header Files 53 | 54 | 55 | 56 | 57 | Source Files 58 | 59 | 60 | Source Files 61 | 62 | 63 | Source Files 64 | 65 | 66 | Source Files 67 | 68 | 69 | Source Files 70 | 71 | 72 | Source Files 73 | 74 | 75 | Source Files 76 | 77 | 78 | Source Files 79 | 80 | 81 | Source Files 82 | 83 | 84 | Source Files 85 | 86 | 87 | Source Files 88 | 89 | 90 | Source Files 91 | 92 | 93 | Source Files 94 | 95 | 96 | Source Files 97 | 98 | 99 | Source Files 100 | 101 | 102 | Source Files 103 | 104 | 105 | 106 | 107 | Resource Files 108 | 109 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /libz/pch.c: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /libz/pch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | -------------------------------------------------------------------------------- /libz/uncompr.c: -------------------------------------------------------------------------------- 1 | /* uncompr.c -- decompress a memory buffer 2 | * Copyright (C) 1995-2003, 2010, 2014, 2016 Jean-loup Gailly, Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #define ZLIB_INTERNAL 9 | #include "zlib.h" 10 | 11 | /* =========================================================================== 12 | Decompresses the source buffer into the destination buffer. *sourceLen is 13 | the byte length of the source buffer. Upon entry, *destLen is the total size 14 | of the destination buffer, which must be large enough to hold the entire 15 | uncompressed data. (The size of the uncompressed data must have been saved 16 | previously by the compressor and transmitted to the decompressor by some 17 | mechanism outside the scope of this compression library.) Upon exit, 18 | *destLen is the size of the decompressed data and *sourceLen is the number 19 | of source bytes consumed. Upon return, source + *sourceLen points to the 20 | first unused input byte. 21 | 22 | uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough 23 | memory, Z_BUF_ERROR if there was not enough room in the output buffer, or 24 | Z_DATA_ERROR if the input data was corrupted, including if the input data is 25 | an incomplete zlib stream. 26 | */ 27 | int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen, const Bytef *source, 28 | uLong *sourceLen) { 29 | z_stream stream; 30 | int err; 31 | const uInt max = (uInt)-1; 32 | uLong len, left; 33 | Byte buf[1]; /* for detection of incomplete stream when *destLen == 0 */ 34 | 35 | len = *sourceLen; 36 | if (*destLen) { 37 | left = *destLen; 38 | *destLen = 0; 39 | } 40 | else { 41 | left = 1; 42 | dest = buf; 43 | } 44 | 45 | stream.next_in = (z_const Bytef *)source; 46 | stream.avail_in = 0; 47 | stream.zalloc = (alloc_func)0; 48 | stream.zfree = (free_func)0; 49 | stream.opaque = (voidpf)0; 50 | 51 | err = inflateInit(&stream); 52 | if (err != Z_OK) return err; 53 | 54 | stream.next_out = dest; 55 | stream.avail_out = 0; 56 | 57 | do { 58 | if (stream.avail_out == 0) { 59 | stream.avail_out = left > (uLong)max ? max : (uInt)left; 60 | left -= stream.avail_out; 61 | } 62 | if (stream.avail_in == 0) { 63 | stream.avail_in = len > (uLong)max ? max : (uInt)len; 64 | len -= stream.avail_in; 65 | } 66 | err = inflate(&stream, Z_NO_FLUSH); 67 | } while (err == Z_OK); 68 | 69 | *sourceLen -= len + stream.avail_in; 70 | if (dest != buf) 71 | *destLen = stream.total_out; 72 | else if (stream.total_out && err == Z_BUF_ERROR) 73 | left = 1; 74 | 75 | inflateEnd(&stream); 76 | return err == Z_STREAM_END ? Z_OK : 77 | err == Z_NEED_DICT ? Z_DATA_ERROR : 78 | err == Z_BUF_ERROR && left + stream.avail_out ? Z_DATA_ERROR : 79 | err; 80 | } 81 | 82 | int ZEXPORT uncompress(Bytef *dest, uLongf *destLen, const Bytef *source, 83 | uLong sourceLen) { 84 | return uncompress2(dest, destLen, source, &sourceLen); 85 | } 86 | -------------------------------------------------------------------------------- /libz/zlib.def: -------------------------------------------------------------------------------- 1 | ; zlib data compression library 2 | EXPORTS 3 | ; basic functions 4 | zlibVersion 5 | deflate 6 | deflateEnd 7 | inflate 8 | inflateEnd 9 | ; advanced functions 10 | deflateSetDictionary 11 | deflateGetDictionary 12 | deflateCopy 13 | deflateReset 14 | deflateParams 15 | deflateTune 16 | deflateBound 17 | deflatePending 18 | deflatePrime 19 | deflateSetHeader 20 | inflateSetDictionary 21 | inflateGetDictionary 22 | inflateSync 23 | inflateCopy 24 | inflateReset 25 | inflateReset2 26 | inflatePrime 27 | inflateMark 28 | inflateGetHeader 29 | inflateBack 30 | inflateBackEnd 31 | zlibCompileFlags 32 | ; utility functions 33 | compress 34 | compress2 35 | compressBound 36 | uncompress 37 | uncompress2 38 | gzopen 39 | gzdopen 40 | gzbuffer 41 | gzsetparams 42 | gzread 43 | gzfread 44 | gzwrite 45 | gzfwrite 46 | gzprintf 47 | gzvprintf 48 | gzputs 49 | gzgets 50 | gzputc 51 | gzgetc 52 | gzungetc 53 | gzflush 54 | gzseek 55 | gzrewind 56 | gztell 57 | gzoffset 58 | gzeof 59 | gzdirect 60 | gzclose 61 | gzclose_r 62 | gzclose_w 63 | gzerror 64 | gzclearerr 65 | ; large file functions 66 | gzopen64 67 | gzseek64 68 | gztell64 69 | gzoffset64 70 | adler32_combine64 71 | crc32_combine64 72 | crc32_combine_gen64 73 | ; checksum functions 74 | adler32 75 | adler32_z 76 | crc32 77 | crc32_z 78 | adler32_combine 79 | crc32_combine 80 | crc32_combine_gen 81 | crc32_combine_op 82 | ; various hacks, don't look :) 83 | deflateInit_ 84 | deflateInit2_ 85 | inflateInit_ 86 | inflateInit2_ 87 | inflateBackInit_ 88 | gzgetc_ 89 | zError 90 | inflateSyncPoint 91 | get_crc_table 92 | inflateUndermine 93 | inflateValidate 94 | inflateCodesUsed 95 | inflateResetKeep 96 | deflateResetKeep 97 | gzopen_w 98 | -------------------------------------------------------------------------------- /libz/zlib1.rc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "zlib.h" 3 | 4 | #ifdef GCC_WINDRES 5 | VS_VERSION_INFO VERSIONINFO 6 | #else 7 | VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE 8 | #endif 9 | FILEVERSION ZLIB_VER_MAJOR,ZLIB_VER_MINOR,ZLIB_VER_REVISION,0 10 | PRODUCTVERSION ZLIB_VER_MAJOR,ZLIB_VER_MINOR,ZLIB_VER_REVISION,0 11 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 12 | #ifdef _DEBUG 13 | FILEFLAGS 1 14 | #else 15 | FILEFLAGS 0 16 | #endif 17 | FILEOS VOS__WINDOWS32 18 | FILETYPE VFT_DLL 19 | FILESUBTYPE 0 // not used 20 | BEGIN 21 | BLOCK "StringFileInfo" 22 | BEGIN 23 | BLOCK "040904E4" 24 | //language ID = U.S. English, char set = Windows, Multilingual 25 | BEGIN 26 | VALUE "FileDescription", "zlib data compression library\0" 27 | VALUE "FileVersion", ZLIB_VERSION "\0" 28 | VALUE "InternalName", "zlib1.dll\0" 29 | VALUE "LegalCopyright", "(C) 1995-2024 Jean-loup Gailly & Mark Adler\0" 30 | VALUE "OriginalFilename", "zlib1.dll\0" 31 | VALUE "ProductName", "zlib\0" 32 | VALUE "ProductVersion", ZLIB_VERSION "\0" 33 | VALUE "Comments", "For more information visit http://www.zlib.net/\0" 34 | END 35 | END 36 | BLOCK "VarFileInfo" 37 | BEGIN 38 | VALUE "Translation", 0x0409, 1252 39 | END 40 | END 41 | -------------------------------------------------------------------------------- /lua/lua.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /lua/lua.rc: -------------------------------------------------------------------------------- 1 |  2 | #include 3 | 4 | VS_VERSION_INFO VERSIONINFO 5 | FILEVERSION 5,4,7,0 6 | PRODUCTVERSION 5,4,7,0 7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 8 | #ifndef _DEBUG 9 | FILEFLAGS 0x00000000L 10 | #else 11 | FILEFLAGS VS_FF_DEBUG 12 | #endif 13 | FILEOS VOS_NT_WINDOWS32 14 | FILETYPE VFT_APP 15 | FILESUBTYPE VFT2_UNKNOWN 16 | { 17 | BLOCK "StringFileInfo" 18 | { 19 | BLOCK "000004B0" 20 | { 21 | VALUE "CompanyName", "Lua.org, PUC-Rio" 22 | VALUE "FileDescription", "Lua Language Executable with Wide Character Patch" 23 | VALUE "FileVersion", "5.4.7" 24 | VALUE "InternalName", "lua54" 25 | VALUE "LegalCopyright", "Copyright (C) 1994-2024 Lua.org, PUC-Rio." 26 | VALUE "OriginalFilename", "lua54.exe" 27 | VALUE "ProductName", "Lua Language" 28 | VALUE "ProductVersion", "5.4.7" 29 | } 30 | } 31 | BLOCK "VarFileInfo" 32 | { 33 | VALUE "Translation", 0x0000, 1200 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lua/lua.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | 23 | 24 | Source Files 25 | 26 | 27 | Source Files 28 | 29 | 30 | Source Files 31 | 32 | 33 | 34 | 35 | Resource Files 36 | 37 | 38 | 39 | 40 | Resource Files 41 | 42 | 43 | -------------------------------------------------------------------------------- /lua/pch.c: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /lua/pch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | 5 | #include "lprefix.h" 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include 24 | #include 25 | -------------------------------------------------------------------------------- /test/imcrvmgr_test/cpp.hint: -------------------------------------------------------------------------------- 1 | // common.h 2 | #define FORWARD_ITERATION_I(iterator, container) for (auto (iterator) = (container).begin(); (iterator) != (container).end(); ++(iterator)) 3 | #define FORWARD_ITERATION(iterator, container) for (auto (iterator) = (container).begin(); (iterator) != (container).end(); ) 4 | #define REVERSE_ITERATION_I(reverse_iterator, container) for (auto (reverse_iterator) = (container).rbegin(); (reverse_iterator) != (container).rend(); ++(reverse_iterator)) 5 | #define REVERSE_ITERATION(reverse_iterator, container) for (auto (reverse_iterator) = (container).rbegin(); (reverse_iterator) != (container).rend(); ) 6 | -------------------------------------------------------------------------------- /test/imcrvmgr_test/dictionary.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "parseskkdic.h" 4 | 5 | // okuri block 6 | typedef struct _OKURI_BLOCK { 7 | WCHAR r; 8 | WCHAR d[6]; 9 | } OKURI_BLOCK; 10 | 11 | #define OKURI_BLOCK_NUM 32 12 | extern OKURI_BLOCK okuri_block[OKURI_BLOCK_NUM]; 13 | 14 | extern WCHAR mgrpipename[MAX_PIPENAME]; //名前付きパイプ 15 | 16 | void _CreateIpcName(); 17 | BOOL _ConnectDic(); 18 | void _DisconnectDic(); 19 | BOOL _SearchDic(WCHAR command, CANDIDATES &candidates, const std::wstring &searchkey, const std::wstring &searchkey_org, const std::wstring &okurikey); 20 | BOOL _AddUserDic(WCHAR command, const std::wstring &key, const std::wstring &candidate, const std::wstring &annotation, const std::wstring &okurikey); 21 | BOOL _DelUserDic(WCHAR command, const std::wstring &key, const std::wstring &candidate); 22 | BOOL _SaveUserDic(); 23 | BOOL _BackupUserDic(); 24 | BOOL _CommandDic(WCHAR command); 25 | 26 | #define E_MAKESKKDIC_OK MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0) 27 | //#define E_MAKESKKDIC_DOWNLOAD MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 1) 28 | #define E_MAKESKKDIC_FILEIO MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 2) 29 | #define E_MAKESKKDIC_ENCODING MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 3) 30 | //#define E_MAKESKKDIC_UNGZIP MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 4) 31 | //#define E_MAKESKKDIC_UNTAR MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 5) 32 | 33 | HRESULT CheckMultiByteFile(LPCWSTR path, SKKDICENCODING encoding); 34 | HRESULT CheckWideCharFile(LPCWSTR path); 35 | -------------------------------------------------------------------------------- /test/imcrvmgr_test/imcrvmgr_test.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | 29 | 30 | Header Files 31 | 32 | 33 | Header Files 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /test/imcrvmgr_test/pch.cpp: -------------------------------------------------------------------------------- 1 |  2 | -------------------------------------------------------------------------------- /test/imcrvmgr_test/pch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | #include 15 | --------------------------------------------------------------------------------