hkscs2004.h 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  1. /*
  2. * Copyright (C) 1999-2006, 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:2004
  21. */
  22. static const unsigned short hkscs2004_2uni_page87[58] = {
  23. /* 0x87 */
  24. 0x0af0, 0x1032, 0x0d03, 0x0ca6, 0x0c78, 0x4167, 0x1177, 0x0cb3,
  25. 0x44b1, 0x10e2, 0x44c5, 0x0595, 0x0e36, 0x0e44, 0x1047, 0x1040,
  26. 0x39bf, 0x3417, 0x4252, 0x3f8b, 0x40d2, 0x1057, 0x4d51, 0x0e4f,
  27. 0x0cda, 0x1085, 0x446c, 0x1107, 0x0fa4, 0x0da1, 0x3d23, 0x1e25,
  28. 0x3c54, 0x2d63, 0x3606, 0x3761, 0x1a4d, 0x13fb, 0x28fd, 0x2195,
  29. 0x141d, 0x47b9, 0x06f4, 0x2534, 0x43ef, 0x16db, 0x2e5e, 0x15a4,
  30. 0x0125, 0x4bb0, 0x15d1, 0x16b7, 0x17fc, 0x1b6e, 0x2393, 0x4a45,
  31. 0x1f61, 0x1f9d,
  32. };
  33. static const unsigned short hkscs2004_2uni_page8c[189] = {
  34. /* 0x8c */
  35. 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd,
  36. 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd,
  37. 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd,
  38. 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd,
  39. 0x28fd, 0x28fd, 0x2b6f, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd,
  40. 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd,
  41. 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd,
  42. 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd,
  43. 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd,
  44. 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd,
  45. 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd,
  46. 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd,
  47. 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd,
  48. 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd,
  49. 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd,
  50. 0x28fd, 0x1ae7, 0x28fd, 0x1c57, 0x20ca, 0x0688, 0x0bc3, 0x3256,
  51. 0x3196, 0x0a9a, 0x0c36, 0x28fd, 0x17d5, 0x351a, 0x24f9, 0x1778,
  52. 0x0612, 0x3351, 0x1878, 0x27b2, 0x1d57, 0x0c58, 0x38ec, 0x2f23,
  53. 0x1077, 0x0478, 0x004a, 0x29a4, 0x3e41, 0x24cc, 0x12b4, 0x2a39,
  54. 0x14bf, 0x226c, 0x2656, 0x49fa, 0x193b,
  55. /* 0x8d */
  56. 0x2c9f, 0x28fd, 0x30c1, 0x466d, 0x0902, 0x0dbb, 0x4879, 0x0707,
  57. 0x27b3, 0x4cb5, 0x08f8, 0x02d6, 0x0df7, 0x3e46, 0x097c, 0x45b2,
  58. 0x42ff, 0x0c6d, 0x03d4, 0x3b9a, 0x0c61, 0x0c1b, 0x1189, 0x107b,
  59. 0x1176, 0x0cea, 0x07c8, 0x3a0f, 0x0161, 0x0bde, 0x0bbd, 0x09ed,
  60. };
  61. static const ucs4_t hkscs2004_2uni_upages[78] = {
  62. 0x03400, 0x03600, 0x03700, 0x03800, 0x03900, 0x03b00, 0x03d00, 0x03f00,
  63. 0x04000, 0x04100, 0x04300, 0x04400, 0x04500, 0x04600, 0x04700, 0x04a00,
  64. 0x04c00, 0x04d00, 0x04f00, 0x05600, 0x05900, 0x05a00, 0x05b00, 0x05c00,
  65. 0x05d00, 0x05f00, 0x06600, 0x06700, 0x06e00, 0x07100, 0x07200, 0x07400,
  66. 0x07900, 0x07d00, 0x08100, 0x08500, 0x08a00, 0x09700, 0x09800, 0x09f00,
  67. 0x0ff00, 0x20100, 0x20200, 0x20a00, 0x20b00, 0x21a00, 0x21d00, 0x21e00,
  68. 0x22100, 0x22700, 0x23200, 0x23500, 0x23600, 0x23b00, 0x23e00, 0x23f00,
  69. 0x24000, 0x24200, 0x24b00, 0x25400, 0x25a00, 0x26b00, 0x26c00, 0x26e00,
  70. 0x27000, 0x27200, 0x27300, 0x27b00, 0x27c00, 0x28600, 0x28900, 0x28b00,
  71. 0x29000, 0x29800, 0x29900, 0x29e00, 0x2a100, 0x2a300,
  72. };
  73. static int
  74. hkscs2004_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n)
  75. {
  76. unsigned char c1 = s[0];
  77. if ((c1 == 0x87) || (c1 >= 0x8c && c1 <= 0x8d)) {
  78. if (n >= 2) {
  79. unsigned char c2 = s[1];
  80. if ((c2 >= 0x40 && c2 < 0x7f) || (c2 >= 0xa1 && c2 < 0xff)) {
  81. unsigned int i = 157 * (c1 - 0x80) + (c2 - (c2 >= 0xa1 ? 0x62 : 0x40));
  82. ucs4_t wc = 0xfffd;
  83. unsigned short swc;
  84. if (i < 1884) {
  85. if (i < 1157)
  86. swc = hkscs2004_2uni_page87[i-1099],
  87. wc = hkscs2004_2uni_upages[swc>>8] | (swc & 0xff);
  88. } else {
  89. if (i < 2073)
  90. swc = hkscs2004_2uni_page8c[i-1884],
  91. wc = hkscs2004_2uni_upages[swc>>8] | (swc & 0xff);
  92. }
  93. if (wc != 0xfffd) {
  94. *pwc = wc;
  95. return 2;
  96. }
  97. }
  98. return RET_ILSEQ;
  99. }
  100. return RET_TOOFEW(0);
  101. }
  102. return RET_ILSEQ;
  103. }
  104. static const unsigned short hkscs2004_2charset[123] = {
  105. 0x8cf4, 0x8770, 0x8d5c, 0x8d4b, 0x8d52, 0x8cf3, 0x874b, 0x8cea,
  106. 0x8cdf, 0x876a, 0x8d47, 0x8d5a, 0x8d4a, 0x8d44, 0x8d4e, 0x8d5f,
  107. 0x8ce3, 0x8740, 0x8d5e, 0x8ce0, 0x8d5d, 0x8d55, 0x8ce4, 0x8cef,
  108. 0x8d54, 0x8d51, 0x8744, 0x8743, 0x8747, 0x8758, 0x8d59, 0x8742,
  109. 0x875d, 0x8d45, 0x8d4c, 0x874c, 0x874d, 0x8757, 0x875c, 0x8741,
  110. 0x874f, 0x874e, 0x8755, 0x8cf2, 0x8d57, 0x8759, 0x8749, 0x875b,
  111. 0x8d58, 0x8746, 0x8d56, 0x8cf8, 0x8765, 0x8768, 0x8cfa, 0x876f,
  112. 0x8772, 0x8773, 0x876d, 0x8ce9, 0x8ce6, 0x8774, 0x8cec, 0x8cfe,
  113. 0x8764, 0x8cdb, 0x8775, 0x8cdd, 0x8cee, 0x875f, 0x8778, 0x8779,
  114. 0x8cde, 0x8767, 0x8cfb, 0x8776, 0x8cf7, 0x8ce8, 0x876b, 0x8cfc,
  115. 0x8ced, 0x8d48, 0x8cf5, 0x8cf9, 0x8c62, 0x8d40, 0x8761, 0x876e,
  116. 0x8cf1, 0x8d42, 0x8ce2, 0x8ce1, 0x8ceb, 0x8751, 0x8ce7, 0x8762,
  117. 0x8763, 0x8cf0, 0x8750, 0x8d5b, 0x8d53, 0x8760, 0x875e, 0x8cf6,
  118. 0x8d4d, 0x8753, 0x8754, 0x8745, 0x8752, 0x8d50, 0x876c, 0x875a,
  119. 0x8748, 0x874a, 0x8d4f, 0x8d43, 0x8769, 0x8d46, 0x8cfd, 0x8777,
  120. 0x8771, 0x8d49, 0x8756,
  121. };
  122. static const Summary16 hkscs2004_uni2indx_page34[5] = {
  123. /* 0x3400 */
  124. { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 },
  125. { 0, 0x0400 },
  126. };
  127. static const Summary16 hkscs2004_uni2indx_page36[56] = {
  128. /* 0x3600 */
  129. { 1, 0x0000 }, { 1, 0x0000 }, { 1, 0x0020 }, { 2, 0x0000 },
  130. { 2, 0x0000 }, { 2, 0x0000 }, { 2, 0x0002 }, { 3, 0x0000 },
  131. { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 },
  132. { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 },
  133. /* 0x3700 */
  134. { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 },
  135. { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 },
  136. { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 },
  137. { 3, 0x0000 }, { 3, 0x0040 }, { 4, 0x0000 }, { 4, 0x0000 },
  138. /* 0x3800 */
  139. { 4, 0x0000 }, { 4, 0x0000 }, { 4, 0x0000 }, { 4, 0x0000 },
  140. { 4, 0x0000 }, { 4, 0x0000 }, { 4, 0x0000 }, { 4, 0x0000 },
  141. { 4, 0x0000 }, { 4, 0x0000 }, { 4, 0x0000 }, { 4, 0x0000 },
  142. { 4, 0x0000 }, { 4, 0x0010 }, { 5, 0x0000 }, { 5, 0x0000 },
  143. /* 0x3900 */
  144. { 5, 0x0000 }, { 5, 0x0000 }, { 5, 0x0000 }, { 5, 0x0000 },
  145. { 5, 0x0000 }, { 5, 0x0000 }, { 5, 0x0000 }, { 5, 0x0100 },
  146. };
  147. static const Summary16 hkscs2004_uni2indx_page3b[10] = {
  148. /* 0x3b00 */
  149. { 6, 0x0000 }, { 6, 0x0000 }, { 6, 0x0000 }, { 6, 0x0000 },
  150. { 6, 0x0000 }, { 6, 0x0000 }, { 6, 0x0000 }, { 6, 0x0000 },
  151. { 6, 0x0000 }, { 6, 0x0020 },
  152. };
  153. static const Summary16 hkscs2004_uni2indx_page3d[16] = {
  154. /* 0x3d00 */
  155. { 7, 0x0000 }, { 7, 0x0004 }, { 8, 0x0000 }, { 8, 0x0000 },
  156. { 8, 0x0000 }, { 8, 0x0000 }, { 8, 0x0000 }, { 8, 0x0000 },
  157. { 8, 0x0100 }, { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 },
  158. { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0010 },
  159. };
  160. static const Summary16 hkscs2004_uni2indx_page3f[47] = {
  161. /* 0x3f00 */
  162. { 10, 0x0080 }, { 11, 0x0000 }, { 11, 0x0000 }, { 11, 0x0000 },
  163. { 11, 0x0000 }, { 11, 0x0000 }, { 11, 0x0000 }, { 11, 0x0000 },
  164. { 11, 0x0000 }, { 11, 0x0000 }, { 11, 0x0000 }, { 11, 0x0000 },
  165. { 11, 0x0100 }, { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 },
  166. /* 0x4000 */
  167. { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 },
  168. { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 },
  169. { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 },
  170. { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0100 },
  171. /* 0x4100 */
  172. { 13, 0x0004 }, { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0000 },
  173. { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x1000 },
  174. { 15, 0x0000 }, { 15, 0x0000 }, { 15, 0x0000 }, { 15, 0x0000 },
  175. { 15, 0x0000 }, { 15, 0x0000 }, { 15, 0x2000 },
  176. };
  177. static const Summary16 hkscs2004_uni2indx_page43[69] = {
  178. /* 0x4300 */
  179. { 16, 0x0000 }, { 16, 0x0000 }, { 16, 0x0000 }, { 16, 0x0000 },
  180. { 16, 0x0000 }, { 16, 0x0000 }, { 16, 0x0000 }, { 16, 0x0000 },
  181. { 16, 0x0000 }, { 16, 0x0400 }, { 17, 0x0000 }, { 17, 0x0000 },
  182. { 17, 0x0000 }, { 17, 0x0000 }, { 17, 0x0000 }, { 17, 0x0001 },
  183. /* 0x4400 */
  184. { 18, 0x0000 }, { 18, 0x0000 }, { 18, 0x0000 }, { 18, 0x0000 },
  185. { 18, 0x0000 }, { 18, 0x0000 }, { 18, 0x0000 }, { 18, 0x0000 },
  186. { 18, 0x0000 }, { 18, 0x0000 }, { 18, 0x0000 }, { 18, 0x2000 },
  187. { 19, 0x0008 }, { 20, 0x4000 }, { 21, 0x0000 }, { 21, 0x0000 },
  188. /* 0x4500 */
  189. { 21, 0x0000 }, { 21, 0x0800 }, { 22, 0x0000 }, { 22, 0x0040 },
  190. { 23, 0x0000 }, { 23, 0x0100 }, { 24, 0x2002 }, { 26, 0x0100 },
  191. { 27, 0x0000 }, { 27, 0x0000 }, { 27, 0x0040 }, { 28, 0x0008 },
  192. { 29, 0x0000 }, { 29, 0x0400 }, { 30, 0x0400 }, { 31, 0x0000 },
  193. /* 0x4600 */
  194. { 31, 0x0008 }, { 32, 0x0000 }, { 32, 0x0000 }, { 32, 0x0000 },
  195. { 32, 0x0000 }, { 32, 0x0000 }, { 32, 0x0000 }, { 32, 0x0000 },
  196. { 32, 0x0000 }, { 32, 0x0000 }, { 32, 0x0002 }, { 33, 0x0800 },
  197. { 34, 0x0000 }, { 34, 0x0000 }, { 34, 0x0000 }, { 34, 0x0080 },
  198. /* 0x4700 */
  199. { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0040 },
  200. { 36, 0x8010 },
  201. };
  202. static const Summary16 hkscs2004_uni2indx_page4a[11] = {
  203. /* 0x4a00 */
  204. { 38, 0x0000 }, { 38, 0x0000 }, { 38, 0x0000 }, { 38, 0x0000 },
  205. { 38, 0x0000 }, { 38, 0x0000 }, { 38, 0x0000 }, { 38, 0x0000 },
  206. { 38, 0x0000 }, { 38, 0x0000 }, { 38, 0x0010 },
  207. };
  208. static const Summary16 hkscs2004_uni2indx_page4c[25] = {
  209. /* 0x4c00 */
  210. { 39, 0x0000 }, { 39, 0x0000 }, { 39, 0x0000 }, { 39, 0x0004 },
  211. { 40, 0x0081 }, { 42, 0x0080 }, { 43, 0x0000 }, { 43, 0x0880 },
  212. { 45, 0x0020 }, { 46, 0x0000 }, { 46, 0x0000 }, { 46, 0x0000 },
  213. { 46, 0x0000 }, { 46, 0x0000 }, { 46, 0x0004 }, { 47, 0x0000 },
  214. /* 0x4d00 */
  215. { 47, 0x0080 }, { 48, 0x0000 }, { 48, 0x0000 }, { 48, 0x0000 },
  216. { 48, 0x0000 }, { 48, 0x0000 }, { 48, 0x0000 }, { 48, 0x00c0 },
  217. { 50, 0x0200 },
  218. };
  219. static const Summary16 hkscs2004_uni2indx_page4f[12] = {
  220. /* 0x4f00 */
  221. { 51, 0x0000 }, { 51, 0x0000 }, { 51, 0x0000 }, { 51, 0x0000 },
  222. { 51, 0x0000 }, { 51, 0x0000 }, { 51, 0x0000 }, { 51, 0x0000 },
  223. { 51, 0x0000 }, { 51, 0x0000 }, { 51, 0x0000 }, { 51, 0x0010 },
  224. };
  225. static const Summary16 hkscs2004_uni2indx_page56[16] = {
  226. /* 0x5600 */
  227. { 52, 0x0000 }, { 52, 0x0000 }, { 52, 0x0000 }, { 52, 0x0000 },
  228. { 52, 0x0000 }, { 52, 0x0000 }, { 52, 0x0000 }, { 52, 0x0000 },
  229. { 52, 0x0000 }, { 52, 0x0000 }, { 52, 0x0000 }, { 52, 0x0000 },
  230. { 52, 0x0000 }, { 52, 0x0000 }, { 52, 0x0000 }, { 52, 0x0800 },
  231. };
  232. static const Summary16 hkscs2004_uni2indx_page59[72] = {
  233. /* 0x5900 */
  234. { 53, 0x0000 }, { 53, 0x2000 }, { 54, 0x0000 }, { 54, 0x0000 },
  235. { 54, 0x0000 }, { 54, 0x0000 }, { 54, 0x0000 }, { 54, 0x0000 },
  236. { 54, 0x0000 }, { 54, 0x0000 }, { 54, 0x0000 }, { 54, 0x8000 },
  237. { 55, 0x0000 }, { 55, 0x0000 }, { 55, 0x0000 }, { 55, 0x0000 },
  238. /* 0x5a00 */
  239. { 55, 0x0000 }, { 55, 0x0000 }, { 55, 0x0000 }, { 55, 0x0000 },
  240. { 55, 0x0000 }, { 55, 0x0000 }, { 55, 0x0000 }, { 55, 0x0000 },
  241. { 55, 0x0000 }, { 55, 0x0000 }, { 55, 0x0010 }, { 56, 0x0000 },
  242. { 56, 0x0000 }, { 56, 0x0002 }, { 57, 0x0000 }, { 57, 0x0000 },
  243. /* 0x5b00 */
  244. { 57, 0x0000 }, { 57, 0x0000 }, { 57, 0x0000 }, { 57, 0x0000 },
  245. { 57, 0x0000 }, { 57, 0x0000 }, { 57, 0x0000 }, { 57, 0x0000 },
  246. { 57, 0x0000 }, { 57, 0x0000 }, { 57, 0x0000 }, { 57, 0x0080 },
  247. { 58, 0x0000 }, { 58, 0x0800 }, { 59, 0x0000 }, { 59, 0x0000 },
  248. /* 0x5c00 */
  249. { 59, 0x0000 }, { 59, 0x0000 }, { 59, 0x0000 }, { 59, 0x0000 },
  250. { 59, 0x0000 }, { 59, 0x0000 }, { 59, 0x0000 }, { 59, 0x0100 },
  251. { 60, 0x0000 }, { 60, 0x0000 }, { 60, 0x0000 }, { 60, 0x0000 },
  252. { 60, 0x0000 }, { 60, 0x0020 }, { 61, 0x0000 }, { 61, 0x1000 },
  253. /* 0x5d00 */
  254. { 62, 0x0000 }, { 62, 0x0000 }, { 62, 0x0000 }, { 62, 0x0000 },
  255. { 62, 0x0000 }, { 62, 0x0000 }, { 62, 0x0000 }, { 62, 0x0100 },
  256. };
  257. static const Summary16 hkscs2004_uni2indx_page5f[4] = {
  258. /* 0x5f00 */
  259. { 63, 0x0000 }, { 63, 0x0000 }, { 63, 0x0000 }, { 63, 0x0800 },
  260. };
  261. static const Summary16 hkscs2004_uni2indx_page66[23] = {
  262. /* 0x6600 */
  263. { 64, 0x0000 }, { 64, 0x0000 }, { 64, 0x0000 }, { 64, 0x0000 },
  264. { 64, 0x2000 }, { 65, 0x0000 }, { 65, 0x0000 }, { 65, 0x0000 },
  265. { 65, 0x0000 }, { 65, 0x0000 }, { 65, 0x0000 }, { 65, 0x0000 },
  266. { 65, 0x0000 }, { 65, 0x0000 }, { 65, 0x0080 }, { 66, 0x0000 },
  267. /* 0x6700 */
  268. { 66, 0x0000 }, { 66, 0x0000 }, { 66, 0x0000 }, { 66, 0x0000 },
  269. { 66, 0x0000 }, { 66, 0x0000 }, { 66, 0x4000 },
  270. };
  271. static const Summary16 hkscs2004_uni2indx_page6e[6] = {
  272. /* 0x6e00 */
  273. { 67, 0x0000 }, { 67, 0x0000 }, { 67, 0x0000 }, { 67, 0x0000 },
  274. { 67, 0x0000 }, { 67, 0x0080 },
  275. };
  276. static const Summary16 hkscs2004_uni2indx_page71[19] = {
  277. /* 0x7100 */
  278. { 68, 0x0000 }, { 68, 0x0000 }, { 68, 0x0000 }, { 68, 0x0000 },
  279. { 68, 0x0000 }, { 68, 0x0080 }, { 69, 0x0000 }, { 69, 0x0000 },
  280. { 69, 0x0000 }, { 69, 0x0000 }, { 69, 0x0000 }, { 69, 0x0000 },
  281. { 69, 0x0000 }, { 69, 0x0000 }, { 69, 0x0000 }, { 69, 0x0000 },
  282. /* 0x7200 */
  283. { 69, 0x0000 }, { 69, 0x0000 }, { 69, 0x0020 },
  284. };
  285. static const Summary16 hkscs2004_uni2indx_page74[10] = {
  286. /* 0x7400 */
  287. { 70, 0x0000 }, { 70, 0x0000 }, { 70, 0x0000 }, { 70, 0x0000 },
  288. { 70, 0x0000 }, { 70, 0x0000 }, { 70, 0x0002 }, { 71, 0x0000 },
  289. { 71, 0x0000 }, { 71, 0x2000 },
  290. };
  291. static const Summary16 hkscs2004_uni2indx_page79[13] = {
  292. /* 0x7900 */
  293. { 72, 0x0000 }, { 72, 0x0000 }, { 72, 0x0000 }, { 72, 0x0000 },
  294. { 72, 0x0000 }, { 72, 0x0000 }, { 72, 0x0000 }, { 72, 0x0000 },
  295. { 72, 0x0000 }, { 72, 0x0000 }, { 72, 0x0000 }, { 72, 0x0000 },
  296. { 72, 0x0400 },
  297. };
  298. static const Summary16 hkscs2004_uni2indx_page7d[10] = {
  299. /* 0x7d00 */
  300. { 73, 0x0000 }, { 73, 0x0000 }, { 73, 0x0000 }, { 73, 0x0000 },
  301. { 73, 0x0000 }, { 73, 0x0000 }, { 73, 0x0000 }, { 73, 0x0000 },
  302. { 73, 0x0000 }, { 73, 0x0020 },
  303. };
  304. static const Summary16 hkscs2004_uni2indx_page81[7] = {
  305. /* 0x8100 */
  306. { 74, 0x0000 }, { 74, 0x0000 }, { 74, 0x0000 }, { 74, 0x0000 },
  307. { 74, 0x0000 }, { 74, 0x0000 }, { 74, 0x1000 },
  308. };
  309. static const Summary16 hkscs2004_uni2indx_page85[10] = {
  310. /* 0x8500 */
  311. { 75, 0x0000 }, { 75, 0x0000 }, { 75, 0x0000 }, { 75, 0x0000 },
  312. { 75, 0x0000 }, { 75, 0x0000 }, { 75, 0x0000 }, { 75, 0x0000 },
  313. { 75, 0x0000 }, { 75, 0x0008 },
  314. };
  315. static const Summary16 hkscs2004_uni2indx_page8a[16] = {
  316. /* 0x8a00 */
  317. { 76, 0x0000 }, { 76, 0x0000 }, { 76, 0x0000 }, { 76, 0x0000 },
  318. { 76, 0x0000 }, { 76, 0x0000 }, { 76, 0x0000 }, { 76, 0x0000 },
  319. { 76, 0x0000 }, { 76, 0x0000 }, { 76, 0x0000 }, { 76, 0x0000 },
  320. { 76, 0x1000 }, { 77, 0x0000 }, { 77, 0x0000 }, { 77, 0x0200 },
  321. };
  322. static const Summary16 hkscs2004_uni2indx_page97[22] = {
  323. /* 0x9700 */
  324. { 78, 0x0000 }, { 78, 0x0000 }, { 78, 0x0000 }, { 78, 0x0010 },
  325. { 79, 0x0000 }, { 79, 0x0000 }, { 79, 0x0000 }, { 79, 0x0000 },
  326. { 79, 0x0000 }, { 79, 0x0000 }, { 79, 0x0000 }, { 79, 0x0000 },
  327. { 79, 0x0000 }, { 79, 0x0000 }, { 79, 0x0000 }, { 79, 0x0000 },
  328. /* 0x9800 */
  329. { 79, 0x0000 }, { 79, 0x0000 }, { 79, 0x0000 }, { 79, 0x0000 },
  330. { 79, 0x0000 }, { 79, 0x0040 },
  331. };
  332. static const Summary16 hkscs2004_uni2indx_page9f[12] = {
  333. /* 0x9f00 */
  334. { 80, 0x0000 }, { 80, 0x0000 }, { 80, 0x0000 }, { 80, 0x0000 },
  335. { 80, 0x0000 }, { 80, 0x0000 }, { 80, 0x0000 }, { 80, 0x0000 },
  336. { 80, 0x0000 }, { 80, 0x0000 }, { 80, 0x0000 }, { 80, 0x000c },
  337. };
  338. static const Summary16 hkscs2004_uni2indx_page201[20] = {
  339. /* 0x20100 */
  340. { 82, 0x0000 }, { 82, 0x0000 }, { 82, 0x0000 }, { 82, 0x0000 },
  341. { 82, 0x0000 }, { 82, 0x0000 }, { 82, 0x0000 }, { 82, 0x0000 },
  342. { 82, 0x0000 }, { 82, 0x0000 }, { 82, 0x0010 }, { 83, 0x0000 },
  343. { 83, 0x0000 }, { 83, 0x0000 }, { 83, 0x0000 }, { 83, 0x0000 },
  344. /* 0x20200 */
  345. { 83, 0x0000 }, { 83, 0x0000 }, { 83, 0x0000 }, { 83, 0x0200 },
  346. };
  347. static const Summary16 hkscs2004_uni2indx_page20a[26] = {
  348. /* 0x20a00 */
  349. { 84, 0x0000 }, { 84, 0x0000 }, { 84, 0x0000 }, { 84, 0x0000 },
  350. { 84, 0x0000 }, { 84, 0x0000 }, { 84, 0x8000 }, { 85, 0x0000 },
  351. { 85, 0x0000 }, { 85, 0x0000 }, { 85, 0x0000 }, { 85, 0x0000 },
  352. { 85, 0x0000 }, { 85, 0x0000 }, { 85, 0x0000 }, { 85, 0x0000 },
  353. /* 0x20b00 */
  354. { 85, 0x0000 }, { 85, 0x0000 }, { 85, 0x0000 }, { 85, 0x0000 },
  355. { 85, 0x0000 }, { 85, 0x0000 }, { 85, 0x0000 }, { 85, 0x0000 },
  356. { 85, 0x0000 }, { 85, 0x8000 },
  357. };
  358. static const Summary16 hkscs2004_uni2indx_page21a[7] = {
  359. /* 0x21a00 */
  360. { 86, 0x0000 }, { 86, 0x0000 }, { 86, 0x0000 }, { 86, 0x0000 },
  361. { 86, 0x0000 }, { 86, 0x0000 }, { 86, 0x0008 },
  362. };
  363. static const Summary16 hkscs2004_uni2indx_page21d[19] = {
  364. /* 0x21d00 */
  365. { 87, 0x0000 }, { 87, 0x0000 }, { 87, 0x0000 }, { 87, 0x0000 },
  366. { 87, 0x0000 }, { 87, 0x4000 }, { 88, 0x0000 }, { 88, 0x0000 },
  367. { 88, 0x0000 }, { 88, 0x0000 }, { 88, 0x0000 }, { 88, 0x0000 },
  368. { 88, 0x0000 }, { 88, 0x0000 }, { 88, 0x0000 }, { 88, 0x0000 },
  369. /* 0x21e00 */
  370. { 88, 0x0000 }, { 88, 0x0000 }, { 88, 0x0008 },
  371. };
  372. static const Summary16 hkscs2004_uni2indx_page221[13] = {
  373. /* 0x22100 */
  374. { 89, 0x0000 }, { 89, 0x0000 }, { 89, 0x0000 }, { 89, 0x0000 },
  375. { 89, 0x0000 }, { 89, 0x0000 }, { 89, 0x0000 }, { 89, 0x0000 },
  376. { 89, 0x0000 }, { 89, 0x0000 }, { 89, 0x0000 }, { 89, 0x0000 },
  377. { 89, 0x0002 },
  378. };
  379. static const Summary16 hkscs2004_uni2indx_page227[10] = {
  380. /* 0x22700 */
  381. { 90, 0x0000 }, { 90, 0x0000 }, { 90, 0x0000 }, { 90, 0x0000 },
  382. { 90, 0x0000 }, { 90, 0x0000 }, { 90, 0x0000 }, { 90, 0x0000 },
  383. { 90, 0x0000 }, { 90, 0x0040 },
  384. };
  385. static const Summary16 hkscs2004_uni2indx_page232[6] = {
  386. /* 0x23200 */
  387. { 91, 0x0000 }, { 91, 0x0000 }, { 91, 0x0000 }, { 91, 0x0000 },
  388. { 91, 0x0000 }, { 91, 0x0040 },
  389. };
  390. static const Summary16 hkscs2004_uni2indx_page235[18] = {
  391. /* 0x23500 */
  392. { 92, 0x0000 }, { 92, 0x0000 }, { 92, 0x0000 }, { 92, 0x0000 },
  393. { 92, 0x0000 }, { 92, 0x0002 }, { 93, 0x0000 }, { 93, 0x0000 },
  394. { 93, 0x0000 }, { 93, 0x0000 }, { 93, 0x0000 }, { 93, 0x0000 },
  395. { 93, 0x0000 }, { 93, 0x0000 }, { 93, 0x0000 }, { 93, 0x0000 },
  396. /* 0x23600 */
  397. { 93, 0x0000 }, { 93, 0x0080 },
  398. };
  399. static const Summary16 hkscs2004_uni2indx_page23b[2] = {
  400. /* 0x23b00 */
  401. { 94, 0x0000 }, { 94, 0x0400 },
  402. };
  403. static const Summary16 hkscs2004_uni2indx_page23e[47] = {
  404. /* 0x23e00 */
  405. { 95, 0x0040 }, { 96, 0x0000 }, { 96, 0x0000 }, { 96, 0x0000 },
  406. { 96, 0x0000 }, { 96, 0x0000 }, { 96, 0x0000 }, { 96, 0x0000 },
  407. { 96, 0x0000 }, { 96, 0x0000 }, { 96, 0x0000 }, { 96, 0x0000 },
  408. { 96, 0x0000 }, { 96, 0x0000 }, { 96, 0x0000 }, { 96, 0x0000 },
  409. /* 0x23f00 */
  410. { 96, 0x0000 }, { 96, 0x0000 }, { 96, 0x0000 }, { 96, 0x0000 },
  411. { 96, 0x0000 }, { 96, 0x0000 }, { 96, 0x0002 }, { 97, 0x0000 },
  412. { 97, 0x0000 }, { 97, 0x0000 }, { 97, 0x0000 }, { 97, 0x0000 },
  413. { 97, 0x0000 }, { 97, 0x0000 }, { 97, 0x0000 }, { 97, 0x0000 },
  414. /* 0x24000 */
  415. { 97, 0x0000 }, { 97, 0x0000 }, { 97, 0x0000 }, { 97, 0x0000 },
  416. { 97, 0x0000 }, { 97, 0x0000 }, { 97, 0x0000 }, { 97, 0x0000 },
  417. { 97, 0x0000 }, { 97, 0x0000 }, { 97, 0x0000 }, { 97, 0x0000 },
  418. { 97, 0x0000 }, { 97, 0x0000 }, { 97, 0x1000 },
  419. };
  420. static const Summary16 hkscs2004_uni2indx_page242[12] = {
  421. /* 0x24200 */
  422. { 98, 0x0000 }, { 98, 0x0000 }, { 98, 0x0000 }, { 98, 0x0000 },
  423. { 98, 0x0000 }, { 98, 0x0000 }, { 98, 0x0000 }, { 98, 0x0000 },
  424. { 98, 0x0000 }, { 98, 0x0000 }, { 98, 0x0000 }, { 98, 0x8000 },
  425. };
  426. static const Summary16 hkscs2004_uni2indx_page24b[1] = {
  427. /* 0x24b00 */
  428. { 99, 0x8000 },
  429. };
  430. static const Summary16 hkscs2004_uni2indx_page254[10] = {
  431. /* 0x25400 */
  432. { 100, 0x0000 }, { 100, 0x0000 }, { 100, 0x0000 }, { 100, 0x0000 },
  433. { 100, 0x0000 }, { 100, 0x0000 }, { 100, 0x0000 }, { 100, 0x0000 },
  434. { 100, 0x0000 }, { 100, 0x0400 },
  435. };
  436. static const Summary16 hkscs2004_uni2indx_page25a[6] = {
  437. /* 0x25a00 */
  438. { 101, 0x0000 }, { 101, 0x0000 }, { 101, 0x0000 }, { 101, 0x0000 },
  439. { 101, 0x0000 }, { 101, 0x0010 },
  440. };
  441. static const Summary16 hkscs2004_uni2indx_page26b[21] = {
  442. /* 0x26b00 */
  443. { 102, 0x0000 }, { 102, 0x0000 }, { 102, 0x0008 }, { 103, 0x0000 },
  444. { 103, 0x0000 }, { 103, 0x0000 }, { 103, 0x0000 }, { 103, 0x0000 },
  445. { 103, 0x0000 }, { 103, 0x0000 }, { 103, 0x0000 }, { 103, 0x0000 },
  446. { 103, 0x0000 }, { 103, 0x0000 }, { 103, 0x0000 }, { 103, 0x0000 },
  447. /* 0x26c00 */
  448. { 103, 0x0000 }, { 103, 0x0000 }, { 103, 0x0000 }, { 103, 0x0000 },
  449. { 103, 0x0042 },
  450. };
  451. static const Summary16 hkscs2004_uni2indx_page26e[9] = {
  452. /* 0x26e00 */
  453. { 105, 0x0000 }, { 105, 0x0000 }, { 105, 0x0000 }, { 105, 0x0000 },
  454. { 105, 0x0000 }, { 105, 0x0000 }, { 105, 0x0000 }, { 105, 0x0000 },
  455. { 105, 0x0800 },
  456. };
  457. static const Summary16 hkscs2004_uni2indx_page270[14] = {
  458. /* 0x27000 */
  459. { 106, 0x0000 }, { 106, 0x0000 }, { 106, 0x0000 }, { 106, 0x0000 },
  460. { 106, 0x0000 }, { 106, 0x0000 }, { 106, 0x0000 }, { 106, 0x0000 },
  461. { 106, 0x0000 }, { 106, 0x0000 }, { 106, 0x0000 }, { 106, 0x0000 },
  462. { 106, 0x0000 }, { 106, 0x0004 },
  463. };
  464. static const Summary16 hkscs2004_uni2indx_page272[32] = {
  465. /* 0x27200 */
  466. { 107, 0x0000 }, { 107, 0x0000 }, { 107, 0x0000 }, { 107, 0x0000 },
  467. { 107, 0x0000 }, { 107, 0x0000 }, { 107, 0x0080 }, { 108, 0x0000 },
  468. { 108, 0x0000 }, { 108, 0x0000 }, { 108, 0x0000 }, { 108, 0x0000 },
  469. { 108, 0x0000 }, { 108, 0x0000 }, { 108, 0x0000 }, { 108, 0x0000 },
  470. /* 0x27300 */
  471. { 108, 0x0000 }, { 108, 0x0000 }, { 108, 0x0000 }, { 108, 0x0000 },
  472. { 108, 0x0000 }, { 108, 0x0004 }, { 109, 0x0000 }, { 109, 0x0000 },
  473. { 109, 0x0000 }, { 109, 0x0000 }, { 109, 0x0000 }, { 109, 0x0000 },
  474. { 109, 0x0000 }, { 109, 0x0000 }, { 109, 0x0000 }, { 109, 0x8000 },
  475. };
  476. static const Summary16 hkscs2004_uni2indx_page27b[29] = {
  477. /* 0x27b00 */
  478. { 110, 0x0000 }, { 110, 0x0000 }, { 110, 0x0000 }, { 110, 0x0000 },
  479. { 110, 0x0000 }, { 110, 0x0000 }, { 110, 0x0000 }, { 110, 0x0000 },
  480. { 110, 0x0000 }, { 110, 0x0000 }, { 110, 0x0000 }, { 110, 0x0000 },
  481. { 110, 0x0000 }, { 110, 0x0000 }, { 110, 0x8000 }, { 111, 0x0000 },
  482. /* 0x27c00 */
  483. { 111, 0x0000 }, { 111, 0x0000 }, { 111, 0x0000 }, { 111, 0x0000 },
  484. { 111, 0x0000 }, { 111, 0x0000 }, { 111, 0x1000 }, { 112, 0x0000 },
  485. { 112, 0x0000 }, { 112, 0x0000 }, { 112, 0x0000 }, { 112, 0x0002 },
  486. { 113, 0x0020 },
  487. };
  488. static const Summary16 hkscs2004_uni2indx_page286[12] = {
  489. /* 0x28600 */
  490. { 114, 0x0000 }, { 114, 0x0000 }, { 114, 0x0000 }, { 114, 0x0000 },
  491. { 114, 0x0000 }, { 114, 0x0000 }, { 114, 0x0000 }, { 114, 0x0000 },
  492. { 114, 0x0000 }, { 114, 0x0000 }, { 114, 0x0000 }, { 114, 0x0004 },
  493. };
  494. static const Summary16 hkscs2004_uni2indx_page289[7] = {
  495. /* 0x28900 */
  496. { 115, 0x0000 }, { 115, 0x0000 }, { 115, 0x0000 }, { 115, 0x0000 },
  497. { 115, 0x0000 }, { 115, 0x0000 }, { 115, 0x2000 },
  498. };
  499. static const Summary16 hkscs2004_uni2indx_page28b[12] = {
  500. /* 0x28b00 */
  501. { 116, 0x0000 }, { 116, 0x0000 }, { 116, 0x0000 }, { 116, 0x0000 },
  502. { 116, 0x0000 }, { 116, 0x0000 }, { 116, 0x0000 }, { 116, 0x0000 },
  503. { 116, 0x0000 }, { 116, 0x0000 }, { 116, 0x0000 }, { 116, 0x0200 },
  504. };
  505. static const Summary16 hkscs2004_uni2indx_page290[8] = {
  506. /* 0x29000 */
  507. { 117, 0x0000 }, { 117, 0x0000 }, { 117, 0x0000 }, { 117, 0x0000 },
  508. { 117, 0x0000 }, { 117, 0x0000 }, { 117, 0x0000 }, { 117, 0x0200 },
  509. };
  510. static const Summary16 hkscs2004_uni2indx_page298[21] = {
  511. /* 0x29800 */
  512. { 118, 0x0000 }, { 118, 0x0000 }, { 118, 0x0000 }, { 118, 0x0000 },
  513. { 118, 0x0000 }, { 118, 0x0000 }, { 118, 0x0000 }, { 118, 0x0000 },
  514. { 118, 0x0000 }, { 118, 0x0000 }, { 118, 0x0000 }, { 118, 0x0000 },
  515. { 118, 0x0000 }, { 118, 0x0000 }, { 118, 0x0000 }, { 118, 0x0400 },
  516. /* 0x29900 */
  517. { 119, 0x0000 }, { 119, 0x0000 }, { 119, 0x0000 }, { 119, 0x0000 },
  518. { 119, 0x0020 },
  519. };
  520. static const Summary16 hkscs2004_uni2indx_page29e[12] = {
  521. /* 0x29e00 */
  522. { 120, 0x0000 }, { 120, 0x0000 }, { 120, 0x0000 }, { 120, 0x0000 },
  523. { 120, 0x0000 }, { 120, 0x0000 }, { 120, 0x0000 }, { 120, 0x0000 },
  524. { 120, 0x0000 }, { 120, 0x0000 }, { 120, 0x0000 }, { 120, 0x0001 },
  525. };
  526. static const Summary16 hkscs2004_uni2indx_page2a1[12] = {
  527. /* 0x2a100 */
  528. { 121, 0x0000 }, { 121, 0x0000 }, { 121, 0x0000 }, { 121, 0x0000 },
  529. { 121, 0x0000 }, { 121, 0x0000 }, { 121, 0x0000 }, { 121, 0x0000 },
  530. { 121, 0x0000 }, { 121, 0x0000 }, { 121, 0x0000 }, { 121, 0x0020 },
  531. };
  532. static const Summary16 hkscs2004_uni2indx_page2a3[6] = {
  533. /* 0x2a300 */
  534. { 122, 0x0000 }, { 122, 0x0000 }, { 122, 0x0000 }, { 122, 0x0000 },
  535. { 122, 0x0000 }, { 122, 0x0002 },
  536. };
  537. static int
  538. hkscs2004_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n)
  539. {
  540. if (n >= 2) {
  541. const Summary16 *summary = NULL;
  542. if (wc < 0x21a00) {
  543. if (wc < 0x6e00) {
  544. if (wc >= 0x3400 && wc < 0x3450)
  545. summary = &hkscs2004_uni2indx_page34[(wc>>4)-0x340];
  546. else if (wc >= 0x3600 && wc < 0x3980)
  547. summary = &hkscs2004_uni2indx_page36[(wc>>4)-0x360];
  548. else if (wc >= 0x3b00 && wc < 0x3ba0)
  549. summary = &hkscs2004_uni2indx_page3b[(wc>>4)-0x3b0];
  550. else if (wc >= 0x3d00 && wc < 0x3e00)
  551. summary = &hkscs2004_uni2indx_page3d[(wc>>4)-0x3d0];
  552. else if (wc >= 0x3f00 && wc < 0x41f0)
  553. summary = &hkscs2004_uni2indx_page3f[(wc>>4)-0x3f0];
  554. else if (wc >= 0x4300 && wc < 0x4750)
  555. summary = &hkscs2004_uni2indx_page43[(wc>>4)-0x430];
  556. else if (wc >= 0x4a00 && wc < 0x4ab0)
  557. summary = &hkscs2004_uni2indx_page4a[(wc>>4)-0x4a0];
  558. else if (wc >= 0x4c00 && wc < 0x4d90)
  559. summary = &hkscs2004_uni2indx_page4c[(wc>>4)-0x4c0];
  560. else if (wc >= 0x4f00 && wc < 0x4fc0)
  561. summary = &hkscs2004_uni2indx_page4f[(wc>>4)-0x4f0];
  562. else if (wc >= 0x5600 && wc < 0x5700)
  563. summary = &hkscs2004_uni2indx_page56[(wc>>4)-0x560];
  564. else if (wc >= 0x5900 && wc < 0x5d80)
  565. summary = &hkscs2004_uni2indx_page59[(wc>>4)-0x590];
  566. else if (wc >= 0x5f00 && wc < 0x5f40)
  567. summary = &hkscs2004_uni2indx_page5f[(wc>>4)-0x5f0];
  568. else if (wc >= 0x6600 && wc < 0x6770)
  569. summary = &hkscs2004_uni2indx_page66[(wc>>4)-0x660];
  570. } else {
  571. if (wc >= 0x6e00 && wc < 0x6e60)
  572. summary = &hkscs2004_uni2indx_page6e[(wc>>4)-0x6e0];
  573. else if (wc >= 0x7100 && wc < 0x7230)
  574. summary = &hkscs2004_uni2indx_page71[(wc>>4)-0x710];
  575. else if (wc >= 0x7400 && wc < 0x74a0)
  576. summary = &hkscs2004_uni2indx_page74[(wc>>4)-0x740];
  577. else if (wc >= 0x7900 && wc < 0x79d0)
  578. summary = &hkscs2004_uni2indx_page79[(wc>>4)-0x790];
  579. else if (wc >= 0x7d00 && wc < 0x7da0)
  580. summary = &hkscs2004_uni2indx_page7d[(wc>>4)-0x7d0];
  581. else if (wc >= 0x8100 && wc < 0x8170)
  582. summary = &hkscs2004_uni2indx_page81[(wc>>4)-0x810];
  583. else if (wc >= 0x8500 && wc < 0x85a0)
  584. summary = &hkscs2004_uni2indx_page85[(wc>>4)-0x850];
  585. else if (wc >= 0x8a00 && wc < 0x8b00)
  586. summary = &hkscs2004_uni2indx_page8a[(wc>>4)-0x8a0];
  587. else if (wc >= 0x9700 && wc < 0x9860)
  588. summary = &hkscs2004_uni2indx_page97[(wc>>4)-0x970];
  589. else if (wc >= 0x9f00 && wc < 0x9fc0)
  590. summary = &hkscs2004_uni2indx_page9f[(wc>>4)-0x9f0];
  591. else if (wc >= 0x20100 && wc < 0x20240)
  592. summary = &hkscs2004_uni2indx_page201[(wc>>4)-0x2010];
  593. else if (wc >= 0x20a00 && wc < 0x20ba0)
  594. summary = &hkscs2004_uni2indx_page20a[(wc>>4)-0x20a0];
  595. }
  596. } else {
  597. if (wc < 0x26b00) {
  598. if (wc >= 0x21a00 && wc < 0x21a70)
  599. summary = &hkscs2004_uni2indx_page21a[(wc>>4)-0x21a0];
  600. else if (wc >= 0x21d00 && wc < 0x21e30)
  601. summary = &hkscs2004_uni2indx_page21d[(wc>>4)-0x21d0];
  602. else if (wc >= 0x22100 && wc < 0x221d0)
  603. summary = &hkscs2004_uni2indx_page221[(wc>>4)-0x2210];
  604. else if (wc >= 0x22700 && wc < 0x227a0)
  605. summary = &hkscs2004_uni2indx_page227[(wc>>4)-0x2270];
  606. else if (wc >= 0x23200 && wc < 0x23260)
  607. summary = &hkscs2004_uni2indx_page232[(wc>>4)-0x2320];
  608. else if (wc >= 0x23500 && wc < 0x23620)
  609. summary = &hkscs2004_uni2indx_page235[(wc>>4)-0x2350];
  610. else if (wc >= 0x23b00 && wc < 0x23b20)
  611. summary = &hkscs2004_uni2indx_page23b[(wc>>4)-0x23b0];
  612. else if (wc >= 0x23e00 && wc < 0x240f0)
  613. summary = &hkscs2004_uni2indx_page23e[(wc>>4)-0x23e0];
  614. else if (wc >= 0x24200 && wc < 0x242c0)
  615. summary = &hkscs2004_uni2indx_page242[(wc>>4)-0x2420];
  616. else if (wc >= 0x24b00 && wc < 0x24b10)
  617. summary = &hkscs2004_uni2indx_page24b[(wc>>4)-0x24b0];
  618. else if (wc >= 0x25400 && wc < 0x254a0)
  619. summary = &hkscs2004_uni2indx_page254[(wc>>4)-0x2540];
  620. else if (wc >= 0x25a00 && wc < 0x25a60)
  621. summary = &hkscs2004_uni2indx_page25a[(wc>>4)-0x25a0];
  622. } else {
  623. if (wc >= 0x26b00 && wc < 0x26c50)
  624. summary = &hkscs2004_uni2indx_page26b[(wc>>4)-0x26b0];
  625. else if (wc >= 0x26e00 && wc < 0x26e90)
  626. summary = &hkscs2004_uni2indx_page26e[(wc>>4)-0x26e0];
  627. else if (wc >= 0x27000 && wc < 0x270e0)
  628. summary = &hkscs2004_uni2indx_page270[(wc>>4)-0x2700];
  629. else if (wc >= 0x27200 && wc < 0x27400)
  630. summary = &hkscs2004_uni2indx_page272[(wc>>4)-0x2720];
  631. else if (wc >= 0x27b00 && wc < 0x27cd0)
  632. summary = &hkscs2004_uni2indx_page27b[(wc>>4)-0x27b0];
  633. else if (wc >= 0x28600 && wc < 0x286c0)
  634. summary = &hkscs2004_uni2indx_page286[(wc>>4)-0x2860];
  635. else if (wc >= 0x28900 && wc < 0x28970)
  636. summary = &hkscs2004_uni2indx_page289[(wc>>4)-0x2890];
  637. else if (wc >= 0x28b00 && wc < 0x28bc0)
  638. summary = &hkscs2004_uni2indx_page28b[(wc>>4)-0x28b0];
  639. else if (wc >= 0x29000 && wc < 0x29080)
  640. summary = &hkscs2004_uni2indx_page290[(wc>>4)-0x2900];
  641. else if (wc >= 0x29800 && wc < 0x29950)
  642. summary = &hkscs2004_uni2indx_page298[(wc>>4)-0x2980];
  643. else if (wc >= 0x29e00 && wc < 0x29ec0)
  644. summary = &hkscs2004_uni2indx_page29e[(wc>>4)-0x29e0];
  645. else if (wc >= 0x2a100 && wc < 0x2a1c0)
  646. summary = &hkscs2004_uni2indx_page2a1[(wc>>4)-0x2a10];
  647. else if (wc >= 0x2a300 && wc < 0x2a360)
  648. summary = &hkscs2004_uni2indx_page2a3[(wc>>4)-0x2a30];
  649. }
  650. }
  651. if (summary) {
  652. unsigned short used = summary->used;
  653. unsigned int i = wc & 0x0f;
  654. if (used & ((unsigned short) 1 << i)) {
  655. unsigned short c;
  656. /* Keep in 'used' only the bits 0..i-1. */
  657. used &= ((unsigned short) 1 << i) - 1;
  658. /* Add 'summary->indx' and the number of bits set in 'used'. */
  659. used = (used & 0x5555) + ((used & 0xaaaa) >> 1);
  660. used = (used & 0x3333) + ((used & 0xcccc) >> 2);
  661. used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4);
  662. used = (used & 0x00ff) + (used >> 8);
  663. c = hkscs2004_2charset[summary->indx + used];
  664. r[0] = (c >> 8); r[1] = (c & 0xff);
  665. return 2;
  666. }
  667. }
  668. return RET_ILUNI;
  669. }
  670. return RET_TOOSMALL;
  671. }