ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/gencompose
Revision: 1.1
Committed: Thu Mar 4 02:05:49 2004 UTC (20 years, 3 months ago) by pcg
Branch: MAIN
Log Message:
*** empty log message ***

File Contents

# Content
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 open TABLE, ">", "table/compose.h"
6 or die "table/compose.h: $!";
7
8 print TABLE <<EOF;
9 //
10 // AUTOMATICALLLY GENERATED by gencompose
11 //
12
13 struct rxvt_compose {
14 uint32_t c1, c2, r;
15 } rxvt_compose_table = {
16 #ifdef ENCODING_COMPOSE
17 EOF
18
19 my %docom = qw(initial | medial | final | isolated | compat | none |);
20
21 while (<UNIDATA>) {
22 my ($code, undef, undef, undef, undef, $decompose, undef) = split /;/;
23 next unless $decompose;
24 $type = $decompose =~ s/^<(.*)>\s*// ? $1 : "none";
25
26 next unless $docom{$type};
27 next unless $decompose =~ /^([0-9a-f]+) ([0-9a-f]+)$/i;
28 my $pfx = sprintf "%08d %08d %08d", hex $1, hex $2, hex $code;
29 push @compose, [$pfx, hex $1, hex $2, hex $code];
30 }
31
32 for (sort { $a->[0] cmp $b->[0] } @compose) {
33 next if $seen{$_->[1],$_->[2]}++;
34 printf TABLE " { 0x%05x, 0x%05x, 0x%05x },\n", $_->[1], $_->[2], $_->[3];
35 $count++;
36 }
37
38
39 print TABLE <<EOF;
40 #define ENCODING_COMPOSE_COUNT $count
41 #else
42 #define ENCODING_COMPOSE_COUNT 0
43 #endif
44 };
45 EOF