uniname2ctype_p (str, len)
     register const char *str;
     register unsigned int len;
{
  static const struct uniname2ctype_struct wordlist[] =
    {
#ifdef USE_UNICODE_PROPERTIES
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3,                                        33},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str5,                                        23},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str7,                                       35},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str8,                                       24},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str10,                                       20},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str11,                                       36},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str12,                                       26},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str13,                                        17},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str16,                                       21},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str20,                                       18},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str21,                                      93},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str22,                                     93},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str23,                                    150},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str26,                                       59},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str29,                                    127},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str30,                                     142},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str31,                                    142},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str32,                                    113},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str34,                                  18},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str37,                                    147},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str40,                                  147},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str42,                                       51},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str44,                                    86},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str46,                                     74},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str47,                                     3},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str48,                                    74},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str51,                                     108},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str53,                                   79},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str54,                                    110},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str55,                                    115},
      {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str60,                                    108},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str63,                                 115},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str66,                                       27},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str67,                                       49},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str69,                                    105},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str70,                                   184},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str71,                                       46},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str73,                                        50},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str74,                                  178},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str75,                                    151},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str76,                                    100},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str84,                                    157},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str88,                                    113},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str89,                                     81},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str90,                                     92},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str91,                       197},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str92,                                  91},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str93,                                   170},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str94,                                    14},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str95,                       42},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str98,                                    17},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str99,                             170},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str100,                                   81},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str101,                                    152},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str103,                                  182},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str105,                              36},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str106,                              26},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str109,                                     91},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str112,                                    119},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str114,                     38},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str115,                                        45},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str116,                                       69},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str117,                                      197},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str119,                                    195},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str120,                                      66},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str121,                                     190},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str122,                                       22},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str123,                                 152},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str124,                                     180},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str125,                                     99},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str126,                   161},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str128,                                 122},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str137,                                 188},
      {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str143,                                     193},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str147,                               180},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str148,                                    200},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str149,                                     98},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str151,                      100},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str152,                                       53},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str153,                              49},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str156,                               110},
      {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str161,                    162},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str162,                                 151},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str163,                            51},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str166,                            194},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str170,                                    194},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str171,                           177},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str172,                               113},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str174,                          182},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str175,                     174},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str176,                                     82},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str179,                         178},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str180,                                    179},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str181,                   184},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str183,                         195},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str187,                                   119},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str190,                              132},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str192,                               82},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str193,                                   23},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str195,                                       34},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str197,                                    187},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str198,                                    112},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str200,                          27},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str202,                                       43},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str203,                                    171},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str206,                                       38},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str209,                             35},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str212,                                       42},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str215,                                157},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str217,                                       32},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str218,                                  65},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str220,                               66},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str222,                                      65},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str223,                                     1},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str227,                                       30},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str229,                                  127},
      {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str234,                               104},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str235,                                   73},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str236,                                     77},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str237,                                    127},
      {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str243,                                    124},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str244,                                    159},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str245,                                    162},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str246,                                    161},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str250,                                 77},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str251,                                      192},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str252,                                 167},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str255,                              136},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str258,                                     87},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str261,                                    87},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str268,                                    58},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str269,                                    149},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str270,                       186},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str271,                                    140},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str275,          190},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str278,                                     7},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str286,                                    123},
      {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str292,                                    154},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str294,                                     54},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str296,                                    120},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str297,                         40},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str301,                         43},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str303,                                    134},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str306,                                   175},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str307,                               154},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str308,                                       44},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str310,                                     79},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str311,                                    125},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str314,                                 150},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str317,                                 120},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str321,                                  140},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str322,                                    167},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str324,                                    158},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str325,                                    174},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str326,                              129},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str327,                               21},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str328,                                       40},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str335,                                 112},
      {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str340,                                    166},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str341,                                    102},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str343,                               175},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str344,                                   102},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str345,                                     97},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str346,                                 98},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str349,                                       31},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str350,                                   198},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str353,                                50},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str355,                                     94},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str356,                                  111},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str358,                                117},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str359,                                    160},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str361,                                    128},
      {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str367,                                  94},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str371,                                    111},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str372,                                    145},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str373,                                   97},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str374,                                  83},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str375,                                105},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str376,                                 125},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str379,                                     96},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str380,                                 201},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str381,                                 203},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str382,                                 210},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str383,                                 211},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str384,                                 208},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str385,                                        37},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str386,                                       39},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str388,                                    155},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str389,                                 202},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str390,                                 209},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str391,                                 212},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str392,                                 207},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str393,                                     5},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str395,                                    143},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str396,                                     9},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str397,                                 205},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str398,                                 206},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str399,                                     78},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str402,                                   169},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str405,                                 204},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str408,                             169},
      {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str413,                   193},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str420,                                     88},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str422,                                       52},
      {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str427,                                        29},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str430,                                       25},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str432,                      187},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str433,                                134},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str434,                                   189},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str436,                           53},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str438,                                    70},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str442,                                    13},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str443,                               163},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str445,                                     68},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str446,                                    186},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str447,                                    177},
      {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str452,                                   19},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str456,                            59},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str457,                                130},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str459,                               139},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str462,                                     181},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str464,                              143},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str465,                       198},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str466,                                     4},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str474,                                    139},
      {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str480,                            34},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str484,                                    107},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str485,                                       48},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str488,                          183},
      {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str493,                             179},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str496,                                     67},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str497,                               20},
      {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str502,                                 137},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str506,                               55},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str508,                                    118},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str512,                                   11},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str513,                                 67},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str516,                                    104},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str518,                              68},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str521,                                 16},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str523,                                    101},
      {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str529,                                     138},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str530,                                    138},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str533,                                    141},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str534,                              191},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str535,                                  166},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str536,                                    137},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str538,                                    106},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str540,                                    144},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str542,                    60},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str543,                                181},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str550,                                     191},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str554,                                 141},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str562,                                      60},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str563,                             71},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str565,                                    136},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str573,                                    163},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str576,                                     8},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str577,                                    133},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str580,                                     6},
      {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str586,                                   196},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str587,                                      109},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str588,                                    146},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str589,                                     76},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str591,                                  146},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str592,                         41},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str593,                                     86},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str594,                           70},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str596,                                  164},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str597,                                    132},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str598,                                    109},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str599,                                    164},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str601,                                 76},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str602,                                    129},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str605,                                  183},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str617,                                    117},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str620,                                      62},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str623,                                   33},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str625,                                    114},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str626,                                     89},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str627,                          24},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str628,                    62},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str629,                              192},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str632,                                    121},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str634,                                    131},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str636,                                       28},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str640,                                 114},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str643,                              133},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str644,                                     80},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str645,                                  89},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str646,                                     83},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str647,                                56},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str656,                                    122},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str659,                           199},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str660,                                   80},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str663,                                     12},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str667,                         159},
      {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str672,                                121},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str675,                            31},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str677,                                 96},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str678,                                    148},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str681,                                  148},
      {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str686,                             131},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str687,                                     85},
      {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str692,                                    130},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str696,                           46},
      {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str701,                                   0},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str705,                                107},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str706,                                  185},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str707,                                 99},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str708,                                 85},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str710,                               128},
      {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str716,                          39},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str718,                         160},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str725,                                    10},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str732,                                       19},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str734,                                    116},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str735,                                  145},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str736,                     185},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str739,                           25},
      {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str745,                           32},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str749,                    64},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str752,                                     29},
      {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str757,                                22},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str765,                       52},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str767,                                   101},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str768,                                     176},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str772,                          28},
      {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str777,                                176},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str778,                                     64},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str781,                                   71},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str782,                                    103},
      {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str788,                        189},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str792,                                57},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str793,                                   103},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str795,                              30},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str797,                              168},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str806,                                  199},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str816,                                 124},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str818,                          44},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str821,                                    156},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str831,                                   116},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str840,                                    165},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str851,                                   45},
      {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str856,                    61},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str857,                                 123},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str861,                                   118},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str868,                              37},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str872,                                  172},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str888,                               48},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str892,                                     75},
      {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str898,                    63},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str902,                           173},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str903,                                    126},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str916,                               135},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str918,                                       41},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str927,                                     63},
      {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str932,                                   156},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str940,                                     84},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str944,                                  168},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str951,                             158},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str976,                69},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str980,                           47},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str999,                                     90},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1007,                                     95},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1020,                                90},
      {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1026,                                  95},
      {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1032,                                   88},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1033,                                126},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1037,                                    135},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1093,                                       47},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1097,                                106},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1124,                                    153},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1146,                                      15},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1148,                                 144},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1190,                                      61},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1263,                                   173},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1329,                                     2},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1347,                                   72},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1358,                                   165},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1395,                                 200},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1410,                                    75},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
