X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Fliblunicode%2Fucdata%2Fucgendat.c;h=538d4293c474f4dad2506a6bc41c9c21fe33ad7d;hb=255895125148704f4219868b295d6f69dfdcd68a;hp=d621e3ef907504b59585ae6e41326f1dbf03e5f5;hpb=3c598e89fb34a892d369a138daa8c3314294493c;p=openldap diff --git a/libraries/liblunicode/ucdata/ucgendat.c b/libraries/liblunicode/ucdata/ucgendat.c index d621e3ef90..538d4293c4 100644 --- a/libraries/liblunicode/ucdata/ucgendat.c +++ b/libraries/liblunicode/ucdata/ucgendat.c @@ -1,7 +1,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1998-2004 The OpenLDAP Foundation. + * Copyright 1998-2009 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,6 +38,7 @@ #include "ldap_config.h" #include +#include #include #include #include @@ -46,6 +47,10 @@ #include +#ifndef HARDCODE_DATA +#define HARDCODE_DATA 1 +#endif + #undef ishdigit #define ishdigit(cc) (((cc) >= '0' && (cc) <= '9') ||\ ((cc) >= 'A' && (cc) <= 'F') ||\ @@ -136,7 +141,7 @@ static ac_uint4 kdecomps_size; */ #define COMPEX_SET(c) (compexs[(c) >> 5] |= (1 << ((c) & 31))) #define COMPEX_TEST(c) (compexs[(c) >> 5] & (1 << ((c) & 31))) -static ac_uint4 compexs[2048]; +static ac_uint4 compexs[8192]; /* * Struct for holding a composition pair, and array of composition pairs @@ -855,8 +860,17 @@ read_cdata(FILE *in) * 3. D800-DFFF Surrogates. * 4. E000-F8FF Private Use Area. * 5. F900-FA2D Han compatibility. + * ...Plus additional ranges in newer Unicode versions... */ switch (code) { + case 0x3400: + /* CJK Ideograph Extension A */ + add_range(0x3400, 0x4db5, "Lo", "L"); + + add_range(0x3400, 0x4db5, "Cp", 0); + + skip = 1; + break; case 0x4e00: /* * The Han ideographs. @@ -910,6 +924,26 @@ read_cdata(FILE *in) add_range(0xf900, 0xfaff, "Cp", 0); skip = 1; + break; + case 0x20000: + /* CJK Ideograph Extension B */ + add_range(0x20000, 0x2a6d6, "Lo", "L"); + + add_range(0x20000, 0x2a6d6, "Cp", 0); + + skip = 1; + break; + case 0xf0000: + /* Plane 15 private use */ + add_range(0xf0000, 0xffffd, "Co", "L"); + skip = 1; + break; + + case 0x100000: + /* Plane 16 private use */ + add_range(0x100000, 0x10fffd, "Co", "L"); + skip = 1; + break; } if (skip) @@ -1044,7 +1078,7 @@ read_cdata(FILE *in) * Adjust the denominator in case of integers and add the number. */ if (wnum == 0) - number[1] = number[0]; + number[1] = 1; add_number(code, number[0], number[1]); } @@ -1171,10 +1205,11 @@ cmpcomps(const void *v_comp1, const void *v_comp2) static void read_compexdata(FILE *in) { - ac_uint2 i, code; + ac_uint2 i; + ac_uint4 code; char line[512], *s; - (void) memset((char *) compexs, 0, sizeof(ac_uint4) << 11); + (void) memset((char *) compexs, 0, sizeof(compexs)); while (fgets(line, sizeof(line), in)) { if( (s=strchr(line, '\n')) ) *s = '\0'; @@ -1185,10 +1220,11 @@ read_compexdata(FILE *in) continue; /* - * Collect the code. Assume max 4 digits + * Collect the code. Assume max 6 digits */ - for (s = line, i = code = 0; *s != '#' && i < 4; i++, s++) { + for (s = line, i = code = 0; *s != '#' && i < 6; i++, s++) { + if (isspace((unsigned char)*s)) break; code <<= 4; if (*s >= '0' && *s <= '9') code += *s - '0'; @@ -1224,14 +1260,37 @@ create_comps(void) qsort(comps, comps_used, sizeof(_comp_t), cmpcomps); } +#if HARDCODE_DATA +static void +write_case(FILE *out, _case_t *tab, int num, int first) +{ + int i; + + for (i=0; i 0) { + for (j=0; j 0) + /* + * Write the upper case table. + */ + write_case(out, upper, upper_used, 1); + + if (lower_used > 0) + /* + * Write the lower case table. + */ + write_case(out, lower, lower_used, !upper_used); + + if (title_used > 0) + /* + * Write the title case table. + */ + write_case(out, title, title_used, !(upper_used||lower_used)); + + if (!(upper_used || lower_used || title_used)) + fprintf(out, "\t0"); + + fprintf(out, "\n};\n\n"); +#else /* * Open the case.dat file. */ @@ -1353,6 +1481,7 @@ write_cdata(char *opath) fwrite((char *) title, sizeof(_case_t), title_used, out); fclose(out); +#endif /***************************************************************** * @@ -1365,6 +1494,27 @@ write_cdata(char *opath) */ create_comps(); +#if HARDCODE_DATA + fprintf(out, PREF "ac_uint4 _uccomp_size = %ld;\n\n", + comps_used * 4L); + + fprintf(out, PREF "ac_uint4 _uccomp_data[] = {"); + + /* + * Now, if comps exist, write them out. + */ + if (comps_used > 0) { + for (i=0; i 0) { + /* + * Write the combining class ranges out. + */ + for (i = 0; i 0) { + for (i = 0; i