summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChoe Hwanjin <choe.hwanjin@gmail.com>2016-03-04 18:10:29 +0900
committerChoe Hwanjin <choe.hwanjin@gmail.com>2016-03-05 11:18:58 +0900
commitacf25460c6ec11259ce5044c1005a4d620c9ae4c (patch)
tree9eecdd84792a6a0bde584db177325b0eaa461014 /tools
parentbf4981327a5d5985b573a2e594c31b455ec59ba6 (diff)
downloadlibhangul-acf25460c6ec11259ce5044c1005a4d620c9ae4c.tar.gz
xml로 작성된 외부의 한글 자판을 로딩하는 기능 구현
한글 자판 파일의 확장성을 고려하여 자판 파일은 xml로 구성하도록 한다. xml 파서는 expat을 사용한다. xml 번역을 위해서 intltool을 사용하고 autopoint대신 intltool로 gettext을 초기화 한다. 한글 자판 관리는 HangulKeyboardList를 통해서 한다. 한글 자판을 로딩하고 언로딩하기 위해서 hangul_init()/hangul_fini()와 같은 함수를 추가로 도입한다. HangulKeyboard는 HangulCombination과 세트로 관리하는 편이 합리적인 것 같다.
Diffstat (limited to 'tools')
-rw-r--r--tools/hangul.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/hangul.c b/tools/hangul.c
index bc6bba6..d2783c3 100644
--- a/tools/hangul.c
+++ b/tools/hangul.c
@@ -1,5 +1,5 @@
/* libhangul
- * Copyright (C) 2011 Choe Hwanjin
+ * Copyright (C) 2011 - 2016 Choe Hwanjin
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -124,7 +124,7 @@ list_keyboards()
unsigned i;
unsigned n;
- n = hangul_ic_get_n_keyboards();
+ n = hangul_keyboard_list_get_count();
#if defined(ENABLE_NLS) && defined(HAVE_NL_LANGINFO)
if (n > 0) {
@@ -147,8 +147,8 @@ list_keyboards()
const char* id;
const char* name;
- id = hangul_ic_get_keyboard_id(i);
- name = hangul_ic_get_keyboard_name(i);
+ id = hangul_keyboard_list_get_keyboard_id(i);
+ name = hangul_keyboard_list_get_keyboard_name(i);
printf("%-12s %s\n", id, name);
}
@@ -310,6 +310,8 @@ main(int argc, char *argv[])
setlocale(LC_ALL, "");
+ hangul_init();
+
res = EXIT_SUCCESS;
keyboard = "2";
input_string = NULL;
@@ -406,6 +408,8 @@ main(int argc, char *argv[])
hangul_ic_delete(ic);
+ hangul_fini();
+
iconv_close(cd_ucs4_to_utf8);
if (strcmp(output_file, "-") != 0) {