iso2022_jp2.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693
  1. /*
  2. * Copyright (C) 1999-2001, 2008 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 Library General Public
  7. * License as published by the Free Software Foundation; either version 2
  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. * Library General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Library General Public
  16. * License along with the GNU LIBICONV Library; see the file COPYING.LIB.
  17. * If not, write to the Free Software Foundation, Inc., 51 Franklin Street,
  18. * Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. /*
  21. * ISO-2022-JP-2
  22. */
  23. /* Specification: RFC 1554 */
  24. /* ESC '(' 'I' for JISX0201 Katakana is an extension not found in RFC 1554 or
  25. CJK.INF, but implemented in glibc-2.1 and qt-2.0. */
  26. #define ESC 0x1b
  27. /*
  28. * The state is composed of one of the following values
  29. */
  30. #define STATE_ASCII 0
  31. #define STATE_JISX0201ROMAN 1
  32. #define STATE_JISX0201KATAKANA 2
  33. #define STATE_JISX0208 3
  34. #define STATE_JISX0212 4
  35. #define STATE_GB2312 5
  36. #define STATE_KSC5601 6
  37. /*
  38. * and one of the following values, << 8
  39. */
  40. #define STATE_G2_NONE 0
  41. #define STATE_G2_ISO8859_1 1
  42. #define STATE_G2_ISO8859_7 2
  43. #define SPLIT_STATE \
  44. unsigned int state1 = state & 0xff, state2 = state >> 8
  45. #define COMBINE_STATE \
  46. state = (state2 << 8) | state1
  47. static int
  48. iso2022_jp2_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
  49. {
  50. state_t state = conv->istate;
  51. SPLIT_STATE;
  52. int count = 0;
  53. unsigned char c;
  54. for (;;) {
  55. c = *s;
  56. if (c == ESC) {
  57. if (n < count+3)
  58. goto none;
  59. if (s[1] == '(') {
  60. if (s[2] == 'B') {
  61. state1 = STATE_ASCII;
  62. s += 3; count += 3;
  63. if (n < count+1)
  64. goto none;
  65. continue;
  66. }
  67. if (s[2] == 'J') {
  68. state1 = STATE_JISX0201ROMAN;
  69. s += 3; count += 3;
  70. if (n < count+1)
  71. goto none;
  72. continue;
  73. }
  74. if (s[2] == 'I') {
  75. state1 = STATE_JISX0201KATAKANA;
  76. s += 3; count += 3;
  77. if (n < count+1)
  78. goto none;
  79. continue;
  80. }
  81. goto ilseq;
  82. }
  83. if (s[1] == '$') {
  84. if (s[2] == '@' || s[2] == 'B') {
  85. /* We don't distinguish JIS X 0208-1978 and JIS X 0208-1983. */
  86. state1 = STATE_JISX0208;
  87. s += 3; count += 3;
  88. if (n < count+1)
  89. goto none;
  90. continue;
  91. }
  92. if (s[2] == 'A') {
  93. state1 = STATE_GB2312;
  94. s += 3; count += 3;
  95. if (n < count+1)
  96. goto none;
  97. continue;
  98. }
  99. if (s[2] == '(') {
  100. if (n < count+4)
  101. goto none;
  102. if (s[3] == 'D') {
  103. state1 = STATE_JISX0212;
  104. s += 4; count += 4;
  105. if (n < count+1)
  106. goto none;
  107. continue;
  108. }
  109. if (s[3] == 'C') {
  110. state1 = STATE_KSC5601;
  111. s += 4; count += 4;
  112. if (n < count+1)
  113. goto none;
  114. continue;
  115. }
  116. goto ilseq;
  117. }
  118. goto ilseq;
  119. }
  120. if (s[1] == '.') {
  121. if (n < count+3)
  122. goto none;
  123. if (s[2] == 'A') {
  124. state2 = STATE_G2_ISO8859_1;
  125. s += 3; count += 3;
  126. if (n < count+1)
  127. goto none;
  128. continue;
  129. }
  130. if (s[2] == 'F') {
  131. state2 = STATE_G2_ISO8859_7;
  132. s += 3; count += 3;
  133. if (n < count+1)
  134. goto none;
  135. continue;
  136. }
  137. goto ilseq;
  138. }
  139. if (s[1] == 'N') {
  140. switch (state2) {
  141. case STATE_G2_NONE:
  142. goto ilseq;
  143. case STATE_G2_ISO8859_1:
  144. if (s[2] < 0x80) {
  145. unsigned char buf = s[2]+0x80;
  146. int ret = iso8859_1_mbtowc(conv,pwc,&buf,1);
  147. if (ret == RET_ILSEQ)
  148. goto ilseq;
  149. if (ret != 1) abort();
  150. COMBINE_STATE;
  151. conv->istate = state;
  152. return count+3;
  153. } else
  154. goto ilseq;
  155. case STATE_G2_ISO8859_7:
  156. if (s[2] < 0x80) {
  157. unsigned char buf = s[2]+0x80;
  158. int ret = iso8859_7_mbtowc(conv,pwc,&buf,1);
  159. if (ret == RET_ILSEQ)
  160. goto ilseq;
  161. if (ret != 1) abort();
  162. COMBINE_STATE;
  163. conv->istate = state;
  164. return count+3;
  165. } else
  166. goto ilseq;
  167. default: abort();
  168. }
  169. }
  170. goto ilseq;
  171. }
  172. break;
  173. }
  174. switch (state1) {
  175. case STATE_ASCII:
  176. if (c < 0x80) {
  177. int ret = ascii_mbtowc(conv,pwc,s,1);
  178. if (ret == RET_ILSEQ)
  179. goto ilseq;
  180. if (ret != 1) abort();
  181. if (*pwc == 0x000a || *pwc == 0x000d)
  182. state2 = STATE_G2_NONE;
  183. COMBINE_STATE;
  184. conv->istate = state;
  185. return count+1;
  186. } else
  187. goto ilseq;
  188. case STATE_JISX0201ROMAN:
  189. if (c < 0x80) {
  190. int ret = jisx0201_mbtowc(conv,pwc,s,1);
  191. if (ret == RET_ILSEQ)
  192. goto ilseq;
  193. if (ret != 1) abort();
  194. if (*pwc == 0x000a || *pwc == 0x000d)
  195. state2 = STATE_G2_NONE;
  196. COMBINE_STATE;
  197. conv->istate = state;
  198. return count+1;
  199. } else
  200. goto ilseq;
  201. case STATE_JISX0201KATAKANA:
  202. if (c < 0x80) {
  203. unsigned char buf = c+0x80;
  204. int ret = jisx0201_mbtowc(conv,pwc,&buf,1);
  205. if (ret == RET_ILSEQ)
  206. goto ilseq;
  207. if (ret != 1) abort();
  208. COMBINE_STATE;
  209. conv->istate = state;
  210. return count+1;
  211. } else
  212. goto ilseq;
  213. case STATE_JISX0208:
  214. if (n < count+2)
  215. goto none;
  216. if (s[0] < 0x80 && s[1] < 0x80) {
  217. int ret = jisx0208_mbtowc(conv,pwc,s,2);
  218. if (ret == RET_ILSEQ)
  219. goto ilseq;
  220. if (ret != 2) abort();
  221. COMBINE_STATE;
  222. conv->istate = state;
  223. return count+2;
  224. } else
  225. goto ilseq;
  226. case STATE_JISX0212:
  227. if (n < count+2)
  228. goto none;
  229. if (s[0] < 0x80 && s[1] < 0x80) {
  230. int ret = jisx0212_mbtowc(conv,pwc,s,2);
  231. if (ret == RET_ILSEQ)
  232. goto ilseq;
  233. if (ret != 2) abort();
  234. COMBINE_STATE;
  235. conv->istate = state;
  236. return count+2;
  237. } else
  238. goto ilseq;
  239. case STATE_GB2312:
  240. if (n < count+2)
  241. goto none;
  242. if (s[0] < 0x80 && s[1] < 0x80) {
  243. int ret = gb2312_mbtowc(conv,pwc,s,2);
  244. if (ret == RET_ILSEQ)
  245. goto ilseq;
  246. if (ret != 2) abort();
  247. COMBINE_STATE;
  248. conv->istate = state;
  249. return count+2;
  250. } else
  251. goto ilseq;
  252. case STATE_KSC5601:
  253. if (n < count+2)
  254. goto none;
  255. if (s[0] < 0x80 && s[1] < 0x80) {
  256. int ret = ksc5601_mbtowc(conv,pwc,s,2);
  257. if (ret == RET_ILSEQ)
  258. goto ilseq;
  259. if (ret != 2) abort();
  260. COMBINE_STATE;
  261. conv->istate = state;
  262. return count+2;
  263. } else
  264. goto ilseq;
  265. default: abort();
  266. }
  267. none:
  268. COMBINE_STATE;
  269. conv->istate = state;
  270. return RET_TOOFEW(count);
  271. ilseq:
  272. COMBINE_STATE;
  273. conv->istate = state;
  274. return RET_SHIFT_ILSEQ(count);
  275. }
  276. #undef COMBINE_STATE
  277. #undef SPLIT_STATE
  278. /*
  279. * The state can also contain one of the following values, << 16.
  280. * Values >= STATE_TAG_LANGUAGE are temporary tag parsing states.
  281. */
  282. #define STATE_TAG_NONE 0
  283. #define STATE_TAG_LANGUAGE 4
  284. #define STATE_TAG_LANGUAGE_j 5
  285. #define STATE_TAG_LANGUAGE_ja 1
  286. #define STATE_TAG_LANGUAGE_k 6
  287. #define STATE_TAG_LANGUAGE_ko 2
  288. #define STATE_TAG_LANGUAGE_z 7
  289. #define STATE_TAG_LANGUAGE_zh 3
  290. #define SPLIT_STATE \
  291. unsigned int state1 = state & 0xff, state2 = (state >> 8) & 0xff, state3 = state >> 16
  292. #define COMBINE_STATE \
  293. state = (state3 << 16) | (state2 << 8) | state1
  294. static int
  295. iso2022_jp2_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
  296. {
  297. state_t state = conv->ostate;
  298. SPLIT_STATE;
  299. unsigned char buf[2];
  300. int ret;
  301. /* This defines the conversion preferences depending on the current
  302. langauge tag. */
  303. enum conversion { none = 0, european, japanese, chinese, korean, other };
  304. static const unsigned int conversion_lists[STATE_TAG_LANGUAGE] = {
  305. /* STATE_TAG_NONE */
  306. japanese + (european << 3) + (chinese << 6) + (korean << 9) + (other << 12),
  307. /* STATE_TAG_LANGUAGE_ja */
  308. japanese + (european << 3) + (chinese << 6) + (korean << 9) + (other << 12),
  309. /* STATE_TAG_LANGUAGE_ko */
  310. korean + (european << 3) + (japanese << 6) + (chinese << 9) + (other << 12),
  311. /* STATE_TAG_LANGUAGE_zh */
  312. chinese + (european << 3) + (japanese << 6) + (korean << 9) + (other << 12)
  313. };
  314. unsigned int conversion_list;
  315. /* Handle Unicode tag characters (range U+E0000..U+E007F). */
  316. if ((wc >> 7) == (0xe0000 >> 7)) {
  317. char c = wc & 0x7f;
  318. if (c >= 'A' && c <= 'Z')
  319. c += 'a'-'A';
  320. switch (c) {
  321. case 0x01:
  322. state3 = STATE_TAG_LANGUAGE;
  323. COMBINE_STATE;
  324. conv->ostate = state;
  325. return 0;
  326. case 'j':
  327. if (state3 == STATE_TAG_LANGUAGE) {
  328. state3 = STATE_TAG_LANGUAGE_j;
  329. COMBINE_STATE;
  330. conv->ostate = state;
  331. return 0;
  332. }
  333. break;
  334. case 'a':
  335. if (state3 == STATE_TAG_LANGUAGE_j) {
  336. state3 = STATE_TAG_LANGUAGE_ja;
  337. COMBINE_STATE;
  338. conv->ostate = state;
  339. return 0;
  340. }
  341. break;
  342. case 'k':
  343. if (state3 == STATE_TAG_LANGUAGE) {
  344. state3 = STATE_TAG_LANGUAGE_k;
  345. COMBINE_STATE;
  346. conv->ostate = state;
  347. return 0;
  348. }
  349. break;
  350. case 'o':
  351. if (state3 == STATE_TAG_LANGUAGE_k) {
  352. state3 = STATE_TAG_LANGUAGE_ko;
  353. COMBINE_STATE;
  354. conv->ostate = state;
  355. return 0;
  356. }
  357. break;
  358. case 'z':
  359. if (state3 == STATE_TAG_LANGUAGE) {
  360. state3 = STATE_TAG_LANGUAGE_z;
  361. COMBINE_STATE;
  362. conv->ostate = state;
  363. return 0;
  364. }
  365. break;
  366. case 'h':
  367. if (state3 == STATE_TAG_LANGUAGE_z) {
  368. state3 = STATE_TAG_LANGUAGE_zh;
  369. COMBINE_STATE;
  370. conv->ostate = state;
  371. return 0;
  372. }
  373. break;
  374. case 0x7f:
  375. state3 = STATE_TAG_NONE;
  376. COMBINE_STATE;
  377. conv->ostate = state;
  378. return 0;
  379. default:
  380. break;
  381. }
  382. /* Other tag characters reset the tag parsing state or are ignored. */
  383. if (state3 >= STATE_TAG_LANGUAGE)
  384. state3 = STATE_TAG_NONE;
  385. COMBINE_STATE;
  386. conv->ostate = state;
  387. return 0;
  388. }
  389. if (state3 >= STATE_TAG_LANGUAGE)
  390. state3 = STATE_TAG_NONE;
  391. /* Try ASCII. */
  392. ret = ascii_wctomb(conv,buf,wc,1);
  393. if (ret != RET_ILUNI) {
  394. if (ret != 1) abort();
  395. if (buf[0] < 0x80) {
  396. int count = (state1 == STATE_ASCII ? 1 : 4);
  397. if (n < count)
  398. return RET_TOOSMALL;
  399. if (state1 != STATE_ASCII) {
  400. r[0] = ESC;
  401. r[1] = '(';
  402. r[2] = 'B';
  403. r += 3;
  404. state1 = STATE_ASCII;
  405. }
  406. r[0] = buf[0];
  407. if (wc == 0x000a || wc == 0x000d)
  408. state2 = STATE_G2_NONE;
  409. COMBINE_STATE;
  410. conv->ostate = state;
  411. return count;
  412. }
  413. }
  414. conversion_list = conversion_lists[state3];
  415. do {
  416. switch (conversion_list & ((1 << 3) - 1)) {
  417. case european:
  418. /* Try ISO-8859-1. */
  419. ret = iso8859_1_wctomb(conv,buf,wc,1);
  420. if (ret != RET_ILUNI) {
  421. if (ret != 1) abort();
  422. if (buf[0] >= 0x80) {
  423. int count = (state2 == STATE_G2_ISO8859_1 ? 3 : 6);
  424. if (n < count)
  425. return RET_TOOSMALL;
  426. if (state2 != STATE_G2_ISO8859_1) {
  427. r[0] = ESC;
  428. r[1] = '.';
  429. r[2] = 'A';
  430. r += 3;
  431. state2 = STATE_G2_ISO8859_1;
  432. }
  433. r[0] = ESC;
  434. r[1] = 'N';
  435. r[2] = buf[0]-0x80;
  436. COMBINE_STATE;
  437. conv->ostate = state;
  438. return count;
  439. }
  440. }
  441. /* Try ISO-8859-7. */
  442. ret = iso8859_7_wctomb(conv,buf,wc,1);
  443. if (ret != RET_ILUNI) {
  444. if (ret != 1) abort();
  445. if (buf[0] >= 0x80) {
  446. int count = (state2 == STATE_G2_ISO8859_7 ? 3 : 6);
  447. if (n < count)
  448. return RET_TOOSMALL;
  449. if (state2 != STATE_G2_ISO8859_7) {
  450. r[0] = ESC;
  451. r[1] = '.';
  452. r[2] = 'F';
  453. r += 3;
  454. state2 = STATE_G2_ISO8859_7;
  455. }
  456. r[0] = ESC;
  457. r[1] = 'N';
  458. r[2] = buf[0]-0x80;
  459. COMBINE_STATE;
  460. conv->ostate = state;
  461. return count;
  462. }
  463. }
  464. break;
  465. case japanese:
  466. /* Try JIS X 0201-1976 Roman. */
  467. ret = jisx0201_wctomb(conv,buf,wc,1);
  468. if (ret != RET_ILUNI) {
  469. if (ret != 1) abort();
  470. if (buf[0] < 0x80) {
  471. int count = (state1 == STATE_JISX0201ROMAN ? 1 : 4);
  472. if (n < count)
  473. return RET_TOOSMALL;
  474. if (state1 != STATE_JISX0201ROMAN) {
  475. r[0] = ESC;
  476. r[1] = '(';
  477. r[2] = 'J';
  478. r += 3;
  479. state1 = STATE_JISX0201ROMAN;
  480. }
  481. r[0] = buf[0];
  482. if (wc == 0x000a || wc == 0x000d)
  483. state2 = STATE_G2_NONE;
  484. COMBINE_STATE;
  485. conv->ostate = state;
  486. return count;
  487. }
  488. }
  489. /* Try JIS X 0208-1990 in place of JIS X 0208-1978 and
  490. JIS X 0208-1983. */
  491. ret = jisx0208_wctomb(conv,buf,wc,2);
  492. if (ret != RET_ILUNI) {
  493. if (ret != 2) abort();
  494. if (buf[0] < 0x80 && buf[1] < 0x80) {
  495. int count = (state1 == STATE_JISX0208 ? 2 : 5);
  496. if (n < count)
  497. return RET_TOOSMALL;
  498. if (state1 != STATE_JISX0208) {
  499. r[0] = ESC;
  500. r[1] = '$';
  501. r[2] = 'B';
  502. r += 3;
  503. state1 = STATE_JISX0208;
  504. }
  505. r[0] = buf[0];
  506. r[1] = buf[1];
  507. COMBINE_STATE;
  508. conv->ostate = state;
  509. return count;
  510. }
  511. }
  512. /* Try JIS X 0212-1990. */
  513. ret = jisx0212_wctomb(conv,buf,wc,2);
  514. if (ret != RET_ILUNI) {
  515. if (ret != 2) abort();
  516. if (buf[0] < 0x80 && buf[1] < 0x80) {
  517. int count = (state1 == STATE_JISX0212 ? 2 : 6);
  518. if (n < count)
  519. return RET_TOOSMALL;
  520. if (state1 != STATE_JISX0212) {
  521. r[0] = ESC;
  522. r[1] = '$';
  523. r[2] = '(';
  524. r[3] = 'D';
  525. r += 4;
  526. state1 = STATE_JISX0212;
  527. }
  528. r[0] = buf[0];
  529. r[1] = buf[1];
  530. COMBINE_STATE;
  531. conv->ostate = state;
  532. return count;
  533. }
  534. }
  535. break;
  536. case chinese:
  537. /* Try GB 2312-1980. */
  538. ret = gb2312_wctomb(conv,buf,wc,2);
  539. if (ret != RET_ILUNI) {
  540. if (ret != 2) abort();
  541. if (buf[0] < 0x80 && buf[1] < 0x80) {
  542. int count = (state1 == STATE_GB2312 ? 2 : 5);
  543. if (n < count)
  544. return RET_TOOSMALL;
  545. if (state1 != STATE_GB2312) {
  546. r[0] = ESC;
  547. r[1] = '$';
  548. r[2] = 'A';
  549. r += 3;
  550. state1 = STATE_GB2312;
  551. }
  552. r[0] = buf[0];
  553. r[1] = buf[1];
  554. COMBINE_STATE;
  555. conv->ostate = state;
  556. return count;
  557. }
  558. }
  559. break;
  560. case korean:
  561. /* Try KS C 5601-1992. */
  562. ret = ksc5601_wctomb(conv,buf,wc,2);
  563. if (ret != RET_ILUNI) {
  564. if (ret != 2) abort();
  565. if (buf[0] < 0x80 && buf[1] < 0x80) {
  566. int count = (state1 == STATE_KSC5601 ? 2 : 6);
  567. if (n < count)
  568. return RET_TOOSMALL;
  569. if (state1 != STATE_KSC5601) {
  570. r[0] = ESC;
  571. r[1] = '$';
  572. r[2] = '(';
  573. r[3] = 'C';
  574. r += 4;
  575. state1 = STATE_KSC5601;
  576. }
  577. r[0] = buf[0];
  578. r[1] = buf[1];
  579. COMBINE_STATE;
  580. conv->ostate = state;
  581. return count;
  582. }
  583. }
  584. break;
  585. case other:
  586. /* Try JIS X 0201-1976 Kana. This is not officially part of
  587. ISO-2022-JP-2, according to RFC 1554. Therefore we try this
  588. only after all other attempts. */
  589. ret = jisx0201_wctomb(conv,buf,wc,1);
  590. if (ret != RET_ILUNI) {
  591. if (ret != 1) abort();
  592. if (buf[0] >= 0x80) {
  593. int count = (state1 == STATE_JISX0201KATAKANA ? 1 : 4);
  594. if (n < count)
  595. return RET_TOOSMALL;
  596. if (state1 != STATE_JISX0201KATAKANA) {
  597. r[0] = ESC;
  598. r[1] = '(';
  599. r[2] = 'I';
  600. r += 3;
  601. state1 = STATE_JISX0201KATAKANA;
  602. }
  603. r[0] = buf[0]-0x80;
  604. COMBINE_STATE;
  605. conv->ostate = state;
  606. return count;
  607. }
  608. }
  609. break;
  610. default:
  611. abort();
  612. }
  613. conversion_list = conversion_list >> 3;
  614. } while (conversion_list != 0);
  615. return RET_ILUNI;
  616. }
  617. static int
  618. iso2022_jp2_reset (conv_t conv, unsigned char *r, int n)
  619. {
  620. state_t state = conv->ostate;
  621. SPLIT_STATE;
  622. (void)state2;
  623. (void)state3;
  624. if (state1 != STATE_ASCII) {
  625. if (n < 3)
  626. return RET_TOOSMALL;
  627. r[0] = ESC;
  628. r[1] = '(';
  629. r[2] = 'B';
  630. /* conv->ostate = 0; will be done by the caller */
  631. return 3;
  632. } else
  633. return 0;
  634. }
  635. #undef COMBINE_STATE
  636. #undef SPLIT_STATE
  637. #undef STATE_TAG_LANGUAGE_zh
  638. #undef STATE_TAG_LANGUAGE_z
  639. #undef STATE_TAG_LANGUAGE_ko
  640. #undef STATE_TAG_LANGUAGE_k
  641. #undef STATE_TAG_LANGUAGE_ja
  642. #undef STATE_TAG_LANGUAGE_j
  643. #undef STATE_TAG_LANGUAGE
  644. #undef STATE_TAG_NONE
  645. #undef STATE_G2_ISO8859_7
  646. #undef STATE_G2_ISO8859_1
  647. #undef STATE_G2_NONE
  648. #undef STATE_KSC5601
  649. #undef STATE_GB2312
  650. #undef STATE_JISX0212
  651. #undef STATE_JISX0208
  652. #undef STATE_JISX0201KATAKANA
  653. #undef STATE_JISX0201ROMAN
  654. #undef STATE_ASCII