Skip to content

Commit

Permalink
1.6.0
Browse files Browse the repository at this point in the history
・Luaによる拡張機能を追加しました。
 ・サーバープロセス(imcrvmgr.exe)の各機能の拡張を目的としています。
 ・プログラム実行変換もどきと数値変換をLua側に移植しました。
 ・skk-ignore-dic-word関数を追加しました。が、デフォルトでは無効になっています。
 ・CとLuaのインターフェイスは今後変更する可能性があります。御了承下さい。

・SKK辞書の取込処理ダイアログに中断ボタンを追加しました。

・SKK辞書の取込処理で、注釈をカンマ区切りで連結するときconcat関数を処理するようにしました。

・辞書登録でユーザーが入力した文字列の先頭と末尾のスペースを削除した上で確定および辞書登録するようにしました。

・オプション「ローマ字を表示する」がOFFのとき入力済みローマ字の数に関わらずスペース1つだけ表示するようにしました。

・installerプロジェクトのタイプをUtilityからMakefileに変更しました。
  • Loading branch information
nathancorvussolis committed May 6, 2014
1 parent f487379 commit 3febaf4
Show file tree
Hide file tree
Showing 128 changed files with 23,295 additions and 1,309 deletions.
44 changes: 35 additions & 9 deletions CorvusSKK.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2013 for Windows Desktop
VisualStudioVersion = 12.0.30110.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "installer", "installer\installer.vcxproj", "{F3FB688D-B2FB-46F0-8836-67CEDB4A50A9}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "installer", "installer\installer.vcxproj", "{C65505E2-5456-473C-91B1-C6D91B294DC3}"
ProjectSection(ProjectDependencies) = postProject
{56319425-6482-41CF-8B63-BC33D6EEBB52} = {56319425-6482-41CF-8B63-BC33D6EEBB52}
{EB999F4D-AD29-4049-BCCB-FABFD01DFC97} = {EB999F4D-AD29-4049-BCCB-FABFD01DFC97}
{FC76E950-6F4B-41B1-AC64-AA5EE6F71163} = {FC76E950-6F4B-41B1-AC64-AA5EE6F71163}
{289FD85F-FCDB-413D-BBF3-997583DF0FEE} = {289FD85F-FCDB-413D-BBF3-997583DF0FEE}
{26BFF97B-F38B-482C-9CCF-D81FF5ED9ED8} = {26BFF97B-F38B-482C-9CCF-D81FF5ED9ED8}
{740F50A9-EA25-4FFB-890D-57D53FD6F026} = {740F50A9-EA25-4FFB-890D-57D53FD6F026}
EndProjectSection
EndProject
Expand All @@ -19,6 +21,7 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "imcrvmgr", "imcrvmgr\imcrvmgr.vcxproj", "{289FD85F-FCDB-413D-BBF3-997583DF0FEE}"
ProjectSection(ProjectDependencies) = postProject
{EB999F4D-AD29-4049-BCCB-FABFD01DFC97} = {EB999F4D-AD29-4049-BCCB-FABFD01DFC97}
{FC76E950-6F4B-41B1-AC64-AA5EE6F71163} = {FC76E950-6F4B-41B1-AC64-AA5EE6F71163}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "imcrvcnf", "imcrvcnf\imcrvcnf.vcxproj", "{56319425-6482-41CF-8B63-BC33D6EEBB52}"
Expand All @@ -28,6 +31,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "imcrvcnf", "imcrvcnf\imcrvc
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "common\common.vcxproj", "{EB999F4D-AD29-4049-BCCB-FABFD01DFC97}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua52", "lua52\lua52.vcxproj", "{FC76E950-6F4B-41B1-AC64-AA5EE6F71163}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua", "lua\lua.vcxproj", "{26BFF97B-F38B-482C-9CCF-D81FF5ED9ED8}"
ProjectSection(ProjectDependencies) = postProject
{FC76E950-6F4B-41B1-AC64-AA5EE6F71163} = {FC76E950-6F4B-41B1-AC64-AA5EE6F71163}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Expand All @@ -36,14 +46,6 @@ Global
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F3FB688D-B2FB-46F0-8836-67CEDB4A50A9}.Debug|Win32.ActiveCfg = Debug|Win32
{F3FB688D-B2FB-46F0-8836-67CEDB4A50A9}.Debug|Win32.Build.0 = Debug|Win32
{F3FB688D-B2FB-46F0-8836-67CEDB4A50A9}.Debug|x64.ActiveCfg = Debug|x64
{F3FB688D-B2FB-46F0-8836-67CEDB4A50A9}.Debug|x64.Build.0 = Debug|x64
{F3FB688D-B2FB-46F0-8836-67CEDB4A50A9}.Release|Win32.ActiveCfg = Release|Win32
{F3FB688D-B2FB-46F0-8836-67CEDB4A50A9}.Release|Win32.Build.0 = Release|Win32
{F3FB688D-B2FB-46F0-8836-67CEDB4A50A9}.Release|x64.ActiveCfg = Release|x64
{F3FB688D-B2FB-46F0-8836-67CEDB4A50A9}.Release|x64.Build.0 = Release|x64
{740F50A9-EA25-4FFB-890D-57D53FD6F026}.Debug|Win32.ActiveCfg = Debug|Win32
{740F50A9-EA25-4FFB-890D-57D53FD6F026}.Debug|Win32.Build.0 = Debug|Win32
{740F50A9-EA25-4FFB-890D-57D53FD6F026}.Debug|x64.ActiveCfg = Debug|x64
Expand Down Expand Up @@ -76,6 +78,30 @@ Global
{EB999F4D-AD29-4049-BCCB-FABFD01DFC97}.Release|Win32.Build.0 = Release|Win32
{EB999F4D-AD29-4049-BCCB-FABFD01DFC97}.Release|x64.ActiveCfg = Release|x64
{EB999F4D-AD29-4049-BCCB-FABFD01DFC97}.Release|x64.Build.0 = Release|x64
{FC76E950-6F4B-41B1-AC64-AA5EE6F71163}.Debug|Win32.ActiveCfg = Debug|Win32
{FC76E950-6F4B-41B1-AC64-AA5EE6F71163}.Debug|Win32.Build.0 = Debug|Win32
{FC76E950-6F4B-41B1-AC64-AA5EE6F71163}.Debug|x64.ActiveCfg = Debug|x64
{FC76E950-6F4B-41B1-AC64-AA5EE6F71163}.Debug|x64.Build.0 = Debug|x64
{FC76E950-6F4B-41B1-AC64-AA5EE6F71163}.Release|Win32.ActiveCfg = Release|Win32
{FC76E950-6F4B-41B1-AC64-AA5EE6F71163}.Release|Win32.Build.0 = Release|Win32
{FC76E950-6F4B-41B1-AC64-AA5EE6F71163}.Release|x64.ActiveCfg = Release|x64
{FC76E950-6F4B-41B1-AC64-AA5EE6F71163}.Release|x64.Build.0 = Release|x64
{26BFF97B-F38B-482C-9CCF-D81FF5ED9ED8}.Debug|Win32.ActiveCfg = Debug|Win32
{26BFF97B-F38B-482C-9CCF-D81FF5ED9ED8}.Debug|Win32.Build.0 = Debug|Win32
{26BFF97B-F38B-482C-9CCF-D81FF5ED9ED8}.Debug|x64.ActiveCfg = Debug|x64
{26BFF97B-F38B-482C-9CCF-D81FF5ED9ED8}.Debug|x64.Build.0 = Debug|x64
{26BFF97B-F38B-482C-9CCF-D81FF5ED9ED8}.Release|Win32.ActiveCfg = Release|Win32
{26BFF97B-F38B-482C-9CCF-D81FF5ED9ED8}.Release|Win32.Build.0 = Release|Win32
{26BFF97B-F38B-482C-9CCF-D81FF5ED9ED8}.Release|x64.ActiveCfg = Release|x64
{26BFF97B-F38B-482C-9CCF-D81FF5ED9ED8}.Release|x64.Build.0 = Release|x64
{C65505E2-5456-473C-91B1-C6D91B294DC3}.Debug|Win32.ActiveCfg = Debug|Win32
{C65505E2-5456-473C-91B1-C6D91B294DC3}.Debug|Win32.Build.0 = Debug|Win32
{C65505E2-5456-473C-91B1-C6D91B294DC3}.Debug|x64.ActiveCfg = Debug|x64
{C65505E2-5456-473C-91B1-C6D91B294DC3}.Debug|x64.Build.0 = Debug|x64
{C65505E2-5456-473C-91B1-C6D91B294DC3}.Release|Win32.ActiveCfg = Release|Win32
{C65505E2-5456-473C-91B1-C6D91B294DC3}.Release|Win32.Build.0 = Release|Win32
{C65505E2-5456-473C-91B1-C6D91B294DC3}.Release|x64.ActiveCfg = Release|x64
{C65505E2-5456-473C-91B1-C6D91B294DC3}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
26 changes: 26 additions & 0 deletions LICENSE.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,32 @@ License:
You can use, modify, distribute this table freely.


-------------------------------------------------------------------------------

Lua

Copyright (C) 1994-2013 Lua.org, PUC-Rio.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


-------------------------------------------------------------------------------


Expand Down
1 change: 1 addition & 0 deletions common/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ LPCWSTR fnconfigxml = L"config.xml"; //設定
LPCWSTR fnuserdic = L"userdict.txt"; //ユーザ辞書
LPCWSTR fnskkdic = L"skkdict.dic"; //取込SKK辞書
LPCWSTR fnskkidx = L"skkdict.idx"; //取込SKK辞書インデックス
LPCWSTR fninitlua = L"init.lua"; //init.lua

const TF_DISPLAYATTRIBUTE c_daDisplayAttributeInputMark =
{
Expand Down
16 changes: 9 additions & 7 deletions common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#define COMMON_H

#define TEXTSERVICE_NAME L"CorvusSKK"
#define TEXTSERVICE_VER L"1.5.9"
#define TEXTSERVICE_VER L"1.6.0"

#ifndef _DEBUG
#define TEXTSERVICE_DESC TEXTSERVICE_NAME
Expand All @@ -14,8 +14,8 @@
//for resource
#define RC_AUTHOR "nathancorvussolis"
#define RC_PRODUCT "CorvusSKK"
#define RC_VERSION "1.5.9"
#define RC_VERSION_D 1,5,9,0
#define RC_VERSION "1.6.0"
#define RC_VERSION_D 1,6,0,0

#define DICBUFSIZE 0x2000
#define PIPEBUFSIZE 0x2000
Expand All @@ -33,16 +33,17 @@

//request
#define REQ_SEARCH L'1' //辞書検索
#define REQ_COMPLEMENT L'8' //補完
#define REQ_CONVERSION L'9' //候補変換
#define REQ_COMPLEMENT L'4' //補完
#define REQ_CONVERTKEY L'5' //見出し語変換
#define REQ_CONVERTCND L'6' //候補変換
#define REQ_USER_ADD_0 L'A' //ユーザー辞書追加(送りあり、補完なし)
#define REQ_USER_ADD_1 L'B' //ユーザー辞書追加(送りなし、補完あり)
#define REQ_USER_DEL_0 L'C' //ユーザー辞書削除(送りあり、補完なし)
#define REQ_USER_DEL_1 L'D' //ユーザー辞書削除(送りなし、補完あり)
#define REQ_USER_SAVE L'S' //ユーザー辞書保存
//reply
#define REP_OK L'1' //hit
#define REP_FALSE L'4' //nothing
#define REP_OK L'T' //hit
#define REP_FALSE L'F' //nothing

#define CORVUSMGREXE L"imcrvmgr.exe"
#define CORVUSCNFEXE L"imcrvcnf.exe"
Expand All @@ -68,6 +69,7 @@ extern LPCWSTR fnconfigxml; //設定
extern LPCWSTR fnuserdic; //ユーザー辞書
extern LPCWSTR fnskkdic; //取込SKK辞書
extern LPCWSTR fnskkidx; //取込SKK辞書インデックス
extern LPCWSTR fninitlua; //init.lua

#define DISPLAYATTRIBUTE_INFO_NUM 7

Expand Down
2 changes: 2 additions & 0 deletions common/common.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
<ClInclude Include="eucjis2004table.h" />
<ClInclude Include="parseskkdic.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="utf8.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="common.cpp" />
Expand All @@ -167,6 +168,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="utf8.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
6 changes: 6 additions & 0 deletions common/common.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
<ClInclude Include="parseskkdic.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="utf8.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
Expand All @@ -56,5 +59,8 @@
<ClCompile Include="parseskkdic.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="utf8.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
6 changes: 3 additions & 3 deletions common/eucjis2004.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ size_t UcpToWideChar(UCSCHAR ucp, PWCHAR first, PWCHAR second)

*first = L'\0';
*second = L'\0';

if(ucp < SURROGATEPAIR_UCPMIN)
{
*first = (WCHAR)ucp;
Expand Down Expand Up @@ -267,7 +267,7 @@ BOOL WideCharToEucJis2004(LPCWSTR src, size_t *srcsize, LPSTR dst, size_t *dstsi
WCHAR first, second;
UCSCHAR ucp;
BOOL exist;

if(src == NULL || dstsize == NULL)
{
return FALSE;
Expand Down Expand Up @@ -480,7 +480,7 @@ BOOL WideCharToEucJis2004(LPCWSTR src, size_t *srcsize, LPSTR dst, size_t *dstsi
}
}
}

if(srcsize != NULL)
{
*srcsize = si;
Expand Down
69 changes: 69 additions & 0 deletions common/parseskkdic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,72 @@ void ParseSKKDicOkuriBlock(const std::wstring &s, SKKDICOKURIBLOCKS &o)
so = m.suffix();
}
}

std::wstring ParseConcat(const std::wstring &s)
{
std::wstring ret = s;
std::wregex re;
std::wsmatch res;
std::wstring numstr, tmpstr, fmt;
wchar_t u;

tmpstr = s;
re.assign(L"^\\(concat \".+?\"\\)$");
if(std::regex_search(tmpstr, re))
{
ret.clear();
fmt = L"$1";

re.assign(L"\\(concat \"(.+)\"\\)");
tmpstr = std::regex_replace(tmpstr, re, fmt);

re.assign(L"\\\\([\\\"|\\\\])");
tmpstr = std::regex_replace(tmpstr, re, fmt);

re.assign(L"\\\\[0-3][0-7]{2}");
while(std::regex_search(tmpstr, res, re))
{
ret += res.prefix();
numstr = res.str();
numstr[0] = L'0';
u = (wchar_t)wcstoul(numstr.c_str(), NULL, 0);
if(u >= L'\x20' && u <= L'\x7E')
{
ret.append(1, u);
}
tmpstr = res.suffix();
}
ret += tmpstr;
}

return ret;
}

std::wstring MakeConcat(const std::wstring &s)
{
std::wstring ret = s;
std::wregex re;
std::wstring fmt;

// "/" -> \057, ";" -> \073
re.assign(L"[/;]");
if(std::regex_search(ret, re))
{
// "\"" -> "\\\"", "\\" -> "\\\\"
re.assign(L"([\\\"|\\\\])");
fmt.assign(L"\\$1");
ret = std::regex_replace(ret, re, fmt);

re.assign(L"/");
fmt.assign(L"\\057");
ret = std::regex_replace(ret, re, fmt);

re.assign(L";");
fmt.assign(L"\\073");
ret = std::regex_replace(ret, re, fmt);

ret = L"(concat \"" + ret + L"\")";
}

return ret;
}
2 changes: 2 additions & 0 deletions common/parseskkdic.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@ int ReadSKKDicLine(FILE *fp, WCHAR bom, int &okuri, std::wstring &key,
SKKDICCANDIDATES &c, SKKDICOKURIBLOCKS &o);
void ParseSKKDicCandiate(const std::wstring &s, SKKDICCANDIDATES &c);
void ParseSKKDicOkuriBlock(const std::wstring &s, SKKDICOKURIBLOCKS &o);
std::wstring ParseConcat(const std::wstring &s);
std::wstring MakeConcat(const std::wstring &s);

#endif //PARSESKKDIC_H
50 changes: 50 additions & 0 deletions common/utf8.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

#include "common.h"

std::string wstring_to_utf8_string(const std::wstring &s)
{
std::string ret;

int len = WideCharToMultiByte(CP_UTF8, 0, s.c_str(), -1, NULL, 0, NULL, NULL);
if(len > 0)
{
try
{
LPSTR utf8 = new CHAR[len];
if(WideCharToMultiByte(CP_UTF8, 0, s.c_str(), -1, utf8, len, NULL, NULL) > 0)
{
ret = utf8;
}
delete[] utf8;
}
catch(...)
{
}
}

return ret;
}

std::wstring utf8_string_to_wstring(const std::string &s)
{
std::wstring ret;

int len = MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, NULL, 0);
if(len > 0)
{
try
{
LPWSTR wcs = new WCHAR[len];
if(MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, wcs, len) > 0)
{
ret = wcs;
}
delete[] wcs;
}
catch(...)
{
}
}

