ucschar hangul_jaso_to_syllable(ucschar choseong,
ucschar jungseong,
ucschar jongseong);
+void hangul_syllable_to_jaso(ucschar syllable,
+ ucschar* choseong,
+ ucschar* jungseong,
+ ucschar* jongseong);
/* hangulinputcontext.c */
typedef struct _HangulKeyboard HangulKeyboard;
#include "hangul.h"
+static const ucschar hangul_base = 0xac00;
+static const ucschar choseong_base = 0x1100;
+static const ucschar jungseong_base = 0x1161;
+static const ucschar jongseong_base = 0x11a7;
+static const int njungseong = 21;
+static const int njongseong = 28;
+
/**
* @brief check for a choseong
* @param c ucs4 code value
ucschar
hangul_jaso_to_syllable(ucschar choseong, ucschar jungseong, ucschar jongseong)
{
- static const ucschar hangul_base = 0xac00;
- static const ucschar choseong_base = 0x1100;
- static const ucschar jungseong_base = 0x1161;
- static const ucschar jongseong_base = 0x11a7;
- static const int njungseong = 21;
- static const int njongseong = 28;
ucschar c;
/* we use 0x11a7 like a Jongseong filler */
ucschar* jungseong,
ucschar* jongseong)
{
- static const ucschar hangul_base = 0xac00;
- static const ucschar choseong_base = 0x1100;
- static const ucschar jungseong_base = 0x1161;
- static const ucschar jongseong_base = 0x11a7;
- static const int njungseong = 21;
- static const int njongseong = 28;
-
- if (!hangul_is_syllable(syllable)) {
- if (jongseong != NULL)
- *jongseong = 0;
- if (jungseong != NULL)
- *jungseong = 0;
- if (choseong != NULL)
- *choseong = 0;
-
+ if (jongseong != NULL)
+ *jongseong = 0;
+ if (jungseong != NULL)
+ *jungseong = 0;
+ if (choseong != NULL)
+ *choseong = 0;
+
+ if (!hangul_is_syllable(syllable))
return;
- }
syllable -= hangul_base;
-
if (jongseong != NULL) {
- *jongseong = jongseong_base + syllable % njongseong;
+ if (syllable % njongseong != 0)
+ *jongseong = jongseong_base + syllable % njongseong;
}
syllable /= njongseong;