msvcrt: Add a new file for the x86_64 exception handling.
[wine/multimedia.git] / tools / make_unicode
blob2a8c6487900cfabb08b5a1b8b60303af7ddd1eef
1 #!/usr/bin/perl -w
3 # Generate code page .c files from ftp.unicode.org descriptions
5 # Copyright 2000 Alexandre Julliard
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 use strict;
24 # base URLs for www.unicode.org files
25 my $MAPPINGS = "http://www.unicode.org/Public/MAPPINGS";
26 my $UNIDATA = "http://www.unicode.org/Public/6.0.0/ucd";
28 # Sort keys file
29 my $SORTKEYS = "http://www.unicode.org/reports/tr10/allkeys.txt";
31 # Defaults mapping
32 my $DEFAULTS = "tools/unicode-defaults";
34 # Default char for undefined mappings
35 my $DEF_CHAR = ord '?';
37 my @allfiles =
39 [ 37, "VENDORS/MICSFT/EBCDIC/CP037.TXT", 0, "IBM EBCDIC US Canada" ],
40 [ 424, "VENDORS/MISC/CP424.TXT", 0, "IBM EBCDIC Hebrew" ],
41 [ 437, "VENDORS/MICSFT/PC/CP437.TXT", 1, "OEM United States" ],
42 [ 500, "VENDORS/MICSFT/EBCDIC/CP500.TXT", 0, "IBM EBCDIC International" ],
43 [ 737, "VENDORS/MICSFT/PC/CP737.TXT", 1, "OEM Greek 437G" ],
44 [ 775, "VENDORS/MICSFT/PC/CP775.TXT", 1, "OEM Baltic" ],
45 [ 850, "VENDORS/MICSFT/PC/CP850.TXT", 1, "OEM Multilingual Latin 1" ],
46 [ 852, "VENDORS/MICSFT/PC/CP852.TXT", 1, "OEM Slovak Latin 2" ],
47 [ 855, "VENDORS/MICSFT/PC/CP855.TXT", 1, "OEM Cyrillic" ],
48 [ 856, "VENDORS/MISC/CP856.TXT", 0, "Hebrew PC" ],
49 [ 857, "VENDORS/MICSFT/PC/CP857.TXT", 1, "OEM Turkish" ],
50 [ 860, "VENDORS/MICSFT/PC/CP860.TXT", 1, "OEM Portuguese" ],
51 [ 861, "VENDORS/MICSFT/PC/CP861.TXT", 1, "OEM Icelandic" ],
52 [ 862, "VENDORS/MICSFT/PC/CP862.TXT", 1, "OEM Hebrew" ],
53 [ 863, "VENDORS/MICSFT/PC/CP863.TXT", 1, "OEM Canadian French" ],
54 [ 864, "VENDORS/MICSFT/PC/CP864.TXT", 0, "OEM Arabic" ],
55 [ 865, "VENDORS/MICSFT/PC/CP865.TXT", 1, "OEM Nordic" ],
56 [ 866, "VENDORS/MICSFT/PC/CP866.TXT", 1, "OEM Russian" ],
57 [ 869, "VENDORS/MICSFT/PC/CP869.TXT", 1, "OEM Greek" ],
58 [ 874, "VENDORS/MICSFT/WindowsBestFit/bestfit874.txt", 1, "ANSI/OEM Thai" ],
59 [ 875, "VENDORS/MICSFT/EBCDIC/CP875.TXT", 0, "IBM EBCDIC Greek" ],
60 [ 878, "VENDORS/MISC/KOI8-R.TXT", 0, "Russian KOI8" ],
61 [ 932, "VENDORS/MICSFT/WindowsBestFit/bestfit932.txt", 0, "ANSI/OEM Japanese Shift-JIS" ],
62 [ 936, "VENDORS/MICSFT/WindowsBestFit/bestfit936.txt", 0, "ANSI/OEM Simplified Chinese GBK" ],
63 [ 949, "VENDORS/MICSFT/WindowsBestFit/bestfit949.txt", 0, "ANSI/OEM Korean Unified Hangul" ],
64 [ 950, "VENDORS/MICSFT/WindowsBestFit/bestfit950.txt", 0, "ANSI/OEM Traditional Chinese Big5" ],
65 [ 1006, "VENDORS/MISC/CP1006.TXT", 0, "IBM Arabic" ],
66 [ 1026, "VENDORS/MICSFT/EBCDIC/CP1026.TXT", 0, "IBM EBCDIC Latin 5 Turkish" ],
67 [ 1250, "VENDORS/MICSFT/WindowsBestFit/bestfit1250.txt", 0, "ANSI Eastern Europe" ],
68 [ 1251, "VENDORS/MICSFT/WindowsBestFit/bestfit1251.txt", 0, "ANSI Cyrillic" ],
69 [ 1252, "VENDORS/MICSFT/WindowsBestFit/bestfit1252.txt", 0, "ANSI Latin 1" ],
70 [ 1253, "VENDORS/MICSFT/WindowsBestFit/bestfit1253.txt", 0, "ANSI Greek" ],
71 [ 1254, "VENDORS/MICSFT/WindowsBestFit/bestfit1254.txt", 0, "ANSI Turkish" ],
72 [ 1255, "VENDORS/MICSFT/WindowsBestFit/bestfit1255.txt", 0, "ANSI Hebrew" ],
73 [ 1256, "VENDORS/MICSFT/WindowsBestFit/bestfit1256.txt", 0, "ANSI Arabic" ],
74 [ 1257, "VENDORS/MICSFT/WindowsBestFit/bestfit1257.txt", 0, "ANSI Baltic" ],
75 [ 1258, "VENDORS/MICSFT/WindowsBestFit/bestfit1258.txt", 0, "ANSI/OEM Viet Nam" ],
76 [ 1361, "OBSOLETE/EASTASIA/KSC/JOHAB.TXT", 0, "Korean Johab" ],
77 [ 10000, "VENDORS/MICSFT/MAC/ROMAN.TXT", 0, "Mac Roman" ],
78 [ 10006, "VENDORS/MICSFT/MAC/GREEK.TXT", 0, "Mac Greek" ],
79 [ 10007, "VENDORS/MICSFT/MAC/CYRILLIC.TXT", 0, "Mac Cyrillic" ],
80 [ 10029, "VENDORS/MICSFT/MAC/LATIN2.TXT", 0, "Mac Latin 2" ],
81 [ 10079, "VENDORS/MICSFT/MAC/ICELAND.TXT", 0, "Mac Icelandic" ],
82 [ 10081, "VENDORS/MICSFT/MAC/TURKISH.TXT", 0, "Mac Turkish" ],
83 [ 20127, undef, 0, "US-ASCII (7bit)" ],
84 [ 20866, "VENDORS/MISC/KOI8-R.TXT", 0, "Russian KOI8" ],
85 [ 20932, "OBSOLETE/EASTASIA/JIS/JIS0208.TXT", 0, "EUC-JP" ],
86 [ 21866, "VENDORS/MISC/KOI8-U.TXT", 0, "Ukrainian KOI8" ],
87 [ 28591, "ISO8859/8859-1.TXT", 0, "ISO 8859-1 Latin 1" ],
88 [ 28592, "ISO8859/8859-2.TXT", 0, "ISO 8859-2 Latin 2 (East European)" ],
89 [ 28593, "ISO8859/8859-3.TXT", 0, "ISO 8859-3 Latin 3 (South European)" ],
90 [ 28594, "ISO8859/8859-4.TXT", 0, "ISO 8859-4 Latin 4 (Baltic old)" ],
91 [ 28595, "ISO8859/8859-5.TXT", 0, "ISO 8859-5 Cyrillic" ],
92 [ 28596, "ISO8859/8859-6.TXT", 0, "ISO 8859-6 Arabic" ],
93 [ 28597, "ISO8859/8859-7.TXT", 0, "ISO 8859-7 Greek" ],
94 [ 28598, "ISO8859/8859-8.TXT", 0, "ISO 8859-8 Hebrew" ],
95 [ 28599, "ISO8859/8859-9.TXT", 0, "ISO 8859-9 Latin 5 (Turkish)" ],
96 [ 28600, "ISO8859/8859-10.TXT", 0, "ISO 8859-10 Latin 6 (Nordic)" ],
97 [ 28603, "ISO8859/8859-13.TXT", 0, "ISO 8859-13 Latin 7 (Baltic)" ],
98 [ 28604, "ISO8859/8859-14.TXT", 0, "ISO 8859-14 Latin 8 (Celtic)" ],
99 [ 28605, "ISO8859/8859-15.TXT", 0, "ISO 8859-15 Latin 9 (Euro)" ],
100 [ 28606, "ISO8859/8859-16.TXT", 0, "ISO 8859-16 Latin 10 (Balkan)" ]
104 my %ctype =
106 "upper" => 0x0001,
107 "lower" => 0x0002,
108 "digit" => 0x0004,
109 "space" => 0x0008,
110 "punct" => 0x0010,
111 "cntrl" => 0x0020,
112 "blank" => 0x0040,
113 "xdigit" => 0x0080,
114 "alpha" => 0x0100,
115 "defin" => 0x0200
118 my %indic_types =
120 "Other" => 0x0000,
121 "Bindu" => 0x0001,
122 "Visarga" => 0x0002,
123 "Avagraha" => 0x0003,
124 "Nukta" => 0x0004,
125 "Virama" => 0x0005,
126 "Vowel_Independent" => 0x0006,
127 "Vowel_Dependent" => 0x0007,
128 "Vowel" => 0x0008,
129 "Consonant_Placeholder" => 0x0009,
130 "Consonant" => 0x000a,
131 "Consonant_Dead" => 0x000b,
132 "Consonant_Repha" => 0x000c,
133 "Consonant_Subjoined" => 0x000d,
134 "Consonant_Medial" => 0x000e,
135 "Consonant_Final" => 0x000f,
136 "Consonant_Head_Letter" => 0x0010,
137 "Modifying_Letter" => 0x0011,
138 "Tone_Letter" => 0x0012,
139 "Tone_Mark" => 0x0013,
140 "Register_Shifter" => 0x0014
143 my %matra_types =
145 "Right" => 0x01,
146 "Left" => 0x02,
147 "Visual_Order_Left" => 0x03,
148 "Left_And_Right" => 0x04,
149 "Top" => 0x05,
150 "Bottom" => 0x06,
151 "Top_And_Bottom" => 0x07,
152 "Top_And_Right" => 0x08,
153 "Top_And_Left" => 0x09,
154 "Top_And_Left_And_Right" => 0x0a,
155 "Bottom_And_Right" => 0x0b,
156 "Top_And_Bottom_And_Right" => 0x0c,
157 "Overstruck" => 0x0d,
158 "Invisible" => 0x0e
161 my %break_types =
163 "BK" => 0x0001,
164 "CR" => 0x0002,
165 "LF" => 0x0003,
166 "CM" => 0x0004,
167 "SG" => 0x0005,
168 "GL" => 0x0006,
169 "CB" => 0x0007,
170 "SP" => 0x0008,
171 "ZW" => 0x0009,
172 "NL" => 0x000a,
173 "WJ" => 0x000b,
174 "JL" => 0x000c,
175 "JV" => 0x000d,
176 "JT" => 0x000e,
177 "H2" => 0x000f,
178 "H3" => 0x0010,
179 "XX" => 0x0011,
180 "OP" => 0x0012,
181 "CL" => 0x0013,
182 "CP" => 0x0014,
183 "QU" => 0x0015,
184 "NS" => 0x0016,
185 "EX" => 0x0017,
186 "SY" => 0x0018,
187 "IS" => 0x0019,
188 "PR" => 0x001a,
189 "PO" => 0x001b,
190 "NU" => 0x001c,
191 "AL" => 0x001d,
192 "ID" => 0x001e,
193 "IN" => 0x001f,
194 "HY" => 0x0020,
195 "BB" => 0x0021,
196 "BA" => 0x0022,
197 "SA" => 0x0023,
198 "AI" => 0x0024,
199 "B2" => 0x0025
202 my %categories =
204 "Lu" => $ctype{"defin"}|$ctype{"alpha"}|$ctype{"upper"}, # Letter, Uppercase
205 "Ll" => $ctype{"defin"}|$ctype{"alpha"}|$ctype{"lower"}, # Letter, Lowercase
206 "Lt" => $ctype{"defin"}|$ctype{"alpha"}|$ctype{"upper"}|$ctype{"lower"}, # Letter, Titlecase
207 "Mn" => $ctype{"defin"}, # Mark, Non-Spacing
208 "Mc" => $ctype{"defin"}, # Mark, Spacing Combining
209 "Me" => $ctype{"defin"}, # Mark, Enclosing
210 "Nd" => $ctype{"defin"}|$ctype{"digit"}, # Number, Decimal Digit
211 "Nl" => $ctype{"defin"}|$ctype{"alpha"}, # Number, Letter
212 "No" => $ctype{"defin"}, # Number, Other
213 "Zs" => $ctype{"defin"}|$ctype{"space"}, # Separator, Space
214 "Zl" => $ctype{"defin"}|$ctype{"space"}, # Separator, Line
215 "Zp" => $ctype{"defin"}|$ctype{"space"}, # Separator, Paragraph
216 "Cc" => $ctype{"defin"}|$ctype{"cntrl"}, # Other, Control
217 "Cf" => $ctype{"defin"}|$ctype{"cntrl"}, # Other, Format
218 "Cs" => $ctype{"defin"}, # Other, Surrogate
219 "Co" => $ctype{"defin"}, # Other, Private Use
220 "Cn" => $ctype{"defin"}, # Other, Not Assigned
221 "Lm" => $ctype{"defin"}|$ctype{"alpha"}, # Letter, Modifier
222 "Lo" => $ctype{"defin"}|$ctype{"alpha"}, # Letter, Other
223 "Pc" => $ctype{"defin"}|$ctype{"punct"}, # Punctuation, Connector
224 "Pd" => $ctype{"defin"}|$ctype{"punct"}, # Punctuation, Dash
225 "Ps" => $ctype{"defin"}|$ctype{"punct"}, # Punctuation, Open
226 "Pe" => $ctype{"defin"}|$ctype{"punct"}, # Punctuation, Close
227 "Pi" => $ctype{"defin"}|$ctype{"punct"}, # Punctuation, Initial quote
228 "Pf" => $ctype{"defin"}|$ctype{"punct"}, # Punctuation, Final quote
229 "Po" => $ctype{"defin"}|$ctype{"punct"}, # Punctuation, Other
230 "Sm" => $ctype{"defin"}, # Symbol, Math
231 "Sc" => $ctype{"defin"}, # Symbol, Currency
232 "Sk" => $ctype{"defin"}, # Symbol, Modifier
233 "So" => $ctype{"defin"} # Symbol, Other
236 # a few characters need additional categories that cannot be determined automatically
237 my %special_categories =
239 "xdigit" => [ ord('0')..ord('9'),ord('A')..ord('F'),ord('a')..ord('f'),
240 0xff10..0xff19, 0xff21..0xff26, 0xff41..0xff46 ],
241 "space" => [ 0x09..0x0d, 0x85 ],
242 "blank" => [ 0x09, 0x20, 0xa0, 0x3000, 0xfeff ],
243 "cntrl" => [ 0x070f, 0x200c, 0x200d,
244 0x200e, 0x200f, 0x202a, 0x202b, 0x202c, 0x202d, 0x202e,
245 0x206a, 0x206b, 0x206c, 0x206d, 0x206e, 0x206f, 0xfeff,
246 0xfff9, 0xfffa, 0xfffb ],
247 "punct" => [ 0x24, 0x2b, 0x3c..0x3e, 0x5e, 0x60, 0x7c, 0x7e, 0xa2..0xbe,
248 0xd7, 0xf7 ],
249 "digit" => [ 0xb2, 0xb3, 0xb9 ],
250 "lower" => [ 0x2071, 0x207f ]
253 my %directions =
255 "L" => 1, # Left-to-Right
256 "LRE" => 15, # Left-to-Right Embedding
257 "LRO" => 15, # Left-to-Right Override
258 "R" => 2, # Right-to-Left
259 "AL" => 12, # Right-to-Left Arabic
260 "RLE" => 15, # Right-to-Left Embedding
261 "RLO" => 15, # Right-to-Left Override
262 "PDF" => 15, # Pop Directional Format
263 "EN" => 3, # European Number
264 "ES" => 4, # European Number Separator
265 "ET" => 5, # European Number Terminator
266 "AN" => 6, # Arabic Number
267 "CS" => 7, # Common Number Separator
268 "NSM" => 13, # Non-Spacing Mark
269 "BN" => 14, # Boundary Neutral
270 "B" => 8, # Paragraph Separator
271 "S" => 9, # Segment Separator
272 "WS" => 10, # Whitespace
273 "ON" => 11 # Other Neutrals
276 my %joining_types =
278 "U" => 0, # Non_Joining
279 "T" => 1, # Transparent
280 "R" => 2, # Right_Joining
281 "L" => 3, # Left_Joining
282 "D" => 4, # Dual_Joining
283 "C" => 5, # Join_Causing
286 my @cp2uni = ();
287 my @lead_bytes = ();
288 my @uni2cp = ();
289 my @unicode_defaults = ();
290 my @unicode_aliases = ();
291 my @tolower_table = ();
292 my @toupper_table = ();
293 my @digitmap_table = ();
294 my @compatmap_table = ();
295 my @category_table = (0) x 65536;
296 my @joining_table = (0) x 65536;
297 my @direction_table = ();
298 my @decomp_table = ();
299 my @compose_table = ();
301 my %joining_forms =
303 "isolated" => [],
304 "final" => [],
305 "initial" => [],
306 "medial" => []
309 ################################################################
310 # fetch a unicode.org file and open it
311 sub open_data_file($)
313 my $url = shift;
314 (my $name = $url) =~ s/^.*\///;
315 local *FILE;
316 unless (-f "data/$name")
318 print "Fetching $url...\n";
319 mkdir "data";
320 !system "wget", "-q", "-O", "data/$name", $url or die "cannot fetch $url";
322 open FILE, "<data/$name" or die "cannot open data/$name";
323 return *FILE;
326 ################################################################
327 # read in the defaults file
328 sub READ_DEFAULTS($)
330 my $filename = shift;
331 my $start;
333 # first setup a few default mappings
335 open DEFAULTS, "$filename" or die "Cannot open $filename";
336 print "Loading $filename\n";
337 while (<DEFAULTS>)
339 next if /^\#/; # skip comments
340 next if /^$/; # skip empty lines
341 if (/^(([0-9a-fA-F]+)(,[0-9a-fA-F]+)*)\s+([0-9a-fA-F]+|'.'|none)\s+(\#.*)?/)
343 my @src = map hex, split /,/,$1;
344 my $dst = $4;
345 my $comment = $5;
346 if ($#src > 0) { push @unicode_aliases, \@src; }
347 next if ($dst eq "none");
348 $dst = ($dst =~ /\'.\'/) ? ord substr($dst,1,1) : hex $dst;
349 foreach my $src (@src)
351 die "Duplicate value" if defined($unicode_defaults[$src]);
352 $unicode_defaults[$src] = $dst;
354 next;
356 die "Unrecognized line $_\n";
358 close DEFAULTS;
360 # now build mappings from the decomposition field of the Unicode database
362 my $UNICODE_DATA = open_data_file "$UNIDATA/UnicodeData.txt";
363 while (<$UNICODE_DATA>)
365 # Decode the fields ...
366 my ($code, $name, $cat, $comb, $bidi,
367 $decomp, $dec, $dig, $num, $mirror,
368 $oldname, $comment, $upper, $lower, $title) = split /;/;
369 my $dst;
370 my $src = hex $code;
372 die "unknown category $cat" unless defined $categories{$cat};
373 die "unknown directionality $bidi" unless defined $directions{$bidi};
375 $category_table[$src] = $categories{$cat};
376 $direction_table[$src] = $directions{$bidi};
377 $joining_table[$src] = $joining_types{"T"} if $cat eq "Mn" || $cat eq "Me" || $cat eq "Cf";
379 if ($lower ne "")
381 $tolower_table[$src] = hex $lower;
383 if ($upper ne "")
385 $toupper_table[$src] = hex $upper;
387 if ($dec ne "")
389 $category_table[$src] |= $ctype{"digit"};
391 if ($dig ne "")
393 $digitmap_table[$src] = ord $dig;
396 # copy the category and direction for everything between First/Last pairs
397 if ($name =~ /, First>/) { $start = $src; }
398 if ($name =~ /, Last>/)
400 while ($start < $src)
402 $category_table[$start] = $category_table[$src];
403 $direction_table[$start] = $direction_table[$src];
404 $start++;
408 next if $decomp eq ""; # no decomposition, skip it
410 if ($decomp =~ /^<([a-zA-Z]+)>\s+([0-9a-fA-F]+)$/)
412 # decomposition of the form "<foo> 1234" -> use char if type is known
413 if (($src >= 0xf900 && $src < 0xfb00) || ($src >= 0xfe30 && $src < 0xfffd))
415 # Single char decomposition in the compatibility range
416 $compatmap_table[$src] = hex $2;
418 if ($1 eq "isolated" || $1 eq "final" || $1 eq "initial" || $1 eq "medial")
420 ${joining_forms{$1}}[hex $2] = $src;
421 next;
423 next unless ($1 eq "font" ||
424 $1 eq "noBreak" ||
425 $1 eq "circle" ||
426 $1 eq "super" ||
427 $1 eq "sub" ||
428 $1 eq "wide" ||
429 $1 eq "narrow" ||
430 $1 eq "compat" ||
431 $1 eq "small");
432 $dst = hex $2;
434 elsif ($decomp =~ /^<compat>\s+0020\s+([0-9a-fA-F]+)/)
436 # decomposition "<compat> 0020 1234" -> combining accent
437 $dst = hex $1;
439 elsif ($decomp =~ /^([0-9a-fA-F]+)/)
441 # decomposition contains only char values without prefix -> use first char
442 $dst = hex $1;
443 $category_table[$src] |= $category_table[$dst] if defined $category_table[$dst];
444 # store decomposition if it contains two chars
445 if ($decomp =~ /^([0-9a-fA-F]+)\s+([0-9a-fA-F]+)$/)
447 $decomp_table[$src] = [ hex $1, hex $2 ];
448 push @compose_table, [ hex $1, hex $2, $src ];
450 elsif ($decomp =~ /^(<[a-z]+>\s)*([0-9a-fA-F]+)$/ &&
451 (($src >= 0xf900 && $src < 0xfb00) || ($src >= 0xfe30 && $src < 0xfffd)))
453 # Single char decomposition in the compatibility range
454 $compatmap_table[$src] = hex $2;
457 else
459 next;
462 next if defined($unicode_defaults[$src]); # may have been set in the defaults file
464 # check for loops
465 for (my $i = $dst; ; $i = $unicode_defaults[$i])
467 die sprintf("loop detected for %04x -> %04x",$src,$dst) if $i == $src;
468 last unless defined($unicode_defaults[$i]);
470 $unicode_defaults[$src] = $dst;
472 close $UNICODE_DATA;
474 # patch the category of some special characters
476 foreach my $cat (keys %special_categories)
478 my $flag = $ctype{$cat};
479 foreach my $i (@{$special_categories{$cat}}) { $category_table[$i] |= $flag; }
484 ################################################################
485 # parse the input file
486 sub READ_FILE($)
488 my $name = shift;
489 my $INPUT = open_data_file $name;
491 while (<$INPUT>)
493 next if /^\#/; # skip comments
494 next if /^$/; # skip empty lines
495 next if /\x1a/; # skip ^Z
496 next if (/^0x([0-9a-fA-F]+)\s+\#UNDEFINED/); # undefined char
498 if (/^0x([0-9a-fA-F]+)\s+\#DBCS LEAD BYTE/)
500 my $cp = hex $1;
501 push @lead_bytes,$cp;
502 $cp2uni[$cp] = 0;
503 next;
505 if (/^0x([0-9a-fA-F]+)\s+0x([0-9a-fA-F]+)\s+(\#.*)?/)
507 my $cp = hex $1;
508 my $uni = hex $2;
509 $cp2uni[$cp] = $uni unless defined($cp2uni[$cp]);
510 $uni2cp[$uni] = $cp unless defined($uni2cp[$uni]);
511 if ($cp > 0xff && !defined($cp2uni[$cp >> 8]))
513 push @lead_bytes,$cp >> 8;
514 $cp2uni[$cp >> 8] = 0;
516 next;
518 die "$name: Unrecognized line $_\n";
520 close $INPUT;
524 ################################################################
525 # fill input data for the 20127 (us-ascii) codepage
526 sub fill_20127_codepage()
528 for (my $i = 0; $i < 128; $i++) { $cp2uni[$i] = $uni2cp[$i] = $i; }
529 for (my $i = 128; $i < 256; $i++) { $cp2uni[$i] = $i & 0x7f; }
532 ################################################################
533 # get a mapping including glyph chars for MB_USEGLYPHCHARS
535 sub get_glyphs_mapping(@)
537 $_[0x01] = 0x263a; # (WHITE SMILING FACE)
538 $_[0x02] = 0x263b; # (BLACK SMILING FACE)
539 $_[0x03] = 0x2665; # (BLACK HEART SUIT)
540 $_[0x04] = 0x2666; # (BLACK DIAMOND SUIT)
541 $_[0x05] = 0x2663; # (BLACK CLUB SUIT)
542 $_[0x06] = 0x2660; # (BLACK SPADE SUIT)
543 $_[0x07] = 0x2022; # (BULLET)
544 $_[0x08] = 0x25d8; # (INVERSE BULLET)
545 $_[0x09] = 0x25cb; # (WHITE CIRCLE)
546 $_[0x0a] = 0x25d9; # (INVERSE WHITE CIRCLE)
547 $_[0x0b] = 0x2642; # (MALE SIGN)
548 $_[0x0c] = 0x2640; # (FEMALE SIGN)
549 $_[0x0d] = 0x266a; # (EIGHTH NOTE)
550 $_[0x0e] = 0x266b; # (BEAMED EIGHTH NOTES)
551 $_[0x0f] = 0x263c; # (WHITE SUN WITH RAYS)
552 $_[0x10] = 0x25ba; # (BLACK RIGHT-POINTING POINTER)
553 $_[0x11] = 0x25c4; # (BLACK LEFT-POINTING POINTER)
554 $_[0x12] = 0x2195; # (UP DOWN ARROW)
555 $_[0x13] = 0x203c; # (DOUBLE EXCLAMATION MARK)
556 $_[0x14] = 0x00b6; # (PILCROW SIGN)
557 $_[0x15] = 0x00a7; # (SECTION SIGN)
558 $_[0x16] = 0x25ac; # (BLACK RECTANGLE)
559 $_[0x17] = 0x21a8; # (UP DOWN ARROW WITH BASE)
560 $_[0x18] = 0x2191; # (UPWARDS ARROW)
561 $_[0x19] = 0x2193; # (DOWNWARDS ARROW)
562 $_[0x1a] = 0x2192; # (RIGHTWARDS ARROW)
563 $_[0x1b] = 0x2190; # (LEFTWARDS ARROW)
564 $_[0x1c] = 0x221f; # (RIGHT ANGLE)
565 $_[0x1d] = 0x2194; # (LEFT RIGHT ARROW)
566 $_[0x1e] = 0x25b2; # (BLACK UP-POINTING TRIANGLE)
567 $_[0x1f] = 0x25bc; # (BLACK DOWN-POINTING TRIANGLE)
568 $_[0x7f] = 0x2302; # (HOUSE)
569 return @_;
572 ################################################################
573 # build EUC-JP table from the JIS 0208 file
574 # FIXME: for proper EUC-JP we should probably read JIS 0212 too
575 # but this would require 3-byte DBCS characters
576 sub READ_JIS0208_FILE($)
578 my $name = shift;
580 # ASCII chars
581 for (my $i = 0x00; $i <= 0x7f; $i++)
583 $cp2uni[$i] = $i;
584 $uni2cp[$i] = $i;
587 # JIS X 0201 right plane
588 for (my $i = 0xa1; $i <= 0xdf; $i++)
590 $cp2uni[0x8e00 + $i] = 0xfec0 + $i;
591 $uni2cp[0xfec0 + $i] = 0x8e00 + $i;
594 # lead bytes
595 foreach my $i (0x8e, 0x8f, 0xa1 .. 0xfe)
597 push @lead_bytes,$i;
598 $cp2uni[$i] = 0;
601 # undefined chars
602 foreach my $i (0x80 .. 0x8d, 0x90 .. 0xa0, 0xff)
604 $cp2uni[$i] = $DEF_CHAR;
607 # Shift-JIS compatibility
608 $uni2cp[0x00a5] = 0x5c;
609 $uni2cp[0x203e] = 0x7e;
611 # Fix backslash conversion
612 $cp2uni[0xa1c0] = 0xff3c;
613 $uni2cp[0xff3c] = 0xa1c0;
615 my $INPUT = open_data_file $name;
616 while (<$INPUT>)
618 next if /^\#/; # skip comments
619 next if /^$/; # skip empty lines
620 next if /\x1a/; # skip ^Z
621 if (/^0x[0-9a-fA-F]+\s+0x([0-9a-fA-F]+)\s+0x([0-9a-fA-F]+)\s+(\#.*)?/)
623 my $cp = 0x8080 + hex $1;
624 my $uni = hex $2;
625 $cp2uni[$cp] = $uni unless defined($cp2uni[$cp]);
626 $uni2cp[$uni] = $cp unless defined($uni2cp[$uni]);
627 next;
629 die "$name: Unrecognized line $_\n";
631 close $INPUT;
635 ################################################################
636 # build the sort keys table
637 sub READ_SORTKEYS_FILE()
639 my @sortkeys = ();
640 for (my $i = 0; $i < 65536; $i++) { $sortkeys[$i] = [ -1, 0, 0, 0, 0 ] };
642 my $INPUT = open_data_file $SORTKEYS;
643 while (<$INPUT>)
645 next if /^\#/; # skip comments
646 next if /^$/; # skip empty lines
647 next if /\x1a/; # skip ^Z
648 next if /^\@version/; # skip @version header
649 if (/^([0-9a-fA-F]+)\s+;\s+\[([*.])([0-9a-fA-F]{4})\.([0-9a-fA-F]{4})\.([0-9a-fA-F]{4})\.([0-9a-fA-F]+)\]/)
651 my ($uni,$variable) = (hex $1, $2);
652 next if $uni > 65535;
653 $sortkeys[$uni] = [ $uni, hex $3, hex $4, hex $5, hex $6 ];
654 next;
656 if (/^([0-9a-fA-F]+\s+)+;\s+\[[*.]([0-9a-fA-F]{4})\.([0-9a-fA-F]{4})\.([0-9a-fA-F]{4})\.([0-9a-fA-F]+)\]/)
658 # multiple character sequence, ignored for now
659 next;
661 die "$SORTKEYS: Unrecognized line $_\n";
663 close $INPUT;
665 # compress the keys to 32 bit:
666 # key 1 to 16 bits, key 2 to 8 bits, key 3 to 4 bits, key 4 to 1 bit
668 @sortkeys = sort { ${$a}[1] <=> ${$b}[1] or
669 ${$a}[2] <=> ${$b}[2] or
670 ${$a}[3] <=> ${$b}[3] or
671 ${$a}[4] <=> ${$b}[4] or
672 $a cmp $b; } @sortkeys;
674 my ($n2, $n3) = (1, 1);
675 my @keys = (-1, -1, -1, -1, -1 );
676 my @flatkeys = ();
678 for (my $i = 0; $i < 65536; $i++)
680 my @current = @{$sortkeys[$i]};
681 next if $current[0] == -1;
682 if ($current[1] == $keys[1])
684 if ($current[2] == $keys[2])
686 if ($current[3] == $keys[3])
688 # nothing
690 else
692 $keys[3] = $current[3];
693 $n3++;
694 die if ($n3 >= 16);
697 else
699 $keys[2] = $current[2];
700 $keys[3] = $current[3];
701 $n2++;
702 $n3 = 1;
703 die if ($n2 >= 256);
706 else
708 $keys[1] = $current[1];
709 $keys[2] = $current[2];
710 $keys[3] = $current[3];
711 $n2 = 1;
712 $n3 = 1;
715 if ($current[2]) { $current[2] = $n2; }
716 if ($current[3]) { $current[3] = $n3; }
717 if ($current[4]) { $current[4] = 1; }
719 $flatkeys[$current[0]] = ($current[1] << 16) | ($current[2] << 8) | ($current[3] << 4) | $current[4];
721 return @flatkeys;
725 ################################################################
726 # build the sort keys table
727 sub DUMP_SORTKEYS($@)
729 my ($filename, @keys) = @_;
731 # count the number of 256-key ranges that contain something
733 my @offsets = ();
734 my $ranges = 2;
735 for (my $i = 0; $i < 256; $i++) { $offsets[$i] = 256; }
736 for (my $i = 0; $i < 65536; $i++)
738 next unless defined $keys[$i];
739 $offsets[$i >> 8] = $ranges * 256;
740 $ranges++;
741 $i |= 255;
744 # output the range offsets
746 open OUTPUT,">$filename.new" or die "Cannot create $filename";
747 printf "Building $filename\n";
748 printf OUTPUT "/* Unicode collation element table */\n";
749 printf OUTPUT "/* generated from %s */\n", $SORTKEYS;
750 printf OUTPUT "/* DO NOT EDIT!! */\n\n";
752 printf OUTPUT "const unsigned int collation_table[%d] =\n{\n", $ranges*256;
753 printf OUTPUT " /* index */\n";
754 printf OUTPUT "%s,\n", DUMP_ARRAY( "0x%08x", 0, @offsets );
756 # output the default values
758 printf OUTPUT " /* defaults */\n";
759 printf OUTPUT "%s", DUMP_ARRAY( "0x%08x", 0, (0xffffffff) x 256 );
761 # output all the key ranges
763 for (my $i = 0; $i < 256; $i++)
765 next if $offsets[$i] == 256;
766 printf OUTPUT ",\n /* 0x%02x00 .. 0x%02xff */\n", $i, $i;
767 printf OUTPUT "%s", DUMP_ARRAY( "0x%08x", 0xffffffff, @keys[($i<<8) .. ($i<<8)+255] );
769 printf OUTPUT "\n};\n";
770 close OUTPUT;
771 save_file($filename);
775 ################################################################
776 # add default mappings once the file had been read
777 sub ADD_DEFAULT_MAPPINGS()
779 # Apply aliases
781 foreach my $alias (@unicode_aliases)
783 my $target = undef;
784 foreach my $src (@$alias)
786 if (defined($uni2cp[$src]))
788 $target = $uni2cp[$src];
789 last;
792 next unless defined($target);
794 # At least one char of the alias set is defined, set the others to the same value
795 foreach my $src (@$alias)
797 $uni2cp[$src] = $target unless defined($uni2cp[$src]);
801 # For every src -> target mapping in the defaults table,
802 # make uni2cp[src] = uni2cp[target] if uni2cp[target] is defined
804 for (my $src = 0; $src < 65536; $src++)
806 next if defined($uni2cp[$src]); # source has a definition already
807 next unless defined($unicode_defaults[$src]); # no default for this char
808 my $target = $unicode_defaults[$src];
810 # do a recursive mapping until we find a target char that is defined
811 while (!defined($uni2cp[$target]) &&
812 defined($unicode_defaults[$target])) { $target = $unicode_defaults[$target]; }
814 if (defined($uni2cp[$target])) { $uni2cp[$src] = $uni2cp[$target]; }
817 # Add an identity mapping for all undefined chars
819 for (my $i = 0; $i < 256; $i++)
821 next if defined($cp2uni[$i]);
822 next if defined($uni2cp[$i]);
823 $cp2uni[$i] = $uni2cp[$i] = $i;
827 ################################################################
828 # dump an array of integers
829 sub DUMP_ARRAY($$@)
831 my ($format,$default,@array) = @_;
832 my $i;
833 my $ret = " ";
834 for ($i = 0; $i < $#array; $i++)
836 $ret .= sprintf($format, defined $array[$i] ? $array[$i] : $default);
837 $ret .= (($i % 8) != 7) ? ", " : ",\n ";
839 $ret .= sprintf($format, defined $array[$i] ? $array[$i] : $default);
840 return $ret;
843 ################################################################
844 # dump an SBCS mapping table
845 sub dump_sbcs_table($$$$$)
847 my ($codepage, $has_glyphs, $name, $def, $defw) = @_;
848 my $i;
850 # output the ascii->unicode table
852 if ($has_glyphs)
854 printf OUTPUT "static const WCHAR cp2uni[512] =\n";
855 printf OUTPUT "{\n%s", DUMP_ARRAY( "0x%04x", $defw, @cp2uni[0 .. 255] );
856 printf OUTPUT ",\n /* glyphs */\n%s\n};\n\n",
857 DUMP_ARRAY( "0x%04x", $defw, get_glyphs_mapping(@cp2uni[0 .. 255]) );
859 else
861 printf OUTPUT "static const WCHAR cp2uni[256] =\n";
862 printf OUTPUT "{\n%s\n};\n\n", DUMP_ARRAY( "0x%04x", $defw, @cp2uni[0 .. 255] );
865 # count the number of unicode->ascii subtables that contain something
867 my @filled = ();
868 my $subtables = 1;
869 for (my $i = 0; $i < 65536; $i++)
871 next unless defined $uni2cp[$i];
872 $filled[$i >> 8] = 1;
873 $subtables++;
874 $i |= 255;
877 # output all the subtables into a single array
879 printf OUTPUT "static const unsigned char uni2cp_low[%d] =\n{\n", $subtables*256;
880 for (my $i = 0; $i < 256; $i++)
882 next unless $filled[$i];
883 printf OUTPUT " /* 0x%02x00 .. 0x%02xff */\n", $i, $i;
884 printf OUTPUT "%s,\n", DUMP_ARRAY( "0x%02x", $def, @uni2cp[($i<<8) .. ($i<<8)+255] );
886 printf OUTPUT " /* defaults */\n";
887 printf OUTPUT "%s\n};\n\n", DUMP_ARRAY( "0x%02x", 0, ($def) x 256 );
889 # output a table of the offsets of the subtables in the previous array
891 my $pos = 0;
892 my @offsets = ();
893 for (my $i = 0; $i < 256; $i++)
895 if ($filled[$i]) { push @offsets, $pos; $pos += 256; }
896 else { push @offsets, ($subtables-1) * 256; }
898 printf OUTPUT "static const unsigned short uni2cp_high[256] =\n";
899 printf OUTPUT "{\n%s\n};\n\n", DUMP_ARRAY( "0x%04x", 0, @offsets );
901 # output the code page descriptor
903 printf OUTPUT "const struct sbcs_table cptable_%03d =\n{\n", $codepage;
904 printf OUTPUT " { %d, 1, 0x%04x, 0x%04x, \"%s\" },\n",
905 $codepage, $def, $defw, $name;
906 printf OUTPUT " cp2uni,\n";
907 if ($has_glyphs) { printf OUTPUT " cp2uni + 256,\n"; }
908 else { printf OUTPUT " cp2uni,\n"; }
909 printf OUTPUT " uni2cp_low,\n";
910 printf OUTPUT " uni2cp_high\n};\n";
914 ################################################################
915 # dump a DBCS mapping table
916 sub dump_dbcs_table($$$$@)
918 my ($codepage, $name, $def, $defw, @lb_ranges) = @_;
920 # build a list of lead bytes that are actually used
922 my @lblist = ();
923 LBLOOP: for (my $y = 0; $y <= $#lead_bytes; $y++)
925 my $base = $lead_bytes[$y] << 8;
926 for (my $x = 0; $x < 256; $x++)
928 if (defined $cp2uni[$base+$x])
930 push @lblist,$lead_bytes[$y];
931 next LBLOOP;
935 my $unused = ($#lead_bytes > $#lblist);
937 # output the ascii->unicode table for the single byte chars
939 printf OUTPUT "static const WCHAR cp2uni[%d] =\n", 256 * ($#lblist + 2 + $unused);
940 printf OUTPUT "{\n%s,\n", DUMP_ARRAY( "0x%04x", $defw, @cp2uni[0 .. 255] );
942 # output the default table for unused lead bytes
944 if ($unused)
946 printf OUTPUT " /* unused lead bytes */\n";
947 printf OUTPUT "%s,\n", DUMP_ARRAY( "0x%04x", 0, ($defw) x 256 );
950 # output the ascii->unicode table for each DBCS lead byte
952 for (my $y = 0; $y <= $#lblist; $y++)
954 my $base = $lblist[$y] << 8;
955 printf OUTPUT " /* lead byte %02x */\n", $lblist[$y];
956 printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", $defw, @cp2uni[$base .. $base+255] );
957 printf OUTPUT ($y < $#lblist) ? ",\n" : "\n};\n\n";
960 # output the lead byte subtables offsets
962 my @offsets = ();
963 for (my $x = 0; $x < 256; $x++) { $offsets[$x] = 0; }
964 for (my $x = 0; $x <= $#lblist; $x++) { $offsets[$lblist[$x]] = $x + 1; }
965 if ($unused)
967 # increment all lead bytes offset to take into account the unused table
968 for (my $x = 0; $x <= $#lead_bytes; $x++) { $offsets[$lead_bytes[$x]]++; }
970 printf OUTPUT "static const unsigned char cp2uni_leadbytes[256] =\n";
971 printf OUTPUT "{\n%s\n};\n\n", DUMP_ARRAY( "0x%02x", 0, @offsets );
973 # count the number of unicode->ascii subtables that contain something
975 my @filled = ();
976 my $subtables = 1;
977 for (my $i = 0; $i < 65536; $i++)
979 next unless defined $uni2cp[$i];
980 $filled[$i >> 8] = 1;
981 $subtables++;
982 $i |= 255;
985 # output all the subtables into a single array
987 printf OUTPUT "static const unsigned short uni2cp_low[%d] =\n{\n", $subtables*256;
988 for (my $y = 0; $y < 256; $y++)
990 next unless $filled[$y];
991 printf OUTPUT " /* 0x%02x00 .. 0x%02xff */\n", $y, $y;
992 printf OUTPUT "%s,\n", DUMP_ARRAY( "0x%04x", $def, @uni2cp[($y<<8) .. ($y<<8)+255] );
994 printf OUTPUT " /* defaults */\n";
995 printf OUTPUT "%s\n};\n\n", DUMP_ARRAY( "0x%04x", 0, ($def) x 256 );
997 # output a table of the offsets of the subtables in the previous array
999 my $pos = 0;
1000 @offsets = ();
1001 for (my $y = 0; $y < 256; $y++)
1003 if ($filled[$y]) { push @offsets, $pos; $pos += 256; }
1004 else { push @offsets, ($subtables-1) * 256; }
1006 printf OUTPUT "static const unsigned short uni2cp_high[256] =\n";
1007 printf OUTPUT "{\n%s\n};\n\n", DUMP_ARRAY( "0x%04x", 0, @offsets );
1009 # output the code page descriptor
1011 printf OUTPUT "const struct dbcs_table cptable_%03d =\n{\n", $codepage;
1012 printf OUTPUT " { %d, 2, 0x%04x, 0x%04x, \"%s\" },\n",
1013 $codepage, $def, $defw, $name;
1014 printf OUTPUT " cp2uni,\n";
1015 printf OUTPUT " cp2uni_leadbytes,\n";
1016 printf OUTPUT " uni2cp_low,\n";
1017 printf OUTPUT " uni2cp_high,\n";
1018 printf OUTPUT " {\n %s\n }\n", DUMP_ARRAY( "0x%02x", 0, @lb_ranges, 0, 0 );
1019 printf OUTPUT "};\n";
1023 ################################################################
1024 # get the list of defined lead byte ranges
1025 sub get_lb_ranges()
1027 my @list = ();
1028 my @ranges = ();
1029 my $i = 0;
1030 foreach $i (@lead_bytes) { $list[$i] = 1; }
1031 my $on = 0;
1032 for (my $i = 0; $i < 256; $i++)
1034 if ($on)
1036 if (!defined $list[$i]) { push @ranges, $i-1; $on = 0; }
1038 else
1040 if ($list[$i]) { push @ranges, $i; $on = 1; }
1043 if ($on) { push @ranges, 0xff; }
1044 return @ranges;
1047 ################################################################
1048 # dump the Indic Syllabic Category table
1049 sub dump_indic($)
1051 my $filename = shift;
1052 my @indic_table = ($indic_types{'Other'}) x 65536;;
1054 my $INPUT = open_data_file "$UNIDATA/IndicSyllabicCategory.txt";
1055 while (<$INPUT>)
1057 next if /^\#/; # skip comments
1058 next if /^\s*$/; # skip empty lines
1059 next if /\x1a/; # skip ^Z
1060 if (/^\s*([0-9a-fA-F]+)\s*;\s*([a-zA-Z_]+)\s*#/)
1062 my $type = $2;
1063 die "unknown indic $type" unless defined $indic_types{$type};
1064 if (hex $1 < 65536)
1066 $indic_table[hex $1] = $indic_types{$type};
1068 next;
1070 elsif (/^\s*([0-9a-fA-F]+)..\s*([0-9a-fA-F]+)\s*;\s*([A-Za-z_]+)\s*#/)
1072 my $type = $3;
1073 die "unknown indic $type" unless defined $indic_types{$type};
1074 if (hex $1 < 65536 and hex $2 < 6536)
1076 foreach my $i (hex $1 .. hex $2)
1078 $indic_table[$i] = $indic_types{$type};
1081 next;
1083 die "malformed line $_";
1085 close $INPUT;
1087 $INPUT = open_data_file "$UNIDATA/IndicMatraCategory.txt";
1088 while (<$INPUT>)
1090 next if /^\#/; # skip comments
1091 next if /^\s*$/; # skip empty lines
1092 next if /\x1a/; # skip ^Z
1093 if (/^\s*([0-9a-fA-F]+)\s*;\s*([a-zA-Z]+)\s*#/)
1095 my $type = $2;
1096 die "unknown matra $type" unless defined $matra_types{$type};
1097 $indic_table[hex $1] += $matra_types{$type} << 8;
1098 next;
1100 elsif (/^\s*([0-9a-fA-F]+)..\s*([0-9a-fA-F]+)\s*;\s*([A-Za-z_]+)\s*#/)
1102 my $type = $3;
1103 die "unknown matra $type" unless defined $matra_types{$type};
1104 foreach my $i (hex $1 .. hex $2)
1106 $indic_table[$i] += $matra_types{$type} << 8;
1108 next;
1110 die "malformed line $_";
1112 close $INPUT;
1114 open OUTPUT,">$filename.new" or die "Cannot create $filename";
1115 print "Building $filename\n";
1116 print OUTPUT "/* Unicode Indic Syllabic Category */\n";
1117 print OUTPUT "/* generated from $UNIDATA/IndicSyllabicCategory.txt */\n";
1118 print OUTPUT "/* and from $UNIDATA/IndicMatraCategory.txt */\n";
1119 print OUTPUT "/* DO NOT EDIT!! */\n\n";
1120 print OUTPUT "#include \"wine/unicode.h\"\n\n";
1122 dump_two_level_mapping( "indic_syllabic_table", @indic_table);
1124 close OUTPUT;
1125 save_file($filename);
1128 ################################################################
1129 # dump the Line Break Properties table
1130 sub dump_linebreak($)
1132 my $filename = shift;
1133 my @break_table = ($break_types{'XX'}) x 65536;;
1134 my $next_group = 0;
1136 my $INPUT = open_data_file "$UNIDATA/LineBreak.txt";
1137 while (<$INPUT>)
1139 next if /^\#/; # skip comments
1140 next if /^\s*$/; # skip empty lines
1141 next if /\x1a/; # skip ^Z
1142 if (/^\s*([0-9a-fA-F]+)\s*;\s*([0-9A-Z][0-9A-Z])+\s*/)
1144 my $type = $2;
1145 die "unknown breaktype $type" unless defined $break_types{$type};
1146 $break_table[hex $1] = $break_types{$type};
1147 next;
1149 elsif (/^\s*([0-9a-fA-F]+)..\s*([0-9a-fA-F]+)\s*;\s*([0-9A-Z][0-9A-Z])+\s*/)
1151 my $type = $3;
1152 die "unknown breaktype $type" unless defined $break_types{$type};
1153 foreach my $i (hex $1 .. hex $2)
1155 $break_table[$i] = $break_types{$type};
1157 next;
1159 die "malformed line $_";
1161 close $INPUT;
1163 open OUTPUT,">$filename.new" or die "Cannot create $filename";
1164 print "Building $filename\n";
1165 print OUTPUT "/* Unicode Line Break Properties */\n";
1166 print OUTPUT "/* generated from $UNIDATA/LineBreak.txt */\n";
1167 print OUTPUT "/* DO NOT EDIT!! */\n\n";
1168 print OUTPUT "#include \"wine/unicode.h\"\n\n";
1170 dump_two_level_mapping( "wine_linebreak_table", @break_table);
1172 close OUTPUT;
1173 save_file($filename);
1177 ################################################################
1178 # dump the BiDi mirroring table
1179 sub dump_mirroring($)
1181 my $filename = shift;
1182 my @mirror_table = ();
1184 my $INPUT = open_data_file "$UNIDATA/BidiMirroring.txt";
1185 while (<$INPUT>)
1187 next if /^\#/; # skip comments
1188 next if /^$/; # skip empty lines
1189 next if /\x1a/; # skip ^Z
1190 if (/^\s*([0-9a-fA-F]+)\s*;\s*([0-9a-fA-F]+)/)
1192 $mirror_table[hex $1] = hex $2;
1193 next;
1195 die "malformed line $_";
1197 close $INPUT;
1199 open OUTPUT,">$filename.new" or die "Cannot create $filename";
1200 print "Building $filename\n";
1201 print OUTPUT "/* Unicode BiDi mirroring */\n";
1202 print OUTPUT "/* generated from $UNIDATA/BidiMirroring.txt */\n";
1203 print OUTPUT "/* DO NOT EDIT!! */\n\n";
1204 print OUTPUT "#include \"wine/unicode.h\"\n\n";
1205 DUMP_CASE_TABLE( "wine_mirror_map", @mirror_table );
1206 close OUTPUT;
1207 save_file($filename);
1211 ################################################################
1212 # dump the Arabic shaping table
1213 sub dump_shaping($)
1215 my $filename = shift;
1216 my %groups;
1217 my $next_group = 0;
1219 $groups{"No_Joining_Group"} = $next_group++;
1221 my $INPUT = open_data_file "$UNIDATA/ArabicShaping.txt";
1222 while (<$INPUT>)
1224 next if /^\#/; # skip comments
1225 next if /^\s*$/; # skip empty lines
1226 next if /\x1a/; # skip ^Z
1227 if (/^\s*([0-9a-fA-F]+)\s*;.*;\s*([RLDCUT])\s*;\s*(\w+)/)
1229 my $type = $2;
1230 my $group = $3;
1231 $groups{$group} = $next_group++ unless defined $groups{$group};
1232 $joining_table[hex $1] = $joining_types{$type} | ($groups{$group} << 8);
1233 next;
1235 die "malformed line $_";
1237 close $INPUT;
1239 open OUTPUT,">$filename.new" or die "Cannot create $filename";
1240 print "Building $filename\n";
1241 print OUTPUT "/* Unicode Arabic shaping */\n";
1242 print OUTPUT "/* generated from $UNIDATA/ArabicShaping.txt */\n";
1243 print OUTPUT "/* DO NOT EDIT!! */\n\n";
1244 print OUTPUT "#include \"wine/unicode.h\"\n\n";
1246 dump_two_level_mapping( "wine_shaping_table", @joining_table );
1248 print OUTPUT "\nconst unsigned short wine_shaping_forms[256][4] =\n{\n";
1249 for (my $i = 0x600; $i <= 0x6ff; $i++)
1251 printf OUTPUT " { 0x%04x, 0x%04x, 0x%04x, 0x%04x },\n",
1252 ${joining_forms{"isolated"}}[$i] || $i,
1253 ${joining_forms{"final"}}[$i] || $i,
1254 ${joining_forms{"initial"}}[$i] || $i,
1255 ${joining_forms{"medial"}}[$i] || $i;
1257 print OUTPUT "};\n";
1259 close OUTPUT;
1260 save_file($filename);
1264 ################################################################
1265 # dump the case mapping tables
1266 sub DUMP_CASE_MAPPINGS($)
1268 my $filename = shift;
1269 open OUTPUT,">$filename.new" or die "Cannot create $filename";
1270 printf "Building $filename\n";
1271 printf OUTPUT "/* Unicode case mappings */\n";
1272 printf OUTPUT "/* Automatically generated; DO NOT EDIT!! */\n\n";
1273 printf OUTPUT "#include \"wine/unicode.h\"\n\n";
1275 DUMP_CASE_TABLE( "wine_casemap_lower", @tolower_table );
1276 DUMP_CASE_TABLE( "wine_casemap_upper", @toupper_table );
1277 DUMP_CASE_TABLE( "wine_digitmap", @digitmap_table );
1278 DUMP_CASE_TABLE( "wine_compatmap", @compatmap_table );
1279 close OUTPUT;
1280 save_file($filename);
1284 ################################################################
1285 # dump a case mapping table
1286 sub DUMP_CASE_TABLE($@)
1288 my ($name,@table) = @_;
1290 # count the number of sub tables that contain something
1291 # also compute the low and upper populated bounds
1293 my @lowerbounds = ( 0, 0 );
1294 my @upperbounds = ( 0, 255 );
1295 my $index = 0;
1296 my @filled = ();
1297 for (my $i = 0; $i < 65536; $i++)
1299 next unless defined $table[$i];
1300 if (!defined $filled[$i >> 8])
1302 $lowerbounds[$index] = $i & 0xff;
1303 $upperbounds[$index] = 0xff - $lowerbounds[$index];
1304 $filled[$i >> 8] = $index * 256 + 512;
1305 $index++;
1307 else
1309 $upperbounds[$index-1] = 0xff - ($i & 0xff);
1311 $table[$i] = ($table[$i] - $i) & 0xffff;
1314 # Collapse blocks upwards if possible
1315 my $removed = 0;
1316 $index = 0;
1317 for (my $i = 0; $i < 256; $i++)
1319 next unless defined $filled[$i];
1320 if ($upperbounds[$index - 1] > $lowerbounds[$index])
1322 $removed = $removed + $lowerbounds[$index];
1324 else
1326 $removed = $removed + $upperbounds[$index - 1];
1327 $lowerbounds[$index] = $upperbounds[$index - 1];
1329 $filled[$i] = $filled[$i] - $removed;
1330 $index++;
1333 # dump the table
1335 printf OUTPUT "const WCHAR %s[%d] =\n", $name, $index * 256 + 512 - $removed;
1336 printf OUTPUT "{\n /* index */\n";
1337 printf OUTPUT "%s,\n", DUMP_ARRAY( "0x%04x", 256, @filled );
1338 printf OUTPUT " /* defaults */\n";
1339 printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0, (0) x 256 );
1340 $index = 0;
1341 for (my $i = 0; $i < 256; $i++)
1343 next unless $filled[$i];
1344 printf OUTPUT ",\n /* 0x%02x%02x .. 0x%02xff */\n", $i, $lowerbounds[$index], $i;
1345 printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0,
1346 @table[($i<<8) + $lowerbounds[$index] .. ($i<<8)+255] );
1347 $index++;
1349 printf OUTPUT "\n};\n";
1352 ################################################################
1353 # compress a mapping table by removing identical rows
1354 sub compress_array($@)
1356 my $rows = shift;
1357 my @table = @_;
1358 my $len = @table / $rows;
1359 my @array = (0) x $rows;
1360 my %sequences;
1362 # try to merge table rows
1363 for (my $row = 0; $row < $rows; $row++)
1365 my $rowtxt = pack "S*", @table[($row * $len)..($row * $len + $len - 1)];
1366 if (defined($sequences{$rowtxt}))
1368 # reuse an existing row
1369 $array[$row] = $sequences{$rowtxt};
1371 else
1373 # create a new row
1374 $sequences{$rowtxt} = $array[$row] = $#array + 1;
1375 push @array, @table[$row * $len..$row * $len + $len - 1];
1378 return @array;
1381 ################################################################
1382 # dump a simple char -> 16-bit value mapping table
1383 sub dump_simple_mapping($@)
1385 my $name = shift;
1386 my @array = compress_array( 256, @_[0..65535] );
1388 printf OUTPUT "const unsigned short %s[%d] =\n{\n", $name, $#array+1;
1389 printf OUTPUT " /* offsets */\n%s,\n", DUMP_ARRAY( "0x%04x", 0, @array[0..255] );
1390 printf OUTPUT " /* values */\n%s\n};\n", DUMP_ARRAY( "0x%04x", 0, @array[256..$#array] );
1393 ################################################################
1394 # dump a char -> 16-bit value mapping table using two-level tables
1395 sub dump_two_level_mapping($@)
1397 my $name = shift;
1398 my @row_array = compress_array( 4096, @_[0..65535] );
1399 my @array = compress_array( 256, @row_array[0..4095] );
1401 for (my $i = 256; $i < @array; $i++) { $array[$i] += @array - 4096; }
1403 printf OUTPUT "const unsigned short %s[%d] =\n{\n", $name, @array + @row_array - 4096;
1404 printf OUTPUT " /* level 1 offsets */\n%s,\n", DUMP_ARRAY( "0x%04x", 0, @array[0..255] );
1405 printf OUTPUT " /* level 2 offsets */\n%s,\n", DUMP_ARRAY( "0x%04x", 0, @array[256..$#array] );
1406 printf OUTPUT " /* values */\n%s\n};\n", DUMP_ARRAY( "0x%04x", 0, @row_array[4096..$#row_array] );
1409 ################################################################
1410 # dump a binary case mapping table in l_intl.nls format
1411 sub dump_binary_case_table(@)
1413 my (@table) = @_;
1415 my %difftables_hash = ();
1416 my @difftables;
1417 my %offtables2_hash = ();
1418 my @offtables2 = ();
1420 my @offtable = ();
1421 for (my $i = 0; $i < 256; $i++)
1423 my @offtable2 = ();
1424 for(my $j = 0; $j < 16; $j++) # offset table for xx00-xxFF characters
1426 my @difftable;
1427 for (my $k = 0; $k < 16; $k++) # case map table for xxx0-xxxF characters
1429 my $char = ($i<<8) + ($j<<4) + $k;
1430 $difftable[$k] = (defined $table[$char]) ? (($table[$char]-$char) & 0xffff) : 0;
1433 my $diff_key = pack "S*", @difftable;
1434 my $offset3 = $difftables_hash{$diff_key};
1435 if (!defined $offset3)
1437 $offset3 = scalar @difftables;
1438 $difftables_hash{$diff_key} = $offset3;
1439 push @difftables, @difftable;
1441 $offtable2[$j] = $offset3;
1444 my $offtable2_key = pack "S*", @offtable2;
1445 my $offset2 = $offtables2_hash{$offtable2_key};
1446 if (!defined $offset2)
1448 $offset2 = scalar @offtables2;
1449 $offtables2_hash{$offtable2_key} = $offset2;
1450 push @offtables2, \@offtable2;
1452 $offtable[$i] = $offset2;
1455 my @output;
1456 my $offset = 0x100; # offset of first subtable in words
1457 foreach (@offtable)
1459 push @output, 0x10 * $_ + $offset; # offset of subtable in words
1462 $offset = 0x100 + 0x10 * scalar @offtables2; # offset of first difftable in words
1463 foreach(@offtables2)
1465 my $table = $_;
1466 foreach(@$table)
1468 push @output, $_ + $offset; # offset of difftable in words
1472 my $len = 1 + scalar @output + scalar @difftables;
1473 return pack "S<*", $len, @output, @difftables;
1477 ################################################################
1478 # dump case mappings for l_intl.nls
1479 sub dump_intl_nls($)
1481 my $filename = shift;
1482 open OUTPUT,">$filename.new" or die "Cannot create $filename";
1483 printf "Building $filename\n";
1485 binmode OUTPUT;
1486 print OUTPUT pack "S<", 1; # version
1487 print OUTPUT dump_binary_case_table( @toupper_table );
1488 print OUTPUT dump_binary_case_table( @tolower_table );
1489 close OUTPUT;
1490 save_file($filename);
1494 ################################################################
1495 # dump the ctype tables
1496 sub DUMP_CTYPE_TABLES($)
1498 my $filename = shift;
1499 open OUTPUT,">$filename.new" or die "Cannot create $filename";
1500 printf "Building $filename\n";
1501 printf OUTPUT "/* Unicode ctype tables */\n";
1502 printf OUTPUT "/* Automatically generated; DO NOT EDIT!! */\n\n";
1503 printf OUTPUT "#include \"wine/unicode.h\"\n\n";
1505 # add the direction in the high 4 bits of the category
1506 for (my $i = 0; $i < 65536; $i++)
1508 $category_table[$i] |= $direction_table[$i] << 12 if defined $direction_table[$i];
1511 dump_simple_mapping( "wine_wctype_table", @category_table );
1513 close OUTPUT;
1514 save_file($filename);
1518 ################################################################
1519 # dump the char composition tables
1520 sub DUMP_COMPOSE_TABLES($)
1522 my $filename = shift;
1524 open OUTPUT,">$filename.new" or die "Cannot create $filename";
1525 printf "Building $filename\n";
1526 printf OUTPUT "/* Unicode char composition */\n";
1527 printf OUTPUT "/* Automatically generated; DO NOT EDIT!! */\n\n";
1528 printf OUTPUT "#include \"wine/unicode.h\"\n\n";
1530 ######### composition table
1532 my @filled = ();
1533 foreach my $i (@compose_table)
1535 my @comp = @$i;
1536 push @{$filled[$comp[1]]}, [ $comp[0], $comp[2] ];
1539 # count how many different second chars we have
1541 my $count = 0;
1542 for (my $i = 0; $i < 65536; $i++)
1544 next unless defined $filled[$i];
1545 $count++;
1548 # build the table of second chars and offsets
1550 my $pos = $count + 1;
1551 my @table = ();
1552 for (my $i = 0; $i < 65536; $i++)
1554 next unless defined $filled[$i];
1555 push @table, $i, $pos;
1556 $pos += @{$filled[$i]};
1558 # terminator with last position
1559 push @table, 0, $pos;
1560 printf OUTPUT "const WCHAR unicode_compose_table[0x%x] =\n{\n", 2*$pos;
1561 printf OUTPUT " /* second chars + offsets */\n%s", DUMP_ARRAY( "0x%04x", 0, @table );
1563 # build the table of first chars and mappings
1565 for (my $i = 0; $i < 65536; $i++)
1567 next unless defined $filled[$i];
1568 my @table = ();
1569 my @list = sort { $a->[0] <=> $b->[0] } @{$filled[$i]};
1570 for (my $j = 0; $j <= $#list; $j++)
1572 push @table, $list[$j][0], $list[$j][1];
1574 printf OUTPUT ",\n /* 0x%04x */\n%s", $i, DUMP_ARRAY( "0x%04x", 0, @table );
1576 printf OUTPUT "\n};\n\nconst unsigned int unicode_compose_table_size = %d;\n\n", $count;
1578 ######### decomposition table
1580 # first determine all the 16-char subsets that contain something
1582 @filled = (0) x 4096;
1583 $pos = 16*2; # for the null subset
1584 for (my $i = 0; $i < 65536; $i++)
1586 next unless defined $decomp_table[$i];
1587 $filled[$i >> 4] = $pos;
1588 $pos += 16*2;
1589 $i |= 15;
1591 my $total = $pos;
1593 # now count the 256-char subsets that contain something
1595 my @filled_idx = (256) x 256;
1596 $pos = 256 + 16;
1597 for (my $i = 0; $i < 4096; $i++)
1599 next unless $filled[$i];
1600 $filled_idx[$i >> 4] = $pos;
1601 $pos += 16;
1602 $i |= 15;
1604 my $null_offset = $pos; # null mapping
1605 $total += $pos;
1607 # add the index offsets to the subsets positions
1609 for (my $i = 0; $i < 4096; $i++)
1611 next unless $filled[$i];
1612 $filled[$i] += $null_offset;
1615 # dump the main index
1617 printf OUTPUT "const WCHAR unicode_decompose_table[%d] =\n", $total;
1618 printf OUTPUT "{\n /* index */\n";
1619 printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0, @filled_idx );
1620 printf OUTPUT ",\n /* null sub-index */\n%s", DUMP_ARRAY( "0x%04x", 0, ($null_offset) x 16 );
1622 # dump the second-level indexes
1624 for (my $i = 0; $i < 256; $i++)
1626 next unless ($filled_idx[$i] > 256);
1627 my @table = @filled[($i<<4)..($i<<4)+15];
1628 for (my $j = 0; $j < 16; $j++) { $table[$j] ||= $null_offset; }
1629 printf OUTPUT ",\n /* sub-index %02x */\n", $i;
1630 printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0, @table );
1633 # dump the 16-char subsets
1635 printf OUTPUT ",\n /* null mapping */\n";
1636 printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0, (0) x 32 );
1638 for (my $i = 0; $i < 4096; $i++)
1640 next unless $filled[$i];
1641 my @table = (0) x 32;
1642 for (my $j = 0; $j < 16; $j++)
1644 if (defined $decomp_table[($i<<4) + $j])
1646 $table[2 * $j] = ${$decomp_table[($i << 4) + $j]}[0];
1647 $table[2 * $j + 1] = ${$decomp_table[($i << 4) + $j]}[1];
1650 printf OUTPUT ",\n /* 0x%03x0 .. 0x%03xf */\n", $i, $i;
1651 printf OUTPUT "%s", DUMP_ARRAY( "0x%04x", 0, @table );
1654 printf OUTPUT "\n};\n";
1655 close OUTPUT;
1656 save_file($filename);
1660 ################################################################
1661 # handle a "bestfit" Windows mapping file
1663 sub handle_bestfit_file($$$)
1665 my ($filename, $has_glyphs, $comment) = @_;
1666 my $state = "";
1667 my ($codepage, $width, $def, $defw, $count);
1668 my ($lb_cur, $lb_end);
1669 my @lb_ranges = ();
1671 my $INPUT = open_data_file "$MAPPINGS/$filename" or die "Cannot open $filename";
1673 while (<$INPUT>)
1675 next if /^;/; # skip comments
1676 next if /^\s*$/; # skip empty lines
1677 next if /\x1a/; # skip ^Z
1678 last if /^ENDCODEPAGE/;
1680 if (/^CODEPAGE\s+(\d+)/)
1682 $codepage = $1;
1683 next;
1685 if (/^CPINFO\s+(\d+)\s+0x([0-9a-fA-f]+)\s+0x([0-9a-fA-F]+)/)
1687 $width = $1;
1688 $def = hex $2;
1689 $defw = hex $3;
1690 next;
1692 if (/^(MBTABLE|WCTABLE|DBCSRANGE|DBCSTABLE)\s+(\d+)/)
1694 $state = $1;
1695 $count = $2;
1696 next;
1698 if (/^0x([0-9a-fA-F]+)\s+0x([0-9a-fA-F]+)/)
1700 if ($state eq "MBTABLE")
1702 my $cp = hex $1;
1703 my $uni = hex $2;
1704 $cp2uni[$cp] = $uni unless defined($cp2uni[$cp]);
1705 next;
1707 if ($state eq "WCTABLE")
1709 my $uni = hex $1;
1710 my $cp = hex $2;
1711 $uni2cp[$uni] = $cp unless defined($uni2cp[$uni]);
1712 next;
1714 if ($state eq "DBCSRANGE")
1716 my $start = hex $1;
1717 my $end = hex $2;
1718 push @lb_ranges, $start, $end;
1719 for (my $i = $start; $i <= $end; $i++)
1721 push @lead_bytes, $i;
1722 $cp2uni[$i] = 0;
1724 $lb_cur = $start;
1725 $lb_end = $end;
1726 next;
1728 if ($state eq "DBCSTABLE")
1730 my $mb = hex $1;
1731 my $uni = hex $2;
1732 my $cp = ($lb_cur << 8) | $mb;
1733 $cp2uni[$cp] = $uni unless defined($cp2uni[$cp]);
1734 if (!--$count)
1736 if (++$lb_cur > $lb_end) { $state = "DBCSRANGE"; }
1738 next;
1741 die "$filename: Unrecognized line $_\n";
1743 close $INPUT;
1745 my $output = sprintf "libs/wine/c_%03d.c", $codepage;
1746 open OUTPUT,">$output.new" or die "Cannot create $output";
1748 printf "Building %s from %s (%s)\n", $output, $filename, $comment;
1750 # dump all tables
1752 printf OUTPUT "/* code page %03d (%s) */\n", $codepage, $comment;
1753 printf OUTPUT "/* generated from $MAPPINGS/$filename */\n";
1754 printf OUTPUT "/* DO NOT EDIT!! */\n\n";
1755 printf OUTPUT "#include \"wine/unicode.h\"\n\n";
1757 if ($width == 1) { dump_sbcs_table( $codepage, $has_glyphs, $comment, $def, $defw ); }
1758 else { dump_dbcs_table( $codepage, $comment, $def, $defw, @lb_ranges ); }
1759 close OUTPUT;
1760 save_file($output);
1764 ################################################################
1765 # read an input file and generate the corresponding .c file
1766 sub HANDLE_FILE(@)
1768 my ($codepage,$filename,$has_glyphs,$comment) = @_;
1770 @cp2uni = ();
1771 @lead_bytes = ();
1772 @uni2cp = ();
1774 # symbol codepage file is special
1775 if ($codepage == 20932) { READ_JIS0208_FILE "$MAPPINGS/$filename"; }
1776 elsif ($codepage == 20127) { fill_20127_codepage(); }
1777 elsif ($filename =~ /\/bestfit/)
1779 handle_bestfit_file( $filename, $has_glyphs, $comment );
1780 return;
1782 else { READ_FILE "$MAPPINGS/$filename"; }
1784 ADD_DEFAULT_MAPPINGS();
1786 my $output = sprintf "libs/wine/c_%03d.c", $codepage;
1787 open OUTPUT,">$output.new" or die "Cannot create $output";
1789 printf "Building %s from %s (%s)\n", $output, $filename || "hardcoded data", $comment;
1791 # dump all tables
1793 printf OUTPUT "/* code page %03d (%s) */\n", $codepage, $comment;
1794 if ($filename)
1796 print OUTPUT "/* generated from $MAPPINGS/$filename */\n";
1797 print OUTPUT "/* DO NOT EDIT!! */\n\n";
1799 else
1801 printf OUTPUT "/* Automatically generated; DO NOT EDIT!! */\n\n";
1803 printf OUTPUT "#include \"wine/unicode.h\"\n\n";
1805 if (!@lead_bytes) { dump_sbcs_table( $codepage, $has_glyphs, $comment, $DEF_CHAR, $DEF_CHAR ); }
1806 else { dump_dbcs_table( $codepage, $comment, $DEF_CHAR, $DEF_CHAR, get_lb_ranges() ); }
1807 close OUTPUT;
1808 save_file($output);
1812 ################################################################
1813 # save a file if modified
1814 sub save_file($)
1816 my $file = shift;
1817 if (-f $file && !system "cmp $file $file.new >/dev/null")
1819 unlink "$file.new";
1821 else
1823 rename "$file.new", "$file";
1828 ################################################################
1829 # output the list of codepage tables into the cptable.c file
1830 sub output_cptable($)
1832 my $output = shift;
1833 my @tables_decl = ();
1835 printf "Building %s\n", $output;
1837 foreach my $file (@allfiles)
1839 my ($codepage,$filename,$comment) = @$file;
1840 push @tables_decl, sprintf("extern union cptable cptable_%03d;\n",$codepage);
1843 push @tables_decl, sprintf("\nstatic const union cptable * const cptables[%d] =\n{\n",$#allfiles+1);
1844 foreach my $file (@allfiles)
1846 my ($codepage,$filename,$comment) = @$file;
1847 push @tables_decl, sprintf(" &cptable_%03d,\n", $codepage);
1849 push @tables_decl, "};";
1850 REPLACE_IN_FILE( $output, @tables_decl );
1853 ################################################################
1854 # replace the contents of a file between ### cpmap ### marks
1856 sub REPLACE_IN_FILE($@)
1858 my $name = shift;
1859 my @data = @_;
1860 my @lines = ();
1861 open(FILE,$name) or die "Can't open $name";
1862 while (<FILE>)
1864 push @lines, $_;
1865 last if /\#\#\# cpmap begin \#\#\#/;
1867 push @lines, @data;
1868 while (<FILE>)
1870 if (/\#\#\# cpmap end \#\#\#/) { push @lines, "\n", $_; last; }
1872 push @lines, <FILE>;
1873 open(FILE,">$name.new") or die "Can't modify $name";
1874 print FILE @lines;
1875 close(FILE);
1876 save_file($name);
1879 ################################################################
1880 # main routine
1882 chdir ".." if -f "./make_unicode";
1883 READ_DEFAULTS( $DEFAULTS );
1884 DUMP_CASE_MAPPINGS( "libs/wine/casemap.c" );
1885 DUMP_SORTKEYS( "libs/wine/collation.c", READ_SORTKEYS_FILE() );
1886 DUMP_COMPOSE_TABLES( "libs/wine/compose.c" );
1887 DUMP_CTYPE_TABLES( "libs/wine/wctype.c" );
1888 dump_mirroring( "dlls/usp10/mirror.c" );
1889 dump_shaping( "dlls/usp10/shaping.c" );
1890 dump_linebreak( "dlls/usp10/linebreak.c" );
1891 dump_indic( "dlls/usp10/indicsyllable.c" );
1892 dump_intl_nls("tools/l_intl.nls");
1894 foreach my $file (@allfiles) { HANDLE_FILE( @{$file} ); }
1896 output_cptable("libs/wine/cptable.c");
1898 exit 0;
1900 # Local Variables:
1901 # compile-command: "./make_unicode"
1902 # End: