3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 $header = <<END_OF_HEADER;
8 # This Source Code Form is subject to the terms of the Mozilla Public
9 # License, v. 2.0. If a copy of the MPL was not distributed with this
10 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
13 # THIS FILE IS GENERATED BY mozilla/intl/unicharutil/tools/gentransliterate.pl
14 # PLEASE DO NOT MODIFY THIS FILE BY HAND
16 entity.list.name=transliterate
20 # Here are the windows-1252 characters from the range 0x80 - 0x9F
24 $handcoded = <<END_OF_HANDCODED
;
27 # SINGLE LOW-9 QUOTATION MARK
29 # LATIN SMALL LETTER F WITH HOOK
31 # DOUBLE LOW-9 QUOTATION MARK
37 # MODIFIER LETTER CIRCUMFLEX ACCENT
41 # SINGLE LEFT-POINTING ANGLE QUOTATION MARK
43 # LATIN CAPITAL LIGATURE OE
45 # LEFT SINGLE QUOTATION MARK
47 # RIGHT SINGLE QUOTATION MARK
49 # LEFT DOUBLE QUOTATION MARK
51 # RIGHT DOUBLE QUOTATION MARK
61 # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
63 # LATIN SMALL LIGATURE OE
71 # U+2011 NON-BREAKING HYPHEN
75 # U+2015 HORIZONTAL BAR
77 # U+200B, ZERO WIDTH SPACE (a.k.a. InvisibleComma)
79 # U+2061, ApplyFunction, character showing function application in presentation tagging
81 # U+2062, InvisibleTimes, marks multiplication when it is understood without a mark
83 # U+2146, DifferentialD, d for use in differentials, e.g., within integrals
85 # U+2212, MINUS SIGN, official Unicode minus sign
88 # U+05BE HEBREW PUNCTUATION MAQAF
90 # U+05C0 HEBREW PUNCTUATION PASEQ
92 # U+05C3 HEBREW PUNCTUATION SOF PASUQ
94 # U+05F3 HEBREW PUNCTUATION GERESH
96 # U+05F4 HEBREW PUNCTUATION GERSHAYIM
99 ## End of hand coded section
100 ## Below are generated from the unicode character database
109 if($cmt =~ /PRECEDED BY APOSTROPHE/) {
112 if($cmt =~ /CAPITAL LETTER ([A-Z]*)/) {
115 if($cmt =~ /SMALL LETTER ([A-Z]*)/) {
116 $char = $char . lc($1);
118 @f = split(/ / , $cmt);
119 while($item = shift @f) {
122 } elsif ($item eq "DIAERESIS") {
124 } elsif ($item eq "BREVE") {
126 } elsif ($item eq "ACUTE") {
128 } elsif ($item eq "GRAVE") {
130 } elsif ($item eq "TILDE") {
132 } elsif ($item eq "CARON") {
134 } elsif ($item eq "HOOK") {
136 } elsif ($item eq "CEDILLA") {
138 } elsif ($item eq "MACRON") {
140 } elsif ($item eq "CIRCUMFLEX") {
142 } elsif ($item eq "RING") {
144 } elsif ($item eq "OGONEK") {
146 } elsif ($item eq "LINE") {
148 } elsif ($item eq "COMMA") {
150 } elsif ($item eq "STROKE") {
152 } elsif ($item eq "HORN") {
154 } elsif ($item =~ /^(LATIN|CAPITAL|SMALL|LETTER|WITH|ABOVE|BELOW|INVERTED|MIDDLE|AND|BY|APOSTROPHE|[A-Z])$/) {
157 #print "AAAA $item\n";
165 my ($warning) = (@_);
166 print "WARNING: $warning \n";
170 my ($u, $cmt, $udec, $str) = (@_);
171 # don't print out comments - for debugging purposes only
172 # print "# U+$u $cmt\n";
173 print "entity.$udec=$str\n";
177 my ($u, $cmt, $udec, $str) = (@_);
178 if(decomposeIntoNonASCII
($str)) {
179 if(($cmt =~ "LATIN") && ($cmt =~ "LETTER") && !($cmt =~ "LONG")) {
180 $str = FromLatinComment
($cmt);
181 output
($u,$cmt,$udec,$str);
184 # don't print out comments - for debugging purposes only
185 # print OUT "# U+$u $cmt\n";
186 print OUT
"entity.$udec=$str\n";
190 sub decomposeIntoNonASCII
193 return $dec =~ /\\u([1-9A-F][0-9A-F][0-9A-F]|[0-9A-F][1-9A-F][0-9A-F]|00[8-9A-F])[0-9A-F]/;
204 $overscore = "002D"; ## should be 00AF but we can only handle ASCII now
205 $umlaut = "0022"; ## should be 00A8 but we can only handle ASCII now
206 $doubleacute = "0022";
208 $doublegrave = "0060 0060";
211 $dec =~ s/00A8/$umlaut/eg;
212 $dec =~ s/00AF/$overscore/eg;
213 # $dec =~ s/00B0//eg;
214 $dec =~ s/00B4/$acute/eg;
215 $dec =~ s/00B7/$dot/eg;
216 # $dec =~ s/00B8//eg;
217 $dec =~ s/0300/$grave/eg;
218 $dec =~ s/0301/$acute/eg;
219 $dec =~ s/0302/$hat/eg;
220 $dec =~ s/0303/$tilde/eg;
221 $dec =~ s/0304/$overscore/eg;
222 $dec =~ s/0305/$overscore/eg;
223 #$dec =~ s/0306/?/eg;
224 $dec =~ s/0307/$dot/eg;
225 $dec =~ s/0308/$umlaut/eg;
226 #$dec =~ s/0309/?/eg;
227 #$dec =~ s/030A/?/eg;
228 $dec =~ s/030B/$doubleacute/eg;
229 #$dec =~ s/030C/?/eg;
230 $dec =~ s/030D/$acute/eg;
231 $dec =~ s/030E/$doubleacute/eg;
232 $dec =~ s/030F/$doublegrave/eg;
234 # $dec =~ s/03[0-9A-F][0-9A-F]//eg; ## drop others
240 if(exists $table{$dec}) {
242 $t =~ s/<[a-zA-Z]*>//eg;
243 $t = foldcombining
($t);
244 return rdecompose
( $table{$t});
250 my ($removeprefix, $dec) = (@_);
251 $removeprefix .= " ";
253 $dec =~ s/$removeprefix//eg;
256 } elsif($dec eq "005C") {
260 $dec =~ s/2044/$k/eg;
261 $dec =~ s/([0-9A-F][0-9A-F][0-9A-F][0-9A-F])/rdecompose($1)/eg;
262 $dec =~ s/([0-9A-F][0-9A-F][0-9A-F][0-9A-F])/\\u$1/g;
263 $dec =~ s/\\u00([0-7][0-9A-F])/pack("C",hex($1))/eg;
269 ######################################################################
271 # Open the unicode database file
273 ######################################################################
274 open ( UNICODATA
, "< UnicodeData-Latest.txt")
275 || die "cannot find UnicodeData-Latest.txt";
277 open ( UNICODATA2
, "< UnicodeData-Latest.txt")
278 || die "cannot find UnicodeData-Latest.txt";
279 ######################################################################
281 # Open the output file
283 ######################################################################
284 open ( OUT
, "> ../tables/transliterate.properties")
285 || die "cannot open output ../tables/transliterate.properties file";
289 # remove comments from $handcoded
290 $handcoded =~ s/^#[^#].*\n//mg;
291 print OUT
$handcoded;
293 ######################################################################
295 # Process the file line by line
297 ######################################################################
298 while(<UNICODATA2
>) {
300 @f = split(/;/ , $_);
302 if(($udec > 256 ) && ($f[5] ne "")) {
308 ######################################################################
310 # Get value from fields
312 ######################################################################
313 @f = split(/;/ , $_);
314 $u = $f[0]; # The unicode value
315 $cmt = $f[1]; # The comment
316 $dec = $f[5]; # The decomposed value
329 # formated decomposition
330 if($dec =~ /<wide>/) {
331 output
($u,$cmt,$udec,&decompose
("<wide>", $dec));
332 } elsif($dec =~ /<narrow>/) {
333 # ignore non ASCII decomposition
335 } elsif($dec =~ /<circle>/) {
336 output
($u,$cmt,$udec,&decompose
("<circle>", "(".$dec.")"));
337 } elsif($dec =~ /<fraction>/) {
338 output
($u,$cmt,$udec,&decompose
("<fraction>", $dec));
339 } elsif($dec =~ /<small>/) {
340 output
($u,$cmt,$udec,&decompose
("<small>", $dec));
341 } elsif($dec =~ /<vertical>/) {
343 } elsif($dec =~ /<super>/) {
344 output
($u,$cmt,$udec,"^(".&decompose
("<super>", $dec).")");
345 } elsif($dec =~ /<sub>/) {
346 output
($u,$cmt,$udec,"v(".&decompose
("<sub>", $dec).")");
347 } elsif($dec =~ /<font>/) {
348 output
($u,$cmt,$udec,&decompose
("<font>", $dec));
349 } elsif($dec =~ /<square>/) {
352 } elsif($dec =~ /<compat>/) {
353 output
($u,$cmt,$udec,&decompose
("<compat>", $dec));
354 } elsif($dec =~ /<isolated>/) {
357 } elsif($dec =~ /<medial>/) {
360 } elsif($dec =~ /<final>/) {
363 } elsif($dec =~ /<initial>/) {
366 } elsif($dec =~ /<noBreak>/) {
367 if($dec eq "<noBreak> 0020")
369 output
($u,$cmt,$udec,"\\u0020");
378 # decomposition without format code
379 if($cmt =~ /LATIN/) {
380 $dec = foldcombining
($dec);
381 output
($u,$cmt,$udec,&decompose
("", $dec));
382 } elsif($cmt =~ /CYRILLIC/) {
385 } elsif($cmt =~ /GREEK/) {
388 } elsif($cmt =~ /ARABIC/) {
391 } elsif($cmt =~ /CJK/) {
394 } elsif($cmt =~ /HEBREW/) {
397 } elsif($cmt =~ /DEVANAGARI/) {
400 } elsif($cmt =~ /BENGALI/) {
403 } elsif($cmt =~ /GURMUKHI/) {
406 } elsif($cmt =~ /ORIYA/) {
409 } elsif($cmt =~ /TAMIL/) {
412 } elsif($cmt =~ /TELUGU/) {
415 } elsif($cmt =~ /KANNADA/) {
418 } elsif($cmt =~ /MALAYALAM/) {
421 } elsif($cmt =~ /SINHALA/) {
424 } elsif($cmt =~ /TIBETAN/) {
427 } elsif($cmt =~ /MYANMAR/) {
430 } elsif($cmt =~ /KATAKANA/) {
433 } elsif($cmt =~ /HIRAGANA/) {
442 # do not have decomposition
445 # are numeric characters
446 output
($u,$cmt,$udec,$d1);
447 } elsif ($d2 ne "") {
448 if($cmt =~ /CIRCLED/) {
450 output
($u,$cmt,$udec,"(".$d2.")");
453 output
($u,$cmt,$udec,"[".$d2."]");
455 } elsif ($d3 ne "") {
456 if($cmt =~ /CIRCLED/) {
458 output
($u,$cmt,$udec,"(".$d3.")");
461 output
($u,$cmt,$udec,"[".$d3."]");
464 # not numeric characters
466 } # end of no decomposition
467 } # end of have/not decomposition
470 ######################################################################
474 ######################################################################