Revision: | 1.3 |
Committed: | Sun Mar 14 23:14:39 2004 UTC (20 years, 4 months ago) by pcg |
Branch: | MAIN |
CVS Tags: | rel-7_2, rel-7_1, rel-7_0, rel-5_5, rel-5_4, rel-5_7, rel-5_1, rel-5_0, rel-5_3, rel-5_2, rel-4_4, rel-4_6, rel-4_7, rel-5_9, rel-5_8, rel-4_2, rel-4_3, rel-3_7, rel-3_8, rel-3_5, rel-3_4, rel-3_3, rel-3_2, rel-2_8, rel-3_0, rel-2_4, rel-6_2, rel-2_5, rel-6_3, rel-3_6, rel-6_0, rel-4_1, rel-4_0, rel-6_1, rel-2_7, rel-4_8, rel-4_9 |
Changes since 1.2: | +34 -13 lines |
Log Message: | *** empty log message *** |
# | User | Rev | Content |
---|---|---|---|
1 | pcg | 1.1 | #!/usr/bin/perl |
2 | |||
3 | open UNIDATA, "<", "www.unicode.org/Public/UNIDATA/UnicodeData.txt" | ||
4 | or die "www.unicode.org/Public/UNIDATA/UnicodeData.txt: $!"; | ||
5 | pcg | 1.3 | my %docom = qw(initial | medial | final | isolated | compat | none |); |
6 | |||
7 | while (<UNIDATA>) { | ||
8 | my ($code, undef, $category, undef, undef, $decompose, undef) = split /;/; | ||
9 | |||
10 | push @cat_z, $code if $category =~ /^Z/; | ||
11 | |||
12 | if ($decompose) { | ||
13 | $type = $decompose =~ s/^<(.*)>\s*// ? $1 : "none"; | ||
14 | |||
15 | next unless $docom{$type}; | ||
16 | next unless $decompose =~ /^([0-9a-f]+) ([0-9a-f]+)$/i; | ||
17 | my $pfx = sprintf "%08d %08d %08d", hex $1, hex $2, hex $code; | ||
18 | push @compose, [$pfx, hex $1, hex $2, hex $code]; | ||
19 | } | ||
20 | } | ||
21 | |||
22 | pcg | 1.1 | open TABLE, ">", "table/compose.h" |
23 | or die "table/compose.h: $!"; | ||
24 | |||
25 | print TABLE <<EOF; | ||
26 | // | ||
27 | // AUTOMATICALLLY GENERATED by gencompose | ||
28 | // | ||
29 | |||
30 | pcg | 1.2 | struct rxvt_compose_entry { |
31 | pcg | 1.1 | uint32_t c1, c2, r; |
32 | pcg | 1.2 | } rxvt_compose_table[] = { |
33 | pcg | 1.1 | #ifdef ENCODING_COMPOSE |
34 | EOF | ||
35 | |||
36 | for (sort { $a->[0] cmp $b->[0] } @compose) { | ||
37 | next if $seen{$_->[1],$_->[2]}++; | ||
38 | printf TABLE " { 0x%05x, 0x%05x, 0x%05x },\n", $_->[1], $_->[2], $_->[3]; | ||
39 | } | ||
40 | |||
41 | |||
42 | print TABLE <<EOF; | ||
43 | #endif | ||
44 | }; | ||
45 | EOF | ||
46 | pcg | 1.3 | |
47 | open TABLE_Z, ">", "table/category.h"; | ||
48 | |||
49 | print TABLE_Z <<EOF; | ||
50 | // | ||
51 | // AUTOMATICALLLY GENERATED by gencompose | ||
52 | // | ||
53 | |||
54 | #define IS_SPACE(c) \\ | ||
55 | EOF | ||
56 | |||
57 | for (@cat_z) { | ||
58 | print TABLE_Z " (c) == 0x$_ || \\\n"; | ||
59 | } | ||
60 | |||
61 | print TABLE_Z " 0\n"; | ||
62 |