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, 12 Dec 2023 06:29:58 -0500 (EST)

branch: master
commit 52a12b302d6487c8e831d4f66ac4ffff3aa42935
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Dec 12 12:29:46 2023 +0100

    * tp/Texinfo/Report.pm (format_line_message): add empty macro if there
    are lines numbers.  This is not good, but is for consistency with what
    is done for Parser messages.
    
    * tp/Texinfo/XS/main/build_perl_info.c (element_to_perl_hash): store
    empty string for macro and file_name only if line_nr is set.
    
    * tp/Texinfo/XS/main/get_perl_info.c (get_document_or_warn): document
    descriptor in converter can be undef.
    
    * tp/Texinfo/XS/main/build_perl_info.c (build_errors): rename
    get_errors as build_errors. Update callers.
    
    * tp/Texinfo/Report.pm (format_document_message, document_warn)
    (document_error, format_line_message, line_error, line_warn): make
    format_document_message and format_line_message independent of
    converter/Report object.  Move the corresponding code back to
    document_warn, document_error, line_error, line_warn.
    
    * tp/Texinfo/XS/main/errors.c (message_list_line_error_internal)
    (message_list_line_formatted_message)
    (message_list_document_error_internal)
    (message_list_document_formatted_message): split
    message_list_line_formatted_message out of
    message_list_line_error_internal and
    message_list_document_formatted_message out of
    message_list_document_error_internal to be able to format/register an
    already translated message.
    
    * tp/Texinfo/Convert/Converter.pm (%XS_overrides)
    (_XS_converter_initialize, converter, _XS_html_converter_initialize),
    tp/Texinfo/XS/convert/ConvertXS.xs (converter_initialize),
    tp/Texinfo/XS/convert/get_html_perl_info.c
    (html_converter_initialize_sv), tp/Texinfo/XS/main/get_perl_info.c
    (converter_initialize): separate generic converter initialization from
    HTML converter initialization and initialize generic converter in
    Converter.pm converter/get_perl_info.c converter_initialize.
    
    * tp/Texinfo/Convert/Converter.pm (converter_line_error,
    converter_line_warn, converter_document_error)
    (converter_document_warn, get_converter_errors),
    tp/Texinfo/Convert/Plaintext.pm (plaintext_line_warn)
    (plaintext_line_error), tp/Texinfo/Convert/Text.pm
    (converter_line_error, converter_document_warn),
    tp/Texinfo/Convert/Utils.pm (expand_verbatiminclude),
    tp/Texinfo/Structuring.pm (_converter_or_registrar_line_warn)
    (setup_sortable_index_entries): use specific error reporting for
    converters, which use Texinfo::Report for formatting, but register in
    converter.  Use get_converter_errors to get errors to
    Texinfo::Register, both for XS and perl converters.  Update all calls
    to Texinfo::Report to be converter_* calls.  Rename
    converter_line_error and converter_line_warn in Plaintext.pm as
    plaintext_line_error and plaintext_line_warn as the method names are
    now the generic converter method names.  Use only one argument for
    converter in expand_verbatiminclude.  setup_sortable_index_entries
    error messages can be both called from converters or Texinfo::Report
    object separate from customization information, so use a specific
    function to call Texinfo::Report or converter functions.
    
    * tp/Texinfo/XS/convert/ConvertXS.xs (%XS_overrides),
    tp/Texinfo/XS/convert/ConvertXS.xs (converter_line_error)
    (converter_line_warn, converter_document_error)
    (converter_document_warn), tp/Texinfo/XS/main/get_perl_info.c
    (get_source_info, get_line_message), tp/t/test_utils.pl
    (convert_to_plaintext, convert_to_info, convert_to_html)
    (convert_to_xml, convert_to_docbook, convert_to_latex):
    override converter_line_*, converter_document_* in XS.  This is for
    all the converters.
---
 ChangeLog                                  |  74 +++++++++++++++-
 tp/Texinfo/Convert/Converter.pm            | 110 +++++++++++++++++++++---
 tp/Texinfo/Convert/DocBook.pm              |  10 +--
 tp/Texinfo/Convert/HTML.pm                 | 104 ++++++++++++-----------
 tp/Texinfo/Convert/IXIN.pm                 |   6 +-
 tp/Texinfo/Convert/Info.pm                 |  24 +++---
 tp/Texinfo/Convert/LaTeX.pm                |  10 +--
 tp/Texinfo/Convert/Plaintext.pm            |  36 ++++----
 tp/Texinfo/Convert/TexinfoMarkup.pm        |   4 +-
 tp/Texinfo/Convert/Text.pm                 |  13 ++-
 tp/Texinfo/Convert/Utils.pm                |  42 +++++-----
 tp/Texinfo/DebugTree.pm                    |   4 +-
 tp/Texinfo/Report.pm                       |  70 ++++++++++------
 tp/Texinfo/Structuring.pm                  |  25 +++++-
 tp/Texinfo/XS/convert/ConvertXS.xs         |  88 ++++++++++++++++++-
 tp/Texinfo/XS/convert/get_html_perl_info.c |  17 +---
 tp/Texinfo/XS/convert/get_html_perl_info.h |   2 +-
 tp/Texinfo/XS/main/build_perl_info.c       |  20 +++--
 tp/Texinfo/XS/main/build_perl_info.h       |   2 +-
 tp/Texinfo/XS/main/errors.c                |  65 ++++++++++-----
 tp/Texinfo/XS/main/errors.h                |   8 ++
 tp/Texinfo/XS/main/get_perl_info.c         | 130 ++++++++++++++++++++++++++---
 tp/Texinfo/XS/main/get_perl_info.h         |   5 +-
 tp/ext/epub3.pm                            |  47 +++++------
 tp/ext/highlight_syntax.pm                 |  42 +++++-----
 tp/ext/latex2html.pm                       |  30 +++----
 tp/ext/tex4ht.pm                           |  28 +++----
 tp/init/chm.pm                             |  14 ++--
 tp/t/init/redefine_need.init               |   4 +-
 tp/t/results/htmlxref/htmlxref.pl          |   2 +
 tp/t/results/htmlxref/htmlxref_nodes.pl    |   2 +
 tp/t/test_utils.pl                         |  36 +++++++-
 32 files changed, 762 insertions(+), 312 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index abe3658b2c..5cd8528fc6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,78 @@
+2023-12-12  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Report.pm (format_line_message): add empty macro if there
+       are lines numbers.  This is not good, but is for consistency with what
+       is done for Parser messages.
+
+       * tp/Texinfo/XS/main/build_perl_info.c (element_to_perl_hash): store
+       empty string for macro and file_name only if line_nr is set.
+
+       * tp/Texinfo/XS/main/get_perl_info.c (get_document_or_warn): document
+       descriptor in converter can be undef.
+
+       * tp/Texinfo/XS/main/build_perl_info.c (build_errors): rename
+       get_errors as build_errors. Update callers.
+
+       * tp/Texinfo/Report.pm (format_document_message, document_warn)
+       (document_error, format_line_message, line_error, line_warn): make
+       format_document_message and format_line_message independent of
+       converter/Report object.  Move the corresponding code back to
+       document_warn, document_error, line_error, line_warn.
+
+       * tp/Texinfo/XS/main/errors.c (message_list_line_error_internal)
+       (message_list_line_formatted_message)
+       (message_list_document_error_internal)
+       (message_list_document_formatted_message): split
+       message_list_line_formatted_message out of
+       message_list_line_error_internal and
+       message_list_document_formatted_message out of
+       message_list_document_error_internal to be able to format/register an
+       already translated message.
+
+       * tp/Texinfo/Convert/Converter.pm (%XS_overrides)
+       (_XS_converter_initialize, converter, _XS_html_converter_initialize),
+       tp/Texinfo/XS/convert/ConvertXS.xs (converter_initialize),
+       tp/Texinfo/XS/convert/get_html_perl_info.c
+       (html_converter_initialize_sv), tp/Texinfo/XS/main/get_perl_info.c
+       (converter_initialize): separate generic converter initialization from
+       HTML converter initialization and initialize generic converter in
+       Converter.pm converter/get_perl_info.c converter_initialize. 
+
+       * tp/Texinfo/Convert/Converter.pm (converter_line_error,
+       converter_line_warn, converter_document_error)
+       (converter_document_warn, get_converter_errors),
+       tp/Texinfo/Convert/Plaintext.pm (plaintext_line_warn)
+       (plaintext_line_error), tp/Texinfo/Convert/Text.pm
+       (converter_line_error, converter_document_warn),
+       tp/Texinfo/Convert/Utils.pm (expand_verbatiminclude),
+       tp/Texinfo/Structuring.pm (_converter_or_registrar_line_warn)
+       (setup_sortable_index_entries): use specific error reporting for
+       converters, which use Texinfo::Report for formatting, but register in
+       converter.  Use get_converter_errors to get errors to
+       Texinfo::Register, both for XS and perl converters.  Update all calls
+       to Texinfo::Report to be converter_* calls.  Rename
+       converter_line_error and converter_line_warn in Plaintext.pm as
+       plaintext_line_error and plaintext_line_warn as the method names are
+       now the generic converter method names.  Use only one argument for
+       converter in expand_verbatiminclude.  setup_sortable_index_entries
+       error messages can be both called from converters or Texinfo::Report
+       object separate from customization information, so use a specific
+       function to call Texinfo::Report or converter functions.
+
+       * tp/Texinfo/XS/convert/ConvertXS.xs (%XS_overrides),
+       tp/Texinfo/XS/convert/ConvertXS.xs (converter_line_error)
+       (converter_line_warn, converter_document_error)
+       (converter_document_warn), tp/Texinfo/XS/main/get_perl_info.c
+       (get_source_info, get_line_message), tp/t/test_utils.pl
+       (convert_to_plaintext, convert_to_info, convert_to_html)
+       (convert_to_xml, convert_to_docbook, convert_to_latex):
+       override converter_line_*, converter_document_* in XS.  This is for
+       all the converters.
+
 2023-12-10  Patrice Dumas  <pertusus@free.fr>
 
-       * tp/Texinfo/Report.pm (format_line_message, line_warn, line_error)
+       * tp/Texinfo/Convert/Converter.pm (%XS_overrides),
+       tp/Texinfo/Report.pm (format_line_message, line_warn, line_error)
        (format_document_message, document_warn, document_error): split
        formatting messages out of line_* and document_*, adding
        format_line_message for line messages and format_document_message for
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index 1de529f827..e6facb2947 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -85,12 +85,24 @@ $XS_convert = 1 if ($XS_structuring
 our $module_loaded = 0;
 
 my %XS_overrides = (
+  "Texinfo::Convert::Converter::_XS_converter_initialize",
+   => "Texinfo::Convert::ConvertXS::converter_initialize",
   "Texinfo::Convert::Converter::_XS_set_conf"
    => "Texinfo::Convert::ConvertXS::set_conf",
   "Texinfo::Convert::Converter::_XS_get_unclosed_stream"
    => "Texinfo::Convert::ConvertXS::get_unclosed_stream",
   "Texinfo::Convert::Converter::get_converter_errors"
    => "Texinfo::Convert::ConvertXS::get_converter_errors",
+
+  "Texinfo::Convert::Converter::converter_line_error"
+   => "Texinfo::Convert::ConvertXS::converter_line_error",
+  "Texinfo::Convert::Converter::converter_line_warn"
+   => "Texinfo::Convert::ConvertXS::converter_line_warn",
+  "Texinfo::Convert::Converter::converter_document_error"
+   => "Texinfo::Convert::ConvertXS::converter_document_error",
+  "Texinfo::Convert::Converter::converter_document_warn"
+   => "Texinfo::Convert::ConvertXS::converter_document_warn",
+
   "Texinfo::Convert::Converter::destroy"
    => "Texinfo::Convert::ConvertXS::destroy",
 );
@@ -196,10 +208,16 @@ sub converter_defaults($$)
   return %defaults;
 }
 
+# should be redefined by specific converters
 sub converter_initialize($)
 {
 }
 
