texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]


From: Patrice Dumas
Date: Wed, 23 Oct 2024 16:46:35 -0400 (EDT)

branch: master
commit 4a80fa611941b9610b650bf4d924349d618808b1
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Oct 23 22:44:01 2024 +0200

    * tp/Texinfo/XS/main/element_types.txt,
    tp/Texinfo/XS/convert/convert_html.c (html_convert_tree_append),
    tp/Texinfo/XS/main/build_perl_info.c (element_to_perl_hash): change
    TF_at_command to TF_c_only to flag types specific of C.
    
    * tp/Texinfo/XS/main/element_types.txt: add information on flags.
---
 ChangeLog                            |  9 +++++++
 tp/Texinfo/ParserNonXS.pm            |  1 +
 tp/Texinfo/XS/convert/convert_html.c |  4 +--
 tp/Texinfo/XS/main/build_perl_info.c |  4 +--
 tp/Texinfo/XS/main/element_types.c   | 22 ++++++++--------
 tp/Texinfo/XS/main/element_types.txt | 50 +++++++++++++++++++++++++++---------
 tp/Texinfo/XS/main/types_data.h      |  2 +-
 7 files changed, 62 insertions(+), 30 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8b289bddb5..0bec2ceec2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,15 @@
 
        See 
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=947388eb043ea1c44b37df94046e1eee790ad776
 
+2024-10-23  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/main/element_types.txt,
+       tp/Texinfo/XS/convert/convert_html.c (html_convert_tree_append),
+       tp/Texinfo/XS/main/build_perl_info.c (element_to_perl_hash): change
+       TF_at_command to TF_c_only to flag types specific of C.
+
+       * tp/Texinfo/XS/main/element_types.txt: add information on flags.
+
 2024-10-23  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/parsetexi/close.c (remove_empty_content): check cmd to
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index b290631d12..dc5312dfab 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -385,6 +385,7 @@ foreach my $type ('brace_arg', 'brace_container') {
   $type_without_paragraph{$type} = 1;
 };
 
+# To keep in sync with XS main/element_types.txt leading_space flag
 my %leading_space_types;
 foreach my $type ('empty_line', 'ignorable_spaces_after_command',
         'internal_spaces_after_command', 'internal_spaces_before_argument',
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index aeb991e47b..9f82c7e824 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -1224,9 +1224,7 @@ html_convert_tree_append (CONVERTER *self, const ELEMENT 
*element,
             be known in Perl for the formatting function to be set to
             be ignored?
           */
-           || (type_data[element->type].flags & TF_at_command
-               && element->type != ET_index_entry_command
-               && element->type != ET_definfoenclose_command)))
+           || type_data[element->type].flags & TF_c_only))
        && (!cmd
            || self->current_commands_conversion_function[cmd].status
                                                      == FRS_status_ignored))
