texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: Set remaining configuration vaiables in CONF


From: Patrice Dumas
Subject: branch master updated: Set remaining configuration vaiables in CONF
Date: Mon, 20 May 2024 07:04:04 -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 1d6515aa2d Set remaining configuration vaiables in CONF
1d6515aa2d is described below

commit 1d6515aa2d01f1fd17b5307542d685c60a7ba7a1
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon May 20 13:04:08 2024 +0200

    Set remaining configuration vaiables in CONF
    
    * tp/Texinfo/XS/main/translations.c (replace_convert_substrings),
    tp/Texinfo/XS/parsetexi/Parsetexi.pm (parser),
    tp/Texinfo/XS/parsetexi/Parsetexi.xs
    (conf_set_DOC_ENCODING_FOR_INPUT_FILE_NAME)
    (conf_set_INPUT_FILE_NAME_ENCODING, conf_set_LOCALE_ENCODING)
    (conf_set_accept_internalvalue), tp/Texinfo/XS/parsetexi/api.c
    (reset_parser), tp/Texinfo/XS/parsetexi/commands.c (lookup_command),
    tp/Texinfo/XS/parsetexi/conf.c
    (conf_set_DOC_ENCODING_FOR_INPUT_FILE_NAME)
    (conf_set_INPUT_FILE_NAME_ENCODING, conf_set_LOCALE_ENCODING)
    (conf_set_accept_internalvalue, reset_conf),
    tp/Texinfo/XS/parsetexi/conf.h (CONF), tp/Texinfo/XS/parsetexi/input.c
    (encode_file_name), tp/Texinfo/XS/parsetexi/parser.c: add
    doc_encoding_for_input_file_name, input_file_name_encoding,
    locale_encoding and accept_internalvalue in CONF.  Add the
    corresponding functions to set them.  Remove
    parser_set_DOC_ENCODING_FOR_INPUT_FILE_NAME,
    parser_set_input_file_name_encoding, parser_set_locale_encoding,
    parser_set_accept_internalvalue, set_input_file_name_encoding,
    set_locale_encoding, set_doc_encoding_for_input_file_name and the
    corresponding variables.
---
 ChangeLog                            | 28 +++++++++++++++++++++++++++-
 tp/Texinfo/XS/main/translations.c    |  4 ++--
 tp/Texinfo/XS/parsetexi/Parsetexi.pm |  8 ++++----
 tp/Texinfo/XS/parsetexi/Parsetexi.xs |  8 ++++----
 tp/Texinfo/XS/parsetexi/api.c        | 30 ------------------------------
 tp/Texinfo/XS/parsetexi/api.h        |  4 ----
 tp/Texinfo/XS/parsetexi/commands.c   |  5 ++---
 tp/Texinfo/XS/parsetexi/conf.c       | 35 ++++++++++++++++++++++++++++++++++-
 tp/Texinfo/XS/parsetexi/conf.h       | 11 ++++++++++-
 tp/Texinfo/XS/parsetexi/input.c      | 35 +++++------------------------------
 tp/Texinfo/XS/parsetexi/input.h      |  4 ----
 tp/Texinfo/XS/parsetexi/parser.c     |  7 -------
 tp/Texinfo/XS/parsetexi/parser.h     |  3 ---
 13 files changed, 88 insertions(+), 94 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e1c2514b3e..2ac200b5c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2024-05-20  Patrice Dumas  <pertusus@free.fr>
+
+       Set remaining configuration vaiables in CONF
+
+       * tp/Texinfo/XS/main/translations.c (replace_convert_substrings),
+       tp/Texinfo/XS/parsetexi/Parsetexi.pm (parser),
+       tp/Texinfo/XS/parsetexi/Parsetexi.xs
+       (conf_set_DOC_ENCODING_FOR_INPUT_FILE_NAME)
+       (conf_set_INPUT_FILE_NAME_ENCODING, conf_set_LOCALE_ENCODING)
+       (conf_set_accept_internalvalue), tp/Texinfo/XS/parsetexi/api.c
+       (reset_parser), tp/Texinfo/XS/parsetexi/commands.c (lookup_command),
+       tp/Texinfo/XS/parsetexi/conf.c
+       (conf_set_DOC_ENCODING_FOR_INPUT_FILE_NAME)
+       (conf_set_INPUT_FILE_NAME_ENCODING, conf_set_LOCALE_ENCODING)
+       (conf_set_accept_internalvalue, reset_conf),
+       tp/Texinfo/XS/parsetexi/conf.h (CONF), tp/Texinfo/XS/parsetexi/input.c
+       (encode_file_name), tp/Texinfo/XS/parsetexi/parser.c: add
+       doc_encoding_for_input_file_name, input_file_name_encoding,
+       locale_encoding and accept_internalvalue in CONF.  Add the
+       corresponding functions to set them.  Remove
+       parser_set_DOC_ENCODING_FOR_INPUT_FILE_NAME,
+       parser_set_input_file_name_encoding, parser_set_locale_encoding,
+       parser_set_accept_internalvalue, set_input_file_name_encoding,
+       set_locale_encoding, set_doc_encoding_for_input_file_name and the
+       corresponding variables.
+
 2024-05-20  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Common.pm (%parser_state_configuration)
@@ -13,7 +39,7 @@
 
        * tp/Texinfo/XS/parsetexi/api.c (initialize_parsing),
        tp/Texinfo/XS/parsetexi/parser.c: inline
-       wipe_parser_global_variablesin initialize_parsing.
+       wipe_parser_global_variables in initialize_parsing.
 
 2024-05-20  Patrice Dumas  <pertusus@free.fr>
 
diff --git a/tp/Texinfo/XS/main/translations.c 
b/tp/Texinfo/XS/main/translations.c
index ca6ca9da5c..db4e825e6a 100644
--- a/tp/Texinfo/XS/main/translations.c
+++ b/tp/Texinfo/XS/main/translations.c
@@ -475,7 +475,7 @@ replace_convert_substrings (char *translated_string,
    accept @txiinternalvalue as a valid Texinfo command, used to mark
    location in tree of substituted brace enclosed strings.
    */
-  parser_set_accept_internalvalue (1);
+  conf_set_accept_internalvalue (1);
   previous_no_index = conf_set_NO_INDEX (1);
   previous_no_user_commands = conf_set_NO_USER_COMMANDS (1);
 
@@ -497,7 +497,7 @@ replace_convert_substrings (char *translated_string,
     }
   clear_document_parser_errors (document_descriptor);
 
-  parser_set_accept_internalvalue (0);
+  conf_set_accept_internalvalue (0);
   conf_set_NO_INDEX (previous_no_index);
   conf_set_NO_USER_COMMANDS (previous_no_user_commands);
   conf_set_DEBUG (previous_debug_level);
diff --git a/tp/Texinfo/XS/parsetexi/Parsetexi.pm 
b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
index a6bb0f3a3a..1d9a500793 100644
--- a/tp/Texinfo/XS/parsetexi/Parsetexi.pm
+++ b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
@@ -123,18 +123,18 @@ sub parser (;$)
       } elsif ($key eq 'NO_USER_COMMANDS') {
         conf_set_NO_USER_COMMANDS($conf->{$key});
       } elsif ($key eq 'DOC_ENCODING_FOR_INPUT_FILE_NAME') {
-        parser_set_DOC_ENCODING_FOR_INPUT_FILE_NAME($conf->{$key});
+        conf_set_DOC_ENCODING_FOR_INPUT_FILE_NAME($conf->{$key});
       } elsif ($key eq 'INPUT_FILE_NAME_ENCODING') {
         if (defined($conf->{$key})) {
-          parser_set_input_file_name_encoding($conf->{$key});
+          conf_set_INPUT_FILE_NAME_ENCODING($conf->{$key});
         }
       } elsif ($key eq 'LOCALE_ENCODING') {
         if (defined($conf->{$key})) {
-          parser_set_locale_encoding($conf->{$key});
+          conf_set_LOCALE_ENCODING($conf->{$key});
         }
       } elsif ($key eq 'accept_internalvalue') {
         if ($conf->{$key}) {
-          parser_set_accept_internalvalue(1);
+          conf_set_accept_internalvalue(1);
         }
       } elsif ($key eq 'registrar' or $key eq 'COMMAND_LINE_ENCODING'
                or $key eq 'DEBUG') {
diff --git a/tp/Texinfo/XS/parsetexi/Parsetexi.xs 
b/tp/Texinfo/XS/parsetexi/Parsetexi.xs
index 31c9c4a86a..3fffb9a7fd 100644
--- a/tp/Texinfo/XS/parsetexi/Parsetexi.xs
+++ b/tp/Texinfo/XS/parsetexi/Parsetexi.xs
@@ -191,14 +191,14 @@ int
 conf_set_NO_USER_COMMANDS (int i)
 
 void
-parser_set_DOC_ENCODING_FOR_INPUT_FILE_NAME (int i)
+conf_set_DOC_ENCODING_FOR_INPUT_FILE_NAME (int i)
 
 void
-parser_set_input_file_name_encoding (value)
+conf_set_INPUT_FILE_NAME_ENCODING (value)
      char *value = (char *)SvPVutf8_nolen ($arg);
 
 void
-parser_set_locale_encoding (value)
+conf_set_LOCALE_ENCODING (value)
      char *value = (char *)SvPVutf8_nolen ($arg);
 
 void
@@ -209,6 +209,6 @@ int
 conf_set_DEBUG (int i)
 
 void
-parser_set_accept_internalvalue (int value)
+conf_set_accept_internalvalue (int value)
 
 
diff --git a/tp/Texinfo/XS/parsetexi/api.c b/tp/Texinfo/XS/parsetexi/api.c
index 4dad09eb16..14d699d293 100644
--- a/tp/Texinfo/XS/parsetexi/api.c
+++ b/tp/Texinfo/XS/parsetexi/api.c
@@ -105,12 +105,6 @@ reset_parser (int local_debug_output)
           "!!!!!!!!!!!!!!!! RESETTING THE PARSER !!!!!!!!!!!!!!!!!!!!!\n");
 
   reset_conf ();
-
-  set_doc_encoding_for_input_file_name (1);
-  set_input_file_name_encoding (0);
-  set_locale_encoding (0);
-
-  global_accept_internalvalue = 0;
 }
 
 /* Determine directory path based on file name.
@@ -214,24 +208,6 @@ parse_piece (const char *string, int line_nr)
   return document_descriptor;
 }
 
-void
-parser_set_DOC_ENCODING_FOR_INPUT_FILE_NAME (int i)
-{
-  set_doc_encoding_for_input_file_name (i);
-}
-
-void
-parser_set_input_file_name_encoding (const char *value)
-{
-  set_input_file_name_encoding (value);
-}
-
-void
-parser_set_locale_encoding (const char *value)
-{
-  set_locale_encoding (value);
-}
-
 void
 parser_reset_values_conf (void)
 {
@@ -244,9 +220,3 @@ parser_store_value (const char *name, const char *value)
   store_value (&conf.values, name, value);
 }
 
-void
-parser_set_accept_internalvalue (int value)
-{
-  set_accept_internalvalue (value);
-}
-
diff --git a/tp/Texinfo/XS/parsetexi/api.h b/tp/Texinfo/XS/parsetexi/api.h
index 318286d696..d9d65d2fe2 100644
--- a/tp/Texinfo/XS/parsetexi/api.h
+++ b/tp/Texinfo/XS/parsetexi/api.h
@@ -13,9 +13,5 @@ void reset_parser (int debug_output);
 
 void parser_reset_values_conf (void);
 void parser_store_value (const char *name, const char *value);
-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);
 
 #endif
diff --git a/tp/Texinfo/XS/parsetexi/commands.c 
b/tp/Texinfo/XS/parsetexi/commands.c
index 357ee6d2ab..9423fa1748 100644
--- a/tp/Texinfo/XS/parsetexi/commands.c
+++ b/tp/Texinfo/XS/parsetexi/commands.c
@@ -18,8 +18,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-/* for global_accept_internalvalue */
-#include "parser.h"
+#include "conf.h"
 #include "command_ids.h"
 #include "builtin_commands.h"
 /* for lookup_macro and unset_macro_record */
