]> mj.ucw.cz Git - libucw.git/blob - charset/misc/mkunacc
Syncing crashed repository with my work tree.
[libucw.git] / charset / misc / mkunacc
1 #!/usr/bin/perl
2 #
3 #  Create Unicode Unaccenting Table
4 #  (c) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
5 #
6
7 open (UNI, "/tmp/unicode") || die "No Unicode Data File";
8 while (<UNI>) {
9     chomp;
10     ($num,$name,$cat,$_,$_,$exp) = split /;/;
11     if ($cat =~ /^L[ul]$/) { $letter{$num} = 1; }
12     if ($cat =~ /^Mn$/) { $accent{$num} = 1; }
13 }
14 close UNI;
15
16 open (UNI, "/tmp/unicode") || die "No Unicode Data File";
17 while (<UNI>) {
18     chomp;
19     ($num,$name,$cat,$_,$_,$exp) = split /;/;
20     if ($exp ne "") {
21         $exp =~ s/^<.*> *//g;
22         $good = 1;
23         $e = "";
24         foreach $a (split(/\s+/, $exp)) {
25             if ($accent{$a}) { }
26             elsif ($letter{$a}) {
27                 if ($e ne "") { $good = 0; }
28                 else { $e = $a; }
29             } else { $good = 0; }
30         }
31         if ($good && $e ne "") { print "$num\t0x$e\n"; }
32     }
33 }
34 close UNI;