texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: util/txixml2texi.pl: unbuffered output if debug i


From: Patrice Dumas
Subject: branch master updated: util/txixml2texi.pl: unbuffered output if debug is set
Date: Mon, 28 Nov 2022 16:41:10 -0500

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

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new fa82472f63 util/txixml2texi.pl: unbuffered output if debug is set
fa82472f63 is described below

commit fa82472f634e15f425bc72b398e8111ae0e7ed8f
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Nov 28 22:40:23 2022 +0100

    util/txixml2texi.pl: unbuffered output if debug is set
---
 util/txixml2texi.pl | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/util/txixml2texi.pl b/util/txixml2texi.pl
index 2f06d993d1..2ae469b4a3 100755
--- a/util/txixml2texi.pl
+++ b/util/txixml2texi.pl
@@ -90,6 +90,15 @@ my $result_options = Getopt::Long::GetOptions (
  'debug|d' => \$debug,
 );
 
+# to get unbuffered output
+if ($debug) {
+  my $previous_default = select(STDOUT);  # save previous default
+  $|++;                                   # autoflush STDOUT
+  select(STDERR);
+  $|++;                                   # autoflush STDERR, to be sure
+  select($previous_default);              # restore previous default
+}
+
 sub command_with_braces($)
 {
   my $command = shift;
@@ -121,6 +130,7 @@ my %elements_end_attributes = (
 # reference which associates an attribute value to the formatted @-command
 # string.
 my %element_at_commands;
+
 # entities not associated to @-commands
 my %entity_texts = (
   'textldquo' => '``',
@@ -367,6 +377,7 @@ while ($reader->read) {
         }
       }
     } elsif ($arg_elements{$name}) {
+      # elements corresponding to @-commands arguments
       if ($reader->hasAttributes()
           and defined($reader->getAttribute('automatic'))
           and $reader->getAttribute('automatic') eq 'on') {
@@ -446,6 +457,7 @@ while ($reader->read) {
         print '{';
         print "$spaces";
       }
+      # menus 'star' and following spaces
       if (defined($reader->getAttribute('leadingtext'))) {
         print $reader->getAttribute('leadingtext');
       }
@@ -514,6 +526,8 @@ while ($reader->read) {
       print STDERR "END UNKNOWN $name\n" if ($debug);
     }
   } elsif ($reader->nodeType() eq XML_READER_TYPE_ENTITY_REFERENCE) {
+    # for some reason XML_READER_TYPE_ENTITY is never emitted
+    #       or $reader->nodeType() eq XML_READER_TYPE_ENTITY) {
     if (defined($entity_texts{$name})) {
       print $entity_texts{$name};
     }



reply via email to

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