@@ -55,7 +54,7 @@ lookup_command (char *cmdname)
 
   /* txiinternalvalue is invalid if the corresponding parameter
    * is not set */
-  if (cmd == CM_txiinternalvalue && !global_accept_internalvalue)
+  if (cmd == CM_txiinternalvalue && !conf.accept_internalvalue)
     return 0;
 
   return cmd;
diff --git a/tp/Texinfo/XS/parsetexi/conf.c b/tp/Texinfo/XS/parsetexi/conf.c
index 9445e40fc8..201f39e7b5 100644
--- a/tp/Texinfo/XS/parsetexi/conf.c
+++ b/tp/Texinfo/XS/parsetexi/conf.c
@@ -104,21 +104,54 @@ conf_set_documentlanguage (const char *value)
   conf.global_documentlanguage_fixed = 1;
 }
 
+void
+conf_set_DOC_ENCODING_FOR_INPUT_FILE_NAME (int i)
+{
+  conf.doc_encoding_for_input_file_name = i;
+}
+
+void
+conf_set_INPUT_FILE_NAME_ENCODING (const char *value)
+{
+  free (conf.input_file_name_encoding);
+  conf.input_file_name_encoding = value ? strdup (value) : 0;
+}
+
+void
+conf_set_LOCALE_ENCODING (const char *value)
+{
+  free (conf.locale_encoding);
+  conf.locale_encoding =  value ? strdup (value) : 0;
+}
+
+void
+conf_set_accept_internalvalue (int value)
+{
+  conf.accept_internalvalue = value;
+}
+
 void
 reset_conf (void)
 {
   wipe_values (&conf.values);
   clear_strings_list (&conf.include_directories);
   free (conf.documentlanguage);
+  free (conf.input_file_name_encoding);
+  free (conf.locale_encoding);
 
+  conf.accept_internalvalue = 0;
   conf.cpp_line_directives = 1;
   conf.debug = 1;
+  conf.doc_encoding_for_input_file_name = 1;
+  conf.documentlanguage = 0;
   conf.ignore_space_after_braced_command_name = 1;
+  conf.input_file_name_encoding = 0;
+  conf.locale_encoding = 0;
   conf.max_macro_call_nesting = 100000;
   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,
diff --git a/tp/Texinfo/XS/parsetexi/conf.h b/tp/Texinfo/XS/parsetexi/conf.h
index 9f96e22aef..191bf49736 100644
--- a/tp/Texinfo/XS/parsetexi/conf.h
+++ b/tp/Texinfo/XS/parsetexi/conf.h
@@ -19,15 +19,20 @@
 #include "document_types.h"
 
 typedef struct CONF {
+    int accept_internalvalue;
     int cpp_line_directives;
+    int doc_encoding_for_input_file_name;
+    char *documentlanguage;
     int debug;
+    char *input_file_name_encoding;
     int ignore_space_after_braced_command_name;
     STRING_LIST include_directories;
+    char *locale_encoding;
     int max_macro_call_nesting;
     int no_index;
     int no_user_commands;
     int show_menu;
-    char *documentlanguage;
+
     int global_documentlanguage_fixed;
 
     EXPANDED_FORMAT expanded_formats[7];
@@ -49,6 +54,10 @@ 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 conf_set_DOC_ENCODING_FOR_INPUT_FILE_NAME (int i);
+void conf_set_INPUT_FILE_NAME_ENCODING (const char *value);
+void conf_set_LOCALE_ENCODING (const char *value);
+void conf_set_accept_internalvalue (int value);
 
 void reset_conf (void);
 
diff --git a/tp/Texinfo/XS/parsetexi/input.c b/tp/Texinfo/XS/parsetexi/input.c
index 9cb3de5d8c..906ac500d7 100644
--- a/tp/Texinfo/XS/parsetexi/input.c
+++ b/tp/Texinfo/XS/parsetexi/input.c
@@ -170,31 +170,6 @@ convert_to_utf8 (char *s)
   return ret;
 }
 
-
-static int doc_encoding_for_input_file_name = 1;
-static char *input_file_name_encoding = 0;
-static char *locale_encoding = 0;
-
-void
-set_input_file_name_encoding (const char *value)
-{
-  free (input_file_name_encoding);
-  input_file_name_encoding = value ? strdup (value) : 0;
-}
-
-void
-set_locale_encoding (const char *value)
-{
-  free (locale_encoding);
-  locale_encoding =  value ? strdup (value) : 0;
-}
-
-void
-set_doc_encoding_for_input_file_name (int value)
-{
-  doc_encoding_for_input_file_name = value;
-}
-
 /* Reverse the decoding of the filename to the input encoding, to retrieve
    the bytes that were present in the original Texinfo file.  Return
    value is freed when freeing small_strings. */
@@ -203,11 +178,11 @@ encode_file_name (char *filename)
 {
   if (!reverse_iconv)
     {
-      if (input_file_name_encoding)
+      if (conf.input_file_name_encoding)
         {
-          reverse_iconv = iconv_open (input_file_name_encoding, "UTF-8");
+          reverse_iconv = iconv_open (conf.input_file_name_encoding, "UTF-8");
         }
-      else if (doc_encoding_for_input_file_name)
+      else if (conf.doc_encoding_for_input_file_name)
         {
           if (current_encoding_conversion
               && strcmp (parsed_document->global_info.input_encoding_name,
@@ -218,9 +193,9 @@ encode_file_name (char *filename)
               reverse_iconv = iconv_open (conversion_encoding, "UTF-8");
             }
         }
-      else if (locale_encoding)
+      else if (conf.locale_encoding)
         {
-          reverse_iconv = iconv_open (locale_encoding, "UTF-8");
+          reverse_iconv = iconv_open (conf.locale_encoding, "UTF-8");
         }
     }
   if (reverse_iconv && reverse_iconv != (iconv_t) -1)
diff --git a/tp/Texinfo/XS/parsetexi/input.h b/tp/Texinfo/XS/parsetexi/input.h
index 74d8edc294..681f8b8f0d 100644
--- a/tp/Texinfo/XS/parsetexi/input.h
+++ b/tp/Texinfo/XS/parsetexi/input.h
@@ -32,8 +32,4 @@ extern int macro_expansion_nr;
 extern int value_expansion_nr;
 extern int after_end_fetch_nr;
 
-void set_input_file_name_encoding (const char *value);
-void set_locale_encoding (const char *value);
-void set_doc_encoding_for_input_file_name (int value);
-
 #endif
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 88ef405aa4..fa961e8e39 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -316,16 +316,9 @@ reset_parser_counters (void)
 
 char *global_clickstyle = 0;
 char *global_documentlanguage = 0;
-int global_accept_internalvalue = 0;
 
 enum kbd_enum global_kbdinputstyle = kbd_distinct;
 
-void
-set_accept_internalvalue (int value)
-{
-  global_accept_internalvalue = value;
-}
-
 /* Record the information from a command of global effect. */
 int
 register_global_command (ELEMENT *current)
diff --git a/tp/Texinfo/XS/parsetexi/parser.h b/tp/Texinfo/XS/parsetexi/parser.h
index 906748b165..ca73ea0b19 100644
--- a/tp/Texinfo/XS/parsetexi/parser.h
+++ b/tp/Texinfo/XS/parsetexi/parser.h
@@ -69,8 +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_accept_internalvalue (int value);
-void set_restricted (int value);
 
 void push_conditional_stack (enum command_id cond, SOURCE_MARK *source_mark);
 CONDITIONAL_STACK_ITEM *pop_conditional_stack (void);
@@ -119,7 +117,6 @@ extern ELEMENT *current_part;
 
 extern char *global_clickstyle;
 extern char *global_documentlanguage;
-extern int global_accept_internalvalue;
 
 enum kbd_enum {kbd_none, kbd_code, kbd_example, kbd_distinct };
 extern enum kbd_enum global_kbdinputstyle;



reply via email to

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