texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Thu, 4 Jan 2024 06:03:05 -0500 (EST)

branch: master
commit 2bcf8674353425205e287bd4c46c3915bed2010c
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Jan 4 12:02:49 2024 +0100

    * tp/Texinfo/Convert/HTML.pm (_XS_reset_output_init_conf): define for
    Non XS.
    
    * tp/Texinfo/XS/main/utils.c (set_informative_command_value):
    rearrange code.
    
    * tp/Texinfo/XS/convert/ConvertXS.xs
    (html_prepare_converted_output_info): do not copy configuration from
    perl, it should be already set in XS through the overrided functions.
    
    * tp/Texinfo/XS/main/get_perl_info.c (init_copy_sv_options)
    (copy_converter_conf_sv): rename copy_sv_options as
    init_copy_sv_options and recopy_converter_conf_sv as
    copy_converter_conf_sv.  Update callers.
    
    * tp/Texinfo/XS/main/get_perl_info.c (copy_converter_conf_sv)
    (html_get_direction_icons_sv), tp/Texinfo/XS/main/utils.c
    (html_clear_direction_icons, clear_option),
    tp/maintain/regenerate_C_options_info.pl (clear_options): add the
    possibility to clear options without freeing them with clear_option
    and clear_options.  Do that in copy_converter_conf_sv if the conf is
    already set.  Allocate icons in html_get_direction_icons_sv only if
    the number was 0.
    
    * tp/Texinfo/XS/main/get_perl_info.c (get_sv_options)
    (get_sv_configured_options, copy_converter_conf_sv, set_conf)
    (force_conf), tp/maintain/regenerate_C_options_info.pl
    (set_option_key_configured): separate setting configured field, with
    get_sv_configured_options and set_option_key_configured, from setting
    options values.  Add a force argument to functions to force setting
    options by ignoring the option configured field if set.
    
    * tp/Texinfo/XS/main/get_perl_info.c (converter_initialize):
    call directly new_options and call copy_converter_conf_sv to copy
    options values.
---
 ChangeLog                                  |  38 +++++++
 tp/Texinfo/Convert/HTML.pm                 |   4 +
 tp/Texinfo/XS/convert/ConvertXS.xs         |   2 -
 tp/Texinfo/XS/convert/get_html_perl_info.c |   6 +-
 tp/Texinfo/XS/main/DocumentXS.xs           |   6 +-
 tp/Texinfo/XS/main/get_perl_info.c         | 156 +++++++++++++++--------------
 tp/Texinfo/XS/main/get_perl_info.h         |  14 ++-
 tp/Texinfo/XS/main/utils.c                 |  58 +++++++++--
 tp/Texinfo/XS/main/utils.h                 |   5 +-
 tp/maintain/regenerate_C_options_info.pl   |  45 ++++++---
 10 files changed, 226 insertions(+), 108 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 45c85badff..967fbac38d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,41 @@
+2024-01-04  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/HTML.pm (_XS_reset_output_init_conf): define for
+       Non XS.
+
+       * tp/Texinfo/XS/main/utils.c (set_informative_command_value):
+       rearrange code.
+
+       * tp/Texinfo/XS/convert/ConvertXS.xs
+       (html_prepare_converted_output_info): do not copy configuration from
+       perl, it should be already set in XS through the overrided functions.
+
+       * tp/Texinfo/XS/main/get_perl_info.c (init_copy_sv_options)
+       (copy_converter_conf_sv): rename copy_sv_options as
+       init_copy_sv_options and recopy_converter_conf_sv as
+       copy_converter_conf_sv.  Update callers.
+
+       * tp/Texinfo/XS/main/get_perl_info.c (copy_converter_conf_sv)
+       (html_get_direction_icons_sv), tp/Texinfo/XS/main/utils.c
+       (html_clear_direction_icons, clear_option),
+       tp/maintain/regenerate_C_options_info.pl (clear_options): add the
+       possibility to clear options without freeing them with clear_option
+       and clear_options.  Do that in copy_converter_conf_sv if the conf is
+       already set.  Allocate icons in html_get_direction_icons_sv only if
+       the number was 0.
+
+       * tp/Texinfo/XS/main/get_perl_info.c (get_sv_options)
+       (get_sv_configured_options, copy_converter_conf_sv, set_conf)
+       (force_conf), tp/maintain/regenerate_C_options_info.pl
+       (set_option_key_configured): separate setting configured field, with
+       get_sv_configured_options and set_option_key_configured, from setting
+       options values.  Add a force argument to functions to force setting
+       options by ignoring the option configured field if set.
+
+       * tp/Texinfo/XS/main/get_perl_info.c (converter_initialize):
+       call directly new_options and call copy_converter_conf_sv to copy
+       options values.
+
 2024-01-04  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/Converter.pm (converter, set_conf),
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 9538c7c710..02eb21464b 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -12205,6 +12205,10 @@ sub _html_convert_output($$$$$$$$)
   return $text_output;
 }
 