#endif /* USE_UNICODE_PROPERTIES */
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
#ifndef USE_UNICODE_PROPERTIES
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str7,                                     7},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str8,                                     8},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str9,                                     1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str10,                                    13},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str11,                                   11},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str12,                                   0},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str13,                                    10},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str14,                                    14},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str15,                                     3},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str16,                                     9},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str17,                                     12},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str18,                                     6},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str19,                                     5},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str20,                                     4},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str21,                                     2}
#else /* USE_UNICODE_PROPERTIES */
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1463,                             72},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1470,                                 84},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1556,                                   78},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1621,                     153},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
      {-1}, {-1},
      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1741,                                     73}
#endif /* USE_UNICODE_PROPERTIES */
    };

  if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
    {
      register int key = uniname2ctype_hash (str, len);

      if (key <= MAX_HASH_VALUE && key >= 0)
        {
          register int o = wordlist[key].name;
          if (o >= 0)
            {
              register const char *s = o + uniname2ctype_pool;

              if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
                return &wordlist[key];
            }
        }
    }
  return 0;
}

merge Ruby 1.9.2


onig_memsize(const regex_t *reg)
{
    size_t size = sizeof(regex_t);
    if (IS_NOT_NULL(reg->p))                size += reg->alloc;
    if (IS_NOT_NULL(reg->exact))            size += reg->exact_end - reg->exact;
    if (IS_NOT_NULL(reg->int_map))          size += sizeof(int) * ONIG_CHAR_TABLE_SIZE;
    if (IS_NOT_NULL(reg->int_map_backward)) size += sizeof(int) * ONIG_CHAR_TABLE_SIZE;
    if (IS_NOT_NULL(reg->repeat_range))     size += reg->repeat_range_alloc * sizeof(OnigRepeatRange);
    if (IS_NOT_NULL(reg->chain))            size += onig_memsize(reg->chain);

    return size;
}

merge Ruby 1.9.2


uniname2ctype(const UChar *name, unsigned int len)
{
  const struct uniname2ctype_struct *p = uniname2ctype_p((const char *)name, len);
  if (p) return p->ctype;
  return -1;
}

merge Ruby 1.9.2


onig_bbuf_init(BBuf* buf, OnigDistance size)
{
  if (size <= 0) {
    size   = 0;
    buf->p = NULL;
  }
  else {
    buf->p = (UChar* )xmalloc(size);
    if (IS_NULL(buf->p)) return(ONIGERR_MEMORY);
  }

  buf->alloc = (unsigned int)size;
  buf->used  = 0;
  return 0;
}

merge Ruby 1.9.2


big5_is_allowed_reverse_match(const UChar* s, const UChar* end ARG_UNUSED, OnigEncoding enc ARG_UNUSED)
{
  const UChar c = *s;

  return (BIG5_ISMB_TRAIL(c) ? FALSE : TRUE);
}

merge Ruby 1.9.2


gb18030_is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc)
{
  return onigenc_mb4_is_code_ctype(enc, code, ctype);
}

merge Ruby 1.9.2


onig_error_code_to_str(s, code, va_alist)
  UChar* s;
  int code;
  va_dcl
#endif
{
  UChar *p, *q;
  OnigErrorInfo* einfo;
  size_t len;
  int is_over;
  UChar parbuf[MAX_ERROR_PAR_LEN];
  va_list vargs;

  va_init_list(vargs, code);

  switch (code) {
  case ONIGERR_UNDEFINED_NAME_REFERENCE:
  case ONIGERR_UNDEFINED_GROUP_REFERENCE:
  case ONIGERR_MULTIPLEX_DEFINED_NAME:
  case ONIGERR_MULTIPLEX_DEFINITION_NAME_CALL:
  case ONIGERR_INVALID_GROUP_NAME:
  case ONIGERR_INVALID_CHAR_IN_GROUP_NAME:
  case ONIGERR_INVALID_CHAR_PROPERTY_NAME:
    einfo = va_arg(vargs, OnigErrorInfo*);
    len = to_ascii(einfo->enc, einfo->par, einfo->par_end,
		   parbuf, MAX_ERROR_PAR_LEN - 3, &is_over);
    q = onig_error_code_to_format(code);
    p = s;
    while (*q != '\0') {
      if (*q == '%') {
	q++;
	if (*q == 'n') { /* '%n': name */
	  xmemcpy(p, parbuf, len);
	  p += len;
	  if (is_over != 0) {
	    xmemcpy(p, "...", 3);
	    p += 3;
	  }
	  q++;
	}
	else
	  goto normal_char;
      }
      else {
      normal_char:
	*p++ = *q++;
      }
    }
    *p = '\0';
    len = p - s;
    break;

  default:
    q = onig_error_code_to_format(code);
    len = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, q);
    xmemcpy(s, q, len);
    s[len] = '\0';
    break;
  }

  va_end(vargs);
  return (int)len;
}

merge Ruby 1.9.2


update_string_node_case_fold(regex_t* reg, Node *node)
{
  UChar *p, *q, *end, buf[ONIGENC_MBC_CASE_FOLD_MAXLEN];
  UChar *sbuf, *ebuf, *sp;
  int r, i, len;
  OnigDistance sbuf_size;
  StrNode* sn = NSTR(node);

  end = sn->end;
  sbuf_size = (end - sn->s) * 2;
  sbuf = (UChar* )xmalloc(sbuf_size);
  CHECK_NULL_RETURN_MEMERR(sbuf);
  ebuf = sbuf + sbuf_size;

  sp = sbuf;
  p = sn->s;
  while (p < end) {
    len = ONIGENC_MBC_CASE_FOLD(reg->enc, reg->case_fold_flag, &p, end, buf);
    q = buf;
    for (i = 0; i < len; i++) {
      if (sp >= ebuf) {
	sbuf = (UChar* )xrealloc(sbuf, sbuf_size * 2);
	CHECK_NULL_RETURN_MEMERR(sbuf);
	sp = sbuf + sbuf_size;
	sbuf_size *= 2;
	ebuf = sbuf + sbuf_size;
      }

      *sp++ = buf[i];
    }
  }

  r = onig_node_str_set(node, sbuf, sp);
  if (r != 0) {
    xfree(sbuf);
    return r;
  }

  xfree(sbuf);
  return 0;
}

merge Ruby 1.9.2


st_insert(register st_table *table, register st_data_t key, st_data_t value)
{
    st_index_t hash_val, bin_pos;
    register st_table_entry *ptr;

    if (table->entries_packed) {
        st_index_t i;
        for (i = 0; i < table->num_entries; i++) {
            if ((st_data_t)table->bins[i*2] == key) {
                table->bins[i*2+1] = (struct st_table_entry*)value;
                return 1;
            }
        }
        if (MORE_PACKABLE_P(table)) {
            i = table->num_entries++;
            table->bins[i*2] = (struct st_table_entry*)key;
            table->bins[i*2+1] = (struct st_table_entry*)value;
            return 0;
        }
        else {
            unpack_entries(table);
        }
    }

    hash_val = do_hash(key, table);
    FIND_ENTRY(table, ptr, hash_val, bin_pos);

    if (ptr == 0) {
	ADD_DIRECT(table, key, value, hash_val, bin_pos);
	return 0;
    }
    else {
	ptr->record = value;
	return 1;
    }
}

