3 # ***** BEGIN LICENSE BLOCK *****
4 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 # The contents of this file are subject to the Mozilla Public License Version
7 # 1.1 (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
9 # http://www.mozilla.org/MPL/
11 # Software distributed under the License is distributed on an "AS IS" basis,
12 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 # for the specific language governing rights and limitations under the
16 # The Original Code is mozilla.org code.
18 # The Initial Developer of the Original Code is
19 # Netscape Communications Corporation.
20 # Portions created by the Initial Developer are Copyright (C) 1999
21 # the Initial Developer. All Rights Reserved.
25 # Alternatively, the contents of this file may be used under the terms of
26 # either the GNU General Public License Version 2 or later (the "GPL"), or
27 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 # in which case the provisions of the GPL or the LGPL are applicable instead
29 # of those above. If you wish to allow use of your version of this file only
30 # under the terms of either the GPL or the LGPL, and not to allow others to
31 # use your version of this file under the terms of the MPL, indicate your
32 # decision by deleting the provisions above and replace them with the notice
33 # and other provisions required by the GPL or the LGPL. If you do not delete
34 # the provisions above, a recipient may use your version of this file under
35 # the terms of any one of the MPL, the GPL or the LGPL.
37 # ***** END LICENSE BLOCK *****
39 $header = <<END_OF_HEADER;
40 # ***** BEGIN LICENSE BLOCK *****
41 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
43 # The contents of this file are subject to the Mozilla Public License Version
44 # 1.1 (the "License"); you may not use this file except in compliance with
45 # the License. You may obtain a copy of the License at
46 # http://www.mozilla.org/MPL/
48 # Software distributed under the License is distributed on an "AS IS" basis,
49 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
50 # for the specific language governing rights and limitations under the
53 # The Original Code is mozilla.org code.
55 # The Initial Developer of the Original Code is
56 # Netscape Communications Corporation.
57 # Portions created by the Initial Developer are Copyright (C) 1999
58 # the Initial Developer. All Rights Reserved.
62 # Alternatively, the contents of this file may be used under the terms of
63 # either the GNU General Public License Version 2 or later (the "GPL"), or
64 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
65 # in which case the provisions of the GPL or the LGPL are applicable instead
66 # of those above. If you wish to allow use of your version of this file only
67 # under the terms of either the GPL or the LGPL, and not to allow others to
68 # use your version of this file under the terms of the MPL, indicate your
69 # decision by deleting the provisions above and replace them with the notice
70 # and other provisions required by the GPL or the LGPL. If you do not delete
71 # the provisions above, a recipient may use your version of this file under
72 # the terms of any one of the MPL, the GPL or the LGPL.
74 # ***** END LICENSE BLOCK
*****
77 # THIS FILE IS GENERATED BY mozilla/intl/unicharutil/tools/gentransliterate.pl
78 # PLEASE DO NOT MODIFY THIS FILE BY HAND
80 entity
.list
.name
=transliterate
84 # Here are the windows-1252 characters from the range 0x80 - 0x9F
88 $handcoded = <<END_OF_HANDCODED;
91 # SINGLE LOW-9 QUOTATION MARK
93 # LATIN SMALL LETTER F WITH HOOK
95 # DOUBLE LOW-9 QUOTATION MARK
101 # MODIFIER LETTER CIRCUMFLEX ACCENT
105 # SINGLE LEFT-POINTING ANGLE QUOTATION MARK
107 # LATIN CAPITAL LIGATURE OE
109 # LEFT SINGLE QUOTATION MARK
111 # RIGHT SINGLE QUOTATION MARK
113 # LEFT DOUBLE QUOTATION MARK
115 # RIGHT DOUBLE QUOTATION MARK
125 # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
127 # LATIN SMALL LIGATURE OE
135 # U+2011 NON-BREAKING HYPHEN
139 # U+2015 HORIZONTAL BAR
141 # U+200B, ZERO WIDTH SPACE (a.k.a. InvisibleComma)
143 # U+2061, ApplyFunction, character showing function application in presentation tagging
145 # U+2062, InvisibleTimes, marks multiplication when it is understood without a mark
147 # U+2146, DifferentialD, d for use in differentials, e.g., within integrals
149 # U+2212, MINUS SIGN, official Unicode minus sign
152 # U+05BE HEBREW PUNCTUATION MAQAF
154 # U+05C0 HEBREW PUNCTUATION PASEQ
156 # U+05C3 HEBREW PUNCTUATION SOF PASUQ
158 # U+05F3 HEBREW PUNCTUATION GERESH
160 # U+05F4 HEBREW PUNCTUATION GERSHAYIM
163 ## End of hand coded section
164 ## Below are generated from the unicode character database
173 if($cmt =~ /PRECEDED BY APOSTROPHE/) {
176 if($cmt =~ /CAPITAL LETTER ([A-Z]*)/) {
179 if($cmt =~ /SMALL LETTER ([A-Z]*)/) {
180 $char = $char . lc($1);
182 @f = split(/ / , $cmt);
183 while($item = shift @f) {
186 } elsif ($item eq "DIAERESIS") {
188 } elsif ($item eq "BREVE") {
190 } elsif ($item eq "ACUTE") {
192 } elsif ($item eq "GRAVE") {
194 } elsif ($item eq "TILDE") {
196 } elsif ($item eq "CARON") {
198 } elsif ($item eq "HOOK") {
200 } elsif ($item eq "CEDILLA") {
202 } elsif ($item eq "MACRON") {
204 } elsif ($item eq "CIRCUMFLEX") {
206 } elsif ($item eq "RING") {
208 } elsif ($item eq "OGONEK") {
210 } elsif ($item eq "LINE") {
212 } elsif ($item eq "COMMA") {
214 } elsif ($item eq "STROKE") {
216 } elsif ($item eq "HORN") {
218 } elsif ($item =~ /^(LATIN|CAPITAL|SMALL|LETTER|WITH|ABOVE|BELOW|INVERTED|MIDDLE|AND|BY|APOSTROPHE|[A-Z])$/) {
221 #print "AAAA $item\n";
229 my ($warning) = (@_);
230 print "WARNING: $warning \n";
234 my ($u, $cmt, $udec, $str) = (@_);
235 # don't print out comments - for debugging purposes only
236 # print "# U+$u $cmt\n";
237 print "entity.$udec=$str\n";
241 my ($u, $cmt, $udec, $str) = (@_);
242 if(decomposeIntoNonASCII($str)) {
243 if(($cmt =~ "LATIN") && ($cmt =~ "LETTER") && !($cmt =~ "LONG")) {
244 $str = FromLatinComment($cmt);
245 output($u,$cmt,$udec,$str);
248 # don't print out comments - for debugging purposes only
249 # print OUT "# U+$u $cmt\n";
250 print OUT "entity.$udec=$str\n";
254 sub decomposeIntoNonASCII
257 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]/;
268 $overscore = "002D"; ## should be 00AF but we can only handle ASCII now
269 $umlaut = "0022"; ## should be 00A8 but we can only handle ASCII now
270 $doubleacute = "0022";
272 $doublegrave = "0060 0060";
275 $dec =~ s/00A8/$umlaut/eg;
276 $dec =~ s/00AF/$overscore/eg;
277 # $dec =~ s/00B0//eg;
278 $dec =~ s/00B4/$acute/eg;
279 $dec =~ s/00B7/$dot/eg;
280 # $dec =~ s/00B8//eg;
281 $dec =~ s/0300/$grave/eg;
282 $dec =~ s/0301/$acute/eg;
283 $dec =~ s/0302/$hat/eg;
284 $dec =~ s/0303/$tilde/eg;
285 $dec =~ s/0304/$overscore/eg;
286 $dec =~ s/0305/$overscore/eg;
287 #$dec =~ s/0306/?/eg;
288 $dec =~ s/0307/$dot/eg;
289 $dec =~ s/0308/$umlaut/eg;
290 #$dec =~ s/0309/?/eg;
291 #$dec =~ s/030A/?/eg;
292 $dec =~ s/030B/$doubleacute/eg;
293 #$dec =~ s/030C/?/eg;
294 $dec =~ s/030D/$acute/eg;
295 $dec =~ s/030E/$doubleacute/eg;
296 $dec =~ s/030F/$doublegrave/eg;
298 # $dec =~ s/03[0-9A-F][0-9A-F]//eg; ## drop others
304 if(exists $table{$dec}) {
306 $t =~ s/<[a-zA-Z]*>//eg;
307 $t = foldcombining($t);
308 return rdecompose( $table{$t});
314 my ($removeprefix, $dec) = (@_);
315 $removeprefix .= " ";
317 $dec =~ s/$removeprefix//eg;
320 } elsif($dec eq "005C") {
324 $dec =~ s/2044/$k/eg;
325 $dec =~ s/([0-9A-F][0-9A-F][0-9A-F][0-9A-F])/rdecompose($1)/eg;
326 $dec =~ s/([0-9A-F][0-9A-F][0-9A-F][0-9A-F])/\\u$1/g;
327 $dec =~ s/\\u00([0-7][0-9A-F])/pack("C",hex($1))/eg;
333 ######################################################################
335 # Open the unicode database file
337 ######################################################################
338 open ( UNICODATA , "< UnicodeData-Latest.txt")
339 || die "cannot find UnicodeData-Latest.txt";
341 open ( UNICODATA2 , "< UnicodeData-Latest.txt")
342 || die "cannot find UnicodeData-Latest.txt";
343 ######################################################################
345 # Open the output file
347 ######################################################################
348 open ( OUT , "> ../tables/transliterate.properties")
349 || die "cannot open output ../tables/transliterate.properties file";
353 # remove comments from $handcoded
354 $handcoded =~ s/^#[^#].*\n//mg;
355 print OUT $handcoded;
357 ######################################################################
359 # Process the file line by line
361 ######################################################################
362 while(<UNICODATA2>) {
364 @f = split(/;/ , $_);
366 if(($udec > 256 ) && ($f[5] ne "")) {
372 ######################################################################
374 # Get value from fields
376 ######################################################################
377 @f = split(/;/ , $_);
378 $u = $f[0]; # The unicode value
379 $cmt = $f[1]; # The comment
380 $dec = $f[5]; # The decomposed value
393 # formated decomposition
394 if($dec =~ /<wide>/) {
395 output($u,$cmt,$udec,&decompose("<wide>", $dec));
396 } elsif($dec =~ /<narrow>/) {
397 # ignore non ASCII decomposition
399 } elsif($dec =~ /<circle>/) {
400 output($u,$cmt,$udec,&decompose("<circle>", "(".$dec.")"));
401 } elsif($dec =~ /<fraction>/) {
402 output($u,$cmt,$udec,&decompose("<fraction>", $dec));
403 } elsif($dec =~ /<small>/) {
404 output($u,$cmt,$udec,&decompose("<small>", $dec));
405 } elsif($dec =~ /<vertical>/) {
407 } elsif($dec =~ /<super>/) {
408 output($u,$cmt,$udec,"^(".&decompose("<super>", $dec).")");
409 } elsif($dec =~ /<sub>/) {
410 output($u,$cmt,$udec,"v(".&decompose("<sub>", $dec).")");
411 } elsif($dec =~ /<font>/) {
412 output($u,$cmt,$udec,&decompose("<font>", $dec));
413 } elsif($dec =~ /<square>/) {
416 } elsif($dec =~ /<compat>/) {
417 output($u,$cmt,$udec,&decompose("<compat>", $dec));
418 } elsif($dec =~ /<isolated>/) {
421 } elsif($dec =~ /<medial>/) {
424 } elsif($dec =~ /<final>/) {
427 } elsif($dec =~ /<initial>/) {
430 } elsif($dec =~ /<noBreak>/) {
431 if($dec eq "<noBreak> 0020")
433 output($u,$cmt,$udec,"\\u0020");
442 # decomposition without format code
443 if($cmt =~ /LATIN/) {
444 $dec = foldcombining($dec);
445 output($u,$cmt,$udec,&decompose("", $dec));
446 } elsif($cmt =~ /CYRILLIC/) {
449 } elsif($cmt =~ /GREEK/) {
452 } elsif($cmt =~ /ARABIC/) {
455 } elsif($cmt =~ /CJK/) {
458 } elsif($cmt =~ /HEBREW/) {
461 } elsif($cmt =~ /DEVANAGARI/) {
464 } elsif($cmt =~ /BENGALI/) {
467 } elsif($cmt =~ /GURMUKHI/) {
470 } elsif($cmt =~ /ORIYA/) {
473 } elsif($cmt =~ /TAMIL/) {
476 } elsif($cmt =~ /TELUGU/) {
479 } elsif($cmt =~ /KANNADA/) {
482 } elsif($cmt =~ /MALAYALAM/) {
485 } elsif($cmt =~ /SINHALA/) {
488 } elsif($cmt =~ /TIBETAN/) {
491 } elsif($cmt =~ /MYANMAR/) {
494 } elsif($cmt =~ /KATAKANA/) {
497 } elsif($cmt =~ /HIRAGANA/) {
506 # do not have decomposition
509 # are numeric characters
510 output($u,$cmt,$udec,$d1);
511 } elsif ($d2 ne "") {
512 if($cmt =~ /CIRCLED/) {
514 output($u,$cmt,$udec,"(".$d2.")");
517 output($u,$cmt,$udec,"[".$d2."]");
519 } elsif ($d3 ne "") {
520 if($cmt =~ /CIRCLED/) {
522 output($u,$cmt,$udec,"(".$d3.")");
525 output($u,$cmt,$udec,"[".$d3."]");
528 # not numeric characters
530 } # end of no decomposition
531 } # end of have/not decomposition
534 ######################################################################
538 ######################################################################