+sub _XS_reset_output_init_conf($$)
+{
+}
+
 # Main function for outputting a manual in HTML.
 # $SELF is the output converter object of class Texinfo::Convert::HTML (this
 # module), and $DOCUMENT is the parsed document from the parser and structuring
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs 
b/tp/Texinfo/XS/convert/ConvertXS.xs
index a531d40b94..973f4fa58a 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -1814,8 +1814,6 @@ html_prepare_converted_output_info (SV *converter_in)
            {
              HV *converter_hv = (HV *) SvRV (converter_in);
 
-             recopy_converter_conf_sv (converter_hv, self, &self->conf, 
"conf");
-
              html_prepare_converted_output_info (self);
              if (self->added_title_tree)
                build_texinfo_tree (self->title_tree, 1);
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.c 
b/tp/Texinfo/XS/convert/get_html_perl_info.c
index 4850e8c2dc..d9b6487f47 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.c
@@ -1076,8 +1076,10 @@ html_converter_initialize_sv (SV *converter_sv,
 
   /* at that point, the format specific informations, in particular the number
      of special elements is available, such that all the options can be
-     passed to C */
-  recopy_converter_conf_sv (converter_hv, converter, &converter->conf, "conf");
+     passed to C.  It is important to set the force argument to 1 to get
+     all the configuration, even if the configured field is set */
+  copy_converter_conf_sv (converter_hv, converter,
+                          &converter->conf, "conf", 1);
 }
 
 void
diff --git a/tp/Texinfo/XS/main/DocumentXS.xs b/tp/Texinfo/XS/main/DocumentXS.xs
index 5cbb2858ff..5db1f4098c 100644
--- a/tp/Texinfo/XS/main/DocumentXS.xs
+++ b/tp/Texinfo/XS/main/DocumentXS.xs
@@ -165,7 +165,7 @@ set_document_options (SV *sv_options_in, SV *document_in)
                                              "set_document_options");
         if (document)
           {
-            OPTIONS *options = copy_sv_options (sv_options_in, 0, 0);
+            OPTIONS *options = init_copy_sv_options (sv_options_in, 0, 0);
             register_document_options (document, options);
           }
 
@@ -179,7 +179,7 @@ set_document_options (SV *sv_options_in, SV *document_in)
 # do not exist in XS/C data.
 
 # TODO not sure that the options_in argument is good to be
-# copy_sv_options argument, may need to retrieve a converter
+# init_copy_sv_options argument, may need to retrieve a converter
 # first or Parser configuration.  Does not matter much as
 # the approach does not work because replaced_substrings
 # perl element tree cannot be retrieved in C stored documents.
@@ -201,7 +201,7 @@ gdt (SV *options_in, string, ...)
       CODE:
          if (SvOK(options_in))
            {
-             options = copy_sv_options (options_in, 0, 0);
+             options = init_copy_sv_options (options_in, 0, 0);
            }
         if (items > 4 && SvOK(ST(4)))
            in_lang = (char *)SvPVutf8_nolen(ST(4));
