diff options
author | H. Peter Anvin <hpa@smyrno.hos.anvin.org> | 2005-11-26 00:08:21 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@smyrno.hos.anvin.org> | 2005-11-26 00:08:21 -0800 |
commit | d6203ae1a8a90134c7f477687bb1c897a1ef2cab (patch) | |
tree | 82b6f933fbb53d129d439645f9d74ff50994b811 | |
parent | 4cf9a4c781e3979fa0d08a955bc7e2499b0c0f3c (diff) | |
download | libucd-d6203ae1a8a90134c7f477687bb1c897a1ef2cab.tar.gz |
Prefix internal symbols with _libucd; add support for 24-bit integers
-rwxr-xr-x | convert_ucd.pl | 8 | ||||
-rw-r--r-- | get_name.c | 4 | ||||
-rw-r--r-- | int24.h | 23 | ||||
-rw-r--r-- | libucd_int.h | 7 |
4 files changed, 33 insertions, 9 deletions
diff --git a/convert_ucd.pl b/convert_ucd.pl index 08889df..4d7c4df 100755 --- a/convert_ucd.pl +++ b/convert_ucd.pl @@ -194,17 +194,17 @@ sub make_jamo_tables() { open($fh, '>', 'gen/jamo.c') or die "$0 cannot create gen/jamo.c"; print $fh "#include \"libucd_int.h\"\n\n"; - print $fh "const char libucd_hangul_jamo_l[$LCount][4] = {\n"; + print $fh "const char _libucd_hangul_jamo_l[$LCount][4] = {\n"; for ( $i = 0 ; $i < $LCount ; $i++ ) { printf $fh "\t%s,\n", make_jamo_string(${$ucs_props{$LBase+$i}}{'Jamo_Short_Name'}); } print $fh "};\n"; - print $fh "const char libucd_hangul_jamo_v[$VCount][4] = {\n"; + print $fh "const char _libucd_hangul_jamo_v[$VCount][4] = {\n"; for ( $i = 0 ; $i < $VCount ; $i++ ) { printf $fh "\t%s,\n", make_jamo_string(${$ucs_props{$VBase+$i}}{'Jamo_Short_Name'}); } print $fh "};\n"; - print $fh "const char libucd_hangul_jamo_t[$TCount][4] = {\n"; + print $fh "const char _libucd_hangul_jamo_t[$TCount][4] = {\n"; for ( $i = 0 ; $i < $TCount ; $i++ ) { printf $fh "\t%s,\n", make_jamo_string(${$ucs_props{$TBase+$i}}{'Jamo_Short_Name'}); } @@ -229,7 +229,7 @@ sub make_names_list() { open($fh, '>', 'gen/nameslist.c') or die "$0: Cannot create gen/nameslist.c"; print $fh "#include \"libucd_int.h\"\n\n"; - print $fh "const char libucd_names_list[] = {"; + print $fh "const char _libucd_names_list[] = {"; $col = 9999; foreach $k ( sort {$a <=> $b} (keys(%ucs_props)) ) { @@ -40,7 +40,7 @@ * its formal name. Returns the length, or 0 if invalid. */ -size_t libucd_hangul_name(char *buf, size_t n, int32_t codepoint) +size_t _libucd_hangul_name(char *buf, size_t n, int32_t codepoint) { /* See the Unicode Standard, version 4.1, section 3.12 */ const int32_t SBase = 0xAC00; @@ -72,7 +72,7 @@ size_t libucd_hangul_name(char *buf, size_t n, int32_t codepoint) * Naming for CJK unified ideographs */ -size_t libucd_cjk_name(char *buf, size_t n, int32_t codepoint) +size_t _libucd_cjk_name(char *buf, size_t n, int32_t codepoint) { return snprintf(buf, n, "CJK UNIFIED IDEOGRAPH-%04X", codepoint); } @@ -0,0 +1,23 @@ +#ifndef LIBUCD_INT24_H +#define LIBUCD_INT24_H 1 + +#include <inttypes.h> + +typedef uint8_t int24[3]; +typedef uint8_t uint24[3]; + +static inline uint32_t getuint24(const uint8_t *p) +{ + return (uint32_t)p[0] + + ((uint32_t)p[1] << 8) + + ((uint32_t)p[2] << 16); +} + +static inline int32_t getint24(const uint8_t *p) +{ + return (int32_t)p[0] + + ((int32_t)p[1] << 8) + + ((int32_t)(int8_t)p[2] << 16); +} + +#endif /* LIBUCD_INT24_H */ diff --git a/libucd_int.h b/libucd_int.h index 2fd4e00..be3429a 100644 --- a/libucd_int.h +++ b/libucd_int.h @@ -9,9 +9,10 @@ #include <stdlib.h> #include "ucd.h" +#include "int24.h" -extern const char libucv_hangul_jamo_l[][4]; -extern const char libucv_hangul_jamo_v[][4]; -extern const char libucv_hangul_jamo_t[][4]; +extern const char _libucd_hangul_jamo_l[][4]; +extern const char _libucd_hangul_jamo_v[][4]; +extern const char _libucd_hangul_jamo_t[][4]; #endif |