texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/parsetexi/Parsetexi.pm (parser),


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/parsetexi/Parsetexi.pm (parser), tp/Texinfo/XS/parsetexi/Parsetexi.xs (conf_set_documentlanguage), tp/Texinfo/XS/parsetexi/api.c (initialize_parsing, reset_parser), tp/Texinfo/XS/parsetexi/conf.c (conf_set_documentlanguage) (reset_conf), tp/Texinfo/XS/parsetexi/conf.h (CONF), tp/Texinfo/XS/parsetexi/parser.c (wipe_parser_global_variables): add documentlanguage and global_documentlanguage_fixed in CONF, add conf_set_documentlanguage to set them. Initialize global_documentla [...]
Date: Mon, 20 May 2024 05:30:32 -0400

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 5487cd1981 * tp/Texinfo/XS/parsetexi/Parsetexi.pm (parser), 
tp/Texinfo/XS/parsetexi/Parsetexi.xs (conf_set_documentlanguage), 
tp/Texinfo/XS/parsetexi/api.c (initialize_parsing, reset_parser), 
tp/Texinfo/XS/parsetexi/conf.c (conf_set_documentlanguage) (reset_conf), 
tp/Texinfo/XS/parsetexi/conf.h (CONF), tp/Texinfo/XS/parsetexi/parser.c 
(wipe_parser_global_variables): add documentlanguage and 
global_documentlanguage_fixed in CONF, add conf_set_documentlanguage to set 
them.  Initial [...]
5487cd1981 is described below

commit 5487cd19819a0fded47d521c482636773a93bff4
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon May 20 11:30:33 2024 +0200

    * tp/Texinfo/XS/parsetexi/Parsetexi.pm (parser),
    tp/Texinfo/XS/parsetexi/Parsetexi.xs (conf_set_documentlanguage),
    tp/Texinfo/XS/parsetexi/api.c (initialize_parsing, reset_parser),
    tp/Texinfo/XS/parsetexi/conf.c (conf_set_documentlanguage)
    (reset_conf), tp/Texinfo/XS/parsetexi/conf.h (CONF),
    tp/Texinfo/XS/parsetexi/parser.c (wipe_parser_global_variables): add
    documentlanguage and global_documentlanguage_fixed in CONF, add
    conf_set_documentlanguage to set them.  Initialize
    global_documentlanguage in initialize_parsing.  Remove
    parser_set_documentlanguage_override and
    set_documentlanguage_override.
    
    * tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line),
    tp/Texinfo/XS/parsetexi/parser.c: inline set_documentlanguage in
    end_line_misc_line.
---
 ChangeLog                            | 18 ++++++++++++++++++
 tp/Texinfo/XS/parsetexi/Parsetexi.pm |  2 +-
 tp/Texinfo/XS/parsetexi/Parsetexi.xs |  2 +-
 tp/Texinfo/XS/parsetexi/api.c        | 15 ++++++---------
 tp/Texinfo/XS/parsetexi/api.h        |  1 -
 tp/Texinfo/XS/parsetexi/conf.c       | 11 +++++++++++
 tp/Texinfo/XS/parsetexi/conf.h       |  3 +++
 tp/Texinfo/XS/parsetexi/end_line.c   |  8 +++++++-
 tp/Texinfo/XS/parsetexi/parser.c     | 26 --------------------------
 tp/Texinfo/XS/parsetexi/parser.h     |  3 ---
 10 files changed, 47 insertions(+), 42 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e5f639961a..9d6b947c41 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2024-05-20  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/parsetexi/Parsetexi.pm (parser),
+       tp/Texinfo/XS/parsetexi/Parsetexi.xs (conf_set_documentlanguage),
+       tp/Texinfo/XS/parsetexi/api.c (initialize_parsing, reset_parser),
+       tp/Texinfo/XS/parsetexi/conf.c (conf_set_documentlanguage)
+       (reset_conf), tp/Texinfo/XS/parsetexi/conf.h (CONF),
+       tp/Texinfo/XS/parsetexi/parser.c (wipe_parser_global_variables): add
+       documentlanguage and global_documentlanguage_fixed in CONF, add
+       conf_set_documentlanguage to set them.  Initialize
+       global_documentlanguage in initialize_parsing.  Remove
+       parser_set_documentlanguage_override and
+       set_documentlanguage_override.
+
+       * tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line),
+       tp/Texinfo/XS/parsetexi/parser.c: inline set_documentlanguage in
+       end_line_misc_line.
+
 2024-05-20  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/parsetexi/Parsetexi.pm (parser),
