| 1 | /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. |
| 2 | Copyright (c) 2009-2011, Monty Program Ab |
| 3 | Copyright (C) 2003 by Sathit Jittanupat |
| 4 | <jsat66@hotmail.com,jsat66@yahoo.com> |
| 5 | * solving bug crash with long text field string |
| 6 | * sorting with different number of space or sign char. within string |
| 7 | |
| 8 | Copyright (C) 2001 by Korakot Chaovavanich <korakot@iname.com> and |
| 9 | Apisilp Trunganont <apisilp@pantip.inet.co.th> |
| 10 | Copyright (C) 1998, 1999 by Pruet Boonma <pruet@eng.cmu.ac.th> |
| 11 | Copyright (C) 1998 by Theppitak Karoonboonyanan <thep@links.nectec.or.th> |
| 12 | Copyright (C) 1989, 1991 by Samphan Raruenrom <samphan@thai.com> |
| 13 | |
| 14 | Permission to use, copy, modify, distribute and sell this software |
| 15 | and its documentation for any purpose is hereby granted without fee, |
| 16 | provided that the above copyright notice appear in all copies. |
| 17 | Samphan Raruenrom , Theppitak Karoonboonyanan , Pruet Boonma , |
| 18 | Korakot Chaovavanich and Apisilp Trunganont makes no representations |
| 19 | about the suitability of this software for any purpose. It is provided |
| 20 | "as is" without express or implied warranty. |
| 21 | */ |
| 22 | |
| 23 | |
| 24 | /* |
| 25 | This file is basically tis620 character sets with some extra functions |
| 26 | for tis-620 handling |
| 27 | */ |
| 28 | |
| 29 | /* |
| 30 | * This comment is parsed by configure to create ctype.c, |
| 31 | * so don't change it unless you know what you are doing. |
| 32 | * |
| 33 | * .configure. strxfrm_multiply_tis620=4 |
| 34 | */ |
| 35 | |
| 36 | #include "strings_def.h" |
| 37 | #include <m_ctype.h> |
| 38 | #include "t_ctype.h" |
| 39 | #include <my_sys.h> |
| 40 | |
| 41 | #ifdef HAVE_CHARSET_tis620 |
| 42 | |
| 43 | #define M L_MIDDLE |
| 44 | #define U L_UPPER |
| 45 | #define L L_LOWER |
| 46 | #define UU L_UPRUPR |
| 47 | #define X L_MIDDLE |
| 48 | |
| 49 | |
| 50 | static const int t_ctype[][TOT_LEVELS] = { |
| 51 | /*0x00*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 52 | /*0x01*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 53 | /*0x02*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 54 | /*0x03*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 55 | /*0x04*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 56 | /*0x05*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 57 | /*0x06*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 58 | /*0x07*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 59 | /*0x08*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 60 | /*0x09*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 61 | /*0x0A*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 62 | /*0x0B*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 63 | /*0x0C*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 64 | /*0x0D*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 65 | /*0x0E*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 66 | /*0x0F*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 67 | /*0x10*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 68 | /*0x11*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 69 | /*0x12*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 70 | /*0x13*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 71 | /*0x14*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 72 | /*0x15*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 73 | /*0x16*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 74 | /*0x17*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 75 | /*0x18*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 76 | /*0x19*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 77 | /*0x1A*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 78 | /*0x1B*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 79 | /*0x1C*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 80 | /*0x1D*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 81 | /*0x1E*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 82 | /*0x1F*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 83 | /*0x20*/ { IGNORE, IGNORE, L3_SPACE, IGNORE, M}, |
| 84 | /*0x21*/ { IGNORE, IGNORE, L3_EXCLAMATION, IGNORE, M }, |
| 85 | /*0x22*/ { IGNORE, IGNORE, L3_QUOTATION, IGNORE, M }, |
| 86 | /*0x23*/ { IGNORE, IGNORE, L3_NUMBER, IGNORE, M }, |
| 87 | /*0x24*/ { IGNORE, IGNORE, L3_DOLLAR, IGNORE, M }, |
| 88 | /*0x25*/ { IGNORE, IGNORE, L3_PERCENT, IGNORE, M }, |
| 89 | /*0x26*/ { IGNORE, IGNORE, L3_AMPERSAND, IGNORE, M }, |
| 90 | /*0x27*/ { IGNORE, IGNORE, L3_APOSTROPHE, IGNORE, M }, |
| 91 | /*0x28*/ { IGNORE, IGNORE, L3_L_PARANTHESIS, IGNORE, M }, |
| 92 | /*0x29*/ { IGNORE, IGNORE, L3_R_PARENTHESIS, IGNORE, M }, |
| 93 | /*0x2A*/ { IGNORE, IGNORE, L3_ASTERISK, IGNORE, M }, |
| 94 | /*0x2B*/ { IGNORE, IGNORE, L3_PLUS, IGNORE, M }, |
| 95 | /*0x2C*/ { IGNORE, IGNORE, L3_COMMA, IGNORE, M }, |
| 96 | /*0x2D*/ { IGNORE, IGNORE, L3_HYPHEN, IGNORE, M }, |
| 97 | /*0x2E*/ { IGNORE, IGNORE, L3_FULL_STOP, IGNORE, M }, |
| 98 | /*0x2F*/ { IGNORE, IGNORE, L3_SOLIDUS, IGNORE, M }, |
| 99 | /*0x30*/ { L1_08, L2_BLANK, L3_BLANK, L4_BLANK, M }, |
| 100 | /*0x31*/ { L1_18, L2_BLANK, L3_BLANK, L4_BLANK, M }, |
| 101 | /*0x32*/ { L1_28, L2_BLANK, L3_BLANK, L4_BLANK, M }, |
| 102 | /*0x33*/ { L1_38, L2_BLANK, L3_BLANK, L4_BLANK, M }, |
| 103 | /*0x34*/ { L1_48, L2_BLANK, L3_BLANK, L4_BLANK, M }, |
| 104 | /*0x35*/ { L1_58, L2_BLANK, L3_BLANK, L4_BLANK, M }, |
| 105 | /*0x36*/ { L1_68, L2_BLANK, L3_BLANK, L4_BLANK, M }, |
| 106 | /*0x37*/ { L1_78, L2_BLANK, L3_BLANK, L4_BLANK, M }, |
| 107 | /*0x38*/ { L1_88, L2_BLANK, L3_BLANK, L4_BLANK, M }, |
| 108 | /*0x39*/ { L1_98, L2_BLANK, L3_BLANK, L4_BLANK, M }, |
| 109 | /*0x3A*/ { IGNORE, IGNORE, L3_COLON, IGNORE, M }, |
| 110 | /*0x3B*/ { IGNORE, IGNORE, L3_SEMICOLON, IGNORE, M }, |
| 111 | /*0x3C*/ { IGNORE, IGNORE, L3_LESS_THAN, IGNORE, M }, |
| 112 | /*0x3D*/ { IGNORE, IGNORE, L3_EQUAL, IGNORE, M }, |
| 113 | /*0x3E*/ { IGNORE, IGNORE, L3_GREATER_THAN, IGNORE, M }, |
| 114 | /*0x3F*/ { IGNORE, IGNORE, L3_QUESTION, IGNORE, M }, |
| 115 | /*0x40*/ { IGNORE, IGNORE, L3_AT, IGNORE, M }, |
| 116 | /*0x41*/ { L1_A8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 117 | /*0x42*/ { L1_B8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 118 | /*0x43*/ { L1_C8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 119 | /*0x44*/ { L1_D8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 120 | /*0x45*/ { L1_E8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 121 | /*0x46*/ { L1_F8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 122 | /*0x47*/ { L1_G8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 123 | /*0x48*/ { L1_H8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 124 | /*0x49*/ { L1_I8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 125 | /*0x4A*/ { L1_J8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 126 | /*0x4B*/ { L1_K8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 127 | /*0x4C*/ { L1_L8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 128 | /*0x4D*/ { L1_M8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 129 | /*0x4E*/ { L1_N8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 130 | /*0x4F*/ { L1_O8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 131 | /*0x50*/ { L1_P8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 132 | /*0x51*/ { L1_Q8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 133 | /*0x52*/ { L1_R8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 134 | /*0x53*/ { L1_S8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 135 | /*0x54*/ { L1_T8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 136 | /*0x55*/ { L1_U8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 137 | /*0x56*/ { L1_V8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 138 | /*0x57*/ { L1_W8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 139 | /*0x58*/ { L1_X8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 140 | /*0x59*/ { L1_Y8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 141 | /*0x5A*/ { L1_Z8, L2_BLANK, L3_BLANK, L4_CAP, M }, |
| 142 | /*0x5B*/ { IGNORE, IGNORE, L3_L_BRACKET, IGNORE, M }, |
| 143 | /*0x5C*/ { IGNORE, IGNORE, L3_BK_SOLIDUS, IGNORE, M }, |
| 144 | /*0x5D*/ { IGNORE, IGNORE, L3_R_BRACKET, IGNORE, M }, |
| 145 | /*0x5E*/ { IGNORE, IGNORE, L3_CIRCUMFLEX, IGNORE, M }, |
| 146 | /*0x5F*/ { IGNORE, IGNORE, L3_LOW_LINE, IGNORE, M }, |
| 147 | /*0x60*/ { IGNORE, IGNORE, L3_GRAVE, IGNORE, M }, |
| 148 | /*0x61*/ { L1_A8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 149 | /*0x62*/ { L1_B8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 150 | /*0x63*/ { L1_C8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 151 | /*0x64*/ { L1_D8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 152 | /*0x65*/ { L1_E8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 153 | /*0x66*/ { L1_F8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 154 | /*0x67*/ { L1_G8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 155 | /*0x68*/ { L1_H8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 156 | /*0x69*/ { L1_I8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 157 | /*0x6A*/ { L1_J8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 158 | /*0x6B*/ { L1_K8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 159 | /*0x6C*/ { L1_L8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 160 | /*0x6D*/ { L1_M8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 161 | /*0x6E*/ { L1_N8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 162 | /*0x6F*/ { L1_O8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 163 | /*0x70*/ { L1_P8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 164 | /*0x71*/ { L1_Q8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 165 | /*0x72*/ { L1_R8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 166 | /*0x73*/ { L1_S8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 167 | /*0x74*/ { L1_T8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 168 | /*0x75*/ { L1_U8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 169 | /*0x76*/ { L1_V8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 170 | /*0x77*/ { L1_W8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 171 | /*0x78*/ { L1_X8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 172 | /*0x79*/ { L1_Y8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 173 | /*0x7A*/ { L1_Z8, L2_BLANK, L3_BLANK, L4_MIN, M }, |
| 174 | /*0x7B*/ { IGNORE, IGNORE, L3_L_BRACE, IGNORE, M }, |
| 175 | /*0x7C*/ { IGNORE, IGNORE, L3_V_LINE, IGNORE, M }, |
| 176 | /*0x7D*/ { IGNORE, IGNORE, L3_R_BRACE, IGNORE, M }, |
| 177 | /*0x7E*/ { IGNORE, IGNORE, L3_TILDE, IGNORE, M }, |
| 178 | /*0x7F*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 179 | /*0x80*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 180 | /*0x81*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 181 | /*0x82*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 182 | /*0x83*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 183 | /*0x84*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 184 | /*0x85*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 185 | /*0x86*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 186 | /*0x87*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 187 | /*0x88*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 188 | /*0x89*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 189 | /*0x8A*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 190 | /*0x8B*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 191 | /*0x8C*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 192 | /*0x8D*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 193 | /*0x8E*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 194 | /*0x8F*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 195 | /*0x90*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 196 | /*0x91*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 197 | /*0x92*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 198 | /*0x93*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 199 | /*0x94*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 200 | /*0x95*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 201 | /*0x96*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 202 | /*0x97*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 203 | /*0x98*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 204 | /*0x99*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 205 | /*0x9A*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 206 | /*0x9B*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 207 | /*0x9C*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 208 | /*0x9D*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 209 | /*0x9E*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 210 | /*0x9F*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 211 | /*0xA0*/ { IGNORE, IGNORE, L3_NB_SACE, IGNORE, X }, |
| 212 | /*0xA1*/ { L1_KO_KAI, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 213 | /*0xA2*/ { L1_KHO_KHAI, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 214 | /*0xA3*/ { L1_KHO_KHUAT, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 215 | /*0xA4*/ { L1_KHO_KHWAI, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 216 | /*0xA5*/ { L1_KHO_KHON, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 217 | /*0xA6*/ { L1_KHO_RAKHANG, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 218 | /*0xA7*/ { L1_NGO_NGU, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 219 | /*0xA8*/ { L1_CHO_CHAN, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 220 | /*0xA9*/ { L1_CHO_CHING, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 221 | /*0xAA*/ { L1_CHO_CHANG, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 222 | /*0xAB*/ { L1_SO_SO, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 223 | /*0xAC*/ { L1_CHO_CHOE, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 224 | /*0xAD*/ { L1_YO_YING, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 225 | /*0xAE*/ { L1_DO_CHADA, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 226 | /*0xAF*/ { L1_TO_PATAK, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 227 | /*0xB0*/ { L1_THO_THAN, L2_BLANK,L3_BLANK, L4_BLANK, M | _consnt}, |
| 228 | /*0xB1*/ { L1_THO_NANGMONTHO, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 229 | /*0xB2*/ { L1_THO_PHUTHAO, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 230 | /*0xB3*/ { L1_NO_NEN, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 231 | /*0xB4*/ { L1_DO_DEK, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 232 | /*0xB5*/ { L1_TO_TAO, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 233 | /*0xB6*/ { L1_THO_THUNG, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 234 | /*0xB7*/ { L1_THO_THAHAN, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 235 | /*0xB8*/ { L1_THO_THONG, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 236 | /*0xB9*/ { L1_NO_NU, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 237 | /*0xBA*/ { L1_BO_BAIMAI, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 238 | /*0xBB*/ { L1_PO_PLA, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 239 | /*0xBC*/ { L1_PHO_PHUNG, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 240 | /*0xBD*/ { L1_FO_FA, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 241 | /*0xBE*/ { L1_PHO_PHAN, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 242 | /*0xBF*/ { L1_FO_FAN, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 243 | /*0xC0*/ { L1_PHO_SAMPHAO, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 244 | /*0xC1*/ { L1_MO_MA, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 245 | /*0xC2*/ { L1_YO_YAK, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 246 | /*0xC3*/ { L1_RO_RUA, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 247 | /*0xC4*/ { L1_RU, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 248 | /*0xC5*/ { L1_LO_LING, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 249 | /*0xC6*/ { L1_LU, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 250 | /*0xC7*/ { L1_WO_WAEN, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 251 | /*0xC8*/ { L1_SO_SALA, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 252 | /*0xC9*/ { L1_SO_RUSI, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 253 | /*0xCA*/ { L1_SO_SUA, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 254 | /*0xCB*/ { L1_HO_HIP, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 255 | /*0xCC*/ { L1_LO_CHULA, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 256 | /*0xCD*/ { L1_O_ANG, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 257 | /*0xCE*/ { L1_HO_NOKHUK, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, |
| 258 | /*0xCF*/ { IGNORE, IGNORE, L3_PAIYAN_NOI, IGNORE, M}, |
| 259 | /*0xD0*/ { L1_SARA_A, L2_BLANK, L3_BLANK, L4_BLANK, M | _fllwvowel}, |
| 260 | /*0xD1*/ { L1_MAI_HAN_AKAT, L2_BLANK, L3_BLANK, L4_BLANK, U | _uprvowel}, |
| 261 | /*0xD2*/ { L1_SARA_AA, L2_BLANK, L3_BLANK, L4_BLANK, M | _fllwvowel}, |
| 262 | /*0xD3*/ { L1_SARA_AM, L2_BLANK, L3_BLANK, L4_BLANK, M | _fllwvowel}, |
| 263 | /*0xD4*/ { L1_SARA_I, L2_BLANK, L3_BLANK, L4_BLANK, U | _uprvowel}, |
| 264 | /*0xD5*/ { L1_SARA_II, L2_BLANK, L3_BLANK, L4_BLANK, U | _uprvowel}, |
| 265 | /*0xD6*/ { L1_SARA_UE, L2_BLANK, L3_BLANK, L4_BLANK, U | _uprvowel}, |
| 266 | /*0xD7*/ { L1_SARA_UEE, L2_BLANK, L3_BLANK, L4_BLANK, U | _uprvowel}, |
| 267 | /*0xD8*/ { L1_SARA_U, L2_BLANK, L3_BLANK, L4_BLANK, L | _lwrvowel}, |
| 268 | /*0xD9*/ { L1_SARA_UU, L2_BLANK, L3_BLANK, L4_BLANK, L | _lwrvowel}, |
| 269 | /*0xDA*/ { IGNORE, L2_PINTHU, L3_BLANK, L4_BLANK, L }, |
| 270 | /*0xDB*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 271 | /*0xDC*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 272 | /*0xDD*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 273 | /*0xDE*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 274 | /*0xDF*/ { IGNORE, IGNORE, L3_BAHT, IGNORE, M}, |
| 275 | /*0xE0*/ { L1_SARA_E, L2_BLANK, L3_BLANK, L4_BLANK, M | _ldvowel }, |
| 276 | /*0xE1*/ { L1_SARA_AE, L2_BLANK, L3_BLANK, L4_BLANK, M | _ldvowel }, |
| 277 | /*0xE2*/ { L1_SARA_O, L2_BLANK, L3_BLANK, L4_BLANK, M | _ldvowel }, |
| 278 | /*0xE3*/ { L1_SARA_AI_MAIMUAN, L2_BLANK, L3_BLANK, L4_BLANK, M | _ldvowel }, |
| 279 | /*0xE4*/ { L1_SARA_AI_MAIMALAI, L2_BLANK, L3_BLANK, L4_BLANK, M | _ldvowel }, |
| 280 | /*0xE5*/ { L1_SARA_AA, L2_BLANK, L3_BLANK, L4_EXT, M | _fllwvowel }, |
| 281 | /*0xE6*/ { IGNORE, IGNORE, L3_MAI_YAMOK, IGNORE, M | _stone }, |
| 282 | /*0xE7*/ { IGNORE, L2_TYKHU, L3_BLANK, L4_BLANK, U | _diacrt1 | _stone }, |
| 283 | /*0xE8*/ { IGNORE, L2_TONE1, L3_BLANK, L4_BLANK, UU | _tone | _combine | _stone }, |
| 284 | /*0xE9*/ { IGNORE, L2_TONE2, L3_BLANK, L4_BLANK, UU | _tone | _combine | _stone }, |
| 285 | /*0xEA*/ { IGNORE, L2_TONE3, L3_BLANK, L4_BLANK, UU | _tone | _combine | _stone }, |
| 286 | /*0xEB*/ { IGNORE, L2_TONE4, L3_BLANK, L4_BLANK, UU | _tone | _combine | _stone }, |
| 287 | /*0xEC*/ { IGNORE, L2_GARAN, L3_BLANK, L4_BLANK, UU | _diacrt2 | _combine | _stone }, |
| 288 | /*0xED*/ { L1_NKHIT, L2_BLANK, L3_BLANK, L4_BLANK, U | _diacrt1 }, |
| 289 | /*0xEE*/ { IGNORE, L2_YAMAK, L3_BLANK, L4_BLANK, U | _diacrt1 }, |
| 290 | /*0xEF*/ { IGNORE, IGNORE, L3_FONGMAN, IGNORE, M }, |
| 291 | /*0xF0*/ { L1_08, L2_THAII, L3_BLANK, L4_BLANK, M | _tdig }, |
| 292 | /*0xF1*/ { L1_18, L2_THAII, L3_BLANK, L4_BLANK, M | _tdig }, |
| 293 | /*0xF2*/ { L1_28, L2_THAII, L3_BLANK, L4_BLANK, M | _tdig }, |
| 294 | /*0xF3*/ { L1_38, L2_THAII, L3_BLANK, L4_BLANK, M | _tdig }, |
| 295 | /*0xF4*/ { L1_48, L2_THAII, L3_BLANK, L4_BLANK, M | _tdig }, |
| 296 | /*0xF5*/ { L1_58, L2_THAII, L3_BLANK, L4_BLANK, M | _tdig }, |
| 297 | /*0xF6*/ { L1_68, L2_THAII, L3_BLANK, L4_BLANK, M | _tdig }, |
| 298 | /*0xF7*/ { L1_78, L2_THAII, L3_BLANK, L4_BLANK, M | _tdig }, |
| 299 | /*0xF8*/ { L1_88, L2_THAII, L3_BLANK, L4_BLANK, M | _tdig }, |
| 300 | /*0xF9*/ { L1_98, L2_THAII, L3_BLANK, L4_BLANK, M | _tdig }, |
| 301 | /*0xFA*/ { IGNORE, IGNORE, L3_ANGKHANKHU, IGNORE, X }, |
| 302 | /*0xFB*/ { IGNORE, IGNORE, L3_KHOMUT, IGNORE, X }, |
| 303 | /*0xFC*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 304 | /*0xFD*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 305 | /*0xFE*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, |
| 306 | /* Utilize 0xFF for max_sort_chr in my_like_range_tis620 */ |
| 307 | /*0xFF*/ { 255 /*IGNORE*/, IGNORE, IGNORE, IGNORE, X }, |
| 308 | }; |
| 309 | |
| 310 | static uchar ctype_tis620[257] = |
| 311 | { |
| 312 | 0, /* For standard library */ |
| 313 | 32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32, |
| 314 | 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, |
| 315 | 72,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, |
| 316 | 132,132,132,132,132,132,132,132,132,132,16,16,16,16,16,16, |
| 317 | 16,129,129,129,129,129,129,1,1,1,1,1,1,1,1,1, |
| 318 | 1,1,1,1,1,1,1,1,1,1,1,16,16,16,16,16, |
| 319 | 16,130,130,130,130,130,130,2,2,2,2,2,2,2,2,2, |
| 320 | 2,2,2,2,2,2,2,2,2,2,2,16,16,16,16,32, |
| 321 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 322 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 323 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 324 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 325 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 326 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 327 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 328 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 329 | }; |
| 330 | |
| 331 | static uchar to_lower_tis620[]= |
| 332 | { |
| 333 | '\000','\001','\002','\003','\004','\005','\006','\007', |
| 334 | '\010','\011','\012','\013','\014','\015','\016','\017', |
| 335 | '\020','\021','\022','\023','\024','\025','\026','\027', |
| 336 | '\030','\031','\032','\033','\034','\035','\036','\037', |
| 337 | ' ', '!', '"', '#', '$', '%', '&', '\'', |
| 338 | '(', ')', '*', '+', ',', '-', '.', '/', |
| 339 | '0', '1', '2', '3', '4', '5', '6', '7', |
| 340 | '8', '9', ':', ';', '<', '=', '>', '?', |
| 341 | '@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', |
| 342 | 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', |
| 343 | 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', |
| 344 | 'x', 'y', 'z', '[', '\\', ']', '^', '_', |
| 345 | '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', |
| 346 | 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', |
| 347 | 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', |
| 348 | 'x', 'y', 'z', '{', '|', '}', '~', '\177', |
| 349 | (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', |
| 350 | (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', |
| 351 | (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', |
| 352 | (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', |
| 353 | (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', |
| 354 | (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', |
| 355 | (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', |
| 356 | (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', |
| 357 | (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', |
| 358 | (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', |
| 359 | (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', |
| 360 | (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', |
| 361 | (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', |
| 362 | (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', |
| 363 | (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', |
| 364 | (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', |
| 365 | }; |
| 366 | |
| 367 | static uchar to_upper_tis620[]= |
| 368 | { |
| 369 | '\000','\001','\002','\003','\004','\005','\006','\007', |
| 370 | '\010','\011','\012','\013','\014','\015','\016','\017', |
| 371 | '\020','\021','\022','\023','\024','\025','\026','\027', |
| 372 | '\030','\031','\032','\033','\034','\035','\036','\037', |
| 373 | ' ', '!', '"', '#', '$', '%', '&', '\'', |
| 374 | '(', ')', '*', '+', ',', '-', '.', '/', |
| 375 | '0', '1', '2', '3', '4', '5', '6', '7', |
| 376 | '8', '9', ':', ';', '<', '=', '>', '?', |
| 377 | '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', |
| 378 | 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', |
| 379 | 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', |
| 380 | 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', |
| 381 | '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', |
| 382 | 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', |
| 383 | 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', |
| 384 | 'X', 'Y', 'Z', '{', '|', '}', '~', '\177', |
| 385 | (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', |
| 386 | (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', |
| 387 | (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', |
| 388 | (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', |
| 389 | (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', |
| 390 | (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', |
| 391 | (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', |
| 392 | (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', |
| 393 | (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', |
| 394 | (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', |
| 395 | (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', |
| 396 | (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', |
| 397 | (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', |
| 398 | (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', |
| 399 | (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', |
| 400 | (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', |
| 401 | }; |
| 402 | |
| 403 | static const uchar sort_order_tis620[]= |
| 404 | { |
| 405 | '\000','\001','\002','\003','\004','\005','\006','\007', |
| 406 | '\010','\011','\012','\013','\014','\015','\016','\017', |
| 407 | '\020','\021','\022','\023','\024','\025','\026','\027', |
| 408 | '\030','\031','\032','\033','\034','\035','\036','\037', |
| 409 | ' ', '!', '"', '#', '$', '%', '&', '\'', |
| 410 | '(', ')', '*', '+', ',', '-', '.', '/', |
| 411 | '0', '1', '2', '3', '4', '5', '6', '7', |
| 412 | '8', '9', ':', ';', '<', '=', '>', '?', |
| 413 | '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', |
| 414 | 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', |
| 415 | 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', |
| 416 | 'X', 'Y', 'Z', '\\', ']', '[', '^', '_', |
| 417 | 'E', 'A', 'B', 'C', 'D', 'E', 'F', 'G', |
| 418 | 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', |
| 419 | 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', |
| 420 | 'X', 'Y', 'Z', '{', '|', '}', 'Y', '\177', |
| 421 | (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', |
| 422 | (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', |
| 423 | (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', |
| 424 | (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', |
| 425 | (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', |
| 426 | (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', |
| 427 | (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', |
| 428 | (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', |
| 429 | (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', |
| 430 | (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', |
| 431 | (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', |
| 432 | (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', |
| 433 | (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', |
| 434 | (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', |
| 435 | (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', |
| 436 | (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', |
| 437 | }; |
| 438 | |
| 439 | |
| 440 | /* |
| 441 | Convert thai string to "Standard C String Function" sortable string |
| 442 | |
| 443 | SYNOPSIS |
| 444 | thai2sortable() |
| 445 | tstr String to convert. Does not have to end with \0 |
| 446 | len Length of tstr |
| 447 | */ |
| 448 | |
| 449 | static size_t thai2sortable(uchar *tstr, size_t len) |
| 450 | { |
| 451 | uchar *p; |
| 452 | size_t tlen; |
| 453 | uchar l2bias; |
| 454 | |
| 455 | tlen= len; |
| 456 | l2bias= 256 - 8; |
| 457 | for (p= tstr; tlen > 0; p++, tlen--) |
| 458 | { |
| 459 | uchar c= *p; |
| 460 | |
| 461 | if (isthai(c)) |
| 462 | { |
| 463 | const int *t_ctype0= t_ctype[c]; |
| 464 | |
| 465 | if (isconsnt(c)) |
| 466 | l2bias -= 8; |
| 467 | if (isldvowel(c) && tlen != 1 && isconsnt(p[1])) |
| 468 | { |
| 469 | /* simply swap between leading-vowel and consonant */ |
| 470 | *p= p[1]; |
| 471 | p[1]= c; |
| 472 | tlen--; |
| 473 | p++; |
| 474 | continue; |
| 475 | } |
| 476 | |
| 477 | /* if found level 2 char (L2_GARAN,L2_TONE*,L2_TYKHU) move to last */ |
| 478 | if (t_ctype0[1] >= L2_GARAN) |
| 479 | { |
| 480 | /* |
| 481 | l2bias use to control position weight of l2char |
| 482 | example (*=l2char) XX*X must come before X*XX |
| 483 | */ |
| 484 | memmove((char*) p, (char*) (p+1), tlen-1); |
| 485 | tstr[len-1]= l2bias + t_ctype0[1]- L2_GARAN +1; |
| 486 | p--; |
| 487 | continue; |
| 488 | } |
| 489 | } |
| 490 | else |
| 491 | { |
| 492 | l2bias-= 8; |
| 493 | *p= to_lower_tis620[c]; |
| 494 | } |
| 495 | } |
| 496 | return len; |
| 497 | } |
| 498 | |
| 499 | |
| 500 | /* |
| 501 | strncoll() replacement, compare 2 string, both are converted to sortable |
| 502 | string |
| 503 | |
| 504 | NOTE: |
| 505 | We can't cut strings at end \0 as this would break comparison with |
| 506 | LIKE characters, where the min range is stored as end \0 |
| 507 | |
| 508 | Arg: 2 Strings and it compare length |
| 509 | Ret: strcmp result |
| 510 | */ |
| 511 | |
| 512 | static |
| 513 | int my_strnncoll_tis620(CHARSET_INFO *cs __attribute__((unused)), |
| 514 | const uchar *s1, size_t len1, |
| 515 | const uchar *s2, size_t len2, |
| 516 | my_bool s2_is_prefix) |
| 517 | { |
| 518 | uchar buf[80] ; |
| 519 | uchar *tc1, *tc2; |
| 520 | int i; |
| 521 | |
| 522 | if (s2_is_prefix && len1 > len2) |
| 523 | len1= len2; |
| 524 | |
| 525 | tc1= buf; |
| 526 | if ((len1 + len2 +2) > (int) sizeof(buf)) |
| 527 | tc1= (uchar*) my_malloc(len1+len2+2, MYF(MY_FAE)); |
| 528 | tc2= tc1 + len1+1; |
| 529 | memcpy((char*) tc1, (char*) s1, len1); |
| 530 | tc1[len1]= 0; /* if length(s1)> len1, need to put 'end of string' */ |
| 531 | memcpy((char *)tc2, (char *)s2, len2); |
| 532 | tc2[len2]= 0; /* put end of string */ |
| 533 | thai2sortable(tc1, len1); |
| 534 | thai2sortable(tc2, len2); |
| 535 | i= strcmp((char*)tc1, (char*)tc2); |
| 536 | if (tc1 != buf) |
| 537 | my_free(tc1); |
| 538 | return i; |
| 539 | } |
| 540 | |
| 541 | |
| 542 | static |
| 543 | int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)), |
| 544 | const uchar *a0, size_t a_length, |
| 545 | const uchar *b0, size_t b_length) |
| 546 | { |
| 547 | uchar buf[80], *end, *a, *b, *alloced= NULL; |
| 548 | size_t length; |
| 549 | int res= 0; |
| 550 | |
| 551 | a= buf; |
| 552 | if ((a_length + b_length +2) > (int) sizeof(buf)) |
| 553 | alloced= a= (uchar*) my_malloc(a_length+b_length+2, MYF(MY_FAE)); |
| 554 | |
| 555 | b= a + a_length+1; |
| 556 | memcpy((char*) a, (char*) a0, a_length); |
| 557 | a[a_length]= 0; /* if length(a0)> len1, need to put 'end of string' */ |
| 558 | memcpy((char *)b, (char *)b0, b_length); |
| 559 | b[b_length]= 0; /* put end of string */ |
| 560 | a_length= thai2sortable(a, a_length); |
| 561 | b_length= thai2sortable(b, b_length); |
| 562 | |
| 563 | end= a + (length= MY_MIN(a_length, b_length)); |
| 564 | while (a < end) |
| 565 | { |
| 566 | if (*a++ != *b++) |
| 567 | { |
| 568 | res= ((int) a[-1] - (int) b[-1]); |
| 569 | goto ret; |
| 570 | } |
| 571 | } |
| 572 | |
| 573 | res= a_length == b_length ? 0 : |
| 574 | a_length < b_length ? |
| 575 | -my_strnncollsp_padspace_bin(b, b_length - length) : |
| 576 | my_strnncollsp_padspace_bin(a, a_length - length); |
| 577 | |
| 578 | ret: |
| 579 | |
| 580 | if (alloced) |
| 581 | my_free(alloced); |
| 582 | return res; |
| 583 | } |
| 584 | |
| 585 | |
| 586 | static |
| 587 | int my_strnncollsp_tis620_nopad(CHARSET_INFO * cs __attribute__((unused)), |
| 588 | const uchar *a0, size_t a_length, |
| 589 | const uchar *b0, size_t b_length) |
| 590 | { |
| 591 | return my_strnncoll_tis620(cs, a0, a_length, b0, b_length, FALSE); |
| 592 | } |
| 593 | /* |
| 594 | strnxfrm replacment, convert Thai string to sortable string |
| 595 | |
| 596 | Arg: Destination buffer, source string, dest length and source length |
| 597 | Ret: Converted string size |
| 598 | */ |
| 599 | |
| 600 | static size_t |
| 601 | my_strnxfrm_tis620(CHARSET_INFO *cs, |
| 602 | uchar *dst, size_t dstlen, uint nweights, |
| 603 | const uchar *src, size_t srclen, uint flags) |
| 604 | { |
| 605 | size_t len, dstlen0= dstlen; |
| 606 | len= (uint) (strmake((char*) dst, (char*) src, MY_MIN(dstlen, srclen)) - |
| 607 | (char*) dst); |
| 608 | len= thai2sortable(dst, len); |
| 609 | set_if_smaller(dstlen, nweights); |
| 610 | set_if_smaller(len, dstlen); |
| 611 | len= my_strxfrm_pad_desc_and_reverse(cs, dst, dst + len, dst + dstlen, |
| 612 | (uint)(dstlen - len), flags, 0); |
| 613 | if ((flags & MY_STRXFRM_PAD_TO_MAXLEN) && len < dstlen0) |
| 614 | { |
| 615 | size_t fill_length= dstlen0 - len; |
| 616 | cs->cset->fill(cs, (char*) dst + len, fill_length, cs->pad_char); |
| 617 | len= dstlen0; |
| 618 | } |
| 619 | return len; |
| 620 | } |
| 621 | |
| 622 | |
| 623 | static size_t |
| 624 | my_strnxfrm_tis620_nopad(CHARSET_INFO *cs, |
| 625 | uchar *dst, size_t dstlen, uint nweights, |
| 626 | const uchar *src, size_t srclen, uint flags) |
| 627 | { |
| 628 | size_t len, dstlen0= dstlen; |
| 629 | len= (uint) (strmake((char*) dst, (char*) src, MY_MIN(dstlen, srclen)) - |
| 630 | (char*) dst); |
| 631 | len= thai2sortable(dst, len); |
| 632 | set_if_smaller(dstlen, nweights); |
| 633 | set_if_smaller(len, dstlen); |
| 634 | len= my_strxfrm_pad_desc_and_reverse_nopad(cs, dst, dst + len, dst + dstlen, |
| 635 | (uint)(dstlen - len), flags, 0); |
| 636 | if ((flags & MY_STRXFRM_PAD_TO_MAXLEN) && len < dstlen0) |
| 637 | { |
| 638 | size_t fill_length= dstlen0 - len; |
| 639 | memset(dst + len, 0x00, fill_length); |
| 640 | len= dstlen0; |
| 641 | } |
| 642 | return len; |
| 643 | } |
| 644 | |
| 645 | |
| 646 | static const unsigned short cs_to_uni[256]={ |
| 647 | 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, |
| 648 | 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, |
| 649 | 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, |
| 650 | 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, |
| 651 | 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, |
| 652 | 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, |
| 653 | 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, |
| 654 | 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, |
| 655 | 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, |
| 656 | 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, |
| 657 | 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, |
| 658 | 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, |
| 659 | 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, |
| 660 | 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, |
| 661 | 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, |
| 662 | 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, |
| 663 | 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, |
| 664 | 0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, |
| 665 | 0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, |
| 666 | 0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, |
| 667 | 0xFFFD,0x0E01,0x0E02,0x0E03,0x0E04,0x0E05,0x0E06,0x0E07, |
| 668 | 0x0E08,0x0E09,0x0E0A,0x0E0B,0x0E0C,0x0E0D,0x0E0E,0x0E0F, |
| 669 | 0x0E10,0x0E11,0x0E12,0x0E13,0x0E14,0x0E15,0x0E16,0x0E17, |
| 670 | 0x0E18,0x0E19,0x0E1A,0x0E1B,0x0E1C,0x0E1D,0x0E1E,0x0E1F, |
| 671 | 0x0E20,0x0E21,0x0E22,0x0E23,0x0E24,0x0E25,0x0E26,0x0E27, |
| 672 | 0x0E28,0x0E29,0x0E2A,0x0E2B,0x0E2C,0x0E2D,0x0E2E,0x0E2F, |
| 673 | 0x0E30,0x0E31,0x0E32,0x0E33,0x0E34,0x0E35,0x0E36,0x0E37, |
| 674 | 0x0E38,0x0E39,0x0E3A,0xFFFD,0xFFFD,0xFFFD,0xFFFD,0x0E3F, |
| 675 | 0x0E40,0x0E41,0x0E42,0x0E43,0x0E44,0x0E45,0x0E46,0x0E47, |
| 676 | 0x0E48,0x0E49,0x0E4A,0x0E4B,0x0E4C,0x0E4D,0x0E4E,0x0E4F, |
| 677 | 0x0E50,0x0E51,0x0E52,0x0E53,0x0E54,0x0E55,0x0E56,0x0E57, |
| 678 | 0x0E58,0x0E59,0x0E5A,0x0E5B,0xFFFD,0xFFFD,0xFFFD,0xFFFD |
| 679 | }; |
| 680 | static const uchar pl00[256]={ |
| 681 | 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, |
| 682 | 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, |
| 683 | 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, |
| 684 | 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, |
| 685 | 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, |
| 686 | 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, |
| 687 | 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, |
| 688 | 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, |
| 689 | 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, |
| 690 | 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, |
| 691 | 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, |
| 692 | 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, |
| 693 | 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, |
| 694 | 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, |
| 695 | 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, |
| 696 | 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, |
| 697 | 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, |
| 698 | 0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, |
| 699 | 0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, |
| 700 | 0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, |
| 701 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 702 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 703 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 704 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 705 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 706 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 707 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 708 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 709 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 710 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 711 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 712 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 |
| 713 | }; |
| 714 | static const uchar pl0E[256]={ |
| 715 | 0x0000,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, |
| 716 | 0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF, |
| 717 | 0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, |
| 718 | 0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF, |
| 719 | 0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7, |
| 720 | 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF, |
| 721 | 0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7, |
| 722 | 0x00D8,0x00D9,0x00DA,0x0000,0x0000,0x0000,0x0000,0x00DF, |
| 723 | 0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7, |
| 724 | 0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF, |
| 725 | 0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7, |
| 726 | 0x00F8,0x00F9,0x00FA,0x00FB,0x0000,0x0000,0x0000,0x0000, |
| 727 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 728 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 729 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 730 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 731 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 732 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 733 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 734 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 735 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 736 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 737 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 738 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 739 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 740 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 741 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 742 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 743 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 744 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 745 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 746 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 |
| 747 | }; |
| 748 | static const uchar plFF[256]={ |
| 749 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 750 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 751 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 752 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 753 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 754 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 755 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 756 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 757 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 758 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 759 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 760 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 761 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 762 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 763 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 764 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 765 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 766 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 767 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 768 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 769 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 770 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 771 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 772 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 773 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 774 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 775 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 776 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 777 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 778 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 779 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, |
| 780 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x00FF,0x0000,0x0000 |
| 781 | }; |
| 782 | static const uchar *const uni_to_cs[256]={ |
| 783 | pl00,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 784 | NULL,NULL,NULL,NULL,NULL,NULL,pl0E,NULL, |
| 785 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 786 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 787 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 788 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 789 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 790 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 791 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 792 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 793 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 794 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 795 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 796 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 797 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 798 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 799 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 800 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 801 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 802 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 803 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 804 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 805 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 806 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 807 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 808 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 809 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 810 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 811 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 812 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 813 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
| 814 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,plFF |
| 815 | }; |
| 816 | |
| 817 | |
| 818 | static |
| 819 | int my_mb_wc_tis620(CHARSET_INFO *cs __attribute__((unused)), |
| 820 | my_wc_t *wc, |
| 821 | const uchar *str, |
| 822 | const uchar *end __attribute__((unused))) |
| 823 | { |
| 824 | if (str >= end) |
| 825 | return MY_CS_TOOSMALL; |
| 826 | |
| 827 | *wc=cs_to_uni[*str]; |
| 828 | return (!wc[0] && str[0]) ? -1 : 1; |
| 829 | } |
| 830 | |
| 831 | static |
| 832 | int my_wc_mb_tis620(CHARSET_INFO *cs __attribute__((unused)), |
| 833 | my_wc_t wc, |
| 834 | uchar *str, |
| 835 | uchar *end __attribute__((unused))) |
| 836 | { |
| 837 | const uchar *pl; |
| 838 | |
| 839 | if (str >= end) |
| 840 | return MY_CS_TOOSMALL; |
| 841 | |
| 842 | pl= uni_to_cs[(wc>>8) & 0xFF]; |
| 843 | str[0]= pl ? pl[wc & 0xFF] : '\0'; |
| 844 | return (!str[0] && wc) ? MY_CS_ILUNI : 1; |
| 845 | } |
| 846 | |
| 847 | |
| 848 | static MY_COLLATION_HANDLER my_collation_ci_handler = |
| 849 | { |
| 850 | NULL, /* init */ |
| 851 | my_strnncoll_tis620, |
| 852 | my_strnncollsp_tis620, |
| 853 | my_strnxfrm_tis620, |
| 854 | my_strnxfrmlen_simple, |
| 855 | my_like_range_simple, |
| 856 | my_wildcmp_8bit, /* wildcmp */ |
| 857 | my_strcasecmp_8bit, |
| 858 | my_instr_simple, /* QQ: To be fixed */ |
| 859 | my_hash_sort_simple, |
| 860 | my_propagate_simple |
| 861 | }; |
| 862 | |
| 863 | static MY_COLLATION_HANDLER my_collation_nopad_ci_handler = |
| 864 | { |
| 865 | NULL, /* init */ |
| 866 | my_strnncoll_tis620, |
| 867 | my_strnncollsp_tis620_nopad, |
| 868 | my_strnxfrm_tis620_nopad, |
| 869 | my_strnxfrmlen_simple, |
| 870 | my_like_range_simple, |
| 871 | my_wildcmp_8bit, /* wildcmp */ |
| 872 | my_strcasecmp_8bit, |
| 873 | my_instr_simple, /* QQ: To be fixed */ |
| 874 | my_hash_sort_simple_nopad, |
| 875 | my_propagate_simple |
| 876 | }; |
| 877 | |
| 878 | static MY_CHARSET_HANDLER my_charset_handler= |
| 879 | { |
| 880 | NULL, /* init */ |
| 881 | my_numchars_8bit, |
| 882 | my_charpos_8bit, |
| 883 | my_lengthsp_8bit, |
| 884 | my_numcells_8bit, |
| 885 | my_mb_wc_tis620, /* mb_wc */ |
| 886 | my_wc_mb_tis620, /* wc_mb */ |
| 887 | my_mb_ctype_8bit, |
| 888 | my_caseup_str_8bit, |
| 889 | my_casedn_str_8bit, |
| 890 | my_caseup_8bit, |
| 891 | my_casedn_8bit, |
| 892 | my_snprintf_8bit, |
| 893 | my_long10_to_str_8bit, |
| 894 | my_longlong10_to_str_8bit, |
| 895 | my_fill_8bit, |
| 896 | my_strntol_8bit, |
| 897 | my_strntoul_8bit, |
| 898 | my_strntoll_8bit, |
| 899 | my_strntoull_8bit, |
| 900 | my_strntod_8bit, |
| 901 | my_strtoll10_8bit, |
| 902 | my_strntoull10rnd_8bit, |
| 903 | my_scan_8bit, |
| 904 | my_charlen_8bit, |
| 905 | my_well_formed_char_length_8bit, |
| 906 | my_copy_8bit, |
| 907 | my_wc_mb_bin, /* native_to_mb */ |
| 908 | }; |
| 909 | |
| 910 | |
| 911 | |
| 912 | struct charset_info_st my_charset_tis620_thai_ci= |
| 913 | { |
| 914 | 18,0,0, /* number */ |
| 915 | MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM|MY_CS_NON1TO1, /* state */ |
| 916 | "tis620" , /* cs name */ |
| 917 | "tis620_thai_ci" , /* name */ |
| 918 | "" , /* comment */ |
| 919 | NULL, /* tailoring */ |
| 920 | ctype_tis620, |
| 921 | to_lower_tis620, |
| 922 | to_upper_tis620, |
| 923 | sort_order_tis620, |
| 924 | NULL, /* uca */ |
| 925 | NULL, /* tab_to_uni */ |
| 926 | NULL, /* tab_from_uni */ |
| 927 | &my_unicase_default,/* caseinfo */ |
| 928 | NULL, /* state_map */ |
| 929 | NULL, /* ident_map */ |
| 930 | 4, /* strxfrm_multiply */ |
| 931 | 1, /* caseup_multiply */ |
| 932 | 1, /* casedn_multiply */ |
| 933 | 1, /* mbminlen */ |
| 934 | 1, /* mbmaxlen */ |
| 935 | 0, /* min_sort_char */ |
| 936 | 255, /* max_sort_char */ |
| 937 | ' ', /* pad char */ |
| 938 | 0, /* escape_with_backslash_is_dangerous */ |
| 939 | 1, /* levels_for_order */ |
| 940 | &my_charset_handler, |
| 941 | &my_collation_ci_handler |
| 942 | }; |
| 943 | |
| 944 | struct charset_info_st my_charset_tis620_bin= |
| 945 | { |
| 946 | 89,0,0, /* number */ |
| 947 | MY_CS_COMPILED|MY_CS_BINSORT, /* state */ |
| 948 | "tis620" , /* cs name */ |
| 949 | "tis620_bin" , /* name */ |
| 950 | "" , /* comment */ |
| 951 | NULL, /* tailoring */ |
| 952 | ctype_tis620, |
| 953 | to_lower_tis620, |
| 954 | to_upper_tis620, |
| 955 | NULL, /* sort_order */ |
| 956 | NULL, /* uca */ |
| 957 | NULL, /* tab_to_uni */ |
| 958 | NULL, /* tab_from_uni */ |
| 959 | &my_unicase_default,/* caseinfo */ |
| 960 | NULL, /* state_map */ |
| 961 | NULL, /* ident_map */ |
| 962 | 1, /* strxfrm_multiply */ |
| 963 | 1, /* caseup_multiply */ |
| 964 | 1, /* casedn_multiply */ |
| 965 | 1, /* mbminlen */ |
| 966 | 1, /* mbmaxlen */ |
| 967 | 0, /* min_sort_char */ |
| 968 | 255, /* max_sort_char */ |
| 969 | ' ', /* pad char */ |
| 970 | 0, /* escape_with_backslash_is_dangerous */ |
| 971 | 1, /* levels_for_order */ |
| 972 | &my_charset_handler, |
| 973 | &my_collation_8bit_bin_handler |
| 974 | }; |
| 975 | |
| 976 | |
| 977 | struct charset_info_st my_charset_tis620_thai_nopad_ci= |
| 978 | { |
| 979 | MY_NOPAD_ID(18),0,0, /* number */ |
| 980 | MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_NON1TO1|MY_CS_NOPAD, /* state */ |
| 981 | "tis620" , /* cs name */ |
| 982 | "tis620_thai_nopad_ci" ,/* name */ |
| 983 | "" , /* comment */ |
| 984 | NULL, /* tailoring */ |
| 985 | ctype_tis620, |
| 986 | to_lower_tis620, |
| 987 | to_upper_tis620, |
| 988 | sort_order_tis620, |
| 989 | NULL, /* uca */ |
| 990 | NULL, /* tab_to_uni */ |
| 991 | NULL, /* tab_from_uni */ |
| 992 | &my_unicase_default, /* caseinfo */ |
| 993 | NULL, /* state_map */ |
| 994 | NULL, /* ident_map */ |
| 995 | 4, /* strxfrm_multiply */ |
| 996 | 1, /* caseup_multiply */ |
| 997 | 1, /* casedn_multiply */ |
| 998 | 1, /* mbminlen */ |
| 999 | 1, /* mbmaxlen */ |
| 1000 | 0, /* min_sort_char */ |
| 1001 | 255, /* max_sort_char */ |
| 1002 | ' ', /* pad char */ |
| 1003 | 0, /* escape_with_backslash_is_dangerous */ |
| 1004 | 1, /* levels_for_order */ |
| 1005 | &my_charset_handler, |
| 1006 | &my_collation_nopad_ci_handler |
| 1007 | }; |
| 1008 | |
| 1009 | |
| 1010 | struct charset_info_st my_charset_tis620_nopad_bin= |
| 1011 | { |
| 1012 | MY_NOPAD_ID(89),0,0, /* number */ |
| 1013 | MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, /* state */ |
| 1014 | "tis620" , /* cs name */ |
| 1015 | "tis620_nopad_bin" , /* name */ |
| 1016 | "" , /* comment */ |
| 1017 | NULL, /* tailoring */ |
| 1018 | ctype_tis620, |
| 1019 | to_lower_tis620, |
| 1020 | to_upper_tis620, |
| 1021 | NULL, /* sort_order */ |
| 1022 | NULL, /* uca */ |
| 1023 | NULL, /* tab_to_uni */ |
| 1024 | NULL, /* tab_from_uni */ |
| 1025 | &my_unicase_default, /* caseinfo */ |
| 1026 | NULL, /* state_map */ |
| 1027 | NULL, /* ident_map */ |
| 1028 | 1, /* strxfrm_multiply */ |
| 1029 | 1, /* caseup_multiply */ |
| 1030 | 1, /* casedn_multiply */ |
| 1031 | 1, /* mbminlen */ |
| 1032 | 1, /* mbmaxlen */ |
| 1033 | 0, /* min_sort_char */ |
| 1034 | 255, /* max_sort_char */ |
| 1035 | ' ', /* pad char */ |
| 1036 | 0, /* escape_with_backslash_is_dangerous */ |
| 1037 | 1, /* levels_for_order */ |
| 1038 | &my_charset_handler, |
| 1039 | &my_collation_8bit_nopad_bin_handler |
| 1040 | }; |
| 1041 | |
| 1042 | |
| 1043 | #endif |
| 1044 | |