diff options
author | Matthias Clasen <mclasen@redhat.com> | 2011-07-13 22:07:11 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2011-07-14 16:55:34 -0400 |
commit | 761a1841eebedefeb7dc3675e442a56309f347c9 (patch) | |
tree | 353ca57cf5d4a25cd369bdb3e66186201b00a8e7 /glib/gen-unicode-tables.pl | |
parent | 8c7de592ff961410de0e8507d2334b4f18bc9a58 (diff) | |
download | glib-761a1841eebedefeb7dc3675e442a56309f347c9.tar.gz |
Bug 654195 - Add g_unichar_compose() and g_unichar_decompose()
Diffstat (limited to 'glib/gen-unicode-tables.pl')
-rwxr-xr-x | glib/gen-unicode-tables.pl | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/glib/gen-unicode-tables.pl b/glib/gen-unicode-tables.pl index 4d6adc350..c3623eb93 100755 --- a/glib/gen-unicode-tables.pl +++ b/glib/gen-unicode-tables.pl @@ -870,6 +870,46 @@ sub print_decomp printf OUT "static const gchar decomp_expansion_string[] = %s;\n\n", $decomp_string; + print OUT "typedef struct\n{\n"; + print OUT " gunichar ch;\n"; + print OUT " gunichar a;\n"; + print OUT " gunichar b;\n"; + print OUT "} decomposition_step;\n\n"; + + print OUT "static const decomposition_step decomp_step_table[] =\n{\n"; + $first = 1; + my @steps = (); + for ($count = 0; $count <= $last; ++$count) + { + if ((defined $decompositions[$count]) && (!$decompose_compat[$count])) + { + print OUT ",\n" + if ! $first; + $first = 0; + my @list; + @list = (split(' ', $decompositions[$count]), "0"); + printf OUT qq( { 0x%05x, 0x%05x, 0x%05x }), $count, hex($list[0]), hex($list[1]); + # don't include 1:1 in the compose table + push @steps, [ ($count, hex($list[0]), hex($list[1])) ] + if hex($list[1]) + } + } + print OUT "\n};\n\n"; + + print OUT "static const decomposition_step comp_step_table[] =\n{\n"; + my @inverted; + @inverted = sort { @{$a}[1] <=> @{$b}[1] || + @{$a}[2] <=> @{$b}[2] } @steps; + $first = 1; + foreach my $i ( 0 .. $#inverted ) + { + print OUT ",\n" + if ! $first; + $first = 0; + printf OUT qq( { 0x%05x, 0x%05x, 0x%05x }), $inverted[$i][0], $inverted[$i][1], $inverted[$i][2]; + } + print OUT "\n};\n\n"; + print OUT "#endif /* DECOMP_H */\n"; printf STDERR "Generated %d bytes in decomp tables\n", $bytes_out; |