[gtk/wip/compose-parser: 2/3] composetable: Keep the number of sequences
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/compose-parser: 2/3] composetable: Keep the number of sequences
- Date: Thu, 15 Jul 2021 13:30:58 +0000 (UTC)
commit 264d592012c3d909e5fc4d07198ede73e1badbec
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Jul 15 08:14:40 2021 -0400
composetable: Keep the number of sequences
And print it out in tests.
Update all tests for this.
gtk/gtkcomposetable.c | 5 +++++
gtk/gtkcomposetable.h | 1 +
testsuite/gtk/compose/basic.expected | 1 +
testsuite/gtk/compose/codepoint.expected | 1 +
testsuite/gtk/compose/comments.expected | 1 +
testsuite/gtk/compose/hex.expected | 1 +
testsuite/gtk/compose/include.expected | 1 +
testsuite/gtk/compose/long.expected | 1 +
testsuite/gtk/compose/match.expected | 5 +++--
testsuite/gtk/compose/multi.expected | 1 +
testsuite/gtk/compose/octal.expected | 1 +
testsuite/gtk/compose/strings.expected | 1 +
testsuite/gtk/compose/system.expected | 1 +
testsuite/gtk/composetable.c | 3 ++-
14 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkcomposetable.c b/gtk/gtkcomposetable.c
index eb1ceeeca1..39ca2e3e92 100644
--- a/gtk/gtkcomposetable.c
+++ b/gtk/gtkcomposetable.c
@@ -879,6 +879,7 @@ parser_get_compose_table (GtkComposeParser *parser)
int first_pos;
int rest_pos;
int index_rowstride;
+ int n_sequences;
gunichar current_first;
parser_remove_duplicates (parser);
@@ -899,6 +900,7 @@ parser_get_compose_table (GtkComposeParser *parser)
char_data = g_string_new ("");
+ n_sequences = 0;
current_first = 0;
first_pos = 0;
rest_pos = n_first * index_rowstride;
@@ -958,6 +960,8 @@ parser_get_compose_table (GtkComposeParser *parser)
g_assert (encoded_value != 0);
data[rest_pos + len - 1] = encoded_value;
+ n_sequences++;
+
rest_pos += len;
for (i = len; i <= max_compose_len; i++)
@@ -980,6 +984,7 @@ parser_get_compose_table (GtkComposeParser *parser)
table->n_index_size = n_first;
table->n_chars = char_data->len;
table->char_data = g_string_free (char_data, FALSE);
+ table->n_sequences = n_sequences;
table->id = g_str_hash (parser->compose_file);
g_list_free (sequences);
diff --git a/gtk/gtkcomposetable.h b/gtk/gtkcomposetable.h
index 0e6c1aec9c..7a4c952f33 100644
--- a/gtk/gtkcomposetable.h
+++ b/gtk/gtkcomposetable.h
@@ -53,6 +53,7 @@ struct _GtkComposeTable
int n_index_size;
int data_size;
int n_chars;
+ int n_sequences;
guint32 id;
};
diff --git a/testsuite/gtk/compose/basic.expected b/testsuite/gtk/compose/basic.expected
index 96e2f4e0e3..465a4e37f8 100644
--- a/testsuite/gtk/compose/basic.expected
+++ b/testsuite/gtk/compose/basic.expected
@@ -1,3 +1,4 @@
+# n_sequences: 1
# max_seq_len: 4
# n_index_size: 1
# data_size: 9
diff --git a/testsuite/gtk/compose/codepoint.expected b/testsuite/gtk/compose/codepoint.expected
index 295e71882f..c1d11e791e 100644
--- a/testsuite/gtk/compose/codepoint.expected
+++ b/testsuite/gtk/compose/codepoint.expected
@@ -1,3 +1,4 @@
+# n_sequences: 1
# max_seq_len: 4
# n_index_size: 1
# data_size: 9
diff --git a/testsuite/gtk/compose/comments.expected b/testsuite/gtk/compose/comments.expected
index 683486e499..891c490a1a 100644
--- a/testsuite/gtk/compose/comments.expected
+++ b/testsuite/gtk/compose/comments.expected
@@ -1,3 +1,4 @@
+# n_sequences: 3
# max_seq_len: 2
# n_index_size: 1
# data_size: 9
diff --git a/testsuite/gtk/compose/hex.expected b/testsuite/gtk/compose/hex.expected
index f753c59688..7d2d26af98 100644
--- a/testsuite/gtk/compose/hex.expected
+++ b/testsuite/gtk/compose/hex.expected
@@ -1,3 +1,4 @@
+# n_sequences: 1
# max_seq_len: 4
# n_index_size: 1
# data_size: 9
diff --git a/testsuite/gtk/compose/include.expected b/testsuite/gtk/compose/include.expected
index bb0bd50a9c..8307b1c594 100644
--- a/testsuite/gtk/compose/include.expected
+++ b/testsuite/gtk/compose/include.expected
@@ -1,3 +1,4 @@
+# n_sequences: 1
# max_seq_len: 4
# n_index_size: 1
# data_size: 9
diff --git a/testsuite/gtk/compose/long.expected b/testsuite/gtk/compose/long.expected
index e50a95d39a..0846c7f6e9 100644
--- a/testsuite/gtk/compose/long.expected
+++ b/testsuite/gtk/compose/long.expected
@@ -1,3 +1,4 @@
+# n_sequences: 1
# max_seq_len: 11
# n_index_size: 1
# data_size: 23
diff --git a/testsuite/gtk/compose/match.expected b/testsuite/gtk/compose/match.expected
index 6a2deaa724..bed10c5a10 100644
--- a/testsuite/gtk/compose/match.expected
+++ b/testsuite/gtk/compose/match.expected
@@ -1,7 +1,8 @@
+# n_sequences: 3
# max_seq_len: 7
# n_index_size: 1
# data_size: 24
-# n_chars: 4
+# n_chars: 5
<Uff20> <U73> <U65> <U71> : "!" # U21
<Uff20> <U73> <U65> <U71> <U75> : "?" # U3f
-<Uff20> <U7a> <U77> <U69> <U6e> <U65> <U73> : "🥂"
+<Uff20> <U7a> <U77> <U69> <U6e> <U65> <U73> : "🥂" # U1f942
diff --git a/testsuite/gtk/compose/multi.expected b/testsuite/gtk/compose/multi.expected
index 72a9fbe92d..078f21f441 100644
--- a/testsuite/gtk/compose/multi.expected
+++ b/testsuite/gtk/compose/multi.expected
@@ -1,3 +1,4 @@
+# n_sequences: 3
# max_seq_len: 5
# n_index_size: 1
# data_size: 19
diff --git a/testsuite/gtk/compose/octal.expected b/testsuite/gtk/compose/octal.expected
index 96e2f4e0e3..465a4e37f8 100644
--- a/testsuite/gtk/compose/octal.expected
+++ b/testsuite/gtk/compose/octal.expected
@@ -1,3 +1,4 @@
+# n_sequences: 1
# max_seq_len: 4
# n_index_size: 1
# data_size: 9
diff --git a/testsuite/gtk/compose/strings.expected b/testsuite/gtk/compose/strings.expected
index 4eff96267a..84f13c765b 100644
--- a/testsuite/gtk/compose/strings.expected
+++ b/testsuite/gtk/compose/strings.expected
@@ -1,3 +1,4 @@
+# n_sequences: 4
# max_seq_len: 5
# n_index_size: 1
# data_size: 24
diff --git a/testsuite/gtk/compose/system.expected b/testsuite/gtk/compose/system.expected
index 04902d2c76..aac5ac82ea 100644
--- a/testsuite/gtk/compose/system.expected
+++ b/testsuite/gtk/compose/system.expected
@@ -1,3 +1,4 @@
+# n_sequences: 4909
# max_seq_len: 5
# n_index_size: 30
# data_size: 16521
diff --git a/testsuite/gtk/composetable.c b/testsuite/gtk/composetable.c
index ca5a5c0eea..9c3a4a6142 100644
--- a/testsuite/gtk/composetable.c
+++ b/testsuite/gtk/composetable.c
@@ -66,7 +66,8 @@ gtk_compose_table_print (GtkComposeTable *table)
str = g_string_new ("");
- g_string_append_printf (str, "# max_seq_len: %d\n# n_index_size: %d\n# data_size: %d\n# n_chars: %d\n",
+ g_string_append_printf (str, "# n_sequences: %d\n# max_seq_len: %d\n# n_index_size: %d\n# data_size: %d\n#
n_chars: %d\n",
+ table->n_sequences,
table->max_seq_len,
table->n_index_size,
table->data_size,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]