diff --git a/tp/Texinfo/XS/main/build_perl_info.c 
b/tp/Texinfo/XS/main/build_perl_info.c
index b063bd33c6..19de3c5bdf 100644
--- a/tp/Texinfo/XS/main/build_perl_info.c
+++ b/tp/Texinfo/XS/main/build_perl_info.c
@@ -746,9 +746,7 @@ element_to_perl_hash (ELEMENT *e, int avoid_recursion)
   /* non-text elements */
 
   if (e->type
-      && (!(type_data[e->type].flags & TF_at_command)
-          || e->type == ET_index_entry_command
-          || e->type == ET_definfoenclose_command))
+      && !(type_data[e->type].flags & TF_c_only))
     {
       sv = newSVpv (type_data[e->type].name, 0);
       hv_store (e->hv, "type", strlen ("type"), sv, HSH_type);
diff --git a/tp/Texinfo/XS/main/element_types.c 
b/tp/Texinfo/XS/main/element_types.c
index 87107157e5..0a922ee325 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_at_command, 1},
-{"definfoenclose_command", TF_at_command, 2},
-{"nobrace_command", TF_at_command, 0},
-{"brace_noarg_command", TF_at_command, 2},
-{"container_command", TF_at_command, 0},
-{"lineraw_command", TF_at_command, 0},
-{"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},
+{"index_entry_command", 0, 1},
+{"definfoenclose_command", 0, 2},
+{"nobrace_command", TF_c_only, 0},
+{"brace_noarg_command", TF_c_only, 2},
+{"container_command", TF_c_only, 0},
+{"lineraw_command", TF_c_only, 0},
+{"line_command", TF_c_only, 1},
+{"block_command", TF_c_only, 1},
+{"brace_command", TF_c_only, 2},
+{"brace_args_command", TF_c_only, 2},
+{"context_brace_command", TF_c_only, 2},
 {"empty_line", TF_text | TF_leading_space, 0},
 {"raw", TF_text, 0},
 {"ignorable_spaces_after_command", TF_text | TF_leading_space, 0},
diff --git a/tp/Texinfo/XS/main/element_types.txt 
b/tp/Texinfo/XS/main/element_types.txt
index 49639646bb..f103a6e56c 100644
--- a/tp/Texinfo/XS/main/element_types.txt
+++ b/tp/Texinfo/XS/main/element_types.txt
@@ -15,25 +15,51 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# The first column holds type names, second column contains flags for types
+# The first column holds type names, second column contains flags.
+# Flags for text elements:
+#  text: distinguishes text from other elements
+#  leading_space: text elements with spaces appearing before actual text.
+#                 to keep in sync with Perl parser %leading_space_types.
+#
+# The following flags correspond to elements holding information on the tree
+# associated to the type.  The association is set in the parsing
+# code based on the command/container, not using these flags.  Therefore
+# the flags should be determined by looking at the parser code.  The main
+# use of these flags is to determine the number of slots needed by those
+# elements in the elt_info array in generated code.  These flags are not
+# direclty used in the C code.
+#  spaces_before: element containing the spaces appearing before the
+#                 argument
+#  braces: element containing the spaces appearing between the @-command name
+#          and the opening brace
+#  spaces_after: element containing the spaces appearing after the argument
+#
+# Other flags:
+#  macro_call: @-command like user-defined macros call that require some
+#              information not needed by other containers.  Mainly used in C
+#              specific code for memory management, passing to Perl.
+#  c_only: element type associated to @-commands appearing only in C, needed
+#          because each correspond to a different need for associated info
+#          element or strings.  Flag only used to avoid passing to Perl.
+
 
 # Types for @-commands
-index_entry_command                    spaces_before,at_command
-definfoenclose_command                 braces,at_command
+index_entry_command                    spaces_before
+definfoenclose_command                 braces
 
 # only in C
-nobrace_command                        at_command
-brace_noarg_command                    braces,at_command
+nobrace_command                        c_only
+brace_noarg_command                    braces,c_only
 # @item, @tab
-container_command                      at_command
-lineraw_command                        at_command
-line_command                           spaces_before,at_command
-block_command                          spaces_before,at_command
-brace_command                          braces,at_command
+container_command                      c_only
+lineraw_command                        c_only
+line_command                           spaces_before,c_only
+block_command                          spaces_before,c_only
+brace_command                          braces,c_only
 # BRACE_arguments and BRACE_inline commands
-brace_args_command                     braces,at_command
+brace_args_command                     braces,c_only
 # BRACE_context commands
-context_brace_command                  braces,spaces_before,at_command
+context_brace_command                  braces,spaces_before,c_only
 
 # For text elements
 empty_line                                text,leading_space
diff --git a/tp/Texinfo/XS/main/types_data.h b/tp/Texinfo/XS/main/types_data.h
index b4bb1ce41e..0ee405e6ad 100644
--- a/tp/Texinfo/XS/main/types_data.h
+++ b/tp/Texinfo/XS/main/types_data.h
@@ -34,7 +34,7 @@ extern TYPE_DATA type_data[];
 #define TF_spaces_after       0x0008
  */
 #define TF_macro_call         0x0010
-#define TF_at_command         0x0020
+#define TF_c_only             0x0020
 #define TF_leading_space      0x0040
 
 #endif



reply via email to

[Prev in Thread] Current Thread [Next in Thread]