summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorroot <root>2006-01-23 23:33:58 +0000
committerroot <root>2006-01-23 23:33:58 +0000
commitda3e513130c256e8809949a912e2f4828c6dfac4 (patch)
tree623871d762c6b52558e93eb8abfc86ac305192b5 /src
parent761ba2822b26499f9fa3a7cf53715ab8742b52a2 (diff)
*** empty log message ***
Diffstat (limited to 'src')
-rwxr-xr-xsrc/gencompose63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/gencompose b/src/gencompose
new file mode 100755
index 0000000..4b65c39
--- /dev/null
+++ b/src/gencompose
@@ -0,0 +1,63 @@
+#!/usr/bin/perl
+
+open UNIDATA, "<", "www.unicode.org/Public/UNIDATA/UnicodeData.txt"
+ or die "www.unicode.org/Public/UNIDATA/UnicodeData.txt: $!";
+#my %docom = qw(initial | medial | final | isolated | compat | none |); #+ arabic
+my %docom = qw(compat | none |);
+
+while (<UNIDATA>) {
+ my ($code, undef, $category, undef, undef, $decompose, undef) = split /;/;
+
+ push @cat_z, $code if $category =~ /^Z/;
+
+ if ($decompose) {
+ $type = $decompose =~ s/^<(.*)>\s*// ? $1 : "none";
+
+ next unless $docom{$type};
+ next unless $decompose =~ /^([0-9a-f]+) ([0-9a-f]+)$/i;
+ my $pfx = sprintf "%08d %08d %08d", hex $1, hex $2, hex $code;
+ push @compose, [$pfx, hex $1, hex $2, hex $code];
+ }
+}
+
+open TABLE, ">", "table/compose.h"
+ or die "table/compose.h: $!";
+
+print TABLE <<EOF;
+//
+// AUTOMATICALLLY GENERATED by gencompose
+//
+
+struct rxvt_compose_entry {
+ uint32_t c1, c2, r;
+} rxvt_compose_table[] = {
+#ifdef ENCODING_COMPOSE
+EOF
+
+for (sort { $a->[0] cmp $b->[0] } @compose) {
+ next if $seen{$_->[1],$_->[2]}++;
+ printf TABLE " { 0x%05x, 0x%05x, 0x%05x },\n", $_->[1], $_->[2], $_->[3];
+}
+
+
+print TABLE <<EOF;
+#endif
+};
+EOF
+
+open TABLE_Z, ">", "table/category.h";
+
+print TABLE_Z <<EOF;
+//
+// AUTOMATICALLLY GENERATED by gencompose
+//
+
+#define IS_SPACE(c) \\
+EOF
+
+for (@cat_z) {
+ print TABLE_Z " (c) == 0x$_ || \\\n";
+}
+
+print TABLE_Z " 0\n";
+