summaryrefslogtreecommitdiff
path: root/hangul
diff options
context:
space:
mode:
authorChoe Hwanjin <choe.hwanjin@gmail.com>2006-11-13 00:55:27 +0900
committerChoe Hwanjin <choe.hwanjin@gmail.com>2006-11-13 00:55:27 +0900
commitd474bfc544a664a93f646581ff63b26f0f23a3aa (patch)
tree5ce78f25c6a53570910fc86a9ddc3e1954f821f4 /hangul
parent616e939600a60a2fc7a42bbdaa8e200df2130334 (diff)
downloadlibhangul-d474bfc544a664a93f646581ff63b26f0f23a3aa.tar.gz
* hangul_keyboard_get_type() 사용
* hangul_ic_new()에서 keyboard 정보를 string을 전달 git-svn-id: http://kldp.net/svn/hangul/libhangul/trunk@94 8f00fcd2-89fc-0310-932e-b01be5b65e01
Diffstat (limited to 'hangul')
-rw-r--r--hangul/hangul.h12
-rw-r--r--hangul/hangulinputcontext.c21
2 files changed, 16 insertions, 17 deletions
diff --git a/hangul/hangul.h b/hangul/hangul.h
index acbf930..3b22c96 100644
--- a/hangul/hangul.h
+++ b/hangul/hangul.h
@@ -64,15 +64,6 @@ typedef struct _HangulBuffer HangulBuffer;
typedef struct _HangulInputContext HangulInputContext;
typedef bool (*HangulICFilter) (ucschar*, ucschar, ucschar, ucschar, void*);
-typedef enum {
- HANGUL_KEYBOARD_2,
- HANGUL_KEYBOARD_32,
- HANGUL_KEYBOARD_3FINAL,
- HANGUL_KEYBOARD_390,
- HANGUL_KEYBOARD_3NOSHIFT,
- HANGUL_KEYBOARD_3YETGUL
-} HangulKeyboardType;
-
enum {
HANGUL_OUTPUT_SYLLABLE,
HANGUL_OUTPUT_JAMO
@@ -86,7 +77,6 @@ enum {
/* keyboard */
HangulKeyboard* hangul_keyboard_new();
void hangul_keyboard_delete(HangulKeyboard *keyboard);
-ucschar hangul_keyboard_get_value(const HangulKeyboard *keyboard, int key);
void hangul_keyboard_set_value(HangulKeyboard *keyboard,
int key, ucschar value);
void hangul_keyboard_set_type(HangulKeyboard *keyboard, int type);
@@ -98,7 +88,7 @@ bool hangul_combination_set_data(HangulCombination* combination,
ucschar* first, ucschar* second, ucschar* result, int n);
/* input context */
-HangulInputContext* hangul_ic_new(HangulKeyboardType keyboard);
+HangulInputContext* hangul_ic_new(const char* keyboard);
void hangul_ic_delete(HangulInputContext *hic);
bool hangul_ic_process(HangulInputContext *hic, int ascii);
void hangul_ic_reset(HangulInputContext *hic);
diff --git a/hangul/hangulinputcontext.c b/hangul/hangulinputcontext.c
index 6b7c5eb..ceee02a 100644
--- a/hangul/hangulinputcontext.c
+++ b/hangul/hangulinputcontext.c
@@ -142,7 +142,7 @@ hangul_keyboard_new()
return NULL;
}
-ucschar
+static ucschar
hangul_keyboard_get_value(const HangulKeyboard *keyboard, int key)
{
if (keyboard != NULL) {
@@ -162,6 +162,16 @@ hangul_keyboard_set_value(HangulKeyboard *keyboard, int key, ucschar value)
}
}
+static int
+hangul_keyboard_get_type(const HangulKeyboard *keyboard)
+{
+ int type = 0;
+ if (keyboard != NULL) {
+ type = keyboard->type;
+ }
+ return type;
+}
+
void
hangul_keyboard_set_type(HangulKeyboard *keyboard, int type)
{
@@ -766,7 +776,7 @@ hangul_ic_process(HangulInputContext *hic, int ascii)
hic->preedit_string[0] = 0;
hic->commit_string[0] = 0;
- if (hic->type == HANGUL_KEYBOARD_TYPE_JAMO)
+ if (hangul_keyboard_get_type(hic->keyboard) == HANGUL_KEYBOARD_TYPE_JAMO)
return hangul_ic_process_jamo(hic, ch);
else
return hangul_ic_process_jaso(hic, ch);
@@ -964,8 +974,7 @@ hangul_ic_set_output_mode(HangulInputContext *hic, int mode)
if (hic == NULL)
return;
- if (hic->output_mode != HANGUL_KEYBOARD_3YETGUL)
- hic->output_mode = mode;
+ hic->output_mode = mode;
}
void hangul_ic_set_filter(HangulInputContext *hic,
@@ -1028,7 +1037,7 @@ hangul_ic_set_combination(HangulInputContext *hic,
}
HangulInputContext*
-hangul_ic_new(HangulKeyboardType keyboard)
+hangul_ic_new(const char* keyboard)
{
HangulInputContext *hic;
@@ -1037,7 +1046,7 @@ hangul_ic_new(HangulKeyboardType keyboard)
return NULL;
hangul_ic_set_output_mode(hic, HANGUL_OUTPUT_SYLLABLE);
- hangul_ic_select_keyboard(hic, "2");
+ hangul_ic_select_keyboard(hic, keyboard);
hangul_ic_set_filter(hic, NULL, NULL);
hangul_buffer_clear(&hic->buffer);