texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Fri, 4 Oct 2024 06:02:37 -0400 (EDT)

branch: master
commit 16efb33e318aa9ceaa14c666a606d192f3cdc3b7
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Aug 10 22:35:43 2024 +0200

    * tp/maintain/regenerate_C_options_info.pl: remove generation of
    unused get_options_key_sv_option and build_sv_option_key functions.
---
 ChangeLog                                |   5 +
 tp/maintain/regenerate_C_options_info.pl | 175 +------------------------------
 2 files changed, 6 insertions(+), 174 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b5118eb293..e106b76863 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-08-10  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/maintain/regenerate_C_options_info.pl: remove generation of
+       unused get_options_key_sv_option and build_sv_option_key functions.
+
 2024-08-10  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/convert/texinfo.c: add some comments.
diff --git a/tp/maintain/regenerate_C_options_info.pl 
b/tp/maintain/regenerate_C_options_info.pl
index f80d634cad..e593b5864e 100755
--- a/tp/maintain/regenerate_C_options_info.pl
+++ b/tp/maintain/regenerate_C_options_info.pl
@@ -439,119 +439,9 @@ close(OHDEF);
 open(GET, ">$get_file") or die "Open $get_file: $!\n";
 print GET "/* Automatically generated from $program_name */\n\n";
 
-print GET '
-/* Avoid namespace conflicts. */
-#define context perl_context
-
-#define PERL_NO_GET_CONTEXT
-#include "EXTERN.h"
-#include "perl.h"
-#include "XSUB.h"
-
-#undef context
-
- /* See the NOTE in build_perl_info.c on use of functions related to
-    memory allocation */
-
-';
-
-# FIXME include before or after perl?  Include config.h?
-print GET '#include <string.h>'."\n";
-print GET '#include <stdlib.h>'."\n";
-print GET '#include <stdio.h>'."\n\n";
-
 print GET '#include "options_types.h"'."\n";
 print GET '#include "converter_types.h"'."\n";
-print GET '#include "utils.h"'."\n";
-print GET '#include "get_perl_info.h"'."\n";
-print GET '#include "build_perl_info.h"'."\n\n";
-
-# unused
-print GET 'int
-get_options_key_sv_option (OPTIONS *options, const char *key, SV *value, int 
force, const CONVERTER *converter)
-{
-  dTHX;
-
-  if (0) {}
-';
-
-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 (force <= 0 && options->$option.configured > 0)
-        return -1;\n\n";
-    if ($type eq 'char' or $type eq 'bytes') {
-      my $SV_function_type = 'utf8';
-      if ($type eq 'bytes') {
-        $SV_function_type = 'byte';
-      }
-      # TODO the generated file includes perl headers.  The NOTE in
-      # build_perl_info.c about not using malloc/free should be relevant for
-      # the generated file.
-      print GET "      non_perl_free (options->$option.o.string);
-      if (SvOK (value))
-        options->$option.o.string = non_perl_strdup 
(SvPV${SV_function_type}_nolen (value));
-      else
-        options->$option.o.string = 0;
-    }\n";
-    } elsif ($type eq 'integer') {
-      print GET "      if (SvOK (value))
-        {
-          if (looks_like_number (value))
-            options->$option.o.integer = SvIV (value);
-          else
-            {
-              fprintf (stderr, \"BUG: %s: not an integer: %s\\n\",
-                       \"$option\", SvPVutf8_nolen (value));
-              options->$option.o.integer = -1;
-              return -3;
-            }
-        }
-      else
-        options->$option.o.integer = -1;
-    }\n";
-    } elsif ($type =~ /_string_list$/) {
-      my $dir_string_arg = 'svt_byte';
-      if ($type eq 'file_string_list') {
-        $dir_string_arg = 'svt_dir';
-      } elsif ($type eq 'char_string_list') {
-        $dir_string_arg = 'svt_char';
-      }
-      print GET "      clear_strings_list (options->$option.o.strlist);
-      add_svav_to_string_list (value, options->$option.o.strlist, 
$dir_string_arg);
-    }\n";
-    } elsif ($type eq 'buttons') {
-      print GET "      if (options->$option.o.buttons)
-        {
-          options->BIT_user_function_number -= 
options->$option.o.buttons->BIT_user_function_number;
-          html_free_button_specification_list (options->$option.o.buttons);
-        }
-
-      options->$option.o.buttons = html_get_button_specification_list 
(converter, value);
-      if (options->$option.o.buttons)
-        options->BIT_user_function_number += 
options->$option.o.buttons->BIT_user_function_number;
-    }\n";
-    } elsif ($type eq 'icons') {
-      print GET "      html_free_direction_icons (options->$option.o.icons);
-      html_get_direction_icons_sv (converter, options->$option.o.icons, value);
-    }\n";
-    } else {
-      print STDERR "BUG: unknown type: $type\n";
-      print GET "    {}\n";
-    }
-  }
-}
-
-print GET '  else
-    return -2; /* unknown */
-
-  return 0;
-}
-
-';
+print GET '#include "get_perl_info.h"'."\n\n";
 
 print GET 'void
 html_fill_sv_options (OPTIONS *options, const CONVERTER *converter)
@@ -573,69 +463,6 @@ print GET '}
 
 ';
 
-
-# Unused
-print GET 'SV *
-build_sv_option_key (const OPTIONS *options, const char *key,
-                     const CONVERTER *converter)
-{
-  dTHX;
-
-  if (0) {return newSV (0);}
-';
-
-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\"))\n";
-    if ($type eq 'char' or $type eq 'bytes') {
-      my $SV_function_type = 'utf8';
-      if ($type eq 'bytes') {
-        $SV_function_type = 'byte';
-      }
-      print GET "    {
-      if (!options->$option.o.string)
-        return newSV (0);
-      return newSVpv_${SV_function_type} (options->$option.o.string, 0);
-    }\n";
-    } elsif ($type eq 'integer') {
-      print GET "    {
-      if (options->$option.o.integer == -1)
-        return newSV (0);
-      return newSViv (options->$option.o.integer);
-    }\n";
-    } elsif ($type =~ /_string_list$/) {
-      my $dir_string_arg = 'svt_byte';
-      if ($type eq 'file_string_list') {
-        $dir_string_arg = 'svt_dir';
-      } elsif ($type eq 'char_string_list') {
-        $dir_string_arg = 'svt_char';
-      }
-      print GET "    {
-      return newRV_noinc ((SV *) build_string_list(options->$option.o.strlist, 
$dir_string_arg));
-    }\n";
-    } elsif ($type eq 'buttons') {
-      print GET "    {
-      if (!options->$option.o.buttons) return newSV (0);
-      return newRV_inc ((SV *) options->$option.o.buttons->av);
-    }\n";
-    } elsif ($type eq 'icons') {
-      print GET "    {
-      return html_build_direction_icons (converter, options->$option.o.icons);
-    }\n";
-    } else {
-      print GET "    {return newSV (0);}\n";
-    }
-  }
-}
-
-print GET '
-  return newSV (0);
-}
-
-';
-
 close(GET);
 
 



reply via email to

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