diff --git a/tp/Texinfo/XS/main/get_perl_info.c 
b/tp/Texinfo/XS/main/get_perl_info.c
index e37af1a803..b5859d3203 100644
--- a/tp/Texinfo/XS/main/get_perl_info.c
+++ b/tp/Texinfo/XS/main/get_perl_info.c
@@ -269,48 +269,60 @@ get_line_message (CONVERTER *self, enum error_type type, 
int continuation,
 
 void
 get_sv_options (SV *sv, OPTIONS *options, CONVERTER *converter,
-                SV *configured_sv_in)
+                int force)
 {
   I32 hv_number;
   I32 i;
   HV *hv;
-  HV *configured_hv = 0;
 
   dTHX;
 
   hv = (HV *)SvRV (sv);
 
-  if (configured_sv_in)
-    configured_hv = (HV *)SvRV (configured_sv_in);
-
   hv_number = hv_iterinit (hv);
   for (i = 0; i < hv_number; i++)
     {
-      int configured = 0;
       char *key;
       I32 retlen;
       SV *value = hv_iternextsv(hv, &key, &retlen);
       if (value && SvOK (value))
         {
-          if (configured_hv)
-            {
-              SV **value_configured_sv
-                  = hv_fetch (configured_hv, key, strlen (key), 0);
-              if (value_configured_sv && SvOK (*value_configured_sv)
-                  && SvIV (*value_configured_sv))
-                configured = 1;
-            }
-          get_sv_option (options, key, value, configured, converter);
+          get_sv_option (options, key, value, force, converter);
+        }
+    }
+}
+
+void
+get_sv_configured_options (SV *configured_sv_in, OPTIONS *options)
+{
+  I32 hv_number;
+  I32 i;
+  HV *configured_hv;
+
+  dTHX;
+
+  configured_hv = (HV *)SvRV (configured_sv_in);
+
+  hv_number = hv_iterinit (configured_hv);
+  for (i = 0; i < hv_number; i++)
+    {
+      char *key;
+      I32 retlen;
+      SV *value = hv_iternextsv(configured_hv, &key, &retlen);
+      if (value && SvOK (value))
+        {
+          int configured = SvIV (value);
+          set_option_key_configured (options, key, configured);
         }
     }
 }
 
 
 OPTIONS *
-copy_sv_options (SV *sv_in, CONVERTER *converter, SV *configured_sv_in)
+init_copy_sv_options (SV *sv_in, CONVERTER *converter, int force)
 {
   OPTIONS *options = new_options ();
-  get_sv_options (sv_in, options, converter, configured_sv_in);
+  get_sv_options (sv_in, options, converter, force);
   return options;
 }
 
@@ -429,6 +441,28 @@ set_translated_commands (CONVERTER *converter, HV *hv_in)
     }
 }
 
+void
+copy_converter_conf_sv (HV *hv, CONVERTER *converter,
+                        OPTIONS **conf, const char *conf_key, int force)
+{
+  SV **conf_sv;
+
+  dTHX;
+
+  conf_sv = hv_fetch (hv, conf_key, strlen (conf_key), 0);
+
+  if (conf_sv && SvOK(*conf_sv))
+    {
+      if (*conf)
+        clear_options (*conf);
+      else
+        *conf = new_options ();
+
+      get_sv_options (*conf_sv, *conf, converter, force);
+    }
+}
+
+/* reset output_init_conf.  Can be called after it has been modified */
 /* Texinfo::Convert::Converter generic initialization for all the converters */
 /* Called early, in particuliar before any format specific code has been
    called */
@@ -436,8 +470,7 @@ int
 converter_initialize (SV *converter_sv)
 {
   HV *hv_in;
-  SV **conf_sv;
-  SV **converter_init_conf_sv;
+  SV **configured_sv;
   SV **output_format_sv;
   DOCUMENT *document;
   int converter_descriptor = 0;
@@ -489,27 +522,21 @@ converter_initialize (SV *converter_sv)
   fprintf (stderr, "XS|CONVERTER Init: %d; doc %d; %s\n", converter_descriptor,
                    converter->document->descriptor, converter->output_format);
     */
-  FETCH(conf)
-
-  if (conf_sv && SvOK (*conf_sv))
-    {
-      SV **configured_sv;
-      SV *configured_arg = 0;
 
-      FETCH(configured);
+  converter->conf = new_options ();
+  /* force is not set, but at this point, the configured field should not
+     be set, so it would not have an effect anyway */
+  copy_converter_conf_sv (hv_in, converter, &converter->conf, "conf", 0);
 
-      if (configured_sv && SvOK (*configured_sv))
-        configured_arg = *configured_sv;
-      converter->conf
-         = copy_sv_options (*conf_sv, converter, configured_arg);
-    }
+  converter->init_conf = new_options ();
+  copy_converter_conf_sv (hv_in, converter, &converter->init_conf,
+                                              "converter_init_conf", 1);
 
-  FETCH(converter_init_conf)
+  FETCH(configured);
 
-  if (converter_init_conf_sv && SvOK (*converter_init_conf_sv))
+  if (configured_sv && SvOK (*configured_sv))
     {
-      converter->init_conf
-         = copy_sv_options (*converter_init_conf_sv, converter, 0);
+      get_sv_configured_options (*configured_sv, converter->conf);
     }
 
 #undef FETCH
@@ -527,35 +554,6 @@ converter_initialize (SV *converter_sv)
   return converter_descriptor;
 }
 
-void
-recopy_converter_conf_sv (HV *hv, CONVERTER *converter,
-                          OPTIONS **conf, const char *conf_key)
-{
-  SV **conf_sv;
-
-  dTHX;
-
-  conf_sv = hv_fetch (hv, conf_key, strlen (conf_key), 0);
-
-  if (conf_sv && SvOK(*conf_sv))
-    {
-      SV **configured_sv;
-      SV *configured_arg = 0;
-
-      if (*conf)
-        free_options (*conf);
-      free (*conf);
-
-      configured_sv = hv_fetch (hv, "configured", strlen ("configured"), 0);
-
-      if (configured_sv && SvOK (*configured_sv))
-        configured_arg = *configured_sv;
-
-      *conf = copy_sv_options (*conf_sv, converter, configured_arg);
-    }
-}
-
-/* reset output_init_conf.  Can be called after it has been modified */
 void
 reset_output_init_conf (SV *sv_in, const char *warn_string)
 {
@@ -568,8 +566,8 @@ reset_output_init_conf (SV *sv_in, const char *warn_string)
 
   hv_in = (HV *)SvRV (sv_in);
 
-  recopy_converter_conf_sv (hv_in, converter, &converter->init_conf,
-                            "output_init_conf");
+  copy_converter_conf_sv (hv_in, converter, &converter->init_conf,
+                          "output_init_conf", 1);
 }
 
 /* code in comments allow to sort the index names to have a fixed order
@@ -806,7 +804,7 @@ void
 set_conf (CONVERTER *converter, const char *conf, SV *value)
 {
   if (converter->conf)
-    get_sv_option (converter->conf, conf, value, -1, converter);
+    get_sv_option (converter->conf, conf, value, 0, converter);
    /* Too early to have options set
   else
     fprintf (stderr, "HHH no converter conf %s\n", conf);
@@ -817,7 +815,7 @@ void
 force_conf (CONVERTER *converter, const char *conf, SV *value)
 {
   if (converter->conf)
-    get_sv_option (converter->conf, conf, value, 0, converter);
+    get_sv_option (converter->conf, conf, value, 1, converter);
 }
 
 /* output format specific */
@@ -869,7 +867,7 @@ copy_sv_options_for_convert_text (SV *sv_in)
   if (other_converter_options_sv)
     {
       text_options->other_converter_options
-         = copy_sv_options (*other_converter_options_sv, 0, 0);
+         = init_copy_sv_options (*other_converter_options_sv, 0, 1);
     }
 
   self_converter_options_sv = hv_fetch (hv_in, "self_converter_options",
@@ -878,7 +876,7 @@ copy_sv_options_for_convert_text (SV *sv_in)
   if (self_converter_options_sv)
     {
       text_options->self_converter_options
-         = copy_sv_options (*self_converter_options_sv, 0, 0);
+         = init_copy_sv_options (*self_converter_options_sv, 0, 1);
     }
 
   return text_options;
@@ -1073,14 +1071,20 @@ html_get_direction_icons_sv (CONVERTER *converter,
   if (!SvOK (icons_sv))
     return;
 
-  if (!converter || !converter->direction_unit_direction_name)
+  if (!converter || !converter->direction_unit_direction_name
+       /* the following is for consistency, but is not possible */
+      || converter->special_unit_varieties.number
+          + NON_SPECIAL_DIRECTIONS_NR <= 0)
     return;
 
-  direction_icons->number = converter->special_unit_varieties.number
-                        + NON_SPECIAL_DIRECTIONS_NR;
-  direction_icons->list = (char **) malloc
+  if (direction_icons->number == 0)
+    {
+      /* consistent with direction_unit_direction_name size */
+      direction_icons->number = converter->special_unit_varieties.number
+                                 + NON_SPECIAL_DIRECTIONS_NR;
+      direction_icons->list = (char **) malloc
            (direction_icons->number * sizeof (char *));
-  memset (direction_icons->list, 0, direction_icons->number * sizeof (char *));
+    }
 
   icons_hv = (HV *)SvRV (icons_sv);
 
@@ -1095,6 +1099,8 @@ html_get_direction_icons_sv (CONVERTER *converter,
           direction_icons->list[i]
             = strdup (SvPVutf8_nolen (*direction_icon_sv));
         }
+      else
+        direction_icons->list[i] = 0;
     }
 }
 
