texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp/Texinfo/Convert Text.pm


From: Patrice Dumas
Subject: texinfo/tp/Texinfo/Convert Text.pm
Date: Thu, 29 Sep 2011 15:37:00 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/09/29 15:37:00

Modified files:
        tp/Texinfo/Convert: Text.pm 

Log message:
        Simplify the code of eight_bit_accents doing the first unicode 
        formatting.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Text.pm?cvsroot=texinfo&r1=1.64&r2=1.65

Patches:
Index: Text.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Text.pm,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -b -r1.64 -r1.65
--- Text.pm     29 Sep 2011 15:17:08 -0000      1.64
+++ Text.pm     29 Sep 2011 15:37:00 -0000      1.65
@@ -189,33 +189,23 @@
   if ($debug) {
     print STDERR "stack: ".join('|', map {$_->{'cmdname'}} @$stack)."\n";
   }
+
   # accents are formatted and the intermediate results are kept, such
   # that we can return the maximum of multiaccented letters that can be
-  # rendered with a given eight bit formatting.
-  my $accent = $stack->[-1];
-  my $current_result = $text;
+  # rendered with a given eight bit formatting.  undef is stored when 
+  # there is no corresponding unicode anymore.
   my @results_stack;
+  my $unicode_formatted = $text;
 
-  while (1) {
-    my $unicode_formatted_accent
-      = Texinfo::Convert::Unicode::unicode_accent($current_result, $accent);
-    if (!defined($unicode_formatted_accent)) {
-      last;
-    }
-    $current_result = $unicode_formatted_accent;
-    $unicode_formatted_accent = uc($unicode_formatted_accent)
-      if ($in_upper_case);
-    push @results_stack, [$unicode_formatted_accent, $accent];
-    last if ($accent eq $current);
-    $accent = $accent->{'parent'}->{'parent'};
-  }
-
-  if ($accent ne $current) {
-    while (1) {
-      push @results_stack, [undef, $accent];
-      last if ($accent eq $current);
-      $accent = $accent->{'parent'}->{'parent'};
+  while (@$stack) {
+    if (defined($unicode_formatted)) {
+      $unicode_formatted
+        = Texinfo::Convert::Unicode::unicode_accent($unicode_formatted, 
$stack->[-1]);
+      $unicode_formatted = uc($unicode_formatted)
+        if ($in_upper_case and defined($unicode_formatted));
     }
+    push @results_stack, [$unicode_formatted, $stack->[-1]];
+    pop @$stack;
   }
 
   if ($debug) {



reply via email to

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