utf8_heavy.pl: Find mapping files from table
authorKarl Williamson <public@khwilliamson.com>
Sat, 5 Nov 2011 17:12:39 +0000 (11:12 -0600)
committerKarl Williamson <public@khwilliamson.com>
Tue, 8 Nov 2011 15:09:34 +0000 (08:09 -0700)
Previously, utf8_heavy.pl only returned 4 mapping files, the ones that
change case, and their names are known to it.  mktables now generates a
list of mapping files that it outputs.  This adds these to utf8_heavy's
repertoire.

lib/utf8_heavy.pl

index 2f34b85..c3ddf88 100644 (file)
@@ -19,7 +19,7 @@ sub _loose_name ($) {
 
     my $loose = $_[0] =~ s/[-\s_]//rg;
 
-    return $loose if $loose !~ / ^ (?: is )? l $/x;
+    return $loose if $loose !~ / ^ (?: is | to )? l $/x;
     return 'l_' if $_[0] =~ / l .* _ /x;    # If original had a trailing '_'
     return $loose;
 }
@@ -422,13 +422,24 @@ sub _loose_name ($) {
                 ## The user-level way to access ToDigit() and ToFold()
                 ## is to use Unicode::UCD.
                 ##
-
-                if ($minbits != 1) {    # Only check if caller wants non-binary
+                # Only check if caller wants non-binary
+                if ($minbits != 1 && $property_and_table =~ s/^to//) {
                     if ($type =~ /^To(Digit|Fold|Lower|Title|Upper)$/) {
                         $file = "$unicore_dir/To/$1.pl";
                         ## would like to test to see if $file actually exists....
                         last GETFILE;
                     }
+
+                    # Look input up in list of properties for which we have
+                    # mapping files.
+                    if (defined ($file =
+                          $utf8::loose_property_to_file_of{$property_and_table}))
+                    {
+                        $type = $utf8::file_to_swash_name{$file};
+                        print STDERR __LINE__, ": type set to $type\n" if DEBUG;
+                        $file = "$unicore_dir/$file.pl";
+                        last GETFILE;
+                    }
                 }
 
                 ##