diff options
author | Choe Hwanjin <choe.hwanjin@gmail.com> | 2006-02-17 19:22:48 +0900 |
---|---|---|
committer | Choe Hwanjin <choe.hwanjin@gmail.com> | 2006-02-17 19:22:48 +0900 |
commit | 6867c770de3ab39ce4b4ed57cb93df923c8dfaf7 (patch) | |
tree | 1f6cc299219ed68734c50580b701e7373c4fbd98 /test/test.c | |
parent | 03c9b1fbaacb6bdfdce1dfeed1507a4387e7fb50 (diff) | |
download | libhangul-6867c770de3ab39ce4b4ed57cb93df923c8dfaf7.tar.gz |
add hangul_ic_set_filter() function
git-svn-id: http://kldp.net/svn/hangul/libhangul/trunk@52 8f00fcd2-89fc-0310-932e-b01be5b65e01
Diffstat (limited to 'test/test.c')
-rw-r--r-- | test/test.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/test/test.c b/test/test.c index a013e1e..306a265 100644 --- a/test/test.c +++ b/test/test.c @@ -6,6 +6,13 @@ #include "../hangul/hangul.h" +bool filter(ucschar cho, ucschar jung, ucschar jong, void *data) +{ + //printf("Filter: %x %x %x\n", cho, jung, jong); + //return jong == 0; + return true; +} + int main(int argc, char *argv[]) { @@ -27,6 +34,7 @@ main(int argc, char *argv[]) printf("hic is null\n"); return -1; } + hangul_ic_set_filter(hic, filter, NULL); for (ascii = getchar(); ascii != EOF; ascii = getchar()) { int ret = hangul_ic_process(hic, ascii); @@ -40,12 +48,14 @@ main(int argc, char *argv[]) printf("%c", ascii); } } - hangul_ic_flush(hic); - commit_string = (wchar_t*)hangul_ic_get_commit_string(hic); - n = wcstombs(commit, commit_string, sizeof(commit)); - commit[n] = '\0'; - if (strlen(commit) > 0) { - printf("%s", commit); + if (!hangul_ic_is_empty(hic)) { + hangul_ic_flush(hic); + commit_string = (wchar_t*)hangul_ic_get_commit_string(hic); + n = wcstombs(commit, commit_string, sizeof(commit)); + commit[n] = '\0'; + if (strlen(commit) > 0) { + printf("%s", commit); + } } hangul_ic_delete(hic); |