ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/gencompose
(Generate patch)

Comparing rxvt-unicode/src/gencompose (file contents):
Revision 1.2 by pcg, Thu Mar 4 03:04:53 2004 UTC vs.
Revision 1.3 by pcg, Sun Mar 14 23:14:39 2004 UTC

1#!/usr/bin/perl 1#!/usr/bin/perl
2 2
3open UNIDATA, "<", "www.unicode.org/Public/UNIDATA/UnicodeData.txt" 3open UNIDATA, "<", "www.unicode.org/Public/UNIDATA/UnicodeData.txt"
4 or die "www.unicode.org/Public/UNIDATA/UnicodeData.txt: $!"; 4 or die "www.unicode.org/Public/UNIDATA/UnicodeData.txt: $!";
5my %docom = qw(initial | medial | final | isolated | compat | none |);
6
7while (<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
5open TABLE, ">", "table/compose.h" 22open TABLE, ">", "table/compose.h"
6 or die "table/compose.h: $!"; 23 or die "table/compose.h: $!";
7 24
8print TABLE <<EOF; 25print TABLE <<EOF;
9// 26//
14 uint32_t c1, c2, r; 31 uint32_t c1, c2, r;
15} rxvt_compose_table[] = { 32} rxvt_compose_table[] = {
16#ifdef ENCODING_COMPOSE 33#ifdef ENCODING_COMPOSE
17EOF 34EOF
18 35
19my %docom = qw(initial | medial | final | isolated | compat | none |);
20
21while (<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
32for (sort { $a->[0] cmp $b->[0] } @compose) { 36for (sort { $a->[0] cmp $b->[0] } @compose) {
33 next if $seen{$_->[1],$_->[2]}++; 37 next if $seen{$_->[1],$_->[2]}++;
34 printf TABLE " { 0x%05x, 0x%05x, 0x%05x },\n", $_->[1], $_->[2], $_->[3]; 38 printf TABLE " { 0x%05x, 0x%05x, 0x%05x },\n", $_->[1], $_->[2], $_->[3];
35} 39}
36 40
37 41
38print TABLE <<EOF; 42print TABLE <<EOF;
39#endif 43#endif
40}; 44};
41EOF 45EOF
46
47open TABLE_Z, ">", "table/category.h";
48
49print TABLE_Z <<EOF;
50//
51// AUTOMATICALLLY GENERATED by gencompose
52//
53
54#define IS_SPACE(c) \\
55EOF
56
57for (@cat_z) {
58 print TABLE_Z " (c) == 0x$_ || \\\n";
59}
60
61print TABLE_Z " 0\n";
62

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines