diff --git a/gtk/compose/compose-parse.c b/gtk/compose/compose-parse.c index 7a3d511132..385a34fb77 100644 --- a/gtk/compose/compose-parse.c +++ b/gtk/compose/compose-parse.c @@ -7,7 +7,8 @@ * character data, and definitions for the builtin compose table of GTK. * Run it like this: * - * compose-parse Compose sequences chars gtkcomposedata.h + * cpp -DXCOMM='#' Compose.pre | sed -e 's/^ *#/#/' > Compose + * compose-parse Compose sequences-little-endian sequences-big-endian chars gtkcomposedata.h * * The GTK build expects the output files to be in the source tree, in * the gtk/compose directory. @@ -15,15 +16,19 @@ int main (int argc, char *argv[]) { + const guint16 *sequences_le; + const guint16 *sequences_be; + guint16 *other_sequences; GtkComposeTable *table; GError *error = NULL; GString *str; + gsize i; setlocale (LC_ALL, ""); if (argc < 5) { - g_print ("Usage: compose-parse INPUT OUTPUT1 OUTPUT2 OUTPUT3\n"); + g_print ("Usage: compose-parse INPUT SEQUENCES-LE SEQUENCES-BE CHARS HEADER\n"); exit (1); } @@ -31,11 +36,26 @@ main (int argc, char *argv[]) if (!table) g_error ("Failed to parse %s", argv[1]); +#if G_BYTE_ORDER == G_BIG_ENDIAN + sequences_le = other_sequences = g_new0 (guint16, table->data_size); + sequences_be = (const guint16 *) table->data; +#else + sequences_le = (const guint16 *) table->data; + sequences_be = other_sequences = g_new0 (guint16, table->data_size); +#endif + + for (i = 0; i < table->data_size; i++) + other_sequences[i] = GUINT16_SWAP_LE_BE (table->data[i]); + /* data_size is the size in guint16 */ - if (!g_file_set_contents (argv[2], (char *)table->data, 2 * table->data_size, &error)) + if (!g_file_set_contents (argv[2], (char *) sequences_le, 2 * table->data_size, &error)) g_error ("%s", error->message); - if (!g_file_set_contents (argv[3], table->char_data, table->n_chars + 1, &error)) + /* data_size is the size in guint16 */ + if (!g_file_set_contents (argv[3], (char *) sequences_be, 2 * table->data_size, &error)) + g_error ("%s", error->message); + + if (!g_file_set_contents (argv[4], table->char_data, table->n_chars + 1, &error)) g_error ("%s", error->message); str = g_string_new (""); @@ -55,10 +75,11 @@ main (int argc, char *argv[]) "\n" "#endif\n"); - if (!g_file_set_contents (argv[4], str->str, str->len, &error)) + if (!g_file_set_contents (argv[5], str->str, str->len, &error)) g_error ("%s", error->message); g_string_free (str, TRUE); + g_free (other_sequences); return 0; } diff --git a/gtk/compose/gtkcomposedata.h b/gtk/compose/gtkcomposedata.h index 442696218c..09b0263a7f 100644 --- a/gtk/compose/gtkcomposedata.h +++ b/gtk/compose/gtkcomposedata.h @@ -3,7 +3,7 @@ #define MAX_SEQ_LEN 5 #define N_INDEX_SIZE 30 -#define DATA_SIZE 16447 +#define DATA_SIZE 16477 #define N_CHARS 1241 #endif diff --git a/gtk/compose/sequences-big-endian b/gtk/compose/sequences-big-endian new file mode 100644 index 0000000000..e8b971c317 Binary files /dev/null and b/gtk/compose/sequences-big-endian differ diff --git a/gtk/compose/sequences b/gtk/compose/sequences-little-endian similarity index 86% rename from gtk/compose/sequences rename to gtk/compose/sequences-little-endian index 39984d4125..dad83a8cc6 100644 Binary files a/gtk/compose/sequences and b/gtk/compose/sequences-little-endian differ diff --git a/gtk/gen-gtk-gresources-xml.py b/gtk/gen-gtk-gresources-xml.py index 8a8da4254e..81c06637bc 100644 --- a/gtk/gen-gtk-gresources-xml.py +++ b/gtk/gen-gtk-gresources-xml.py @@ -21,6 +21,7 @@ def replace_if_changed(new, old): os.remove(new) srcdir = sys.argv[1] +endian = sys.argv[2] xml = ''' @@ -84,13 +85,13 @@ for f in get_files('inspector', '.ui'): xml += ''' inspector/inspector.css emoji/en.data - compose/sequences + compose/sequences-{0}-endian compose/chars -''' +'''.format(endian) -if len(sys.argv) > 2: - outfile = sys.argv[2] +if len(sys.argv) > 3: + outfile = sys.argv[3] tmpfile = outfile + '~' with open(tmpfile, 'w') as f: f.write(xml) diff --git a/gtk/meson.build b/gtk/meson.build index a4cdfabecc..21b7bb8b29 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -838,6 +838,7 @@ gtk_gresources_xml = configure_file(output: 'gtk.gresources.xml', command: [ gen_gtk_gresources_xml, meson.current_source_dir(), + host_machine.endian(), '@OUTPUT@' ], ) diff --git a/testsuite/gtk/compose/system.expected b/testsuite/gtk/compose/system.expected index c807827bbf..93c51ebb68 100644 --- a/testsuite/gtk/compose/system.expected +++ b/testsuite/gtk/compose/system.expected @@ -1,7 +1,7 @@ -# n_sequences: 4874 +# n_sequences: 4884 # max_seq_len: 5 # n_index_size: 30 -# data_size: 16447 +# data_size: 16477 # n_chars: 1241 : "ΐ" # U390 : "ΰ" # U3b0 @@ -1959,6 +1959,7 @@ : "Ġ" # U120 : ">" # U3e : "Ğ" # U11e + : "Ğ" # U11e : "Ğ" # U11e : "Ḩ" # U1e28 : "Ï" # Ucf @@ -2512,6 +2513,7 @@ : "ġ" # U121 : "ğ" # U11f : ">" # U3e + : "ğ" # U11f : "ğ" # U11f : "ḩ" # U1e29 : "ï" # Uef @@ -2611,11 +2613,19 @@ : "ų" # U173 : "û" # Ufb : "Ă" # U102 + : "Ĕ" # U114 + : "Ğ" # U11e + : "Ĭ" # U12c + : "Ŏ" # U14e : "Ŭ" # U16c : "û" # Ufb : "ū" # U16b : "ù" # Uf9 : "ă" # U103 + : "ĕ" # U115 + : "ğ" # U11f + : "ĭ" # U12d + : "ŏ" # U14f : "ŭ" # U16d : "ũ" # U169 : "ü" # Ufc