diff --git a/tp/Texinfo/XS/parsetexi/Parsetexi.pm 
b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
index 6bcafec6a8..5bea49834f 100644
--- a/tp/Texinfo/XS/parsetexi/Parsetexi.pm
+++ b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
@@ -105,7 +105,7 @@ sub parser (;$$)
         parser_store_EXPANDED_FORMATS($conf->{'EXPANDED_FORMATS'});
       } elsif ($key eq 'documentlanguage') {
         if (defined ($conf->{$key})) {
-          parser_set_documentlanguage_override($conf->{$key});
+          conf_set_documentlanguage($conf->{$key});
         }
       } elsif ($key eq 'FORMAT_MENU') {
         if ($conf->{$key} and $conf->{$key} eq 'menu') {
diff --git a/tp/Texinfo/XS/parsetexi/Parsetexi.xs 
b/tp/Texinfo/XS/parsetexi/Parsetexi.xs
index c7aca34291..31c9c4a86a 100644
--- a/tp/Texinfo/XS/parsetexi/Parsetexi.xs
+++ b/tp/Texinfo/XS/parsetexi/Parsetexi.xs
@@ -202,7 +202,7 @@ parser_set_locale_encoding (value)
      char *value = (char *)SvPVutf8_nolen ($arg);
 
 void
-parser_set_documentlanguage_override (value)
+conf_set_documentlanguage (value)
      char *value = (char *)SvPVutf8_nolen ($arg);
 
 int
diff --git a/tp/Texinfo/XS/parsetexi/api.c b/tp/Texinfo/XS/parsetexi/api.c
index 25a3867ed9..1da2a0be95 100644
--- a/tp/Texinfo/XS/parsetexi/api.c
+++ b/tp/Texinfo/XS/parsetexi/api.c
@@ -59,6 +59,12 @@ initialize_parsing (void)
 
   init_values ();
 
+  free (global_documentlanguage);
+  if (conf.global_documentlanguage_fixed && conf.documentlanguage)
+    global_documentlanguage = strdup (conf.documentlanguage);
+  else
+    global_documentlanguage = 0;
+
   reset_context_stack ();
   reset_command_stack (&nesting_context.basic_inline_stack);
   reset_command_stack (&nesting_context.basic_inline_stack_on_line);
@@ -98,9 +104,6 @@ reset_parser (int local_debug_output)
 
   reset_conf ();
 
-  global_documentlanguage_fixed = 0;
-  set_documentlanguage (0);
-
   set_doc_encoding_for_input_file_name (1);
   set_input_file_name_encoding (0);
   set_locale_encoding (0);
@@ -209,12 +212,6 @@ parse_piece (const char *string, int line_nr)
   return document_descriptor;
 }
 
-void
-parser_set_documentlanguage_override (const char *value)
-{
-  set_documentlanguage_override (value);
-}
-
 void
 parser_set_DOC_ENCODING_FOR_INPUT_FILE_NAME (int i)
 {
diff --git a/tp/Texinfo/XS/parsetexi/api.h b/tp/Texinfo/XS/parsetexi/api.h
index 480ad02388..318286d696 100644
--- a/tp/Texinfo/XS/parsetexi/api.h
+++ b/tp/Texinfo/XS/parsetexi/api.h
@@ -17,6 +17,5 @@ void parser_set_accept_internalvalue (int value);
 void parser_set_DOC_ENCODING_FOR_INPUT_FILE_NAME (int i);
 void parser_set_input_file_name_encoding (const char *value);
 void parser_set_locale_encoding (const char *value);
-void parser_set_documentlanguage_override (const char *value);
 
 #endif
diff --git a/tp/Texinfo/XS/parsetexi/conf.c b/tp/Texinfo/XS/parsetexi/conf.c
index 16d968e170..9445e40fc8 100644
--- a/tp/Texinfo/XS/parsetexi/conf.c
+++ b/tp/Texinfo/XS/parsetexi/conf.c
@@ -96,11 +96,20 @@ conf_add_expanded_format (const char *format)
   add_expanded_format (conf.expanded_formats, format);
 }
 
+void
+conf_set_documentlanguage (const char *value)
+{
+  free (conf.documentlanguage);
+  conf.documentlanguage = value ? strdup (value) : 0;
+  conf.global_documentlanguage_fixed = 1;
+}
+
 void
 reset_conf (void)
 {
   wipe_values (&conf.values);
   clear_strings_list (&conf.include_directories);
+  free (conf.documentlanguage);
 
   conf.cpp_line_directives = 1;
   conf.debug = 1;
@@ -109,6 +118,8 @@ reset_conf (void)
   conf.no_index = 0;
   conf.no_user_commands = 0;
   conf.show_menu = 1;
+  conf.documentlanguage = 0;
+  conf.global_documentlanguage_fixed = 0;
 
   memcpy (conf.expanded_formats, default_expanded_formats,
           sizeof (conf.expanded_formats));
diff --git a/tp/Texinfo/XS/parsetexi/conf.h b/tp/Texinfo/XS/parsetexi/conf.h
index 5778ba04c5..9f96e22aef 100644
--- a/tp/Texinfo/XS/parsetexi/conf.h
+++ b/tp/Texinfo/XS/parsetexi/conf.h
@@ -27,6 +27,8 @@ typedef struct CONF {
     int no_index;
     int no_user_commands;
     int show_menu;
+    char *documentlanguage;
+    int global_documentlanguage_fixed;
 
     EXPANDED_FORMAT expanded_formats[7];
     VALUE_LIST values;
@@ -46,6 +48,7 @@ void conf_clear_INCLUDE_DIRECTORIES (void);
 void conf_add_include_directory (const char *filename);
 void conf_clear_expanded_formats (void);
 void conf_add_expanded_format (const char *format);
+void conf_set_documentlanguage (const char *value);
 
 void reset_conf (void);
 
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c 
b/tp/Texinfo/XS/parsetexi/end_line.c
index 2160007a94..52ed37c7d9 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -30,6 +30,7 @@
 /* for isascii_alnum whitespace_chars read_flag_name
    indices_info_index_by_name ultimate_index fatal */
 #include "utils.h"
+#include "conf.h"
 /* for parse_node_manual */
 #include "manipulate_tree.h"
 /* for parse_float_type add_to_float_record_list */
@@ -1518,7 +1519,12 @@ end_line_misc_line (ELEMENT *current)
                         }
                     }
                 }
