texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Mon, 23 Dec 2024 18:48:33 -0500 (EST)

branch: master
commit b44be9dab389b3e2d5f30a9814fddfbc192e6ab0
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Dec 21 15:39:25 2024 +0100

    * tp/Texinfo/XS/main/customization_options.c (clear_options_list):
    also clear the OF_set_in_list flags.
    
    * tp/Texinfo/XS/convert/texinfo.c (txi_converter_format_defaults),
    tp/Texinfo/XS/teximakehtml.c (main): do not set expanded_formats
    through txi_converter_format_defaults, remove corresponding argument,
    it should be set as a regular customization option.  Remove
    expanded_formats in teximakehtml.c.
    
    * tp/Texinfo/XS/teximakehtml.c (main, set_expansion, unset_expansion):
    always set EXPANDED_FORMATS as an added options in cmdline_options.
---
 ChangeLog                                  | 14 ++++++++++++++
 tp/Texinfo/XS/convert/texinfo.c            | 16 +---------------
 tp/Texinfo/XS/convert/texinfo.h            |  3 +--
 tp/Texinfo/XS/main/customization_options.c |  9 +++++++++
 tp/Texinfo/XS/teximakehtml.c               | 16 +++++++---------
 5 files changed, 32 insertions(+), 26 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e304b21548..8a8197625d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2024-12-21  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/main/customization_options.c (clear_options_list):
+       also clear the OF_set_in_list flags.
+
+       * tp/Texinfo/XS/convert/texinfo.c (txi_converter_format_defaults),
+       tp/Texinfo/XS/teximakehtml.c (main): do not set expanded_formats
+       through txi_converter_format_defaults, remove corresponding argument,
+       it should be set as a regular customization option.  Remove
+       expanded_formats in teximakehtml.c.
+
+       * tp/Texinfo/XS/teximakehtml.c (main, set_expansion, unset_expansion):
+       always set EXPANDED_FORMATS as an added options in cmdline_options.
+
 2024-12-21  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/main/utils.c (store_value, clear_value),
