ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/gencompose
Revision: 1.4
Committed: Mon Jan 23 23:33:58 2006 UTC (18 years, 3 months ago) by root
Branch: MAIN
CVS Tags: rel-7_3, before_dynamic_fontidx, rel-7_6, rel-7_5, rxvt-unicode-rel-9_29, rxvt-unicode-rel-9_26, rel-7_8, rel-7_9, rxvt-unicode-rel-9_25, rxvt-unicode-rel-9_22, rxvt-unicode-rel-9_20, rxvt-unicode-rel-9_21, rel-7_7, rel-9_14, rel-7_4, rel-9_11, rel-9_10, rel-8_1, rel-9_12, rel-8_5a, rel-7_3a, rel-8_2, rel-8_9, rel-8_8, dynamic_fontidx, rxvt-unicode-rel-9_19, rxvt-unicode-rel-9_18, rel-8_0, rel-8_4, rel-9_0, rel-8_3, rxvt-unicode-rel-9_17, rxvt-unicode-rel-9_16, rxvt-unicode-rel-9_15, rxvt-unicode-rel-9_30, rel-8_6, rel-8_7, rel-9_09, rel-9_02, rel-9_01, rel-9_06, rel-9_07, rel-9_05, HEAD
Changes since 1.3: +2 -1 lines
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 #my %docom = qw(initial | medial | final | isolated | compat | none |); #+ arabic
6 my %docom = qw(compat | none |);
7
8 while (<UNIDATA>) {
9 my ($code, undef, $category, undef, undef, $decompose, undef) = split /;/;
10
11 push @cat_z, $code if $category =~ /^Z/;
12
13 if ($decompose) {
14 $type = $decompose =~ s/^<(.*)>\s*// ? $1 : "none";
15
16 next unless $docom{$type};
17 next unless $decompose =~ /^([0-9a-f]+) ([0-9a-f]+)$/i;
18 my $pfx = sprintf "%08d %08d %08d", hex $1, hex $2, hex $code;
19 push @compose, [$pfx, hex $1, hex $2, hex $code];
20 }
21 }
22
23 open TABLE, ">", "table/compose.h"
24 or die "table/compose.h: $!";
25
26 print TABLE <<EOF;
27 //
28 // AUTOMATICALLLY GENERATED by gencompose
29 //
30
31 struct rxvt_compose_entry {
32 uint32_t c1, c2, r;
33 } rxvt_compose_table[] = {
34 #ifdef ENCODING_COMPOSE
35 EOF
36
37 for (sort { $a->[0] cmp $b->[0] } @compose) {
38 next if $seen{$_->[1],$_->[2]}++;
39 printf TABLE " { 0x%05x, 0x%05x, 0x%05x },\n", $_->[1], $_->[2], $_->[3];
40 }
41
42
43 print TABLE <<EOF;
44 #endif
45 };
46 EOF
47
48 open TABLE_Z, ">", "table/category.h";
49
50 print TABLE_Z <<EOF;
51 //
52 // AUTOMATICALLLY GENERATED by gencompose
53 //
54
55 #define IS_SPACE(c) \\
56 EOF
57
58 for (@cat_z) {
59 print TABLE_Z " (c) == 0x$_ || \\\n";
60 }
61
62 print TABLE_Z " 0\n";
63