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, 8 Apr 2024 15:45:48 -0400 (EDT)

branch: master
commit 333280a39268a142db34ff6ae02a8e3ab2072d77
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Apr 8 12:14:58 2024 +0200

    * tp/Texinfo/Config.pm (GNUT_set_customization_default),
    tp/texi2any.pl, tp/t/test_utils.pl (test): rename
    GNUT_set_main_program_default as GNUT_set_customization_default and
    rename GNUT_initialize_config as GNUT_initialize_customization.
---
 ChangeLog            |  7 +++++++
 tp/Texinfo/Config.pm | 26 ++++++++++++++++----------
 tp/t/test_utils.pl   |  2 +-
 tp/texi2any.pl       |  8 ++++----
 4 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0e07e8d8a0..873b58f743 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-04-08  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Config.pm (GNUT_set_customization_default),
+       tp/texi2any.pl, tp/t/test_utils.pl (test): rename
+       GNUT_set_main_program_default as GNUT_set_customization_default and
+       rename GNUT_initialize_config as GNUT_initialize_customization.
+
 2024-04-08  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/convert/build_html_perl_state.c
diff --git a/tp/Texinfo/Config.pm b/tp/Texinfo/Config.pm
index 96f1e73244..916463f092 100644
--- a/tp/Texinfo/Config.pm
+++ b/tp/Texinfo/Config.pm
@@ -56,6 +56,11 @@ my $real_command_name = '';
 # customization API, used from main calling context (main program or
 # t/test_utils.pl) and from init files.
 
+# The main calling context may merge $cmdline_options, $options_defaults
+# and $init_files_options.  That's why it is important, in *_set_from_*
+# functions below to also delete keys in other hashes for overriden
+# customization variables, even though it wouldn't change the output of
+# texinfo_get_conf.
 my $cmdline_options;
 my $options_defaults;
 my $init_files_options = {};
@@ -81,7 +86,7 @@ my %options_as_lists;
 # References on $OPTIONS_DEFAULT and $CMDLINE_OPTIONS are retained in
 # the main calling context, therefore the hash reference should be used
 # directly, not copies.
-sub GNUT_initialize_config($$$) {
+sub GNUT_initialize_customization($$$) {
   $real_command_name = shift;
   $options_defaults = shift;
   $cmdline_options = shift;
@@ -287,7 +292,7 @@ sub GNUT_set_from_cmdline($$)
 }
 
 # add default based, for instance, on the format.
-sub GNUT_set_main_program_default($$)
+sub GNUT_set_customization_default($$)
 {
   my $var = shift;
   my $value = shift;
@@ -339,15 +344,16 @@ sub texinfo_remove_from_option_list($$)
 # For conversion customization variables, converter methods
 # should be used instead, the implementation usually used being
 # from Texinfo::Convert::Converter.
-# It is possible to set up an interface similar to those used in
-# converters for the main program configuration with the
-# Texinfo::MainConfig below, but it should not be accessed/used
-# in user defined code (and is therefore undocumented).
+# NOTE It is possible to set up an interface similar to those used in
+# converters for the main program and tests configuration with the
+# Texinfo::MainConfig package below, but it should not be accessed/used
+# in user defined code (and the Texinfo::MainConfig interface
+# is therefore undocumented).
 sub texinfo_get_conf($)
 {
   my $var = shift;
   confess("BUG: texinfo_get_conf: undef \$cmdline_options."
-         ." Call GNUT_initialize_config")
+         ." Call GNUT_initialize_customization")
     if (!$cmdline_options);
   if (exists($cmdline_options->{$var})) {
     return $cmdline_options->{$var};
@@ -864,7 +870,7 @@ sub get_conf($$)
   my $var = shift;
 
   # as get_conf, but with self having precedence on
-  # main program defaults
+  # main calling context defaults
   if (exists($cmdline_options->{$var})) {
     return $cmdline_options->{$var};
   } elsif (exists($init_files_options->{$var})) {
@@ -888,8 +894,8 @@ sub set_conf($$$)
 }
 
 # for structuring and tree transformations XS code uses options registered
-# with the document by that function.  It is not needed in perl where
-# get_conf above is used.
+# with the document by that function.  It is not needed in Perl where
+# get_conf above is used on a separate MainConfig object.
 sub register_XS_document_main_configuration($$)
 {
   my $self = shift;
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index 21b9d5a9eb..6a53abc120 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -959,7 +959,7 @@ sub test($$)
   # reset Texinfo::Config informations to have isolated tests
   Texinfo::Config::GNUT_reinitialize_init_files();
   my $init_files_options
-      = Texinfo::Config::GNUT_initialize_config('',
+      = Texinfo::Config::GNUT_initialize_customization('',
                                    $main_configuration_defaults, {});
   my $init_file_directories = [$srcdir.'init/', $srcdir.'t/init/'];
   # the init file names should be binary strings.  Since they
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index e5d32a853e..ce37e67b57 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -491,7 +491,7 @@ sub set_from_cmdline($$) {
 }
 
 sub set_main_program_default($$) {
-  return &Texinfo::Config::GNUT_set_main_program_default(@_);
+  return &Texinfo::Config::GNUT_set_customization_default(@_);
 }
 
 sub get_conf($) {
@@ -549,7 +549,7 @@ my $default_expanded_format = [ $format ];
 my @conf_dirs = ();
 my @prepend_dirs = ();
 
-# The $cmdline_options passed to Texinfo::Config::GNUT_initialize_config
+# The $cmdline_options passed to Texinfo::Config::GNUT_initialize_customization
 # are considered to be arrays in which items can be added or deleted both
 # from the command line and from init files.  $cmdline_options text values
 # are set by GNUT_set_from_cmdline (aliased as set_from_cmdline) from the
@@ -563,7 +563,7 @@ my @prepend_dirs = ();
 # they are parser options.
 my $parser_options = {'values' => {'txicommandconditionals' => 1}};
 
-my $init_files_options = Texinfo::Config::GNUT_initialize_config(
+my $init_files_options = Texinfo::Config::GNUT_initialize_customization(
       $real_command_name, $main_program_default_options, $cmdline_options);
 
 # Need to do that early for early messages
@@ -571,7 +571,7 @@ my $translations_encoding = 
get_conf('COMMAND_LINE_ENCODING');
 set_translations_encoding($translations_encoding);
 
 # read initialization files.  Better to do that after
-# Texinfo::Config::GNUT_initialize_config() in case loaded
+# Texinfo::Config::GNUT_initialize_customization() in case loaded
 # files replace default options.
 foreach my $file (Texinfo::Common::locate_init_file($conf_file_name,
                   [ reverse(@program_config_dirs) ], 1)) {



reply via email to

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