7 #include "../hangul/hangul.h"
9 bool filter(ucschar *str, ucschar cho, ucschar jung, ucschar jong, void *data)
11 //printf("Filter: %x %x %x\n", cho, jung, jong);
17 main(int argc, char *argv[])
21 int keyboard = HANGUL_KEYBOARD_2;
22 char commit[32] = { '\0', };
23 wchar_t *commit_string;
24 HangulInputContext *hic;
27 keyboard = atoi(argv[1]);
30 setlocale(LC_CTYPE, "");
32 hic = hangul_ic_new(keyboard);
34 printf("hic is null\n");
37 hangul_ic_set_filter(hic, filter, NULL);
39 for (ascii = getchar(); ascii != EOF; ascii = getchar()) {
40 int ret = hangul_ic_process(hic, ascii);
41 commit_string = (wchar_t*)hangul_ic_get_commit_string(hic);
42 n = wcstombs(commit, commit_string, sizeof(commit));
44 if (strlen(commit) > 0) {
51 if (!hangul_ic_is_empty(hic)) {
53 commit_string = (wchar_t*)hangul_ic_get_commit_string(hic);
54 n = wcstombs(commit, commit_string, sizeof(commit));
56 if (strlen(commit) > 0) {
61 hangul_ic_delete(hic);