Commit 991cbcce97527e74ca3751dd04b89e393420549c

Werner Lemberg 2014-01-05T13:24:56

[autofit] Minor fixes for `afblue.pl'. * src/tools/afblue.pl (aux_name): Don't use `reverse'. <Handling #endif>: Use proper indentation for generated `#else'. * src/autofit/afblue.h: Regenerated.

diff --git a/ChangeLog b/ChangeLog
index 861e0b2..8adabd9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2014-01-05  Werner Lemberg  <wl@gnu.org>
+
+	[autofit] Minor fixes for `afblue.pl'.
+
+	* src/tools/afblue.pl (aux_name): Don't use `reverse'.
+	<Handling #endif>: Use proper indentation for generated `#else'.
+
+	* src/autofit/afblue.h: Regenerated.
+
 2014-01-04  Werner Lemberg  <wl@gnu.org>
 
 	[autofit] Fix Indic scripts.
diff --git a/src/autofit/afblue.h b/src/autofit/afblue.h
index 75f60df..7c50d99 100644
--- a/src/autofit/afblue.h
+++ b/src/autofit/afblue.h
@@ -103,13 +103,13 @@ FT_BEGIN_HEADER
     AF_BLUE_STRING_CJK_LEFT_UNFILL = af_blue_1_1_1 + 77,
     AF_BLUE_STRING_CJK_RIGHT_FILL = af_blue_1_1_1 + 153,
     AF_BLUE_STRING_CJK_RIGHT_UNFILL = af_blue_1_1_1 + 229,
-    af_blue_1_2_1 = af_blue_1_1_1 + 304,
+    af_blue_1_1_2 = af_blue_1_1_1 + 304,
 #else
-    af_blue_1_2_1 = af_blue_1_1_1 + 0,
+    af_blue_1_1_2 = af_blue_1_1_1 + 0,
 #endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */
-    af_blue_1_2 = af_blue_1_2_1 + 0,
+    af_blue_1_2 = af_blue_1_1_2 + 0,
 #else
-    af_blue_1_2 = af_blue_1_2_1 + 0,
+    af_blue_1_2 = af_blue_1_1_2 + 0,
 #endif /* AF_CONFIG_OPTION_CJK                */
 
 
@@ -162,13 +162,13 @@ FT_BEGIN_HEADER
     AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0,
     af_blue_2_1_1 = af_blue_2_1 + 4,
 #ifdef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT
-    af_blue_2_2_1 = af_blue_2_1_1 + 4,
+    af_blue_2_1_2 = af_blue_2_1_1 + 4,
 #else
-    af_blue_2_2_1 = af_blue_2_1_1 + 0,
+    af_blue_2_1_2 = af_blue_2_1_1 + 0,
 #endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */
-    af_blue_2_2 = af_blue_2_2_1 + 1,
+    af_blue_2_2 = af_blue_2_1_2 + 1,
 #else
-    af_blue_2_2 = af_blue_2_2_1 + 0,
+    af_blue_2_2 = af_blue_2_1_2 + 0,
 #endif /* AF_CONFIG_OPTION_CJK                */
 
 
diff --git a/src/tools/afblue.pl b/src/tools/afblue.pl
index 774438f..d7c7322 100644
--- a/src/tools/afblue.pl
+++ b/src/tools/afblue.pl
@@ -194,7 +194,7 @@ sub convert_literal
 
 sub aux_name
 {
-  return "af_blue_" . $num_sections. "_" . join('_', reverse @name_stack);
+  return "af_blue_" . $num_sections. "_" . join('_', @name_stack);
 }
 
 
@@ -210,7 +210,7 @@ sub aux_name_next
 
 sub enum_val_string
 {
-  # Build string which holds code to save the current offset in an
+  # Build string that holds code to save the current offset in an
   # enumeration element.
   my $aux = shift;
 
@@ -288,7 +288,7 @@ while (<DATA>)
     {
       # Having preprocessor conditionals complicates the computation of
       # correct offset values.  We have to introduce auxiliary enumeration
-      # elements with the name `af_blue_<s>_<n1>_<n2>_...' which store
+      # elements with the name `af_blue_<s>_<n1>_<n2>_...' that store
       # offsets to be used in conditional clauses.  `<s>' is the number of
       # sections seen so far, `<n1>' is the number of `#if' and `#endif'
       # conditionals seen so far in the topmost level, `<n2>' the number of
@@ -344,7 +344,7 @@ while (<DATA>)
 
         $curr_offset = 0;
       }
-      elsif (/ ^ \# \s* endif /x)
+      elsif (/ ^ (\# \s*) endif /x)
       {
         my $prev_else = pop @else_stack;
         Die("unbalanced #endif") unless defined($prev_else);
@@ -356,8 +356,9 @@ while (<DATA>)
         # necessary to have correct offsets.
         if (!$prev_else)
         {
+          # Use amount of whitespace from `endif'.
           push @{$diversions{$curr_enum}}, enum_val_string(aux_name())
-                                           . "#else\n";
+                                           . $1 . "else\n";
 
           $curr_offset = 0;
         }