-              set_documentlanguage (text);
+           /* Set the document language unless it was set on the command line. 
*/
+              if (!conf.global_documentlanguage_fixed)
+                {
+                  free (global_documentlanguage);
+                  global_documentlanguage = strdup (text);
+                }
             }
         }
       if (superfluous_arg)
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 08edc5af9d..c4d6f99911 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -316,31 +316,10 @@ reset_parser_counters (void)
 
 char *global_clickstyle = 0;
 char *global_documentlanguage = 0;
-int global_documentlanguage_fixed = 0;
 int global_accept_internalvalue = 0;
 
 enum kbd_enum global_kbdinputstyle = kbd_distinct;
 
-/* Set the document language unless it was set on the texi2any command line. */
-void
-set_documentlanguage (char *value)
-{
-  if (!global_documentlanguage_fixed)
-    {
-      free (global_documentlanguage);
-      global_documentlanguage = value ? strdup (value) : 0;
-    }
-}
-
-void
-set_documentlanguage_override (const char *value)
-{
-  free (global_documentlanguage);
-  global_documentlanguage = value ? strdup (value) : 0;
-  global_documentlanguage_fixed = 1;
-}
-
-
 void
 set_accept_internalvalue (int value)
 {
@@ -436,11 +415,6 @@ wipe_parser_global_variables (void)
 {
   free (global_clickstyle);
   global_clickstyle = strdup ("arrow");
-  if (!global_documentlanguage_fixed)
-    {
-      free (global_documentlanguage);
-      global_documentlanguage = 0;
-    }
   global_kbdinputstyle = kbd_distinct;
 }
 
diff --git a/tp/Texinfo/XS/parsetexi/parser.h b/tp/Texinfo/XS/parsetexi/parser.h
index b3f4ee45eb..f9ec1f6c47 100644
--- a/tp/Texinfo/XS/parsetexi/parser.h
+++ b/tp/Texinfo/XS/parsetexi/parser.h
@@ -69,7 +69,6 @@ typedef struct {
 ELEMENT *setup_document_root_and_before_node_section (void);
 int parse_texi (ELEMENT *root_elt, ELEMENT *current_elt);
 int parse_texi_document (void);
-void set_documentlanguage_override (const char *value);
 void set_accept_internalvalue (int value);
 void set_restricted (int value);
 
@@ -100,7 +99,6 @@ void start_empty_line_after_command (ELEMENT *current, char 
**line_inout,
 ELEMENT *begin_paragraph (ELEMENT *current);
 int is_end_current_command (ELEMENT *current, char **line,
                             enum command_id *end_cmd);
-void set_documentlanguage (char *);
 int check_space_element (ELEMENT *e);
 void gather_spaces_after_cmd_before_arg (ELEMENT *current);
 char *parse_command_name (char **ptr, int *single_char);
@@ -121,7 +119,6 @@ extern ELEMENT *current_part;
 
 extern char *global_clickstyle;
 extern char *global_documentlanguage;
-extern int global_documentlanguage_fixed;
 extern int global_accept_internalvalue;
 
 enum kbd_enum {kbd_none, kbd_code, kbd_example, kbd_distinct };



reply via email to

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