diff options
author | Owen Taylor <otaylor@src.gnome.org> | 2000-01-13 04:12:07 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2000-01-13 04:12:07 +0000 |
commit | 282fb5fc9f9d01c4d933a6eb6bee6ae9f0d512c7 (patch) | |
tree | 0b19c69692a2fe52a1b33d5e27c97b26a64417e3 /tools/compress-table.pl | |
parent | 66ae87f9fc45f5f564acf5014e9bd1341d052958 (diff) | |
download | pango-282fb5fc9f9d01c4d933a6eb6bee6ae9f0d512c7.tar.gz |
Initial revision
Diffstat (limited to 'tools/compress-table.pl')
-rwxr-xr-x | tools/compress-table.pl | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tools/compress-table.pl b/tools/compress-table.pl new file mode 100755 index 00000000..83b268cb --- /dev/null +++ b/tools/compress-table.pl @@ -0,0 +1,43 @@ +#!/usr/bin/perl -w + +sub convert { + $s = shift; + $s = "ENC_".uc($s); + $s =~ s/-/_/g; + return $s; +} + +open TABLE, "table"; + +$encodings = ""; + +while (<TABLE>) { + if (/^(0x[0-9a-fA-F]+)\s+([^:]*):(0x[0-9a-fA-F]+)/) { + ($u, $e) = ($1, $2); + + $u = oct($u); + + if (!defined $start) { + $start = $u; + $old_u = $u; + $encodings = convert($e); + $end = $u; + } elsif ($old_u ne $u) { + if (!defined $old_encodings) { + $old_encodings = $encodings; + } elsif ($old_encodings ne $encodings || $old_u != $end + 1) { + + printf "{ %#x, %#x, $old_encodings },\n", $start, $end; + $start = $old_u; + $old_encodings = $encodings; + } + $end = $old_u; + $encodings = convert($e); + $old_u = $u; + } else { + $encodings .= "|".convert($e); + } + } +} + +close TABLE; |