merge Ruby 1.9.2


euckr_mbc_to_code(const UChar* p, const UChar* end, OnigEncoding enc)
{
  return onigenc_mbn_mbc_to_code(enc, p, end);
}

merge Ruby 1.9.2


mbc_to_code(const UChar* p, const UChar* end, OnigEncoding enc)
{
  int c, i, len;
  OnigCodePoint n;

  len = enclen(enc, p, end);
  c = *p++;
  n = c;
  if (len == 1) return n;

  for (i = 1; i < len; i++) {
    if (p >= end) break;
    c = *p++;
    n <<= 8;  n += c;
  }
  return n;
}

merge Ruby 1.9.2


property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
{
  hash_data_type ctype;
  UChar *s, *e;

  PROPERTY_LIST_INIT_CHECK;

  s = e = ALLOCA_N(UChar, end-p+1);
  for (; p < end; p++) {
    *e++ = ONIGENC_ASCII_CODE_TO_LOWER_CASE(*p);
  }

  if (onig_st_lookup_strend(PropertyNameTable, s, e, &ctype) == 0) {
    return onigenc_minimum_property_name_to_ctype(enc, s, e);
  }

  return (int)ctype;
}

merge Ruby 1.9.2


set_bm_skip(UChar* s, UChar* end, OnigEncoding enc ARG_UNUSED,
	    UChar skip[], int** int_skip)
{
  OnigDistance i, len;

  len = end - s;
  if (len < ONIG_CHAR_TABLE_SIZE) {
    for (i = 0; i < ONIG_CHAR_TABLE_SIZE; i++) skip[i] = len;

    for (i = 0; i < len - 1; i++)
      skip[s[i]] = len - 1 - i;
  }
  else {
    if (IS_NULL(*int_skip)) {
      *int_skip = (int* )xmalloc(sizeof(int) * ONIG_CHAR_TABLE_SIZE);
      if (IS_NULL(*int_skip)) return ONIGERR_MEMORY;
    }
    for (i = 0; i < ONIG_CHAR_TABLE_SIZE; i++) (*int_skip)[i] = (int)len;

    for (i = 0; i < len - 1; i++)
      (*int_skip)[s[i]] = (int)(len - 1 - i);
  }
  return 0;
}

merge Ruby 1.9.2


koi8_u_is_code_ctype(OnigCodePoint code, unsigned int ctype,
		     OnigEncoding enc ARG_UNUSED)
{
  if (code < 256)
    return ENC_IS_KOI8_U_CTYPE(code, ctype);
  else
    return FALSE;
}

merge Ruby 1.9.2


is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc ARG_UNUSED)
{
  if (code < 256)
    return ENC_IS_ISO_8859_11_CTYPE(code, ctype);
  else
    return FALSE;
}

merge Ruby 1.9.2


st_numcmp(st_data_t x, st_data_t y)
{
    return x != y;
}

merge Ruby 1.9.2


cp949_mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end,
                    UChar* lower, OnigEncoding enc)
{
  return onigenc_mbn_mbc_case_fold(enc, flag,
                                   pp, end, lower);
}

merge Ruby 1.9.2


onigenc_always_true_is_allowed_reverse_match(const UChar* s ARG_UNUSED, const UChar* end ARG_UNUSED,
					     OnigEncoding enc ARG_UNUSED)
{
  return TRUE;
}

merge Ruby 1.9.2


onig_error_code_to_format(int code)
{
  const char *p;

  if (code >= 0) return (UChar* )0;

  switch (code) {
  case ONIG_MISMATCH:
    p = "mismatch"; break;
  case ONIG_NO_SUPPORT_CONFIG:
    p = "no support in this configuration"; break;
  case ONIGERR_MEMORY:
    p = "failed to allocate memory"; break;
  case ONIGERR_MATCH_STACK_LIMIT_OVER:
    p = "match-stack limit over"; break;
  case ONIGERR_TYPE_BUG:
    p = "undefined type (bug)"; break;
  case ONIGERR_PARSER_BUG:
    p = "internal parser error (bug)"; break;
  case ONIGERR_STACK_BUG:
    p = "stack error (bug)"; break;
  case ONIGERR_UNDEFINED_BYTECODE:
    p = "undefined bytecode (bug)"; break;
  case ONIGERR_UNEXPECTED_BYTECODE:
    p = "unexpected bytecode (bug)"; break;
  case ONIGERR_DEFAULT_ENCODING_IS_NOT_SETTED:
    p = "default multibyte-encoding is not setted"; break;
  case ONIGERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR:
    p = "can't convert to wide-char on specified multibyte-encoding"; break;
  case ONIGERR_INVALID_ARGUMENT:
    p = "invalid argument"; break;
  case ONIGERR_END_PATTERN_AT_LEFT_BRACE:
    p = "end pattern at left brace"; break;
  case ONIGERR_END_PATTERN_AT_LEFT_BRACKET:
    p = "end pattern at left bracket"; break;
  case ONIGERR_EMPTY_CHAR_CLASS:
    p = "empty char-class"; break;
  case ONIGERR_PREMATURE_END_OF_CHAR_CLASS:
    p = "premature end of char-class"; break;
  case ONIGERR_END_PATTERN_AT_ESCAPE:
    p = "end pattern at escape"; break;
  case ONIGERR_END_PATTERN_AT_META:
    p = "end pattern at meta"; break;
  case ONIGERR_END_PATTERN_AT_CONTROL:
    p = "end pattern at control"; break;
  case ONIGERR_META_CODE_SYNTAX:
    p = "invalid meta-code syntax"; break;
  case ONIGERR_CONTROL_CODE_SYNTAX:
    p = "invalid control-code syntax"; break;
  case ONIGERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE:
    p = "char-class value at end of range"; break;
  case ONIGERR_CHAR_CLASS_VALUE_AT_START_OF_RANGE:
    p = "char-class value at start of range"; break;
  case ONIGERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS:
    p = "unmatched range specifier in char-class"; break;
  case ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED:
    p = "target of repeat operator is not specified"; break;
  case ONIGERR_TARGET_OF_REPEAT_OPERATOR_INVALID:
    p = "target of repeat operator is invalid"; break;
  case ONIGERR_NESTED_REPEAT_OPERATOR:
    p = "nested repeat operator"; break;
  case ONIGERR_UNMATCHED_CLOSE_PARENTHESIS:
    p = "unmatched close parenthesis"; break;
  case ONIGERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS:
    p = "end pattern with unmatched parenthesis"; break;
  case ONIGERR_END_PATTERN_IN_GROUP:
    p = "end pattern in group"; break;
  case ONIGERR_UNDEFINED_GROUP_OPTION:
    p = "undefined group option"; break;
  case ONIGERR_INVALID_POSIX_BRACKET_TYPE:
    p = "invalid POSIX bracket type"; break;
  case ONIGERR_INVALID_LOOK_BEHIND_PATTERN:
    p = "invalid pattern in look-behind"; break;
  case ONIGERR_INVALID_REPEAT_RANGE_PATTERN:
    p = "invalid repeat range {lower,upper}"; break;
  case ONIGERR_TOO_BIG_NUMBER:
    p = "too big number"; break;
  case ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE:
    p = "too big number for repeat range"; break;
  case ONIGERR_UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE:
    p = "upper is smaller than lower in repeat range"; break;
  case ONIGERR_EMPTY_RANGE_IN_CHAR_CLASS:
    p = "empty range in char class"; break;
  case ONIGERR_MISMATCH_CODE_LENGTH_IN_CLASS_RANGE:
    p = "mismatch multibyte code length in char-class range"; break;
  case ONIGERR_TOO_MANY_MULTI_BYTE_RANGES:
    p = "too many multibyte code ranges are specified"; break;
  case ONIGERR_TOO_SHORT_MULTI_BYTE_STRING:
    p = "too short multibyte code string"; break;
  case ONIGERR_TOO_BIG_BACKREF_NUMBER:
    p = "too big backref number"; break;
  case ONIGERR_INVALID_BACKREF:
#ifdef USE_NAMED_GROUP
    p = "invalid backref number/name"; break;
#else
    p = "invalid backref number"; break;
#endif
  case ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED:
    p = "numbered backref/call is not allowed. (use name)"; break;
  case ONIGERR_TOO_BIG_WIDE_CHAR_VALUE:
    p = "too big wide-char value"; break;
  case ONIGERR_TOO_LONG_WIDE_CHAR_VALUE:
    p = "too long wide-char value"; break;
  case ONIGERR_INVALID_CODE_POINT_VALUE:
    p = "invalid code point value"; break;
  case ONIGERR_EMPTY_GROUP_NAME:
    p = "group name is empty"; break;
  case ONIGERR_INVALID_GROUP_NAME:
    p = "invalid group name <%n>"; break;
  case ONIGERR_INVALID_CHAR_IN_GROUP_NAME:
#ifdef USE_NAMED_GROUP
    p = "invalid char in group name <%n>"; break;
#else
    p = "invalid char in group number <%n>"; break;
#endif
  case ONIGERR_UNDEFINED_NAME_REFERENCE:
    p = "undefined name <%n> reference"; break;
  case ONIGERR_UNDEFINED_GROUP_REFERENCE:
    p = "undefined group <%n> reference"; break;
  case ONIGERR_MULTIPLEX_DEFINED_NAME:
    p = "multiplex defined name <%n>"; break;
  case ONIGERR_MULTIPLEX_DEFINITION_NAME_CALL:
    p = "multiplex definition name <%n> call"; break;
  case ONIGERR_NEVER_ENDING_RECURSION:
    p = "never ending recursion"; break;
  case ONIGERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY:
    p = "group number is too big for capture history"; break;
  case ONIGERR_INVALID_CHAR_PROPERTY_NAME:
    p = "invalid character property name {%n}"; break;
  case ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION:
    p = "not supported encoding combination"; break;
  case ONIGERR_INVALID_COMBINATION_OF_OPTIONS:
    p = "invalid combination of options"; break;
  case ONIGERR_OVER_THREAD_PASS_LIMIT_COUNT:
    p = "over thread pass limit count"; break;

  default:
    p = "undefined error code"; break;
  }

  return (UChar* )p;
}