+# generic XS converter initialization
+sub _XS_converter_initialize($)
+{
+}
+
 sub output_internal_links($)
 {
   my $self = shift;
@@ -291,6 +309,10 @@ sub converter($;$)
   $converter->{'output_files'} = Texinfo::Common::output_files_initialize();
 
   $converter->Texinfo::Report::new();
+  $converter->{'error_warning_messages'} = [];
+
+  # XS converter initialization
+  _XS_converter_initialize($converter);
 
   $converter->converter_initialize();
 
@@ -327,7 +349,7 @@ sub output($$)
            or $self->get_conf('OUTFILE') eq '-'
            or $self->get_conf('OUTFILE') eq '')) {
     if ($self->get_conf('SPLIT')) {
-      $self->document_warn($self,
+      $self->converter_document_warn(
                sprintf(__("%s: output incompatible with split"),
                                    $self->get_conf('OUTFILE')));
       $self->force_conf('SPLIT', '');
@@ -395,7 +417,7 @@ sub output($$)
                     $self->output_files_information(), $self,
                     $encoded_outfile_name);
       if (!$fh) {
-        $self->document_error($self,
+        $self->converter_document_error(
                  sprintf(__("could not open %s for writing: %s"),
                                       $outfile_name, $error_message));
         return undef;
@@ -423,7 +445,7 @@ sub output($$)
       Texinfo::Common::output_files_register_closed(
                   $self->output_files_information(), $encoded_outfile_name);
       if (!close($fh)) {
-        $self->document_error($self,
+        $self->converter_document_error(
                  sprintf(__("error on closing %s: %s"),
                                       $outfile_name, $!));
       }
@@ -446,7 +468,7 @@ sub output($$)
                              $self->output_files_information(), $self,
                              $out_filepath);
         if (!$file_fh) {
-          $self->document_error($self,
+          $self->converter_document_error(
                 sprintf(__("could not open %s for writing: %s"),
                        $out_filepath, $error_message));
           return undef;
@@ -464,7 +486,7 @@ sub output($$)
           Texinfo::Common::output_files_register_closed(
             $self->output_files_information(), $out_filepath);
           if (!close($file_fh)) {
-            $self->document_error($self,
+            $self->converter_document_error(
                      sprintf(__("error on closing %s: %s"),
                                   $out_filepath, $!));
             return undef;
@@ -481,10 +503,78 @@ sub destroy($)
 {
 }
 
-# Nothing to do in perl as the converter is also a Texinfo::Report.
-# In XS return the error messages.
+sub converter_line_error($$$;$$)
+{
+  my $self = shift;
+  my $text = shift;
+  my $error_location_info = shift;
+  my $continuation = shift;
+  my $silent = shift;
+
+  my $warn = ($self->get_conf('DEBUG')
+              and not $silent);
+
+  my $message = Texinfo::Report::format_line_message ('error', $text,
+                        $error_location_info, $continuation, $warn);
+  push @{$self->{'error_warning_messages'}}, $message;
+}
+
+sub converter_line_warn($$$;$$)
+{
+  my $self = shift;
+  my $text = shift;
+  my $error_location_info = shift;
+  my $continuation = shift;
+  my $silent = shift;
+
+  my $warn = ($self->get_conf('DEBUG')
+              and not $silent);
+
+  my $message = Texinfo::Report::format_line_message ('warning', $text,
+                           $error_location_info, $continuation, $warn);
+  push @{$self->{'error_warning_messages'}}, $message;
+}
+
+sub converter_document_error($$;$)
+{
+  my $self = shift;
+  my $text = shift;
+  my $continuation = shift;
+
+  my $program_name;
+
+  if ($self->get_conf('PROGRAM') && $self->get_conf('PROGRAM') ne '') {
+    $program_name = $self->get_conf('PROGRAM');
+  }
+
+  my $message
+      = Texinfo::Report::format_document_message('error', $text, $program_name,
+                                                 $continuation);
+  push @{$self->{'error_warning_messages'}}, $message;
+}
+
+sub converter_document_warn($$;$)
+{
+  my $self = shift;
+  my $text = shift;
+  my $continuation = shift;
+
+  my $program_name;
+
+  if ($self->get_conf('PROGRAM') && $self->get_conf('PROGRAM') ne '') {
+    $program_name = $self->get_conf('PROGRAM');
+  }
+
+  my $message
+      = Texinfo::Report::format_document_message('warning', $text,
+                                        $program_name, $continuation);
+  push @{$self->{'error_warning_messages'}}, $message;
+}
+
 sub get_converter_errors($)
 {
+  my $self = shift;
+  return $self->{'error_warning_messages'};
 }
 
 ###############################################################
@@ -1079,7 +1169,7 @@ sub create_destination_directory($$$)
   if (defined($destination_directory_path)
       and ! -d $destination_directory_path) {
     if (!mkdir($destination_directory_path, oct(755))) {
-      $self->document_error($self, sprintf(__(
+      $self->converter_document_error(sprintf(__(
                                 "could not create directory `%s': %s"),
                                    $destination_directory_name, $!));
       return 0;
@@ -1253,7 +1343,7 @@ sub txt_image_text($$$)
         my $decoded_file_name = $txt_file;
         $decoded_file_name = Encode::decode($file_name_encoding, $txt_file)
           if (defined($file_name_encoding));
-        $self->document_warn($self,
+        $self->converter_document_warn(
            sprintf(__("error on closing image text file %s: %s"),
                                      $decoded_file_name, $!));
       }
@@ -1262,7 +1352,7 @@ sub txt_image_text($$$)
       my $decoded_file_name = $txt_file;
       $decoded_file_name = Encode::decode($file_name_encoding, $txt_file)
         if (defined($file_name_encoding));
-      $self->line_warn($self,
+      $self->converter_line_warn(
                sprintf(__("\@image file `%s' unreadable: %s"),
                           $decoded_file_name, $!), $element->{'source_info'});
     }
diff --git a/tp/Texinfo/Convert/DocBook.pm b/tp/Texinfo/Convert/DocBook.pm
index 96f79ce863..91917ebab3 100644
--- a/tp/Texinfo/Convert/DocBook.pm
+++ b/tp/Texinfo/Convert/DocBook.pm
@@ -353,7 +353,7 @@ sub output($$)
                               $self->output_files_information(), $self,
                               $encoded_output_file);
     if (!$fh) {
-      $self->document_error($self,
+      $self->converter_document_error(
            sprintf(__("could not open %s for writing: %s"),
                                     $output_file, $error_message));
       return undef;
@@ -518,7 +518,7 @@ sub output($$)
     Texinfo::Common::output_files_register_closed(
                   $self->output_files_information(), $encoded_output_file);
     if (!close ($fh)) {
-      $self->document_error($self,
+      $self->converter_document_error(
             sprintf(__("error on closing %s: %s"),
                                     $output_file, $!));
     }
@@ -980,7 +980,7 @@ sub _convert($$;$)
         }
       } elsif ($element->{'cmdname'} eq 'verbatiminclude') {
         my $verbatim_include_verbatim
-          = Texinfo::Convert::Utils::expand_verbatiminclude($self, $self, 
$element);
+          = Texinfo::Convert::Utils::expand_verbatiminclude($self, $element);
         if (defined($verbatim_include_verbatim)) {
           $result .= $self->_convert($verbatim_include_verbatim);
         } else {
@@ -1299,7 +1299,7 @@ sub _convert($$;$)
                .'</literallayout></textobject>';
           }
           if (!defined($image_text) and !$image_file_found) {
-            $self->line_warn($self, sprintf(
+            $self->converter_line_warn(sprintf(
                      __("\@image file `%s' not found, using `%s'"), 
                        $basefile, "$basefile.jpg"), $element->{'source_info'});
           }
@@ -1434,7 +1434,7 @@ sub _convert($$;$)
         if ($argument) {
           $result = "&#x$argument;";
         } else {
-          $self->line_warn($self,
+          $self->converter_line_warn(
                   __("no argument specified for \@U"),
                            $element->{'source_info'});
           $result = '';
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 6633f5353b..8fc16cf4c2 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -112,7 +112,7 @@ my %XS_overrides = (
 my %XS_conversion_overrides = (
   "Texinfo::Convert::HTML::_XS_format_init"
    => "Texinfo::Convert::ConvertXS::html_format_init",
-  "Texinfo::Convert::HTML::_XS_converter_initialize"
+  "Texinfo::Convert::HTML::_XS_html_converter_initialize"
    => "Texinfo::Convert::ConvertXS::html_converter_initialize_sv",
   "Texinfo::Convert::HTML::_XS_initialize_output_state"
    => "Texinfo::Convert::ConvertXS::html_initialize_output_state",
@@ -2743,7 +2743,7 @@ sub _noticed_line_warn($$$)
   my $text = shift;
   my $line_nr = shift;
   return if ($self->{'ignore_notice'});
-  $self->line_warn($self, $text, $line_nr);
+  $self->converter_line_warn($text, $line_nr);
 }
 
 my %kept_line_commands;
@@ -4896,7 +4896,7 @@ sub _convert_verbatiminclude_command($$$$)
   my $args = shift;
 
   my $verbatim_include_verbatim
-    = Texinfo::Convert::Utils::expand_verbatiminclude($self, $self, $command);
+    = Texinfo::Convert::Utils::expand_verbatiminclude($self, $command);
   if (defined($verbatim_include_verbatim)) {
     return $self->convert_tree($verbatim_include_verbatim,
                                'convert verbatiminclude');
@@ -5689,6 +5689,7 @@ sub _convert_xref_commands($$$$)
     } elsif ($cmdname eq 'ref' or $cmdname eq 'link') {
       $tree = $self->gdt('{reference_name}',
          { 'reference_name' => {'type' => '_converted', 'text' => $reference} 
});
+
     }
   } else {
     # external reference
@@ -6170,7 +6171,7 @@ sub _convert_printindex_command($$$$)
           # NOTE _noticed_line_warn is not used as printindex should not
           # happen in multiple tree parsing that lead to ignore_notice being 
set,
           # but the error message is printed only for the first entry 
formatting.
-          $self->line_warn($self,
+          $self->converter_line_warn(
                            sprintf(
            __("entry for index `%s' for \@printindex %s outside of any node"),
                                    $index_entry_ref->{'index_name'},
@@ -6201,7 +6202,7 @@ sub _convert_printindex_command($$$$)
             # happen in multiple tree parsing that lead to ignore_notice being 
set,
             # but the error message is printed only for the first entry 
formatting.
             # NOTE the index entry may be associated to a node in that case.
-            $self->line_warn($self,
+            $self->converter_line_warn(
                              sprintf(
         __("entry for index `%s' for \@printindex %s outside of any section"),
                                      $index_entry_ref->{'index_name'},
@@ -7986,7 +7987,7 @@ sub _parse_htmlxref_files($$)
       if (defined($encoding)) {
         $htmlxref_file_name = decode($encoding, $htmlxref_file_name);
       }
-      $self->document_warn($self,
+      $self->converter_document_warn(
         sprintf(__("could not open html refs config file %s: %s"),
           $htmlxref_file_name, $!));
       next;
@@ -8015,11 +8016,11 @@ sub _parse_htmlxref_files($$)
       my $split_or_mono = shift @htmlxref;
       #print STDERR "$split_or_mono 
$Texi2HTML::Config::htmlxref_entries{$split_or_mono} $line_nr\n";
       if (!defined($split_or_mono)) {
-        $self->line_warn($self, __("missing type"),
+        $self->converter_line_warn(__("missing type"),
                  {'file_name' => $fname, 'line_nr' => $line_nr});
         next;
       } elsif (!defined($htmlxref_entries{$split_or_mono})) {
-        $self->line_warn($self, sprintf(__("unrecognized type: %s"),
+        $self->converter_line_warn(sprintf(__("unrecognized type: %s"),
                                         $split_or_mono),
                     {'file_name' => $fname, 'line_nr' => $line_nr});
         next;
@@ -8040,7 +8041,7 @@ sub _parse_htmlxref_files($$)
       $htmlxref->{$manual}->{$split_or_mono} = $href;
     }
     if (!close (HTMLXREF)) {
-      $self->document_warn($self, sprintf(__(
+      $self->converter_document_warn(sprintf(__(
                        "error on closing html refs config file %s: %s"),
                              $file, $!));
     }
@@ -8064,7 +8065,7 @@ sub _load_htmlxref_files {
     if (-e $encoded_htmlxref_file_name and -r $encoded_htmlxref_file_name) {
       @htmlxref_files = ($encoded_htmlxref_file_name);
     } else {
-      $self->document_warn($self,
+      $self->converter_document_warn(
         sprintf(__("could not find html refs config file %s"),
           $htmlxref_file_name));
     }
@@ -8225,7 +8226,7 @@ my %special_characters = (
   'non_breaking_space' => [undef, '00A0'],
 );
 
-sub _XS_converter_initialize($$$$$$$$$$$)
+sub _XS_html_converter_initialize($$$$$$$$$$$)
 {
 }
 
@@ -8587,7 +8588,7 @@ sub converter_initialize($)
   foreach my $customized_file_id_setting_ref
        (sort(keys(%{$customized_file_id_setting_references}))) {
     if 
(!$customizable_file_id_setting_references{$customized_file_id_setting_ref}) {
-      $self->document_warn($self,
+      $self->converter_document_warn(
                            sprintf(__("Unknown file and id setting function: 
%s"),
                                    $customized_file_id_setting_ref));
     } else {
@@ -8603,7 +8604,8 @@ sub converter_initialize($)
   foreach my $customized_formatting_reference
        (sort(keys(%{$customized_formatting_references}))) {
     if 
(!exists($default_formatting_references{$customized_formatting_reference})) {
-      $self->document_warn($self, sprintf(__("Unknown formatting function: 
%s"),
+      $self->converter_document_warn(
+            sprintf(__("Unknown formatting function: %s"),
                                           $customized_formatting_reference));
     }
   }
@@ -8718,7 +8720,7 @@ sub converter_initialize($)
       $self->{'sorted_special_unit_varieties'}
         = [sort(keys(%all_special_unit_varieties))];
     }
-    _XS_converter_initialize($self,
+    _XS_html_converter_initialize($self,
                              \%default_formatting_references,
                              \%default_css_string_formatting_references,
                              \%default_commands_open,
@@ -8935,11 +8937,11 @@ sub _process_css_file($$$)
       }
     }
   }
-  $self->line_warn($self, __("string not closed in css file"),
+  $self->converter_line_warn(__("string not closed in css file"),
                  {'file_name' => $file, 'line_nr' => $line_nr}) if 
($in_string);
-  $self->line_warn($self, __("--css-include ended in comment"),
+  $self->converter_line_warn(__("--css-include ended in comment"),
                  {'file_name' => $file, 'line_nr' => $line_nr}) if 
($in_comment);
-  $self->line_warn($self, __("\@import not finished in css file"),
+  $self->converter_line_warn(__("\@import not finished in css file"),
                  {'file_name' => $file, 'line_nr' => $line_nr})
     if ($in_import and !$in_comment and !$in_string);
   return ($imports, $rules);
@@ -8969,7 +8971,7 @@ sub _prepare_css($)
         if (defined($encoding)) {
           $input_file_name = decode($encoding, $input_file_name);
         }
-        $self->document_warn($self, sprintf(
+        $self->converter_document_warn(sprintf(
                __("CSS file %s not found"), $input_file_name));
         next;
       }
@@ -8979,7 +8981,7 @@ sub _prepare_css($)
         if (defined($encoding)) {
           $css_file_name = decode($encoding, $css_file_name);
         }
-        $self->document_warn($self, sprintf(__(
+        $self->converter_document_warn(sprintf(__(
              "could not open --include-file %s: %s"),
               $css_file_name, $!));
         next;
@@ -8998,7 +9000,7 @@ sub _prepare_css($)
       if (defined($encoding)) {
         $css_file_name = decode($encoding, $css_file_name);
       }
-      $self->document_warn($self,
+      $self->converter_document_warn(
             sprintf(__("error on closing CSS file %s: %s"),
                                    $css_file_name, $!));
     }
@@ -9199,7 +9201,7 @@ sub _set_root_commands_targets_node_files($)
         if (defined($user_node_filename)) {
           $node_filename = $user_node_filename;
         } elsif ($self->get_conf('VERBOSE')) {
-          $self->document_warn($self, sprintf(__(
+          $self->converter_document_warn(sprintf(__(
               "user-defined node file name not set for `%s'"),
               $node_filename));
 
@@ -9507,7 +9509,7 @@ sub _html_set_pages_files($$$$$$$$$)
           # is undef and the other is not
           if (defined($user_filepath) and defined($previous_filepath)
               and $user_filepath ne $previous_filepath) {
-            $self->document_warn($self,
+            $self->converter_document_warn(
              sprintf(__("resetting %s file path %s to %s"),
               $user_filename, $previous_filepath, $user_filepath));
           }
@@ -10066,9 +10068,9 @@ sub _sort_index_entries($)
     my $index_entries_sort_strings;
 
     ($self->{'index_entries_by_letter'}, $index_entries_sort_strings)
-            = Texinfo::Structuring::sort_indices_by_letter($self,
-                                    $self, $merged_index_entries,
-                                    $indices_information);
+            = Texinfo::Structuring::sort_indices_by_letter(undef, $self,
+                                               $merged_index_entries,
+                                               $indices_information);
     $self->{'index_entries'} = $merged_index_entries;
 
     # pass sorted index entries to XS for a reproducible sorting.
@@ -10246,14 +10248,14 @@ sub _external_node_href($$$;$)
         if (defined($source_command) and $source_command->{'source_info'}) {
           my $node_manual_key = $source_command.'-'.$manual_name;
           if (!$self->{'check_htmlxref_already_warned'}->{$node_manual_key}) {
-            $self->line_warn($self, sprintf(__(
+            $self->converter_line_warn(sprintf(__(
                     "no htmlxref.cnf entry found for `%s'"), $manual_name),
                              $source_command->{'source_info'});
             $self->{'check_htmlxref_already_warned'}->{$node_manual_key} = 1;
           }
         } else {
           if 
(!$self->{'check_htmlxref_already_warned'}->{'UNDEF-'.$manual_name}) {
-            $self->document_warn($self, sprintf(__(
+            $self->converter_document_warn(sprintf(__(
               "no htmlxref.cnf entry found for `%s'"), $manual_name),
               );
             $self->{'check_htmlxref_already_warned'}->{'UNDEF-'.$manual_name} 
= 1;
@@ -10703,7 +10705,7 @@ sub _file_header_information($$;$)
 
   if (defined($self->get_conf('INFO_JS_DIR'))) {
     if (!$self->get_conf('SPLIT')) {
-      $self->document_error($self,
+      $self->converter_document_error(
         sprintf(__("%s not meaningful for non-split output"),
                    'INFO_JS_DIR'));
     } else {
@@ -11161,7 +11163,7 @@ sub _do_jslicenses_file {
   $a .= "</table>\n</body></html>\n";
 
   if (File::Spec->file_name_is_absolute($path) or $path =~ /^[A-Za-z]*:/) {
-    $self->document_warn($self, sprintf(
+    $self->converter_document_warn(sprintf(
 __("cannot use absolute path or URL `%s' for JS_WEBLABELS_FILE when generating 
web labels file"), $path));
     return;
   }
@@ -11183,12 +11185,12 @@ __("cannot use absolute path or URL `%s' for 
JS_WEBLABELS_FILE when generating w
     Texinfo::Common::output_files_register_closed(
                   $self->output_files_information(), $licence_file_path);
     if (!close ($fh)) {
-      $self->document_error($self,
+      $self->converter_document_error(
                sprintf(__("error on closing %s: %s"),
                                     $license_file, $!));
     }
   } else {
-    $self->document_error($self,
+    $self->converter_document_error(
            sprintf(__("could not open %s for writing: %s"),
                    $license_file, $error_message_licence_file));
   }
@@ -11559,7 +11561,7 @@ sub run_stage_handlers($$$)
       my $status = &{$handler}($converter, $root, $stage);
       if ($status != 0) {
         if ($status < 0) {
-          $converter->document_error($converter,
+          $converter->converter_document_error(
              sprintf(__("handler %d of stage %s priority %s failed"),
                         $handler_idx, $stage, $priority));
         } else {
@@ -11611,7 +11613,7 @@ sub _do_js_files($$)
     }
     if (!-d $jsdir) {
       if (-f $jsdir) {
-        $self->document_error($self,
+        $self->converter_document_error(
           sprintf(__("%s already exists but is not a directory"), $jsdir));
       } else {
         mkdir $jsdir;
@@ -11632,7 +11634,7 @@ sub _do_js_files($$)
           my $from = File::Spec->catfile($jssrcdir, $f);
 
           if (!copy($from, $jsdir)) {
-            $self->document_error($self,
+            $self->converter_document_error(
               sprintf(__("error on copying %s into %s"), $from, $jsdir));
           }
         }
@@ -11641,12 +11643,12 @@ sub _do_js_files($$)
         for my $f ('info.js', 'modernizr.js', 'info.css') {
           my $filename = File::Spec->catfile($jsdir, $f);
           if (!open (FH, '>', $filename)) {
-            $self->document_error($self,
+            $self->converter_document_error(
               sprintf(__("error on creating empty %s: %s"),
                       $filename, $!));
           }
           if (!close(FH)) {
-            $self->document_error($self,
+            $self->converter_document_error(
               sprintf(__("error on closing empty %s: %s"),
                       $filename, $!));
           }
@@ -11713,7 +11715,7 @@ sub _prepare_converted_output_info($)
     # for line_warn.  Not clear what is the right way to do.  There is
     # no file level warn, as in general document_warn is used for messages
     # for other files than the main file name.
-    $self->line_warn($self, __(
+    $self->converter_line_warn(__(
                          "must specify a title with a title command or \@top"),
                {'file_name' => $self->{'document_info'}->{'input_file_name'}});
   } else {
@@ -11847,7 +11849,7 @@ sub _html_convert_output($$$$$$$$)
                          $self->output_files_information(), $self,
                          $encoded_out_filepath);
         if (!$file_fh) {
-          $self->document_error($self,
+          $self->converter_document_error(
                sprintf(__("could not open %s for writing: %s"),
                                     $out_filepath, $error_message));
           return undef;
@@ -11867,7 +11869,7 @@ sub _html_convert_output($$$$$$$$)
           Texinfo::Common::output_files_register_closed(
              $self->output_files_information(), $encoded_out_filepath);
           if (!close($file_fh)) {
-            $self->document_error($self,
+            $self->converter_document_error(
                        sprintf(__("error on closing %s: %s"),
                                   $out_filepath, $!));
             return undef;
@@ -12174,7 +12176,7 @@ sub output($$)
         # first condition finds conflict with tree elements
         if ($self->{'elements_in_file_count'}->{$redirection_filename}
             or $redirection_filenames{$redirection_filename}) {
-          $self->line_warn($self,
+          $self->converter_line_warn(
              sprintf(__("\@%s `%s' file %s for redirection exists"),
                $target_element->{'cmdname'},
                Texinfo::Convert::Texinfo::convert_to_texinfo({'contents'
@@ -12191,24 +12193,24 @@ sub output($$)
               # with potentially conflicting name will also be in the
               # non-split output document and therefore does not need
               # a redirection.
-              $self->document_warn($self,
+              $self->converter_document_warn(
                             __("conflict with whole document file"), 1);
             } elsif ($name eq 'Top') {
-              $self->document_warn($self,
+              $self->converter_document_warn(
                            __("conflict with Top file"), 1);
             } elsif ($name eq 'user_defined') {
-              $self->document_warn($self,
+              $self->converter_document_warn(
                             __("conflict with user-defined file"), 1);
            } elsif ($name eq 'unknown_node') {
-              $self->document_warn($self,
+              $self->converter_document_warn(
                            __("conflict with unknown node file"), 1);
             } elsif ($name eq 'unknown') {
-              $self->document_warn($self,
+              $self->converter_document_warn(
                             __("conflict with file without known source"), 1);
             }
           } elsif ($file_info_type eq 'node') {
             my $conflicting_node = $file_source->{'file_info_element'};
-            $self->line_warn($self,
+            $self->converter_line_warn(
          sprintf(__p('conflict of redirection file with file based on node 
name',
                      "conflict with \@%s `%s' file"),
                  $conflicting_node->{'cmdname'},
@@ -12220,7 +12222,7 @@ sub output($$)
             my $conflicting_node = $file_source->{'file_info_element'};
             my $conflicting_label_contents
                  = $file_source->{'file_info_label_contents'};
-            $self->line_warn($self,
+            $self->converter_line_warn(
                sprintf(__("conflict with \@%s `%s' redirection file"),
                  $conflicting_node->{'cmdname'},
                  Texinfo::Convert::Texinfo::convert_to_texinfo({'contents'
@@ -12229,7 +12231,7 @@ sub output($$)
               $conflicting_node->{'source_info'}, 1);
           } elsif ($file_info_type eq 'section') {
             my $conflicting_section = $file_source->{'file_info_element'};
-            $self->line_warn($self,
+            $self->converter_line_warn(
          sprintf(__p('conflict of redirection file with file based on section 
name',
                      "conflict with \@%s `%s' file"),
                  $conflicting_section->{'cmdname'},
@@ -12242,7 +12244,7 @@ sub output($$)
             my $special_unit = $unit_command->{'associated_unit'};
             my $output_unit_variety
               = $special_unit->{'special_unit_variety'};
-            $self->document_warn($self,
+            $self->converter_document_warn(
                sprintf(__("conflict with %s special element"),
                        $output_unit_variety), 1);
           }
@@ -12271,7 +12273,7 @@ sub output($$)
                              $self->output_files_information(), $self,
                              $encoded_out_filename);
         if (!$file_fh) {
-         $self->document_error($self, sprintf(__(
+         $self->converter_document_error(sprintf(__(
                                     "could not open %s for writing: %s"),
                                     $out_filename, $error_message));
         } else {
@@ -12279,7 +12281,7 @@ sub output($$)
           Texinfo::Common::output_files_register_closed(
                   $self->output_files_information(), $encoded_out_filename);
           if (!close ($file_fh)) {
-            $self->document_error($self, sprintf(__(
+            $self->converter_document_error(sprintf(__(
                              "error on closing redirection node file %s: %s"),
                                     $out_filename, $!));
             $self->_finalize_output_state();
diff --git a/tp/Texinfo/Convert/IXIN.pm b/tp/Texinfo/Convert/IXIN.pm
index 8333da86ab..6552719c12 100644
--- a/tp/Texinfo/Convert/IXIN.pm
+++ b/tp/Texinfo/Convert/IXIN.pm
@@ -339,7 +339,7 @@ sub output_ixin($$)
                              $self->output_files_information(), $self,
                              $encoded_output_file);
     if (!$fh) {
-      $self->document_error($self,
+      $self->converter_document_error(
                 sprintf(__("could not open %s for writing: %s"),
                                     $output_file, $error_message));
       return undef;
@@ -682,7 +682,7 @@ sub output_ixin($$)
     my $merged_index_entries
         = Texinfo::Structuring::merge_indices($indices_information);
     my ($entries, $index_entries_sort_strings)
-      = Texinfo::Structuring::sort_indices_by_index($self, $self,
+      = Texinfo::Structuring::sort_indices_by_index(undef, $self,
                                            $merged_index_entries,
                                            $indices_information);
     # first do the dts_text as the counts are needed for the dts index
@@ -982,7 +982,7 @@ sub output_ixin($$)
     Texinfo::Common::output_files_register_closed(
                   $self->output_files_information(), $encoded_output_file);
     if (!close ($fh)) {
-      $self->document_error($self,
+      $self->converter_document_error(
                 sprintf(__("error on closing %s: %s"),
                                     $output_file, $!));
     }
diff --git a/tp/Texinfo/Convert/Info.pm b/tp/Texinfo/Convert/Info.pm
index c34c8ef4a6..8bce249c90 100644
--- a/tp/Texinfo/Convert/Info.pm
+++ b/tp/Texinfo/Convert/Info.pm
@@ -118,7 +118,7 @@ sub output($$)
   my @indirect_files;
   if (!defined($tree_units) or not defined($tree_units->[0])
       or not defined($tree_units->[0]->{'unit_command'})) {
-    $self->line_warn($self, __("document without nodes"),
+    $self->converter_line_warn(__("document without nodes"),
              {'file_name' => $self->{'document_info'}->{'input_file_name'}});
     my $output = $header.$self->convert_tree($root);
     $self->count_context_bug_message('no element ');
@@ -135,7 +135,7 @@ sub output($$)
   } else {
     unless ($self->{'identifiers_target'}
             and $self->{'identifiers_target'}->{'Top'}) {
-      $self->line_warn($self, __("document without Top node"),
+      $self->converter_line_warn(__("document without Top node"),
              {'file_name' => $self->{'document_info'}->{'input_file_name'}});
     }
     $out_file_nr = 1;
@@ -176,7 +176,7 @@ sub output($$)
         if ($out_file_nr == 1) {
           $self->_register_closed_info_file($output_file);
           if (defined($close_error)) {
-            $self->document_error($self,
+            $self->converter_document_error(
                   sprintf(__("error on closing %s: %s"),
                                   $output_file, $close_error));
             return undef;
@@ -186,7 +186,7 @@ sub output($$)
                   $output_file.'-'.$out_file_nr."\n";
           }
           unless (rename($output_file, $output_file.'-'.$out_file_nr)) {
-            $self->document_error($self,
+            $self->converter_document_error(
                   sprintf(__("rename %s failed: %s"),
                                          $output_file, $!));
             return undef;
@@ -203,7 +203,7 @@ sub output($$)
         } else {
           $self->_register_closed_info_file($output_file.'-'.$out_file_nr);
           if (defined($close_error)) {
-            $self->document_error($self,
+            $self->converter_document_error(
                   sprintf(__("error on closing %s: %s"),
                                   $output_file.'-'.$out_file_nr,
                                   $close_error));
@@ -232,7 +232,7 @@ sub output($$)
   if ($out_file_nr > 1) {
     $self->_register_closed_info_file($output_file.'-'.$out_file_nr);
     if (!close ($fh)) {
-      $self->document_error($self,
+      $self->converter_document_error(
                sprintf(__("error on closing %s: %s"),
                             $output_file.'-'.$out_file_nr, $!));
       return undef;
@@ -271,7 +271,7 @@ sub output($$)
     my ($label_text, $byte_count) = $self->node_name($label->{'root'});
 
     if ($seen_anchors{$label_text}) {
-      $self->converter_line_error($self,
+      $self->plaintext_line_error($self,
                                   sprintf(__("\@%s output more than once: %s"),
           $label->{'root'}->{'cmdname'},
           Texinfo::Convert::Texinfo::convert_to_texinfo({'contents' =>
@@ -298,7 +298,7 @@ sub output($$)
     unless ($output_file eq '-') {
       $self->_register_closed_info_file($output_file);
       if (!close ($fh)) {
-        $self->document_error($self,
+        $self->converter_document_error(
                   sprintf(__("error on closing %s: %s"),
                               $output_file, $!));
       }
@@ -324,7 +324,7 @@ sub _open_info_file($$)
                                $encoded_filename, 'use_binmode');
 
   if (!$fh) {
-    $self->document_error($self, sprintf(
+    $self->converter_document_error(sprintf(
         __("could not open %s for writing: %s"),
         $filename, $error_message));
     return undef;
@@ -427,7 +427,7 @@ sub format_error_outside_of_any_node($$)
   my $self = shift;
   my $element = shift;
   if (!$self->{'current_node'}) {
-    $self->converter_line_warn($self,
+    $self->plaintext_line_warn($self,
          sprintf(__("\@%s outside of any node"),
                  $element->{'cmdname'}), $element->{'source_info'});
   }
@@ -475,7 +475,7 @@ sub format_node($$)
   my $post_quote = '';
   if ($node_text =~ /,/) {
     if ($self->{'info_special_chars_warning'}) {
-      $self->converter_line_warn($self, sprintf(__(
+      $self->plaintext_line_warn($self, sprintf(__(
                  "\@node name should not contain `,': %s"), $node_text),
                                $node->{'source_info'});
     }
@@ -513,7 +513,7 @@ sub format_node($$)
               # warn only for external nodes, internal nodes should already
               # trigger a warning when defined
               and $node_direction->{'extra'}->{'manual_content'}) {
-            $self->converter_line_warn($self, sprintf(__(
+            $self->plaintext_line_warn($self, sprintf(__(
                  "\@node %s name should not contain `,': %s"),
                                            $direction, $node_text),
                              $node->{'source_info'});
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index 1a67d5f561..e45c20633b 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -1076,7 +1076,7 @@ sub output($$)
                              $self->output_files_information(), $self,
                              $encoded_output_file);
     if (!$fh) {
-      $self->document_error($self,
+      $self->converter_document_error(
              sprintf(__("could not open %s for writing: %s"),
                                     $output_file, $error_message));
       return undef;
@@ -1145,7 +1145,7 @@ sub output($$)
     Texinfo::Common::output_files_register_closed(
                   $self->output_files_information(), $encoded_output_file);
     if (!close ($fh)) {
-      $self->document_error($self,
+      $self->converter_document_error(
                    sprintf(__("error on closing %s: %s"),
                                     $output_file, $!));
     }
@@ -2960,7 +2960,7 @@ sub _convert($$)
             next LINE;
           }
         }
-        $self->line_warn($self,
+        $self->converter_line_warn(
            sprintf(__("\\verb delimiter `%s' (for LaTeX) used in text `%s'"),
                       $delim, $line),
            $element->{'source_info'});
@@ -2992,7 +2992,7 @@ sub _convert($$)
           }
         }
         if (not $image_file_found) {
-          $self->line_warn($self,
+          $self->converter_line_warn(
                          sprintf(__("\@image file `%s' (for LaTeX) not found"),
                                  $basefile),
                            $element->{'source_info'});
@@ -3844,7 +3844,7 @@ sub _convert($$)
       }
       return $result;
     } elsif ($cmdname eq 'verbatiminclude') {
-      my $expansion = Texinfo::Convert::Utils::expand_verbatiminclude($self,
+      my $expansion = Texinfo::Convert::Utils::expand_verbatiminclude(
                                                               $self, $element);
       unshift @{$self->{'current_contents'}->[-1]}, $expansion
         if ($expansion);
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 2ccbbb6def..cd22b3b4c6 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -756,7 +756,7 @@ sub new_formatter($$;$)
 }
 
 # intercept messages, in case some Texinfo is processed twice
-sub converter_line_warn($$$$)
+sub plaintext_line_warn($$$$)
 {
   my $self = shift;
   my $configuration_information = shift;
@@ -764,11 +764,11 @@ sub converter_line_warn($$$$)
   my $error_location_info = shift;
 
   if (!$self->{'silent'}) {
-    $self->line_warn($configuration_information, $text, $error_location_info);
+    $self->converter_line_warn($text, $error_location_info);
   }
 }
 
-sub converter_line_error($$$$)
+sub plaintext_line_error($$$$)
 {
   my $self = shift;
   my $configuration_information = shift;
@@ -776,7 +776,7 @@ sub converter_line_error($$$$)
   my $error_location_info = shift;
 
   if (!$self->{'silent'}) {
-    $self->line_error($configuration_information, $text, $error_location_info);
+    $self->converter_line_error($text, $error_location_info);
   }
 }
 
@@ -1354,7 +1354,7 @@ sub process_printindex($$;$)
       = Texinfo::Structuring::merge_indices($indices_information);
     my $index_entries_sort_strings;
     ($self->{'index_entries'}, $index_entries_sort_strings)
-      = Texinfo::Structuring::sort_indices_by_index($self, $self,
+      = Texinfo::Structuring::sort_indices_by_index(undef, $self,
                                            $merged_index_entries,
                                            $indices_information);
   }
@@ -1482,7 +1482,7 @@ sub process_printindex($$;$)
       $entry_cmdname
         = $main_entry_element->{'extra'}->{'original_def_cmdname'}
            if (!defined($entry_cmdname));
-      $self->converter_line_warn ($self,
+      $self->plaintext_line_warn ($self,
         sprintf(__("Index entry in \@%s with : produces invalid Info: %s"),
                 $entry_cmdname,
                 Texinfo::Convert::Texinfo::convert_to_texinfo($entry_tree)),
@@ -1529,7 +1529,7 @@ sub process_printindex($$;$)
       # done by the Parser.
       # Warn, only once.
       if (!$self->{'index_entries_no_node'}->{$entry}) {
-        $self->converter_line_warn($self,
+        $self->plaintext_line_warn($self,
            sprintf(__("entry for index `%s' outside of any node"),
                       $index_name), $main_entry_element->{'source_info'});
         $self->{'index_entries_no_node'}->{$entry} = 1;
@@ -1545,7 +1545,7 @@ sub process_printindex($$;$)
         if ($self->{'info_special_chars_warning'}) {
           # Warn only once
           if (! $self->{'index_entry_node_colon'}->{$node_name}) {
-            $self->converter_line_warn($self, sprintf(__(
+            $self->plaintext_line_warn($self, sprintf(__(
              "node name with index entries should not contain `%s'"),
                                             $warned_char),
                            $node->{'source_info'});
@@ -1656,7 +1656,7 @@ sub image_formatted_text($$$$)
     $result = '[' .Texinfo::Convert::Text::convert_to_text(
          $element->{'args'}->[3], $self->{'convert_text_options'}) .']';
   } else {
-    $self->converter_line_warn($self, sprintf(__(
+    $self->plaintext_line_warn($self, sprintf(__(
                     "could not find \@image file `%s.txt' nor alternate text"),
                              $basefile), $element->{'source_info'});
     $result = '['.$basefile.']';
@@ -2002,7 +2002,7 @@ sub _convert($$)
                     =~ /^Note\s/i
               and $self->{'converted_format'}
               and $self->{'converted_format'} eq 'info') {
-            $self->converter_line_warn($self, __(
+            $self->plaintext_line_warn($self, __(
       "\@strong{Note...} produces a spurious cross-reference in Info; reword 
to avoid that"),
                              $element->{'source_info'});
           }
@@ -2168,7 +2168,7 @@ sub _convert($$)
             my $quoting_required = 0;
             if ($name_text_checked =~ /:/m) {
               if ($self->{'info_special_chars_warning'}) {
-                $self->converter_line_warn($self, sprintf(__(
+                $self->plaintext_line_warn($self, sprintf(__(
                    "\@%s cross-reference name should not contain `:'"),
                                          $command), $element->{'source_info'});
               }
@@ -2227,7 +2227,7 @@ sub _convert($$)
           my $quoting_required = 0;
           if ($node_line_name =~ /([$check_chars])/m) {
             if ($self->{'info_special_chars_warning'}) {
-              $self->converter_line_warn($self, sprintf(__(
+              $self->plaintext_line_warn($self, sprintf(__(
                  "\@%s node name should not contain `%s'"), $command, $1),
                                $element->{'source_info'});
             }
@@ -2293,11 +2293,11 @@ sub _convert($$)
                   my $text = $next->{'text'};
                   $text =~ s/^\s*//;
                   my $char = substr($text, 0, 1);
-                  $self->converter_line_warn($self, sprintf(__(
+                  $self->plaintext_line_warn($self, sprintf(__(
                               "`.' or `,' must follow \@xref, not %s"),
                                            $char), $element->{'source_info'});
                 } else {
-                  $self->converter_line_warn($self,
+                  $self->plaintext_line_warn($self,
                              __("`.' or `,' must follow \@xref"),
                                    $element->{'source_info'});
                 }
@@ -2943,7 +2943,7 @@ sub _convert($$)
       }
       return $result;
     } elsif ($command eq 'verbatiminclude') {
-      my $expansion = Texinfo::Convert::Utils::expand_verbatiminclude($self,
+      my $expansion = Texinfo::Convert::Utils::expand_verbatiminclude(
                                                                $self, 
$element);
       $result .= _convert($self, $expansion) if (defined($expansion));
       return $result;
@@ -3422,7 +3422,7 @@ sub _convert($$)
           if ($entry_name_seen) {
             if ($node_text =~ /([,\t]|\.\s)/) {
               if ($self->{'info_special_chars_warning'}) {
-                $self->converter_line_warn($self, sprintf(__(
+                $self->plaintext_line_warn($self, sprintf(__(
                    "menu entry node name should not contain `%s'"), $1),
                                $element->{'source_info'});
               }
@@ -3433,7 +3433,7 @@ sub _convert($$)
           } else {
             if ($node_text =~ /:/) {
               if ($self->{'info_special_chars_warning'}) {
-                $self->converter_line_warn($self, __(
+                $self->plaintext_line_warn($self, __(
                  "menu entry node name should not contain `:'"),
                                $element->{'source_info'});
               }
@@ -3456,7 +3456,7 @@ sub _convert($$)
           $pre_quote = $post_quote = '';
           if ($entry_name =~ /:/) {
             if ($self->{'info_special_chars_warning'}) {
-              $self->converter_line_warn($self, __(
+              $self->plaintext_line_warn($self, __(
                  "menu entry name should not contain `:'"),
                                $element->{'source_info'});
             }
diff --git a/tp/Texinfo/Convert/TexinfoMarkup.pm 
b/tp/Texinfo/Convert/TexinfoMarkup.pm
index 084cd386bd..4c3a659185 100644
--- a/tp/Texinfo/Convert/TexinfoMarkup.pm
+++ b/tp/Texinfo/Convert/TexinfoMarkup.pm
@@ -309,7 +309,7 @@ sub output($$)
                              $self->output_files_information(), $self,
                              $encoded_output_file);
     if (!$fh) {
-      $self->document_error($self,
+      $self->converter_document_error(
                  sprintf(__("could not open %s for writing: %s"),
                                     $output_file, $error_message));
       return undef;
@@ -336,7 +336,7 @@ sub output($$)
     Texinfo::Common::output_files_register_closed(
                   $self->output_files_information(), $encoded_output_file);
     if (!close ($fh)) {
-      $self->document_error($self,
+      $self->converter_document_error(
                   sprintf(__("error on closing %s: %s"),
                                     $output_file, $!));
     }
diff --git a/tp/Texinfo/Convert/Text.pm b/tp/Texinfo/Convert/Text.pm
index b2b8f1fc87..ad9e989368 100644
--- a/tp/Texinfo/Convert/Text.pm
+++ b/tp/Texinfo/Convert/Text.pm
@@ -737,11 +737,10 @@ sub _convert($;$)
           # output as for the main $options->{'converter'}.
           $verbatim_include_verbatim
             = Texinfo::Convert::Utils::expand_verbatiminclude(
-                $options->{'converter'}, $options->{'converter'}, $element);
+                                          $options->{'converter'}, $element);
         } else {
           $verbatim_include_verbatim
-            = Texinfo::Convert::Utils::expand_verbatiminclude(undef,
-                                                        $options, $element);
+            = Texinfo::Convert::Utils::expand_verbatiminclude($options, 
$element);
         }
         if (defined($verbatim_include_verbatim)) {
           $result .= _convert($verbatim_include_verbatim, $options);
@@ -1039,6 +1038,14 @@ sub set_conf($$$)
   return 1;
 }
 
+sub converter_line_error()
+{
+}
+
+sub converter_document_warn()
+{
+}
+
 sub errors()
 {
   return undef;
diff --git a/tp/Texinfo/Convert/Utils.pm b/tp/Texinfo/Convert/Utils.pm
index 38b96e8cfe..47b7be8c28 100644
--- a/tp/Texinfo/Convert/Utils.pm
+++ b/tp/Texinfo/Convert/Utils.pm
@@ -259,15 +259,13 @@ sub find_innermost_accent_contents($)
   }
 }
 
-# $REGISTRAR argument (in practice, a converter) is optional.
-# $CONFIGURATION_INFORMATION is also optional, but without this
+# $CONVERTER is optional, but without this
 # argument and the 'INCLUDE_DIRECTORIES' available through
 # get_conf(), the included file can only be found in specific
 # circumstances.
-sub expand_verbatiminclude($$$)
+sub expand_verbatiminclude($$)
 {
-  my $registrar = shift;
-  my $customization_information = shift;
+  my $converter = shift;
   my $current = shift;
 
   return undef unless ($current->{'extra'}
@@ -278,22 +276,22 @@ sub expand_verbatiminclude($$$)
     = Texinfo::Common::element_associated_processing_encoding($current);
 
   my ($file_name, $file_name_encoding)
-    = encoded_input_file_name($customization_information,
+    = encoded_input_file_name($converter,
                               $file_name_text, $input_encoding);
 
-  my $file = Texinfo::Common::locate_include_file($customization_information,
+  my $file = Texinfo::Common::locate_include_file($converter,
                                                   $file_name);
 
   my $verbatiminclude;
 
   if (defined($file)) {
     if (!open(VERBINCLUDE, $file)) {
-      if ($registrar) {
+      if ($converter) {
         my $decoded_file = $file;
         # need to decode to the internal perl codepoints for error message
         $decoded_file = Encode::decode($file_name_encoding, $file)
            if (defined($file_name_encoding));
-        $registrar->line_error($customization_information,
+        $converter->converter_line_error(
                       sprintf(__("could not read %s: %s"), $decoded_file, $!),
                       $current->{'source_info'});
       }
@@ -310,20 +308,20 @@ sub expand_verbatiminclude($$$)
                   {'type' => 'raw', 'text' => $_ };
       }
       if (!close (VERBINCLUDE)) {
-        if ($registrar) {
+        if ($converter) {
           my $decoded_file = $file;
           # need to decode to the internal perl codepoints for error message
           $decoded_file = Encode::decode($file_name_encoding, $file)
              if (defined($file_name_encoding));
-          $registrar->document_warn(
-                 $customization_information, sprintf(__(
+          $converter->converter_document_warn(
+                 sprintf(__(
                       "error on closing \@verbatiminclude file %s: %s"),
                           $decoded_file, $!));
         }
       }
     }
-  } elsif ($registrar) {
-    $registrar->line_error($customization_information,
+  } elsif ($converter) {
+    $converter->converter_line_error(
                            sprintf(__("\@%s: could not find %s"),
                                        $current->{'cmdname'}, $file_name_text),
                            $current->{'source_info'});
@@ -541,7 +539,7 @@ Texinfo::Convert::Utils - miscellaneous functions usable in 
all converters
   
   my $today_tree = Texinfo::Convert::Utils::expand_today($converter);
   my $verbatiminclude_tree
-     = Texinfo::Convert::Utils::expand_verbatiminclude(undef, $converter,
+     = Texinfo::Convert::Utils::expand_verbatiminclude($converter,
                                                        $verbatiminclude);
 
 =head1 NOTES
@@ -630,16 +628,14 @@ Expand today's date, as a texinfo tree with translations. 
 The I<$converter>
 argument is not optional and is used both to retrieve customization information
 and to translate strings.
 
-=item $tree = expand_verbatiminclude($registrar, $customization_information, 
$verbatiminclude)
+=item $tree = expand_verbatiminclude($converter, $verbatiminclude)
 X<C<expand_verbatiminclude>>
 
-The I<$registrar> argument may be undef.  The I<$customization_information>
-argument is required and is used to retrieve customization information
-L<Texinfo::Convert::Converter/Getting and setting customization variables>.
-I<$verbatiminclude> is a C<@verbatiminclude> tree element.  This function
-returns a C<@verbatim> tree elements after finding the included file and
-reading it.  If I<$registrar> is not defined, error messages are not
-registered.
+The I<$converter> argument is required and is used to output error messages and
+retrieve customization information L<Texinfo::Convert::Converter/Getting and
+setting customization variables>.  I<$verbatiminclude> is a C<@verbatiminclude>
+tree element.  This function returns a C<@verbatim> tree elements after finding
+the included file and reading it.
 
 =item ($contents_element, \@accent_commands) = 
find_innermost_accent_contents($element)
 X<C<find_innermost_accent_contents>>
diff --git a/tp/Texinfo/DebugTree.pm b/tp/Texinfo/DebugTree.pm
index df50b8ef58..34db3c0c82 100644
--- a/tp/Texinfo/DebugTree.pm
+++ b/tp/Texinfo/DebugTree.pm
@@ -74,7 +74,7 @@ sub output($$)
                              $self->output_files_information(), $self,
                                      $encoded_output_file);
     if (!$fh) {
-      $self->document_error($self,
+      $self->converter_document_error(
            sprintf(__("could not open %s for writing: %s"),
                                     $output_file, $error_message));
       return undef;
@@ -86,7 +86,7 @@ sub output($$)
     Texinfo::Common::output_files_register_closed(
              $self->output_files_information(), $encoded_output_file);
     if (!close ($fh)) {
-      $self->document_error($self,
+      $self->converter_document_error(
                sprintf(__("error on closing %s: %s"),
                                     $output_file, $!));
       return undef;
diff --git a/tp/Texinfo/Report.pm b/tp/Texinfo/Report.pm
index 2aa441efcc..27d02e0b38 100644
--- a/tp/Texinfo/Report.pm
+++ b/tp/Texinfo/Report.pm
@@ -80,15 +80,13 @@ sub add_formatted_message($$)
   push @{$self->{'errors_warnings'}}, $message;
 }
 
-sub format_line_message($$$$$;$$)
+sub format_line_message($$$$;$)
 {
-  my $self = shift;
-  my $configuration_information = shift;
   my $type = shift;
   my $text = shift;
   my $error_location_info = shift;
   my $continuation = shift;
-  my $silent = shift;
+  my $warn = shift;
 
   # TODO actually a bug, add a bug message/cluck
   return if (!defined($error_location_info));
@@ -117,12 +115,15 @@ sub format_line_message($$$$$;$$)
       $message_line = $text."\n";
     }
   }
-  warn $message_line if (defined($configuration_information)
-                      and $configuration_information->get_conf('DEBUG')
-                      and not $silent);
+  warn $message_line if ($warn);
   my %location_info = %{$error_location_info};
   delete $location_info{'file_name'} if (exists ($location_info{'file_name'})
                                   and not 
defined($location_info{'file_name'}));
+  # FIXME remove this code as soon as possible
+  if (defined($location_info{'line_nr'}) and $location_info{'line_nr'} > 0
+      and !defined ($location_info{'macro'})) {
+    $location_info{'macro'} = "";
+  }
   my $result
     = { 'type' => $type, 'text' => $text, 'error_line' => $message_line,
          %location_info };
@@ -141,12 +142,16 @@ sub line_warn($$$$;$$)
   my $continuation = shift;
   my $silent = shift;
 
-  my $warning = $self->format_line_message($configuration_information,
-            'warning', $text, $error_location_info, $continuation, $silent);
+  my $warn = (defined($configuration_information)
+              and $configuration_information->get_conf('DEBUG')
+              and not $silent);
+
+  my $warning = format_line_message('warning', $text, $error_location_info,
+                                    $continuation, $warn);
   $self->add_formatted_message($warning);
 }
 
-sub line_error($$$$;$)
+sub line_error($$$$;$$)
 {
   my $self = shift;
   my $configuration_information = shift;
@@ -155,29 +160,30 @@ sub line_error($$$$;$)
   my $continuation = shift;
   my $silent = shift;
 
-  my $error = $self->format_line_message($configuration_information, 'error',
-                        $text, $error_location_info, $continuation, $silent);
+  my $warn = (defined($configuration_information)
+              and $configuration_information->get_conf('DEBUG')
+              and not $silent);
+
+  my $error = format_line_message('error', $text, $error_location_info,
+                                  $continuation, $warn);
   $self->add_formatted_message($error);
 }
 
-sub format_document_message($$$$;$)
+sub format_document_message($$;$$)
 {
-  my $self = shift;
-  my $configuration_information = shift;
   my $type = shift;
   my $text = shift;
+  my $program_name = shift;
   my $continuation = shift;
 
   my $message_line;
-  if (defined($configuration_information)
-      and defined($configuration_information->get_conf('PROGRAM'))
-      and $configuration_information->get_conf('PROGRAM') ne '') {
+  if (defined($program_name)) {
     if ($type eq 'warning') {
       $message_line = sprintf(__p("whole document warning", "%s: warning: 
%s")."\n",
-                    $configuration_information->get_conf('PROGRAM'), $text);
+                              $program_name, $text);
     } else {
       $message_line = sprintf("%s: %s\n",
-            $configuration_information->get_conf('PROGRAM'), $text);
+            $program_name, $text);
     }
   } else {
     if ($type eq 'warning') {
@@ -199,8 +205,16 @@ sub document_warn($$$;$)
   my $text = shift;
   my $continuation = shift;
 
-  my $warning = $self->format_document_message($configuration_information,
-                                               'warning', $text, 
$continuation);
+  my $program_name;
+
+  if (defined($configuration_information)
+      and defined($configuration_information->get_conf('PROGRAM'))
+      and $configuration_information->get_conf('PROGRAM') ne '') {
+    $program_name = $configuration_information->get_conf('PROGRAM');
+  }
+
+  my $warning = format_document_message('warning', $text, $program_name,
+                                        $continuation);
   $self->add_formatted_message($warning);
 }
 
@@ -211,8 +225,16 @@ sub document_error($$$;$)
   my $text = shift;
   my $continuation = shift;
 
-  my $error = $self->format_document_message($configuration_information,
-                                             'error', $text, $continuation);
+  my $program_name;
+
+  if (defined($configuration_information)
+      and defined($configuration_information->get_conf('PROGRAM'))
+      and $configuration_information->get_conf('PROGRAM') ne '') {
+    $program_name = $configuration_information->get_conf('PROGRAM');
+  }
+
+  my $error = format_document_message('error', $text, $program_name,
+                                      $continuation);
   $self->add_formatted_message($error);
 }
 
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index 53f3a36279..68b640419b 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -2357,6 +2357,25 @@ package Texinfo::Structuring;
 #my $default_preset_keys = 0;
 my $default_preset_keys = 1;
 
+# this is needed here, as the code can be called both from the main
+# context, with a registrar and customization information, and from
+# a converter
+sub _converter_or_registrar_line_warn($$$$)
+{
+  my $registrar = shift;
+  my $customization_information = shift;
+  my $text = shift;
+  my $error_location_info = shift;
+
+  if (defined($registrar)) {
+    $registrar->line_warn($customization_information, $text,
+                          $error_location_info);
+  } else {
+    $customization_information->converter_line_warn($text,
+                                                    $error_location_info);
+  }
+}
+
 sub setup_sortable_index_entries($$$$$;$)
 {
   my $registrar = shift;
@@ -2444,7 +2463,8 @@ sub setup_sortable_index_entries($$$$$;$)
           = $main_entry_element->{'extra'}->{'original_def_cmdname'}
            if (!defined($entry_cmdname));
         if (!$silent) {
-          $registrar->line_warn($customization_information,
+          _converter_or_registrar_line_warn($registrar,
+                                   $customization_information,
                        sprintf(__("empty index key in \@%s"),
                                   $entry_cmdname),
                                $main_entry_element->{'source_info'});
@@ -2472,7 +2492,8 @@ sub setup_sortable_index_entries($$$$$;$)
             = $main_entry_element->{'extra'}->{'original_def_cmdname'}
               if (!defined($entry_cmdname));
           if (!$silent) {
-            $registrar->line_warn($customization_information,
+            _converted_or_registrar_line_warn($registrar,
+                                $customization_information,
                          sprintf(__("empty index sub entry %d key in \@%s"),
                                     $subentry_nr, $entry_cmdname),
                                   $main_entry_element->{'source_info'});
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs 
b/tp/Texinfo/XS/convert/ConvertXS.xs
index 23a1a4e137..db27a32a34 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -70,7 +70,11 @@ init (...)
         RETVAL
 
 void
-set_conf(SV *converter_in, conf, SV *value)
+converter_initialize (SV *converter_in)
+
+
+void
+set_conf (SV *converter_in, conf, SV *value)
          char *conf = (char *)SvPVbyte_nolen($arg);
       PREINIT:
          CONVERTER *self;
@@ -80,6 +84,82 @@ set_conf(SV *converter_in, conf, SV *value)
          if (self)
            set_conf (self, conf, value);
 
+void
+converter_line_error (SV *converter_in, text, SV *error_location_info, ...)
+          char *text = (char *)SvPVutf8_nolen($arg);
+      PROTOTYPE: $$$;$$
+      PREINIT:
+         CONVERTER *self;
+         int continuation = 0;
+         int silent = 0;
+      CODE:
+         self = get_sv_converter (converter_in, 0);
+         if (items > 3 && SvOK(ST(3)))
+           continuation = SvIV (ST(3));
+         if (items > 4 && SvOK(ST(4)))
+           silent = SvIV (ST(4));
+
+         if (self)
+           {
+             get_line_message (self, MSG_error, continuation,
+                               error_location_info, strdup (text), silent);
+           }
+
+void
+converter_line_warn (SV *converter_in, text, SV *error_location_info, ...)
+          char *text = (char *)SvPVutf8_nolen($arg);
+      PROTOTYPE: $$$;$$
+      PREINIT:
+         CONVERTER *self;
+         int continuation = 0;
+         int silent = 0;
+      CODE:
+         self = get_sv_converter (converter_in, 0);
+         if (items > 3 && SvOK(ST(3)))
+           continuation = SvIV (ST(3));
+         if (items > 4 && SvOK(ST(4)))
+           silent = SvIV (ST(4));
+
+         if (self)
+           {
+             get_line_message (self, MSG_warning, continuation,
+                               error_location_info, strdup (text), silent);
+           }
+
+void
+converter_document_error (SV *converter_in, text, ...)
+          char *text = (char *)SvPVutf8_nolen($arg);
+      PROTOTYPE: $$;$
+      PREINIT:
+         CONVERTER *self;
+         int continuation = 0;
+      CODE:
+         self = get_sv_converter (converter_in, 0);
+         if (items > 2 && SvOK(ST(2)))
+           continuation = SvIV (ST(2));
+         if (self)
+           {
+             message_list_document_formatted_message (&self->error_messages,
+               self->conf, MSG_document_error, continuation, strdup (text)); 
+           }
+
+void
+converter_document_warn (SV *converter_in, text, ...)
+          char *text = (char *)SvPVutf8_nolen($arg);
+      PROTOTYPE: $$;$
+      PREINIT:
+         CONVERTER *self;
+         int continuation = 0;
+      CODE:
+         self = get_sv_converter (converter_in, 0);
+         if (items > 2 && SvOK(ST(2)))
+           continuation = SvIV (ST(2));
+         if (self)
+           {
+             message_list_document_formatted_message (&self->error_messages,
+                      self->conf, MSG_document_warning, continuation, strdup 
(text));
+           }
+
 void
 get_index_entries_sorted_by_letter (SV *converter_in, SV 
*index_entries_sorted_by_letter)
       PREINIT:
@@ -136,8 +216,8 @@ get_converter_errors (SV *converter_in)
          self = get_sv_converter (converter_in, 0);
          if (self && self->error_messages.number)
            {
-             errors_av = get_errors (self->error_messages.list,
-                                     self->error_messages.number);
+             errors_av = build_errors (self->error_messages.list,
+                                       self->error_messages.number);
              wipe_error_message_list (&self->error_messages);
            }
          else
@@ -219,7 +299,7 @@ text_convert_tree (SV *text_options_in, SV *tree_in, 
unused=0)
 void
 html_format_init ()
 
-int
+void
 html_converter_initialize_sv (SV *converter_in, SV 
*default_formatting_references, SV *default_css_string_formatting_references, 
SV *default_commands_open, SV *default_commands_conversion, SV 
*default_css_string_commands_conversion, SV *default_types_open, SV 
*default_types_conversion, SV *default_css_string_types_conversion, SV 
*default_output_units_conversion, SV *default_special_unit_body)
 
 void
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.c 
b/tp/Texinfo/XS/convert/get_html_perl_info.c
index 5b88f66c89..a36bcb3953 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.c
@@ -116,7 +116,7 @@ compare_ints (const void *a, const void *b)
   return (*int_a > *int_b) - (*int_a < *int_b);
 }
 
-int
+void
 html_converter_initialize_sv (SV *converter_sv,
                               SV *default_formatting_references,
                               SV *default_css_string_formatting_references,
@@ -159,15 +159,11 @@ html_converter_initialize_sv (SV *converter_sv,
   HV *types_open_hv;
   HV *types_conversion_hv;
   HV *output_units_conversion_hv;
-  int converter_descriptor = 0;
   CONVERTER *converter;
 
   dTHX;
 
-  converter_descriptor = new_converter ();
-  converter = retrieve_converter (converter_descriptor);
-
-  converter_initialize (converter_sv, converter);
+  converter = get_sv_converter (converter_sv, "html_converter_initialize_sv");
 
   converter_hv = (HV *)SvRV (converter_sv);
 
@@ -823,15 +819,6 @@ html_converter_initialize_sv (SV *converter_sv,
     }
 
   html_converter_initialize (converter);
-
-  converter->hv = converter_hv;
-
-  /* store converter_descriptor in perl converter */
-  hv_store (converter_hv, "converter_descriptor",
-            strlen("converter_descriptor"),
-            newSViv (converter_descriptor), 0);
-
-  return converter_descriptor;
 }
 
 void
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.h 
b/tp/Texinfo/XS/convert/get_html_perl_info.h
index 1dbf66d6a2..0c224ed932 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.h
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.h
@@ -5,7 +5,7 @@
 #include "EXTERN.h"
 #include "perl.h"
 
-int html_converter_initialize_sv (SV *converter_sv,
+void html_converter_initialize_sv (SV *converter_sv,
                                   SV *default_formatting_references,
                                   SV *default_css_string_formatting_references,
                                   SV *default_commands_open,
diff --git a/tp/Texinfo/XS/main/build_perl_info.c 
b/tp/Texinfo/XS/main/build_perl_info.c
index afd7bc6d03..98617b396d 100644
--- a/tp/Texinfo/XS/main/build_perl_info.c
+++ b/tp/Texinfo/XS/main/build_perl_info.c
@@ -629,20 +629,22 @@ element_to_perl_hash (ELEMENT *e, int avoid_recursion)
           STORE("file_name", newSVpv (source_info->file_name, 0),
                 HSH_file_name);
         }
-      else
-        STORE("file_name", newSVpv ("", 0), HSH_file_name);
 
       if (source_info->line_nr)
         {
           STORE("line_nr", newSViv (source_info->line_nr), HSH_line_nr);
+
+          if (!source_info->macro)
+            STORE("macro", newSVpv ("", 0), HSH_macro);
+
+          if (!source_info->file_name)
+            STORE("file_name", newSVpv ("", 0), HSH_file_name);
         }
 
       if (source_info->macro)
         {
           STORE("macro", newSVpv_utf8 (source_info->macro, 0), HSH_macro);
         }
-      else
-        STORE("macro", newSVpv ("", 0), HSH_macro);
 #undef STORE
     }
 }
@@ -1109,7 +1111,7 @@ convert_error (ERROR_MESSAGE e)
 
 /* Errors */
 AV *
-get_errors (ERROR_MESSAGE* error_list, size_t error_number)
+build_errors (ERROR_MESSAGE* error_list, size_t error_number)
 {
   AV *av;
   int i;
@@ -1152,8 +1154,8 @@ get_document (size_t document_descriptor)
 
   hv_info = build_global_info (document->global_info, 
document->global_commands);
 
-  av_errors_list = get_errors (document->error_messages->list,
-                               document->error_messages->number);
+  av_errors_list = build_errors (document->error_messages->list,
+                                 document->error_messages->number);
 
 #define STORE(key, value) hv_store (hv, key, strlen (key), newRV_inc ((SV *) 
value), 0)
   STORE("tree", hv_tree);
@@ -1231,8 +1233,8 @@ build_document (size_t document_descriptor, int no_store)
   av_labels_list = build_target_elements_list (document->labels_list->list,
                                                document->labels_list->number);
 
-  av_errors_list = get_errors (document->error_messages->list,
-                               document->error_messages->number);
+  av_errors_list = build_errors (document->error_messages->list,
+                                 document->error_messages->number);
 
   if (document->nodes_list)
     av_nodes_list = build_elements_list (document->nodes_list);
diff --git a/tp/Texinfo/XS/main/build_perl_info.h 
b/tp/Texinfo/XS/main/build_perl_info.h
index e08bc83c4e..f9d438075e 100644
--- a/tp/Texinfo/XS/main/build_perl_info.h
+++ b/tp/Texinfo/XS/main/build_perl_info.h
@@ -23,7 +23,7 @@ SV *build_document (size_t document_descriptor, int no_store);
 SV *get_document (size_t document_descriptor);
 
 HV *build_texinfo_tree (ELEMENT *root, int avoid_recursion);
-AV *get_errors (ERROR_MESSAGE* error_list, size_t error_number);
+AV *build_errors (ERROR_MESSAGE* error_list, size_t error_number);
 AV *build_target_elements_list (LABEL *labels_list,
                                 size_t labels_number);
 HV* build_identifiers_target (LABEL_LIST *identifiers_target);
diff --git a/tp/Texinfo/XS/main/errors.c b/tp/Texinfo/XS/main/errors.c
index b2c9ce5f1a..727f5fec33 100644
--- a/tp/Texinfo/XS/main/errors.c
+++ b/tp/Texinfo/XS/main/errors.c
@@ -59,23 +59,16 @@ reallocate_error_messages (ERROR_MESSAGE_LIST 
*error_messages)
   return error_message;
 }
 
-static void
-message_list_line_error_internal (ERROR_MESSAGE_LIST *error_messages,
-                                  enum error_type type, int continuation,
-                                  const SOURCE_INFO *cmd_source_info,
-                                  const char *format, va_list v)
+/* only directly used for messages passed from perl */
+void
+message_list_line_formatted_message (ERROR_MESSAGE_LIST *error_messages,
+                           enum error_type type, int continuation,
+                           const SOURCE_INFO *cmd_source_info,
+                           char *message, int warn)
 {
-  char *message;
   TEXT error_line;
   ERROR_MESSAGE *error_message;
 
-#ifdef ENABLE_NLS
-  xvasprintf (&message, gettext(format), v);
-#else
-  xvasprintf (&message, format, v);
-#endif
-  if (!message) fatal ("vasprintf failed");
-
   error_message = reallocate_error_messages (error_messages);
 
   error_message->message = message;
@@ -135,27 +128,40 @@ message_list_line_error_internal (ERROR_MESSAGE_LIST 
*error_messages,
 
   error_message->error_line = error_line.text;
 
-  if (debug_output)
+  if (warn)
     fprintf (stderr, "%s", error_message->error_line);
 }
 
 static void
-message_list_document_error_internal (ERROR_MESSAGE_LIST *error_messages,
-                                      OPTIONS *conf,
-                                      enum error_type type, int continuation,
-                                      const char *format, va_list v)
+message_list_line_error_internal (ERROR_MESSAGE_LIST *error_messages,
+                                  enum error_type type, int continuation,
+                                  const SOURCE_INFO *cmd_source_info,
+                                  const char *format, va_list v)
 {
   char *message;
-  TEXT error_line;
-  ERROR_MESSAGE *error_message;
 
 #ifdef ENABLE_NLS
   xvasprintf (&message, gettext(format), v);
 #else
   xvasprintf (&message, format, v);
 #endif
+
   if (!message) fatal ("vasprintf failed");
 
+  message_list_line_formatted_message (error_messages,
+                             type, continuation,
+                             cmd_source_info, message, debug_output);
+}
+
+void
+message_list_document_formatted_message (ERROR_MESSAGE_LIST *error_messages,
+                                         OPTIONS *conf,
+                                         enum error_type type, int 
continuation,
+                                         char *message)
+{
+  TEXT error_line;
+  ERROR_MESSAGE *error_message;
+
   error_message = reallocate_error_messages (error_messages);
 
   error_message->message = message;
@@ -212,6 +218,25 @@ message_list_document_error_internal (ERROR_MESSAGE_LIST 
*error_messages,
     fprintf (stderr, "%s", error_message->error_line);
 }
 
+static void
+message_list_document_error_internal (ERROR_MESSAGE_LIST *error_messages,
+                                      OPTIONS *conf,
+                                      enum error_type type, int continuation,
+                                      const char *format, va_list v)
+{
+  char *message;
+
+#ifdef ENABLE_NLS
+  xvasprintf (&message, gettext(format), v);
+#else
+  xvasprintf (&message, format, v);
+#endif
+  if (!message) fatal ("vasprintf failed");
+
+  message_list_document_formatted_message (error_messages, conf, type,
+                                            continuation, message);
+}
+
 static void
 line_error_internal (enum error_type type, int continuation,
                      const SOURCE_INFO *cmd_source_info,
diff --git a/tp/Texinfo/XS/main/errors.h b/tp/Texinfo/XS/main/errors.h
index 3f14994726..6861c3ac29 100644
--- a/tp/Texinfo/XS/main/errors.h
+++ b/tp/Texinfo/XS/main/errors.h
@@ -21,6 +21,10 @@ char *prepare_error_line_message (ERROR_MESSAGE 
*error_message);
 
 void wipe_error_message_list (ERROR_MESSAGE_LIST *error_messages);
 void clear_error_message_list (ERROR_MESSAGE_LIST *error_messages);
+void message_list_line_formatted_message (ERROR_MESSAGE_LIST *error_messages,
+                           enum error_type type, int continuation,
+                           const SOURCE_INFO *cmd_source_info,
+                           char *message, int warn);
 void message_list_line_error_ext (ERROR_MESSAGE_LIST *error_messages,
                                 enum error_type type, int continuation,
                      SOURCE_INFO *cmd_source_info, const char *format, ...);
@@ -29,6 +33,10 @@ void message_list_command_error (ERROR_MESSAGE_LIST 
*error_messages,
 void message_list_command_warn (ERROR_MESSAGE_LIST *error_messages,
                                 const ELEMENT *e, const char *format, ...);
 
+void message_list_document_formatted_message (ERROR_MESSAGE_LIST 
*error_messages,
+                                         OPTIONS *conf,
+                                         enum error_type type, int 
continuation,
+                                         char *message);
 void message_list_document_error (ERROR_MESSAGE_LIST *error_messages,
                                   OPTIONS *conf,
                                   const char *format, ...);
diff --git a/tp/Texinfo/XS/main/get_perl_info.c 
b/tp/Texinfo/XS/main/get_perl_info.c
index 6dbd57d23d..94811e5687 100644
--- a/tp/Texinfo/XS/main/get_perl_info.c
+++ b/tp/Texinfo/XS/main/get_perl_info.c
@@ -43,6 +43,7 @@ FIXME add an initialization of translations?
 #include "converter_types.h"
 #include "utils.h"
 #include "builtin_commands.h"
+#include "errors.h"
 #include "document.h"
 #include "output_unit.h"
 #include "convert_to_text.h"
@@ -61,7 +62,7 @@ get_document_or_warn (SV *sv_in, char *key, char *warn_string)
 
   hv_in = (HV *)SvRV (sv_in);
   document_descriptor_sv = hv_fetch (hv_in, key, strlen (key), 0);
-  if (document_descriptor_sv)
+  if (document_descriptor_sv && SvOK (*document_descriptor_sv))
     {
       document_descriptor = SvIV (*document_descriptor_sv);
       document = retrieve_document (document_descriptor);
@@ -193,6 +194,67 @@ add_svav_to_string_list (SV *sv, STRING_LIST *string_list, 
enum sv_string_type t
     }
 }
 
+#define FETCH(key) key##_sv = hv_fetch (hv_in, #key, strlen(#key), 0);
+SOURCE_INFO *
+get_source_info (SV *source_info_sv)
+{
+  HV *hv_in;
+  SV **macro_sv;
+  SV **file_name_sv;
+  SV **line_nr_sv;
+
+  dTHX;
+
+  hv_in = (HV *)SvRV (source_info_sv);
+
+  SOURCE_INFO *source_info = (SOURCE_INFO *) malloc (sizeof (SOURCE_INFO));
+  memset (source_info, 0, sizeof (SOURCE_INFO));
+
+  FETCH(macro)
+
+  if (macro_sv)
+    {
+      char *macro = (char *) SvPVutf8_nolen (*macro_sv);
+      if (strlen (macro))
+        source_info->macro = strdup (macro);
+    }
+
+  FETCH(file_name)
+
+  if (file_name_sv && SvOK (*file_name_sv))
+    {
+      char *file_name = (char *) SvPVutf8_nolen (*file_name_sv);
+      if (strlen (file_name))
+        source_info->file_name = strdup (file_name);
+    }
+
+  FETCH(line_nr)
+
+  if (line_nr_sv)
+    source_info->line_nr = SvIV (*line_nr_sv);
+
+  return source_info;
+}
+#undef FETCH
+
+void
+get_line_message (CONVERTER *self, enum error_type type, int continuation,
+                  SV *error_location_info, char *message, int silent)
+{
+  int do_warn = (self->conf->DEBUG > 1 && !silent);
+  SOURCE_INFO *source_info = get_source_info (error_location_info);
+  message_list_line_formatted_message (&self->error_messages,
+                                       type, continuation, source_info,
+                                       message, do_warn);
+  if (source_info->file_name)
+    add_string (source_info->file_name, self->document->small_strings);
+
+  if (source_info->macro)
+    add_string (source_info->macro, self->document->small_strings);
+
+  free (source_info);
+}
+
 /* contains get_sv_option (), automatically generated from options_data.txt */
 #include "options_get_perl.c"
 
@@ -343,23 +405,64 @@ set_translated_commands (CONVERTER *converter, HV *hv_in)
     }
 }
 
-#define FETCH(key) key##_sv = hv_fetch (hv_in, #key, strlen(#key), 0);
-void
-converter_initialize (SV *converter_sv, CONVERTER *converter)
+/* Texinfo::Convert::Converter generic initialization for all the converters */
+int
+converter_initialize (SV *converter_sv)
 {
   HV *hv_in;
   SV **conf_sv;
   SV **converter_init_conf_sv;
   SV **output_format_sv;
   DOCUMENT *document;
+  int converter_descriptor = 0;
+  CONVERTER *converter;
 
   dTHX;
 
+  converter_descriptor = new_converter ();
+  converter = retrieve_converter (converter_descriptor);
+
   hv_in = (HV *)SvRV (converter_sv);
 
   document = get_sv_document_document (converter_sv, 0);
+  if (!document)
+    {
+      /* happens in tests for PlainTexinfo for example */
+      unregister_converter_descriptor (converter_descriptor);
+      return 0;
+      /*
+      I32 hv_number;
+      I32 i;
+      hv_number = hv_iterinit (hv_in);
+      fprintf (stderr, "REMARK: no document for SV %p HV %p\n", converter_sv,
+                       hv_in);
+      for (i = 0; i < hv_number; i++)
+        {
+          char *key;
+          I32 retlen;
+          SV *value = hv_iternextsv(hv_in, &key, &retlen);
+          if (value && SvOK (value))
+            {
+              fprintf (stderr, "  %s: %p\n", key, value);
+            }
+        }
+       */
+    }
   converter->document = document;
 
+#define FETCH(key) key##_sv = hv_fetch (hv_in, #key, strlen(#key), 0);
+  FETCH(output_format)
+
+  if (output_format_sv && SvOK (*output_format_sv))
+    {
+      converter->output_format
+         = strdup (SvPVutf8_nolen (*output_format_sv));
+    }
+
+   /*
+  fprintf (stderr, "XS|CONVERTER Init: %d; doc %d; %s\n", converter_descriptor,
+                   converter->document->descriptor, converter->output_format);
+    */
   FETCH(conf)
 
   if (conf_sv && SvOK (*conf_sv))
@@ -376,17 +479,18 @@ converter_initialize (SV *converter_sv, CONVERTER 
*converter)
          = copy_sv_options (*converter_init_conf_sv, converter);
     }
 
-  FETCH(output_format)
-
-  if (output_format_sv && SvOK (*output_format_sv))
-    {
-      converter->output_format
-         = strdup (SvPVutf8_nolen (*output_format_sv));
-    }
-
   set_translated_commands (converter, hv_in);
 
   get_expanded_formats (hv_in, &converter->expanded_formats);
+
+  converter->hv = hv_in;
+
+  /* store converter_descriptor in perl converter */
+  hv_store (hv_in, "converter_descriptor",
+            strlen("converter_descriptor"),
+            newSViv (converter_descriptor), 0);
+
+  return converter_descriptor;
 }
 
 /* initialize an XS converter from a perl converter right before conversion */
@@ -785,7 +889,7 @@ html_get_button_specification_list (CONVERTER *converter, 
SV *buttons_sv)
   result->list = (BUTTON_SPECIFICATION *)
     malloc (result->number * sizeof (BUTTON_SPECIFICATION));
   memset (result->list, 0, result->number * sizeof (BUTTON_SPECIFICATION));
- 
+
   for (i = 0; i < buttons_nr; i++)
     {
       SV** button_sv = av_fetch (buttons_av, i, 0);
diff --git a/tp/Texinfo/XS/main/get_perl_info.h 
b/tp/Texinfo/XS/main/get_perl_info.h
index 23470848ca..12ca923495 100644
--- a/tp/Texinfo/XS/main/get_perl_info.h
+++ b/tp/Texinfo/XS/main/get_perl_info.h
@@ -26,13 +26,16 @@ int get_sv_output_units_descriptor (SV *output_units_in, 
char *warn_string);
 void add_svav_to_string_list (SV *sv, STRING_LIST *string_list,
                               enum sv_string_type type);
 
+SOURCE_INFO *get_source_info (SV *source_info_sv);
+void get_line_message (CONVERTER *self, enum error_type type, int continuation,
+                      SV *error_location_info, char *message, int silent);
 OPTIONS *copy_sv_options (SV *sv_in, CONVERTER *converter);
 void set_conf (CONVERTER *converter, const char *conf, SV *value);
 
 CONVERTER *set_output_converter_sv (SV *sv_in, char *warn_string);
 CONVERTER *get_sv_converter (SV *sv_in, char *warn_string);
 
-void converter_initialize (SV *converter_sv, CONVERTER *converter);
+int converter_initialize (SV *converter_sv);
 
 INDEX_SORTED_BY_LETTER *get_sv_index_entries_sorted_by_letter
                  (INDEX **index_names, SV *index_entries_sorted_by_letter);
diff --git a/tp/ext/epub3.pm b/tp/ext/epub3.pm
index e7ccabf67d..a9076f2689 100644
--- a/tp/ext/epub3.pm
+++ b/tp/ext/epub3.pm
@@ -288,7 +288,7 @@ sub epub_convert_image_command($$$$)
     $epub_file_nr += 1;
     if (defined($image_file)) {
       if (not defined($image_path)) {
-        $self->document_error($self,
+        $self->converter_document_error(
               sprintf(__("\@image file `%s' can not be copied"),
                      $image_basefile));
       } else {
@@ -300,7 +300,7 @@ sub epub_convert_image_command($$$$)
         my $error_creating_dir;
         if (! -d $encoded_images_destination_dir) {
           if (!mkdir($encoded_images_destination_dir, oct(755))) {
-            $self->document_error($self, sprintf(__(
+            $self->converter_document_error(sprintf(__(
                              "could not create images directory `%s': %s"),
                                          $images_destination_dir, $!));
             $error_creating_dir = 1;
@@ -320,7 +320,7 @@ sub epub_convert_image_command($$$$)
             } else {
               $image_path_text = $image_path;
             }
-            $self->document_error($self, sprintf(__(
+            $self->converter_document_error(sprintf(__(
                      "could not copy `%s' to `%s': %s"),
                         $image_path_text, $image_destination_path_name, $!));
           }
@@ -400,12 +400,12 @@ sub _epub_remove_container_folder($$)
     for my $diag (@$err_remove_tree) {
       my ($file, $message) = %$diag;
       if ($file eq '') {
-        $self->document_error($self,
+        $self->converter_document_error(
            sprintf(__("error removing directory: %s: %s"),
                    $epub_destination_directory, $message));
       }
       else {
-        $self->document_error($self,
+        $self->converter_document_error(
           sprintf(__("error removing directory: %s: unlinking %s: %s"),
                   $epub_destination_directory, $file, $message));
       }
@@ -447,7 +447,7 @@ sub epub_setup($)
 
   if ($self->get_conf('EPUB_CREATE_CONTAINER_FILE')
       and $archive_zip_loading_error) {
-    $self->document_error($self,
+    $self->converter_document_error(
        __("Archive::Zip is required for EPUB file output"));
     return 150;
   }
@@ -542,12 +542,12 @@ sub epub_setup($)
     for my $diag (@$err_make_path) {
       my ($file, $message) = %$diag;
       if ($file eq '') {
-        $self->document_error($self,
+        $self->converter_document_error(
            sprintf(__("error creating directory: %s: %s"),
                   $epub_document_destination_directory, $message));
       }
       else {
-        $self->document_error($self,
+        $self->converter_document_error(
           sprintf(__("error creating directory: %s: creating %s: %s"),
                  $epub_document_destination_directory, $file, $message));
       }
@@ -572,8 +572,7 @@ sub epub_finish($$)
     if (defined($self->{'current_filename'})) {
       push @epub_output_filenames, $self->{'current_filename'};
     } else {
-      $self->document_warn($self,
-        __("epub: no filename output"));
+      $self->converter_document_warn(__("epub: no filename output"));
     }
   }
 
@@ -583,7 +582,7 @@ sub epub_finish($$)
   my ($encoded_meta_inf_directory, $meta_inf_directory_encoding)
     = $self->encoded_output_file_name($meta_inf_directory);
   if (!mkdir($encoded_meta_inf_directory, oct(755))) {
-    $self->document_error($self, sprintf(__(
+    $self->converter_document_error(sprintf(__(
                    "could not create meta informations directory `%s': %s"),
                                          $meta_inf_directory, $!));
     return 1;
@@ -597,7 +596,7 @@ sub epub_finish($$)
                           $self->output_files_information(), $self,
                           $encoded_container_file_path_name, undef, 'utf-8');
   if (!defined($container_fh)) {
-    $self->document_error($self,
+    $self->converter_document_error(
          sprintf(__("epub3.pm: could not open %s for writing: %s\n"),
                   $container_file_path_name, $error_message_container));
     return 1;
@@ -617,7 +616,7 @@ EOT
   Texinfo::Common::output_files_register_closed(
     $self->output_files_information(), $encoded_container_file_path_name);
   if (!close ($container_fh)) {
-    $self->document_error($self,
+    $self->converter_document_error(
          sprintf(__("epub3.pm: error on closing %s: %s"),
                           $container_file_path_name, $!));
     return 1;
@@ -633,7 +632,7 @@ EOT
                         $self->output_files_information(), $self,
                         $encoded_mimetype_file_path_name, undef, 'utf-8');
   if (!defined($mimetype_fh)) {
-    $self->document_error($self,
+    $self->converter_document_error(
          sprintf(__("epub3.pm: could not open %s for writing: %s\n"),
                   $mimetype_file_path_name, $error_message_mimetype));
     return 1;
@@ -645,7 +644,7 @@ EOT
   Texinfo::Common::output_files_register_closed(
     $self->output_files_information(), $encoded_mimetype_file_path_name);
   if (!close ($mimetype_fh)) {
-    $self->document_error($self,
+    $self->converter_document_error(
          sprintf(__("epub3.pm: error on closing %s: %s"),
                           $mimetype_file_path_name, $!));
     return 1;
@@ -663,7 +662,7 @@ EOT
                        $self->output_files_information(), $self,
                        $encoded_nav_file_path_name, undef, 'utf-8');
     if (!defined($nav_fh)) {
-      $self->document_error($self,
+      $self->converter_document_error(
            sprintf(__("epub3.pm: could not open %s for writing: %s\n"),
                     $nav_file_path_name, $error_message_nav));
       return 1;
@@ -744,7 +743,7 @@ EOT
     Texinfo::Common::output_files_register_closed(
       $self->output_files_information(), $encoded_nav_file_path_name);
     if (!close ($nav_fh)) {
-      $self->document_error($self,
+      $self->converter_document_error(
            sprintf(__("epub3.pm: error on closing %s: %s"),
                             $nav_file_path_name, $!));
       return 1;
@@ -774,7 +773,7 @@ EOT
                    $self->output_files_information(), $self,
                    $encoded_opf_file_path_name, undef, 'utf-8');
   if (!defined($opf_fh)) {
-    $self->document_error($self,
+    $self->converter_document_error(
          sprintf(__("epub3.pm: could not open %s for writing: %s\n"),
                   $opf_file_path_name, $error_message_opf));
     return 1;
@@ -875,7 +874,7 @@ EOT
                                     $epub_document_dir_name, 
$epub_info_js_dir_name);
     my $opendir_success = opendir(JSPATH, $info_js_destination_dir);
     if (not $opendir_success) {
-      $self->document_error($self,
+      $self->converter_document_error(
            sprintf(__("epub3.pm: readdir %s error: %s"),
                           $info_js_destination_dir, $!));
     } else {
@@ -923,7 +922,7 @@ EOT
   Texinfo::Common::output_files_register_closed(
     $self->output_files_information(), $encoded_opf_file_path_name);
   if (!close ($opf_fh)) {
-    $self->document_error($self,
+    $self->converter_document_error(
          sprintf(__("epub3.pm: error on closing %s: %s"),
                           $opf_file_path_name, $!));
     return 1;
@@ -943,7 +942,7 @@ EOT
       = $zip->addFile($encoded_mimetype_file_path_name, $mimetype_filename,
                       Archive::Zip->COMPRESSION_LEVEL_NONE);
     if (not(defined($mimetype_added))) {
-      $self->document_error($self,
+      $self->converter_document_error(
         sprintf(__("epub3.pm: error adding %s to archive"),
                $mimetype_file_path_name));
       return 1;
@@ -952,7 +951,7 @@ EOT
     my $meta_inf_directory_ret_code
       = $zip->addTree($encoded_meta_inf_directory, $meta_inf_directory_name);
     if ($meta_inf_directory_ret_code != Archive::Zip->AZ_OK) {
-      $self->document_error($self,
+      $self->converter_document_error(
         sprintf(__("epub3.pm: error adding %s to archive"),
                $meta_inf_directory));
       return 1;
@@ -965,7 +964,7 @@ EOT
     my $epub_document_dir_name_ret_code
       = $zip->addTree($encoded_epub_document_dir_path, 
$epub_document_dir_name);
     if ($epub_document_dir_name_ret_code != Archive::Zip->AZ_OK) {
-      $self->document_error($self,
+      $self->converter_document_error(
         sprintf(__("epub3.pm: error adding %s to archive"),
                $epub_document_dir_path));
       return 1;
@@ -974,7 +973,7 @@ EOT
     my ($encoded_epub_outfile, $epub_outfile_encoding)
       = $self->encoded_output_file_name($epub_outfile);
     unless ($zip->writeToFileNamed($encoded_epub_outfile) == 
Archive::Zip->AZ_OK) {
-      $self->document_error($self,
+      $self->converter_document_error(
            sprintf(__("epub3.pm: error writing archive %s"),
                    $epub_outfile));
       return 1;
diff --git a/tp/ext/highlight_syntax.pm b/tp/ext/highlight_syntax.pm
index 7c381414bc..2f48b18af5 100644
--- a/tp/ext/highlight_syntax.pm
+++ b/tp/ext/highlight_syntax.pm
@@ -109,13 +109,13 @@ sub highlight_setup($$)
         #warn "$message";
         # not sure why, but this does not work, the warning is not actually
         # registered, as if it was done in a scope that is later destroyed.
-        #$self->document_warn($self, sprintf(__('%s: %s'), $cmd, $message));
+        #$self->converter_document_warn(sprintf(__('%s: %s'), $cmd, $message));
       };
 
   my $status = open(HIGHLIGHT_LANG_LIST, '-|', $cmd);
   $SIG{__WARN__} = undef;
   if (not($status)) {
-    $self->document_error($self, sprintf(__('%s: %s'), $cmd, $!));
+    $self->converter_document_error(sprintf(__('%s: %s'), $cmd, $!));
     return 1;
   }
 
@@ -157,7 +157,7 @@ sub highlight_setup($$)
       if ($line =~ /^\* (.+):$/) {
         my @languages = split (/, /, $1);
         if (scalar(@languages) == 0) {
-          $self->document_warn($self, sprintf(__(
+          $self->converter_document_warn(sprintf(__(
                         '%s: %s: cannot parse language line'), $cmd, $line))
         } else {
           my $main_language = shift @languages;
@@ -179,7 +179,7 @@ sub highlight_setup($$)
         my $language = $1;
         $highlighted_languages_list{$language} = 1;
       } else {
-        $self->document_warn($self, sprintf(__(
+        $self->converter_document_warn(sprintf(__(
                         '%s: %s: cannot parse language line'), $cmd, $line))
       }
     }
@@ -190,7 +190,7 @@ sub highlight_setup($$)
   if (scalar(keys(%highlighted_languages_list)) == 0) {
     # important if $cmd returns no output to have a message.  If there
     # is some output, there will already be some line parse error messages.
-    $self->document_warn($self, sprintf(__(
+    $self->converter_document_warn(sprintf(__(
                             '%s: no highlighted language found'), $cmd));
     # the remaining will be skipped, but no error is returned
   }
@@ -349,7 +349,7 @@ sub highlight_process($$)
         }
         my $pid = IPC::Open3::open3($wtr, $rdr, $err, $cmd);
         if (! $pid) {
-          $self->document_error($self, sprintf(__('%s: %s'), $cmd, $!));
+          $self->converter_document_error(sprintf(__('%s: %s'), $cmd, $!));
           return 1;
         }
         binmode($wtr, ':utf8');
@@ -358,7 +358,7 @@ sub highlight_process($$)
         binmode($err, ':utf8');
         print $wtr $text;
         if (!close($wtr)) {
-          $self->document_error($self,
+          $self->converter_document_error(
             sprintf(__('%s: error closing input: %s'), $cmd, $!));
           close ($rdr);
           close ($err);
@@ -369,22 +369,22 @@ sub highlight_process($$)
         my @errlines = <$err>;
         my $status = 0;
         if (!close($rdr)) {
-          $self->document_error($self,
+          $self->converter_document_error(
             sprintf(__('%s: error closing output: %s'), $cmd, $!));
           $status = 1;
         }
         if (!close($err)) {
-          $self->document_error($self,
+          $self->converter_document_error(
             sprintf(__('%s: error closing errors: %s'), $cmd, $!));
           $status = 1;
         }
         waitpid($pid, 0);
         if (@errlines) {
           $status = 1;
-          $self->document_error($self, sprintf(__('%s: errors: %s'),
+          $self->converter_document_error(sprintf(__('%s: errors: %s'),
                                                $cmd, shift @errlines));
           foreach my $error_line (@errlines) {
-            $self->document_error($self, sprintf(__('  %s'), $error_line), 1);
+            $self->converter_document_error(sprintf(__('  %s'), $error_line), 
1);
           }
         }
         return 1 if ($status);
@@ -419,7 +419,7 @@ sub highlight_process($$)
     my ($encoded_input_language_path_name, $input_language_path_encoding)
       = $self->encoded_output_file_name($input_language_path_name);
     unless (open (HIGHLIGHT_LANG_IN, ">$encoded_input_language_path_name")) {
-      $self->document_warn($self,
+      $self->converter_document_warn(
              sprintf(__("highlight_syntax.pm: could not open %s: %s"),
                                       $input_language_path_name, $!));
       return 1;
@@ -449,7 +449,7 @@ sub highlight_process($$)
       $counter ++;
     }
     if (! close(HIGHLIGHT_LANG_IN)) {
-      $self->document_warn($self,
+      $self->converter_document_warn(
              sprintf(__("highlight_syntax.pm: error on closing %s: %s"),
                                       $input_language_path_name, $!));
       return 1;
@@ -478,7 +478,7 @@ sub highlight_process($$)
       $encoded_cmd = $cmd;
     }
     if (system($encoded_cmd)) {
-      $self->document_error($self,
+      $self->converter_document_error(
           sprintf(__("highlight_syntax.pm: command did not succeed: %s"),
                                   $cmd));
       return 1;
@@ -489,7 +489,7 @@ sub highlight_process($$)
     my ($encoded_html_result_path_name, $html_result_path_encoding)
       = $self->encoded_output_file_name($html_result_path_name);
     unless (open(HIGHLIGHT_LANG_OUT, $encoded_html_result_path_name)) {
-      $self->document_warn($self,
+      $self->converter_document_warn(
          sprintf(__("highlight_syntax.pm: could not open %s: %s"),
                                   $html_result_path_name, $!));
       return 1;
@@ -525,7 +525,7 @@ sub highlight_process($$)
       }
     }
     if ($separators_count != $language_fragments_nr +1) {
-      $self->document_warn($self, sprintf(__(
+      $self->converter_document_warn(sprintf(__(
        "highlight_syntax.pm: %s: %d separators; expected %d, the number of 
fragments +1"),
                       $language, $separators_count, $language_fragments_nr+1));
     }
@@ -533,7 +533,7 @@ sub highlight_process($$)
       my $element_command = 
$languages{$language}->{'commands'}->[$got_count-1];
       my $element = $element_command->[0];
       my $cmdname = $element_command->[1];
-      $self->document_warn($self, sprintf(__(
+      $self->converter_document_warn(sprintf(__(
                  "highlight_syntax.pm: %s: end of \@%s item %d not found"),
                                   $language, $cmdname, $got_count));
     }
@@ -542,12 +542,12 @@ sub highlight_process($$)
     # it is useless, and even if there were other commands, the failure is
     # for a language, not a command, so it should not be needed either.
     if ($got_count != $languages{$language}->{'counter'}) {
-      $self->document_warn($self, sprintf(__(
+      $self->converter_document_warn(sprintf(__(
          "highlight_syntax.pm: %s: retrieved %d items in HTML; expected %d"),
                             $language, $got_count, $language_fragments_nr));
     }
     if (!close (HIGHLIGHT_LANG_OUT)) {
-      $self->document_warn($self,
+      $self->converter_document_warn(
              sprintf(__("highlight_syntax.pm: error on closing %s: %s"),
                                       $html_result_path_name, $!));
     }
@@ -611,7 +611,7 @@ sub highlight_preformatted_command($$$$$)
         and defined($commands{$cmdname}->{'results'}->{$command})) {
 
       if (not defined($language)) {
-        $self->document_warn($self, sprintf(__(
+        $self->converter_document_warn(sprintf(__(
        "highlight_syntax.pm: output has HTML item for \@%s but no language 
%s"),
                                     $cmdname, $command));
       } else {
@@ -699,7 +699,7 @@ sub highlight_preformatted_command($$$$$)
       # was processed without failure.
       # If they are not equal there should have been a message already.
       if ($cmd_language_input_count == $cmd_language_retrieved_count) {
-        $self->document_warn($self, sprintf(__(
+        $self->converter_document_warn(sprintf(__(
                 "highlight_syntax.pm: output has no HTML item for \@%s %s %s"),
                                     $cmdname, $language, $command));
       } elsif ($self->get_conf('VERBOSE') or $self->get_conf('DEBUG')) {
diff --git a/tp/ext/latex2html.pm b/tp/ext/latex2html.pm
index ac66b15df9..e7829a1deb 100644
--- a/tp/ext/latex2html.pm
+++ b/tp/ext/latex2html.pm
@@ -119,7 +119,7 @@ sub l2h_to_latex($$$$$)
   my $latex_texts = shift;
 
   unless (open(L2H_LATEX, ">$l2h_latex_path_string")) {
-    $self->document_error($self, sprintf(__(
+    $self->converter_document_error(sprintf(__(
           "l2h: could not open latex file %s for writing: %s"),
                                   $l2h_latex_path_name, $!));
     return 0;
@@ -359,7 +359,7 @@ sub l2h_process($$)
       if ($latex_converted_count != $html_converted_count) {
         # unless latex2html somewhat mangles the output this cannot
         # actually happen, so it could also be presented as an error or a bug.
-        $self->document_warn($self, sprintf(__(
+        $self->converter_document_warn(sprintf(__(
           "latex2html.pm: processing produced %d items in HTML; expected %d"),
                           $html_converted_count, $latex_converted_count));
       }
@@ -397,13 +397,13 @@ sub l2h_to_html($$$)
   # Check for dot in directory where dvips will work
   if ($self->get_conf('L2H_TMP')) {
     if ($self->get_conf('L2H_TMP') =~ /\./) {
-      $self->document_warn($self,
+      $self->converter_document_warn(
         __("l2h: L2H_TMP directory contains a dot"));
       $dotbug = 1;
     }
   } else {
     if (cwd() =~ /\./) {
-      $self->document_warn($self,
+      $self->converter_document_warn(
             __("l2h: current directory contains a dot"));
       $dotbug = 1;
     }
@@ -411,7 +411,7 @@ sub l2h_to_html($$$)
 
   my $latex2html_command = $self->get_conf('L2H_L2H');
   if (not defined($latex2html_command) or $latex2html_command !~ /\S/) {
-    $self->document_error($self, __("l2h: command not set"));
+    $self->converter_document_error(__("l2h: command not set"));
     return 0;
   }
 
@@ -465,7 +465,7 @@ sub l2h_to_html($$$)
 
   warn "# l2h: executing '$encoded_call'\n" if ($verbose);
   if (system($encoded_call)) {
-    $self->document_error($self, sprintf(__("l2h: command did not succeed: 
%s"),
+    $self->converter_document_error(sprintf(__("l2h: command did not succeed: 
%s"),
                                          $call));
     return 0;
   } else  {
@@ -509,7 +509,7 @@ sub l2h_change_image_file_names($$)
         # document extension. copying the file could result in
         # overwriting an output file (almost surely if the default
         # texi2html file names are used).
-        $self->document_warn($self, sprintf(__(
+        $self->converter_document_warn(sprintf(__(
                             "l2h: image has invalid extension: %s"), $src));
         next;
       }
@@ -540,7 +540,7 @@ sub l2h_change_image_file_names($$)
         copy($encoded_file_src, $encoded_file_dest);
       } else {
         if (!rename($encoded_file_src, $encoded_file_dest)) {
-          $self->document_warn($self,
+          $self->converter_document_warn(
                  sprintf(__("l2h: rename %s as %s failed: %s"),
                                  $src_file, $file_dest, $!));
         }
@@ -566,7 +566,7 @@ sub l2h_retrieve_from_html($$)
                                                  $encoded_l2h_html_file_name);
 
   if (! open(L2H_HTML, "<$l2h_html_path_string")) {
-    $self->document_error($self,
+    $self->converter_document_error(
                 sprintf(__("l2h: could not open %s: %s"),
                                  $l2h_html_path_name, $!));
     # return empty array
@@ -600,7 +600,7 @@ sub l2h_retrieve_from_html($$)
       }
       unless ($h_end_found) {
         # couldn't found the closing comment. Should be a bug.
-        $self->document_warn($self,
+        $self->converter_document_warn(
                 sprintf(__("latex2html.pm: end of \@%s text %d not found"),
                                       $l2h_name, $latex_text_index));
         last;
@@ -680,7 +680,7 @@ sub l2h_convert_command($$$;$$)
       # it could also probably be marked as a bug (or error) as there is no
       # situation in which this could happen with the conditions on succeeding
       # conversion.
-      $self->document_warn($self, sprintf(__(
+      $self->converter_document_warn(sprintf(__(
         "l2h: could not extract the fragment %d for \@%s, text %d, from HTML"),
                    $command_count, $cmdname, $latex_text_index));
     } elsif ($verbose) {
@@ -772,16 +772,16 @@ sub l2h_init_cache($)
     my $rdo = do "$loaded_path";
     unless ($rdo) {
       # FIXME error or warning?
-      $self->document_error($self,
+      $self->converter_document_error(
                sprintf(__("l2h: could not compile %s: %s"),
                                   $l2h_cache_path_name, $@))
         if ($@);
       if (! defined($rdo)) {
-        $self->document_error($self,
+        $self->converter_document_error(
                sprintf(__("l2h: could not load %s: %s"),
                                   $l2h_cache_path_name, $!));
       } else {
-        $self->document_error($self,
+        $self->converter_document_error(
                sprintf(__("l2h: error loading %s"),
                                    $l2h_cache_path_name));
       }
@@ -801,7 +801,7 @@ sub l2h_store_cache($)
   my ($encoded_l2h_cache_path_name, $l2h_cache_path_encoding)
     = $self->encoded_output_file_name($l2h_cache_path_name);
   unless (open(FH, ">$encoded_l2h_cache_path_name")) {
-    $self->document_error($self,
+    $self->converter_document_error(
           sprintf(__("l2h: could not open %s for writing: %s"),
                                   $l2h_cache_path_name, $!));
     return;
diff --git a/tp/ext/tex4ht.pm b/tp/ext/tex4ht.pm
index 4d6fde8255..4bf568bb8a 100644
--- a/tp/ext/tex4ht.pm
+++ b/tp/ext/tex4ht.pm
@@ -118,7 +118,7 @@ sub tex4ht_prepare($$)
 
   my $math_conversion = $self->get_conf('T4H_MATH_CONVERSION');
   if (defined($math_conversion) and !$formats{$math_conversion}) {
-    $self->document_error($self,
+    $self->converter_document_error(
          sprintf(__("tex4ht.pm: unknown conversion type for math: %s"),
                                       $math_conversion));
     $math_conversion = undef;
@@ -127,7 +127,7 @@ sub tex4ht_prepare($$)
 
   my $tex_conversion = $self->get_conf('T4H_TEX_CONVERSION');
   if (defined($tex_conversion) and !$formats{$tex_conversion}) {
-    $self->document_error($self,
+    $self->converter_document_error(
          sprintf(__("tex4ht.pm: unknown conversion type for \@tex: %s"),
                                       $tex_conversion));
     $tex_conversion = undef;
@@ -136,7 +136,7 @@ sub tex4ht_prepare($$)
 
   my $latex_conversion = $self->get_conf('T4H_LATEX_CONVERSION');
   if (defined($latex_conversion) and !$formats{$latex_conversion}) {
-    $self->document_error($self,
+    $self->converter_document_error(
          sprintf(__("tex4ht.pm: unknown conversion type for \@latex: %s"),
                                       $latex_conversion));
     $latex_conversion = undef;
@@ -233,7 +233,7 @@ sub tex4ht_prepare($$)
         if ($formats{$format}->{'counter'} == 0) {
           local *TEX4HT_TEXFILE;
           unless (open(*TEX4HT_TEXFILE, ">$encoded_tex4ht_file_path_name")) {
-            $self->document_error($self,
+            $self->converter_document_error(
                     sprintf(__("tex4ht.pm: could not open %s: %s"),
                                           $tex4ht_file_path_name, $!));
             return 1;
@@ -338,7 +338,7 @@ sub tex4ht_process($)
   my ($encoded_tex4ht_out_dir, $tex4ht_out_dir_encoding)
     = $self->encoded_output_file_name($tex4ht_out_dir);
   unless (chdir $encoded_tex4ht_out_dir) {
-    $self->document_warn($self,
+    $self->converter_document_warn(
             sprintf(__("tex4ht.pm: chdir %s failed: %s"),
                          $tex4ht_out_dir, $!));
     return 1;
@@ -352,7 +352,7 @@ sub tex4ht_process($)
     $errors += tex4ht_process_format($self, $format);
   }
   unless (chdir $tex4ht_initial_dir) {
-    $self->document_warn($self, sprintf(__(
+    $self->converter_document_warn(sprintf(__(
           "tex4ht.pm: unable to return to initial directory: %s"), $!));
     return 1 + $errors;
   }
@@ -366,7 +366,7 @@ sub tex4ht_process_format($$) {
 
   return 0 unless ($formats{$format}->{'counter'});
 
-  $self->document_warn($self,
+  $self->converter_document_warn(
               sprintf(__("tex4ht.pm: output file missing: %s"),
                                $formats{$format}->{'basefile_name'}))
     unless (-f $formats{$format}->{'basefile_path'});
@@ -401,12 +401,12 @@ sub tex4ht_process_format($$) {
   # if tex fails, it will read from STDIN and the input may trigger
   # diverse actions by tex.
   if (not(open(TEX4HT, "|-", $encoded_cmd))) {
-    $self->document_error($self, sprintf(__(
+    $self->converter_document_error(sprintf(__(
                          "tex4ht.pm: command failed: %s"), $cmd));
     return 1;
   }
   if (!close(TEX4HT)) {
-    $self->document_warn($self, sprintf(__(
+    $self->converter_document_warn(sprintf(__(
                          "tex4ht.pm: closing communication failed: %s: %s"),
                          $cmd, $!));
     return 1;
@@ -419,7 +419,7 @@ sub tex4ht_process_format($$) {
   my $html_basefile = $formats{$format}->{'html_basefile_name'};
   my $encoded_html_basefile = $formats{$format}->{'html_basefile_path'};
   unless (open(TEX4HT_HTMLFILE, $encoded_html_basefile)) {
-    $self->document_warn($self,
+    $self->converter_document_warn(
               sprintf(__("tex4ht.pm: could not open %s: %s"),
                                   $html_basefile, $!));
     return 1;
@@ -455,7 +455,7 @@ sub tex4ht_process_format($$) {
       }
       unless ($end_found) {
         # should be a bug or mangled output
-        $self->document_warn($self, sprintf(__(
+        $self->converter_document_warn(sprintf(__(
                                "tex4ht.pm: end of %s item %d for \@%s not 
found"),
                                       $format, $count, $cmdname));
       }
@@ -464,7 +464,7 @@ sub tex4ht_process_format($$) {
   if ($got_count != $formats{$format}->{'counter'}) {
     # unless tex4ht somehow mangles the output, this should
     # never happen, could also be considered as en error or a bug.
-    $self->document_warn($self, sprintf(__(
+    $self->converter_document_warn(sprintf(__(
        "tex4ht.pm: processing produced %d items in HTML; expected %d for 
format %s"),
                                  $got_count, $formats{$format}->{'counter'},
                                  $format));
@@ -499,7 +499,7 @@ sub tex4ht_convert_command($$$;$$)
   } else {
     # probably a bug in that case, unless the format is ignored
     if ($self->is_format_expanded($cmdname)) {
-      $self->document_warn($self, sprintf(__(
+      $self->converter_document_warn(sprintf(__(
                        "tex4ht.pm: output has no HTML item for \@%s %s"),
                                   $cmdname, $command));
     }
@@ -516,7 +516,7 @@ sub tex4ht_finish($)
     foreach my $command (sort(keys(%commands))) {
       if (not defined($commands{$command}->{'output_counter'})) {
         if (defined($commands{$command}->{'counter'})) {
-          $self->document_warn($self, sprintf(__(
+          $self->converter_document_warn(sprintf(__(
            "tex4ht.pm: output counter UNDEF; expected %d for \@%s"),
                                  $commands{$command}->{'counter'}, $command));
         } else {
diff --git a/tp/init/chm.pm b/tp/init/chm.pm
index 1214ce0042..7e7ad5cda1 100644
--- a/tp/init/chm.pm
+++ b/tp/init/chm.pm
@@ -226,7 +226,7 @@ sub chm_init($)
                       $self->output_files_information(), $self,
                       $encoded_hhk_file_path_name);
   if (!defined($hhk_fh)) {
-    $self->document_error($self,
+    $self->converter_document_error(
          sprintf(__("chm.pm: could not open %s for writing: %s\n"),
                   $hhk_file_path_name, $hhk_error_message));
     return 1;
@@ -244,7 +244,7 @@ sub chm_init($)
   print $hhk_fh "</OBJECT>\n";
 
   my ($index_entries, $index_entries_sort_strings)
-       = Texinfo::Structuring::sort_indices_by_index($self, $self,
+       = Texinfo::Structuring::sort_indices_by_index(undef, $self,
                              $self->get_info('index_entries'),
                              $self->get_info('indices_information'));
   if ($index_entries) {
@@ -278,7 +278,7 @@ sub chm_init($)
   Texinfo::Common::output_files_register_closed(
     $self->output_files_information(), $encoded_hhk_file_path_name);
   if (!close ($hhk_fh)) {
-    $self->document_error($self,
+    $self->converter_document_error(
            sprintf(__("chm.pm: error on closing %s: %s"),
                           $hhk_file_path_name, $!));
     return 1;
@@ -292,7 +292,7 @@ sub chm_init($)
                       $self->output_files_information(), $self,
                       $encoded_hhc_file_path_name);
   if (!defined($hhc_fh)) {
-    $self->document_error($self,
+    $self->converter_document_error(
          sprintf(__("chm.pm: could not open %s for writing: %s\n"),
                   $hhc_file_path_name, $hhc_error_message));
     return 1;
@@ -359,7 +359,7 @@ sub chm_init($)
   Texinfo::Common::output_files_register_closed(
     $self->output_files_information(), $encoded_hhc_file_path_name);
   if (!close ($hhc_fh)) {
-    $self->document_error($self,
+    $self->converter_document_error(
            sprintf(__("chm.pm: error on closing %s: %s"),
                           $hhc_file_path_name, $!));
     return 1;
@@ -373,7 +373,7 @@ sub chm_init($)
                       $self->output_files_information(), $self,
                       $encoded_hhp_file_path_name);
   if (!defined($hhp_fh)) {
-    $self->document_error(
+    $self->converter_document_error(
            $self, sprintf(__("chm.pm: could not open %s for writing: %s\n"),
                   $hhp_file_path_name, $hhp_error_message));
     return 1;
@@ -425,7 +425,7 @@ EOT
   Texinfo::Common::output_files_register_closed(
     $self->output_files_information(), $encoded_hhp_file_path_name);
   if (!close ($hhp_fh)) {
-    $self->document_error($self,
+    $self->converter_document_error(
          sprintf(__("chm.pm: error on closing %s: %s"),
                           $hhp_file_path_name, $!));
     return 1;
diff --git a/tp/t/init/redefine_need.init b/tp/t/init/redefine_need.init
index 7cd3e0ed74..2defe12c35 100644
--- a/tp/t/init/redefine_need.init
+++ b/tp/t/init/redefine_need.init
@@ -12,11 +12,11 @@ sub my_need_formatting($$$)
 
   if ($command->{'extra'} and $command->{'extra'}->{'misc_args'}
       and @{$command->{'extra'}->{'misc_args'}}) {
-    $converter->line_warn($converter,
+    $converter->converter_line_warn(
             "need has the right arg: $command->{'extra'}->{'misc_args'}->[0]",
                            $command->{'source_info'});
   } else {
-    $converter->line_warn($converter, "Bad arg for $cmdname",
+    $converter->converter_line_warn("Bad arg for $cmdname",
                           $command->{'source_info'});
   }
   my $arg_text;
diff --git a/tp/t/results/htmlxref/htmlxref.pl 
b/tp/t/results/htmlxref/htmlxref.pl
index 96d18dfe0f..8f62627573 100644
--- a/tp/t/results/htmlxref/htmlxref.pl
+++ b/tp/t/results/htmlxref/htmlxref.pl
@@ -2983,6 +2983,7 @@ $result_converted_errors{'file_html'}->{'htmlxref'} = [
 ',
     'file_name' => 'htmlxref.cnf',
     'line_nr' => 15,
+    'macro' => '',
     'text' => 'unrecognized type: foo',
     'type' => 'warning'
   },
@@ -2991,6 +2992,7 @@ $result_converted_errors{'file_html'}->{'htmlxref'} = [
 ',
     'file_name' => 'htmlxref.cnf',
     'line_nr' => 16,
+    'macro' => '',
     'text' => 'missing type',
     'type' => 'warning'
   }
diff --git a/tp/t/results/htmlxref/htmlxref_nodes.pl 
b/tp/t/results/htmlxref/htmlxref_nodes.pl
index 2148d90bc5..581bed239f 100644
--- a/tp/t/results/htmlxref/htmlxref_nodes.pl
+++ b/tp/t/results/htmlxref/htmlxref_nodes.pl
@@ -2983,6 +2983,7 @@ $result_converted_errors{'file_html'}->{'htmlxref_nodes'} 
= [
 ',
     'file_name' => 'htmlxref.cnf',
     'line_nr' => 15,
+    'macro' => '',
     'text' => 'unrecognized type: foo',
     'type' => 'warning'
   },
@@ -2991,6 +2992,7 @@ $result_converted_errors{'file_html'}->{'htmlxref_nodes'} 
= [
 ',
     'file_name' => 'htmlxref.cnf',
     'line_nr' => 16,
+    'macro' => '',
     'text' => 'missing type',
     'type' => 'warning'
   }
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index 8e8e9352e8..46f7f98d9c 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -532,6 +532,12 @@ sub convert_to_plaintext($$$$$$;$)
     close_files($converter);
     $result = undef if (defined($result) and ($result eq ''));
   }
+
+  my $converter_errors = $converter->get_converter_errors();
+  foreach my $error (@$converter_errors) {
+    $converter->add_formatted_message($error);
+  }
+
   my ($errors, $error_nrs) = $converter->errors();
   return ($errors, $result, $converter);
 }
@@ -557,6 +563,12 @@ sub convert_to_info($$$$$;$)
   my $result = $converter->output($document);
   close_files($converter);
   die if (!defined($converter_options->{'SUBDIR'}) and !defined($result));
+
+  my $converter_errors = $converter->get_converter_errors();
+  foreach my $error (@$converter_errors) {
+    $converter->add_formatted_message($error);
+  }
+
   my ($errors, $error_nrs) = $converter->errors();
   return ($errors, $result, $converter);
 }
@@ -590,10 +602,8 @@ sub convert_to_html($$$$$$;$)
   }
 
   my $converter_errors = $converter->get_converter_errors();
-  if (defined($converter_errors)) {
-    foreach my $error (@$converter_errors) {
-      $converter->add_formatted_message($error);
-    }
+  foreach my $error (@$converter_errors) {
+    $converter->add_formatted_message($error);
   }
 
   die if (!defined($converter_options->{'SUBDIR'}) and !defined($result));
@@ -628,6 +638,12 @@ sub convert_to_xml($$$$$$;$)
     close_files($converter);
     $result = undef if (defined($result) and ($result eq ''));
   }
+
+  my $converter_errors = $converter->get_converter_errors();
+  foreach my $error (@$converter_errors) {
+    $converter->add_formatted_message($error);
+  }
+
   my ($errors, $error_nrs) = $converter->errors();
   return ($errors, $result, $converter);
 }
@@ -678,6 +694,12 @@ sub convert_to_docbook($$$$$$;$)
     close_files($converter);
     $result = undef if (defined($result) and ($result eq ''));
   }
+
+  my $converter_errors = $converter->get_converter_errors();
+  foreach my $error (@$converter_errors) {
+    $converter->add_formatted_message($error);
+  }
+
   my ($errors, $error_nrs) = $converter->errors();
   return ($errors, $result, $converter);
 }
@@ -707,6 +729,12 @@ sub convert_to_latex($$$$$$;$)
     close_files($converter);
     $result = undef if (defined($result) and ($result eq ''));
   }
+
+  my $converter_errors = $converter->get_converter_errors();
+  foreach my $error (@$converter_errors) {
+    $converter->add_formatted_message($error);
+  }
+
   my ($errors, $error_nrs) = $converter->errors();
   return ($errors, $result, $converter);
 }



reply via email to

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