diff --git a/tp/Texinfo/XS/main/get_perl_info.h 
b/tp/Texinfo/XS/main/get_perl_info.h
index bd9344e2d2..2844d8644c 100644
--- a/tp/Texinfo/XS/main/get_perl_info.h
+++ b/tp/Texinfo/XS/main/get_perl_info.h
@@ -13,7 +13,11 @@
 
 /* in options_get_perl.c */
 void get_sv_option (OPTIONS *options, const char *key, SV *value,
-                    int configured, CONVERTER *converter);
+                    int force, CONVERTER *converter);
+/* in options_init_free.c */
+void set_option_key_configured (OPTIONS *options, const char *key,
+                                int configured);
+
 
 DOCUMENT *get_sv_tree_document (SV *tree_in, char *warn_string);
 DOCUMENT *get_sv_document_document (SV *document_in, char *warn_string);
@@ -27,10 +31,10 @@ void add_svav_to_string_list (SV *sv, STRING_LIST 
*string_list,
 SOURCE_INFO *get_source_info (SV *source_info_sv);
 void get_line_message (CONVERTER *self, enum error_type type, int continuation,
                        SV *error_location_info, char *message);
-OPTIONS *copy_sv_options (SV *sv_in, CONVERTER *converter,
-                          SV *configured_sv_in);
-void recopy_converter_conf_sv (HV *hv, CONVERTER *converter,
-                               OPTIONS **conf, const char *conf_key);
+OPTIONS *init_copy_sv_options (SV *sv_in, CONVERTER *converter, int force);
+void get_sv_configured_options (SV *configured_sv_in, OPTIONS *options);
+void copy_converter_conf_sv (HV *hv, CONVERTER *converter,
+                             OPTIONS **conf, const char *conf_key, int force);
 void set_conf (CONVERTER *converter, const char *conf, SV *value);
 void force_conf (CONVERTER *converter, const char *conf, SV *value);
 
diff --git a/tp/Texinfo/XS/main/utils.c b/tp/Texinfo/XS/main/utils.c
index bafc9792ed..fa54bebc31 100644
--- a/tp/Texinfo/XS/main/utils.c
+++ b/tp/Texinfo/XS/main/utils.c
@@ -1067,15 +1067,17 @@ void
 set_informative_command_value (OPTIONS *options, const ELEMENT *element)
 {
   char *value = 0;
-  enum command_id cmd = element_builtin_cmd (element);
-  if (cmd == CM_summarycontents)
-    cmd = CM_shortcontents;
 
   value = informative_command_value (element);
 
   if (value)
     {
-      OPTION *option = get_command_option (options, cmd);
+      OPTION *option;
+      enum command_id cmd = element_builtin_cmd (element);
+      if (cmd == CM_summarycontents)
+        cmd = CM_shortcontents;
+
+      option = get_command_option (options, cmd);
       if (option && option->configured <= 0)
         {
           if (option->type == GO_integer)
@@ -1397,8 +1399,7 @@ html_free_button_specification_list 
(BUTTON_SPECIFICATION_LIST *buttons)
   free (buttons);
 }
 
-void
-html_free_direction_icons (DIRECTION_ICON_LIST *direction_icons)
+void html_clear_direction_icons (DIRECTION_ICON_LIST *direction_icons)
 {
   if (!direction_icons)
     return;
@@ -1409,8 +1410,18 @@ html_free_direction_icons (DIRECTION_ICON_LIST 
*direction_icons)
       for (i = 0; i < direction_icons->number; i++)
         {
           free (direction_icons->list[i]);
+          direction_icons->list[i] = 0;
         }
     }
+}
+
+void
+html_free_direction_icons (DIRECTION_ICON_LIST *direction_icons)
+{
+  if (!direction_icons)
+    return;
+
+  html_clear_direction_icons (direction_icons);
   free (direction_icons->list);
 }
 
@@ -1425,6 +1436,40 @@ new_options (void)
   return options;
 }
 
+void
+clear_option (OPTION *option)
+{
+  switch (option->type)
+    {
+      case GO_char:
+      case GO_bytes:
+        free (option->string);
+        option->string = 0;
+        break;
+
+      case GO_bytes_string_list:
+      case GO_file_string_list:
+      case GO_char_string_list:
+        clear_strings_list (option->strlist);
+        break;
+
+      case GO_buttons:
+        html_free_button_specification_list (option->buttons);
+        option->buttons = 0;
+        break;
+
+      case GO_icons:
+        html_clear_direction_icons (option->icons);
+        break;
+
+      case GO_integer:
+        option->integer = -1;
+
+      default:
+    }
+}
+
+/* option is not supposed to be accessed again */
 void
 free_option (OPTION *option)
 {
@@ -1489,4 +1534,3 @@ initialize_option (OPTION *option, enum 
global_option_type type)
       default:
     }
 }
-
diff --git a/tp/Texinfo/XS/main/utils.h b/tp/Texinfo/XS/main/utils.h
index 5cf8826e0a..aa28a5ea0d 100644
--- a/tp/Texinfo/XS/main/utils.h
+++ b/tp/Texinfo/XS/main/utils.h
@@ -191,6 +191,7 @@ void wipe_index_names (INDEX **index_names);
 
 /* in options_init_free.c */
 void initialize_options (OPTIONS *options);
+void clear_options (OPTIONS *options);
 void free_options (OPTIONS *options);
 
 OPTIONS *new_options (void);
@@ -231,9 +232,11 @@ ELEMENT *get_cmd_global_uniq_command (GLOBAL_COMMANDS 
*global_commands_ref,
                                       enum command_id cmd);
 
 void html_free_button_specification_list (BUTTON_SPECIFICATION_LIST *buttons);
+void html_clear_direction_icons (DIRECTION_ICON_LIST *direction_icons);
 void html_free_direction_icons (DIRECTION_ICON_LIST *direction_icons);
 
-void free_option (OPTION *option);
 void initialize_option (OPTION *option, enum global_option_type type);
+void clear_option (OPTION *option);
+void free_option (OPTION *option);
 
 #endif
diff --git a/tp/maintain/regenerate_C_options_info.pl 
b/tp/maintain/regenerate_C_options_info.pl
index 4ee3878456..0d1a50be06 100755
--- a/tp/maintain/regenerate_C_options_info.pl
+++ b/tp/maintain/regenerate_C_options_info.pl
@@ -153,6 +153,36 @@ foreach my $category (sort(keys(%option_categories))) {
 }
 print CODE "};\n\n";
 
+print CODE "void\nclear_options (OPTIONS *options)\n{\n";
+foreach my $category (sort(keys(%option_categories))) {
+  print CODE "\n/* ${category} */\n\n";
+  foreach my $option_info (@{$option_categories{$category}}) {
+    my ($option, $value, $type) = @$option_info;
+    print CODE "  clear_option (&options->$option);\n";
+  }
+}
+print CODE "};\n\n";
+
+# set configured based on the name
+print CODE 'void
+set_option_key_configured (OPTIONS *options, const char *key, int configured)
+{
+  if (0) {}
+';
+foreach my $category (sort(keys(%option_categories))) {
+  print CODE "\n/* ${category} */\n\n";
+  foreach my $option_info (@{$option_categories{$category}}) {
+    my ($option, $value, $type) = @$option_info;
+    print CODE "  else if (!strcmp (key, \"$option\"))
+    {
+      if (configured > 0)
+        options->$option.configured = configured;
+    }\n";
+  }
+}
+
+print CODE "}\n\n";
+
 # associate commands to options
 print CODE "#include \"command_ids.h\"\n\n";
 print CODE 'OPTION *
@@ -250,31 +280,20 @@ print GET '#include "get_perl_info.h"'."\n";
 print GET '#include "build_perl_info.h"'."\n\n";
 
 print GET 'void
-get_sv_option (OPTIONS *options, const char *key, SV *value, int configured, 
CONVERTER *converter)
+get_sv_option (OPTIONS *options, const char *key, SV *value, int force, 
CONVERTER *converter)
 {
   dTHX;
 
   if (0) {}
 ';
 
-#my %non_decoded_customization_variables
-#   = %Texinfo::Common::non_decoded_customization_variables;
-
-# duplicated from Texinfo::Common to avoid depending on Texinfo::Common
-my %non_decoded_customization_variables;
-foreach my $variable_name ('MACRO_EXPAND', 'INTERNAL_LINKS') {
-  $non_decoded_customization_variables{$variable_name} = 1;
-}
-
 foreach my $category (sort(keys(%option_categories))) {
   print GET "\n/* ${category} */\n\n";
   foreach my $option_info (@{$option_categories{$category}}) {
     my ($option, $value, $type) = @$option_info;
     print GET "  else if (!strcmp (key, \"$option\"))
     {
-      if (configured > 0)
-        options->$option.configured = configured;
-      else if (configured < 0 && options->$option.configured > 0)
+      if (force <= 0 && options->$option.configured > 0)
         return;\n\n";
     if ($type eq 'char' or $type eq 'bytes') {
       my $SV_function_type = 'utf8';



reply via email to

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