diff --git a/tp/Texinfo/XS/convert/texinfo.c b/tp/Texinfo/XS/convert/texinfo.c
index 50cb2084fd..84a5460566 100644
--- a/tp/Texinfo/XS/convert/texinfo.c
+++ b/tp/Texinfo/XS/convert/texinfo.c
@@ -175,8 +175,7 @@ txi_converter_format_defaults (const char *converted_format,
    The implementation is similar to parsetexi/Parsetexi.pm on purpose. */
 void
 txi_parser (const char *file_path, const char *locale_encoding,
-            const char **expanded_formats, const VALUE_LIST *values,
-            OPTIONS_LIST *options_list)
+            const VALUE_LIST *values, OPTIONS_LIST *options_list)
 {
   char *input_file_name_and_directory[2];
   char *input_directory;
@@ -208,8 +207,6 @@ txi_parser (const char *file_path, const char 
*locale_encoding,
 
   /* set from arguments.  Options override */
   parser_conf_set_LOCALE_ENCODING (locale_encoding);
-  for (i = 0; expanded_formats[i]; i++)
-    parser_conf_add_expanded_format (expanded_formats[i]);
 
   if (options_list)
     {
@@ -397,17 +394,6 @@ txi_converter_setup (const char *converted_format,
 
   conf = new_converter_initialization_info ();
 
-  /* prepare specific information for the converter */
-  /* Now already done in main program
-  if (output_format)
-    err_add_option_value (&conf->conf, "TEXINFO_OUTPUT_FORMAT",
-                          0, output_format);
-  else
-    err_add_option_value (&conf->conf, "TEXINFO_OUTPUT_FORMAT",
-                          0, converted_format);
-   */
-
-
   if (texinfo_language_config_dirs_in)
     copy_strings (texinfo_language_config_dirs,
                   texinfo_language_config_dirs_in);
diff --git a/tp/Texinfo/XS/convert/texinfo.h b/tp/Texinfo/XS/convert/texinfo.h
index f0a599329f..f86b88c89d 100644
--- a/tp/Texinfo/XS/convert/texinfo.h
+++ b/tp/Texinfo/XS/convert/texinfo.h
@@ -41,8 +41,7 @@ CONVERTER_INITIALIZATION_INFO *txi_converter_format_defaults (
                                OPTIONS_LIST *customizations);
 
 void txi_parser (const char *file_path, const char *locale_encoding,
-                const char **expanded_formats, const VALUE_LIST *values,
-                OPTIONS_LIST *options);
+                 const VALUE_LIST *values, OPTIONS_LIST *options);
 
 DOCUMENT *txi_parse_texi_file (const char *input_file_path, int *status);
 
diff --git a/tp/Texinfo/XS/main/customization_options.c 
b/tp/Texinfo/XS/main/customization_options.c
index 825f7096b0..a63858fc92 100644
--- a/tp/Texinfo/XS/main/customization_options.c
+++ b/tp/Texinfo/XS/main/customization_options.c
@@ -430,6 +430,15 @@ free_options_list (OPTIONS_LIST *options_list)
 void
 clear_options_list (OPTIONS_LIST *options_list)
 {
+  size_t i;
+
+  /* need to reset the flags too, otherwise the options will not be readded
+     to the list */
+  for (i = 0; i < options_list->number; i++)
+    {
+      size_t index = options_list->list[i] -1;
+      options_list->sorted_options[index]->flags &= ~OF_set_in_list;
+    }
   options_list->number = 0;
   clear_options (options_list->options);
 }
diff --git a/tp/Texinfo/XS/teximakehtml.c b/tp/Texinfo/XS/teximakehtml.c
index deda72c918..0644821ad4 100644
--- a/tp/Texinfo/XS/teximakehtml.c
+++ b/tp/Texinfo/XS/teximakehtml.c
@@ -102,7 +102,6 @@ static FORMAT_SPECIFICATION formats_table[] = {
   {NULL, 0, NULL}
 };
 
-static const char *expanded_formats[] = {"html", 0};
 static VALUE values_array[] = {
   {"txicommandconditionals", "1"}
 };
@@ -543,8 +542,6 @@ set_expansion (OPTIONS_LIST *options_list, STRING_LIST 
*ignored_formats,
 
   if (ignored_idx)
     remove_from_strings_list (ignored_formats, ignored_idx -1);
-
-  options_list_add_option_number (options_list, option->number);
 }
 
 static void
@@ -561,8 +558,6 @@ unset_expansion (OPTIONS_LIST *options_list, STRING_LIST 
*ignored_formats,
 
   if (!ignored_idx)
     add_string (format_name, ignored_formats);
-
-  options_list_add_option_number (options_list, option->number);
 }
 
 static void
@@ -824,6 +819,7 @@ main (int argc, char *argv[])
   STRING_LIST prepended_include_directories;
   char *texinfo_output_format_env;
   OPTION *output_format_option;
+  OPTION *expanded_formats_option;
   const char *output_format;
   const char *converted_format;
   FORMAT_SPECIFICATION *format_specification = 0;
@@ -1409,6 +1405,8 @@ main (int argc, char *argv[])
   memset (&default_expanded_formats, 0, sizeof (STRING_LIST));
   format_expanded_formats (&default_expanded_formats, format_specification);
 
+  expanded_formats_option = &cmdline_options.options->EXPANDED_FORMATS;
+
   for (i = 0; i < ignored_formats.number; i++)
     {
       size_t ignored_fmt_nr
@@ -1418,12 +1416,13 @@ main (int argc, char *argv[])
     }
   for (i = 0; i < default_expanded_formats.number; i++)
     {
-      OPTION *option = &cmdline_options.options->EXPANDED_FORMATS;
-      STRING_LIST *expanded_formats_list = option->o.strlist;
+      STRING_LIST *expanded_formats_list = expanded_formats_option->o.strlist;
       if (!find_string (expanded_formats_list,
                         default_expanded_formats.list[i]))
         add_string (default_expanded_formats.list[i], expanded_formats_list);
     }
+  options_list_add_option_number (&cmdline_options,
+                                  expanded_formats_option->number);
 
 
   /* corresponds to eval "require $module"; in texi2any.pl */
@@ -1616,8 +1615,7 @@ main (int argc, char *argv[])
 
       /* Texinfo file parsing */
       /* initialize parser */
-      txi_parser (input_file_path, locale_encoding, expanded_formats,
-                  &values, &parser_options);
+      txi_parser (input_file_path, locale_encoding, &values, &parser_options);
 
       /* Texinfo document tree parsing */
       document = txi_parse_texi_file (input_file_path, &status);



reply via email to

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