[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Wed, 23 Oct 2024 08:18:38 -0400 (EDT) |
branch: master
commit a3a3ec1e9a52df158b299ecd5cdddaaafa5a3ba4
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Oct 23 14:18:30 2024 +0200
* tp/Texinfo/XS/main/element_types.awk: do not set flags that are
not directly used in C code, but are used to determine the size of the
lements info array.
---
ChangeLog | 6 ++++++
tp/Texinfo/XS/main/element_types.awk | 13 ++++++++++---
tp/Texinfo/XS/main/element_types.c | 36 ++++++++++++++++++------------------
tp/Texinfo/XS/main/types_data.h | 3 +++
4 files changed, 37 insertions(+), 21 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c46a57a516..0f432f999f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-10-23 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/main/element_types.awk: do not set flags that are
+ not directly used in C code, but are used to determine the size of the
+ lements info array.
+
2024-10-23 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/main/convert_to_texinfo.c (expand_cmd_args_to_texi)
diff --git a/tp/Texinfo/XS/main/element_types.awk
b/tp/Texinfo/XS/main/element_types.awk
index 494533521d..52db8ff0ce 100644
--- a/tp/Texinfo/XS/main/element_types.awk
+++ b/tp/Texinfo/XS/main/element_types.awk
@@ -81,15 +81,22 @@ END {
elt_info_number += 1;
}
if (type_flags[t] != "") {
- split(type_flags[t], flags_array, ",")
- for (flag_idx in flags_array) {
- if (flag_idx == 1) {
+ split(type_flags[t], flags_array, ",")
+ flags_str = "";
+ for (flag_idx in flags_array) {
+ # ignore flags that are useful to determine the size of the
+ # elements info array but are not directly used in code.
+ if (flags_array[flag_idx] != "braces" \
+ && flags_array[flag_idx] != "spaces_before" \
+ && flags_array[flag_idx] != "spaces_after") {
+ if (flags_str == "") {
flags_str = flags_array[flag_idx]
} else {
old_str = flags_str
flags_str = old_str "," flags_array[flag_idx]
}
}
+ }
}
if (flags_str == "") {
flags = "0"
diff --git a/tp/Texinfo/XS/main/element_types.c
b/tp/Texinfo/XS/main/element_types.c
index 1b9e9e3eb2..87107157e5 100644
--- a/tp/Texinfo/XS/main/element_types.c
+++ b/tp/Texinfo/XS/main/element_types.c
@@ -4,17 +4,17 @@
TYPE_DATA type_data[] = {
{0, 0, 0},
-{"index_entry_command", TF_spaces_before | TF_at_command, 1},
-{"definfoenclose_command", TF_braces | TF_at_command, 2},
+{"index_entry_command", TF_at_command, 1},
+{"definfoenclose_command", TF_at_command, 2},
{"nobrace_command", TF_at_command, 0},
-{"brace_noarg_command", TF_braces | TF_at_command, 2},
+{"brace_noarg_command", TF_at_command, 2},
{"container_command", TF_at_command, 0},
{"lineraw_command", TF_at_command, 0},
-{"line_command", TF_spaces_before | TF_at_command, 1},
-{"block_command", TF_spaces_before | TF_at_command, 1},
-{"brace_command", TF_braces | TF_at_command, 2},
-{"brace_args_command", TF_braces | TF_at_command, 2},
-{"context_brace_command", TF_braces | TF_spaces_before | TF_at_command, 2},
+{"line_command", TF_at_command, 1},
+{"block_command", TF_at_command, 1},
+{"brace_command", TF_at_command, 2},
+{"brace_args_command", TF_at_command, 2},
+{"context_brace_command", TF_at_command, 2},
{"empty_line", TF_text | TF_leading_space, 0},
{"raw", TF_text, 0},
{"ignorable_spaces_after_command", TF_text | TF_leading_space, 0},
@@ -40,9 +40,9 @@ TYPE_DATA type_data[] = {
{"rawpreformatted", 0, 0},
{"brace_container", 0, 0},
{"brace_command_context", 0, 0},
-{"brace_arg", TF_spaces_before | TF_spaces_after, 3},
-{"block_line_arg", TF_spaces_before | TF_spaces_after, 4},
-{"line_arg", TF_spaces_before | TF_spaces_after, 4},
+{"brace_arg", 0, 3},
+{"block_line_arg", 0, 4},
+{"line_arg", 0, 4},
{"following_arg", 0, 0},
{"rawline_arg", TF_text, 0},
{"menu_entry", 0, 0},
@@ -65,7 +65,7 @@ TYPE_DATA type_data[] = {
{"table_term", 0, 0},
{"table_definition", 0, 0},
{"inter_item", 0, 0},
-{"def_line", TF_spaces_before, 1},
+{"def_line", 0, 1},
{"def_item", 0, 0},
{"inter_def_item", 0, 0},
{"before_defline", 0, 0},
@@ -73,7 +73,7 @@ TYPE_DATA type_data[] = {
{"multitable_body", 0, 0},
{"row", 0, 0},
{"balanced_braces", 0, 0},
-{"bracketed_arg", TF_spaces_before | TF_spaces_after, 3},
+{"bracketed_arg", 0, 3},
{"def_line_arg", 0, 0},
{"untranslated_def_line_arg", 0, 0},
{"def_category", 0, 0},
@@ -87,11 +87,11 @@ TYPE_DATA type_data[] = {
{"untranslated", TF_text, 0},
{"elided_rawpreformatted", 0, 0},
{"elided_brace_command_arg", 0, 0},
-{"macro_call", TF_braces | TF_macro_call, 2},
-{"rmacro_call", TF_braces | TF_macro_call, 2},
-{"macro_call_line", TF_spaces_before | TF_macro_call, 1},
-{"rmacro_call_line", TF_spaces_before | TF_macro_call, 1},
-{"linemacro_call", TF_spaces_before | TF_macro_call, 1},
+{"macro_call", TF_macro_call, 2},
+{"rmacro_call", TF_macro_call, 2},
+{"macro_call_line", TF_macro_call, 1},
+{"rmacro_call_line", TF_macro_call, 1},
+{"linemacro_call", TF_macro_call, 1},
{"bracketed_linemacro_arg", TF_text, 0},
{"text", 0, 0},
{"_code", 0, 0},
diff --git a/tp/Texinfo/XS/main/types_data.h b/tp/Texinfo/XS/main/types_data.h
index 652fdcaa0d..b4bb1ce41e 100644
--- a/tp/Texinfo/XS/main/types_data.h
+++ b/tp/Texinfo/XS/main/types_data.h
@@ -27,9 +27,12 @@ typedef struct types_struct {
extern TYPE_DATA type_data[];
#define TF_text 0x0001
+/* Used to determine elt_info_number in generated TYPE_DATA generated,
+ but not directly used in code
#define TF_braces 0x0002
#define TF_spaces_before 0x0004
#define TF_spaces_after 0x0008
+ */
#define TF_macro_call 0x0010
#define TF_at_command 0x0020
#define TF_leading_space 0x0040