merge Ruby 1.9.2


euckr_is_allowed_reverse_match(const UChar* s, const UChar* end ARG_UNUSED, OnigEncoding enc ARG_UNUSED)
{
  const UChar c = *s;
  if (c <= 0x7e) return TRUE;
  else           return FALSE;
}

merge Ruby 1.9.2


mbc_to_code(const UChar* p, const UChar* end, OnigEncoding enc)
{
  int c, len;
  OnigCodePoint n;

  len = enclen(enc, p, end);
  c = *p++;
  if (len > 1) {
    len--;
    n = c & ((1 << (6 - len)) - 1);
    while (len--) {
      c = *p++;
      n = (n << 6) | (c & ((1 << 6) - 1));
    }
    return n;
  }
  else {
#ifdef USE_INVALID_CODE_SCHEME
    if (c > 0xfd) {
      return ((c == 0xfe) ? INVALID_CODE_FE : INVALID_CODE_FF);
    }
#endif
    return (OnigCodePoint )c;
  }
}

merge Ruby 1.9.2


strhash(st_data_t arg)
{
    register const char *string = (const char *)arg;
    register st_index_t hval = FNV1_32A_INIT;

    /*
     * FNV-1a hash each octet in the buffer
     */
    while (*string) {
	/* xor the bottom with the current octet */
	hval ^= (unsigned int)*string++;

	/* multiply by the 32 bit FNV magic prime mod 2^32 */
	hval *= FNV_32_PRIME;
    }
    return hval;
}

merge Ruby 1.9.2


gbk_is_allowed_reverse_match(const UChar* s, const UChar* end ARG_UNUSED, OnigEncoding enc ARG_UNUSED)
{
  const UChar c = *s;
  return (GBK_ISMB_TRAIL(c) ? FALSE : TRUE);
}

merge Ruby 1.9.2


print_optimize_info(FILE* f, regex_t* reg)
{
  static const char* on[] = { "NONE", "EXACT", "EXACT_BM", "EXACT_BM_NOT_REV",
                              "EXACT_IC", "MAP" };

  fprintf(f, "optimize: %s\n", on[reg->optimize]);
  fprintf(f, "  anchor: "); print_anchor(f, reg->anchor);
  if ((reg->anchor & ANCHOR_END_BUF_MASK) != 0)
    print_distance_range(f, reg->anchor_dmin, reg->anchor_dmax);
  fprintf(f, "\n");

  if (reg->optimize) {
    fprintf(f, "  sub anchor: "); print_anchor(f, reg->sub_anchor);
    fprintf(f, "\n");
  }
  fprintf(f, "\n");

  if (reg->exact) {
    UChar *p;
    fprintf(f, "exact: [");
    for (p = reg->exact; p < reg->exact_end; p++) {
      fputc(*p, f);
    }
    fprintf(f, "]: length: %ld\n", (reg->exact_end - reg->exact));
  }
  else if (reg->optimize & ONIG_OPTIMIZE_MAP) {
    int c, i, n = 0;

    for (i = 0; i < ONIG_CHAR_TABLE_SIZE; i++)
      if (reg->map[i]) n++;

    fprintf(f, "map: n=%d\n", n);
    if (n > 0) {
      c = 0;
      fputc('[', f);
      for (i = 0; i < ONIG_CHAR_TABLE_SIZE; i++) {
	if (reg->map[i] != 0) {
          if (c > 0)  fputs(", ", f);
          c++;
          if (ONIGENC_MBC_MAXLEN(reg->enc) == 1 &&
              ONIGENC_IS_CODE_PRINT(reg->enc, (OnigCodePoint )i))
            fputc(i, f);
          else
            fprintf(f, "%d", i);
        }
      }
      fprintf(f, "]\n");
    }
  }
}

merge Ruby 1.9.2


st_strncasecmp(const char *s1, const char *s2, size_t n)
{
    unsigned int c1, c2;

    while (n--) {
        c1 = (unsigned char)*s1++;
        c2 = (unsigned char)*s2++;
        if (c1 == '\0' || c2 == '\0') {
            if (c1 != '\0') return 1;
            if (c2 != '\0') return -1;
            return 0;
        }
        if ((unsigned int)(c1 - 'A') <= ('Z' - 'A')) c1 += 'a' - 'A';
        if ((unsigned int)(c2 - 'A') <= ('Z' - 'A')) c2 += 'a' - 'A';
        if (c1 != c2) {
            if (c1 > c2)
                return 1;
            else
                return -1;
        }
    }
    return 0;
}

merge Ruby 1.9.2


gbk_code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc)
{
  return onigenc_mb2_code_to_mbc(enc, code, buf);
}

merge Ruby 1.9.2


