tools: Generate the Unicode Bidi Bracketing table.

This commit is contained in:
Aric Stewart 2014-06-30 09:01:33 -05:00 committed by Alexandre Julliard
parent 18d410dec1
commit 2a12c6a7d4
3 changed files with 151 additions and 0 deletions

View File

@ -4,6 +4,7 @@ IMPORTS = advapi32 user32 gdi32
C_SRCS = \
bidi.c \
bracket.c \
breaking.c \
indic.c \
indicsyllable.c \

106
dlls/usp10/bracket.c Normal file
View File

@ -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
};

View File

@ -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" );