hkscs2008.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. /*
  2. * Copyright (C) 1999-2010, 2012, 2016 Free Software Foundation, Inc.
  3. * This file is part of the GNU LIBICONV Library.
  4. *
  5. * The GNU LIBICONV Library is free software; you can redistribute it
  6. * and/or modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either version 2.1
  8. * of the License, or (at your option) any later version.
  9. *
  10. * The GNU LIBICONV Library is distributed in the hope that it will be
  11. * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with the GNU LIBICONV Library; see the file COPYING.LIB.
  17. * If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. /*
  20. * HKSCS:2008
  21. */
  22. static const unsigned short hkscs2008_2uni_page87[126] = {
  23. /* 0x87 */
  24. 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd,
  25. 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd,
  26. 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd,
  27. 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd,
  28. 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd,
  29. 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd,
  30. 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd,
  31. 0x22fd, 0x22fd, 0x0175, 0x2453, 0x299e, 0x2d21, 0x03ec, 0x2bde,
  32. 0x02f5, 0x16fc, 0x2197, 0x2a61, 0x300d, 0x26ea, 0x238a, 0x275e,
  33. 0x060a, 0x1884, 0x2196, 0x1f2f, 0x0930, 0x1a13, 0x0d96, 0x204a,
  34. 0x1e18, 0x15d0, 0x1632, 0x0f60, 0x1129, 0x1b9d, 0x144c, 0x17c5,
  35. 0x1082, 0x162c, 0x0a4f, 0x1d46, 0x00e6, 0x13c4, 0x2cb9, 0x14c6,
  36. 0x21c7, 0x0cb3, 0x092f, 0x0b4c, 0x0531, 0x298e, 0x0d18, 0x1672,
  37. 0x2f65, 0x1c8f, 0x08ae, 0x2e88, 0x0581, 0x2c99, 0x17ae, 0x25bc,
  38. 0x21c8, 0x25c1, 0x25c9, 0x25cc, 0x21c9, 0x1904, 0x28bb, 0x04b4,
  39. 0x21ca, 0x07e1, 0x31ff, 0x0ec1, 0x126e, 0x21cb,
  40. };
  41. static const ucs4_t hkscs2008_2uni_upages[50] = {
  42. 0x03400, 0x03800, 0x03a00, 0x03e00, 0x04000, 0x04100, 0x04300, 0x04400,
  43. 0x04600, 0x04900, 0x05200, 0x05400, 0x05700, 0x05800, 0x06200, 0x06600,
  44. 0x06700, 0x06a00, 0x07000, 0x07300, 0x07400, 0x07900, 0x07a00, 0x07b00,
  45. 0x08400, 0x08500, 0x08600, 0x08800, 0x08b00, 0x09000, 0x09200, 0x09400,
  46. 0x09700, 0x09f00, 0x0ff00, 0x20a00, 0x21d00, 0x22400, 0x23100, 0x23200,
  47. 0x23500, 0x23600, 0x24100, 0x25800, 0x25d00, 0x26000, 0x26e00, 0x27b00,
  48. 0x28900, 0x2ad00,
  49. };
  50. static int
  51. hkscs2008_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n)
  52. {
  53. unsigned char c1 = s[0];
  54. if ((c1 == 0x87)) {
  55. if (n >= 2) {
  56. unsigned char c2 = s[1];
  57. if ((c2 >= 0x40 && c2 < 0x7f) || (c2 >= 0xa1 && c2 < 0xff)) {
  58. unsigned int i = 157 * (c1 - 0x80) + (c2 - (c2 >= 0xa1 ? 0x62 : 0x40));
  59. ucs4_t wc = 0xfffd;
  60. unsigned short swc;
  61. {
  62. if (i < 1225)
  63. swc = hkscs2008_2uni_page87[i-1099],
  64. wc = hkscs2008_2uni_upages[swc>>8] | (swc & 0xff);
  65. }
  66. if (wc != 0xfffd) {
  67. *pwc = wc;
  68. return 2;
  69. }
  70. }
  71. return RET_ILSEQ;
  72. }
  73. return RET_TOOFEW(0);
  74. }
  75. return RET_ILSEQ;
  76. }
  77. static const unsigned short hkscs2008_2charset[68] = {
  78. 0x87be, 0x877a, 0x87a2, 0x877e, 0x87d9, 0x87c6, 0x87ce, 0x87aa,
  79. 0x87db, 0x87cc, 0x87c4, 0x87ae, 0x87bc, 0x87c5, 0x87c3, 0x87c8,
  80. 0x87b0, 0x87dd, 0x87b5, 0x87ba, 0x87b6, 0x87de, 0x87bf, 0x87b8,
  81. 0x87c1, 0x87b3, 0x87bb, 0x87b4, 0x87c9, 0x87a3, 0x87d0, 0x87b9,
  82. 0x87ab, 0x87d7, 0x87af, 0x87b7, 0x87cb, 0x87bd, 0x87b2, 0x87ad,
  83. 0x87b1, 0x87ac, 0x87a4, 0x87c2, 0x87d2, 0x87d6, 0x87da, 0x87df,
  84. 0x87a8, 0x877b, 0x87d1, 0x87d3, 0x87d4, 0x87d5, 0x87a7, 0x87a9,
  85. 0x87d8, 0x87c7, 0x877c, 0x87a5, 0x87a1, 0x87cf, 0x87c0, 0x877d,
  86. 0x87cd, 0x87ca, 0x87a6, 0x87dc,
  87. };
  88. static const Summary16 hkscs2008_uni2indx_page34[15] = {
  89. /* 0x3400 */
  90. { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 },
  91. { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 },
  92. { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 },
  93. { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0040 },
  94. };
  95. static const Summary16 hkscs2008_uni2indx_page38[8] = {
  96. /* 0x3800 */
  97. { 1, 0x0000 }, { 1, 0x0000 }, { 1, 0x0000 }, { 1, 0x0000 },
  98. { 1, 0x0000 }, { 1, 0x0000 }, { 1, 0x0000 }, { 1, 0x0020 },
  99. };
  100. static const Summary16 hkscs2008_uni2indx_page3a[16] = {
  101. /* 0x3a00 */
  102. { 2, 0x0000 }, { 2, 0x0000 }, { 2, 0x0000 }, { 2, 0x0000 },
  103. { 2, 0x0000 }, { 2, 0x0000 }, { 2, 0x0000 }, { 2, 0x0000 },
  104. { 2, 0x0000 }, { 2, 0x0000 }, { 2, 0x0000 }, { 2, 0x0000 },
  105. { 2, 0x0000 }, { 2, 0x0000 }, { 2, 0x0000 }, { 2, 0x0020 },
  106. };
  107. static const Summary16 hkscs2008_uni2indx_page3e[15] = {
  108. /* 0x3e00 */
  109. { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 },
  110. { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 },
  111. { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 },
  112. { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x1000 },
  113. };
  114. static const Summary16 hkscs2008_uni2indx_page40[25] = {
  115. /* 0x4000 */
  116. { 4, 0x0000 }, { 4, 0x0000 }, { 4, 0x0000 }, { 4, 0x0000 },
  117. { 4, 0x0000 }, { 4, 0x0000 }, { 4, 0x0000 }, { 4, 0x0000 },
  118. { 4, 0x0000 }, { 4, 0x0000 }, { 4, 0x0000 }, { 4, 0x0010 },
  119. { 5, 0x0000 }, { 5, 0x0000 }, { 5, 0x0000 }, { 5, 0x0000 },
  120. /* 0x4100 */
  121. { 5, 0x0000 }, { 5, 0x0000 }, { 5, 0x0000 }, { 5, 0x0002 },
  122. { 6, 0x0000 }, { 6, 0x0000 }, { 6, 0x0000 }, { 6, 0x0000 },
  123. { 6, 0x0002 },
  124. };
  125. static const Summary16 hkscs2008_uni2indx_page43[31] = {
  126. /* 0x4300 */
  127. { 7, 0x0400 }, { 8, 0x0000 }, { 8, 0x0000 }, { 8, 0x0000 },
  128. { 8, 0x0000 }, { 8, 0x0000 }, { 8, 0x0000 }, { 8, 0x0000 },
  129. { 8, 0x0000 }, { 8, 0x0000 }, { 8, 0x0000 }, { 8, 0x0000 },
  130. { 8, 0x0000 }, { 8, 0x0000 }, { 8, 0x0000 }, { 8, 0x0000 },
  131. /* 0x4400 */
  132. { 8, 0x0000 }, { 8, 0x0000 }, { 8, 0x0000 }, { 8, 0x0000 },
  133. { 8, 0x0000 }, { 8, 0x0000 }, { 8, 0x0000 }, { 8, 0x0000 },
  134. { 8, 0x0000 }, { 8, 0x0000 }, { 8, 0x0000 }, { 8, 0x0000 },
  135. { 8, 0x0000 }, { 8, 0x0000 }, { 8, 0x0002 },
  136. };
  137. static const Summary16 hkscs2008_uni2indx_page46[11] = {
  138. /* 0x4600 */
  139. { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 },
  140. { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 },
  141. { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x4000 },
  142. };
  143. static const Summary16 hkscs2008_uni2indx_page49[4] = {
  144. /* 0x4900 */
  145. { 10, 0x0000 }, { 10, 0x0000 }, { 10, 0x8000 }, { 11, 0x0001 },
  146. };
  147. static const Summary16 hkscs2008_uni2indx_page52[5] = {
  148. /* 0x5200 */
  149. { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 },
  150. { 12, 0x8000 },
  151. };
  152. static const Summary16 hkscs2008_uni2indx_page54[5] = {
  153. /* 0x5400 */
  154. { 13, 0x0000 }, { 13, 0x0000 }, { 13, 0x0000 }, { 13, 0x0000 },
  155. { 13, 0x1000 },
  156. };
  157. static const Summary16 hkscs2008_uni2indx_page57[26] = {
  158. /* 0x5700 */
  159. { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0000 },
  160. { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0000 },
  161. { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0008 },
  162. { 15, 0x0000 }, { 15, 0x0000 }, { 15, 0x0000 }, { 15, 0x0000 },
  163. /* 0x5800 */
  164. { 15, 0x0000 }, { 15, 0x0100 }, { 16, 0x0000 }, { 16, 0x0000 },
  165. { 16, 0x0000 }, { 16, 0x0000 }, { 16, 0x0000 }, { 16, 0x0000 },
  166. { 16, 0x0000 }, { 16, 0x0040 },
  167. };
  168. static const Summary16 hkscs2008_uni2indx_page62[13] = {
  169. /* 0x6200 */
  170. { 17, 0x0000 }, { 17, 0x0000 }, { 17, 0x0000 }, { 17, 0x0000 },
  171. { 17, 0x0000 }, { 17, 0x0000 }, { 17, 0x0000 }, { 17, 0x0000 },
  172. { 17, 0x0000 }, { 17, 0x0000 }, { 17, 0x0000 }, { 17, 0x0000 },
  173. { 17, 0x0002 },
  174. };
  175. static const Summary16 hkscs2008_uni2indx_page66[25] = {
  176. /* 0x6600 */
  177. { 18, 0x0000 }, { 18, 0x0000 }, { 18, 0x0000 }, { 18, 0x0000 },
  178. { 18, 0x0000 }, { 18, 0x0000 }, { 18, 0x0001 }, { 19, 0x0000 },
  179. { 19, 0x0000 }, { 19, 0x0000 }, { 19, 0x0000 }, { 19, 0x0000 },
  180. { 19, 0x0000 }, { 19, 0x0000 }, { 19, 0x0000 }, { 19, 0x0000 },
  181. /* 0x6700 */
  182. { 19, 0x0000 }, { 19, 0x0000 }, { 19, 0x0000 }, { 19, 0x0000 },
  183. { 19, 0x0000 }, { 19, 0x0000 }, { 19, 0x0000 }, { 19, 0x0000 },
  184. { 19, 0x0004 },
  185. };
  186. static const Summary16 hkscs2008_uni2indx_page6a[3] = {
  187. /* 0x6a00 */
  188. { 20, 0x0000 }, { 20, 0x0000 }, { 20, 0x0200 },
  189. };
  190. static const Summary16 hkscs2008_uni2indx_page70[7] = {
  191. /* 0x7000 */
  192. { 21, 0x0000 }, { 21, 0x0000 }, { 21, 0x0000 }, { 21, 0x0000 },
  193. { 21, 0x0000 }, { 21, 0x0000 }, { 21, 0x4000 },
  194. };
  195. static const Summary16 hkscs2008_uni2indx_page73[29] = {
  196. /* 0x7300 */
  197. { 22, 0x0000 }, { 22, 0x0000 }, { 22, 0x0000 }, { 22, 0x0000 },
  198. { 22, 0x0000 }, { 22, 0x0000 }, { 22, 0x0000 }, { 22, 0x0000 },
  199. { 22, 0x0000 }, { 22, 0x0000 }, { 22, 0x0000 }, { 22, 0x0000 },
  200. { 22, 0x0010 }, { 23, 0x0000 }, { 23, 0x0000 }, { 23, 0x0000 },
  201. /* 0x7400 */
  202. { 23, 0x0000 }, { 23, 0x0000 }, { 23, 0x0000 }, { 23, 0x0000 },
  203. { 23, 0x1000 }, { 24, 0x0000 }, { 24, 0x0000 }, { 24, 0x0000 },
  204. { 24, 0x0000 }, { 24, 0x0000 }, { 24, 0x0000 }, { 24, 0x0000 },
  205. { 24, 0x0040 },
  206. };
  207. static const Summary16 hkscs2008_uni2indx_page79[45] = {
  208. /* 0x7900 */
  209. { 25, 0x0000 }, { 25, 0x0000 }, { 25, 0x0000 }, { 25, 0x0000 },
  210. { 25, 0x0000 }, { 25, 0x0000 }, { 25, 0x0000 }, { 25, 0x0000 },
  211. { 25, 0x0000 }, { 25, 0x0000 }, { 25, 0x0000 }, { 25, 0x0000 },
  212. { 25, 0x0000 }, { 25, 0x0001 }, { 26, 0x0000 }, { 26, 0x0000 },
  213. /* 0x7a00 */
  214. { 26, 0x0000 }, { 26, 0x0000 }, { 26, 0x1000 }, { 27, 0x0004 },
  215. { 28, 0x0000 }, { 28, 0x0000 }, { 28, 0x0000 }, { 28, 0x0004 },
  216. { 29, 0x0000 }, { 29, 0x0000 }, { 29, 0x0000 }, { 29, 0x0000 },
  217. { 29, 0x0000 }, { 29, 0x0000 }, { 29, 0x0000 }, { 29, 0x1000 },
  218. /* 0x7b00 */
  219. { 30, 0x0000 }, { 30, 0x0000 }, { 30, 0x0000 }, { 30, 0x0000 },
  220. { 30, 0x0000 }, { 30, 0x0000 }, { 30, 0x0000 }, { 30, 0x0000 },
  221. { 30, 0x0000 }, { 30, 0x0000 }, { 30, 0x4000 }, { 31, 0x0000 },
  222. { 31, 0x0020 },
  223. };
  224. static const Summary16 hkscs2008_uni2indx_page84[34] = {
  225. /* 0x8400 */
  226. { 32, 0x0000 }, { 32, 0x0000 }, { 32, 0x0000 }, { 32, 0x0000 },
  227. { 32, 0x0000 }, { 32, 0x0000 }, { 32, 0x0000 }, { 32, 0x0000 },
  228. { 32, 0x0010 }, { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 },
  229. { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 },
  230. /* 0x8500 */
  231. { 33, 0x0010 }, { 34, 0x0000 }, { 34, 0x0000 }, { 34, 0x0000 },
  232. { 34, 0x0000 }, { 34, 0x0000 }, { 34, 0x0000 }, { 34, 0x0000 },
  233. { 34, 0x0000 }, { 34, 0x0000 }, { 34, 0x0000 }, { 34, 0x0000 },
  234. { 34, 0x0000 }, { 34, 0x0000 }, { 34, 0x0000 }, { 34, 0x0000 },
  235. /* 0x8600 */
  236. { 34, 0x0000 }, { 34, 0x0008 },
  237. };
  238. static const Summary16 hkscs2008_uni2indx_page88[10] = {
  239. /* 0x8800 */
  240. { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0000 },
  241. { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0000 },
  242. { 35, 0x0000 }, { 35, 0x2000 },
  243. };
  244. static const Summary16 hkscs2008_uni2indx_page8b[9] = {
  245. /* 0x8b00 */
  246. { 36, 0x0000 }, { 36, 0x0000 }, { 36, 0x0000 }, { 36, 0x0000 },
  247. { 36, 0x0000 }, { 36, 0x0000 }, { 36, 0x0000 }, { 36, 0x0000 },
  248. { 36, 0x8000 },
  249. };
  250. static const Summary16 hkscs2008_uni2indx_page90[5] = {
  251. /* 0x9000 */
  252. { 37, 0x0000 }, { 37, 0x0000 }, { 37, 0x0000 }, { 37, 0x0000 },
  253. { 37, 0x0040 },
  254. };
  255. static const Summary16 hkscs2008_uni2indx_page92[2] = {
  256. /* 0x9200 */
  257. { 38, 0x0000 }, { 38, 0x0100 },
  258. };
  259. static const Summary16 hkscs2008_uni2indx_page94[3] = {
  260. /* 0x9400 */
  261. { 39, 0x0000 }, { 39, 0x0000 }, { 39, 0x8000 },
  262. };
  263. static const Summary16 hkscs2008_uni2indx_page97[5] = {
  264. /* 0x9700 */
  265. { 40, 0x0000 }, { 40, 0x0000 }, { 40, 0x0000 }, { 40, 0x0000 },
  266. { 40, 0x0400 },
  267. };
  268. static const Summary16 hkscs2008_uni2indx_page9f[13] = {
  269. /* 0x9f00 */
  270. { 41, 0x0000 }, { 41, 0x0000 }, { 41, 0x0000 }, { 41, 0x0000 },
  271. { 41, 0x0000 }, { 41, 0x0000 }, { 41, 0x0000 }, { 41, 0x0000 },
  272. { 41, 0x0000 }, { 41, 0x00c0 }, { 43, 0x0000 }, { 43, 0x0000 },
  273. { 43, 0x0f80 },
  274. };
  275. static const Summary16 hkscs2008_uni2indx_page20a[9] = {
  276. /* 0x20a00 */
  277. { 48, 0x0000 }, { 48, 0x0000 }, { 48, 0x0000 }, { 48, 0x0000 },
  278. { 48, 0x0000 }, { 48, 0x0000 }, { 48, 0x0000 }, { 48, 0x0000 },
  279. { 48, 0x0400 },
  280. };
  281. static const Summary16 hkscs2008_uni2indx_page21d[6] = {
  282. /* 0x21d00 */
  283. { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 },
  284. { 49, 0x0000 }, { 49, 0x0008 },
  285. };
  286. static const Summary16 hkscs2008_uni2indx_page224[13] = {
  287. /* 0x22400 */
  288. { 50, 0x0000 }, { 50, 0x0000 }, { 50, 0x0000 }, { 50, 0x0000 },
  289. { 50, 0x0000 }, { 50, 0x0000 }, { 50, 0x0000 }, { 50, 0x0000 },
  290. { 50, 0x0000 }, { 50, 0x0000 }, { 50, 0x0000 }, { 50, 0x1000 },
  291. { 51, 0x1202 },
  292. };
  293. static const Summary16 hkscs2008_uni2indx_page231[22] = {
  294. /* 0x23100 */
  295. { 54, 0x0000 }, { 54, 0x0000 }, { 54, 0x0000 }, { 54, 0x0000 },
  296. { 54, 0x0000 }, { 54, 0x0000 }, { 54, 0x0000 }, { 54, 0x0000 },
  297. { 54, 0x0000 }, { 54, 0x0000 }, { 54, 0x0000 }, { 54, 0x0000 },
  298. { 54, 0x0000 }, { 54, 0x0000 }, { 54, 0x0400 }, { 55, 0x0000 },
  299. /* 0x23200 */
  300. { 55, 0x0000 }, { 55, 0x0000 }, { 55, 0x0000 }, { 55, 0x0000 },
  301. { 55, 0x0000 }, { 55, 0x4000 },
  302. };
  303. static const Summary16 hkscs2008_uni2indx_page235[26] = {
  304. /* 0x23500 */
  305. { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 },
  306. { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 },
  307. { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0800 },
  308. { 57, 0x0000 }, { 57, 0x0000 }, { 57, 0x0000 }, { 57, 0x0000 },
  309. /* 0x23600 */
  310. { 57, 0x0000 }, { 57, 0x0000 }, { 57, 0x0000 }, { 57, 0x0000 },
  311. { 57, 0x0000 }, { 57, 0x0000 }, { 57, 0x0000 }, { 57, 0x0000 },
  312. { 57, 0x4000 }, { 58, 0x4000 },
  313. };
  314. static const Summary16 hkscs2008_uni2indx_page241[7] = {
  315. /* 0x24100 */
  316. { 59, 0x0000 }, { 59, 0x0000 }, { 59, 0x0000 }, { 59, 0x0000 },
  317. { 59, 0x0000 }, { 59, 0x0000 }, { 59, 0x0002 },
  318. };
  319. static const Summary16 hkscs2008_uni2indx_page258[14] = {
  320. /* 0x25800 */
  321. { 60, 0x0000 }, { 60, 0x0000 }, { 60, 0x0000 }, { 60, 0x0000 },
  322. { 60, 0x0000 }, { 60, 0x0000 }, { 60, 0x0000 }, { 60, 0x0000 },
  323. { 60, 0x0000 }, { 60, 0x0000 }, { 60, 0x0000 }, { 60, 0x0000 },
  324. { 60, 0x0000 }, { 60, 0x4000 },
  325. };
  326. static const Summary16 hkscs2008_uni2indx_page25d[12] = {
  327. /* 0x25d00 */
  328. { 61, 0x0000 }, { 61, 0x0000 }, { 61, 0x0000 }, { 61, 0x0000 },
  329. { 61, 0x0000 }, { 61, 0x0000 }, { 61, 0x0000 }, { 61, 0x0000 },
  330. { 61, 0x0000 }, { 61, 0x0200 }, { 62, 0x0000 }, { 62, 0x0200 },
  331. };
  332. static const Summary16 hkscs2008_uni2indx_page260[3] = {
  333. /* 0x26000 */
  334. { 63, 0x0000 }, { 63, 0x0000 }, { 63, 0x0002 },
  335. };
  336. static const Summary16 hkscs2008_uni2indx_page26e[9] = {
  337. /* 0x26e00 */
  338. { 64, 0x0000 }, { 64, 0x0000 }, { 64, 0x0000 }, { 64, 0x0000 },
  339. { 64, 0x0000 }, { 64, 0x0000 }, { 64, 0x0000 }, { 64, 0x0000 },
  340. { 64, 0x0100 },
  341. };
  342. static const Summary16 hkscs2008_uni2indx_page27b[7] = {
  343. /* 0x27b00 */
  344. { 65, 0x0000 }, { 65, 0x0000 }, { 65, 0x0000 }, { 65, 0x0000 },
  345. { 65, 0x0000 }, { 65, 0x0000 }, { 65, 0x0020 },
  346. };
  347. static const Summary16 hkscs2008_uni2indx_page289[1] = {
  348. /* 0x28900 */
  349. { 66, 0x2000 },
  350. };
  351. static const Summary16 hkscs2008_uni2indx_page2ad[16] = {
  352. /* 0x2ad00 */
  353. { 67, 0x0000 }, { 67, 0x0000 }, { 67, 0x0000 }, { 67, 0x0000 },
  354. { 67, 0x0000 }, { 67, 0x0000 }, { 67, 0x0000 }, { 67, 0x0000 },
  355. { 67, 0x0000 }, { 67, 0x0000 }, { 67, 0x0000 }, { 67, 0x0000 },
  356. { 67, 0x0000 }, { 67, 0x0000 }, { 67, 0x0000 }, { 67, 0x8000 },
  357. };
  358. static int
  359. hkscs2008_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n)
  360. {
  361. if (n >= 2) {
  362. const Summary16 *summary = NULL;
  363. if (wc >= 0x3400 && wc < 0x34f0)
  364. summary = &hkscs2008_uni2indx_page34[(wc>>4)-0x340];
  365. else if (wc >= 0x3800 && wc < 0x3880)
  366. summary = &hkscs2008_uni2indx_page38[(wc>>4)-0x380];
  367. else if (wc >= 0x3a00 && wc < 0x3b00)
  368. summary = &hkscs2008_uni2indx_page3a[(wc>>4)-0x3a0];
  369. else if (wc >= 0x3e00 && wc < 0x3ef0)
  370. summary = &hkscs2008_uni2indx_page3e[(wc>>4)-0x3e0];
  371. else if (wc >= 0x4000 && wc < 0x4190)
  372. summary = &hkscs2008_uni2indx_page40[(wc>>4)-0x400];
  373. else if (wc >= 0x4300 && wc < 0x44f0)
  374. summary = &hkscs2008_uni2indx_page43[(wc>>4)-0x430];
  375. else if (wc >= 0x4600 && wc < 0x46b0)
  376. summary = &hkscs2008_uni2indx_page46[(wc>>4)-0x460];
  377. else if (wc >= 0x4900 && wc < 0x4940)
  378. summary = &hkscs2008_uni2indx_page49[(wc>>4)-0x490];
  379. else if (wc >= 0x5200 && wc < 0x5250)
  380. summary = &hkscs2008_uni2indx_page52[(wc>>4)-0x520];
  381. else if (wc >= 0x5400 && wc < 0x5450)
  382. summary = &hkscs2008_uni2indx_page54[(wc>>4)-0x540];
  383. else if (wc >= 0x5700 && wc < 0x58a0)
  384. summary = &hkscs2008_uni2indx_page57[(wc>>4)-0x570];
  385. else if (wc >= 0x6200 && wc < 0x62d0)
  386. summary = &hkscs2008_uni2indx_page62[(wc>>4)-0x620];
  387. else if (wc >= 0x6600 && wc < 0x6790)
  388. summary = &hkscs2008_uni2indx_page66[(wc>>4)-0x660];
  389. else if (wc >= 0x6a00 && wc < 0x6a30)
  390. summary = &hkscs2008_uni2indx_page6a[(wc>>4)-0x6a0];
  391. else if (wc >= 0x7000 && wc < 0x7070)
  392. summary = &hkscs2008_uni2indx_page70[(wc>>4)-0x700];
  393. else if (wc >= 0x7300 && wc < 0x74d0)
  394. summary = &hkscs2008_uni2indx_page73[(wc>>4)-0x730];
  395. else if (wc >= 0x7900 && wc < 0x7bd0)
  396. summary = &hkscs2008_uni2indx_page79[(wc>>4)-0x790];
  397. else if (wc >= 0x8400 && wc < 0x8620)
  398. summary = &hkscs2008_uni2indx_page84[(wc>>4)-0x840];
  399. else if (wc >= 0x8800 && wc < 0x88a0)
  400. summary = &hkscs2008_uni2indx_page88[(wc>>4)-0x880];
  401. else if (wc >= 0x8b00 && wc < 0x8b90)
  402. summary = &hkscs2008_uni2indx_page8b[(wc>>4)-0x8b0];
  403. else if (wc >= 0x9000 && wc < 0x9050)
  404. summary = &hkscs2008_uni2indx_page90[(wc>>4)-0x900];
  405. else if (wc >= 0x9200 && wc < 0x9220)
  406. summary = &hkscs2008_uni2indx_page92[(wc>>4)-0x920];
  407. else if (wc >= 0x9400 && wc < 0x9430)
  408. summary = &hkscs2008_uni2indx_page94[(wc>>4)-0x940];
  409. else if (wc >= 0x9700 && wc < 0x9750)
  410. summary = &hkscs2008_uni2indx_page97[(wc>>4)-0x970];
  411. else if (wc >= 0x9f00 && wc < 0x9fd0)
  412. summary = &hkscs2008_uni2indx_page9f[(wc>>4)-0x9f0];
  413. else if (wc >= 0x20a00 && wc < 0x20a90)
  414. summary = &hkscs2008_uni2indx_page20a[(wc>>4)-0x20a0];
  415. else if (wc >= 0x21d00 && wc < 0x21d60)
  416. summary = &hkscs2008_uni2indx_page21d[(wc>>4)-0x21d0];
  417. else if (wc >= 0x22400 && wc < 0x224d0)
  418. summary = &hkscs2008_uni2indx_page224[(wc>>4)-0x2240];
  419. else if (wc >= 0x23100 && wc < 0x23260)
  420. summary = &hkscs2008_uni2indx_page231[(wc>>4)-0x2310];
  421. else if (wc >= 0x23500 && wc < 0x236a0)
  422. summary = &hkscs2008_uni2indx_page235[(wc>>4)-0x2350];
  423. else if (wc >= 0x24100 && wc < 0x24170)
  424. summary = &hkscs2008_uni2indx_page241[(wc>>4)-0x2410];
  425. else if (wc >= 0x25800 && wc < 0x258e0)
  426. summary = &hkscs2008_uni2indx_page258[(wc>>4)-0x2580];
  427. else if (wc >= 0x25d00 && wc < 0x25dc0)
  428. summary = &hkscs2008_uni2indx_page25d[(wc>>4)-0x25d0];
  429. else if (wc >= 0x26000 && wc < 0x26030)
  430. summary = &hkscs2008_uni2indx_page260[(wc>>4)-0x2600];
  431. else if (wc >= 0x26e00 && wc < 0x26e90)
  432. summary = &hkscs2008_uni2indx_page26e[(wc>>4)-0x26e0];
  433. else if (wc >= 0x27b00 && wc < 0x27b70)
  434. summary = &hkscs2008_uni2indx_page27b[(wc>>4)-0x27b0];
  435. else if (wc >= 0x28900 && wc < 0x28910)
  436. summary = &hkscs2008_uni2indx_page289[(wc>>4)-0x2890];
  437. else if (wc >= 0x2ad00 && wc < 0x2ae00)
  438. summary = &hkscs2008_uni2indx_page2ad[(wc>>4)-0x2ad0];
  439. if (summary) {
  440. unsigned short used = summary->used;
  441. unsigned int i = wc & 0x0f;
  442. if (used & ((unsigned short) 1 << i)) {
  443. unsigned short c;
  444. /* Keep in 'used' only the bits 0..i-1. */
  445. used &= ((unsigned short) 1 << i) - 1;
  446. /* Add 'summary->indx' and the number of bits set in 'used'. */
  447. used = (used & 0x5555) + ((used & 0xaaaa) >> 1);
  448. used = (used & 0x3333) + ((used & 0xcccc) >> 2);
  449. used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4);
  450. used = (used & 0x00ff) + (used >> 8);
  451. c = hkscs2008_2charset[summary->indx + used];
  452. r[0] = (c >> 8); r[1] = (c & 0xff);
  453. return 2;
  454. }
  455. }
  456. return RET_ILUNI;
  457. }
  458. return RET_TOOSMALL;
  459. }