diff options
| author | Mattias Andrée <m@maandree.se> | 2026-10-18 13:21:09 +0200 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2026-10-18 13:21:09 +0200 |
| commit | 53b3e04d87f1f81845716e585efcba3c9f7cf9e5 (patch) | |
| tree | 6daf34677c9dc5b2dbda75881a084aff0d400f88 /UnicodeData.parse.c | |
| parent | Add to codepoint data whether the codepoint is a character or not (diff) | |
| download | libcmap-53b3e04d87f1f81845716e585efcba3c9f7cf9e5.tar.gz libcmap-53b3e04d87f1f81845716e585efcba3c9f7cf9e5.tar.bz2 libcmap-53b3e04d87f1f81845716e585efcba3c9f7cf9e5.tar.xz | |
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
| -rw-r--r-- | UnicodeData.parse.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/UnicodeData.parse.c b/UnicodeData.parse.c index f9b676c..14aff33 100644 --- a/UnicodeData.parse.c +++ b/UnicodeData.parse.c @@ -128,6 +128,8 @@ split(char **text) static int output_character_data(char *text) { + static int first_first = 1; + char *field, *numeric_value = NULL, *simple_uppercase_mapping; unsigned long int codepoint; const char *formatted; @@ -138,6 +140,17 @@ output_character_data(char *text) if (!(field = split(&text))) return 0; add_linef(".name = \"%s\"", field); + if (strstr(field, ", First>")) { + if (first_first) { + ret |= printf("static const struct libcmap_range gaplist[] = {\n"); + first_first = 0; + } else { + ret |= printf(",\n"); + } + ret |= printf("\t{UINT32_C(0x%04lX)", codepoint); + } else if (strstr(field, ", Last>")) { + ret |= printf(", UINT32_C(0x%04lX)}", codepoint); + } if (!(field = split(&text))) return 0; add_linef(", .general_category = GENERAL_CATEGORY_%s", field); @@ -215,7 +228,10 @@ output_character_data(char *text) add_linef(", .bidirectional_mirrored = BIDIRECTIONAL_MIRRORED_%s", field); if (!(field = split(&text))) return 0; - add_linef(", .unicode_1_name = \"%s\"", field); + if (*field) + add_linef(", .unicode_1_name = \"%s\"", field); + else + add_linef(", .unicode_1_name = NULL"); if (!(field = split(&text))) return 0; /* ISO 10646 comment field -- always empty as of Unicode 5.2.0 */ @@ -371,6 +387,8 @@ output(void) uint32_t *seq = NULL; size_t i, seqlen = 0u, off, end, ext; + ret |= printf("\n};\n"); + if (!nsegments) { fprintf(stderr, "%s: character list is empty\n", argv0); exit(1); |
