t_ctype.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. /* Copyright (C) 2000 MySQL AB
  2. Use is subject to license terms
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; version 2 of the License.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program; if not, write to the Free Software
  12. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
  13. /*
  14. Copyright (C) 1998, 1999 by Pruet Boonma, all rights reserved.
  15. Copyright (C) 1998 by Theppitak Karoonboonyanan, all rights reserved.
  16. Permission to use, copy, modify, distribute and sell this software
  17. and its documentation for any purpose is hereby granted without fee,
  18. provided that the above copyright notice appear in all copies.
  19. Smaphan Raruenrom and Pruet Boonma makes no representations about
  20. the suitability of this software for any purpose. It is provided
  21. "as is" without express or implied warranty.
  22. */
  23. /* LC_COLLATE category + Level information */
  24. #ifndef _t_ctype_h
  25. #define _t_ctype_h
  26. #define TOT_LEVELS 5
  27. #define LAST_LEVEL 4 /* TOT_LEVELS - 1 */
  28. #define IGNORE 0
  29. /* level 1 symbols & order */
  30. enum l1_symbols {
  31. L1_08 = TOT_LEVELS,
  32. L1_18,
  33. L1_28,
  34. L1_38,
  35. L1_48,
  36. L1_58,
  37. L1_68,
  38. L1_78,
  39. L1_88,
  40. L1_98,
  41. L1_A8,
  42. L1_B8,
  43. L1_C8,
  44. L1_D8,
  45. L1_E8,
  46. L1_F8,
  47. L1_G8,
  48. L1_H8,
  49. L1_I8,
  50. L1_J8,
  51. L1_K8,
  52. L1_L8,
  53. L1_M8,
  54. L1_N8,
  55. L1_O8,
  56. L1_P8,
  57. L1_Q8,
  58. L1_R8,
  59. L1_S8,
  60. L1_T8,
  61. L1_U8,
  62. L1_V8,
  63. L1_W8,
  64. L1_X8,
  65. L1_Y8,
  66. L1_Z8,
  67. L1_KO_KAI,
  68. L1_KHO_KHAI,
  69. L1_KHO_KHUAT,
  70. L1_KHO_KHWAI,
  71. L1_KHO_KHON,
  72. L1_KHO_RAKHANG,
  73. L1_NGO_NGU,
  74. L1_CHO_CHAN,
  75. L1_CHO_CHING,
  76. L1_CHO_CHANG,
  77. L1_SO_SO,
  78. L1_CHO_CHOE,
  79. L1_YO_YING,
  80. L1_DO_CHADA,
  81. L1_TO_PATAK,
  82. L1_THO_THAN,
  83. L1_THO_NANGMONTHO,
  84. L1_THO_PHUTHAO,
  85. L1_NO_NEN,
  86. L1_DO_DEK,
  87. L1_TO_TAO,
  88. L1_THO_THUNG,
  89. L1_THO_THAHAN,
  90. L1_THO_THONG,
  91. L1_NO_NU,
  92. L1_BO_BAIMAI,
  93. L1_PO_PLA,
  94. L1_PHO_PHUNG,
  95. L1_FO_FA,
  96. L1_PHO_PHAN,
  97. L1_FO_FAN,
  98. L1_PHO_SAMPHAO,
  99. L1_MO_MA,
  100. L1_YO_YAK,
  101. L1_RO_RUA,
  102. L1_RU,
  103. L1_LO_LING,
  104. L1_LU,
  105. L1_WO_WAEN,
  106. L1_SO_SALA,
  107. L1_SO_RUSI,
  108. L1_SO_SUA,
  109. L1_HO_HIP,
  110. L1_LO_CHULA,
  111. L1_O_ANG,
  112. L1_HO_NOKHUK,
  113. L1_NKHIT,
  114. L1_SARA_A,
  115. L1_MAI_HAN_AKAT,
  116. L1_SARA_AA,
  117. L1_SARA_AM,
  118. L1_SARA_I,
  119. L1_SARA_II,
  120. L1_SARA_UE,
  121. L1_SARA_UEE,
  122. L1_SARA_U,
  123. L1_SARA_UU,
  124. L1_SARA_E,
  125. L1_SARA_AE,
  126. L1_SARA_O,
  127. L1_SARA_AI_MAIMUAN,
  128. L1_SARA_AI_MAIMALAI
  129. };
  130. /* level 2 symbols & order */
  131. enum l2_symbols {
  132. L2_BLANK = TOT_LEVELS,
  133. L2_THAII,
  134. L2_YAMAK,
  135. L2_PINTHU,
  136. L2_GARAN,
  137. L2_TYKHU,
  138. L2_TONE1,
  139. L2_TONE2,
  140. L2_TONE3,
  141. L2_TONE4
  142. };
  143. /* level 3 symbols & order */
  144. enum l3_symbols {
  145. L3_BLANK = TOT_LEVELS,
  146. L3_SPACE,
  147. L3_NB_SACE,
  148. L3_LOW_LINE,
  149. L3_HYPHEN,
  150. L3_COMMA,
  151. L3_SEMICOLON,
  152. L3_COLON,
  153. L3_EXCLAMATION,
  154. L3_QUESTION,
  155. L3_SOLIDUS,
  156. L3_FULL_STOP,
  157. L3_PAIYAN_NOI,
  158. L3_MAI_YAMOK,
  159. L3_GRAVE,
  160. L3_CIRCUMFLEX,
  161. L3_TILDE,
  162. L3_APOSTROPHE,
  163. L3_QUOTATION,
  164. L3_L_PARANTHESIS,
  165. L3_L_BRACKET,
  166. L3_L_BRACE,
  167. L3_R_BRACE,
  168. L3_R_BRACKET,
  169. L3_R_PARENTHESIS,
  170. L3_AT,
  171. L3_BAHT,
  172. L3_DOLLAR,
  173. L3_FONGMAN,
  174. L3_ANGKHANKHU,
  175. L3_KHOMUT,
  176. L3_ASTERISK,
  177. L3_BK_SOLIDUS,
  178. L3_AMPERSAND,
  179. L3_NUMBER,
  180. L3_PERCENT,
  181. L3_PLUS,
  182. L3_LESS_THAN,
  183. L3_EQUAL,
  184. L3_GREATER_THAN,
  185. L3_V_LINE
  186. };
  187. /* level 4 symbols & order */
  188. enum l4_symbols {
  189. L4_BLANK = TOT_LEVELS,
  190. L4_MIN,
  191. L4_CAP,
  192. L4_EXT
  193. };
  194. enum level_symbols {
  195. L_UPRUPR = TOT_LEVELS,
  196. L_UPPER,
  197. L_MIDDLE,
  198. L_LOWER
  199. };
  200. #define _is(c) (t_ctype[(c)][LAST_LEVEL])
  201. #define _level 8
  202. #define _consnt 16
  203. #define _ldvowel 32
  204. #define _fllwvowel 64
  205. #define _uprvowel 128
  206. #define _lwrvowel 256
  207. #define _tone 512
  208. #define _diacrt1 1024
  209. #define _diacrt2 2048
  210. #define _combine 4096
  211. #define _stone 8192
  212. #define _tdig 16384
  213. #define _rearvowel (_fllwvowel | _uprvowel | _lwrvowel)
  214. #define _diacrt (_diacrt1 | _diacrt2)
  215. #define levelof(c) ( _is(c) & _level )
  216. #define isthai(c) ( (c) >= 128 )
  217. #define istalpha(c) ( _is(c) & (_consnt|_ldvowel|_rearvowel|\
  218. _tone|_diacrt1|_diacrt2) )
  219. #define isconsnt(c) ( _is(c) & _consnt )
  220. #define isldvowel(c) ( _is(c) & _ldvowel )
  221. #define isfllwvowel(c) ( _is(c) & _fllwvowel )
  222. #define ismidvowel(c) ( _is(c) & (_ldvowel|_fllwvowel) )
  223. #define isuprvowel(c) ( _is(c) & _uprvowel )
  224. #define islwrvowel(c) ( _is(c) & _lwrvowel )
  225. #define isuprlwrvowel(c) ( _is(c) & (_lwrvowel | _uprvowel))
  226. #define isrearvowel(c) ( _is(c) & _rearvowel )
  227. #define isvowel(c) ( _is(c) & (_ldvowel|_rearvowel) )
  228. #define istone(c) ( _is(c) & _tone )
  229. #define isunldable(c) ( _is(c) & (_rearvowel|_tone|_diacrt1|_diacrt2) )
  230. #define iscombinable(c) ( _is(c) & _combine )
  231. #define istdigit(c) ( _is(c) & _tdig )
  232. #define isstone(c) ( _is(c) & _stone )
  233. #define isdiacrt1(c) ( _is(c) & _diacrt1)
  234. #define isdiacrt2(c) ( _is(c) & _diacrt2)
  235. #define isdiacrt(c) ( _is(c) & _diacrt)
  236. /* Function prototype called by sql/field.cc */
  237. void ThNormalize(uchar* ptr, uint field_length, const uchar* from, uint length);
  238. #endif