#include <stdbool.h>
#include <inttypes.h>
+#ifdef __GNUC__
+#define LIBHANGUL_DEPRECATED __attribute__((deprecated));
+#else
+#define LIBHANGUL_DEPRECATED
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
/* deprecated */
-bool hangul_is_jaso(ucschar c);
-ucschar hangul_jaso_to_jamo(ucschar ch);
+bool hangul_is_jaso(ucschar c) LIBHANGUL_DEPRECATED;
+ucschar hangul_jaso_to_jamo(ucschar ch) LIBHANGUL_DEPRECATED;
ucschar hangul_jaso_to_syllable(ucschar choseong,
ucschar jungseong,
- ucschar jongseong);
+ ucschar jongseong) LIBHANGUL_DEPRECATED;
void hangul_syllable_to_jaso(ucschar syllable,
ucschar* choseong,
ucschar* jungseong,
- ucschar* jongseong);
+ ucschar* jongseong) LIBHANGUL_DEPRECATED;
typedef bool (*HangulICFilter) (ucschar*, ucschar, ucschar, ucschar, void*);
void hangul_ic_set_filter(HangulInputContext *hic,
- HangulICFilter func, void *user_data);
+ HangulICFilter func, void *user_data) LIBHANGUL_DEPRECATED;
#ifdef __cplusplus
}
#endif
+#undef LIBHANGUL_DEPRECATED
+
#endif /* libhangul_hangul_h */
if (cho) {
if (jung) {
/* have cho, jung, jong or no jong */
- ch = hangul_jaso_to_syllable(cho, jung, jong);
+ ch = hangul_jamo_to_syllable(cho, jung, jong);
buf[n++] = ch;
} else {
if (jong) {
/* have cho, jong */
- ch = hangul_jaso_to_jamo(cho);
+ ch = hangul_jamo_to_cjamo(cho);
buf[n++] = ch;
- ch = hangul_jaso_to_jamo(jong);
+ ch = hangul_jamo_to_cjamo(jong);
buf[n++] = ch;
} else {
/* have cho */
- ch = hangul_jaso_to_jamo(cho);
+ ch = hangul_jamo_to_cjamo(cho);
buf[n++] = ch;
}
}
if (jung) {
if (jong) {
/* have jung, jong */
- ch = hangul_jaso_to_jamo(jung);
+ ch = hangul_jamo_to_cjamo(jung);
buf[n++] = ch;
- ch = hangul_jaso_to_jamo(jong);
+ ch = hangul_jamo_to_cjamo(jong);
buf[n++] = ch;
} else {
/* have jung */
- ch = hangul_jaso_to_jamo(jung);
+ ch = hangul_jamo_to_cjamo(jung);
buf[n++] = ch;
}
} else {
if (jong) {
/* have jong */
- ch = hangul_jaso_to_jamo(jong);
+ ch = hangul_jamo_to_cjamo(jong);
buf[n++] = ch;
} else {
/* have nothing */
return false;
}
} else {
- if (!hangul_is_jaso(c)) {
+ if (!hangul_is_jamo(c)) {
hangul_ic_flush_internal(hic);
return false;
}
ucschar jong;
ucschar combined;
- if (!hangul_is_jaso(ch) && ch > 0) {
+ if (!hangul_is_jamo(ch) && ch > 0) {
hangul_ic_save_commit_string(hic);
hangul_ic_append_commit_string(hic, ch);
return true;
ucschar jong;
ucschar combined;
- if (!hangul_is_jaso(ch) && ch > 0) {
+ if (!hangul_is_jamo(ch) && ch > 0) {
hangul_ic_save_commit_string(hic);
hangul_ic_append_commit_string(hic, ch);
return true;
#define UCS4 "UCS-4LE"
#endif
-bool filter(ucschar *str, ucschar cho, ucschar jung, ucschar jong, void *data)
-{
- //printf("Filter: %x %x %x\n", cho, jung, jong);
- //return jong == 0;
- return true;
-}
-
void ucs4_to_utf8(char *buf, const ucschar *ucs4, size_t bufsize)
{
size_t n;
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);