return ret;
}
11 changes: 11 additions & 0 deletions common/utf8.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#ifndef UTF8_H
#define UTF8_H

std::string wstring_to_utf8_string(const std::wstring &s);
std::wstring utf8_string_to_wstring(const std::string &s);

#define WCTOU8(w) wstring_to_utf8_string(w).c_str()
#define U8TOWC(u) utf8_string_to_wstring(u).c_str()

#endif
2 changes: 1 addition & 1 deletion imcrvcnf/DlgProcBehavior.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ INT_PTR CALLBACK DlgProcBehavior(HWND hDlg, UINT message, WPARAM wParam, LPARAM
LoadCheckButton(hDlg, IDC_CHECKBOX_ADDCANDKTKN, SectionBehavior, ValueAddCandKtkn);
LoadCheckButton(hDlg, IDC_CHECKBOX_SHIFTNNOKURI, SectionBehavior, ValueShiftNNOkuri, L"1");
LoadCheckButton(hDlg, IDC_CHECKBOX_PRECEDEOKURI, SectionBehavior, ValuePrecedeOkuri);

return TRUE;

case WM_COMMAND:
Expand Down
2 changes: 1 addition & 1 deletion imcrvcnf/DlgProcDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ INT_PTR CALLBACK DlgProcDisplay(HWND hDlg, UINT message, WPARAM wParam, LPARAM l
}
}
break;

case WM_PAINT:
hdc = BeginPaint(hDlg, &ps);
for(i = 0; i < _countof(displayColor); i++)
Expand Down
Loading

0 comments on commit 3febaf4

Please sign in to comment.