and_cclass(CClassNode* dest, CClassNode* cc, ScanEnv* env)
{
  OnigEncoding enc = env->enc;
  int r, not1, not2;
  BBuf *buf1, *buf2, *pbuf = 0;
  BitSetRef bsr1, bsr2;
  BitSet bs1, bs2;

  not1 = IS_NCCLASS_NOT(dest);
  bsr1 = dest->bs;
  buf1 = dest->mbuf;
  not2 = IS_NCCLASS_NOT(cc);
  bsr2 = cc->bs;
  buf2 = cc->mbuf;

  if (not1 != 0) {
    bitset_invert_to(bsr1, bs1);
    bsr1 = bs1;
  }
  if (not2 != 0) {
    bitset_invert_to(bsr2, bs2);
    bsr2 = bs2;
  }
  bitset_and(bsr1, bsr2);
  if (bsr1 != dest->bs) {
    bitset_copy(dest->bs, bsr1);
    bsr1 = dest->bs;
  }
  if (not1 != 0) {
    bitset_invert(dest->bs);
  }

  if (! ONIGENC_IS_SINGLEBYTE(enc)) {
    if (not1 != 0 && not2 != 0) {
      r = or_code_range_buf(enc, buf1, 0, buf2, 0, &pbuf, env);
    }
    else {
      r = and_code_range_buf(buf1, not1, buf2, not2, &pbuf, env);
      if (r == 0 && not1 != 0) {
	BBuf *tbuf = 0;
	r = not_code_range_buf(enc, pbuf, &tbuf, env);
	bbuf_free(pbuf);
	pbuf = tbuf;
      }
    }
    if (r != 0) {
	bbuf_free(pbuf);
	return r;
    }

    dest->mbuf = pbuf;
    bbuf_free(buf1);
    return r;
  }
  return 0;
}

merge Ruby 1.9.2


cp949_is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc)
{
  return onigenc_mb2_is_code_ctype(enc, code, ctype);
}

merge Ruby 1.9.2


is_mbc_newline(const UChar* p, const UChar* end, OnigEncoding enc)
{
  if (p < end) {
    if (*p == 0x0a) return 1;

#ifdef USE_UNICODE_ALL_LINE_TERMINATORS
#ifndef USE_CRNL_AS_LINE_TERMINATOR
    if (*p == 0x0d) return 1;
#endif
    if (p + 1 < end) {
      if (*(p+1) == 0x85 && *p == 0xc2) /* U+0085 */
	return 1;
      if (p + 2 < end) {
	if ((*(p+2) == 0xa8 || *(p+2) == 0xa9)
	    && *(p+1) == 0x80 && *p == 0xe2)  /* U+2028, U+2029 */
	  return 1;
      }
    }
#endif
  }

  return 0;
}

merge Ruby 1.9.2


utf32be_mbc_enc_len(const UChar* p ARG_UNUSED, const OnigUChar* e ARG_UNUSED,
		    OnigEncoding enc ARG_UNUSED)
{
  return 4;
}

merge Ruby 1.9.2


cp949_code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc)
{
  return onigenc_mb2_code_to_mbc(enc, code, buf);
}

merge Ruby 1.9.2


slow_search(OnigEncoding enc, UChar* target, UChar* target_end,
	    const UChar* text, const UChar* text_end, UChar* text_range)
{
  UChar *t, *p, *s, *end;

  end = (UChar* )text_end;
  end -= target_end - target - 1;
  if (end > text_range)
    end = text_range;

  s = (UChar* )text;

  if (enc->max_enc_len == enc->min_enc_len) {
    int n = enc->max_enc_len;

    while (s < end) {
      if (*s == *target) {
	p = s + 1;
	t = target + 1;
	if (target_end == t || memcmp(t, p, target_end - t) == 0)
	  return s;
      }
      s += n;
    }
    return (UChar*)NULL;
  }
  while (s < end) {
    if (*s == *target) {
      p = s + 1;
      t = target + 1;
      if (target_end == t || memcmp(t, p, target_end - t) == 0)
	return s;
    }
    s += enclen(enc, s, text_end);
  }

  return (UChar* )NULL;
}

merge Ruby 1.9.2


st_cleanup_safe(st_table *table, st_data_t never)
{
    st_table_entry *ptr, **last, *tmp;
    st_index_t i;

    if (table->entries_packed) {
	st_index_t i = 0, j = 0;
	while ((st_data_t)table->bins[i*2] != never) {
	    if (i++ == table->num_entries) return;
	}
	for (j = i; ++i < table->num_entries;) {
	    if ((st_data_t)table->bins[i*2] == never) continue;
	    table->bins[j*2] = table->bins[i*2];
	    table->bins[j*2+1] = table->bins[i*2+1];
	    j++;
	}
	table->num_entries = j;
	return;
    }

    for (i = 0; i < table->num_bins; i++) {
	ptr = *(last = &table->bins[i]);
	while (ptr != 0) {
	    if (ptr->key == never) {
		tmp = ptr;
		*last = ptr = ptr->next;
		free(tmp);
	    }
	    else {
		ptr = *(last = &ptr->next);
	    }
	}
    }
}

merge Ruby 1.9.2


utf32le_left_adjust_char_head(const UChar* start, const UChar* s, const UChar* end,
			      OnigEncoding enc ARG_UNUSED)
{
  ptrdiff_t rem;

  if (s <= start) return (UChar* )s;

  rem = (s - start) % 4;
  return (UChar* )(s - rem);
}

merge Ruby 1.9.2


euctw_code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc)
{
  return onigenc_mb4_code_to_mbc(enc, code, buf);
}

merge Ruby 1.9.2


gbk_mbc_enc_len(const UChar* p, const UChar* e, OnigEncoding enc ARG_UNUSED)
{
  int firstbyte = *p++;
  state_t s = trans[0][firstbyte];
#define RETURN(n) \
    return s == ACCEPT ? ONIGENC_CONSTRUCT_MBCLEN_CHARFOUND(n) : \
                         ONIGENC_CONSTRUCT_MBCLEN_INVALID()
  if (s < 0) RETURN(1);
  if (p == e) return ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE(EncLen_GBK[firstbyte]-1);
  s = trans[s][*p++];
  RETURN(2);
#undef RETURN
}

merge Ruby 1.9.2


koi8_r_is_code_ctype(OnigCodePoint code, unsigned int ctype,
		     OnigEncoding enc ARG_UNUSED)
{
  if (code < 256)
    return ENC_IS_KOI8_R_CTYPE(code, ctype);
  else
    return FALSE;
}

merge Ruby 1.9.2


utf16le_mbc_enc_len(const UChar* p, const OnigUChar* e,
		    OnigEncoding enc ARG_UNUSED)
{
  int len = (int)(e - p);
  UChar byte;
  if (len < 2)
    return ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE(1);
  byte = p[1];
  if (!UTF16_IS_SURROGATE(byte)) {
    return ONIGENC_CONSTRUCT_MBCLEN_CHARFOUND(2);
  }
  if (UTF16_IS_SURROGATE_FIRST(byte)) {
    if (len < 4)
      return ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE(4-len);
    if (UTF16_IS_SURROGATE_SECOND(p[3]))
      return ONIGENC_CONSTRUCT_MBCLEN_CHARFOUND(4);
  }
  return ONIGENC_CONSTRUCT_MBCLEN_INVALID();
}

merge Ruby 1.9.2


setup_tree(Node* node, regex_t* reg, int state, ScanEnv* env)
{
  int type;
  int r = 0;

restart:
  type = NTYPE(node);
  switch (type) {
  case NT_LIST:
    {
      Node* prev = NULL_NODE;
      do {
	r = setup_tree(NCAR(node), reg, state, env);
	if (IS_NOT_NULL(prev) && r == 0) {
	  r = next_setup(prev, NCAR(node), reg);
	}
	prev = NCAR(node);
      } while (r == 0 && IS_NOT_NULL(node = NCDR(node)));
    }
    break;

  case NT_ALT:
    do {
      r = setup_tree(NCAR(node), reg, (state | IN_ALT), env);
    } while (r == 0 && IS_NOT_NULL(node = NCDR(node)));
    break;

  case NT_CCLASS:
    break;

  case NT_STR:
    if (IS_IGNORECASE(reg->options) && !NSTRING_IS_RAW(node)) {
      r = expand_case_fold_string(node, reg);
    }
    break;

  case NT_CTYPE:
  case NT_CANY:
    break;

#ifdef USE_SUBEXP_CALL
  case NT_CALL:
    break;
#endif

  case NT_BREF:
    {
      int i;
      int* p;
      Node** nodes = SCANENV_MEM_NODES(env);
      BRefNode* br = NBREF(node);
      p = BACKREFS_P(br);
      for (i = 0; i < br->back_num; i++) {
	if (p[i] > env->num_mem)  return ONIGERR_INVALID_BACKREF;
	BIT_STATUS_ON_AT(env->backrefed_mem, p[i]);
	BIT_STATUS_ON_AT(env->bt_mem_start, p[i]);
#ifdef USE_BACKREF_WITH_LEVEL
	if (IS_BACKREF_NEST_LEVEL(br)) {
	  BIT_STATUS_ON_AT(env->bt_mem_end, p[i]);
	}
#endif
	SET_ENCLOSE_STATUS(nodes[p[i]], NST_MEM_BACKREFED);
      }
    }
    break;

  case NT_QTFR:
    {
      OnigDistance d;
      QtfrNode* qn = NQTFR(node);
      Node* target = qn->target;

      if ((state & IN_REPEAT) != 0) {
        qn->state |= NST_IN_REPEAT;
      }

      if (IS_REPEAT_INFINITE(qn->upper) || qn->upper >= 1) {
	r = get_min_match_length(target, &d, env);
	if (r) break;
	if (d == 0) {
	  qn->target_empty_info = NQ_TARGET_IS_EMPTY;
#ifdef USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT
	  r = quantifiers_memory_node_info(target);
	  if (r < 0) break;
	  if (r > 0) {
	    qn->target_empty_info = r;
	  }
#endif
#if 0
	  r = get_max_match_length(target, &d, env);
	  if (r == 0 && d == 0) {
	    /*  ()* ==> ()?, ()+ ==> ()  */
	    qn->upper = 1;
	    if (qn->lower > 1) qn->lower = 1;
	    if (NTYPE(target) == NT_STR) {
	      qn->upper = qn->lower = 0;  /* /(?:)+/ ==> // */
	    }
	  }
#endif
	}
      }

      state |= IN_REPEAT;
      if (qn->lower != qn->upper)
	state |= IN_VAR_REPEAT;
      r = setup_tree(target, reg, state, env);
      if (r) break;

      /* expand string */
#define EXPAND_STRING_MAX_LENGTH  100
      if (NTYPE(target) == NT_STR) {
	if (!IS_REPEAT_INFINITE(qn->lower) && qn->lower == qn->upper &&
	    qn->lower > 1 && qn->lower <= EXPAND_STRING_MAX_LENGTH) {
	  OnigDistance len = NSTRING_LEN(target);
	  StrNode* sn = NSTR(target);

	  if (len * qn->lower <= EXPAND_STRING_MAX_LENGTH) {
	    int i, n = qn->lower;
	    onig_node_conv_to_str_node(node, NSTR(target)->flag);
	    for (i = 0; i < n; i++) {
	      r = onig_node_str_cat(node, sn->s, sn->end);
	      if (r) break;
	    }
	    onig_node_free(target);
	    break; /* break case NT_QTFR: */
	  }
	}
      }

#ifdef USE_OP_PUSH_OR_JUMP_EXACT
      if (qn->greedy && (qn->target_empty_info != 0)) {
	if (NTYPE(target) == NT_QTFR) {
	  QtfrNode* tqn = NQTFR(target);
	  if (IS_NOT_NULL(tqn->head_exact)) {
	    qn->head_exact  = tqn->head_exact;
	    tqn->head_exact = NULL;
	  }
	}
	else {
	  qn->head_exact = get_head_value_node(qn->target, 1, reg);
	}
      }
#endif
    }
    break;

  case NT_ENCLOSE:
    {
      EncloseNode* en = NENCLOSE(node);

      switch (en->type) {
      case ENCLOSE_OPTION:
	{
	  OnigOptionType options = reg->options;
	  reg->options = NENCLOSE(node)->option;
	  r = setup_tree(NENCLOSE(node)->target, reg, state, env);
	  reg->options = options;
	}
	break;

      case ENCLOSE_MEMORY:
	if ((state & (IN_ALT | IN_NOT | IN_VAR_REPEAT)) != 0) {
	  BIT_STATUS_ON_AT(env->bt_mem_start, en->regnum);
	  /* SET_ENCLOSE_STATUS(node, NST_MEM_IN_ALT_NOT); */
	}
        r = setup_tree(en->target, reg, state, env);
        break;

      case ENCLOSE_STOP_BACKTRACK:
	{
	  Node* target = en->target;
	  r = setup_tree(target, reg, state, env);
	  if (NTYPE(target) == NT_QTFR) {
	    QtfrNode* tqn = NQTFR(target);
	    if (IS_REPEAT_INFINITE(tqn->upper) && tqn->lower <= 1 &&
		tqn->greedy != 0) {  /* (?>a*), a*+ etc... */
	      int qtype = NTYPE(tqn->target);
	      if (IS_NODE_TYPE_SIMPLE(qtype))
		SET_ENCLOSE_STATUS(node, NST_STOP_BT_SIMPLE_REPEAT);
	    }
	  }
	}
	break;
      }
    }
    break;

  case NT_ANCHOR:
    {
      AnchorNode* an = NANCHOR(node);

      switch (an->type) {
      case ANCHOR_PREC_READ:
	r = setup_tree(an->target, reg, state, env);
	break;
      case ANCHOR_PREC_READ_NOT:
	r = setup_tree(an->target, reg, (state | IN_NOT), env);
	break;

/* allowed node types in look-behind */
#define ALLOWED_TYPE_IN_LB  \
  ( BIT_NT_LIST | BIT_NT_ALT | BIT_NT_STR | BIT_NT_CCLASS | BIT_NT_CTYPE | \
    BIT_NT_CANY | BIT_NT_ANCHOR | BIT_NT_ENCLOSE | BIT_NT_QTFR | BIT_NT_CALL )

#define ALLOWED_ENCLOSE_IN_LB       ( ENCLOSE_MEMORY )
#define ALLOWED_ENCLOSE_IN_LB_NOT   0

#define ALLOWED_ANCHOR_IN_LB \
( ANCHOR_LOOK_BEHIND | ANCHOR_BEGIN_LINE | ANCHOR_END_LINE | ANCHOR_BEGIN_BUF | ANCHOR_BEGIN_POSITION )
#define ALLOWED_ANCHOR_IN_LB_NOT \
( ANCHOR_LOOK_BEHIND | ANCHOR_LOOK_BEHIND_NOT | ANCHOR_BEGIN_LINE | ANCHOR_END_LINE | ANCHOR_BEGIN_BUF | ANCHOR_BEGIN_POSITION )

      case ANCHOR_LOOK_BEHIND:
	{
	  r = check_type_tree(an->target, ALLOWED_TYPE_IN_LB,
			      ALLOWED_ENCLOSE_IN_LB, ALLOWED_ANCHOR_IN_LB);
	  if (r < 0) return r;
	  if (r > 0) return ONIGERR_INVALID_LOOK_BEHIND_PATTERN;
	  r = setup_look_behind(node, reg, env);
	  if (r != 0) return r;
	  if (NTYPE(node) != NT_ANCHOR) goto restart;
	  r = setup_tree(an->target, reg, state, env);
	}
	break;

      case ANCHOR_LOOK_BEHIND_NOT:
	{
	  r = check_type_tree(an->target, ALLOWED_TYPE_IN_LB,
		      ALLOWED_ENCLOSE_IN_LB_NOT, ALLOWED_ANCHOR_IN_LB_NOT);
	  if (r < 0) return r;
	  if (r > 0) return ONIGERR_INVALID_LOOK_BEHIND_PATTERN;
	  r = setup_look_behind(node, reg, env);
	  if (r != 0) return r;
	  if (NTYPE(node) != NT_ANCHOR) goto restart;
	  r = setup_tree(an->target, reg, (state | IN_NOT), env);
	}
	break;
      }
    }
    break;

  default:
    break;
  }

  return r;
}

