aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@smyrno.hos.anvin.org>2005-11-26 00:08:21 -0800
committerH. Peter Anvin <hpa@smyrno.hos.anvin.org>2005-11-26 00:08:21 -0800
commitd6203ae1a8a90134c7f477687bb1c897a1ef2cab (patch)
tree82b6f933fbb53d129d439645f9d74ff50994b811
parent4cf9a4c781e3979fa0d08a955bc7e2499b0c0f3c (diff)
downloadlibucd-d6203ae1a8a90134c7f477687bb1c897a1ef2cab.tar.gz
Prefix internal symbols with _libucd; add support for 24-bit integers
-rwxr-xr-xconvert_ucd.pl8
-rw-r--r--get_name.c4
-rw-r--r--int24.h23
-rw-r--r--libucd_int.h7
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)) ) {
diff --git a/get_name.c b/get_name.c
index 53adce3..659d31a 100644
--- a/get_name.c
+++ b/get_name.c
@@ -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);
}
diff --git a/int24.h b/int24.h
new file mode 100644
index 0000000..a7c7c4c
--- /dev/null
+++ b/int24.h
@@ -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