diff options
author | H. Peter Anvin <hpa@smyrno.hos.anvin.org> | 2005-11-25 20:42:13 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@smyrno.hos.anvin.org> | 2005-11-25 20:42:13 -0800 |
commit | e2dfede694b02fae6d18bf5d4e55f21cdb3d7e20 (patch) | |
tree | fe07ba69cad98c9bb5fd0e9d74c198bd732ff202 | |
parent | f3f7d1cd76ba7d336fd6aa4642d62a05d47f4836 (diff) | |
download | libucd-e2dfede694b02fae6d18bf5d4e55f21cdb3d7e20.tar.gz |
Handle CJK as well as Hangul
-rw-r--r-- | get_name.c (renamed from hangul_name.c) | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/hangul_name.c b/get_name.c index d64380b..53adce3 100644 --- a/hangul_name.c +++ b/get_name.c @@ -26,21 +26,22 @@ * ----------------------------------------------------------------------- */ /* - * hangul_name.c + * get_name.c * - * Take a character in the range of the Hangul characters, and compute - * its formal name. Returns the length, or 0 if invalid. + * Generate the character name from the codepoint number */ #include "libucd_int.h" -#define EMIT(x) ( (++len < n) && (*p++ = (x)) ) +/* + * libucd_hangul_name() + * + * Take a character in the range of the Hangul characters, and compute + * its formal name. Returns the length, or 0 if invalid. + */ size_t libucd_hangul_name(char *buf, size_t n, int32_t codepoint) { - char *p = buf; - size_t len = 0; - /* See the Unicode Standard, version 4.1, section 3.12 */ const int32_t SBase = 0xAC00; const int32_t LCount = 19; @@ -65,4 +66,14 @@ size_t libucd_hangul_name(char *buf, size_t n, int32_t codepoint) libucd_hangul_jamo_t[T]); } - +/* + * libucd_cjk_name() + * + * Naming for CJK unified ideographs + */ + +size_t libucd_cjk_name(char *buf, size_t n, int32_t codepoint) +{ + return snprintf(buf, n, "CJK UNIFIED IDEOGRAPH-%04X", codepoint); +} + |