mkutf8data.c (1b3073291ddbe23fede7e0dd1b6f5635e370f8ba) mkutf8data.c (43bf9d9755bd21970d8382dc88f071f74fc18fbf)
1/*
2 * Copyright (c) 2014 SGI.
3 * All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *

--- 2216 unchanged lines hidden (view full) ---

2225 }
2226 fclose(file);
2227 if (verbose > 0)
2228 printf("Found %d entries\n", count);
2229 if (count == 0)
2230 file_fail(fold_name);
2231}
2232
1/*
2 * Copyright (c) 2014 SGI.
3 * All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *

--- 2216 unchanged lines hidden (view full) ---

2225 }
2226 fclose(file);
2227 if (verbose > 0)
2228 printf("Found %d entries\n", count);
2229 if (count == 0)
2230 file_fail(fold_name);
2231}
2232
2233static void ignore_init(void)
2234{
2235 FILE *file;
2236 unsigned int unichar;
2237 unsigned int first;
2238 unsigned int last;
2239 unsigned int *um;
2240 int count;
2241 int ret;
2242
2243 if (verbose > 0)
2244 printf("Parsing %s\n", prop_name);
2245 file = fopen(prop_name, "r");
2246 if (!file)
2247 open_fail(prop_name, errno);
2248 assert(file);
2249 count = 0;
2250 while (fgets(line, LINESIZE, file)) {
2251 ret = sscanf(line, "%X..%X ; %s # ", &first, &last, buf0);
2252 if (ret == 3) {
2253 if (strcmp(buf0, "Default_Ignorable_Code_Point"))
2254 continue;
2255 if (!utf32valid(first) || !utf32valid(last))
2256 line_fail(prop_name, line);
2257 for (unichar = first; unichar <= last; unichar++) {
2258 free(unicode_data[unichar].utf32nfdi);
2259 um = malloc(sizeof(unsigned int));
2260 *um = 0;
2261 unicode_data[unichar].utf32nfdi = um;
2262 free(unicode_data[unichar].utf32nfdicf);
2263 um = malloc(sizeof(unsigned int));
2264 *um = 0;
2265 unicode_data[unichar].utf32nfdicf = um;
2266 count++;
2267 }
2268 if (verbose > 1)
2269 printf(" %X..%X Default_Ignorable_Code_Point\n",
2270 first, last);
2271 continue;
2272 }
2273 ret = sscanf(line, "%X ; %s # ", &unichar, buf0);
2274 if (ret == 2) {
2275 if (strcmp(buf0, "Default_Ignorable_Code_Point"))
2276 continue;
2277 if (!utf32valid(unichar))
2278 line_fail(prop_name, line);
2279 free(unicode_data[unichar].utf32nfdi);
2280 um = malloc(sizeof(unsigned int));
2281 *um = 0;
2282 unicode_data[unichar].utf32nfdi = um;
2283 free(unicode_data[unichar].utf32nfdicf);
2284 um = malloc(sizeof(unsigned int));
2285 *um = 0;
2286 unicode_data[unichar].utf32nfdicf = um;
2287 if (verbose > 1)
2288 printf(" %X Default_Ignorable_Code_Point\n",
2289 unichar);
2290 count++;
2291 continue;
2292 }
2293 }
2294 fclose(file);
2295
2296 if (verbose > 0)
2297 printf("Found %d entries\n", count);
2298 if (count == 0)
2299 file_fail(prop_name);
2300}
2301
2233static void corrections_init(void)
2234{
2235 FILE *file;
2236 unsigned int unichar;
2237 unsigned int major;
2238 unsigned int minor;
2239 unsigned int revision;
2240 unsigned int age;

--- 1023 unchanged lines hidden (view full) ---

3264 fprintf(file, "\t");
3265 for (j = i; j != i + 16; j++)
3266 fprintf(file, "0x%.2x%s", utf8data[j],
3267 (j < utf8data_size -1 ? "," : ""));
3268 fprintf(file, "\n");
3269 }
3270 fprintf(file, "};\n");
3271 fprintf(file, "\n");
2302static void corrections_init(void)
2303{
2304 FILE *file;
2305 unsigned int unichar;
2306 unsigned int major;
2307 unsigned int minor;
2308 unsigned int revision;
2309 unsigned int age;

--- 1023 unchanged lines hidden (view full) ---

3333 fprintf(file, "\t");
3334 for (j = i; j != i + 16; j++)
3335 fprintf(file, "0x%.2x%s", utf8data[j],
3336 (j < utf8data_size -1 ? "," : ""));
3337 fprintf(file, "\n");
3338 }
3339 fprintf(file, "};\n");
3340 fprintf(file, "\n");
3272 fprintf(file, "struct utf8data_table utf8_data_table = {\n");
3341 fprintf(file, "const struct utf8data_table utf8_data_table = {\n");
3273 fprintf(file, "\t.utf8agetab = utf8agetab,\n");
3274 fprintf(file, "\t.utf8agetab_size = ARRAY_SIZE(utf8agetab),\n");
3275 fprintf(file, "\n");
3276 fprintf(file, "\t.utf8nfdicfdata = utf8nfdicfdata,\n");
3277 fprintf(file, "\t.utf8nfdicfdata_size = ARRAY_SIZE(utf8nfdicfdata),\n");
3278 fprintf(file, "\n");
3279 fprintf(file, "\t.utf8nfdidata = utf8nfdidata,\n");
3280 fprintf(file, "\t.utf8nfdidata_size = ARRAY_SIZE(utf8nfdidata),\n");

--- 56 unchanged lines hidden (view full) ---

3337 if (verbose > 1)
3338 help();
3339 for (unichar = 0; unichar != 0x110000; unichar++)
3340 unicode_data[unichar].code = unichar;
3341 age_init();
3342 ccc_init();
3343 nfdi_init();
3344 nfdicf_init();
3342 fprintf(file, "\t.utf8agetab = utf8agetab,\n");
3343 fprintf(file, "\t.utf8agetab_size = ARRAY_SIZE(utf8agetab),\n");
3344 fprintf(file, "\n");
3345 fprintf(file, "\t.utf8nfdicfdata = utf8nfdicfdata,\n");
3346 fprintf(file, "\t.utf8nfdicfdata_size = ARRAY_SIZE(utf8nfdicfdata),\n");
3347 fprintf(file, "\n");
3348 fprintf(file, "\t.utf8nfdidata = utf8nfdidata,\n");
3349 fprintf(file, "\t.utf8nfdidata_size = ARRAY_SIZE(utf8nfdidata),\n");

--- 56 unchanged lines hidden (view full) ---

3406 if (verbose > 1)
3407 help();
3408 for (unichar = 0; unichar != 0x110000; unichar++)
3409 unicode_data[unichar].code = unichar;
3410 age_init();
3411 ccc_init();
3412 nfdi_init();
3413 nfdicf_init();
3414 ignore_init();
3345 corrections_init();
3346 hangul_decompose();
3347 nfdi_decompose();
3348 nfdicf_decompose();
3349 utf8_init();
3350 trees_init();
3351 trees_populate();
3352 trees_reduce();

--- 12 unchanged lines hidden ---
3415 corrections_init();
3416 hangul_decompose();
3417 nfdi_decompose();
3418 nfdicf_decompose();
3419 utf8_init();
3420 trees_init();
3421 trees_populate();
3422 trees_reduce();

--- 12 unchanged lines hidden ---