texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/parsetexi/Parsetexi.pm (parser),


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/parsetexi/Parsetexi.pm (parser), tp/Texinfo/XS/parsetexi/Parsetexi.xs: pass parser conf strings as UTF-8 encoded bytes, and use the macro corresponding to bytes to get the strings in the C parser.
Date: Thu, 27 Jul 2023 17:43:25 -0400

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new a374a51879 * tp/Texinfo/XS/parsetexi/Parsetexi.pm (parser), 
tp/Texinfo/XS/parsetexi/Parsetexi.xs: pass parser conf strings as UTF-8 encoded 
bytes, and use the macro corresponding to bytes to get the strings in the C 
parser.
a374a51879 is described below

commit a374a518794a197205fb1eccc88bb940140e2a0c
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Jul 27 23:43:10 2023 +0200

    * tp/Texinfo/XS/parsetexi/Parsetexi.pm (parser),
    tp/Texinfo/XS/parsetexi/Parsetexi.xs: pass parser conf strings as
    UTF-8 encoded bytes, and use the macro corresponding to bytes to get
    the strings in the C parser.
---
 ChangeLog                            |  7 +++++++
 tp/Texinfo/XS/parsetexi/Parsetexi.pm | 22 ++++++++++++----------
 tp/Texinfo/XS/parsetexi/Parsetexi.xs | 12 ++++++------
 3 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 767f57dbfc..6ee01ed8e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-07-27  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/parsetexi/Parsetexi.pm (parser),
+       tp/Texinfo/XS/parsetexi/Parsetexi.xs: pass parser conf strings as
+       UTF-8 encoded bytes, and use the macro corresponding to bytes to get
+       the strings in the C parser.
+
 2023-07-27  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/parsetexi/Parsetexi.pm (parse_texi_piece)
diff --git a/tp/Texinfo/XS/parsetexi/Parsetexi.pm 
b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
index 5677c0cdd3..2baf4b8e87 100644
--- a/tp/Texinfo/XS/parsetexi/Parsetexi.pm
+++ b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
@@ -121,22 +121,22 @@ sub parser (;$$)
           add_include_directory ($d);
         }
       } elsif ($key eq 'values') {
-        for my $v (keys %{$conf->{'values'}}) {
-          if (ref($conf->{'values'}->{$v}) eq '') {
-            store_value ($v, $conf->{'values'}->{$v});
-          } else {
-            warn "bug: non-scalar \@value\n";
-          }
+        for my $flag (keys %{$conf->{'values'}}) {
+          my $bytes_flag = Encode::encode('utf-8', $flag);
+          my $bytes_value = Encode::encode('utf-8', 
$conf->{'values'}->{$flag});
+          store_value ($bytes_flag, $bytes_value);
         }
       } elsif ($key eq 'EXPANDED_FORMATS') {
         clear_expanded_formats ();
 
         for my $f (@{$conf->{$key}}) {
-          add_expanded_format ($f);
+          my $utf8_bytes = Encode::encode('utf-8', $f);
+          add_expanded_format ($utf8_bytes);
         }
       } elsif ($key eq 'documentlanguage') {
         if (defined ($conf->{$key})) {
-          conf_set_documentlanguage_override ($conf->{$key});
+          my $utf8_bytes = Encode::encode('utf-8', $conf->{$key});
+          conf_set_documentlanguage_override ($utf8_bytes);
         }
       } elsif ($key eq 'FORMAT_MENU') {
         if ($conf->{$key} eq 'menu') {
@@ -155,9 +155,11 @@ sub parser (;$$)
       } elsif ($key eq 'DOC_ENCODING_FOR_INPUT_FILE_NAME') {
         set_DOC_ENCODING_FOR_INPUT_FILE_NAME ($conf->{$key});
       } elsif ($key eq 'INPUT_FILE_NAME_ENCODING' and defined($conf->{$key})) {
-        conf_set_input_file_name_encoding ($conf->{$key});
+        my $utf8_bytes = Encode::encode('utf-8', $conf->{$key});
+        conf_set_input_file_name_encoding ($utf8_bytes);
       } elsif ($key eq 'LOCALE_ENCODING' and defined($conf->{$key})) {
-        conf_set_locale_encoding ($conf->{$key});
+        my $utf8_bytes = Encode::encode('utf-8', $conf->{$key});
+        conf_set_locale_encoding ($utf8_bytes);
       } elsif ($key eq 'accept_internalvalue') {
         set_accept_internalvalue();
       } elsif ($key eq 'registrar' or $key eq 'COMMAND_LINE_ENCODING') {
diff --git a/tp/Texinfo/XS/parsetexi/Parsetexi.xs 
b/tp/Texinfo/XS/parsetexi/Parsetexi.xs
index 58a00def3b..b53fe617f0 100644
--- a/tp/Texinfo/XS/parsetexi/Parsetexi.xs
+++ b/tp/Texinfo/XS/parsetexi/Parsetexi.xs
@@ -68,8 +68,8 @@ parse_text(string, line_nr)
 
 void
 store_value (name, value)
-        char *name
-        char *value
+        char *name = (char *)SvPVbyte_nolen($arg);
+        char *value = (char *)SvPVbyte_nolen($arg);
 
 void
 wipe_values ()
@@ -113,7 +113,7 @@ clear_expanded_formats ()
 
 void
 add_expanded_format (format)
-     char *format
+     char *format = (char *)SvPVbyte_nolen($arg);
 
 void
 conf_set_show_menu (int i)
@@ -132,15 +132,15 @@ set_DOC_ENCODING_FOR_INPUT_FILE_NAME (int i)
 
 void
 conf_set_input_file_name_encoding (value)
-     char *value
+     char *value = (char *)SvPVbyte_nolen($arg);
 
 void
 conf_set_locale_encoding (value)
-     char *value
+     char *value = (char *)SvPVbyte_nolen($arg);
 
 void
 conf_set_documentlanguage_override (value)
-     char *value
+     char *value = (char *)SvPVbyte_nolen($arg);
 
 void
 set_debug (int i)



reply via email to

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