merge Ruby 1.9.2


onig_region_resize(OnigRegion* region, int n)
{
  region->num_regs = n;

  if (n < ONIG_NREGION)
    n = ONIG_NREGION;

  if (region->allocated == 0) {
    region->beg = (int* )xmalloc(n * sizeof(int));
    if (region->beg == 0)
      return ONIGERR_MEMORY;

    region->end = (int* )xmalloc(n * sizeof(int));
    if (region->end == 0) {
      xfree(region->beg);
      return ONIGERR_MEMORY;
    }

    region->allocated = n;
  }
  else if (region->allocated < n) {
    int *tmp;

    region->allocated = 0;
    tmp = (int* )xrealloc(region->beg, n * sizeof(int));
    if (tmp == 0) {
      xfree(region->beg);
      xfree(region->end);
      return ONIGERR_MEMORY;
    }
    region->beg = tmp;
    tmp = (int* )xrealloc(region->end, n * sizeof(int));
    if (tmp == 0) {
      xfree(region->beg);
      return ONIGERR_MEMORY;
    }
    region->end = tmp;

    if (region->beg == 0 || region->end == 0)
      return ONIGERR_MEMORY;

    region->allocated = n;
  }

  return 0;
}

merge Ruby 1.9.2


utf16be_code_to_mbclen(OnigCodePoint code,
		       OnigEncoding enc)
{
  return (code > 0xffff ? 4 : 2);
}

merge Ruby 1.9.2


code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc)
{
  UChar *p = buf;

  if ((code & 0xff0000) != 0) *p++ = (UChar )(((code >> 16) & 0xff));
  if ((code &   0xff00) != 0) *p++ = (UChar )(((code >>  8) & 0xff));
  *p++ = (UChar )(code & 0xff);

#if 1
  if (enclen(enc, buf, p) != (p - buf))
    return ONIGERR_INVALID_CODE_POINT_VALUE;
#endif
  return (int)(p - buf);
}

merge Ruby 1.9.2


mbc_case_fold(OnigCaseFoldType flag,
			  const UChar** pp, const UChar* end ARG_UNUSED,
			  UChar* lower, OnigEncoding enc ARG_UNUSED)
{
  const UChar* p = *pp;

  if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) {
    *lower++ = 's';
    *lower   = 's';
    (*pp)++;
    return 2;
  }

  *lower = ENC_ISO_8859_10_TO_LOWER_CASE(*p);
  (*pp)++;
  return 1;
}

merge Ruby 1.9.2


koi8_r_mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED,
		     const UChar** pp, const UChar* end ARG_UNUSED,
		     UChar* lower, OnigEncoding enc ARG_UNUSED)
{
  const UChar* p = *pp;

  *lower = ENC_KOI8_R_TO_LOWER_CASE(*p);
  (*pp)++;
  return 1;
}

merge Ruby 1.9.2


ObjectComputeName(
		  UINT32           size,          // IN: the size of the area to digest
		  BYTE            *publicArea,    // IN: the public area to digest
		  TPM_ALG_ID       nameAlg,       // IN: the hash algorithm to use
		  TPM2B_NAME      *name           // OUT: Computed name
		  )
{
    // Hash the publicArea into the name buffer leaving room for the nameAlg
    name->t.size = CryptHashBlock(nameAlg, size, publicArea,
				  sizeof(name->t.name) - 2,
				  &name->t.name[2]);
    // set the nameAlg
    UINT16_TO_BYTE_ARRAY(nameAlg, name->t.name);
    name->t.size += 2;
    return name;
}

tpm2: Initialize a whole OBJECT before using it

Initialize a whole OBJECT before using it. This is necessary since
an OBJECT may also be used as a HASH_OBJECT via the ANY_OBJECT
union and that HASH_OBJECT can leave bad size inidicators in TPM2B
buffer in the OBJECT. To get rid of this problem we reset the whole
OBJECT to 0 before using it. This is as if the memory for the
OBJECT was just initialized.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>


ObjectGetHierarchy(
		   OBJECT          *object         // IN :object
		   )
{
    if(object->attributes.spsHierarchy)
	{
	    return TPM_RH_OWNER;
	}
    else if(object->attributes.epsHierarchy)
	{
	    return TPM_RH_ENDORSEMENT;
	}
    else if(object->attributes.ppsHierarchy)
	{
	    return TPM_RH_PLATFORM;
	}
    else
	{
	    return TPM_RH_NULL;
	}
}


ObjectFlush(
	    OBJECT          *object
	    )
{
    object->attributes.occupied = CLEAR;
}


ObjectCreateEventSequence(
			  TPM2B_AUTH      *auth,          // IN: authValue
			  TPMI_DH_OBJECT  *newHandle      // OUT: sequence object handle
			  )
{
    HASH_OBJECT         *hashObject = AllocateSequenceSlot(newHandle, auth);
    UINT32               count;
    TPM_ALG_ID           hash;
    // See if slot allocated
    if(hashObject == NULL)
	return TPM_RC_OBJECT_MEMORY;
    // Set the event sequence attribute
    hashObject->attributes.eventSeq = SET;
    // Initialize hash states for each implemented PCR algorithms
    for(count = 0; (hash = CryptHashGetAlgByIndex(count)) != TPM_ALG_NULL; count++)
	CryptHashStart(&hashObject->state.hashState[count], hash);
    return TPM_RC_SUCCESS;
}


ObjectCreateHMACSequence(
			 TPMI_ALG_HASH    hashAlg,       // IN: hash algorithm
			 OBJECT          *keyObject,     // IN: the object containing the HMAC key
			 TPM2B_AUTH      *auth,          // IN: authValue
			 TPMI_DH_OBJECT  *newHandle      // OUT: HMAC sequence object handle
			 )
{
    HASH_OBJECT         *hmacObject;
    //
    // Try to allocate a slot for new object
    hmacObject = AllocateSequenceSlot(newHandle, auth);
    if(hmacObject == NULL)
	return TPM_RC_OBJECT_MEMORY;
    // Set HMAC sequence bit
    hmacObject->attributes.hmacSeq = SET;
#if !SMAC_IMPLEMENTED
    if(CryptHmacStart(&hmacObject->state.hmacState, hashAlg,
		      keyObject->sensitive.sensitive.bits.b.size,
		      keyObject->sensitive.sensitive.bits.b.buffer) == 0)
#else
	if(CryptMacStart(&hmacObject->state.hmacState,
			 &keyObject->publicArea.parameters,
			 hashAlg, &keyObject->sensitive.sensitive.any.b) == 0)
#endif // SMAC_IMPLEMENTED
	    return TPM_RC_FAILURE;
    return TPM_RC_SUCCESS;
}


FindEmptyObjectSlot(
		    TPMI_DH_OBJECT  *handle         // OUT: (optional)
		    )
{
    UINT32               i;
    OBJECT              *object;
    for(i = 0; i < MAX_LOADED_OBJECTS; i++)
	{
	    object = &s_objects[i];
	    if(object->attributes.occupied == CLEAR)
		{
		    if(handle)
			*handle = i + TRANSIENT_FIRST;
		    // Initialize the object attributes
		    // MemorySet(&object->attributes, 0, sizeof(OBJECT_ATTRIBUTES));
		    MemorySet(object, 0, sizeof(*object)); // libtpms added: Initialize the whole object
		    return object;
		}
	}
    return NULL;
}


