Converting bidi utilities to non-XPCOM interfaces. Bug 120818; r=mkaply, nhotta; sr=attinasi
authorsmontagu@netscape.com
Thu, 28 Jun 2007 13:02:43 -0700
changeset 2909 c353935be9bf0eeda6677974ec59d688416acaed
parent 2908 49527df015b16cf85ae6618568acbd189b38955e
child 2910 72c5a641116deb0dcf44a55dd863a63f036ef1e0
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkaply, nhotta, attinasi
bugs120818
milestone1.9a6pre
Converting bidi utilities to non-XPCOM interfaces. Bug 120818; r=mkaply, nhotta; sr=attinasi
intl/unicharutil/util/bidicattable.h
intl/unicharutil/util/genbidicattable.pl
intl/unicharutil/util/gensymmtable.pl
intl/unicharutil/util/nsBidiUtils.cpp
intl/unicharutil/util/nsBidiUtils.h
intl/unicharutil/util/symmtable.h
new file mode 100644
--- /dev/null
+++ b/intl/unicharutil/util/bidicattable.h
@@ -0,0 +1,1945 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "MPL"); you may not use this file except in
+ * compliance with the MPL.  You may obtain a copy of the MPL at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the MPL is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the MPL
+ * for the specific language governing rights and limitations under the
+ * MPL.
+ *
+ * The Initial Developer of the Original Code is IBM
+ * Corporation.  Portions created by IBM are
+ * Copyright (C) 2000 IBM Corporation. All
+ * Rights Reserved.
+ */
+/* 
+    DO NOT EDIT THIS DOCUMENT !!! THIS DOCUMENT IS GENERATED BY
+    mozilla/intl/unicharutil/tools/genbidicattable.pl
+ */
+
+
+#include "nscore.h" 
+
+static PRUint8 gBidiCatIdx1[256] = {
+     11,  /* U+0000 - U+0007 : 0xBBBBBBBB */
+     16,  /* U+0008 - U+000F : 0xBBCEDCDB */
+     11,  /* U+0010 - U+0017 : 0xBBBBBBBB */
+     17,  /* U+0018 - U+001F : 0xDCCCBBBB */
+     18,  /* U+0020 - U+0027 : 0x9977799E */
+     19,  /* U+0028 - U+002F : 0x68787999 */
+      5,  /* U+0030 - U+0037 : 0x55555555 */
+     20,  /* U+0038 - U+003F : 0x99999855 */
+     21,  /* U+0040 - U+0047 : 0x11111119 */
+      1,  /* U+0048 - U+004F : 0x11111111 */
+      1,  /* U+0050 - U+0057 : 0x11111111 */
+     22,  /* U+0058 - U+005F : 0x99999111 */
+     21,  /* U+0060 - U+0067 : 0x11111119 */
+      1,  /* U+0068 - U+006F : 0x11111111 */
+      1,  /* U+0070 - U+0077 : 0x11111111 */
+     23,  /* U+0078 - U+007F : 0xB9999111 */
+     24,  /* U+0080 - U+0087 : 0xBBCBBBBB */
+     11,  /* U+0088 - U+008F : 0xBBBBBBBB */
+     11,  /* U+0090 - U+0097 : 0xBBBBBBBB */
+     11,  /* U+0098 - U+009F : 0xBBBBBBBB */
+     25,  /* U+00A0 - U+00A7 : 0x99777798 */
+     26,  /* U+00A8 - U+00AF : 0x99999199 */
+     27,  /* U+00B0 - U+00B7 : 0x99195577 */
+     28,  /* U+00B8 - U+00BF : 0x99999159 */
+      1,  /* U+00C0 - U+00C7 : 0x11111111 */
+      1,  /* U+00C8 - U+00CF : 0x11111111 */
+     29,  /* U+00D0 - U+00D7 : 0x91111111 */
+      1,  /* U+00D8 - U+00DF : 0x11111111 */
+      1,  /* U+00E0 - U+00E7 : 0x11111111 */
+      1,  /* U+00E8 - U+00EF : 0x11111111 */
+     29,  /* U+00F0 - U+00F7 : 0x91111111 */
+      1,  /* U+00F8 - U+00FF : 0x11111111 */
+      1,  /* U+0100 - U+0107 : 0x11111111 */
+      1,  /* U+0108 - U+010F : 0x11111111 */
+      1,  /* U+0110 - U+0117 : 0x11111111 */
+      1,  /* U+0118 - U+011F : 0x11111111 */
+      1,  /* U+0120 - U+0127 : 0x11111111 */
+      1,  /* U+0128 - U+012F : 0x11111111 */
+      1,  /* U+0130 - U+0137 : 0x11111111 */
+      1,  /* U+0138 - U+013F : 0x11111111 */
+      1,  /* U+0140 - U+0147 : 0x11111111 */
+      1,  /* U+0148 - U+014F : 0x11111111 */
+      1,  /* U+0150 - U+0157 : 0x11111111 */
+      1,  /* U+0158 - U+015F : 0x11111111 */
+      1,  /* U+0160 - U+0167 : 0x11111111 */
+      1,  /* U+0168 - U+016F : 0x11111111 */
+      1,  /* U+0170 - U+0177 : 0x11111111 */
+      1,  /* U+0178 - U+017F : 0x11111111 */
+      1,  /* U+0180 - U+0187 : 0x11111111 */
+      1,  /* U+0188 - U+018F : 0x11111111 */
+      1,  /* U+0190 - U+0197 : 0x11111111 */
+      1,  /* U+0198 - U+019F : 0x11111111 */
+      1,  /* U+01A0 - U+01A7 : 0x11111111 */
+      1,  /* U+01A8 - U+01AF : 0x11111111 */
+      1,  /* U+01B0 - U+01B7 : 0x11111111 */
+      1,  /* U+01B8 - U+01BF : 0x11111111 */
+      1,  /* U+01C0 - U+01C7 : 0x11111111 */
+      1,  /* U+01C8 - U+01CF : 0x11111111 */
+      1,  /* U+01D0 - U+01D7 : 0x11111111 */
+      1,  /* U+01D8 - U+01DF : 0x11111111 */
+      1,  /* U+01E0 - U+01E7 : 0x11111111 */
+      1,  /* U+01E8 - U+01EF : 0x11111111 */
+      1,  /* U+01F0 - U+01F7 : 0x11111111 */
+      1,  /* U+01F8 - U+01FF : 0x11111111 */
+      1,  /* U+0200 - U+0207 : 0x11111111 */
+      1,  /* U+0208 - U+020F : 0x11111111 */
+      1,  /* U+0210 - U+0217 : 0x11111111 */
+      1,  /* U+0218 - U+021F : 0x11111111 */
+      1,  /* U+0220 - U+0227 : 0x11111111 */
+      1,  /* U+0228 - U+022F : 0x11111111 */
+      1,  /* U+0230 - U+0237 : 0x11111111 */
+      1,  /* U+0238 - U+023F : 0x11111111 */
+      1,  /* U+0240 - U+0247 : 0x11111111 */
+      1,  /* U+0248 - U+024F : 0x11111111 */
+      1,  /* U+0250 - U+0257 : 0x11111111 */
+      1,  /* U+0258 - U+025F : 0x11111111 */
+      1,  /* U+0260 - U+0267 : 0x11111111 */
+      1,  /* U+0268 - U+026F : 0x11111111 */
+      1,  /* U+0270 - U+0277 : 0x11111111 */
+      1,  /* U+0278 - U+027F : 0x11111111 */
+      1,  /* U+0280 - U+0287 : 0x11111111 */
+      1,  /* U+0288 - U+028F : 0x11111111 */
+      1,  /* U+0290 - U+0297 : 0x11111111 */
+      1,  /* U+0298 - U+029F : 0x11111111 */
+      1,  /* U+02A0 - U+02A7 : 0x11111111 */
+      1,  /* U+02A8 - U+02AF : 0x11111111 */
+      1,  /* U+02B0 - U+02B7 : 0x11111111 */
+     30,  /* U+02B8 - U+02BF : 0x11111991 */
+     31,  /* U+02C0 - U+02C7 : 0x99999911 */
+      9,  /* U+02C8 - U+02CF : 0x99999999 */
+     31,  /* U+02D0 - U+02D7 : 0x99999911 */
+      9,  /* U+02D8 - U+02DF : 0x99999999 */
+     32,  /* U+02E0 - U+02E7 : 0x99911111 */
+     33,  /* U+02E8 - U+02EF : 0x11999999 */
+      1,  /* U+02F0 - U+02F7 : 0x11111111 */
+      1,  /* U+02F8 - U+02FF : 0x11111111 */
+     10,  /* U+0300 - U+0307 : 0xAAAAAAAA */
+     10,  /* U+0308 - U+030F : 0xAAAAAAAA */
+     10,  /* U+0310 - U+0317 : 0xAAAAAAAA */
+     10,  /* U+0318 - U+031F : 0xAAAAAAAA */
+     10,  /* U+0320 - U+0327 : 0xAAAAAAAA */
+     10,  /* U+0328 - U+032F : 0xAAAAAAAA */
+     10,  /* U+0330 - U+0337 : 0xAAAAAAAA */
+     10,  /* U+0338 - U+033F : 0xAAAAAAAA */
+     10,  /* U+0340 - U+0347 : 0xAAAAAAAA */
+     34,  /* U+0348 - U+034F : 0x1AAAAAAA */
+      1,  /* U+0350 - U+0357 : 0x11111111 */
+      1,  /* U+0358 - U+035F : 0x11111111 */
+     35,  /* U+0360 - U+0367 : 0x11111AAA */
+      1,  /* U+0368 - U+036F : 0x11111111 */
+     36,  /* U+0370 - U+0377 : 0x11991111 */
+     37,  /* U+0378 - U+037F : 0x19111111 */
+     38,  /* U+0380 - U+0387 : 0x91991111 */
+      1,  /* U+0388 - U+038F : 0x11111111 */
+      1,  /* U+0390 - U+0397 : 0x11111111 */
+      1,  /* U+0398 - U+039F : 0x11111111 */
+      1,  /* U+03A0 - U+03A7 : 0x11111111 */
+      1,  /* U+03A8 - U+03AF : 0x11111111 */
+      1,  /* U+03B0 - U+03B7 : 0x11111111 */
+      1,  /* U+03B8 - U+03BF : 0x11111111 */
+      1,  /* U+03C0 - U+03C7 : 0x11111111 */
+      1,  /* U+03C8 - U+03CF : 0x11111111 */
+      1,  /* U+03D0 - U+03D7 : 0x11111111 */
+      1,  /* U+03D8 - U+03DF : 0x11111111 */
+      1,  /* U+03E0 - U+03E7 : 0x11111111 */
+      1,  /* U+03E8 - U+03EF : 0x11111111 */
+      1,  /* U+03F0 - U+03F7 : 0x11111111 */
+      1,  /* U+03F8 - U+03FF : 0x11111111 */
+      1,  /* U+0400 - U+0407 : 0x11111111 */
+      1,  /* U+0408 - U+040F : 0x11111111 */
+      1,  /* U+0410 - U+0417 : 0x11111111 */
+      1,  /* U+0418 - U+041F : 0x11111111 */
+      1,  /* U+0420 - U+0427 : 0x11111111 */
+      1,  /* U+0428 - U+042F : 0x11111111 */
+      1,  /* U+0430 - U+0437 : 0x11111111 */
+      1,  /* U+0438 - U+043F : 0x11111111 */
+      1,  /* U+0440 - U+0447 : 0x11111111 */
+      1,  /* U+0448 - U+044F : 0x11111111 */
+      1,  /* U+0450 - U+0457 : 0x11111111 */
+      1,  /* U+0458 - U+045F : 0x11111111 */
+      1,  /* U+0460 - U+0467 : 0x11111111 */
+      1,  /* U+0468 - U+046F : 0x11111111 */
+      1,  /* U+0470 - U+0477 : 0x11111111 */
+      1,  /* U+0478 - U+047F : 0x11111111 */
+     39,  /* U+0480 - U+0487 : 0x1AAAA111 */
+     40,  /* U+0488 - U+048F : 0x111111AA */
+      1,  /* U+0490 - U+0497 : 0x11111111 */
+      1,  /* U+0498 - U+049F : 0x11111111 */
+      1,  /* U+04A0 - U+04A7 : 0x11111111 */
+      1,  /* U+04A8 - U+04AF : 0x11111111 */
+      1,  /* U+04B0 - U+04B7 : 0x11111111 */
+      1,  /* U+04B8 - U+04BF : 0x11111111 */
+      1,  /* U+04C0 - U+04C7 : 0x11111111 */
+      1,  /* U+04C8 - U+04CF : 0x11111111 */
+      1,  /* U+04D0 - U+04D7 : 0x11111111 */
+      1,  /* U+04D8 - U+04DF : 0x11111111 */
+      1,  /* U+04E0 - U+04E7 : 0x11111111 */
+      1,  /* U+04E8 - U+04EF : 0x11111111 */
+      1,  /* U+04F0 - U+04F7 : 0x11111111 */
+      1,  /* U+04F8 - U+04FF : 0x11111111 */
+      1,  /* U+0500 - U+0507 : 0x11111111 */
+      1,  /* U+0508 - U+050F : 0x11111111 */
+      1,  /* U+0510 - U+0517 : 0x11111111 */
+      1,  /* U+0518 - U+051F : 0x11111111 */
+      1,  /* U+0520 - U+0527 : 0x11111111 */
+      1,  /* U+0528 - U+052F : 0x11111111 */
+      1,  /* U+0530 - U+0537 : 0x11111111 */
+      1,  /* U+0538 - U+053F : 0x11111111 */
+      1,  /* U+0540 - U+0547 : 0x11111111 */
+      1,  /* U+0548 - U+054F : 0x11111111 */
+      1,  /* U+0550 - U+0557 : 0x11111111 */
+      1,  /* U+0558 - U+055F : 0x11111111 */
+      1,  /* U+0560 - U+0567 : 0x11111111 */
+      1,  /* U+0568 - U+056F : 0x11111111 */
+      1,  /* U+0570 - U+0577 : 0x11111111 */
+      1,  /* U+0578 - U+057F : 0x11111111 */
+      1,  /* U+0580 - U+0587 : 0x11111111 */
+     41,  /* U+0588 - U+058F : 0x11111911 */
+     42,  /* U+0590 - U+0597 : 0xAAAAAAA2 */
+     10,  /* U+0598 - U+059F : 0xAAAAAAAA */
+     43,  /* U+05A0 - U+05A7 : 0xAAAAA2AA */
+     10,  /* U+05A8 - U+05AF : 0xAAAAAAAA */
+     10,  /* U+05B0 - U+05B7 : 0xAAAAAAAA */
+     44,  /* U+05B8 - U+05BF : 0xA2AAA2AA */
+     45,  /* U+05C0 - U+05C7 : 0x222A2AA2 */
+      2,  /* U+05C8 - U+05CF : 0x22222222 */
+      2,  /* U+05D0 - U+05D7 : 0x22222222 */
+      2,  /* U+05D8 - U+05DF : 0x22222222 */
+      2,  /* U+05E0 - U+05E7 : 0x22222222 */
+      2,  /* U+05E8 - U+05EF : 0x22222222 */
+      2,  /* U+05F0 - U+05F7 : 0x22222222 */
+      2,  /* U+05F8 - U+05FF : 0x22222222 */
+      3,  /* U+0600 - U+0607 : 0x33333333 */
+     46,  /* U+0608 - U+060F : 0x33383333 */
+      3,  /* U+0610 - U+0617 : 0x33333333 */
+      3,  /* U+0618 - U+061F : 0x33333333 */
+      3,  /* U+0620 - U+0627 : 0x33333333 */
+      3,  /* U+0628 - U+062F : 0x33333333 */
+      3,  /* U+0630 - U+0637 : 0x33333333 */
+      3,  /* U+0638 - U+063F : 0x33333333 */
+      3,  /* U+0640 - U+0647 : 0x33333333 */
+     47,  /* U+0648 - U+064F : 0xAAAAA333 */
+     48,  /* U+0650 - U+0657 : 0x33AAAAAA */
+      3,  /* U+0658 - U+065F : 0x33333333 */
+      4,  /* U+0660 - U+0667 : 0x44444444 */
+     49,  /* U+0668 - U+066F : 0x33344744 */
+     50,  /* U+0670 - U+0677 : 0x3333333A */
+      3,  /* U+0678 - U+067F : 0x33333333 */
+      3,  /* U+0680 - U+0687 : 0x33333333 */
+      3,  /* U+0688 - U+068F : 0x33333333 */
+      3,  /* U+0690 - U+0697 : 0x33333333 */
+      3,  /* U+0698 - U+069F : 0x33333333 */
+      3,  /* U+06A0 - U+06A7 : 0x33333333 */
+      3,  /* U+06A8 - U+06AF : 0x33333333 */
+      3,  /* U+06B0 - U+06B7 : 0x33333333 */
+      3,  /* U+06B8 - U+06BF : 0x33333333 */
+      3,  /* U+06C0 - U+06C7 : 0x33333333 */
+      3,  /* U+06C8 - U+06CF : 0x33333333 */
+     51,  /* U+06D0 - U+06D7 : 0xAA333333 */
+     10,  /* U+06D8 - U+06DF : 0xAAAAAAAA */
+     52,  /* U+06E0 - U+06E7 : 0xA33AAAAA */
+     53,  /* U+06E8 - U+06EF : 0x33AAAA9A */
+      5,  /* U+06F0 - U+06F7 : 0x55555555 */
+     54,  /* U+06F8 - U+06FF : 0x33333355 */
+      3,  /* U+0700 - U+0707 : 0x33333333 */
+     55,  /* U+0708 - U+070F : 0xB3333333 */
+     56,  /* U+0710 - U+0717 : 0x333333A3 */
+      3,  /* U+0718 - U+071F : 0x33333333 */
+      3,  /* U+0720 - U+0727 : 0x33333333 */
+      3,  /* U+0728 - U+072F : 0x33333333 */
+     10,  /* U+0730 - U+0737 : 0xAAAAAAAA */
+     10,  /* U+0738 - U+073F : 0xAAAAAAAA */
+     10,  /* U+0740 - U+0747 : 0xAAAAAAAA */
+     57,  /* U+0748 - U+074F : 0x33333AAA */
+      3,  /* U+0750 - U+0757 : 0x33333333 */
+      3,  /* U+0758 - U+075F : 0x33333333 */
+      3,  /* U+0760 - U+0767 : 0x33333333 */
+      3,  /* U+0768 - U+076F : 0x33333333 */
+      3,  /* U+0770 - U+0777 : 0x33333333 */
+      3,  /* U+0778 - U+077F : 0x33333333 */
+      3,  /* U+0780 - U+0787 : 0x33333333 */
+      3,  /* U+0788 - U+078F : 0x33333333 */
+      3,  /* U+0790 - U+0797 : 0x33333333 */
+      3,  /* U+0798 - U+079F : 0x33333333 */
+     51,  /* U+07A0 - U+07A7 : 0xAA333333 */
+     10,  /* U+07A8 - U+07AF : 0xAAAAAAAA */
+     50,  /* U+07B0 - U+07B7 : 0x3333333A */
+      3,  /* U+07B8 - U+07BF : 0x33333333 */
+      1,  /* U+07C0 - U+07C7 : 0x11111111 */
+      1,  /* U+07C8 - U+07CF : 0x11111111 */
+      1,  /* U+07D0 - U+07D7 : 0x11111111 */
+      1,  /* U+07D8 - U+07DF : 0x11111111 */
+      1,  /* U+07E0 - U+07E7 : 0x11111111 */
+      1,  /* U+07E8 - U+07EF : 0x11111111 */
+      1,  /* U+07F0 - U+07F7 : 0x11111111 */
+      1,  /* U+07F8 - U+07FF : 0x11111111 */
+};
+
+static PRUint8 gBidiCatIdx2[512] = {
+     58,  /* U+0900 - U+0907 : 0x11111AA1 */
+      1,  /* U+0908 - U+090F : 0x11111111 */
+      1,  /* U+0910 - U+0917 : 0x11111111 */
+      1,  /* U+0918 - U+091F : 0x11111111 */
+      1,  /* U+0920 - U+0927 : 0x11111111 */
+      1,  /* U+0928 - U+092F : 0x11111111 */
+      1,  /* U+0930 - U+0937 : 0x11111111 */
+     59,  /* U+0938 - U+093F : 0x111A1111 */
+     60,  /* U+0940 - U+0947 : 0xAAAAAAA1 */
+     61,  /* U+0948 - U+094F : 0x11A1111A */
+     62,  /* U+0950 - U+0957 : 0x111AAAA1 */
+      1,  /* U+0958 - U+095F : 0x11111111 */
+     63,  /* U+0960 - U+0967 : 0x1111AA11 */
+      1,  /* U+0968 - U+096F : 0x11111111 */
+      1,  /* U+0970 - U+0977 : 0x11111111 */
+      1,  /* U+0978 - U+097F : 0x11111111 */
+     64,  /* U+0980 - U+0987 : 0x111111A1 */
+      1,  /* U+0988 - U+098F : 0x11111111 */
+      1,  /* U+0990 - U+0997 : 0x11111111 */
+      1,  /* U+0998 - U+099F : 0x11111111 */
+      1,  /* U+09A0 - U+09A7 : 0x11111111 */
+      1,  /* U+09A8 - U+09AF : 0x11111111 */
+      1,  /* U+09B0 - U+09B7 : 0x11111111 */
+     59,  /* U+09B8 - U+09BF : 0x111A1111 */
+     62,  /* U+09C0 - U+09C7 : 0x111AAAA1 */
+     65,  /* U+09C8 - U+09CF : 0x11A11111 */
+      1,  /* U+09D0 - U+09D7 : 0x11111111 */
+      1,  /* U+09D8 - U+09DF : 0x11111111 */
+     63,  /* U+09E0 - U+09E7 : 0x1111AA11 */
+      1,  /* U+09E8 - U+09EF : 0x11111111 */
+     66,  /* U+09F0 - U+09F7 : 0x11117711 */
+      1,  /* U+09F8 - U+09FF : 0x11111111 */
+     67,  /* U+0A00 - U+0A07 : 0x11111A11 */
+      1,  /* U+0A08 - U+0A0F : 0x11111111 */
+      1,  /* U+0A10 - U+0A17 : 0x11111111 */
+      1,  /* U+0A18 - U+0A1F : 0x11111111 */
+      1,  /* U+0A20 - U+0A27 : 0x11111111 */
+      1,  /* U+0A28 - U+0A2F : 0x11111111 */
+      1,  /* U+0A30 - U+0A37 : 0x11111111 */
+     59,  /* U+0A38 - U+0A3F : 0x111A1111 */
+     68,  /* U+0A40 - U+0A47 : 0xA1111AA1 */
+     69,  /* U+0A48 - U+0A4F : 0x11AAA11A */
+      1,  /* U+0A50 - U+0A57 : 0x11111111 */
+      1,  /* U+0A58 - U+0A5F : 0x11111111 */
+      1,  /* U+0A60 - U+0A67 : 0x11111111 */
+      1,  /* U+0A68 - U+0A6F : 0x11111111 */
+     40,  /* U+0A70 - U+0A77 : 0x111111AA */
+      1,  /* U+0A78 - U+0A7F : 0x11111111 */
+     58,  /* U+0A80 - U+0A87 : 0x11111AA1 */
+      1,  /* U+0A88 - U+0A8F : 0x11111111 */
+      1,  /* U+0A90 - U+0A97 : 0x11111111 */
+      1,  /* U+0A98 - U+0A9F : 0x11111111 */
+      1,  /* U+0AA0 - U+0AA7 : 0x11111111 */
+      1,  /* U+0AA8 - U+0AAF : 0x11111111 */
+      1,  /* U+0AB0 - U+0AB7 : 0x11111111 */
+     59,  /* U+0AB8 - U+0ABF : 0x111A1111 */
+     70,  /* U+0AC0 - U+0AC7 : 0xA1AAAAA1 */
+     61,  /* U+0AC8 - U+0ACF : 0x11A1111A */
+      1,  /* U+0AD0 - U+0AD7 : 0x11111111 */
+      1,  /* U+0AD8 - U+0ADF : 0x11111111 */
+      1,  /* U+0AE0 - U+0AE7 : 0x11111111 */
+      1,  /* U+0AE8 - U+0AEF : 0x11111111 */
+      1,  /* U+0AF0 - U+0AF7 : 0x11111111 */
+      1,  /* U+0AF8 - U+0AFF : 0x11111111 */
+     64,  /* U+0B00 - U+0B07 : 0x111111A1 */
+      1,  /* U+0B08 - U+0B0F : 0x11111111 */
+      1,  /* U+0B10 - U+0B17 : 0x11111111 */
+      1,  /* U+0B18 - U+0B1F : 0x11111111 */
+      1,  /* U+0B20 - U+0B27 : 0x11111111 */
+      1,  /* U+0B28 - U+0B2F : 0x11111111 */
+      1,  /* U+0B30 - U+0B37 : 0x11111111 */
+     71,  /* U+0B38 - U+0B3F : 0xA11A1111 */
+     72,  /* U+0B40 - U+0B47 : 0x1111AAA1 */
+     65,  /* U+0B48 - U+0B4F : 0x11A11111 */
+     73,  /* U+0B50 - U+0B57 : 0x1A111111 */
+      1,  /* U+0B58 - U+0B5F : 0x11111111 */
+      1,  /* U+0B60 - U+0B67 : 0x11111111 */
+      1,  /* U+0B68 - U+0B6F : 0x11111111 */
+      1,  /* U+0B70 - U+0B77 : 0x11111111 */
+      1,  /* U+0B78 - U+0B7F : 0x11111111 */
+     67,  /* U+0B80 - U+0B87 : 0x11111A11 */
+      1,  /* U+0B88 - U+0B8F : 0x11111111 */
+      1,  /* U+0B90 - U+0B97 : 0x11111111 */
+      1,  /* U+0B98 - U+0B9F : 0x11111111 */
+      1,  /* U+0BA0 - U+0BA7 : 0x11111111 */
+      1,  /* U+0BA8 - U+0BAF : 0x11111111 */
+      1,  /* U+0BB0 - U+0BB7 : 0x11111111 */
+      1,  /* U+0BB8 - U+0BBF : 0x11111111 */
+     74,  /* U+0BC0 - U+0BC7 : 0x1111111A */
+     65,  /* U+0BC8 - U+0BCF : 0x11A11111 */
+      1,  /* U+0BD0 - U+0BD7 : 0x11111111 */
+      1,  /* U+0BD8 - U+0BDF : 0x11111111 */
+      1,  /* U+0BE0 - U+0BE7 : 0x11111111 */
+      1,  /* U+0BE8 - U+0BEF : 0x11111111 */
+      1,  /* U+0BF0 - U+0BF7 : 0x11111111 */
+      1,  /* U+0BF8 - U+0BFF : 0x11111111 */
+      1,  /* U+0C00 - U+0C07 : 0x11111111 */
+      1,  /* U+0C08 - U+0C0F : 0x11111111 */
+      1,  /* U+0C10 - U+0C17 : 0x11111111 */
+      1,  /* U+0C18 - U+0C1F : 0x11111111 */
+      1,  /* U+0C20 - U+0C27 : 0x11111111 */
+      1,  /* U+0C28 - U+0C2F : 0x11111111 */
+      1,  /* U+0C30 - U+0C37 : 0x11111111 */
+     75,  /* U+0C38 - U+0C3F : 0xAA111111 */
+     76,  /* U+0C40 - U+0C47 : 0xAA11111A */
+     77,  /* U+0C48 - U+0C4F : 0x11AAAA1A */
+     78,  /* U+0C50 - U+0C57 : 0x1AA11111 */
+      1,  /* U+0C58 - U+0C5F : 0x11111111 */
+      1,  /* U+0C60 - U+0C67 : 0x11111111 */
+      1,  /* U+0C68 - U+0C6F : 0x11111111 */
+      1,  /* U+0C70 - U+0C77 : 0x11111111 */
+      1,  /* U+0C78 - U+0C7F : 0x11111111 */
+      1,  /* U+0C80 - U+0C87 : 0x11111111 */
+      1,  /* U+0C88 - U+0C8F : 0x11111111 */
+      1,  /* U+0C90 - U+0C97 : 0x11111111 */
+      1,  /* U+0C98 - U+0C9F : 0x11111111 */
+      1,  /* U+0CA0 - U+0CA7 : 0x11111111 */
+      1,  /* U+0CA8 - U+0CAF : 0x11111111 */
+      1,  /* U+0CB0 - U+0CB7 : 0x11111111 */
+     79,  /* U+0CB8 - U+0CBF : 0xA1111111 */
+     73,  /* U+0CC0 - U+0CC7 : 0x1A111111 */
+     80,  /* U+0CC8 - U+0CCF : 0x11AA1111 */
+      1,  /* U+0CD0 - U+0CD7 : 0x11111111 */
+      1,  /* U+0CD8 - U+0CDF : 0x11111111 */
+      1,  /* U+0CE0 - U+0CE7 : 0x11111111 */
+      1,  /* U+0CE8 - U+0CEF : 0x11111111 */
+      1,  /* U+0CF0 - U+0CF7 : 0x11111111 */
+      1,  /* U+0CF8 - U+0CFF : 0x11111111 */
+      1,  /* U+0D00 - U+0D07 : 0x11111111 */
+      1,  /* U+0D08 - U+0D0F : 0x11111111 */
+      1,  /* U+0D10 - U+0D17 : 0x11111111 */
+      1,  /* U+0D18 - U+0D1F : 0x11111111 */
+      1,  /* U+0D20 - U+0D27 : 0x11111111 */
+      1,  /* U+0D28 - U+0D2F : 0x11111111 */
+      1,  /* U+0D30 - U+0D37 : 0x11111111 */
+      1,  /* U+0D38 - U+0D3F : 0x11111111 */
+     72,  /* U+0D40 - U+0D47 : 0x1111AAA1 */
+     65,  /* U+0D48 - U+0D4F : 0x11A11111 */
+      1,  /* U+0D50 - U+0D57 : 0x11111111 */
+      1,  /* U+0D58 - U+0D5F : 0x11111111 */
+      1,  /* U+0D60 - U+0D67 : 0x11111111 */
+      1,  /* U+0D68 - U+0D6F : 0x11111111 */
+      1,  /* U+0D70 - U+0D77 : 0x11111111 */
+      1,  /* U+0D78 - U+0D7F : 0x11111111 */
+      1,  /* U+0D80 - U+0D87 : 0x11111111 */
+      1,  /* U+0D88 - U+0D8F : 0x11111111 */
+      1,  /* U+0D90 - U+0D97 : 0x11111111 */
+      1,  /* U+0D98 - U+0D9F : 0x11111111 */
+      1,  /* U+0DA0 - U+0DA7 : 0x11111111 */
+      1,  /* U+0DA8 - U+0DAF : 0x11111111 */
+      1,  /* U+0DB0 - U+0DB7 : 0x11111111 */
+      1,  /* U+0DB8 - U+0DBF : 0x11111111 */
+      1,  /* U+0DC0 - U+0DC7 : 0x11111111 */
+     67,  /* U+0DC8 - U+0DCF : 0x11111A11 */
+     81,  /* U+0DD0 - U+0DD7 : 0x1A1AAA11 */
+      1,  /* U+0DD8 - U+0DDF : 0x11111111 */
+      1,  /* U+0DE0 - U+0DE7 : 0x11111111 */
+      1,  /* U+0DE8 - U+0DEF : 0x11111111 */
+      1,  /* U+0DF0 - U+0DF7 : 0x11111111 */
+      1,  /* U+0DF8 - U+0DFF : 0x11111111 */
+      1,  /* U+0E00 - U+0E07 : 0x11111111 */
+      1,  /* U+0E08 - U+0E0F : 0x11111111 */
+      1,  /* U+0E10 - U+0E17 : 0x11111111 */
+      1,  /* U+0E18 - U+0E1F : 0x11111111 */
+      1,  /* U+0E20 - U+0E27 : 0x11111111 */
+      1,  /* U+0E28 - U+0E2F : 0x11111111 */
+     82,  /* U+0E30 - U+0E37 : 0xAAAA11A1 */
+     83,  /* U+0E38 - U+0E3F : 0x71111AAA */
+     79,  /* U+0E40 - U+0E47 : 0xA1111111 */
+     34,  /* U+0E48 - U+0E4F : 0x1AAAAAAA */
+      1,  /* U+0E50 - U+0E57 : 0x11111111 */
+      1,  /* U+0E58 - U+0E5F : 0x11111111 */
+      1,  /* U+0E60 - U+0E67 : 0x11111111 */
+      1,  /* U+0E68 - U+0E6F : 0x11111111 */
+      1,  /* U+0E70 - U+0E77 : 0x11111111 */
+      1,  /* U+0E78 - U+0E7F : 0x11111111 */
+      1,  /* U+0E80 - U+0E87 : 0x11111111 */
+      1,  /* U+0E88 - U+0E8F : 0x11111111 */
+      1,  /* U+0E90 - U+0E97 : 0x11111111 */
+      1,  /* U+0E98 - U+0E9F : 0x11111111 */
+      1,  /* U+0EA0 - U+0EA7 : 0x11111111 */
+      1,  /* U+0EA8 - U+0EAF : 0x11111111 */
+     82,  /* U+0EB0 - U+0EB7 : 0xAAAA11A1 */
+     84,  /* U+0EB8 - U+0EBF : 0x111AA1AA */
+      1,  /* U+0EC0 - U+0EC7 : 0x11111111 */
+     85,  /* U+0EC8 - U+0ECF : 0x11AAAAAA */
+      1,  /* U+0ED0 - U+0ED7 : 0x11111111 */
+      1,  /* U+0ED8 - U+0EDF : 0x11111111 */
+      1,  /* U+0EE0 - U+0EE7 : 0x11111111 */
+      1,  /* U+0EE8 - U+0EEF : 0x11111111 */
+      1,  /* U+0EF0 - U+0EF7 : 0x11111111 */
+      1,  /* U+0EF8 - U+0EFF : 0x11111111 */
+      1,  /* U+0F00 - U+0F07 : 0x11111111 */
+      1,  /* U+0F08 - U+0F0F : 0x11111111 */
+      1,  /* U+0F10 - U+0F17 : 0x11111111 */
+     40,  /* U+0F18 - U+0F1F : 0x111111AA */
+      1,  /* U+0F20 - U+0F27 : 0x11111111 */
+      1,  /* U+0F28 - U+0F2F : 0x11111111 */
+     86,  /* U+0F30 - U+0F37 : 0xA1A11111 */
+     87,  /* U+0F38 - U+0F3F : 0x119999A1 */
+      1,  /* U+0F40 - U+0F47 : 0x11111111 */
+      1,  /* U+0F48 - U+0F4F : 0x11111111 */
+      1,  /* U+0F50 - U+0F57 : 0x11111111 */
+      1,  /* U+0F58 - U+0F5F : 0x11111111 */
+      1,  /* U+0F60 - U+0F67 : 0x11111111 */
+      1,  /* U+0F68 - U+0F6F : 0x11111111 */
+     60,  /* U+0F70 - U+0F77 : 0xAAAAAAA1 */
+     34,  /* U+0F78 - U+0F7F : 0x1AAAAAAA */
+     88,  /* U+0F80 - U+0F87 : 0xAA1AAAAA */
+      1,  /* U+0F88 - U+0F8F : 0x11111111 */
+     10,  /* U+0F90 - U+0F97 : 0xAAAAAAAA */
+     60,  /* U+0F98 - U+0F9F : 0xAAAAAAA1 */
+     10,  /* U+0FA0 - U+0FA7 : 0xAAAAAAAA */
+     10,  /* U+0FA8 - U+0FAF : 0xAAAAAAAA */
+     10,  /* U+0FB0 - U+0FB7 : 0xAAAAAAAA */
+     89,  /* U+0FB8 - U+0FBF : 0x111AAAAA */
+     73,  /* U+0FC0 - U+0FC7 : 0x1A111111 */
+      1,  /* U+0FC8 - U+0FCF : 0x11111111 */
+      1,  /* U+0FD0 - U+0FD7 : 0x11111111 */
+      1,  /* U+0FD8 - U+0FDF : 0x11111111 */
+      1,  /* U+0FE0 - U+0FE7 : 0x11111111 */
+      1,  /* U+0FE8 - U+0FEF : 0x11111111 */
+      1,  /* U+0FF0 - U+0FF7 : 0x11111111 */
+      1,  /* U+0FF8 - U+0FFF : 0x11111111 */
+      1,  /* U+1000 - U+1007 : 0x11111111 */
+      1,  /* U+1008 - U+100F : 0x11111111 */
+      1,  /* U+1010 - U+1017 : 0x11111111 */
+      1,  /* U+1018 - U+101F : 0x11111111 */
+      1,  /* U+1020 - U+1027 : 0x11111111 */
+     90,  /* U+1028 - U+102F : 0xAAA11111 */
+     91,  /* U+1030 - U+1037 : 0xAA111A1A */
+     64,  /* U+1038 - U+103F : 0x111111A1 */
+      1,  /* U+1040 - U+1047 : 0x11111111 */
+      1,  /* U+1048 - U+104F : 0x11111111 */
+      1,  /* U+1050 - U+1057 : 0x11111111 */
+     40,  /* U+1058 - U+105F : 0x111111AA */
+      1,  /* U+1060 - U+1067 : 0x11111111 */
+      1,  /* U+1068 - U+106F : 0x11111111 */
+      1,  /* U+1070 - U+1077 : 0x11111111 */
+      1,  /* U+1078 - U+107F : 0x11111111 */
+      1,  /* U+1080 - U+1087 : 0x11111111 */
+      1,  /* U+1088 - U+108F : 0x11111111 */
+      1,  /* U+1090 - U+1097 : 0x11111111 */
+      1,  /* U+1098 - U+109F : 0x11111111 */
+      1,  /* U+10A0 - U+10A7 : 0x11111111 */
+      1,  /* U+10A8 - U+10AF : 0x11111111 */
+      1,  /* U+10B0 - U+10B7 : 0x11111111 */
+      1,  /* U+10B8 - U+10BF : 0x11111111 */
+      1,  /* U+10C0 - U+10C7 : 0x11111111 */
+      1,  /* U+10C8 - U+10CF : 0x11111111 */
+      1,  /* U+10D0 - U+10D7 : 0x11111111 */
+      1,  /* U+10D8 - U+10DF : 0x11111111 */
+      1,  /* U+10E0 - U+10E7 : 0x11111111 */
+      1,  /* U+10E8 - U+10EF : 0x11111111 */
+      1,  /* U+10F0 - U+10F7 : 0x11111111 */
+      1,  /* U+10F8 - U+10FF : 0x11111111 */
+      1,  /* U+1100 - U+1107 : 0x11111111 */
+      1,  /* U+1108 - U+110F : 0x11111111 */
+      1,  /* U+1110 - U+1117 : 0x11111111 */
+      1,  /* U+1118 - U+111F : 0x11111111 */
+      1,  /* U+1120 - U+1127 : 0x11111111 */
+      1,  /* U+1128 - U+112F : 0x11111111 */
+      1,  /* U+1130 - U+1137 : 0x11111111 */
+      1,  /* U+1138 - U+113F : 0x11111111 */
+      1,  /* U+1140 - U+1147 : 0x11111111 */
+      1,  /* U+1148 - U+114F : 0x11111111 */
+      1,  /* U+1150 - U+1157 : 0x11111111 */
+      1,  /* U+1158 - U+115F : 0x11111111 */
+      1,  /* U+1160 - U+1167 : 0x11111111 */
+      1,  /* U+1168 - U+116F : 0x11111111 */
+      1,  /* U+1170 - U+1177 : 0x11111111 */
+      1,  /* U+1178 - U+117F : 0x11111111 */
+      1,  /* U+1180 - U+1187 : 0x11111111 */
+      1,  /* U+1188 - U+118F : 0x11111111 */
+      1,  /* U+1190 - U+1197 : 0x11111111 */
+      1,  /* U+1198 - U+119F : 0x11111111 */
+      1,  /* U+11A0 - U+11A7 : 0x11111111 */
+      1,  /* U+11A8 - U+11AF : 0x11111111 */
+      1,  /* U+11B0 - U+11B7 : 0x11111111 */
+      1,  /* U+11B8 - U+11BF : 0x11111111 */
+      1,  /* U+11C0 - U+11C7 : 0x11111111 */
+      1,  /* U+11C8 - U+11CF : 0x11111111 */
+      1,  /* U+11D0 - U+11D7 : 0x11111111 */
+      1,  /* U+11D8 - U+11DF : 0x11111111 */
+      1,  /* U+11E0 - U+11E7 : 0x11111111 */
+      1,  /* U+11E8 - U+11EF : 0x11111111 */
+      1,  /* U+11F0 - U+11F7 : 0x11111111 */
+      1,  /* U+11F8 - U+11FF : 0x11111111 */
+      1,  /* U+1200 - U+1207 : 0x11111111 */
+      1,  /* U+1208 - U+120F : 0x11111111 */
+      1,  /* U+1210 - U+1217 : 0x11111111 */
+      1,  /* U+1218 - U+121F : 0x11111111 */
+      1,  /* U+1220 - U+1227 : 0x11111111 */
+      1,  /* U+1228 - U+122F : 0x11111111 */
+      1,  /* U+1230 - U+1237 : 0x11111111 */
+      1,  /* U+1238 - U+123F : 0x11111111 */
+      1,  /* U+1240 - U+1247 : 0x11111111 */
+      1,  /* U+1248 - U+124F : 0x11111111 */
+      1,  /* U+1250 - U+1257 : 0x11111111 */
+      1,  /* U+1258 - U+125F : 0x11111111 */
+      1,  /* U+1260 - U+1267 : 0x11111111 */
+      1,  /* U+1268 - U+126F : 0x11111111 */
+      1,  /* U+1270 - U+1277 : 0x11111111 */
+      1,  /* U+1278 - U+127F : 0x11111111 */
+      1,  /* U+1280 - U+1287 : 0x11111111 */
+      1,  /* U+1288 - U+128F : 0x11111111 */
+      1,  /* U+1290 - U+1297 : 0x11111111 */
+      1,  /* U+1298 - U+129F : 0x11111111 */
+      1,  /* U+12A0 - U+12A7 : 0x11111111 */
+      1,  /* U+12A8 - U+12AF : 0x11111111 */
+      1,  /* U+12B0 - U+12B7 : 0x11111111 */
+      1,  /* U+12B8 - U+12BF : 0x11111111 */
+      1,  /* U+12C0 - U+12C7 : 0x11111111 */
+      1,  /* U+12C8 - U+12CF : 0x11111111 */
+      1,  /* U+12D0 - U+12D7 : 0x11111111 */
+      1,  /* U+12D8 - U+12DF : 0x11111111 */
+      1,  /* U+12E0 - U+12E7 : 0x11111111 */
+      1,  /* U+12E8 - U+12EF : 0x11111111 */
+      1,  /* U+12F0 - U+12F7 : 0x11111111 */
+      1,  /* U+12F8 - U+12FF : 0x11111111 */
+      1,  /* U+1300 - U+1307 : 0x11111111 */
+      1,  /* U+1308 - U+130F : 0x11111111 */
+      1,  /* U+1310 - U+1317 : 0x11111111 */
+      1,  /* U+1318 - U+131F : 0x11111111 */
+      1,  /* U+1320 - U+1327 : 0x11111111 */
+      1,  /* U+1328 - U+132F : 0x11111111 */
+      1,  /* U+1330 - U+1337 : 0x11111111 */
+      1,  /* U+1338 - U+133F : 0x11111111 */
+      1,  /* U+1340 - U+1347 : 0x11111111 */
+      1,  /* U+1348 - U+134F : 0x11111111 */
+      1,  /* U+1350 - U+1357 : 0x11111111 */
+      1,  /* U+1358 - U+135F : 0x11111111 */
+      1,  /* U+1360 - U+1367 : 0x11111111 */
+      1,  /* U+1368 - U+136F : 0x11111111 */
+      1,  /* U+1370 - U+1377 : 0x11111111 */
+      1,  /* U+1378 - U+137F : 0x11111111 */
+      1,  /* U+1380 - U+1387 : 0x11111111 */
+      1,  /* U+1388 - U+138F : 0x11111111 */
+      1,  /* U+1390 - U+1397 : 0x11111111 */
+      1,  /* U+1398 - U+139F : 0x11111111 */
+      1,  /* U+13A0 - U+13A7 : 0x11111111 */
+      1,  /* U+13A8 - U+13AF : 0x11111111 */
+      1,  /* U+13B0 - U+13B7 : 0x11111111 */
+      1,  /* U+13B8 - U+13BF : 0x11111111 */
+      1,  /* U+13C0 - U+13C7 : 0x11111111 */
+      1,  /* U+13C8 - U+13CF : 0x11111111 */
+      1,  /* U+13D0 - U+13D7 : 0x11111111 */
+      1,  /* U+13D8 - U+13DF : 0x11111111 */
+      1,  /* U+13E0 - U+13E7 : 0x11111111 */
+      1,  /* U+13E8 - U+13EF : 0x11111111 */
+      1,  /* U+13F0 - U+13F7 : 0x11111111 */
+      1,  /* U+13F8 - U+13FF : 0x11111111 */
+      1,  /* U+1400 - U+1407 : 0x11111111 */
+      1,  /* U+1408 - U+140F : 0x11111111 */
+      1,  /* U+1410 - U+1417 : 0x11111111 */
+      1,  /* U+1418 - U+141F : 0x11111111 */
+      1,  /* U+1420 - U+1427 : 0x11111111 */
+      1,  /* U+1428 - U+142F : 0x11111111 */
+      1,  /* U+1430 - U+1437 : 0x11111111 */
+      1,  /* U+1438 - U+143F : 0x11111111 */
+      1,  /* U+1440 - U+1447 : 0x11111111 */
+      1,  /* U+1448 - U+144F : 0x11111111 */
+      1,  /* U+1450 - U+1457 : 0x11111111 */
+      1,  /* U+1458 - U+145F : 0x11111111 */
+      1,  /* U+1460 - U+1467 : 0x11111111 */
+      1,  /* U+1468 - U+146F : 0x11111111 */
+      1,  /* U+1470 - U+1477 : 0x11111111 */
+      1,  /* U+1478 - U+147F : 0x11111111 */
+      1,  /* U+1480 - U+1487 : 0x11111111 */
+      1,  /* U+1488 - U+148F : 0x11111111 */
+      1,  /* U+1490 - U+1497 : 0x11111111 */
+      1,  /* U+1498 - U+149F : 0x11111111 */
+      1,  /* U+14A0 - U+14A7 : 0x11111111 */
+      1,  /* U+14A8 - U+14AF : 0x11111111 */
+      1,  /* U+14B0 - U+14B7 : 0x11111111 */
+      1,  /* U+14B8 - U+14BF : 0x11111111 */
+      1,  /* U+14C0 - U+14C7 : 0x11111111 */
+      1,  /* U+14C8 - U+14CF : 0x11111111 */
+      1,  /* U+14D0 - U+14D7 : 0x11111111 */
+      1,  /* U+14D8 - U+14DF : 0x11111111 */
+      1,  /* U+14E0 - U+14E7 : 0x11111111 */
+      1,  /* U+14E8 - U+14EF : 0x11111111 */
+      1,  /* U+14F0 - U+14F7 : 0x11111111 */
+      1,  /* U+14F8 - U+14FF : 0x11111111 */
+      1,  /* U+1500 - U+1507 : 0x11111111 */
+      1,  /* U+1508 - U+150F : 0x11111111 */
+      1,  /* U+1510 - U+1517 : 0x11111111 */
+      1,  /* U+1518 - U+151F : 0x11111111 */
+      1,  /* U+1520 - U+1527 : 0x11111111 */
+      1,  /* U+1528 - U+152F : 0x11111111 */
+      1,  /* U+1530 - U+1537 : 0x11111111 */
+      1,  /* U+1538 - U+153F : 0x11111111 */
+      1,  /* U+1540 - U+1547 : 0x11111111 */
+      1,  /* U+1548 - U+154F : 0x11111111 */
+      1,  /* U+1550 - U+1557 : 0x11111111 */
+      1,  /* U+1558 - U+155F : 0x11111111 */
+      1,  /* U+1560 - U+1567 : 0x11111111 */
+      1,  /* U+1568 - U+156F : 0x11111111 */
+      1,  /* U+1570 - U+1577 : 0x11111111 */
+      1,  /* U+1578 - U+157F : 0x11111111 */
+      1,  /* U+1580 - U+1587 : 0x11111111 */
+      1,  /* U+1588 - U+158F : 0x11111111 */
+      1,  /* U+1590 - U+1597 : 0x11111111 */
+      1,  /* U+1598 - U+159F : 0x11111111 */
+      1,  /* U+15A0 - U+15A7 : 0x11111111 */
+      1,  /* U+15A8 - U+15AF : 0x11111111 */
+      1,  /* U+15B0 - U+15B7 : 0x11111111 */
+      1,  /* U+15B8 - U+15BF : 0x11111111 */
+      1,  /* U+15C0 - U+15C7 : 0x11111111 */
+      1,  /* U+15C8 - U+15CF : 0x11111111 */
+      1,  /* U+15D0 - U+15D7 : 0x11111111 */
+      1,  /* U+15D8 - U+15DF : 0x11111111 */
+      1,  /* U+15E0 - U+15E7 : 0x11111111 */
+      1,  /* U+15E8 - U+15EF : 0x11111111 */
+      1,  /* U+15F0 - U+15F7 : 0x11111111 */
+      1,  /* U+15F8 - U+15FF : 0x11111111 */
+      1,  /* U+1600 - U+1607 : 0x11111111 */
+      1,  /* U+1608 - U+160F : 0x11111111 */
+      1,  /* U+1610 - U+1617 : 0x11111111 */
+      1,  /* U+1618 - U+161F : 0x11111111 */
+      1,  /* U+1620 - U+1627 : 0x11111111 */
+      1,  /* U+1628 - U+162F : 0x11111111 */
+      1,  /* U+1630 - U+1637 : 0x11111111 */
+      1,  /* U+1638 - U+163F : 0x11111111 */
+      1,  /* U+1640 - U+1647 : 0x11111111 */
+      1,  /* U+1648 - U+164F : 0x11111111 */
+      1,  /* U+1650 - U+1657 : 0x11111111 */
+      1,  /* U+1658 - U+165F : 0x11111111 */
+      1,  /* U+1660 - U+1667 : 0x11111111 */
+      1,  /* U+1668 - U+166F : 0x11111111 */
+      1,  /* U+1670 - U+1677 : 0x11111111 */
+      1,  /* U+1678 - U+167F : 0x11111111 */
+     92,  /* U+1680 - U+1687 : 0x1111111E */
+      1,  /* U+1688 - U+168F : 0x11111111 */
+      1,  /* U+1690 - U+1697 : 0x11111111 */
+     93,  /* U+1698 - U+169F : 0x11199111 */
+      1,  /* U+16A0 - U+16A7 : 0x11111111 */
+      1,  /* U+16A8 - U+16AF : 0x11111111 */
+      1,  /* U+16B0 - U+16B7 : 0x11111111 */
+      1,  /* U+16B8 - U+16BF : 0x11111111 */
+      1,  /* U+16C0 - U+16C7 : 0x11111111 */
+      1,  /* U+16C8 - U+16CF : 0x11111111 */
+      1,  /* U+16D0 - U+16D7 : 0x11111111 */
+      1,  /* U+16D8 - U+16DF : 0x11111111 */
+      1,  /* U+16E0 - U+16E7 : 0x11111111 */
+      1,  /* U+16E8 - U+16EF : 0x11111111 */
+      1,  /* U+16F0 - U+16F7 : 0x11111111 */
+      1,  /* U+16F8 - U+16FF : 0x11111111 */
+      1,  /* U+1700 - U+1707 : 0x11111111 */
+      1,  /* U+1708 - U+170F : 0x11111111 */
+      1,  /* U+1710 - U+1717 : 0x11111111 */
+      1,  /* U+1718 - U+171F : 0x11111111 */
+      1,  /* U+1720 - U+1727 : 0x11111111 */
+      1,  /* U+1728 - U+172F : 0x11111111 */
+      1,  /* U+1730 - U+1737 : 0x11111111 */
+      1,  /* U+1738 - U+173F : 0x11111111 */
+      1,  /* U+1740 - U+1747 : 0x11111111 */
+      1,  /* U+1748 - U+174F : 0x11111111 */
+      1,  /* U+1750 - U+1757 : 0x11111111 */
+      1,  /* U+1758 - U+175F : 0x11111111 */
+      1,  /* U+1760 - U+1767 : 0x11111111 */
+      1,  /* U+1768 - U+176F : 0x11111111 */
+      1,  /* U+1770 - U+1777 : 0x11111111 */
+      1,  /* U+1778 - U+177F : 0x11111111 */
+      1,  /* U+1780 - U+1787 : 0x11111111 */
+      1,  /* U+1788 - U+178F : 0x11111111 */
+      1,  /* U+1790 - U+1797 : 0x11111111 */
+      1,  /* U+1798 - U+179F : 0x11111111 */
+      1,  /* U+17A0 - U+17A7 : 0x11111111 */
+      1,  /* U+17A8 - U+17AF : 0x11111111 */
+     79,  /* U+17B0 - U+17B7 : 0xA1111111 */
+     85,  /* U+17B8 - U+17BF : 0x11AAAAAA */
+     73,  /* U+17C0 - U+17C7 : 0x1A111111 */
+     60,  /* U+17C8 - U+17CF : 0xAAAAAAA1 */
+     94,  /* U+17D0 - U+17D7 : 0x1111AAAA */
+     95,  /* U+17D8 - U+17DF : 0x11117111 */
+      1,  /* U+17E0 - U+17E7 : 0x11111111 */
+      1,  /* U+17E8 - U+17EF : 0x11111111 */
+      1,  /* U+17F0 - U+17F7 : 0x11111111 */
+      1,  /* U+17F8 - U+17FF : 0x11111111 */
+      9,  /* U+1800 - U+1807 : 0x99999999 */
+     96,  /* U+1808 - U+180F : 0x1BBBB999 */
+      1,  /* U+1810 - U+1817 : 0x11111111 */
+      1,  /* U+1818 - U+181F : 0x11111111 */
+      1,  /* U+1820 - U+1827 : 0x11111111 */
+      1,  /* U+1828 - U+182F : 0x11111111 */
+      1,  /* U+1830 - U+1837 : 0x11111111 */
+      1,  /* U+1838 - U+183F : 0x11111111 */
+      1,  /* U+1840 - U+1847 : 0x11111111 */
+      1,  /* U+1848 - U+184F : 0x11111111 */
+      1,  /* U+1850 - U+1857 : 0x11111111 */
+      1,  /* U+1858 - U+185F : 0x11111111 */
+      1,  /* U+1860 - U+1867 : 0x11111111 */
+      1,  /* U+1868 - U+186F : 0x11111111 */
+      1,  /* U+1870 - U+1877 : 0x11111111 */
+      1,  /* U+1878 - U+187F : 0x11111111 */
+      1,  /* U+1880 - U+1887 : 0x11111111 */
+      1,  /* U+1888 - U+188F : 0x11111111 */
+      1,  /* U+1890 - U+1897 : 0x11111111 */
+      1,  /* U+1898 - U+189F : 0x11111111 */
+      1,  /* U+18A0 - U+18A7 : 0x11111111 */
+     64,  /* U+18A8 - U+18AF : 0x111111A1 */
+      1,  /* U+18B0 - U+18B7 : 0x11111111 */
+      1,  /* U+18B8 - U+18BF : 0x11111111 */
+      1,  /* U+18C0 - U+18C7 : 0x11111111 */
+      1,  /* U+18C8 - U+18CF : 0x11111111 */
+      1,  /* U+18D0 - U+18D7 : 0x11111111 */
+      1,  /* U+18D8 - U+18DF : 0x11111111 */
+      1,  /* U+18E0 - U+18E7 : 0x11111111 */
+      1,  /* U+18E8 - U+18EF : 0x11111111 */
+      1,  /* U+18F0 - U+18F7 : 0x11111111 */
+      1,  /* U+18F8 - U+18FF : 0x11111111 */
+};
+
+static PRUint8 gBidiCatIdx3[352] = {
+      1,  /* U+1E00 - U+1E07 : 0x11111111 */
+      1,  /* U+1E08 - U+1E0F : 0x11111111 */
+      1,  /* U+1E10 - U+1E17 : 0x11111111 */
+      1,  /* U+1E18 - U+1E1F : 0x11111111 */
+      1,  /* U+1E20 - U+1E27 : 0x11111111 */
+      1,  /* U+1E28 - U+1E2F : 0x11111111 */
+      1,  /* U+1E30 - U+1E37 : 0x11111111 */
+      1,  /* U+1E38 - U+1E3F : 0x11111111 */
+      1,  /* U+1E40 - U+1E47 : 0x11111111 */
+      1,  /* U+1E48 - U+1E4F : 0x11111111 */
+      1,  /* U+1E50 - U+1E57 : 0x11111111 */
+      1,  /* U+1E58 - U+1E5F : 0x11111111 */
+      1,  /* U+1E60 - U+1E67 : 0x11111111 */
+      1,  /* U+1E68 - U+1E6F : 0x11111111 */
+      1,  /* U+1E70 - U+1E77 : 0x11111111 */
+      1,  /* U+1E78 - U+1E7F : 0x11111111 */
+      1,  /* U+1E80 - U+1E87 : 0x11111111 */
+      1,  /* U+1E88 - U+1E8F : 0x11111111 */
+      1,  /* U+1E90 - U+1E97 : 0x11111111 */
+      1,  /* U+1E98 - U+1E9F : 0x11111111 */
+      1,  /* U+1EA0 - U+1EA7 : 0x11111111 */
+      1,  /* U+1EA8 - U+1EAF : 0x11111111 */
+      1,  /* U+1EB0 - U+1EB7 : 0x11111111 */
+      1,  /* U+1EB8 - U+1EBF : 0x11111111 */
+      1,  /* U+1EC0 - U+1EC7 : 0x11111111 */
+      1,  /* U+1EC8 - U+1ECF : 0x11111111 */
+      1,  /* U+1ED0 - U+1ED7 : 0x11111111 */
+      1,  /* U+1ED8 - U+1EDF : 0x11111111 */
+      1,  /* U+1EE0 - U+1EE7 : 0x11111111 */
+      1,  /* U+1EE8 - U+1EEF : 0x11111111 */
+      1,  /* U+1EF0 - U+1EF7 : 0x11111111 */
+      1,  /* U+1EF8 - U+1EFF : 0x11111111 */
+      1,  /* U+1F00 - U+1F07 : 0x11111111 */
+      1,  /* U+1F08 - U+1F0F : 0x11111111 */
+      1,  /* U+1F10 - U+1F17 : 0x11111111 */
+      1,  /* U+1F18 - U+1F1F : 0x11111111 */
+      1,  /* U+1F20 - U+1F27 : 0x11111111 */
+      1,  /* U+1F28 - U+1F2F : 0x11111111 */
+      1,  /* U+1F30 - U+1F37 : 0x11111111 */
+      1,  /* U+1F38 - U+1F3F : 0x11111111 */
+      1,  /* U+1F40 - U+1F47 : 0x11111111 */
+      1,  /* U+1F48 - U+1F4F : 0x11111111 */
+      1,  /* U+1F50 - U+1F57 : 0x11111111 */
+      1,  /* U+1F58 - U+1F5F : 0x11111111 */
+      1,  /* U+1F60 - U+1F67 : 0x11111111 */
+      1,  /* U+1F68 - U+1F6F : 0x11111111 */
+      1,  /* U+1F70 - U+1F77 : 0x11111111 */
+      1,  /* U+1F78 - U+1F7F : 0x11111111 */
+      1,  /* U+1F80 - U+1F87 : 0x11111111 */
+      1,  /* U+1F88 - U+1F8F : 0x11111111 */
+      1,  /* U+1F90 - U+1F97 : 0x11111111 */
+      1,  /* U+1F98 - U+1F9F : 0x11111111 */
+      1,  /* U+1FA0 - U+1FA7 : 0x11111111 */
+      1,  /* U+1FA8 - U+1FAF : 0x11111111 */
+      1,  /* U+1FB0 - U+1FB7 : 0x11111111 */
+     97,  /* U+1FB8 - U+1FBF : 0x91911111 */
+     98,  /* U+1FC0 - U+1FC7 : 0x11111199 */
+     32,  /* U+1FC8 - U+1FCF : 0x99911111 */
+      1,  /* U+1FD0 - U+1FD7 : 0x11111111 */
+     32,  /* U+1FD8 - U+1FDF : 0x99911111 */
+      1,  /* U+1FE0 - U+1FE7 : 0x11111111 */
+     32,  /* U+1FE8 - U+1FEF : 0x99911111 */
+      1,  /* U+1FF0 - U+1FF7 : 0x11111111 */
+     99,  /* U+1FF8 - U+1FFF : 0x19911111 */
+     14,  /* U+2000 - U+2007 : 0xEEEEEEEE */
+    100,  /* U+2008 - U+200F : 0x21BBBEEE */
+      9,  /* U+2010 - U+2017 : 0x99999999 */
+      9,  /* U+2018 - U+201F : 0x99999999 */
+      9,  /* U+2020 - U+2027 : 0x99999999 */
+    101,  /* U+2028 - U+202F : 0xEFFFFFCE */
+    102,  /* U+2030 - U+2037 : 0x99977777 */
+      9,  /* U+2038 - U+203F : 0x99999999 */
+    103,  /* U+2040 - U+2047 : 0x19999999 */
+     33,  /* U+2048 - U+204F : 0x11999999 */
+      1,  /* U+2050 - U+2057 : 0x11111111 */
+      1,  /* U+2058 - U+205F : 0x11111111 */
+      1,  /* U+2060 - U+2067 : 0x11111111 */
+    104,  /* U+2068 - U+206F : 0xBBBBBB11 */
+    105,  /* U+2070 - U+2077 : 0x55551115 */
+    106,  /* U+2078 - U+207F : 0x19997755 */
+      5,  /* U+2080 - U+2087 : 0x55555555 */
+    106,  /* U+2088 - U+208F : 0x19997755 */
+      1,  /* U+2090 - U+2097 : 0x11111111 */
+      1,  /* U+2098 - U+209F : 0x11111111 */
+      7,  /* U+20A0 - U+20A7 : 0x77777777 */
+      7,  /* U+20A8 - U+20AF : 0x77777777 */
+      1,  /* U+20B0 - U+20B7 : 0x11111111 */
+      1,  /* U+20B8 - U+20BF : 0x11111111 */
+      1,  /* U+20C0 - U+20C7 : 0x11111111 */
+      1,  /* U+20C8 - U+20CF : 0x11111111 */
+     10,  /* U+20D0 - U+20D7 : 0xAAAAAAAA */
+     10,  /* U+20D8 - U+20DF : 0xAAAAAAAA */
+     94,  /* U+20E0 - U+20E7 : 0x1111AAAA */
+      1,  /* U+20E8 - U+20EF : 0x11111111 */
+      1,  /* U+20F0 - U+20F7 : 0x11111111 */
+      1,  /* U+20F8 - U+20FF : 0x11111111 */
+    107,  /* U+2100 - U+2107 : 0x19999199 */
+     98,  /* U+2108 - U+210F : 0x11111199 */
+    108,  /* U+2110 - U+2117 : 0x99191111 */
+    109,  /* U+2118 - U+211F : 0x99111119 */
+    110,  /* U+2120 - U+2127 : 0x91919999 */
+    111,  /* U+2128 - U+212F : 0x17111191 */
+     41,  /* U+2130 - U+2137 : 0x11111911 */
+     41,  /* U+2138 - U+213F : 0x11111911 */
+      1,  /* U+2140 - U+2147 : 0x11111111 */
+      1,  /* U+2148 - U+214F : 0x11111111 */
+     22,  /* U+2150 - U+2157 : 0x99999111 */
+      9,  /* U+2158 - U+215F : 0x99999999 */
+      1,  /* U+2160 - U+2167 : 0x11111111 */
+      1,  /* U+2168 - U+216F : 0x11111111 */
+      1,  /* U+2170 - U+2177 : 0x11111111 */
+      1,  /* U+2178 - U+217F : 0x11111111 */
+      1,  /* U+2180 - U+2187 : 0x11111111 */
+      1,  /* U+2188 - U+218F : 0x11111111 */
+      9,  /* U+2190 - U+2197 : 0x99999999 */
+      9,  /* U+2198 - U+219F : 0x99999999 */
+      9,  /* U+21A0 - U+21A7 : 0x99999999 */
+      9,  /* U+21A8 - U+21AF : 0x99999999 */
+      9,  /* U+21B0 - U+21B7 : 0x99999999 */
+      9,  /* U+21B8 - U+21BF : 0x99999999 */
+      9,  /* U+21C0 - U+21C7 : 0x99999999 */
+      9,  /* U+21C8 - U+21CF : 0x99999999 */
+      9,  /* U+21D0 - U+21D7 : 0x99999999 */
+      9,  /* U+21D8 - U+21DF : 0x99999999 */
+      9,  /* U+21E0 - U+21E7 : 0x99999999 */
+      9,  /* U+21E8 - U+21EF : 0x99999999 */
+    112,  /* U+21F0 - U+21F7 : 0x11119999 */
+      1,  /* U+21F8 - U+21FF : 0x11111111 */
+      9,  /* U+2200 - U+2207 : 0x99999999 */
+      9,  /* U+2208 - U+220F : 0x99999999 */
+    113,  /* U+2210 - U+2217 : 0x99997799 */
+      9,  /* U+2218 - U+221F : 0x99999999 */
+      9,  /* U+2220 - U+2227 : 0x99999999 */
+      9,  /* U+2228 - U+222F : 0x99999999 */
+      9,  /* U+2230 - U+2237 : 0x99999999 */
+      9,  /* U+2238 - U+223F : 0x99999999 */
+      9,  /* U+2240 - U+2247 : 0x99999999 */
+      9,  /* U+2248 - U+224F : 0x99999999 */
+      9,  /* U+2250 - U+2257 : 0x99999999 */
+      9,  /* U+2258 - U+225F : 0x99999999 */
+      9,  /* U+2260 - U+2267 : 0x99999999 */
+      9,  /* U+2268 - U+226F : 0x99999999 */
+      9,  /* U+2270 - U+2277 : 0x99999999 */
+      9,  /* U+2278 - U+227F : 0x99999999 */
+      9,  /* U+2280 - U+2287 : 0x99999999 */
+      9,  /* U+2288 - U+228F : 0x99999999 */
+      9,  /* U+2290 - U+2297 : 0x99999999 */
+      9,  /* U+2298 - U+229F : 0x99999999 */
+      9,  /* U+22A0 - U+22A7 : 0x99999999 */
+      9,  /* U+22A8 - U+22AF : 0x99999999 */
+      9,  /* U+22B0 - U+22B7 : 0x99999999 */
+      9,  /* U+22B8 - U+22BF : 0x99999999 */
+      9,  /* U+22C0 - U+22C7 : 0x99999999 */
+      9,  /* U+22C8 - U+22CF : 0x99999999 */
+      9,  /* U+22D0 - U+22D7 : 0x99999999 */
+      9,  /* U+22D8 - U+22DF : 0x99999999 */
+      9,  /* U+22E0 - U+22E7 : 0x99999999 */
+      9,  /* U+22E8 - U+22EF : 0x99999999 */
+     98,  /* U+22F0 - U+22F7 : 0x11111199 */
+      1,  /* U+22F8 - U+22FF : 0x11111111 */
+      9,  /* U+2300 - U+2307 : 0x99999999 */
+      9,  /* U+2308 - U+230F : 0x99999999 */
+      9,  /* U+2310 - U+2317 : 0x99999999 */
+      9,  /* U+2318 - U+231F : 0x99999999 */
+      9,  /* U+2320 - U+2327 : 0x99999999 */
+      9,  /* U+2328 - U+232F : 0x99999999 */
+     33,  /* U+2330 - U+2337 : 0x11999999 */
+      1,  /* U+2338 - U+233F : 0x11111111 */
+      1,  /* U+2340 - U+2347 : 0x11111111 */
+      1,  /* U+2348 - U+234F : 0x11111111 */
+      1,  /* U+2350 - U+2357 : 0x11111111 */
+      1,  /* U+2358 - U+235F : 0x11111111 */
+      1,  /* U+2360 - U+2367 : 0x11111111 */
+      1,  /* U+2368 - U+236F : 0x11111111 */
+      1,  /* U+2370 - U+2377 : 0x11111111 */
+    114,  /* U+2378 - U+237F : 0x99919111 */
+      9,  /* U+2380 - U+2387 : 0x99999999 */
+      9,  /* U+2388 - U+238F : 0x99999999 */
+    115,  /* U+2390 - U+2397 : 0x99199999 */
+    116,  /* U+2398 - U+239F : 0x11111999 */
+      1,  /* U+23A0 - U+23A7 : 0x11111111 */
+      1,  /* U+23A8 - U+23AF : 0x11111111 */
+      1,  /* U+23B0 - U+23B7 : 0x11111111 */
+      1,  /* U+23B8 - U+23BF : 0x11111111 */
+      1,  /* U+23C0 - U+23C7 : 0x11111111 */
+      1,  /* U+23C8 - U+23CF : 0x11111111 */
+      1,  /* U+23D0 - U+23D7 : 0x11111111 */
+      1,  /* U+23D8 - U+23DF : 0x11111111 */
+      1,  /* U+23E0 - U+23E7 : 0x11111111 */
+      1,  /* U+23E8 - U+23EF : 0x11111111 */
+      1,  /* U+23F0 - U+23F7 : 0x11111111 */
+      1,  /* U+23F8 - U+23FF : 0x11111111 */
+      9,  /* U+2400 - U+2407 : 0x99999999 */
+      9,  /* U+2408 - U+240F : 0x99999999 */
+      9,  /* U+2410 - U+2417 : 0x99999999 */
+      9,  /* U+2418 - U+241F : 0x99999999 */
+    103,  /* U+2420 - U+2427 : 0x19999999 */
+      1,  /* U+2428 - U+242F : 0x11111111 */
+      1,  /* U+2430 - U+2437 : 0x11111111 */
+      1,  /* U+2438 - U+243F : 0x11111111 */
+      9,  /* U+2440 - U+2447 : 0x99999999 */
+    116,  /* U+2448 - U+244F : 0x11111999 */
+      1,  /* U+2450 - U+2457 : 0x11111111 */
+      1,  /* U+2458 - U+245F : 0x11111111 */
+      5,  /* U+2460 - U+2467 : 0x55555555 */
+      5,  /* U+2468 - U+246F : 0x55555555 */
+      5,  /* U+2470 - U+2477 : 0x55555555 */
+      5,  /* U+2478 - U+247F : 0x55555555 */
+      5,  /* U+2480 - U+2487 : 0x55555555 */
+      5,  /* U+2488 - U+248F : 0x55555555 */
+      5,  /* U+2490 - U+2497 : 0x55555555 */
+    117,  /* U+2498 - U+249F : 0x11115555 */
+      1,  /* U+24A0 - U+24A7 : 0x11111111 */
+      1,  /* U+24A8 - U+24AF : 0x11111111 */
+      1,  /* U+24B0 - U+24B7 : 0x11111111 */
+      1,  /* U+24B8 - U+24BF : 0x11111111 */
+      1,  /* U+24C0 - U+24C7 : 0x11111111 */
+      1,  /* U+24C8 - U+24CF : 0x11111111 */
+      1,  /* U+24D0 - U+24D7 : 0x11111111 */
+      1,  /* U+24D8 - U+24DF : 0x11111111 */
+      1,  /* U+24E0 - U+24E7 : 0x11111111 */
+    118,  /* U+24E8 - U+24EF : 0x11111511 */
+      1,  /* U+24F0 - U+24F7 : 0x11111111 */
+      1,  /* U+24F8 - U+24FF : 0x11111111 */
+      9,  /* U+2500 - U+2507 : 0x99999999 */
+      9,  /* U+2508 - U+250F : 0x99999999 */
+      9,  /* U+2510 - U+2517 : 0x99999999 */
+      9,  /* U+2518 - U+251F : 0x99999999 */
+      9,  /* U+2520 - U+2527 : 0x99999999 */
+      9,  /* U+2528 - U+252F : 0x99999999 */
+      9,  /* U+2530 - U+2537 : 0x99999999 */
+      9,  /* U+2538 - U+253F : 0x99999999 */
+      9,  /* U+2540 - U+2547 : 0x99999999 */
+      9,  /* U+2548 - U+254F : 0x99999999 */
+      9,  /* U+2550 - U+2557 : 0x99999999 */
+      9,  /* U+2558 - U+255F : 0x99999999 */
+      9,  /* U+2560 - U+2567 : 0x99999999 */
+      9,  /* U+2568 - U+256F : 0x99999999 */
+      9,  /* U+2570 - U+2577 : 0x99999999 */
+      9,  /* U+2578 - U+257F : 0x99999999 */
+      9,  /* U+2580 - U+2587 : 0x99999999 */
+      9,  /* U+2588 - U+258F : 0x99999999 */
+     33,  /* U+2590 - U+2597 : 0x11999999 */
+      1,  /* U+2598 - U+259F : 0x11111111 */
+      9,  /* U+25A0 - U+25A7 : 0x99999999 */
+      9,  /* U+25A8 - U+25AF : 0x99999999 */
+      9,  /* U+25B0 - U+25B7 : 0x99999999 */
+      9,  /* U+25B8 - U+25BF : 0x99999999 */
+      9,  /* U+25C0 - U+25C7 : 0x99999999 */
+      9,  /* U+25C8 - U+25CF : 0x99999999 */
+      9,  /* U+25D0 - U+25D7 : 0x99999999 */
+      9,  /* U+25D8 - U+25DF : 0x99999999 */
+      9,  /* U+25E0 - U+25E7 : 0x99999999 */
+      9,  /* U+25E8 - U+25EF : 0x99999999 */
+      9,  /* U+25F0 - U+25F7 : 0x99999999 */
+      1,  /* U+25F8 - U+25FF : 0x11111111 */
+      9,  /* U+2600 - U+2607 : 0x99999999 */
+      9,  /* U+2608 - U+260F : 0x99999999 */
+    112,  /* U+2610 - U+2617 : 0x11119999 */
+    119,  /* U+2618 - U+261F : 0x99999991 */
+      9,  /* U+2620 - U+2627 : 0x99999999 */
+      9,  /* U+2628 - U+262F : 0x99999999 */
+      9,  /* U+2630 - U+2637 : 0x99999999 */
+      9,  /* U+2638 - U+263F : 0x99999999 */
+      9,  /* U+2640 - U+2647 : 0x99999999 */
+      9,  /* U+2648 - U+264F : 0x99999999 */
+      9,  /* U+2650 - U+2657 : 0x99999999 */
+      9,  /* U+2658 - U+265F : 0x99999999 */
+      9,  /* U+2660 - U+2667 : 0x99999999 */
+      9,  /* U+2668 - U+266F : 0x99999999 */
+     98,  /* U+2670 - U+2677 : 0x11111199 */
+      1,  /* U+2678 - U+267F : 0x11111111 */
+      1,  /* U+2680 - U+2687 : 0x11111111 */
+      1,  /* U+2688 - U+268F : 0x11111111 */
+      1,  /* U+2690 - U+2697 : 0x11111111 */
+      1,  /* U+2698 - U+269F : 0x11111111 */
+      1,  /* U+26A0 - U+26A7 : 0x11111111 */
+      1,  /* U+26A8 - U+26AF : 0x11111111 */
+      1,  /* U+26B0 - U+26B7 : 0x11111111 */
+      1,  /* U+26B8 - U+26BF : 0x11111111 */
+      1,  /* U+26C0 - U+26C7 : 0x11111111 */
+      1,  /* U+26C8 - U+26CF : 0x11111111 */
+      1,  /* U+26D0 - U+26D7 : 0x11111111 */
+      1,  /* U+26D8 - U+26DF : 0x11111111 */
+      1,  /* U+26E0 - U+26E7 : 0x11111111 */
+      1,  /* U+26E8 - U+26EF : 0x11111111 */
+      1,  /* U+26F0 - U+26F7 : 0x11111111 */
+      1,  /* U+26F8 - U+26FF : 0x11111111 */
+    120,  /* U+2700 - U+2707 : 0x99199991 */
+    121,  /* U+2708 - U+270F : 0x99991199 */
+      9,  /* U+2710 - U+2717 : 0x99999999 */
+      9,  /* U+2718 - U+271F : 0x99999999 */
+      9,  /* U+2720 - U+2727 : 0x99999999 */
+    119,  /* U+2728 - U+272F : 0x99999991 */
+      9,  /* U+2730 - U+2737 : 0x99999999 */
+      9,  /* U+2738 - U+273F : 0x99999999 */
+      9,  /* U+2740 - U+2747 : 0x99999999 */
+    110,  /* U+2748 - U+274F : 0x91919999 */
+    122,  /* U+2750 - U+2757 : 0x19111999 */
+    103,  /* U+2758 - U+275F : 0x19999999 */
+    119,  /* U+2760 - U+2767 : 0x99999991 */
+      1,  /* U+2768 - U+276F : 0x11111111 */
+    123,  /* U+2770 - U+2777 : 0x99111111 */
+      9,  /* U+2778 - U+277F : 0x99999999 */
+      9,  /* U+2780 - U+2787 : 0x99999999 */
+      9,  /* U+2788 - U+278F : 0x99999999 */
+    124,  /* U+2790 - U+2797 : 0x11199999 */
+      9,  /* U+2798 - U+279F : 0x99999999 */
+      9,  /* U+27A0 - U+27A7 : 0x99999999 */
+      9,  /* U+27A8 - U+27AF : 0x99999999 */
+    119,  /* U+27B0 - U+27B7 : 0x99999991 */
+    103,  /* U+27B8 - U+27BF : 0x19999999 */
+      1,  /* U+27C0 - U+27C7 : 0x11111111 */
+      1,  /* U+27C8 - U+27CF : 0x11111111 */
+      1,  /* U+27D0 - U+27D7 : 0x11111111 */
+      1,  /* U+27D8 - U+27DF : 0x11111111 */
+      1,  /* U+27E0 - U+27E7 : 0x11111111 */
+      1,  /* U+27E8 - U+27EF : 0x11111111 */
+      1,  /* U+27F0 - U+27F7 : 0x11111111 */
+      1,  /* U+27F8 - U+27FF : 0x11111111 */
+      9,  /* U+2800 - U+2807 : 0x99999999 */
+      9,  /* U+2808 - U+280F : 0x99999999 */
+      9,  /* U+2810 - U+2817 : 0x99999999 */
+      9,  /* U+2818 - U+281F : 0x99999999 */
+      9,  /* U+2820 - U+2827 : 0x99999999 */
+      9,  /* U+2828 - U+282F : 0x99999999 */
+      9,  /* U+2830 - U+2837 : 0x99999999 */
+      9,  /* U+2838 - U+283F : 0x99999999 */
+      9,  /* U+2840 - U+2847 : 0x99999999 */
+      9,  /* U+2848 - U+284F : 0x99999999 */
+      9,  /* U+2850 - U+2857 : 0x99999999 */
+      9,  /* U+2858 - U+285F : 0x99999999 */
+      9,  /* U+2860 - U+2867 : 0x99999999 */
+      9,  /* U+2868 - U+286F : 0x99999999 */
+      9,  /* U+2870 - U+2877 : 0x99999999 */
+      9,  /* U+2878 - U+287F : 0x99999999 */
+      9,  /* U+2880 - U+2887 : 0x99999999 */
+      9,  /* U+2888 - U+288F : 0x99999999 */
+      9,  /* U+2890 - U+2897 : 0x99999999 */
+      9,  /* U+2898 - U+289F : 0x99999999 */
+      9,  /* U+28A0 - U+28A7 : 0x99999999 */
+      9,  /* U+28A8 - U+28AF : 0x99999999 */
+      9,  /* U+28B0 - U+28B7 : 0x99999999 */
+      9,  /* U+28B8 - U+28BF : 0x99999999 */
+      9,  /* U+28C0 - U+28C7 : 0x99999999 */
+      9,  /* U+28C8 - U+28CF : 0x99999999 */
+      9,  /* U+28D0 - U+28D7 : 0x99999999 */
+      9,  /* U+28D8 - U+28DF : 0x99999999 */
+      9,  /* U+28E0 - U+28E7 : 0x99999999 */
+      9,  /* U+28E8 - U+28EF : 0x99999999 */
+      9,  /* U+28F0 - U+28F7 : 0x99999999 */
+      9,  /* U+28F8 - U+28FF : 0x99999999 */
+};
+
+static PRUint8 gBidiCatIdx4[176] = {
+      9,  /* U+2E80 - U+2E87 : 0x99999999 */
+      9,  /* U+2E88 - U+2E8F : 0x99999999 */
+      9,  /* U+2E90 - U+2E97 : 0x99999999 */
+     26,  /* U+2E98 - U+2E9F : 0x99999199 */
+      9,  /* U+2EA0 - U+2EA7 : 0x99999999 */
+      9,  /* U+2EA8 - U+2EAF : 0x99999999 */
+      9,  /* U+2EB0 - U+2EB7 : 0x99999999 */
+      9,  /* U+2EB8 - U+2EBF : 0x99999999 */
+      9,  /* U+2EC0 - U+2EC7 : 0x99999999 */
+      9,  /* U+2EC8 - U+2ECF : 0x99999999 */
+      9,  /* U+2ED0 - U+2ED7 : 0x99999999 */
+      9,  /* U+2ED8 - U+2EDF : 0x99999999 */
+      9,  /* U+2EE0 - U+2EE7 : 0x99999999 */
+      9,  /* U+2EE8 - U+2EEF : 0x99999999 */
+    112,  /* U+2EF0 - U+2EF7 : 0x11119999 */
+      1,  /* U+2EF8 - U+2EFF : 0x11111111 */
+      9,  /* U+2F00 - U+2F07 : 0x99999999 */
+      9,  /* U+2F08 - U+2F0F : 0x99999999 */
+      9,  /* U+2F10 - U+2F17 : 0x99999999 */
+      9,  /* U+2F18 - U+2F1F : 0x99999999 */
+      9,  /* U+2F20 - U+2F27 : 0x99999999 */
+      9,  /* U+2F28 - U+2F2F : 0x99999999 */
+      9,  /* U+2F30 - U+2F37 : 0x99999999 */
+      9,  /* U+2F38 - U+2F3F : 0x99999999 */
+      9,  /* U+2F40 - U+2F47 : 0x99999999 */
+      9,  /* U+2F48 - U+2F4F : 0x99999999 */
+      9,  /* U+2F50 - U+2F57 : 0x99999999 */
+      9,  /* U+2F58 - U+2F5F : 0x99999999 */
+      9,  /* U+2F60 - U+2F67 : 0x99999999 */
+      9,  /* U+2F68 - U+2F6F : 0x99999999 */
+      9,  /* U+2F70 - U+2F77 : 0x99999999 */
+      9,  /* U+2F78 - U+2F7F : 0x99999999 */
+      9,  /* U+2F80 - U+2F87 : 0x99999999 */
+      9,  /* U+2F88 - U+2F8F : 0x99999999 */
+      9,  /* U+2F90 - U+2F97 : 0x99999999 */
+      9,  /* U+2F98 - U+2F9F : 0x99999999 */
+      9,  /* U+2FA0 - U+2FA7 : 0x99999999 */
+      9,  /* U+2FA8 - U+2FAF : 0x99999999 */
+      9,  /* U+2FB0 - U+2FB7 : 0x99999999 */
+      9,  /* U+2FB8 - U+2FBF : 0x99999999 */
+      9,  /* U+2FC0 - U+2FC7 : 0x99999999 */
+      9,  /* U+2FC8 - U+2FCF : 0x99999999 */
+     33,  /* U+2FD0 - U+2FD7 : 0x11999999 */
+      1,  /* U+2FD8 - U+2FDF : 0x11111111 */
+      1,  /* U+2FE0 - U+2FE7 : 0x11111111 */
+      1,  /* U+2FE8 - U+2FEF : 0x11111111 */
+      9,  /* U+2FF0 - U+2FF7 : 0x99999999 */
+    112,  /* U+2FF8 - U+2FFF : 0x11119999 */
+    125,  /* U+3000 - U+3007 : 0x1119999E */
+      9,  /* U+3008 - U+300F : 0x99999999 */
+      9,  /* U+3010 - U+3017 : 0x99999999 */
+      9,  /* U+3018 - U+301F : 0x99999999 */
+     21,  /* U+3020 - U+3027 : 0x11111119 */
+    126,  /* U+3028 - U+302F : 0xAAAAAA11 */
+    109,  /* U+3030 - U+3037 : 0x99111119 */
+    123,  /* U+3038 - U+303F : 0x99111111 */
+      1,  /* U+3040 - U+3047 : 0x11111111 */
+      1,  /* U+3048 - U+304F : 0x11111111 */
+      1,  /* U+3050 - U+3057 : 0x11111111 */
+      1,  /* U+3058 - U+305F : 0x11111111 */
+      1,  /* U+3060 - U+3067 : 0x11111111 */
+      1,  /* U+3068 - U+306F : 0x11111111 */
+      1,  /* U+3070 - U+3077 : 0x11111111 */
+      1,  /* U+3078 - U+307F : 0x11111111 */
+      1,  /* U+3080 - U+3087 : 0x11111111 */
+      1,  /* U+3088 - U+308F : 0x11111111 */
+      1,  /* U+3090 - U+3097 : 0x11111111 */
+    127,  /* U+3098 - U+309F : 0x11199AA1 */
+      1,  /* U+30A0 - U+30A7 : 0x11111111 */
+      1,  /* U+30A8 - U+30AF : 0x11111111 */
+      1,  /* U+30B0 - U+30B7 : 0x11111111 */
+      1,  /* U+30B8 - U+30BF : 0x11111111 */
+      1,  /* U+30C0 - U+30C7 : 0x11111111 */
+      1,  /* U+30C8 - U+30CF : 0x11111111 */
+      1,  /* U+30D0 - U+30D7 : 0x11111111 */
+      1,  /* U+30D8 - U+30DF : 0x11111111 */
+      1,  /* U+30E0 - U+30E7 : 0x11111111 */
+      1,  /* U+30E8 - U+30EF : 0x11111111 */
+      1,  /* U+30F0 - U+30F7 : 0x11111111 */
+    128,  /* U+30F8 - U+30FF : 0x11119111 */
+      1,  /* U+3100 - U+3107 : 0x11111111 */
+      1,  /* U+3108 - U+310F : 0x11111111 */
+      1,  /* U+3110 - U+3117 : 0x11111111 */
+      1,  /* U+3118 - U+311F : 0x11111111 */
+      1,  /* U+3120 - U+3127 : 0x11111111 */
+      1,  /* U+3128 - U+312F : 0x11111111 */
+      1,  /* U+3130 - U+3137 : 0x11111111 */
+      1,  /* U+3138 - U+313F : 0x11111111 */
+      1,  /* U+3140 - U+3147 : 0x11111111 */
+      1,  /* U+3148 - U+314F : 0x11111111 */
+      1,  /* U+3150 - U+3157 : 0x11111111 */
+      1,  /* U+3158 - U+315F : 0x11111111 */
+      1,  /* U+3160 - U+3167 : 0x11111111 */
+      1,  /* U+3168 - U+316F : 0x11111111 */
+      1,  /* U+3170 - U+3177 : 0x11111111 */
+      1,  /* U+3178 - U+317F : 0x11111111 */
+      1,  /* U+3180 - U+3187 : 0x11111111 */
+      1,  /* U+3188 - U+318F : 0x11111111 */
+      1,  /* U+3190 - U+3197 : 0x11111111 */
+      1,  /* U+3198 - U+319F : 0x11111111 */
+      1,  /* U+31A0 - U+31A7 : 0x11111111 */
+      1,  /* U+31A8 - U+31AF : 0x11111111 */
+      1,  /* U+31B0 - U+31B7 : 0x11111111 */
+      1,  /* U+31B8 - U+31BF : 0x11111111 */
+      1,  /* U+31C0 - U+31C7 : 0x11111111 */
+      1,  /* U+31C8 - U+31CF : 0x11111111 */
+      1,  /* U+31D0 - U+31D7 : 0x11111111 */
+      1,  /* U+31D8 - U+31DF : 0x11111111 */
+      1,  /* U+31E0 - U+31E7 : 0x11111111 */
+      1,  /* U+31E8 - U+31EF : 0x11111111 */
+      1,  /* U+31F0 - U+31F7 : 0x11111111 */
+      1,  /* U+31F8 - U+31FF : 0x11111111 */
+      1,  /* U+3200 - U+3207 : 0x11111111 */
+      1,  /* U+3208 - U+320F : 0x11111111 */
+      1,  /* U+3210 - U+3217 : 0x11111111 */
+      1,  /* U+3218 - U+321F : 0x11111111 */
+      1,  /* U+3220 - U+3227 : 0x11111111 */
+      1,  /* U+3228 - U+322F : 0x11111111 */
+      1,  /* U+3230 - U+3237 : 0x11111111 */
+      1,  /* U+3238 - U+323F : 0x11111111 */
+      1,  /* U+3240 - U+3247 : 0x11111111 */
+      1,  /* U+3248 - U+324F : 0x11111111 */
+      1,  /* U+3250 - U+3257 : 0x11111111 */
+      1,  /* U+3258 - U+325F : 0x11111111 */
+      1,  /* U+3260 - U+3267 : 0x11111111 */
+      1,  /* U+3268 - U+326F : 0x11111111 */
+      1,  /* U+3270 - U+3277 : 0x11111111 */
+      1,  /* U+3278 - U+327F : 0x11111111 */
+      1,  /* U+3280 - U+3287 : 0x11111111 */
+      1,  /* U+3288 - U+328F : 0x11111111 */
+      1,  /* U+3290 - U+3297 : 0x11111111 */
+      1,  /* U+3298 - U+329F : 0x11111111 */
+      1,  /* U+32A0 - U+32A7 : 0x11111111 */
+      1,  /* U+32A8 - U+32AF : 0x11111111 */
+      1,  /* U+32B0 - U+32B7 : 0x11111111 */
+      1,  /* U+32B8 - U+32BF : 0x11111111 */
+      1,  /* U+32C0 - U+32C7 : 0x11111111 */
+      1,  /* U+32C8 - U+32CF : 0x11111111 */
+      1,  /* U+32D0 - U+32D7 : 0x11111111 */
+      1,  /* U+32D8 - U+32DF : 0x11111111 */
+      1,  /* U+32E0 - U+32E7 : 0x11111111 */
+      1,  /* U+32E8 - U+32EF : 0x11111111 */
+      1,  /* U+32F0 - U+32F7 : 0x11111111 */
+      1,  /* U+32F8 - U+32FF : 0x11111111 */
+      1,  /* U+3300 - U+3307 : 0x11111111 */
+      1,  /* U+3308 - U+330F : 0x11111111 */
+      1,  /* U+3310 - U+3317 : 0x11111111 */
+      1,  /* U+3318 - U+331F : 0x11111111 */
+      1,  /* U+3320 - U+3327 : 0x11111111 */
+      1,  /* U+3328 - U+332F : 0x11111111 */
+      1,  /* U+3330 - U+3337 : 0x11111111 */
+      1,  /* U+3338 - U+333F : 0x11111111 */
+      1,  /* U+3340 - U+3347 : 0x11111111 */
+      1,  /* U+3348 - U+334F : 0x11111111 */
+      1,  /* U+3350 - U+3357 : 0x11111111 */
+      1,  /* U+3358 - U+335F : 0x11111111 */
+      1,  /* U+3360 - U+3367 : 0x11111111 */
+      1,  /* U+3368 - U+336F : 0x11111111 */
+      1,  /* U+3370 - U+3377 : 0x11111111 */
+      1,  /* U+3378 - U+337F : 0x11111111 */
+      1,  /* U+3380 - U+3387 : 0x11111111 */
+      1,  /* U+3388 - U+338F : 0x11111111 */
+      1,  /* U+3390 - U+3397 : 0x11111111 */
+      1,  /* U+3398 - U+339F : 0x11111111 */
+      1,  /* U+33A0 - U+33A7 : 0x11111111 */
+      1,  /* U+33A8 - U+33AF : 0x11111111 */
+      1,  /* U+33B0 - U+33B7 : 0x11111111 */
+      1,  /* U+33B8 - U+33BF : 0x11111111 */
+      1,  /* U+33C0 - U+33C7 : 0x11111111 */
+      1,  /* U+33C8 - U+33CF : 0x11111111 */
+      1,  /* U+33D0 - U+33D7 : 0x11111111 */
+      1,  /* U+33D8 - U+33DF : 0x11111111 */
+      1,  /* U+33E0 - U+33E7 : 0x11111111 */
+      1,  /* U+33E8 - U+33EF : 0x11111111 */
+      1,  /* U+33F0 - U+33F7 : 0x11111111 */
+      1,  /* U+33F8 - U+33FF : 0x11111111 */
+};
+
+static PRUint8 gBidiCatIdx5[160] = {
+      1,  /* U+A000 - U+A007 : 0x11111111 */
+      1,  /* U+A008 - U+A00F : 0x11111111 */
+      1,  /* U+A010 - U+A017 : 0x11111111 */
+      1,  /* U+A018 - U+A01F : 0x11111111 */
+      1,  /* U+A020 - U+A027 : 0x11111111 */
+      1,  /* U+A028 - U+A02F : 0x11111111 */
+      1,  /* U+A030 - U+A037 : 0x11111111 */
+      1,  /* U+A038 - U+A03F : 0x11111111 */
+      1,  /* U+A040 - U+A047 : 0x11111111 */
+      1,  /* U+A048 - U+A04F : 0x11111111 */
+      1,  /* U+A050 - U+A057 : 0x11111111 */
+      1,  /* U+A058 - U+A05F : 0x11111111 */
+      1,  /* U+A060 - U+A067 : 0x11111111 */
+      1,  /* U+A068 - U+A06F : 0x11111111 */
+      1,  /* U+A070 - U+A077 : 0x11111111 */
+      1,  /* U+A078 - U+A07F : 0x11111111 */
+      1,  /* U+A080 - U+A087 : 0x11111111 */
+      1,  /* U+A088 - U+A08F : 0x11111111 */
+      1,  /* U+A090 - U+A097 : 0x11111111 */
+      1,  /* U+A098 - U+A09F : 0x11111111 */
+      1,  /* U+A0A0 - U+A0A7 : 0x11111111 */
+      1,  /* U+A0A8 - U+A0AF : 0x11111111 */
+      1,  /* U+A0B0 - U+A0B7 : 0x11111111 */
+      1,  /* U+A0B8 - U+A0BF : 0x11111111 */
+      1,  /* U+A0C0 - U+A0C7 : 0x11111111 */
+      1,  /* U+A0C8 - U+A0CF : 0x11111111 */
+      1,  /* U+A0D0 - U+A0D7 : 0x11111111 */
+      1,  /* U+A0D8 - U+A0DF : 0x11111111 */
+      1,  /* U+A0E0 - U+A0E7 : 0x11111111 */
+      1,  /* U+A0E8 - U+A0EF : 0x11111111 */
+      1,  /* U+A0F0 - U+A0F7 : 0x11111111 */
+      1,  /* U+A0F8 - U+A0FF : 0x11111111 */
+      1,  /* U+A100 - U+A107 : 0x11111111 */
+      1,  /* U+A108 - U+A10F : 0x11111111 */
+      1,  /* U+A110 - U+A117 : 0x11111111 */
+      1,  /* U+A118 - U+A11F : 0x11111111 */
+      1,  /* U+A120 - U+A127 : 0x11111111 */
+      1,  /* U+A128 - U+A12F : 0x11111111 */
+      1,  /* U+A130 - U+A137 : 0x11111111 */
+      1,  /* U+A138 - U+A13F : 0x11111111 */
+      1,  /* U+A140 - U+A147 : 0x11111111 */
+      1,  /* U+A148 - U+A14F : 0x11111111 */
+      1,  /* U+A150 - U+A157 : 0x11111111 */
+      1,  /* U+A158 - U+A15F : 0x11111111 */
+      1,  /* U+A160 - U+A167 : 0x11111111 */
+      1,  /* U+A168 - U+A16F : 0x11111111 */
+      1,  /* U+A170 - U+A177 : 0x11111111 */
+      1,  /* U+A178 - U+A17F : 0x11111111 */
+      1,  /* U+A180 - U+A187 : 0x11111111 */
+      1,  /* U+A188 - U+A18F : 0x11111111 */
+      1,  /* U+A190 - U+A197 : 0x11111111 */
+      1,  /* U+A198 - U+A19F : 0x11111111 */
+      1,  /* U+A1A0 - U+A1A7 : 0x11111111 */
+      1,  /* U+A1A8 - U+A1AF : 0x11111111 */
+      1,  /* U+A1B0 - U+A1B7 : 0x11111111 */
+      1,  /* U+A1B8 - U+A1BF : 0x11111111 */
+      1,  /* U+A1C0 - U+A1C7 : 0x11111111 */
+      1,  /* U+A1C8 - U+A1CF : 0x11111111 */
+      1,  /* U+A1D0 - U+A1D7 : 0x11111111 */
+      1,  /* U+A1D8 - U+A1DF : 0x11111111 */
+      1,  /* U+A1E0 - U+A1E7 : 0x11111111 */
+      1,  /* U+A1E8 - U+A1EF : 0x11111111 */
+      1,  /* U+A1F0 - U+A1F7 : 0x11111111 */
+      1,  /* U+A1F8 - U+A1FF : 0x11111111 */
+      1,  /* U+A200 - U+A207 : 0x11111111 */
+      1,  /* U+A208 - U+A20F : 0x11111111 */
+      1,  /* U+A210 - U+A217 : 0x11111111 */
+      1,  /* U+A218 - U+A21F : 0x11111111 */
+      1,  /* U+A220 - U+A227 : 0x11111111 */
+      1,  /* U+A228 - U+A22F : 0x11111111 */
+      1,  /* U+A230 - U+A237 : 0x11111111 */
+      1,  /* U+A238 - U+A23F : 0x11111111 */
+      1,  /* U+A240 - U+A247 : 0x11111111 */
+      1,  /* U+A248 - U+A24F : 0x11111111 */
+      1,  /* U+A250 - U+A257 : 0x11111111 */
+      1,  /* U+A258 - U+A25F : 0x11111111 */
+      1,  /* U+A260 - U+A267 : 0x11111111 */
+      1,  /* U+A268 - U+A26F : 0x11111111 */
+      1,  /* U+A270 - U+A277 : 0x11111111 */
+      1,  /* U+A278 - U+A27F : 0x11111111 */
+      1,  /* U+A280 - U+A287 : 0x11111111 */
+      1,  /* U+A288 - U+A28F : 0x11111111 */
+      1,  /* U+A290 - U+A297 : 0x11111111 */
+      1,  /* U+A298 - U+A29F : 0x11111111 */
+      1,  /* U+A2A0 - U+A2A7 : 0x11111111 */
+      1,  /* U+A2A8 - U+A2AF : 0x11111111 */
+      1,  /* U+A2B0 - U+A2B7 : 0x11111111 */
+      1,  /* U+A2B8 - U+A2BF : 0x11111111 */
+      1,  /* U+A2C0 - U+A2C7 : 0x11111111 */
+      1,  /* U+A2C8 - U+A2CF : 0x11111111 */
+      1,  /* U+A2D0 - U+A2D7 : 0x11111111 */
+      1,  /* U+A2D8 - U+A2DF : 0x11111111 */
+      1,  /* U+A2E0 - U+A2E7 : 0x11111111 */
+      1,  /* U+A2E8 - U+A2EF : 0x11111111 */
+      1,  /* U+A2F0 - U+A2F7 : 0x11111111 */
+      1,  /* U+A2F8 - U+A2FF : 0x11111111 */
+      1,  /* U+A300 - U+A307 : 0x11111111 */
+      1,  /* U+A308 - U+A30F : 0x11111111 */
+      1,  /* U+A310 - U+A317 : 0x11111111 */
+      1,  /* U+A318 - U+A31F : 0x11111111 */
+      1,  /* U+A320 - U+A327 : 0x11111111 */
+      1,  /* U+A328 - U+A32F : 0x11111111 */
+      1,  /* U+A330 - U+A337 : 0x11111111 */
+      1,  /* U+A338 - U+A33F : 0x11111111 */
+      1,  /* U+A340 - U+A347 : 0x11111111 */
+      1,  /* U+A348 - U+A34F : 0x11111111 */
+      1,  /* U+A350 - U+A357 : 0x11111111 */
+      1,  /* U+A358 - U+A35F : 0x11111111 */
+      1,  /* U+A360 - U+A367 : 0x11111111 */
+      1,  /* U+A368 - U+A36F : 0x11111111 */
+      1,  /* U+A370 - U+A377 : 0x11111111 */
+      1,  /* U+A378 - U+A37F : 0x11111111 */
+      1,  /* U+A380 - U+A387 : 0x11111111 */
+      1,  /* U+A388 - U+A38F : 0x11111111 */
+      1,  /* U+A390 - U+A397 : 0x11111111 */
+      1,  /* U+A398 - U+A39F : 0x11111111 */
+      1,  /* U+A3A0 - U+A3A7 : 0x11111111 */
+      1,  /* U+A3A8 - U+A3AF : 0x11111111 */
+      1,  /* U+A3B0 - U+A3B7 : 0x11111111 */
+      1,  /* U+A3B8 - U+A3BF : 0x11111111 */
+      1,  /* U+A3C0 - U+A3C7 : 0x11111111 */
+      1,  /* U+A3C8 - U+A3CF : 0x11111111 */
+      1,  /* U+A3D0 - U+A3D7 : 0x11111111 */
+      1,  /* U+A3D8 - U+A3DF : 0x11111111 */
+      1,  /* U+A3E0 - U+A3E7 : 0x11111111 */
+      1,  /* U+A3E8 - U+A3EF : 0x11111111 */
+      1,  /* U+A3F0 - U+A3F7 : 0x11111111 */
+      1,  /* U+A3F8 - U+A3FF : 0x11111111 */
+      1,  /* U+A400 - U+A407 : 0x11111111 */
+      1,  /* U+A408 - U+A40F : 0x11111111 */
+      1,  /* U+A410 - U+A417 : 0x11111111 */
+      1,  /* U+A418 - U+A41F : 0x11111111 */
+      1,  /* U+A420 - U+A427 : 0x11111111 */
+      1,  /* U+A428 - U+A42F : 0x11111111 */
+      1,  /* U+A430 - U+A437 : 0x11111111 */
+      1,  /* U+A438 - U+A43F : 0x11111111 */
+      1,  /* U+A440 - U+A447 : 0x11111111 */
+      1,  /* U+A448 - U+A44F : 0x11111111 */
+      1,  /* U+A450 - U+A457 : 0x11111111 */
+      1,  /* U+A458 - U+A45F : 0x11111111 */
+      1,  /* U+A460 - U+A467 : 0x11111111 */
+      1,  /* U+A468 - U+A46F : 0x11111111 */
+      1,  /* U+A470 - U+A477 : 0x11111111 */
+      1,  /* U+A478 - U+A47F : 0x11111111 */
+      1,  /* U+A480 - U+A487 : 0x11111111 */
+      1,  /* U+A488 - U+A48F : 0x11111111 */
+      9,  /* U+A490 - U+A497 : 0x99999999 */
+      9,  /* U+A498 - U+A49F : 0x99999999 */
+    121,  /* U+A4A0 - U+A4A7 : 0x99991199 */
+      9,  /* U+A4A8 - U+A4AF : 0x99999999 */
+    129,  /* U+A4B0 - U+A4B7 : 0x99919999 */
+      9,  /* U+A4B8 - U+A4BF : 0x99999999 */
+    130,  /* U+A4C0 - U+A4C7 : 0x19199919 */
+      1,  /* U+A4C8 - U+A4CF : 0x11111111 */
+      1,  /* U+A4D0 - U+A4D7 : 0x11111111 */
+      1,  /* U+A4D8 - U+A4DF : 0x11111111 */
+      1,  /* U+A4E0 - U+A4E7 : 0x11111111 */
+      1,  /* U+A4E8 - U+A4EF : 0x11111111 */
+      1,  /* U+A4F0 - U+A4F7 : 0x11111111 */
+      1,  /* U+A4F8 - U+A4FF : 0x11111111 */
+};
+
+static PRUint8 gBidiCatIdx6[224] = {
+      1,  /* U+F900 - U+F907 : 0x11111111 */
+      1,  /* U+F908 - U+F90F : 0x11111111 */
+      1,  /* U+F910 - U+F917 : 0x11111111 */
+      1,  /* U+F918 - U+F91F : 0x11111111 */
+      1,  /* U+F920 - U+F927 : 0x11111111 */
+      1,  /* U+F928 - U+F92F : 0x11111111 */
+      1,  /* U+F930 - U+F937 : 0x11111111 */
+      1,  /* U+F938 - U+F93F : 0x11111111 */
+      1,  /* U+F940 - U+F947 : 0x11111111 */
+      1,  /* U+F948 - U+F94F : 0x11111111 */
+      1,  /* U+F950 - U+F957 : 0x11111111 */
+      1,  /* U+F958 - U+F95F : 0x11111111 */
+      1,  /* U+F960 - U+F967 : 0x11111111 */
+      1,  /* U+F968 - U+F96F : 0x11111111 */
+      1,  /* U+F970 - U+F977 : 0x11111111 */
+      1,  /* U+F978 - U+F97F : 0x11111111 */
+      1,  /* U+F980 - U+F987 : 0x11111111 */
+      1,  /* U+F988 - U+F98F : 0x11111111 */
+      1,  /* U+F990 - U+F997 : 0x11111111 */
+      1,  /* U+F998 - U+F99F : 0x11111111 */
+      1,  /* U+F9A0 - U+F9A7 : 0x11111111 */
+      1,  /* U+F9A8 - U+F9AF : 0x11111111 */
+      1,  /* U+F9B0 - U+F9B7 : 0x11111111 */
+      1,  /* U+F9B8 - U+F9BF : 0x11111111 */
+      1,  /* U+F9C0 - U+F9C7 : 0x11111111 */
+      1,  /* U+F9C8 - U+F9CF : 0x11111111 */
+      1,  /* U+F9D0 - U+F9D7 : 0x11111111 */
+      1,  /* U+F9D8 - U+F9DF : 0x11111111 */
+      1,  /* U+F9E0 - U+F9E7 : 0x11111111 */
+      1,  /* U+F9E8 - U+F9EF : 0x11111111 */
+      1,  /* U+F9F0 - U+F9F7 : 0x11111111 */
+      1,  /* U+F9F8 - U+F9FF : 0x11111111 */
+      1,  /* U+FA00 - U+FA07 : 0x11111111 */
+      1,  /* U+FA08 - U+FA0F : 0x11111111 */
+      1,  /* U+FA10 - U+FA17 : 0x11111111 */
+      1,  /* U+FA18 - U+FA1F : 0x11111111 */
+      1,  /* U+FA20 - U+FA27 : 0x11111111 */
+      1,  /* U+FA28 - U+FA2F : 0x11111111 */
+      1,  /* U+FA30 - U+FA37 : 0x11111111 */
+      1,  /* U+FA38 - U+FA3F : 0x11111111 */
+      1,  /* U+FA40 - U+FA47 : 0x11111111 */
+      1,  /* U+FA48 - U+FA4F : 0x11111111 */
+      1,  /* U+FA50 - U+FA57 : 0x11111111 */
+      1,  /* U+FA58 - U+FA5F : 0x11111111 */
+      1,  /* U+FA60 - U+FA67 : 0x11111111 */
+      1,  /* U+FA68 - U+FA6F : 0x11111111 */
+      1,  /* U+FA70 - U+FA77 : 0x11111111 */
+      1,  /* U+FA78 - U+FA7F : 0x11111111 */
+      1,  /* U+FA80 - U+FA87 : 0x11111111 */
+      1,  /* U+FA88 - U+FA8F : 0x11111111 */
+      1,  /* U+FA90 - U+FA97 : 0x11111111 */
+      1,  /* U+FA98 - U+FA9F : 0x11111111 */
+      1,  /* U+FAA0 - U+FAA7 : 0x11111111 */
+      1,  /* U+FAA8 - U+FAAF : 0x11111111 */
+      1,  /* U+FAB0 - U+FAB7 : 0x11111111 */
+      1,  /* U+FAB8 - U+FABF : 0x11111111 */
+      1,  /* U+FAC0 - U+FAC7 : 0x11111111 */
+      1,  /* U+FAC8 - U+FACF : 0x11111111 */
+      1,  /* U+FAD0 - U+FAD7 : 0x11111111 */
+      1,  /* U+FAD8 - U+FADF : 0x11111111 */
+      1,  /* U+FAE0 - U+FAE7 : 0x11111111 */
+      1,  /* U+FAE8 - U+FAEF : 0x11111111 */
+      1,  /* U+FAF0 - U+FAF7 : 0x11111111 */
+      1,  /* U+FAF8 - U+FAFF : 0x11111111 */
+      1,  /* U+FB00 - U+FB07 : 0x11111111 */
+      1,  /* U+FB08 - U+FB0F : 0x11111111 */
+      1,  /* U+FB10 - U+FB17 : 0x11111111 */
+    131,  /* U+FB18 - U+FB1F : 0x2A211111 */
+      2,  /* U+FB20 - U+FB27 : 0x22222222 */
+    132,  /* U+FB28 - U+FB2F : 0x22222272 */
+      2,  /* U+FB30 - U+FB37 : 0x22222222 */
+      2,  /* U+FB38 - U+FB3F : 0x22222222 */
+      2,  /* U+FB40 - U+FB47 : 0x22222222 */
+      2,  /* U+FB48 - U+FB4F : 0x22222222 */
+      3,  /* U+FB50 - U+FB57 : 0x33333333 */
+      3,  /* U+FB58 - U+FB5F : 0x33333333 */
+      3,  /* U+FB60 - U+FB67 : 0x33333333 */
+      3,  /* U+FB68 - U+FB6F : 0x33333333 */
+      3,  /* U+FB70 - U+FB77 : 0x33333333 */
+      3,  /* U+FB78 - U+FB7F : 0x33333333 */
+      3,  /* U+FB80 - U+FB87 : 0x33333333 */
+      3,  /* U+FB88 - U+FB8F : 0x33333333 */
+      3,  /* U+FB90 - U+FB97 : 0x33333333 */
+      3,  /* U+FB98 - U+FB9F : 0x33333333 */
+      3,  /* U+FBA0 - U+FBA7 : 0x33333333 */
+      3,  /* U+FBA8 - U+FBAF : 0x33333333 */
+      3,  /* U+FBB0 - U+FBB7 : 0x33333333 */
+      3,  /* U+FBB8 - U+FBBF : 0x33333333 */
+      3,  /* U+FBC0 - U+FBC7 : 0x33333333 */
+      3,  /* U+FBC8 - U+FBCF : 0x33333333 */
+      3,  /* U+FBD0 - U+FBD7 : 0x33333333 */
+      3,  /* U+FBD8 - U+FBDF : 0x33333333 */
+      3,  /* U+FBE0 - U+FBE7 : 0x33333333 */
+      3,  /* U+FBE8 - U+FBEF : 0x33333333 */
+      3,  /* U+FBF0 - U+FBF7 : 0x33333333 */
+      3,  /* U+FBF8 - U+FBFF : 0x33333333 */
+      3,  /* U+FC00 - U+FC07 : 0x33333333 */
+      3,  /* U+FC08 - U+FC0F : 0x33333333 */
+      3,  /* U+FC10 - U+FC17 : 0x33333333 */
+      3,  /* U+FC18 - U+FC1F : 0x33333333 */
+      3,  /* U+FC20 - U+FC27 : 0x33333333 */
+      3,  /* U+FC28 - U+FC2F : 0x33333333 */
+      3,  /* U+FC30 - U+FC37 : 0x33333333 */
+      3,  /* U+FC38 - U+FC3F : 0x33333333 */
+      3,  /* U+FC40 - U+FC47 : 0x33333333 */
+      3,  /* U+FC48 - U+FC4F : 0x33333333 */
+      3,  /* U+FC50 - U+FC57 : 0x33333333 */
+      3,  /* U+FC58 - U+FC5F : 0x33333333 */
+      3,  /* U+FC60 - U+FC67 : 0x33333333 */
+      3,  /* U+FC68 - U+FC6F : 0x33333333 */
+      3,  /* U+FC70 - U+FC77 : 0x33333333 */
+      3,  /* U+FC78 - U+FC7F : 0x33333333 */
+      3,  /* U+FC80 - U+FC87 : 0x33333333 */
+      3,  /* U+FC88 - U+FC8F : 0x33333333 */
+      3,  /* U+FC90 - U+FC97 : 0x33333333 */
+      3,  /* U+FC98 - U+FC9F : 0x33333333 */
+      3,  /* U+FCA0 - U+FCA7 : 0x33333333 */
+      3,  /* U+FCA8 - U+FCAF : 0x33333333 */
+      3,  /* U+FCB0 - U+FCB7 : 0x33333333 */
+      3,  /* U+FCB8 - U+FCBF : 0x33333333 */
+      3,  /* U+FCC0 - U+FCC7 : 0x33333333 */
+      3,  /* U+FCC8 - U+FCCF : 0x33333333 */
+      3,  /* U+FCD0 - U+FCD7 : 0x33333333 */
+      3,  /* U+FCD8 - U+FCDF : 0x33333333 */
+      3,  /* U+FCE0 - U+FCE7 : 0x33333333 */
+      3,  /* U+FCE8 - U+FCEF : 0x33333333 */
+      3,  /* U+FCF0 - U+FCF7 : 0x33333333 */
+      3,  /* U+FCF8 - U+FCFF : 0x33333333 */
+      3,  /* U+FD00 - U+FD07 : 0x33333333 */
+      3,  /* U+FD08 - U+FD0F : 0x33333333 */
+      3,  /* U+FD10 - U+FD17 : 0x33333333 */
+      3,  /* U+FD18 - U+FD1F : 0x33333333 */
+      3,  /* U+FD20 - U+FD27 : 0x33333333 */
+      3,  /* U+FD28 - U+FD2F : 0x33333333 */
+      3,  /* U+FD30 - U+FD37 : 0x33333333 */
+    133,  /* U+FD38 - U+FD3F : 0x99333333 */
+      3,  /* U+FD40 - U+FD47 : 0x33333333 */
+      3,  /* U+FD48 - U+FD4F : 0x33333333 */
+      3,  /* U+FD50 - U+FD57 : 0x33333333 */
+      3,  /* U+FD58 - U+FD5F : 0x33333333 */
+      3,  /* U+FD60 - U+FD67 : 0x33333333 */
+      3,  /* U+FD68 - U+FD6F : 0x33333333 */
+      3,  /* U+FD70 - U+FD77 : 0x33333333 */
+      3,  /* U+FD78 - U+FD7F : 0x33333333 */
+      3,  /* U+FD80 - U+FD87 : 0x33333333 */
+      3,  /* U+FD88 - U+FD8F : 0x33333333 */
+      3,  /* U+FD90 - U+FD97 : 0x33333333 */
+      3,  /* U+FD98 - U+FD9F : 0x33333333 */
+      3,  /* U+FDA0 - U+FDA7 : 0x33333333 */
+      3,  /* U+FDA8 - U+FDAF : 0x33333333 */
+      3,  /* U+FDB0 - U+FDB7 : 0x33333333 */
+      3,  /* U+FDB8 - U+FDBF : 0x33333333 */
+      3,  /* U+FDC0 - U+FDC7 : 0x33333333 */
+      3,  /* U+FDC8 - U+FDCF : 0x33333333 */
+      3,  /* U+FDD0 - U+FDD7 : 0x33333333 */
+      3,  /* U+FDD8 - U+FDDF : 0x33333333 */
+      3,  /* U+FDE0 - U+FDE7 : 0x33333333 */
+      3,  /* U+FDE8 - U+FDEF : 0x33333333 */
+      3,  /* U+FDF0 - U+FDF7 : 0x33333333 */
+      3,  /* U+FDF8 - U+FDFF : 0x33333333 */
+      1,  /* U+FE00 - U+FE07 : 0x11111111 */
+      1,  /* U+FE08 - U+FE0F : 0x11111111 */
+      1,  /* U+FE10 - U+FE17 : 0x11111111 */
+      1,  /* U+FE18 - U+FE1F : 0x11111111 */
+     94,  /* U+FE20 - U+FE27 : 0x1111AAAA */
+      1,  /* U+FE28 - U+FE2F : 0x11111111 */
+      9,  /* U+FE30 - U+FE37 : 0x99999999 */
+      9,  /* U+FE38 - U+FE3F : 0x99999999 */
+    124,  /* U+FE40 - U+FE47 : 0x11199999 */
+    119,  /* U+FE48 - U+FE4F : 0x99999991 */
+    134,  /* U+FE50 - U+FE57 : 0x99891898 */
+    135,  /* U+FE58 - U+FE5F : 0x79999999 */
+    136,  /* U+FE60 - U+FE67 : 0x19997799 */
+    137,  /* U+FE68 - U+FE6F : 0x11119779 */
+      3,  /* U+FE70 - U+FE77 : 0x33333333 */
+      3,  /* U+FE78 - U+FE7F : 0x33333333 */
+      3,  /* U+FE80 - U+FE87 : 0x33333333 */
+      3,  /* U+FE88 - U+FE8F : 0x33333333 */
+      3,  /* U+FE90 - U+FE97 : 0x33333333 */
+      3,  /* U+FE98 - U+FE9F : 0x33333333 */
+      3,  /* U+FEA0 - U+FEA7 : 0x33333333 */
+      3,  /* U+FEA8 - U+FEAF : 0x33333333 */
+      3,  /* U+FEB0 - U+FEB7 : 0x33333333 */
+      3,  /* U+FEB8 - U+FEBF : 0x33333333 */
+      3,  /* U+FEC0 - U+FEC7 : 0x33333333 */
+      3,  /* U+FEC8 - U+FECF : 0x33333333 */
+      3,  /* U+FED0 - U+FED7 : 0x33333333 */
+      3,  /* U+FED8 - U+FEDF : 0x33333333 */
+      3,  /* U+FEE0 - U+FEE7 : 0x33333333 */
+      3,  /* U+FEE8 - U+FEEF : 0x33333333 */
+      3,  /* U+FEF0 - U+FEF7 : 0x33333333 */
+     55,  /* U+FEF8 - U+FEFF : 0xB3333333 */
+    138,  /* U+FF00 - U+FF07 : 0x99777991 */
+     19,  /* U+FF08 - U+FF0F : 0x68787999 */
+      5,  /* U+FF10 - U+FF17 : 0x55555555 */
+     20,  /* U+FF18 - U+FF1F : 0x99999855 */
+     21,  /* U+FF20 - U+FF27 : 0x11111119 */
+      1,  /* U+FF28 - U+FF2F : 0x11111111 */
+      1,  /* U+FF30 - U+FF37 : 0x11111111 */
+     22,  /* U+FF38 - U+FF3F : 0x99999111 */
+     21,  /* U+FF40 - U+FF47 : 0x11111119 */
+      1,  /* U+FF48 - U+FF4F : 0x11111111 */
+      1,  /* U+FF50 - U+FF57 : 0x11111111 */
+    139,  /* U+FF58 - U+FF5F : 0x19999111 */
+    140,  /* U+FF60 - U+FF67 : 0x11999991 */
+      1,  /* U+FF68 - U+FF6F : 0x11111111 */
+      1,  /* U+FF70 - U+FF77 : 0x11111111 */
+      1,  /* U+FF78 - U+FF7F : 0x11111111 */
+      1,  /* U+FF80 - U+FF87 : 0x11111111 */
+      1,  /* U+FF88 - U+FF8F : 0x11111111 */
+      1,  /* U+FF90 - U+FF97 : 0x11111111 */
+      1,  /* U+FF98 - U+FF9F : 0x11111111 */
+      1,  /* U+FFA0 - U+FFA7 : 0x11111111 */
+      1,  /* U+FFA8 - U+FFAF : 0x11111111 */
+      1,  /* U+FFB0 - U+FFB7 : 0x11111111 */
+      1,  /* U+FFB8 - U+FFBF : 0x11111111 */
+      1,  /* U+FFC0 - U+FFC7 : 0x11111111 */
+      1,  /* U+FFC8 - U+FFCF : 0x11111111 */
+      1,  /* U+FFD0 - U+FFD7 : 0x11111111 */
+      1,  /* U+FFD8 - U+FFDF : 0x11111111 */
+    141,  /* U+FFE0 - U+FFE7 : 0x17799977 */
+    103,  /* U+FFE8 - U+FFEF : 0x19999999 */
+      1,  /* U+FFF0 - U+FFF7 : 0x11111111 */
+    142,  /* U+FFF8 - U+FFFF : 0x1199BBB1 */
+};
+
+static PRUint32 gBidiCatPat[143] = {
+    0x00000000,  /* 0 */
+    0x11111111,  /* 1 */
+    0x22222222,  /* 2 */
+    0x33333333,  /* 3 */
+    0x44444444,  /* 4 */
+    0x55555555,  /* 5 */
+    0x66666666,  /* 6 */
+    0x77777777,  /* 7 */
+    0x88888888,  /* 8 */
+    0x99999999,  /* 9 */
+    0xAAAAAAAA,  /* 10 */
+    0xBBBBBBBB,  /* 11 */
+    0xCCCCCCCC,  /* 12 */
+    0xDDDDDDDD,  /* 13 */
+    0xEEEEEEEE,  /* 14 */
+    0xFFFFFFFF,  /* 15 */
+    0xBBCEDCDB,  /* 16 */
+    0xDCCCBBBB,  /* 17 */
+    0x9977799E,  /* 18 */
+    0x68787999,  /* 19 */
+    0x99999855,  /* 20 */
+    0x11111119,  /* 21 */
+    0x99999111,  /* 22 */
+    0xB9999111,  /* 23 */
+    0xBBCBBBBB,  /* 24 */
+    0x99777798,  /* 25 */
+    0x99999199,  /* 26 */
+    0x99195577,  /* 27 */
+    0x99999159,  /* 28 */
+    0x91111111,  /* 29 */
+    0x11111991,  /* 30 */
+    0x99999911,  /* 31 */
+    0x99911111,  /* 32 */
+    0x11999999,  /* 33 */
+    0x1AAAAAAA,  /* 34 */
+    0x11111AAA,  /* 35 */
+    0x11991111,  /* 36 */
+    0x19111111,  /* 37 */
+    0x91991111,  /* 38 */
+    0x1AAAA111,  /* 39 */
+    0x111111AA,  /* 40 */
+    0x11111911,  /* 41 */
+    0xAAAAAAA2,  /* 42 */
+    0xAAAAA2AA,  /* 43 */
+    0xA2AAA2AA,  /* 44 */
+    0x222A2AA2,  /* 45 */
+    0x33383333,  /* 46 */
+    0xAAAAA333,  /* 47 */
+    0x33AAAAAA,  /* 48 */
+    0x33344744,  /* 49 */
+    0x3333333A,  /* 50 */
+    0xAA333333,  /* 51 */
+    0xA33AAAAA,  /* 52 */
+    0x33AAAA9A,  /* 53 */
+    0x33333355,  /* 54 */
+    0xB3333333,  /* 55 */
+    0x333333A3,  /* 56 */
+    0x33333AAA,  /* 57 */
+    0x11111AA1,  /* 58 */
+    0x111A1111,  /* 59 */
+    0xAAAAAAA1,  /* 60 */
+    0x11A1111A,  /* 61 */
+    0x111AAAA1,  /* 62 */
+    0x1111AA11,  /* 63 */
+    0x111111A1,  /* 64 */
+    0x11A11111,  /* 65 */
+    0x11117711,  /* 66 */
+    0x11111A11,  /* 67 */
+    0xA1111AA1,  /* 68 */
+    0x11AAA11A,  /* 69 */
+    0xA1AAAAA1,  /* 70 */
+    0xA11A1111,  /* 71 */
+    0x1111AAA1,  /* 72 */
+    0x1A111111,  /* 73 */
+    0x1111111A,  /* 74 */
+    0xAA111111,  /* 75 */
+    0xAA11111A,  /* 76 */
+    0x11AAAA1A,  /* 77 */
+    0x1AA11111,  /* 78 */
+    0xA1111111,  /* 79 */
+    0x11AA1111,  /* 80 */
+    0x1A1AAA11,  /* 81 */
+    0xAAAA11A1,  /* 82 */
+    0x71111AAA,  /* 83 */
+    0x111AA1AA,  /* 84 */
+    0x11AAAAAA,  /* 85 */
+    0xA1A11111,  /* 86 */
+    0x119999A1,  /* 87 */
+    0xAA1AAAAA,  /* 88 */
+    0x111AAAAA,  /* 89 */
+    0xAAA11111,  /* 90 */
+    0xAA111A1A,  /* 91 */
+    0x1111111E,  /* 92 */
+    0x11199111,  /* 93 */
+    0x1111AAAA,  /* 94 */
+    0x11117111,  /* 95 */
+    0x1BBBB999,  /* 96 */
+    0x91911111,  /* 97 */
+    0x11111199,  /* 98 */
+    0x19911111,  /* 99 */
+    0x21BBBEEE,  /* 100 */
+    0xEFFFFFCE,  /* 101 */
+    0x99977777,  /* 102 */
+    0x19999999,  /* 103 */
+    0xBBBBBB11,  /* 104 */
+    0x55551115,  /* 105 */
+    0x19997755,  /* 106 */
+    0x19999199,  /* 107 */
+    0x99191111,  /* 108 */
+    0x99111119,  /* 109 */
+    0x91919999,  /* 110 */
+    0x17111191,  /* 111 */
+    0x11119999,  /* 112 */
+    0x99997799,  /* 113 */
+    0x99919111,  /* 114 */
+    0x99199999,  /* 115 */
+    0x11111999,  /* 116 */
+    0x11115555,  /* 117 */
+    0x11111511,  /* 118 */
+    0x99999991,  /* 119 */
+    0x99199991,  /* 120 */
+    0x99991199,  /* 121 */
+    0x19111999,  /* 122 */
+    0x99111111,  /* 123 */
+    0x11199999,  /* 124 */
+    0x1119999E,  /* 125 */
+    0xAAAAAA11,  /* 126 */
+    0x11199AA1,  /* 127 */
+    0x11119111,  /* 128 */
+    0x99919999,  /* 129 */
+    0x19199919,  /* 130 */
+    0x2A211111,  /* 131 */
+    0x22222272,  /* 132 */
+    0x99333333,  /* 133 */
+    0x99891898,  /* 134 */
+    0x79999999,  /* 135 */
+    0x19997799,  /* 136 */
+    0x11119779,  /* 137 */
+    0x99777991,  /* 138 */
+    0x19999111,  /* 139 */
+    0x11999991,  /* 140 */
+    0x17799977,  /* 141 */
+    0x1199BBB1,  /* 142 */
+};
+
+static eBidiCategory GetBidiCat(PRUnichar u)
+{
+    PRUint32 pat;
+    PRUint16 patidx;
+
+    /*  Handle blocks which use index table mapping */   
+
+    /* Handle U+0000 to U+07FF */
+    if (u<=((PRUnichar)0x07FF)) {
+        patidx = gBidiCatIdx1 [( u  >> 3 )];
+        if (patidx < 0x10)
+            return (eBidiCategory)patidx;
+        else {
+            pat = gBidiCatPat[patidx];
+            return (eBidiCategory)((pat  >> ((u % 8) * 4)) & 0x0F);
+        }
+    }
+
+    /* Handle U+0900 to U+18FF */
+    if ((((PRUnichar)0x0900)<=u)&&(u<=((PRUnichar)0x18FF))) {
+        patidx = gBidiCatIdx2 [( (u -(PRUnichar) 0x0900) >> 3 )];
+        if (patidx < 0x10)
+            return (eBidiCategory)patidx;
+        else {
+            pat = gBidiCatPat[patidx];
+            return (eBidiCategory)((pat  >> ((u % 8) * 4)) & 0x0F);
+        }
+    }
+
+    /* Handle U+1E00 to U+28FF */
+    if ((((PRUnichar)0x1E00)<=u)&&(u<=((PRUnichar)0x28FF))) {
+        patidx = gBidiCatIdx3 [( (u -(PRUnichar) 0x1E00) >> 3 )];
+        if (patidx < 0x10)
+            return (eBidiCategory)patidx;
+        else {
+            pat = gBidiCatPat[patidx];
+            return (eBidiCategory)((pat  >> ((u % 8) * 4)) & 0x0F);
+        }
+    }
+
+    /* Handle U+2E80 to U+33FF */
+    if ((((PRUnichar)0x2E80)<=u)&&(u<=((PRUnichar)0x33FF))) {
+        patidx = gBidiCatIdx4 [( (u -(PRUnichar) 0x2E80) >> 3 )];
+        if (patidx < 0x10)
+            return (eBidiCategory)patidx;
+        else {
+            pat = gBidiCatPat[patidx];
+            return (eBidiCategory)((pat  >> ((u % 8) * 4)) & 0x0F);
+        }
+    }
+
+    /* Handle U+A000 to U+A4FF */
+    if ((((PRUnichar)0xA000)<=u)&&(u<=((PRUnichar)0xA4FF))) {
+        patidx = gBidiCatIdx5 [( (u -(PRUnichar) 0xA000) >> 3 )];
+        if (patidx < 0x10)
+            return (eBidiCategory)patidx;
+        else {
+            pat = gBidiCatPat[patidx];
+            return (eBidiCategory)((pat  >> ((u % 8) * 4)) & 0x0F);
+        }
+    }
+
+    /* Handle U+F900 to U+FFFF */
+    if (((PRUnichar)0xF900)<=u) {
+        patidx = gBidiCatIdx6 [( (u -(PRUnichar) 0xF900) >> 3 )];
+        if (patidx < 0x10)
+            return (eBidiCategory)patidx;
+        else {
+            pat = gBidiCatPat[patidx];
+            return (eBidiCategory)((pat  >> ((u % 8) * 4)) & 0x0F);
+        }
+    }
+
+    return eBidiCat_L; /* UNDEFINE = L */
+};
+/* total data size = 2252 */
new file mode 100644
--- /dev/null
+++ b/intl/unicharutil/util/genbidicattable.pl
@@ -0,0 +1,343 @@
+#!/usr/local/bin/perl
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is IBM
+# Corporation.  Portions created by IBM are
+# Copyright (C) 2000 IBM Corporation. All
+# Rights Reserved.
+#
+# Contributor(s): 
+#
+
+######################################################################
+#
+# Initial global variable
+#
+######################################################################
+
+%gcount = ();
+%pat = ();
+
+%map = (
+  "L"   =>  "1", # Left-to-Right			  	
+  "R"   =>  "2", # Right-to-Left			  
+  "AL"  =>  "3", # Right-to-Left Arabic		  
+  "AN"  =>  "4", # Arabic Number			  
+  "EN"  =>  "5", # European Number			  	
+  "ES"  =>  "6", # European Number Separator  
+  "ET"  =>  "7", # European Number Terminator 	
+  "CS"  =>  "8", # Common Number Separator	  
+  "ON"  =>  "9", # Other Neutrals             
+  "NSM" => "10", # Non-Spacing Mark			  
+  "BN"  => "11", # Boundary Neutral			  
+  "B"   => "12", # Paragraph Separator		  
+  "S"   => "13", # Segment Separator		  
+  "WS"  => "14", # Whitespace				  
+  "LRE" => "15", # Left-to-Right Embedding	  
+  "RLE" => "15", # Right-to-Left Embedding	  
+  "PDF" => "15", # Pop Directional Format	  
+  "LRO" => "15", # Left-to-Right Override	  	
+  "RLO" => "15"  # Right-to-Left Override	  	
+);
+
+%special = ();
+
+######################################################################
+#
+# Open the unicode database file
+#
+######################################################################
+open ( UNICODATA , "< UnicodeData-Latest.txt") 
+   || die "cannot find UnicodeData-Latest.txt";
+
+######################################################################
+#
+# Open the output file
+#
+######################################################################
+open ( OUT , "> ../base/src/bidicattable.h") 
+  || die "cannot open output ../base/src/bidicattable.h file";
+
+######################################################################
+#
+# Generate license and header
+#
+######################################################################
+$npl = <<END_OF_NPL;
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "MPL"); you may not use this file except in
+ * compliance with the MPL.  You may obtain a copy of the MPL at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the MPL is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the MPL
+ * for the specific language governing rights and limitations under the
+ * MPL.
+ *
+ * The Initial Developer of the Original Code is IBM
+ * Corporation.  Portions created by IBM are
+ * Copyright (C) 2000 IBM Corporation. All
+ * Rights Reserved.
+ */
+/* 
+    DO NOT EDIT THIS DOCUMENT !!! THIS DOCUMENT IS GENERATED BY
+    mozilla/intl/unicharutil/tools/genbidicattable.pl
+ */
+END_OF_NPL
+print OUT $npl;
+print OUT "\n\n#include \"nscore.h\" \n\n";
+
+
+%bidicategory = ();
+%sh = ();
+%sl = ();
+%sc = ();
+
+######################################################################
+#
+# Process the file line by line
+#
+######################################################################
+while(<UNICODATA>) {
+   chop;
+   ######################################################################
+   #
+   # Get value from fields
+   #
+   ######################################################################
+   @f = split(/;/ , $_); 
+   $c = $f[0];   # The unicode value
+   $n = $f[1];   # The unicode name
+   $g = $f[2];   # The General Category 
+   $b = $f[4];   # The Bidi Category 
+
+   if(( substr($n, 0, 1) ne "<")  || ($n eq "<control>"))
+   {
+      #
+      # print $g;
+      # 
+     
+      $gcount{$b}++;
+      $bidicategory{$c} = $b;
+   } else {
+
+      # Handle special block
+      @pair=split(/, /,  $n );
+      $catnum = $map{$b};
+
+      # printf "[%s][%s] => %d\n", $pair[0], $pair[1], $catnum;
+      if( $pair[1] eq "First>") {
+         $sl{$pair[0]} = $c;
+         $sc{$pair[0]} = $catnum;
+      } elsif ( $pair[1] eq "Last>") {
+         $sh{$pair[0]} = $c;
+         if($sc{$pair[0]} ne $catnum)
+         {
+            print "WARNING !!!! error in handling special block\n\n";
+         }
+      } else {
+         print "WARNING !!!! error in handling special block\n\n";
+      }
+   }
+}
+
+# XXX - How can this be made more flexible as new blocks are added to the UCDB?
+
+@range = (
+  0x0000, 0x07ff, 
+  0x0900, 0x18ff,
+  0x1e00, 0x28ff,
+  0x2e80, 0x33ff,
+  0xa000, 0xa4ff,	  
+  0xf900, 0xffff
+);
+
+
+$totaldata = 0;
+
+$tt=($#range+1) / 2;
+@patarray = ();
+
+
+# This should improve performance: put all the patterns like 0x11111111, 0x22222222 etc at the beginning of the table.
+#  Since there are a lot of blocks with the same category, we should be able to save a lot of time extracting the digits
+for (0..15) {
+	$pattern = "0x".(sprintf("%X", $_) x 8);
+	$patarray[$_] = $pattern;
+	$pat{$pattern} = $_;
+}
+
+$newidx = 0x10;
+
+for($t = 1; $t <= $tt; $t++)
+{
+	$tl = $range[($t-1) * 2];
+	$th = $range[($t-1) * 2 + 1];
+	$ts = ( $th - $tl ) >> 3;
+	$totaldata += $ts + 1;
+	printf OUT "static PRUint8 gBidiCatIdx%d[%d] = {\n", $t, $ts + 1;
+	for($i = ($tl >> 3); $i <= ($th >> 3) ; $i ++ )
+	{
+      $data = 0;
+		      
+		for($j = 0; $j < 8 ; $j++)
+		{
+			#defaults for unassigned characters -- see table 3.7 in the Unicode Bidi Algorithm
+			$test = ($i << 3) + $j;
+			if ((($test >= 0x0590) && ($test <= 0x5FF))
+				  || (($test >= 0xFB1D) && ($test <= 0xFB4F)))
+			{
+				$default = $map{"R"};
+			} elsif ((($test >= 0x0600) && ($test <= 0x7BF))
+					   || (($test >= 0xFB50) && ($test <= 0xFDFF))
+					   || (($test >= 0xFE70) && ($test <= 0xFEFF)))
+			{
+				$default = $map{"AL"};
+			} else
+			{
+				$default = $map{"L"};
+			}
+			$k =  sprintf("%04X", (($i << 3) + $j));
+			
+			$cat =  $bidicategory{$k};
+			if( $cat eq "")
+			{
+				$data = $data +  ($default << (4*$j));
+			} else {
+				$data = $data +  ($map{$cat} << (4*$j));
+			}
+			
+		}
+		$pattern = sprintf("0x%08X", $data);
+   
+		$idx = $pat{$pattern};
+		unless( exists($pat{$pattern})){
+			$idx = $newidx++;
+			$patarray[$idx] = $pattern;
+			$pat{$pattern} = $idx;
+		}
+
+      printf OUT "    %3d,  /* U+%04X - U+%04X : %s */\n" , 
+                 $idx, ($i << 3),((($i +1)<< 3)-1), $pattern ;
+
+   
+   }
+   printf OUT "};\n\n";
+
+   if($t ne $tt)
+   {
+       $tl = $range[($t-1) * 2 + 1] + 1;
+       $th = $range[$t * 2] - 1;
+       for($i = ($tl >> 3); $i <= ($th >> 3) ; $i ++ )
+       {
+          $data = 0;
+          for($j = 0; $j < 8 ; $j++)
+          {
+             $k =  sprintf("%04X", (($i << 3) + $j));
+      
+             $cat =  $bidicategory{$k};
+             if( $cat ne "")
+             {
+                 $data = $data +  ($map{$cat} << (4*$j));
+             }
+          }
+          $pattern = sprintf("0x%08X", $data);
+          if($data ne 0)
+          {
+             print "WARNING, Unicode Database now contain characters" .
+                   "which we have not consider, change this program !!!\n\n";
+             printf "Problem- U+%04X - U+%04X range\n", ($i << 3),((($i +1)<< 3)-1);
+          }
+       }
+   }
+}
+
+
+if($newidx > 255)
+{
+  die "We have more than 255 patterns !!! - $newidx\n\n" .
+      "This program is now broken!!!\n\n\n";      
+
+}
+printf OUT "static PRUint32 gBidiCatPat[$newidx] = {\n";
+for($i = 0 ; $i < $newidx; $i++)
+{
+   printf OUT "    %s,  /* $i */\n", $patarray[$i] ;
+}
+printf OUT "};\n\n";
+$totaldata += $newidx * 4;
+
+printf OUT "static eBidiCategory GetBidiCat(PRUnichar u)\n{\n";
+printf OUT "    PRUint32 pat;\n";
+printf OUT "    PRUint16 patidx;\n\n";
+printf OUT "    /*  Handle blocks which use index table mapping */   \n\n";
+for($t = 1; $t <= $tt; $t++)
+{
+   $tl = $range[($t-1) * 2];
+   $th = $range[($t-1) * 2 + 1];
+   if ($tl == 0) {
+	   printf OUT "    /* Handle U+%04X to U+%04X */\n", $tl, $th;
+	   printf OUT "    if (u<=((PRUnichar)0x%04X)) {\n", $th;
+	   printf OUT "        patidx = gBidiCatIdx%d [( u  >> 3 )];\n", $t;
+   } elsif ($th == 0xFFFF) {
+	   printf OUT "    /* Handle U+%04X to U+%04X */\n", $tl, $th;
+	   printf OUT "    if (((PRUnichar)0x%04X)<=u) {\n", $tl;
+	   printf OUT "        patidx = gBidiCatIdx%d [( (u -(PRUnichar) 0x%04X) >> 3 )];\n", $t, $tl;
+   } else {
+	   printf OUT "    /* Handle U+%04X to U+%04X */\n", $tl, $th;
+	   printf OUT "    if ((((PRUnichar)0x%04X)<=u)&&(u<=((PRUnichar)0x%04X))) {\n", $tl, $th;
+	   printf OUT "        patidx = gBidiCatIdx%d [( (u -(PRUnichar) 0x%04X) >> 3 )];\n", $t, $tl;
+   }
+   printf OUT "        if (patidx < 0x10)\n";
+   printf OUT "            return (eBidiCategory)patidx;\n";
+   printf OUT "        else {\n";
+   printf OUT "            pat = gBidiCatPat[patidx];\n";
+   printf OUT "            return (eBidiCategory)((pat  >> ((u % 8) * 4)) & 0x0F);\n";
+   printf OUT "        }\n";
+   printf OUT "    }\n\n";
+}
+
+@special = keys(%sh);
+$sp = 0;
+foreach $s ( sort(@special) ) {
+	# don't bother to define the special blocks unless they have a different
+    #  value from the default they would be given if they were undefined
+	unless ($sc{$s} == $map{"L"}) {
+		unless ($sp++) {
+			%by_value = reverse %map;
+			printf OUT "    /*  Handle blocks which share the same category */\n\n";
+		}
+		printf OUT "    /* Handle %s block */\n", substr($s, 1);
+		printf OUT "    if((((PRUnichar)0x%s)<=u)&&(u<=((PRUnichar)0x%s))) \n", $sl{$s}, $sh{$s};
+		printf OUT "        return eBidiCat_$by_value{$sc{$s}}; \n\n";
+	}
+}
+
+
+
+printf OUT "    return eBidiCat_L; /* UNDEFINE = L */\n};\n";
+
+printf OUT "/* total data size = $totaldata */\n";
+print "total = $totaldata\n";
+
+######################################################################
+#
+# Close files
+#
+######################################################################
+close(UNIDATA);
+close(OUT);
+
new file mode 100644
--- /dev/null
+++ b/intl/unicharutil/util/gensymmtable.pl
@@ -0,0 +1,114 @@
+#!/usr/local/bin/perl
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is IBM code.
+#
+# The Initial Developer of the Original Code is IBM.
+# Portions created by IBM are
+# Copyright (C) International Business Machines
+# Corporation, 2000.  All Rights Reserved.
+#
+# Contributor(s): Simon Montagu
+#
+
+# This program generates the header file symmtable.h from the Unicode
+# informative data file BidiMirroring.txt.
+# See the comments in that file for details of its structure and contents.
+#
+# At the moment we only handle cases where there is another Unicode
+# character whose glyph can serve as at least an adequate version of
+# the mirror image of the original character's glyph. This leaves open
+# the problem of how to provide mirrored glyphs for characters where
+# this is not the case.
+
+# Process the input file
+$ucp = "[0-9a-fA-F]{4}";               # Unicode code point (4 successive hex digits) as a pattern to match
+open ( UNICODATA , "< BidiMirroring.txt") 
+   || die "Cannot find BidiMirroring.txt.\
+The file should be avaiable here:\
+http://www.unicode.org/Public/UNIDATA/BidiMirroring.txt\n";
+
+while (<UNICODATA>) {
+	chop;
+  if (/^($ucp); ($ucp) # (.+)/) {      # If the line looks like this pattern
+                                       # (example: 0028; 0029 # LEFT PARENTHESIS)
+    @table[hex($1)]=hex($1) ^ hex($2); # Enter the character XOR its symmetric pair in the table
+    @isblock[hex(substr($1, 0, 2))]=1; # Remember this block
+  }
+}
+close(UNICODATA);
+
+# Generate license and header
+open ( OUT , "> ../base/src/symmtable.h") 
+  || die "cannot open output ../base/src/symmtable.h file";
+$npl = <<END_OF_NPL;
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is IBM code.
+ * 
+ * The Initial Developer of the Original Code is IBM.
+ * Portions created by IBM are
+ * Copyright (C) International Business Machines
+ * Corporation, 2000.  All Rights Reserved.
+ */
+/* 
+    DO NOT EDIT THIS DOCUMENT !!! THIS DOCUMENT IS GENERATED BY
+    mozilla/intl/unicharutil/tools/gensymmtable.pl
+ */
+END_OF_NPL
+print OUT $npl;
+
+# Generate data tables
+foreach $block (0 .. 0xff) {
+  if (@isblock[$block]) {
+    printf OUT "\n/* Block U%02X__ */\n", $block;
+    printf OUT "const static PRUint8 symmtable_%02X[256] = {\n", $block;
+    print OUT "/*      ";
+    foreach $byte (0 .. 0xf) {
+      printf OUT "   _%X ", $byte;
+    }
+    print OUT "*/\n";
+    foreach $row (0 .. 0xf) {
+      printf OUT "/* %X_ */ ", $row;
+      foreach $byte (0 .. 0xf) {
+         $ix = ($block << 8) | ($row << 4) | ($byte);
+         printf OUT ("%#4x, ", @table[$ix]);
+      }
+      print OUT "\n";
+    }
+    print OUT "};\n";
+  }
+}
+
+# Generate conversion method
+print OUT "\nstatic PRUnichar Mirrored(PRUnichar u)\n{\n";
+print OUT "  switch (u & 0xFF00) {\n";
+print OUT "    // XOR the character with the bitmap in the conversion table to give the symmetric equivalent\n";
+foreach $block (0 .. 0xff) {
+  if (1==@isblock[$block]) {
+    printf OUT "    case %#x:\n", $block * 256;
+    printf OUT "      u ^= symmtable_%02X[u & 0xff];\n", $block;
+    print  OUT "      break;\n";
+  }
+}
+print OUT "  }\n  return u;\n}\n";
+close(OUT);
new file mode 100644
--- /dev/null
+++ b/intl/unicharutil/util/nsBidiUtils.cpp
@@ -0,0 +1,462 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * IBM Corporation.  Portions created by IBM are
+ * Copyright (C) 2000 IBM Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *   Maha Abou El Rous <mahar@eg.ibm.com>
+ *   Lina Kemmel <lkemmel@il.ibm.com>
+ *   Simon Montagu <smontagu@netscape.com>
+ *   Roozbeh Pournader <roozbeh@sharif.edu>
+ */
+#ifdef IBMBIDI
+#include "nsBidiUtils.h"
+
+#define FE_TO_06_OFFSET 0xfe70
+
+static PRUnichar FE_TO_06 [][2] = {
+    {0x064b,0x0000},{0x064b,0x0640},{0x064c,0x0000},
+    {0x0000,0x0000},{0x064d,0x0000},{0x0000,0x0000},
+    {0x064e,0x0000},{0x064e,0x0640},{0x064f,0x0000},
+    {0x064f,0x0640},{0x0650,0x0000},{0x0650,0x0640},
+    {0x0651,0x0000},{0x0651,0x0640},{0x0652,0x0000},
+    {0x0652,0x0640},{0x0621,0x0000},{0x0622,0x0000},
+    {0x0622,0x0000},{0x0623,0x0000},{0x0623,0x0000},
+    {0x0624,0x0000},{0x0624,0x0000},{0x0625,0x0000},
+    {0x0625,0x0000},{0x0626,0x0000},{0x0626,0x0000},
+    {0x0626,0x0000},{0x0626,0x0000},{0x0627,0x0000},
+    {0x0627,0x0000},{0x0628,0x0000},{0x0628,0x0000},
+    {0x0628,0x0000},{0x0628,0x0000},{0x0629,0x0000},
+    {0x0629,0x0000},{0x062a,0x0000},{0x062a,0x0000},
+    {0x062a,0x0000},{0x062a,0x0000},{0x062b,0x0000},
+    {0x062b,0x0000},{0x062b,0x0000},{0x062b,0x0000},
+    {0x062c,0x0000},{0x062c,0x0000},{0x062c,0x0000},
+    {0x062c,0x0000},{0x062d,0x0000},{0x062d,0x0000},
+    {0x062d,0x0000},{0x062d,0x0000},{0x062e,0x0000},
+    {0x062e,0x0000},{0x062e,0x0000},{0x062e,0x0000},
+    {0x062f,0x0000},{0x062f,0x0000},{0x0630,0x0000},
+    {0x0630,0x0000},{0x0631,0x0000},{0x0631,0x0000},
+    {0x0632,0x0000},{0x0632,0x0000},{0x0633,0x0000},
+    {0x0633,0x0000},{0x0633,0x0000},{0x0633,0x0000},
+    {0x0634,0x0000},{0x0634,0x0000},{0x0634,0x0000},
+    {0x0634,0x0000},{0x0635,0x0000},{0x0635,0x0000},
+    {0x0635,0x0000},{0x0635,0x0000},{0x0636,0x0000},
+    {0x0636,0x0000},{0x0636,0x0000},{0x0636,0x0000},
+    {0x0637,0x0000},{0x0637,0x0000},{0x0637,0x0000},
+    {0x0637,0x0000},{0x0638,0x0000},{0x0638,0x0000},
+    {0x0638,0x0000},{0x0638,0x0000},{0x0639,0x0000},
+    {0x0639,0x0000},{0x0639,0x0000},{0x0639,0x0000},
+    {0x063a,0x0000},{0x063a,0x0000},{0x063a,0x0000},
+    {0x063a,0x0000},{0x0641,0x0000},{0x0641,0x0000},
+    {0x0641,0x0000},{0x0641,0x0000},{0x0642,0x0000},
+    {0x0642,0x0000},{0x0642,0x0000},{0x0642,0x0000},
+    {0x0643,0x0000},{0x0643,0x0000},{0x0643,0x0000},
+    {0x0643,0x0000},{0x0644,0x0000},{0x0644,0x0000},
+    {0x0644,0x0000},{0x0644,0x0000},{0x0645,0x0000},
+    {0x0645,0x0000},{0x0645,0x0000},{0x0645,0x0000},
+    {0x0646,0x0000},{0x0646,0x0000},{0x0646,0x0000},
+    {0x0646,0x0000},{0x0647,0x0000},{0x0647,0x0000},
+    {0x0647,0x0000},{0x0647,0x0000},{0x0648,0x0000},
+    {0x0648,0x0000},{0x0649,0x0000},{0x0649,0x0000},
+    {0x064a,0x0000},{0x064a,0x0000},{0x064a,0x0000},
+    {0x064a,0x0000},{0x0644,0x0622},{0x0644,0x0622},
+    {0x0644,0x0623},{0x0644,0x0623},{0x0644,0x0625},
+    {0x0644,0x0625},{0x0644,0x0627},{0x0644,0x0627}
+};
+
+static PRUnichar FB_TO_06 [] = {
+    0x0671,0x0671,0x067B,0x067B,0x067B,0x067B,0x067E,0x067E, //FB50-FB57
+    0x067E,0x067E,0x0680,0x0680,0x0680,0x0680,0x067A,0x067A, //FB58-FB5F
+    0x067A,0x067A,0x067F,0x067F,0x067F,0x067F,0x0679,0x0679, //FB60-FB67
+    0x0679,0x0679,0x06A4,0x06A4,0x06A4,0x06A4,0x06A6,0x06A6, //FB68-FB6F
+    0x06A6,0x06A6,0x0684,0x0684,0x0684,0x0684,0x0683,0x0683, //FB70-FB77
+    0x0683,0x0683,0x0686,0x0686,0x0686,0x0686,0x0687,0x0687, //FB78-FB7F
+    0x0687,0x0687,0x068D,0x068D,0x068C,0x068C,0x068E,0x068E, //FB80-FB87
+    0x0688,0x0688,0x0698,0x0698,0x0691,0x0691,0x06A9,0x06A9, //FB88-FB8F
+    0x06A9,0x06A9,0x06AF,0x06AF,0x06AF,0x06AF,0x06B3,0x06B3, //FB90-FB97
+    0x06B3,0x06B3,0x06B1,0x06B1,0x06B1,0x06B1,0x06BA,0x06BA, //FB98-FB9F
+    0x06BB,0x06BB,0x06BB,0x06BB,0x06C0,0x06C0,0x06C1,0x06C1, //FBA0-FBA7
+    0x06C1,0x06C1,0x06BE,0x06BE,0x06BE,0x06BE,0x06D2,0x06D2, //FBA8-FBAF
+    0x06D3,0x06D3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, //FBB0-FBB7
+    0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, //FBB8-FBBF
+    0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, //FBC0-FBC7
+    0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, //FBC8-FBCF
+    0x0000,0x0000,0x0000,0x06AD,0x06AD,0x06AD,0x06AD,0x06C7, //FBD0-FBD7
+    0x06C7,0x06C6,0x06C6,0x06C8,0x06C8,0x0677,0x06CB,0x06CB, //FBD8-FBDF
+    0x06C5,0x06C5,0x06C9,0x06C9,0x06D0,0x06D0,0x06D0,0x06D0, //FBE0-FBE7
+    0x0649,0x0649,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, //FBE8-FBEF
+    0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, //FBF0-FBF7
+    0x0000,0x0000,0x0000,0x0000,0x06CC,0x06CC,0x06CC,0x06CC  //FBF8-FBFF
+};
+
+#define PresentationToOriginal(c, order)                  \
+    (((0xFE70 <= (c) && (c) <= 0xFEFC)) ?                 \
+         FE_TO_06[(c)- FE_TO_06_OFFSET][order] :                    \
+     (((0xFB50 <= (c) && (c) <= 0xFBFF) && (order) == 0) ? \
+         FB_TO_06[(c)-0xFB50] : (PRUnichar) 0x0000))
+
+//============ Begin Arabic Basic to Presentation Form B Code ============
+// Note: the following code are moved from gfx/src/windows/nsRenderingContextWin.cpp
+static PRUint8 gArabicMap1[] = {
+            0x81, 0x83, 0x85, 0x87, 0x89, 0x8D, // 0622-0627
+0x8F, 0x93, 0x95, 0x99, 0x9D, 0xA1, 0xA5, 0xA9, // 0628-062F
+0xAB, 0xAD, 0xAF, 0xB1, 0xB5, 0xB9, 0xBD, 0xC1, // 0630-0637
+0xC5, 0xC9, 0xCD                                // 0638-063A
+};
+
+static PRUint8 gArabicMap2[] = {
+      0xD1, 0xD5, 0xD9, 0xDD, 0xE1, 0xE5, 0xE9, // 0641-0647
+0xED, 0xEF, 0xF1                                // 0648-064A
+};
+
+static PRUint8 gArabicMapEx[] = {
+      0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0671-0677
+0x00, 0x66, 0x5E, 0x52, 0x00, 0x00, 0x56, 0x62, // 0678-067F
+0x5A, 0x00, 0x00, 0x76, 0x72, 0x00, 0x7A, 0x7E, // 0680-0687
+0x88, 0x00, 0x00, 0x00, 0x84, 0x82, 0x86, 0x00, // 0688-068F
+0x00, 0x8C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0690-0697
+0x8A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0698-069F
+0x00, 0x00, 0x00, 0x00, 0x6A, 0x00, 0x6E, 0x00, // 06A0-06A7
+0x00, 0x8E, 0x00, 0x00, 0x00, 0xD3, 0x00, 0x92, // 06A8-06AF
+0x00, 0x9A, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, // 06B0-06B7
+0x00, 0x00, 0x00, 0xA0, 0x00, 0x00, 0xAA, 0x00, // 06B8-06BF
+0xA4, 0xA6, 0x00, 0x00, 0x00, 0xE0, 0xD9, 0xD7, // 06C0-06C7
+0xDB, 0xE2, 0x00, 0xDE, 0xFC, 0x00, 0x00, 0x00, // 06C8-06CF
+0xE4, 0x00, 0xAE, 0xB0                          // 06D0-06D3
+};
+
+#define PresentationFormB(c, form)                                       \
+    (((0x0622<=(c)) && ((c)<=0x063A)) ?                                  \
+      (0xFE00|(gArabicMap1[(c)-0x0622] + (form))) :                      \
+       (((0x0641<=(c)) && ((c)<=0x064A)) ?                               \
+        (0xFE00|(gArabicMap2[(c)-0x0641] + (form))) :                    \
+         (((0x0671<=(c)) && ((c))<=0x06D3) && gArabicMapEx[(c)-0x0671]) ? \
+          (0xFB00|(gArabicMapEx[(c)-0x0671] + (form))) : (c)))
+enum {
+   eIsolated,  // or Char N
+   eFinal,     // or Char R
+   eInitial,   // or Char L
+   eMedial     // or Char M
+} eArabicForm;
+enum {
+   eTr = 0, // Transparent
+   eRJ = 1, // Right-Joining
+   eLJ = 2, // Left-Joining
+   eDJ = 3, // Dual-Joining
+   eNJ = 4, // Non-Joining
+   eJC = 7, // Joining Causing
+   eRightJCMask = 2, // bit of Right-Join Causing 
+   eLeftJCMask = 1   // bit of Left-Join Causing 
+} eArabicJoiningClass;
+
+#define RightJCClass(j) (eRightJCMask&(j))
+#define LeftJCClass(j)  (eLeftJCMask&(j))
+
+#define DecideForm(jl,j,jr)                                 \
+  (((eRJ == (j)) && RightJCClass(jr)) ? eFinal              \
+                                      :                     \
+   ((eDJ == (j)) ?                                          \
+    ((RightJCClass(jr)) ?                                   \
+     (((LeftJCClass(jl)) ? eMedial                          \
+                         : eFinal))                         \
+                        :                                   \
+     (((LeftJCClass(jl)) ? eInitial                         \
+                         : eIsolated))                      \
+    )                     : eIsolated))                     \
+
+// All letters without an equivalen in the FB50 block are 'eNJ' here. This
+// should be fixed after finding some better mechanism for handling Arabic.
+static PRInt8 gJoiningClass[] = {
+          eNJ, eRJ, eRJ, eRJ, eRJ, eDJ, eRJ, // 0621-0627
+eDJ, eRJ, eDJ, eDJ, eDJ, eDJ, eDJ, eRJ, // 0628-062F
+eRJ, eRJ, eRJ, eDJ, eDJ, eDJ, eDJ, eDJ, // 0630-0637
+eDJ, eDJ, eDJ, eNJ, eNJ, eNJ, eNJ, eNJ, // 0638-063F
+eJC, eDJ, eDJ, eDJ, eDJ, eDJ, eDJ, eDJ, // 0640-0647
+eRJ, eRJ, eDJ, eTr, eTr, eTr, eTr, eTr, // 0648-064F
+eTr, eTr, eTr, eTr, eTr, eTr, eNJ, eNJ, // 0650-0657
+eNJ, eNJ, eNJ, eNJ, eNJ, eNJ, eNJ, eNJ, // 0658-065F
+eNJ, eNJ, eNJ, eNJ, eNJ, eNJ, eNJ, eNJ, // 0660-0667
+eNJ, eNJ, eNJ, eNJ, eNJ, eNJ, eNJ, eNJ, // 0668-066F
+eTr, eRJ, eNJ, eNJ, eNJ, eNJ, eNJ, eNJ, // 0670-0677
+eNJ, eDJ, eDJ, eDJ, eNJ, eNJ, eDJ, eDJ, // 0678-067F
+eDJ, eNJ, eNJ, eDJ, eDJ, eNJ, eDJ, eDJ, // 0680-0687
+eRJ, eNJ, eNJ, eNJ, eRJ, eRJ, eRJ, eNJ, // 0688-068F
+eNJ, eRJ, eNJ, eNJ, eNJ, eNJ, eNJ, eNJ, // 0690-0697
+eRJ, eNJ, eNJ, eNJ, eNJ, eNJ, eNJ, eNJ, // 0698-069F
+eNJ, eNJ, eNJ, eNJ, eDJ, eNJ, eDJ, eNJ, // 06A0-06A7
+eNJ, eDJ, eNJ, eNJ, eNJ, eDJ, eNJ, eDJ, // 06A8-06AF
+eNJ, eDJ, eNJ, eDJ, eNJ, eNJ, eNJ, eNJ, // 06B0-06B7
+eNJ, eNJ, eNJ, eDJ, eNJ, eNJ, eDJ, eNJ, // 06B8-06BF
+eRJ, eDJ, eNJ, eNJ, eNJ, eRJ, eRJ, eRJ, // 06C0-06C7
+eRJ, eRJ, eNJ, eRJ, eDJ, eNJ, eNJ, eNJ, // 06C8-06CF
+eDJ, eNJ, eRJ, eRJ, eNJ, eNJ, eTr, eTr, // 06D0-06D7
+eTr, eTr, eTr, eTr, eTr, eTr, eTr, eTr, // 06D8-06DF
+eTr, eTr, eTr, eTr, eTr, eNJ, eNJ, eTr, // 06E0-06E7
+eTr, eNJ, eTr, eTr, eTr, eTr, eNJ, eNJ, // 06E8-06EF
+eNJ, eNJ, eNJ, eNJ, eNJ, eNJ, eNJ, eNJ, // 06F0-06F7
+eNJ, eNJ, eNJ, eNJ, eNJ, eNJ, eNJ, eNJ  // 06F8-06FF
+};
+
+#define GetJoiningClass(c)                   \
+  (((0x0621 <= (c)) && ((c) <= 0x06FF)) ?    \
+       (gJoiningClass[(c) - 0x0621]) :       \
+      ((0x200D == (c)) ? eJC : eTr))
+
+static PRUint16 gArabicLigatureMap[] = 
+{
+0x82DF, // 0xFE82 0xFEDF -> 0xFEF5
+0x82E0, // 0xFE82 0xFEE0 -> 0xFEF6
+0x84DF, // 0xFE84 0xFEDF -> 0xFEF7
+0x84E0, // 0xFE84 0xFEE0 -> 0xFEF8
+0x88DF, // 0xFE88 0xFEDF -> 0xFEF9
+0x88E0, // 0xFE88 0xFEE0 -> 0xFEFA
+0x8EDF, // 0xFE8E 0xFEDF -> 0xFEFB
+0x8EE0  // 0xFE8E 0xFEE0 -> 0xFEFC
+};
+
+nsresult ArabicShaping(const PRUnichar* aString, PRUint32 aLen,
+                       PRUnichar* aBuf, PRUint32 *aBufLen)
+{
+  const PRUnichar* src = aString;
+  const PRUnichar* p;
+  PRUnichar* dest = aBuf;
+  PRUnichar formB;
+  PRInt8 leftJ, thisJ, rightJ;
+  PRInt8 leftNoTrJ, rightNoTrJ;
+  thisJ = eNJ;
+  rightJ = GetJoiningClass(*(src));
+  while(src<aString+aLen-1) {
+    leftJ = thisJ;
+
+    if ((eTr != leftJ) || ((leftJ == eTr) && 
+        ( ( (src-1) >= aString ) && !IS_ARABIC_CHAR(*(src-1)))))
+      leftNoTrJ = thisJ;
+
+    if(src-2 >= (aString)){
+      for(p=src-2; (p >= (aString))&& (eTr == leftNoTrJ) && (IS_ARABIC_CHAR(*(p+1))) ; p--)  
+        leftNoTrJ = GetJoiningClass(*(p)) ;
+    }
+
+    thisJ = rightJ;
+    rightJ = rightNoTrJ = GetJoiningClass(*(src+1)) ;
+
+    if(src+2 <= (aString+aLen-1)){
+      for(p=src+2; (p <= (aString+aLen-1))&&(eTr == rightNoTrJ) && (IS_ARABIC_CHAR(*(src+1))); p++)
+        rightNoTrJ = GetJoiningClass(*(p)) ;
+    }
+
+    formB = PresentationFormB(*src, DecideForm(leftNoTrJ, thisJ, rightNoTrJ));
+    *dest++ = formB;
+    src++;
+
+  }
+  if((eTr != thisJ) || 
+     ((thisJ == eTr) && (((src-1)>=aString) && (!IS_ARABIC_CHAR(*(src-1))))))
+    leftNoTrJ = thisJ;
+
+  if(src-2 >= (aString)){
+    for(p=src-2; (src-2 >= (aString)) && (eTr == leftNoTrJ) && (IS_ARABIC_CHAR(*(p+1))); p--)
+      leftNoTrJ = GetJoiningClass(*(p)) ;
+  }
+
+  formB = PresentationFormB(*src, DecideForm(leftNoTrJ, rightJ, eNJ));
+  *dest++ = formB;
+  src++;
+
+  PRUnichar *lSrc = aBuf;
+  PRUnichar *lDest = aBuf;
+  while(lSrc < (dest-1)) {
+    PRUnichar next = *(lSrc+1);
+    if(((0xFEDF == next) || (0xFEE0 == next)) && 
+       (0xFE80 == (0xFFF1 & *lSrc))) {
+      PRBool done = PR_FALSE;
+      PRUint16 key = ((*lSrc) << 8) | ( 0x00FF & next);
+      PRUint16 i;
+      for(i=0;i<8;i++) {
+        if(key == gArabicLigatureMap[i]) {
+          done = PR_TRUE;
+          *lDest++ = 0x200B;//ZERO WIDTH SPACE
+          *lDest++ = 0xFEF5 + i;
+          lSrc+=2;
+          break;
+        }
+      }
+      if(! done)
+        *lDest++ = *lSrc++; 
+    } 
+    else 
+      *lDest++ = *lSrc++; 
+
+  }
+  if(lSrc < dest)
+    *lDest++ = *lSrc++; 
+
+  *aBufLen = lDest - aBuf;
+
+  return NS_OK;
+}
+
+nsresult Conv_FE_06(const nsString& aSrc, nsString& aDst)
+{
+  PRUnichar *aSrcUnichars = (PRUnichar *)aSrc.get();
+  PRUint32 i, size = aSrc.Length();
+  aDst.Truncate();
+  for (i=0;i<size;i++) { // i : Source
+    aSrcUnichars[i];
+    if (aSrcUnichars[i] == 0x0000) 
+      break; // no need to convert char after the NULL
+    if (IS_FE_CHAR(aSrcUnichars[i])) {
+      //ahmed for lamalf
+      PRUnichar ch = (PresentationToOriginal(aSrcUnichars[i], 1));
+      if(ch)
+        aDst += ch;
+      ch=(PresentationToOriginal(aSrcUnichars[i], 0));
+      if(ch)
+        aDst += ch;
+      else //if it is 00, just output what we have in FExx
+        aDst += aSrcUnichars[i];
+    } else {
+      aDst += aSrcUnichars[i]; // copy it even if it is not in FE range
+    }
+  }// for : loop the buffer
+  return NS_OK;
+}
+
+nsresult Conv_FE_06_WithReverse(const nsString& aSrc, nsString& aDst)
+{
+  PRUnichar *aSrcUnichars = (PRUnichar *)aSrc.get();
+  PRBool foundArabic = PR_FALSE;
+  PRUint32 i,endArabic, beginArabic, size = aSrc.Length();
+  aDst.Truncate();
+  for (endArabic=0;endArabic<size;endArabic++) {
+    if (aSrcUnichars[endArabic] == 0x0000) 
+      break; // no need to convert char after the NULL
+
+    while( (IS_FE_CHAR(aSrcUnichars[endArabic]))||
+           (IS_ARABIC_CHAR(aSrcUnichars[endArabic]))||
+           (IS_ARABIC_DIGIT(aSrcUnichars[endArabic]))||
+           (aSrcUnichars[endArabic]==0x0020)) 
+    {
+      if(! foundArabic ) {
+        beginArabic=endArabic;
+        foundArabic= PR_TRUE;
+      }
+      endArabic++;
+    }
+    if(foundArabic) {
+      endArabic--;
+      for (i=endArabic; i>=beginArabic; i--) {
+        if(IS_FE_CHAR(aSrcUnichars[i])) {
+          //ahmed for the bug of lamalf
+          aDst += PresentationToOriginal(aSrcUnichars[i], 0);
+          if (PresentationToOriginal(aSrcUnichars[i], 1)) {
+            // Two characters, we have to resize the buffer :(
+             aDst += PresentationToOriginal(aSrcUnichars[i], 1);
+          } // if expands to 2 char
+        } else {
+          // do we need to check the following if ?
+          if((IS_ARABIC_CHAR(aSrcUnichars[i]))||
+             (IS_ARABIC_DIGIT(aSrcUnichars[i]))||
+             (aSrcUnichars[i]==0x0020))
+            aDst += aSrcUnichars[i];
+        }     
+      }
+    } else {
+      aDst += aSrcUnichars[endArabic]; 
+    }
+    foundArabic=PR_FALSE;
+  }// for : loop the buffer
+  return NS_OK;
+}
+
+nsresult Conv_06_FE_WithReverse(const nsString& aSrc,
+                                nsString& aDst,
+                                PRUint32 aDir)
+{
+  PRUnichar *aSrcUnichars = (PRUnichar *)aSrc.get();
+  PRUint32 i,beginArabic, endArabic, size = aSrc.Length();
+  aDst.Truncate();
+  PRBool foundArabic = PR_FALSE;
+  for (endArabic=0;endArabic<size;endArabic++) {
+    if (aSrcUnichars[endArabic] == 0x0000) 
+      break; // no need to convert char after the NULL
+
+    while( (IS_06_CHAR(aSrcUnichars[endArabic])) || 
+           (IS_ARABIC_CHAR(aSrcUnichars[endArabic])) || 
+           (aSrcUnichars[endArabic]==0x0020) || 
+           (IS_ARABIC_DIGIT(aSrcUnichars[endArabic]))  ) 
+    {
+      if(! foundArabic) {
+        beginArabic=endArabic;
+        foundArabic=PR_TRUE;
+      }
+      endArabic++;
+    }
+    if(foundArabic) {
+      endArabic--;
+      PRUnichar buf[8192];
+      PRUint32 len=8192;
+      //reverse the buffer for shaping
+
+      for(i=beginArabic; i<=endArabic; i++) {
+        buf[i-beginArabic]=aSrcUnichars[endArabic-i+beginArabic];
+      }
+      for(i=0; i<=endArabic-beginArabic; i++) {
+        aSrcUnichars[i+beginArabic]=buf[i];
+      }
+      ArabicShaping(&aSrcUnichars[beginArabic], endArabic-beginArabic+1, buf, &len);
+      // to reverse the numerals
+      PRUint32 endNumeral, beginNumeral;
+      for (endNumeral=0;endNumeral<=len-1;endNumeral++){
+        PRBool foundNumeral = PR_FALSE;
+        while((endNumeral < len) && (IS_ARABIC_DIGIT(buf[endNumeral]))  ) {
+          if(!foundNumeral)
+          {
+            foundNumeral=PR_TRUE;
+            beginNumeral=endNumeral;
+          }
+          endNumeral++;
+        }
+        if(foundNumeral){
+          endNumeral--;
+          PRUnichar numbuf[20];
+          for(i=beginNumeral; i<=endNumeral; i++){
+            numbuf[i-beginNumeral]=buf[endNumeral-i+beginNumeral];
+          }
+          for(i=0;i<=endNumeral-beginNumeral;i++){
+            buf[i+beginNumeral]=numbuf[i];
+          }
+        }
+      }
+      if(aDir==1){//ltr
+        for (i=0;i<=len-1;i++){
+          aDst+= buf[i];
+        } 
+      }
+      else if(aDir==2){//rtl
+        for (i=0;i<=len-1;i++){
+          aDst+= buf[len-1-i];
+        } 
+      }
+    } else {
+      aDst += aSrcUnichars[endArabic];
+    }
+    foundArabic=PR_FALSE;
+  }// for : loop the buffer
+  return NS_OK;
+}
+#endif //IBMBIDI
new file mode 100644
--- /dev/null
+++ b/intl/unicharutil/util/nsBidiUtils.h
@@ -0,0 +1,200 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * IBM Corporation.  Portions created by IBM are
+ * Copyright (C) 2000 IBM Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *   Maha Abou El Rous <mahar@eg.ibm.com>
+ *   Lina Kemmel <lkemmel@il.ibm.com>
+ *   Simon Montagu <smontagu@netscape.com>
+ *
+ */
+
+#ifndef nsBidiUtils_h__
+#define nsBidiUtils_h__
+
+#include "nsCOMPtr.h"
+#include "nsString.h"
+
+  /**
+   * Perform Arabic shaping on a Unichar string
+   * @param aString is the input string
+   * @param aLen is the length of aStrong
+   * @param aBuf receives the shaped output
+   * @param aBuflen receives the length of aBuf
+   */
+  nsresult ArabicShaping(const PRUnichar* aString, PRUint32 aLen,
+                         PRUnichar* aBuf, PRUint32* aBufLen);
+
+  /**
+   * Scan an nsString, converting characters in the FExx range (Arabic presentation forms) to the equivalent characters in the 06xx
+   * range
+   * @param aSrc is the input string
+   * @param aDst is the output string
+   */
+  nsresult Conv_FE_06(const nsString& aSrc, nsString& aDst);
+
+  /**
+   * Scan an nsString, converting characters in the FExx range (Arabic presentation forms) to the equivalent characters in the 06xx
+   * range, and also reverse the string
+   * @param aSrc is the input string
+   * @param aDst is the output string
+   */
+  nsresult Conv_FE_06_WithReverse(const nsString& aSrc, nsString& aDst);
+
+  /**
+   * Scan an nsString, converting characters in the 06xx range to the equivalent characters in the 0Fxx range (Arabic presentation
+   * forms), with the option to reverse the string
+   * @param aSrc is the input string
+   * @param aDst is the output string
+   * @param aDir indicates whether the string should be reversed
+   *        IBMBIDI_TEXTDIRECTION_LTR: do not reverse the string
+   *        IBMBIDI_TEXTDIRECTION_RTL: reverse the string
+   */
+  nsresult Conv_06_FE_WithReverse(const nsString& aSrc, nsString& aDst, PRUint32 aDir);
+
+// --------------------------------------------------
+// IBMBIDI 
+// --------------------------------------------------
+//
+// These values are shared with Preferences dialog
+//  ------------------
+//  If Pref values are to be changed
+//  in the XUL file of Prefs. the values
+//  Must be changed here too..
+//  ------------------
+//
+#define IBMBIDI_TEXTDIRECTION_STR       "bidi.direction"
+#define IBMBIDI_TEXTTYPE_STR            "bidi.texttype"
+#define IBMBIDI_CONTROLSTEXTMODE_STR    "bidi.controlstextmode"
+#define IBMBIDI_CLIPBOARDTEXTMODE_STR   "bidi.clipboardtextmode"
+#define IBMBIDI_NUMERAL_STR             "bidi.numeral"
+#define IBMBIDI_SUPPORTMODE_STR         "bidi.support"
+#define IBMBIDI_CHARSET_STR             "bidi.characterset"
+
+#define IBMBIDI_TEXTDIRECTION       1
+#define IBMBIDI_TEXTTYPE            2
+#define IBMBIDI_CONTROLSTEXTMODE    3
+#define IBMBIDI_CLIPBOARDTEXTMODE   4
+#define IBMBIDI_NUMERAL             5
+#define IBMBIDI_SUPPORTMODE         6
+#define IBMBIDI_CHARSET             7
+
+//  ------------------
+//  Text Direction
+//  ------------------
+//  bidi.direction
+#define IBMBIDI_TEXTDIRECTION_LTR     1 //  1 = directionLTRBidi *
+#define IBMBIDI_TEXTDIRECTION_RTL     2 //  2 = directionRTLBidi
+//  ------------------
+//  Text Type
+//  ------------------
+//  bidi.texttype
+#define IBMBIDI_TEXTTYPE_CHARSET      1 //  1 = charsettexttypeBidi *
+#define IBMBIDI_TEXTTYPE_LOGICAL      2 //  2 = logicaltexttypeBidi
+#define IBMBIDI_TEXTTYPE_VISUAL       3 //  3 = visualtexttypeBidi
+//  ------------------
+//  Controls Text Mode
+//  ------------------
+//  bidi.controlstextmode
+#define IBMBIDI_CONTROLSTEXTMODE_LOGICAL   1 //  1 = logicalcontrolstextmodeBidiCmd *
+#define IBMBIDI_CONTROLSTEXTMODE_VISUAL    2 //  2 = visualcontrolstextmodeBidi
+#define IBMBIDI_CONTROLSTEXTMODE_CONTAINER 3 //  3 = containercontrolstextmodeBidi
+//  ------------------
+//  Clipboard Text Mode
+//  ------------------
+//  bidi.clipboardtextmode
+#define IBMBIDI_CLIPBOARDTEXTMODE_LOGICAL 1 //  1 = logicalclipboardtextmodeBidi
+#define IBMBIDI_CLIPBOARDTEXTMODE_VISUAL  2 //  2 = visualclipboardtextmodeBidi
+#define IBMBIDI_CLIPBOARDTEXTMODE_SOURCE  3 //  3 = sourceclipboardtextmodeBidi *
+//  ------------------
+//  Numeral Style
+//  ------------------
+//  bidi.numeral
+#define IBMBIDI_NUMERAL_REGULAR       1 //  1 = regularcontextnumeralBidi *
+#define IBMBIDI_NUMERAL_HINDICONTEXT  2 //  2 = hindicontextnumeralBidi
+#define IBMBIDI_NUMERAL_ARABIC        3 //  3 = arabicnumeralBidi
+#define IBMBIDI_NUMERAL_HINDI         4 //  4 = hindinumeralBidi
+//  ------------------
+//  Support Mode
+//  ------------------
+//  bidi.support
+#define IBMBIDI_SUPPORTMODE_MOZILLA     1 //  1 = mozillaBidisupport *
+#define IBMBIDI_SUPPORTMODE_OSBIDI      2 //  2 = OsBidisupport
+#define IBMBIDI_SUPPORTMODE_DISABLE     3 //  3 = disableBidisupport
+//  ------------------
+//  Charset Mode
+//  ------------------
+//  bidi.characterset
+#define IBMBIDI_CHARSET_BIDI        1 //  1 = doccharactersetBidi *
+#define IBMBIDI_CHARSET_DEFAULT     2 //  2 = defaultcharactersetBidi
+
+#define IBMBIDI_DEFAULT_BIDI_OPTIONS              \
+        ((IBMBIDI_TEXTDIRECTION_LTR<<0)         | \
+         (IBMBIDI_TEXTTYPE_CHARSET<<4)          | \
+         (IBMBIDI_CONTROLSTEXTMODE_LOGICAL<<8)  | \
+         (IBMBIDI_CLIPBOARDTEXTMODE_SOURCE<<12) | \
+         (IBMBIDI_NUMERAL_REGULAR<<16)          | \
+         (IBMBIDI_SUPPORTMODE_MOZILLA<<20)      | \
+         (IBMBIDI_CHARSET_BIDI<<24))
+
+
+#define GET_BIDI_OPTION_DIRECTION(bo) (((bo)>>0) & 0x0000000F) /* 4 bits for DIRECTION */
+#define GET_BIDI_OPTION_TEXTTYPE(bo) (((bo)>>4) & 0x0000000F) /* 4 bits for TEXTTYPE */
+#define GET_BIDI_OPTION_CONTROLSTEXTMODE(bo) (((bo)>>8) & 0x0000000F) /* 4 bits for CONTROLTEXTMODE */
+#define GET_BIDI_OPTION_CLIPBOARDTEXTMODE(bo) (((bo)>>12) & 0x0000000F) /* 4 bits for CLIPBOARDTEXTMODE */
+#define GET_BIDI_OPTION_NUMERAL(bo) (((bo)>>16) & 0x0000000F) /* 4 bits for NUMERAL */
+#define GET_BIDI_OPTION_SUPPORT(bo) (((bo)>>20) & 0x0000000F) /* 4 bits for SUPPORT */
+#define GET_BIDI_OPTION_CHARACTERSET(bo) (((bo)>>24) & 0x0000000F) /* 4 bits for CHARACTERSET */
+
+#define SET_BIDI_OPTION_DIRECTION(bo, dir) {(bo)=((bo) & 0xFFFFFFF0)|(((dir)& 0x0000000F)<<0);}
+#define SET_BIDI_OPTION_TEXTTYPE(bo, tt) {(bo)=((bo) & 0xFFFFFF0F)|(((tt)& 0x0000000F)<<4);}
+#define SET_BIDI_OPTION_CONTROLSTEXTMODE(bo, cotm) {(bo)=((bo) & 0xFFFFF0FF)|(((cotm)& 0x0000000F)<<8);}
+#define SET_BIDI_OPTION_CLIPBOARDTEXTMODE(bo, cltm) {(bo)=((bo) & 0xFFFF0FFF)|(((cltm)& 0x0000000F)<<12);}
+#define SET_BIDI_OPTION_NUMERAL(bo, num) {(bo)=((bo) & 0xFFF0FFFF)|(((num)& 0x0000000F)<<16);}
+#define SET_BIDI_OPTION_SUPPORT(bo, sup) {(bo)=((bo) & 0xFF0FFFFF)|(((sup)& 0x0000000F)<<20);}
+#define SET_BIDI_OPTION_CHARACTERSET(bo, cs) {(bo)=((bo) & 0xF0FFFFFF)|(((cs)& 0x0000000F)<<24);}
+
+/* Constants related to the position of numerics in the codepage */
+#define START_HINDI_DIGITS              0x0660
+#define END_HINDI_DIGITS                0x0669
+#define START_ARABIC_DIGITS             0x0030
+#define END_ARABIC_DIGITS               0x0039
+#define START_FARSI_DIGITS              0x06f0
+#define END_FARSI_DIGITS                0x06f9
+#define IS_HINDI_DIGIT(u)   ( ( (u) >= START_HINDI_DIGITS )  && ( (u) <= END_HINDI_DIGITS ) )
+#define IS_ARABIC_DIGIT(u)  ( ( (u) >= START_ARABIC_DIGITS ) && ( (u) <= END_ARABIC_DIGITS ) )
+#define IS_FARSI_DIGIT(u)  ( ( (u) >= START_FARSI_DIGITS ) && ( (u) <= END_FARSI_DIGITS ) )
+
+#define IS_BIDI_DIACRITIC(u) ( \
+  ( (u) >= 0x0591 && (u) <= 0x05A1) || ( (u) >= 0x05A3 && (u) <= 0x05B9) \
+    || ( (u) >= 0x05BB && (u) <= 0x05BD) || ( (u) == 0x05BF) || ( (u) == 0x05C1) \
+    || ( (u) == 0x05C2) || ( (u) == 0x05C4) \
+    || ( (u) >= 0x064B && (u) <= 0x0652) || ( (u) == 0x0670) \
+    || ( (u) >= 0x06D7 && (u) <= 0x06E4) || ( (u) == 0x06E7) || ( (u) == 0x06E8) \
+    || ( (u) >= 0x06EA && (u) <= 0x06ED) )
+
+#define IS_HEBREW_CHAR(c) (((0x0590 <= (c)) && ((c)<= 0x05FF)) || (((c) >= 0xfb1d) && ((c) <= 0xfb4f)))
+#define IS_06_CHAR(c) ((0x0600 <= (c)) && ((c)<= 0x06FF))
+#define IS_FE_CHAR(c) (((0xfb50 <= (c)) && ((c)<= 0xfbFF)) \
+                       || ((0xfe70 <= (c)) && ((c)<= 0xfeFC)))
+#define IS_ARABIC_CHAR(c) ((0x0600 <= (c)) && ((c)<= 0x06FF))
+#define IS_ARABIC_ALPHABETIC(c) (IS_ARABIC_CHAR(c) && !(IS_HINDI_DIGIT(c) || IS_FARSI_DIGIT(c)))
+
+#define CHAR_IS_BIDI(c) ( (IS_HINDI_DIGIT(c) ) || (IS_HEBREW_CHAR(c) ) \
+                        || (IS_06_CHAR(c) ) || (IS_FE_CHAR(c) ) )
+#endif  /* nsBidiUtils_h__ */
new file mode 100644
--- /dev/null
+++ b/intl/unicharutil/util/symmtable.h
@@ -0,0 +1,151 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is IBM code.
+ * 
+ * The Initial Developer of the Original Code is IBM.
+ * Portions created by IBM are
+ * Copyright (C) International Business Machines
+ * Corporation, 2000.  All Rights Reserved.
+ */
+/* 
+    DO NOT EDIT THIS DOCUMENT !!! THIS DOCUMENT IS GENERATED BY
+    mozilla/intl/unicharutil/tools/gensymmtable.pl
+ */
+
+/* Block U00__ */
+const static PRUint8 symmtable_00[256] = {
+/*         _0    _1    _2    _3    _4    _5    _6    _7    _8    _9    _A    _B    _C    _D    _E    _F */
+/* 0_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 1_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 2_ */    0,    0,    0,    0,    0,    0,    0,    0,  0x1,  0x1,    0,    0,    0,    0,    0,    0, 
+/* 3_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,  0x2,    0,  0x2,    0, 
+/* 4_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 5_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,  0x6,    0,  0x6,    0,    0, 
+/* 6_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 7_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,  0x6,    0,  0x6,    0,    0, 
+/* 8_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 9_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* A_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 0x10,    0,    0,    0,    0, 
+/* B_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 0x10,    0,    0,    0,    0, 
+/* C_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* D_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* E_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* F_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+};
+
+/* Block U20__ */
+const static PRUint8 symmtable_20[256] = {
+/*         _0    _1    _2    _3    _4    _5    _6    _7    _8    _9    _A    _B    _C    _D    _E    _F */
+/* 0_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 1_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 2_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 3_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,  0x3,  0x3,    0,    0,    0,    0,    0, 
+/* 4_ */    0,    0,    0,    0,    0,  0x3,  0x3,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 5_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 6_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 7_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,  0x3,  0x3,    0, 
+/* 8_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,  0x3,  0x3,    0, 
+/* 9_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* A_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* B_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* C_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* D_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* E_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* F_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+};
+
+/* Block U22__ */
+const static PRUint8 symmtable_22[256] = {
+/*         _0    _1    _2    _3    _4    _5    _6    _7    _8    _9    _A    _B    _C    _D    _E    _F */
+/* 0_ */    0,    0,    0,    0,    0,    0,    0,    0,  0x3,  0x5,  0x7,  0x3,  0x5,  0x7,    0,    0, 
+/* 1_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 2_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 3_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,  0x1,  0x1,    0,    0, 
+/* 4_ */    0,    0,    0, 0x8e,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 5_ */    0,    0,  0x1,  0x1,  0x1,  0x1,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 6_ */    0,    0,    0,    0,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,    0,    0,  0x1,  0x1, 
+/* 7_ */  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1, 
+/* 8_ */  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,    0,    0,    0, 0x1f, 
+/* 9_ */ 0x1f,  0x3,  0x3,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* A_ */    0,    0,  0x1,  0x1,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* B_ */  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* C_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,  0x3,  0x3,  0x7,  0x7, 0x8e,    0,    0, 
+/* D_ */  0x1,  0x1,    0,    0,    0,    0,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1, 
+/* E_ */  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,    0,    0, 
+/* F_ */  0x1,  0x1,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+};
+
+/* Block U23__ */
+const static PRUint8 symmtable_23[256] = {
+/*         _0    _1    _2    _3    _4    _5    _6    _7    _8    _9    _A    _B    _C    _D    _E    _F */
+/* 0_ */    0,    0,    0,    0,    0,    0,    0,    0,  0x1,  0x1,  0x1,  0x1,    0,    0,    0,    0, 
+/* 1_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 2_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,  0x3,  0x3,    0,    0,    0,    0,    0, 
+/* 3_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 4_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 5_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 6_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 7_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 8_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 9_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* A_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* B_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* C_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* D_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* E_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* F_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+};
+
+/* Block U30__ */
+const static PRUint8 symmtable_30[256] = {
+/*         _0    _1    _2    _3    _4    _5    _6    _7    _8    _9    _A    _B    _C    _D    _E    _F */
+/* 0_ */    0,    0,    0,    0,    0,    0,    0,    0,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1, 
+/* 1_ */  0x1,  0x1,    0,    0,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,    0,    0,    0,    0, 
+/* 2_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 3_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 4_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 5_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 6_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 7_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 8_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* 9_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* A_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* B_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* C_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* D_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* E_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+/* F_ */    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0, 
+};
+
+static PRUnichar Mirrored(PRUnichar u)
+{
+  switch (u & 0xFF00) {
+    // XOR the character with the bitmap in the conversion table to give the symmetric equivalent
+    case 0:
+      u ^= symmtable_00[u & 0xff];
+      break;
+    case 0x2000:
+      u ^= symmtable_20[u & 0xff];
+      break;
+    case 0x2200:
+      u ^= symmtable_22[u & 0xff];
+      break;
+    case 0x2300:
+      u ^= symmtable_23[u & 0xff];
+      break;
+    case 0x3000:
+      u ^= symmtable_30[u & 0xff];
+      break;
+  }
+  return u;
+}