From 2a12c6a7d49c1bc0539065430a92465a259a1165 Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Mon, 30 Jun 2014 09:01:33 -0500 Subject: [PATCH] tools: Generate the Unicode Bidi Bracketing table. --- dlls/usp10/Makefile.in | 1 + dlls/usp10/bracket.c | 106 +++++++++++++++++++++++++++++++++++++++++ tools/make_unicode | 44 +++++++++++++++++ 3 files changed, 151 insertions(+) create mode 100644 dlls/usp10/bracket.c diff --git a/dlls/usp10/Makefile.in b/dlls/usp10/Makefile.in index 1b8238a1bd6..21541f1bd3c 100644 --- a/dlls/usp10/Makefile.in +++ b/dlls/usp10/Makefile.in @@ -4,6 +4,7 @@ IMPORTS = advapi32 user32 gdi32 C_SRCS = \ bidi.c \ + bracket.c \ breaking.c \ indic.c \ indicsyllable.c \ diff --git a/dlls/usp10/bracket.c b/dlls/usp10/bracket.c new file mode 100644 index 00000000000..20df6fa11f2 --- /dev/null +++ b/dlls/usp10/bracket.c @@ -0,0 +1,106 @@ +/* Unicode Bidirectional Bracket table */ +/* generated from http://www.unicode.org/Public/7.0.0/ucd/BidiBrackets.txt */ +/* DO NOT EDIT!! */ + +const unsigned short bidi_bracket_table[768] = +{ + /* level 1 offsets */ + 0x0100, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0120, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0130, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0140, 0x0110, 0x0110, 0x0150, 0x0110, 0x0110, 0x0110, 0x0160, + 0x0110, 0x0170, 0x0110, 0x0110, 0x0110, 0x0110, 0x0180, 0x0110, + 0x0190, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, + 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x01a0, 0x01b0, + /* level 2 offsets */ + 0x01c0, 0x01c0, 0x01d0, 0x01c0, 0x01c0, 0x01e0, 0x01c0, 0x01e0, + 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, + 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, + 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, + 0x01c0, 0x01c0, 0x01c0, 0x01f0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, + 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, + 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, + 0x01c0, 0x0200, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, + 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x0210, 0x01c0, 0x01c0, 0x0220, + 0x0220, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, + 0x0230, 0x01c0, 0x0240, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, + 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, + 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x0250, 0x0260, + 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x0210, 0x01c0, 0x0270, 0x01c0, + 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, + 0x0280, 0x0290, 0x01c0, 0x01c0, 0x01c0, 0x0230, 0x01c0, 0x02a0, + 0x01c0, 0x01c0, 0x02b0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, + 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, + 0x0250, 0x02c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, + 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, + 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x02d0, 0x01c0, 0x01c0, + 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, + 0x01d0, 0x01c0, 0x01c0, 0x01e0, 0x01c0, 0x02e0, 0x02f0, 0x01c0, + 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, + /* values */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0001, 0x01fe, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0002, 0x0000, 0x01fd, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0001, 0x01fe, 0x0001, 0x01fe, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0001, 0x01fe, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x01fe, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x01fe, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0001, 0x01fe, 0x0001, 0x01fe, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0001, 0x01fe, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0001, 0x01fe, 0x0001, 0x01fe, 0x0001, 0x01fe, 0x0001, 0x01fe, + 0x0001, 0x01fe, 0x0001, 0x01fe, 0x0001, 0x01fe, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x01fe, + 0x0001, 0x01fe, 0x0001, 0x01fe, 0x0001, 0x01fe, 0x0001, 0x01fe, + 0x0000, 0x0000, 0x0000, 0x0001, 0x01fe, 0x0001, 0x01fe, 0x0001, + 0x01fe, 0x0001, 0x01fe, 0x0001, 0x01fe, 0x0003, 0x0101, 0x00fe, + 0x01fc, 0x0001, 0x01fe, 0x0001, 0x01fe, 0x0001, 0x01fe, 0x0001, + 0x01fe, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x01fe, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0001, 0x01fe, 0x0001, 0x01fe, 0x0001, 0x01fe, + 0x0001, 0x01fe, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0001, 0x01fe, 0x0000, 0x0000, 0x0001, 0x01fe, 0x0001, 0x01fe, + 0x0001, 0x01fe, 0x0001, 0x01fe, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0001, 0x01fe, 0x0001, 0x01fe, 0x0001, 0x01fe, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0002, 0x0000, 0x01fd, 0x0000, 0x0001, + 0x01fe, 0x0000, 0x0001, 0x01fe, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +}; diff --git a/tools/make_unicode b/tools/make_unicode index e0f92b5f0ea..be81ec77b7c 100755 --- a/tools/make_unicode +++ b/tools/make_unicode @@ -131,6 +131,12 @@ my %ctype = "defin" => 0x0200 ); +my %bracket_types = +( + "o" => 0x0000, + "c" => 0x0001, +); + my %indic_types = ( "Other" => 0x0000, @@ -1322,6 +1328,43 @@ sub dump_mirroring($) save_file($filename); } +################################################################ +# dump the Bidi Brackets +sub dump_bracket($) +{ + my $filename = shift; + my @bracket_table = (0) x 65536;; + + my $INPUT = open_data_file( $UNIDATA, "BidiBrackets.txt" ); + while (<$INPUT>) + { + next if /^\#/; # skip comments + next if /^\s*$/; # skip empty lines + next if /\x1a/; # skip ^Z + if (/^\s*([0-9a-fA-F]+)\s*;\s*([0-9a-fA-F]+);\s*([con])/) + { + my $type = $3; + die "unknown bracket $type" unless defined $bracket_types{$type}; + die "characters too distant $1 and $2" if abs(hex($2) - hex($1)) >= 256; + $bracket_table[hex $1] = (hex($2) - hex($1)) % 255; + $bracket_table[hex $1] += $bracket_types{$type} << 8; + next; + } + die "malformed line $_"; + } + close $INPUT; + + open OUTPUT,">$filename.new" or die "Cannot create $filename"; + print "Building $filename\n"; + print OUTPUT "/* Unicode Bidirectional Bracket table */\n"; + print OUTPUT "/* generated from $UNIDATA/BidiBrackets.txt */\n"; + print OUTPUT "/* DO NOT EDIT!! */\n\n"; + + dump_two_level_mapping( "bidi_bracket_table", @bracket_table); + + close OUTPUT; + save_file($filename); +} ################################################################ # dump the Arabic shaping table @@ -2228,6 +2271,7 @@ DUMP_SORTKEYS( "libs/wine/collation.c", READ_SORTKEYS_FILE() ); DUMP_COMPOSE_TABLES( "libs/wine/compose.c" ); DUMP_CTYPE_TABLES( "libs/wine/wctype.c" ); dump_mirroring( "dlls/usp10/mirror.c" ); +dump_bracket( "dlls/usp10/bracket.c" ); dump_shaping( "dlls/usp10/shaping.c" ); dump_linebreak( "dlls/usp10/linebreak.c" ); dump_indic( "dlls/usp10/indicsyllable.c" );