Change 11486 by jhi@alpha on 2001/07/29 20:38:09

        Use Search::Dict 1.02 interface for charinfo().

Affected files ...

... //depot/perl/lib/UnicodeCD.pm#8 edit

Differences ...

==== //depot/perl/lib/UnicodeCD.pm#8 (text) ====
Index: perl/lib/UnicodeCD.pm
--- perl/lib/UnicodeCD.pm.~1~   Sun Jul 29 14:45:05 2001
+++ perl/lib/UnicodeCD.pm       Sun Jul 29 14:45:05 2001
@@ -246,21 +246,23 @@
     my $code = _getcode($arg);
     croak __PACKAGE__, "::charinfo: unknown code '$arg'"
        unless defined $code;
-    my $hexk = sprintf("%04X", $code);
+    my $hexk = sprintf("%06X", $code);
     my($rcode,$rname,$rdec);
     foreach my $range (@CharinfoRanges){
       if ($range->[0] <= $code && $code <= $range->[1]) {
         $rcode = $hexk;
+       $rcode =~ s/^0+//;
+       $rcode =  sprintf("%04X", hex($rcode));
         $rname = $range->[2] ? $range->[2]->($code) : '';
         $rdec  = $range->[3] ? $range->[3]->($code) : '';
-        $hexk  = sprintf("%04X", $range->[0]); # replace by the first
+        $hexk  = sprintf("%06X", $range->[0]); # replace by the first
         last;
       }
     }
     openunicode(\$UNICODEFH, "Unicode.txt");
     if (defined $UNICODEFH) {
-       use Search::Dict;
-       if (look($UNICODEFH, "$hexk;")) {
+       use Search::Dict 1.02;
+       if (look($UNICODEFH, "$hexk;", { xfrm => sub { $_[0] =~ /^([^;]+);(.+)/; 
+sprintf "%06X;$2", hex($1) } } ) >= 0) {
            my $line = <$UNICODEFH>;
            chomp $line;
            my %prop;
@@ -271,6 +273,8 @@
                     mirrored unicode10 comment
                     upper lower title
                    )} = split(/;/, $line, -1);
+           $hexk =~ s/^0+//;
+           $hexk =  sprintf("%04X", hex($hexk));
            if ($prop{code} eq $hexk) {
                $prop{block}  = charblock($code);
                $prop{script} = charscript($code);
End of Patch.

Reply via email to