texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Tue, 30 Apr 2024 14:13:58 -0400 (EDT)

branch: master
commit 66befec2ac0c52af818acb083777ea5919b5c8ea
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Apr 29 23:31:17 2024 +0200

    * tp/maintain/regenerate_C_options_info.pl: add a better BUG message
    than the default Perl message for customization variable passed to C
    that should be an integer but is not.
---
 ChangeLog                                |  6 ++++++
 tp/maintain/regenerate_C_options_info.pl | 14 ++++++++++++--
 tp/t/latex_tests.t                       |  1 +
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index edf31d1b2e..fc3e34f886 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-04-29  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/maintain/regenerate_C_options_info.pl: add a better BUG message
+       than the default Perl message for customization variable passed to C
+       that should be an integer but is not.
+
 2024-04-29  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/HTML.pm (_convert_footnote_command)
diff --git a/tp/maintain/regenerate_C_options_info.pl 
b/tp/maintain/regenerate_C_options_info.pl
index b0d587b669..4d88ec2577 100755
--- a/tp/maintain/regenerate_C_options_info.pl
+++ b/tp/maintain/regenerate_C_options_info.pl
@@ -280,7 +280,8 @@ print GET '
 
 # FIXME include before or after perl?  Include config.h?
 print GET '#include <string.h>'."\n";
-print GET '#include <stdlib.h>'."\n\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";
@@ -320,7 +321,16 @@ foreach my $category (sort(keys(%option_categories))) {
     }\n";
     } elsif ($type eq 'integer') {
       print GET "      if (SvOK (value))
-        options->$option.integer = SvIV (value);
+        {
+          if (looks_like_number (value))
+            options->$option.integer = SvIV (value);
+          else
+            {
+              fprintf (stderr, \"BUG: %s: not an integer: %s\\n\",
+                       \"$option\", SvPVutf8_nolen (value));
+              options->$option.integer = -1;
+            }
+        }
       else
         options->$option.integer = -1;
     }\n";
diff --git a/tp/t/latex_tests.t b/tp/t/latex_tests.t
index f641261b41..4bc13af381 100644
--- a/tp/t/latex_tests.t
+++ b/tp/t/latex_tests.t
@@ -646,6 +646,7 @@ In afourpaper reset
         'frenchspacing' => 'on',
         'microtype' => 'off',
         'firstparagraphindent' => 'insert',
+   # With C/XS, this tests that '11' as a string is accepted as an integer
         'fonttextsize' => '11',
         'paragraphindent' => 4,
         'afivepaper' => ''}],



reply via email to

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