From 53b3e04d87f1f81845716e585efcba3c9f7cf9e5 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 18 Oct 2026 13:21:09 +0200 Subject: Misc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- UnicodeData.parse.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'UnicodeData.parse.c') 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); -- cgit v1.3.1