texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/main/build_perl_info.c: move new_


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/main/build_perl_info.c: move new_texinfo_report code earlier.
Date: Sun, 20 Oct 2024 09:31:47 -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 96384f5163 * tp/Texinfo/XS/main/build_perl_info.c: move 
new_texinfo_report code earlier.
96384f5163 is described below

commit 96384f516386be1b8d5ff0a8a2716927375ff6c9
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Oct 20 15:31:32 2024 +0200

    * tp/Texinfo/XS/main/build_perl_info.c: move new_texinfo_report code
    earlier.
    
    * tp/Texinfo/XS/main/build_perl_info.c
    (pass_document_parser_errors_to_registrar),
    tp/Texinfo/XS/parsetexi/Parsetexi.pm (parser): create Texinfo::Report
    registrar object and add to parser in
    pass_document_parser_errors_to_registrar, when it is sure that the
    Perl data is needed, and not in parser.
---
 ChangeLog                            | 12 ++++++++
 tp/Texinfo/XS/main/build_perl_info.c | 59 +++++++++++++++++++++---------------
 tp/Texinfo/XS/parsetexi/Parsetexi.pm |  4 ---
 3 files changed, 46 insertions(+), 29 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4f5ec8ebc8..d5e621d176 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-10-20  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/main/build_perl_info.c: move new_texinfo_report code
+       earlier.
+
+       * tp/Texinfo/XS/main/build_perl_info.c
+       (pass_document_parser_errors_to_registrar),
+       tp/Texinfo/XS/parsetexi/Parsetexi.pm (parser): create Texinfo::Report
+       registrar object and add to parser in
+       pass_document_parser_errors_to_registrar, when it is sure that the
+       Perl data is needed, and not in parser.
+
 2024-10-20  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/main/DocumentXS.xs,
diff --git a/tp/Texinfo/XS/main/build_perl_info.c 
b/tp/Texinfo/XS/main/build_perl_info.c
index 52f4f5047b..f88c15ab36 100644
--- a/tp/Texinfo/XS/main/build_perl_info.c
+++ b/tp/Texinfo/XS/main/build_perl_info.c
@@ -1308,16 +1308,45 @@ pass_errors_to_registrar (const ERROR_MESSAGE_LIST 
*error_messages,
   return newSV (0);
 }
 
+/* same as calling Texinfo::Report::new() */
+static SV *
+new_texinfo_report (void)
+{
+  HV *hv_stash;
+  HV *hv;
+  SV *sv;
+  AV *errors_warnings;
+
+  dTHX;
+
+  hv = newHV ();
+
+  hv_store (hv, "errors_nrs", strlen ("errors_nrs"), newSViv (0), 0);
+
+  errors_warnings = newAV ();
+  hv_store (hv, "errors_warnings", strlen ("errors_warnings"),
+            newRV_noinc ((SV *) errors_warnings), 0);
+
+  hv_stash = gv_stashpv ("Texinfo::Report", GV_ADD);
+  sv = newRV_noinc ((SV *) hv);
+  sv_bless (sv, hv_stash);
+  return sv;
+}
+
 void
 pass_document_parser_errors_to_registrar (size_t document_descriptor,
                                           SV *parser_sv)
 {
   DOCUMENT *document;
+  SV *registrar_sv;
   SV *errors_warnings_sv = 0;
   SV *error_nrs_sv = 0;
+  HV *parser_hv;
 
   dTHX;
 
+  parser_hv = (HV *) SvRV (parser_sv);
+
   document = retrieve_document (document_descriptor);
 
   /* This cannot happen, the function is called on a document that
@@ -1326,6 +1355,11 @@ pass_document_parser_errors_to_registrar (size_t 
document_descriptor,
     return;
    */
 
+  /* Add error registrar to Parser */
+  registrar_sv = new_texinfo_report ();
+  SvREFCNT_inc (registrar_sv);
+  hv_store (parser_hv, "registrar", strlen ("registrar"), registrar_sv, 0);
+
   pass_errors_to_registrar (&document->parser_error_messages, parser_sv,
                             &errors_warnings_sv, &error_nrs_sv);
   clear_error_message_list (&document->parser_error_messages);
@@ -1689,31 +1723,6 @@ build_global_commands (const GLOBAL_COMMANDS 
*global_commands_ref)
   return hv;
 }
 
-/* same as calling Texinfo::Report::new() */
-static SV *
-new_texinfo_report (void)
-{
-  HV *hv_stash;
-  HV *hv;
-  SV *sv;
-  AV *errors_warnings;
-
-  dTHX;
-
-  hv = newHV ();
-
-  hv_store (hv, "errors_nrs", strlen ("errors_nrs"), newSViv (0), 0);
-
-  errors_warnings = newAV ();
-  hv_store (hv, "errors_warnings", strlen ("errors_warnings"),
-            newRV_noinc ((SV *) errors_warnings), 0);
-
-  hv_stash = gv_stashpv ("Texinfo::Report", GV_ADD);
-  sv = newRV_noinc ((SV *) hv);
-  sv_bless (sv, hv_stash);
-  return sv;
-}
-
 /* build a minimal document, without tree/global commands/indices, only
    with the document descriptor information, errors and information that do
    not refer directly to tree elements */
diff --git a/tp/Texinfo/XS/parsetexi/Parsetexi.pm 
b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
index c6a651dd72..749cd93dab 100644
--- a/tp/Texinfo/XS/parsetexi/Parsetexi.pm
+++ b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
@@ -28,8 +28,6 @@
 # * the input file name passed through parse_texi_file is a binary string
 # * the 'file_name' values in 'source_info' from convert_errors and in
 #   the tree elements 'source_info' are returned as binary strings
-#
-# Binary strings are passed from parse_texi_file as arguments of parse_file.
 
 package Texinfo::Parser;
 
@@ -132,8 +130,6 @@ sub parser (;$)
     register_parser_conf($parser);
   }
 
-  $parser->{'registrar'} = Texinfo::Report::new();
-
   return $parser;
 }
 



reply via email to

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