ObjectLoadEvict(
		TPM_HANDLE      *handle,        // IN:OUT: evict object handle.  If success, it
		// will be replace by the loaded object handle
		COMMAND_INDEX    commandIndex   // IN: the command being processed
		)
{
    TPM_RC          result;
    TPM_HANDLE      evictHandle = *handle;   // Save the evict handle
    OBJECT          *object;
    // If this is an index that references a persistent object created by
    // the platform, then return TPM_RH_HANDLE if the phEnable is FALSE
    if(*handle >= PLATFORM_PERSISTENT)
	{
	    // belongs to platform
	    if(g_phEnable == CLEAR)
		return TPM_RC_HANDLE;
	}
    // belongs to owner
    else if(gc.shEnable == CLEAR)
	return TPM_RC_HANDLE;
    // Try to allocate a slot for an object
    object = ObjectAllocateSlot(handle);
    if(object == NULL)
	return TPM_RC_OBJECT_MEMORY;
    // Copy persistent object to transient object slot.  A TPM_RC_HANDLE
    // may be returned at this point. This will mark the slot as containing
    // a transient object so that it will be flushed at the end of the
    // command
    result = NvGetEvictObject(evictHandle, object);
    // Bail out if this failed
    if(result != TPM_RC_SUCCESS)
	return result;
    // check the object to see if it is in the endorsement hierarchy
    // if it is and this is not a TPM2_EvictControl() command, indicate
    // that the hierarchy is disabled.
    // If the associated hierarchy is disabled, make it look like the
    // handle is not defined
    if(ObjectGetHierarchy(object) == TPM_RH_ENDORSEMENT
       && gc.ehEnable == CLEAR
       && GetCommandCode(commandIndex) != TPM_CC_EvictControl)
	return TPM_RC_HANDLE;
    return result;
}


GetQualifiedName(
		 TPMI_DH_OBJECT   handle,        // IN: handle of the object
		 TPM2B_NAME      *qualifiedName  // OUT: qualified name of the object
		 )
{
    OBJECT      *object;
    switch(HandleGetType(handle))
	{
	  case TPM_HT_PERMANENT:
	    qualifiedName->t.size = sizeof(TPM_HANDLE);
	    UINT32_TO_BYTE_ARRAY(handle, qualifiedName->t.name);
	    break;
	  case TPM_HT_TRANSIENT:
	    object = HandleToObject(handle);
	    if(object == NULL || object->publicArea.nameAlg == TPM_ALG_NULL)
		qualifiedName->t.size = 0;
	    else
		// Copy the name
		*qualifiedName = object->qualifiedName;
	    break;
	  default:
	    FAIL(FATAL_ERROR_INTERNAL);
	}
    return;
}


GetHeriarchy(
	     TPMI_DH_OBJECT   handle         // IN :object handle
	     )
{
    OBJECT          *object = HandleToObject(handle);
    return ObjectGetHierarchy(object);
}


PublicMarshalAndComputeName(
			    TPMT_PUBLIC     *publicArea,    // IN: public area of an object
			    TPM2B_NAME      *name           // OUT: name of the object
			    )
{
    // Will marshal a public area into a template. This is because the internal
    // format for a TPM2B_PUBLIC is a structure and not a simple BYTE buffer.
    TPM2B_TEMPLATE       marshaled;     // this is big enough to hold a
    //  marshaled TPMT_PUBLIC
    BYTE                *buffer = (BYTE *)&marshaled.t.buffer;
    // if the nameAlg is NULL then there is no name.
    if(publicArea->nameAlg == TPM_ALG_NULL)
	name->t.size = 0;
    else
	{
	    // Marshal the public area into its canonical form
	    marshaled.t.size = TPMT_PUBLIC_Marshal(publicArea, &buffer, NULL);
	    // and compute the name
	    ObjectComputeName(marshaled.t.size, marshaled.t.buffer,
			      publicArea->nameAlg, name);
	}
    return name;
}


ObjectFlushHierarchy(
		     TPMI_RH_HIERARCHY    hierarchy      // IN: hierarchy to be flush
		     )
{
    UINT16          i;
    // iterate object slots
    for(i = 0; i < MAX_LOADED_OBJECTS; i++)
	{
	    if(s_objects[i].attributes.occupied)          // If found an occupied slot
		{
		    switch(hierarchy)
			{
			  case TPM_RH_PLATFORM:
			    if(s_objects[i].attributes.ppsHierarchy == SET)
				s_objects[i].attributes.occupied = FALSE;
			    break;
			  case TPM_RH_OWNER:
			    if(s_objects[i].attributes.spsHierarchy == SET)
				s_objects[i].attributes.occupied = FALSE;
			    break;
			  case TPM_RH_ENDORSEMENT:
			    if(s_objects[i].attributes.epsHierarchy == SET)
				s_objects[i].attributes.occupied = FALSE;
			    break;
			  default:
			    FAIL(FATAL_ERROR_INTERNAL);
			    break;
			}
		}
	}
    return;
}


ObjectIsSequence(
		 OBJECT          *object         // IN: handle to be checked
		 )
{
    pAssert(object != NULL);
    return (object->attributes.hmacSeq == SET
	    || object->attributes.hashSeq == SET
	    || object->attributes.eventSeq == SET);
}


ComputeQualifiedName(
		     TPM_HANDLE       parentHandle,  // IN: parent's handle
		     TPM_ALG_ID       nameAlg,       // IN: name hash
		     TPM2B_NAME      *name,          // IN: name of the object
		     TPM2B_NAME      *qualifiedName  // OUT: qualified name of the object
		     )
{
    HASH_STATE      hashState;   // hash state
    TPM2B_NAME      parentName;
    if(parentHandle == TPM_RH_UNASSIGNED)
	{
	    MemoryCopy2B(&qualifiedName->b, &name->b, sizeof(qualifiedName->t.name));
	    *qualifiedName = *name;
	}
    else
	{
	    GetQualifiedName(parentHandle, &parentName);
	    //      QN_A = hash_A (QN of parent || NAME_A)
	    // Start hash
	    qualifiedName->t.size = CryptHashStart(&hashState, nameAlg);
	    // Add parent's qualified name
	    CryptDigestUpdate2B(&hashState, &parentName.b);
	    // Add self name
	    CryptDigestUpdate2B(&hashState, &name->b);
	    // Complete hash leaving room for the name algorithm
	    CryptHashEnd(&hashState, qualifiedName->t.size,
			 &qualifiedName->t.name[2]);
	    UINT16_TO_BYTE_ARRAY(nameAlg, qualifiedName->t.name);
	    qualifiedName->t.size += 2;
	}
    return;
}


ObjectTerminateEvent(
		     void
		     )
{
    HASH_OBJECT         *hashObject;
    int                  count;
    BYTE                 buffer[MAX_DIGEST_SIZE];
    hashObject = (HASH_OBJECT *)HandleToObject(g_DRTMHandle);
    // Don't assume that this is a proper sequence object
    if(hashObject->attributes.eventSeq)
	{
	    // If it is, close any open hash contexts. This is done in case
	    // the cryptographic implementation has some context values that need to be
	    // cleaned up (hygiene).
	    //
	    for(count = 0; CryptHashGetAlgByIndex(count) != TPM_ALG_NULL; count++)
		{
		    CryptHashEnd(&hashObject->state.hashState[count], 0, buffer);
		}
	    // Flush sequence object
	    FlushObject(g_DRTMHandle);
	}
    g_DRTMHandle = TPM_RH_UNASSIGNED;
}