texinfo-commits
[Top][All Lists]
Advanced

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

[7470] count_bytes method call syntax


From: gavinsmith0123
Subject: [7470] count_bytes method call syntax
Date: Tue, 25 Oct 2016 18:03:51 +0000 (UTC)

Revision: 7470
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7470
Author:   gavin
Date:     2016-10-25 18:03:51 +0000 (Tue, 25 Oct 2016)
Log Message:
-----------
count_bytes method call syntax

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tp/Texinfo/Convert/Info.pm
    trunk/tp/Texinfo/Convert/Plaintext.pm

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2016-10-23 16:20:22 UTC (rev 7469)
+++ trunk/ChangeLog     2016-10-25 18:03:51 UTC (rev 7470)
@@ -1,3 +1,9 @@
+2016-10-25  Gavin Smith  <address@hidden>
+
+       * tp/Texinfo/Convert/Plaintext.pm (count_bytes): Call throughout
+       without using method call syntax.
+       (_align_lines): Remove some commented-out lines of code.
+
 2016-10-23  Gavin Smith  <address@hidden>
 
        * tp/Texinfo/Structuring.pm (nodes_tree): If 'validatemenus' is 

Modified: trunk/tp/Texinfo/Convert/Info.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Info.pm    2016-10-23 16:20:22 UTC (rev 7469)
+++ trunk/tp/Texinfo/Convert/Info.pm    2016-10-25 18:03:51 UTC (rev 7470)
@@ -85,7 +85,7 @@
   pop @{$self->{'count_context'}};
   return undef unless $self->_create_destination_directory();
 
-  my $header_bytes = $self->count_bytes($header);
+  my $header_bytes = Texinfo::Convert::Plaintext::count_bytes($self, $header);
   my $complete_header_bytes = $header_bytes;
   my $elements = Texinfo::Structuring::split_by_node($root);
 
@@ -134,7 +134,7 @@
         $first_node = 1;
         if (defined($self->{'text_before_first_node'})) {
           $complete_header .= $self->{'text_before_first_node'};
-          $complete_header_bytes += 
$self->count_bytes($self->{'text_before_first_node'});
+          $complete_header_bytes += 
Texinfo::Convert::Plaintext::count_bytes($self, 
$self->{'text_before_first_node'});
         }
         # for the first node, header is prepended, not complete_header
         # as 'text_before_first_node' is already part of the node

Modified: trunk/tp/Texinfo/Convert/Plaintext.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Plaintext.pm       2016-10-23 16:20:22 UTC (rev 
7469)
+++ trunk/tp/Texinfo/Convert/Plaintext.pm       2016-10-25 18:03:51 UTC (rev 
7470)
@@ -1013,27 +1013,24 @@
       my $chomped = chomp($line);
       # for debugging.
       $orig_line = $line;
-      $removed_line_bytes_end -= $self->count_bytes($chomped);
-      #$line_bytes_end -= $self->count_bytes($chomped);
+      $removed_line_bytes_end -= count_bytes($self, $chomped);
       $line =~ s/^(\s*)//;
-      $removed_line_bytes_begin -= $self->count_bytes($1);
-      #$line_bytes_begin -= $self->count_bytes($1);
+      $removed_line_bytes_begin -= count_bytes($self, $1);
       $line =~ s/(\s*)$//;
-      $removed_line_bytes_end -= $self->count_bytes($1);
-      #$line_bytes_end -= $self->count_bytes($1);
+      $removed_line_bytes_end -= count_bytes($self, $1);
       my $line_width = Texinfo::Convert::Unicode::string_width($line);
       if ($line_width == 0) {
         $result .= "\n";
-        $line_bytes_end += $self->count_bytes("\n");
-        $bytes_count += $self->count_bytes("\n");
+        $line_bytes_end += count_bytes($self, "\n");
+        $bytes_count += count_bytes($self, "\n");
       } else {
         my $spaces_prepended 
          = _compute_spaces_align_line($line_width, $max_column, $direction);
         $result .= ' ' x$spaces_prepended . $line ."\n";
-        $line_bytes_begin += $self->count_bytes(' ' x$spaces_prepended);
-        $line_bytes_end += $self->count_bytes("\n");
+        $line_bytes_begin += count_bytes($self, ' ' x$spaces_prepended);
+        $line_bytes_end += count_bytes($self, "\n");
         $bytes_count += $line_bytes_begin + $line_bytes_end 
-                        + $self->count_bytes($line);
+                        + count_bytes($self, $line);
       }
     } else {
       $image_lines_count++;
@@ -1047,8 +1044,8 @@
         $prepended_spaces = 0 if ($prepended_spaces < 0);
       }
       $result .= ' ' x$prepended_spaces . $line;
-      $line_bytes_begin += $self->count_bytes(' ' x$prepended_spaces);
-      $bytes_count += $line_bytes_begin + $self->count_bytes($line);
+      $line_bytes_begin += count_bytes($self, ' ' x$prepended_spaces);
+      $bytes_count += $line_bytes_begin + count_bytes($self, $line);
       if ($new_image) {
         $image = $new_image;
         $image_prepended_spaces = $new_image_prepended_spaces;
@@ -1448,7 +1445,7 @@
   my $text = shift;
   my $chomped = chomp ($text);
   if ($chomped) {
-    $self->{'count_context'}->[-1]->{'bytes'} -= $self->count_bytes($chomped);
+    $self->{'count_context'}->[-1]->{'bytes'} -= count_bytes($self, $chomped);
     $self->{'count_context'}->[-1]->{'lines'} -= 1;
   }
   $text .= "\n";
@@ -3225,11 +3222,11 @@
             chomp($cell_text);
             if ($line eq '' and $cell_text ne '') {
               $line = ' ' x $indent_len;
-              $bytes_count += $self->count_bytes($line);
+              $bytes_count += count_bytes($self, $line);
             }
             print STDERR "  C($cell_idx) `$cell_text'\n" if ($self->{'debug'});
             $line .= $cell_text;
-            $bytes_count += $self->count_bytes($cell_text);
+            $bytes_count += count_bytes($self, $cell_text);
             $line_width += Texinfo::Convert::Unicode::string_width($cell_text);
           }
           if (defined($cell_updated_locations->[$cell_idx]->{$line_idx})) {
@@ -3243,24 +3240,24 @@
             if ($line_width < $indent_len + $cell_beginnings[$cell_idx+1]) {
               if ($line eq '') {
                 $line = ' ' x $indent_len;
-                $bytes_count += $self->count_bytes($line);
+                $bytes_count += count_bytes($self, $line);
               }
               my $spaces = ' ' x ($indent_len + $cell_beginnings[$cell_idx+1] 
- $line_width);
               $line_width += Texinfo::Convert::Unicode::string_width($spaces);
               $line .= $spaces;
-              $bytes_count += $self->count_bytes($spaces);
+              $bytes_count += count_bytes($self, $spaces);
             }
           }
         }
         $line .= "\n";
-        $bytes_count += $self->count_bytes("\n");
+        $bytes_count += count_bytes($self, "\n");
         $result .= $line;
       }
       if ($self->{'format_context'}->[-1]->{'item_command'} eq 'headitem') {
         # at this point cell_beginning is at the beginning of
         # the cell following the end of the table -> full width
         my $line = ' ' x $indent_len . '-' x $cell_beginning . "\n";
-        $bytes_count += $self->count_bytes($line);
+        $bytes_count += count_bytes($self, $line);
         $result .= $line;
         $self->{'empty_lines_count'} = 0;
         $max_lines++;




reply via email to

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