From 2eee4916eede1eff6fbe6bf33d150c0e28551593 Mon Sep 17 00:00:00 2001 From: Won-Kyu Park Date: Sat, 11 Feb 2023 13:23:51 +0900 Subject: WIN32 build fixes --- hangul/hangulinputcontext.c | 4 ++++ hangul/hangulkeyboard.c | 6 ++++++ hangul/hanja.c | 5 +++++ test/hangul.c | 2 +- test/test.c | 7 ++++++- 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/hangul/hangulinputcontext.c b/hangul/hangulinputcontext.c index cd54945..ee43f5e 100644 --- a/hangul/hangulinputcontext.c +++ b/hangul/hangulinputcontext.c @@ -21,7 +21,11 @@ #include #include +#ifndef _WIN32 #include +#else +#define strcasecmp _stricmp +#endif #include #include #include diff --git a/hangul/hangulkeyboard.c b/hangul/hangulkeyboard.c index 11354d8..9e1e599 100644 --- a/hangul/hangulkeyboard.c +++ b/hangul/hangulkeyboard.c @@ -35,6 +35,10 @@ #include "hangul.h" #include "hangulinternals.h" +#ifdef _WIN32 +#define strdup _strdup +#endif + /** * @file hangulkeyboard.c */ @@ -831,6 +835,7 @@ hangul_keyboard_list_clear() hangul_keyboards.keyboards = NULL; } +#if ENABLE_EXTERNAL_KEYBOARDS static char* hangul_keyboard_get_default_keyboard_path() { @@ -886,6 +891,7 @@ hangul_keyboard_get_keyboard_path() return keyboard_path; } +#endif /* ENABLE_EXTERNAL_KEYBOARDS */ int hangul_keyboard_list_init() diff --git a/hangul/hanja.c b/hangul/hanja.c index 0cbe347..0bed47f 100644 --- a/hangul/hanja.c +++ b/hangul/hanja.c @@ -22,7 +22,12 @@ #include #include +#ifndef _WIN32 #include +#else +#include +#define strtok_r strtok_s +#endif #ifdef HAVE_MMAP #include diff --git a/test/hangul.c b/test/hangul.c index a019f06..b00bd6a 100644 --- a/test/hangul.c +++ b/test/hangul.c @@ -70,7 +70,7 @@ main(int argc, char *argv[]) char* keyboard_path = getenv("LIBHANGUL_KEYBOARD_PATH"); if (keyboard_path == NULL) - setenv("LIBHANGUL_KEYBOARD_PATH", TEST_LIBHANGUL_KEYBOARD_PATH, 1); + putenv("LIBHANGUL_KEYBOARD_PATH=" TEST_LIBHANGUL_KEYBOARD_PATH); hangul_init(); diff --git a/test/test.c b/test/test.c index f476c48..1ee83a3 100644 --- a/test/test.c +++ b/test/test.c @@ -1,5 +1,6 @@ #include #include +#include #include #include @@ -528,6 +529,7 @@ START_TEST(test_syllable_iterator) } END_TEST +#if ENABLE_EXTERNAL_KEYBOARDS START_TEST(test_hangul_keyboard) { const char* id; @@ -575,6 +577,7 @@ START_TEST(test_hangul_keyboard) hangul_keyboard_delete(keyboard); } END_TEST +#endif /* ENABLE_EXTERNAL_KEYBOARDS */ START_TEST(test_hangul_jamo_to_cjamo) { @@ -604,7 +607,9 @@ Suite* libhangul_suite() tcase_add_test(hangul, test_hangul_ic_combi_on_double_stroke); tcase_add_test(hangul, test_hangul_ic_non_choseong_combi); tcase_add_test(hangul, test_syllable_iterator); +#if ENABLE_EXTERNAL_KEYBOARDS tcase_add_test(hangul, test_hangul_keyboard); +#endif /* ENABLE_EXTERNAL_KEYBOARDS */ tcase_add_test(hangul, test_hangul_jamo_to_cjamo); suite_add_tcase(s, hangul); @@ -615,7 +620,7 @@ int main() { char* keyboard_path = getenv("LIBHANGUL_KEYBOARD_PATH"); if (keyboard_path == NULL) - setenv("LIBHANGUL_KEYBOARD_PATH", TEST_LIBHANGUL_KEYBOARD_PATH, 1); + putenv("LIBHANGUL_KEYBOARD_PATH=" TEST_LIBHANGUL_KEYBOARD_PATH); hangul_init(); -- cgit v1.2.1 From bc10ca455bce26fda3e8b6200e5d98d5f28eef3f Mon Sep 17 00:00:00 2001 From: Won-Kyu Park Date: Sat, 11 Feb 2023 13:40:04 +0900 Subject: add win32 vcxproj file --- libhangul.vcxproj | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 libhangul.vcxproj diff --git a/libhangul.vcxproj b/libhangul.vcxproj new file mode 100644 index 0000000..edc8751 --- /dev/null +++ b/libhangul.vcxproj @@ -0,0 +1,158 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {83381EEE-8813-47E6-BDCB-4F9882E81882} + Win32Proj + libhangul + 10.0.17763.0 + + + + StaticLibrary + true + v141 + Unicode + + + StaticLibrary + false + v141 + true + Unicode + false + + + StaticLibrary + true + v141 + Unicode + + + StaticLibrary + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + + + true + + + true + + + + Level3 + Disabled + .;.\win32;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_LIB;ENABLE_EXTERNAL_KEYBOARDS=0;%(PreprocessorDefinitions);_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS + /utf-8 + + + Windows + true + + + + + Level3 + Disabled + .;.\win32;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_LIB;ENABLE_EXTERNAL_KEYBOARDS=0;%(PreprocessorDefinitions);_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS + /utf-8 + + + Windows + true + + + + + Level3 + MaxSpeed + true + .;.\win32;%(AdditionalIncludeDirectories) + WIN32;_LIB;ENABLE_EXTERNAL_KEYBOARDS=0;%(PreprocessorDefinitions);_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS + /utf-8 + + + Windows + true + true + + + + + Level3 + MaxSpeed + true + .;.\win32;%(AdditionalIncludeDirectories) + WIN32;_LIB;ENABLE_EXTERNAL_KEYBOARDS=0;%(PreprocessorDefinitions);_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS + /utf-8 + + + Windows + true + true + + + + + + + + + + + + + + + + + + + -- cgit v1.2.1 From 3cc5d20e4907de66cc38d368da5c91ba7c77329b Mon Sep 17 00:00:00 2001 From: Won-Kyu Park Date: Sat, 11 Feb 2023 14:36:06 +0900 Subject: win32: support DynamicLibrary --- libhangul.vcxproj | 3 +++ win32/libhangul.rc | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 win32/libhangul.rc diff --git a/libhangul.vcxproj b/libhangul.vcxproj index edc8751..906a374 100644 --- a/libhangul.vcxproj +++ b/libhangul.vcxproj @@ -139,6 +139,9 @@ true + + + diff --git a/win32/libhangul.rc b/win32/libhangul.rc new file mode 100644 index 0000000..5116efc --- /dev/null +++ b/win32/libhangul.rc @@ -0,0 +1,46 @@ + +#undef APSTUDIO_READONLY_SYMBOLS +#include +#include "../hangul/hangul.h" +#undef APSTUDIO_READONLY_SYMBOLS + +// English resources +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,0 + PRODUCTVERSION 1,0,0,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0xbL +#else + FILEFLAGS 0xaL +#endif + FILEOS 0x4L + FILETYPE VFT_DLL + FILESUBTYPE 0xbL +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + BEGIN + VALUE "Comments", "libhangul hangul library https://github.com/libhangul/libhangul\0" + VALUE "CompanyName", "libhangul\0" + VALUE "FileDescription", "Libhangul v1.0.0\0" + VALUE "FileVersion", "1.0\0" + VALUE "InternalName", "Libhangul\0" + VALUE "LegalCopyright", "Copyright (C) 2004-2022 Choe Hwanjin\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "LIBHANGUL.DLL\0" + VALUE "ProductName", "Libhangul\0" + VALUE "ProductVersion", "1.0.0.0\0" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + +#endif // English resources -- cgit v1.2.1 From c33ba4ca3de49f636a173f2f73f33633a26b4ce6 Mon Sep 17 00:00:00 2001 From: Won-Kyu Park Date: Sun, 12 Feb 2023 00:57:45 +0900 Subject: do not define the default hanja dictionary for win32 case. --- hangul/hanja.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hangul/hanja.c b/hangul/hanja.c index 0bed47f..7812813 100644 --- a/hangul/hanja.c +++ b/hangul/hanja.c @@ -495,7 +495,11 @@ hanja_table_load(const char* filename) HanjaTable* table; if (filename == NULL) +#ifdef LIBHANGUL_DEFAULT_HANJA_DIC filename = LIBHANGUL_DEFAULT_HANJA_DIC; +#else + return NULL; +#endif /* LIBHANGUL_DEFAULT_HANJA_DIC */ file = fopen(filename, "r"); if (file == NULL) { -- cgit v1.2.1