• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/ruby-106/ruby/ext/nkf/nkf-utf8/

Lines Matching refs:c1

51    c1           32bit data
135 static nkf_char s_iconv(nkf_char c2, nkf_char c1, nkf_char c0);
136 static nkf_char e_iconv(nkf_char c2, nkf_char c1, nkf_char c0);
137 static nkf_char w_iconv(nkf_char c2, nkf_char c1, nkf_char c0);
138 static nkf_char w_iconv16(nkf_char c2, nkf_char c1, nkf_char c0);
139 static nkf_char w_iconv32(nkf_char c2, nkf_char c1, nkf_char c0);
140 static void j_oconv(nkf_char c2, nkf_char c1);
141 static void s_oconv(nkf_char c2, nkf_char c1);
142 static void e_oconv(nkf_char c2, nkf_char c1);
143 static void w_oconv(nkf_char c2, nkf_char c1);
144 static void w_oconv16(nkf_char c2, nkf_char c1);
145 static void w_oconv32(nkf_char c2, nkf_char c1);
149 nkf_char (*iconv)(nkf_char c2, nkf_char c1, nkf_char c0);
150 void (*oconv)(nkf_char c2, nkf_char c1);
332 nkf_char (*iconv_func)(nkf_char c2, nkf_char c1, nkf_char c0);
447 static nkf_char (*iconv_for_check)(nkf_char c2,nkf_char c1,nkf_char c0) = 0;
464 /* static nkf_char cp932_conv(nkf_char c2, nkf_char c1); */
512 no_connection2(ARG_UNUSED nkf_char c2, ARG_UNUSED nkf_char c1, ARG_UNUSED nkf_char c0)
520 no_connection(nkf_char c2, nkf_char c1)
522 no_connection2(c2,c1,0);
525 static nkf_char (*iconv)(nkf_char c2,nkf_char c1,nkf_char c0) = no_connection2;
526 static void (*oconv)(nkf_char c2,nkf_char c1) = no_connection;
528 static void (*o_zconv)(nkf_char c2,nkf_char c1) = no_connection;
529 static void (*o_fconv)(nkf_char c2,nkf_char c1) = no_connection;
530 static void (*o_eol_conv)(nkf_char c2,nkf_char c1) = no_connection;
531 static void (*o_rot_conv)(nkf_char c2,nkf_char c1) = no_connection;
532 static void (*o_hira_conv)(nkf_char c2,nkf_char c1) = no_connection;
533 static void (*o_base64conv)(nkf_char c2,nkf_char c1) = no_connection;
534 static void (*o_iso2022jp_check_conv)(nkf_char c2,nkf_char c1) = no_connection;
1056 nkf_each_char_to_hex(void (*f)(nkf_char c2,nkf_char c1), nkf_char c)
1494 find_inputcode_byfunc(nkf_char (*iconv_func)(nkf_char c2,nkf_char c1,nkf_char c0))
1509 set_iconv(nkf_char f, nkf_char (*iconv_func)(nkf_char c2,nkf_char c1,nkf_char c0))
1570 is_x0213_2_in_x0212(nkf_char c1)
1574 int ku = c1 - 0x20;
1583 e2s_conv(nkf_char c2, nkf_char c1, nkf_char *p2, nkf_char *p1)
1591 if (p1) *p1 = c1 + ((ndx & 1) ? ((c1 < 0x60) ? 0x1f : 0x20) : 0x7e);
1595 if (p1) *p1 = c1 + ((ndx & 1) ? ((c1 < 0x60) ? 0x1f : 0x20) : 0x7e);
1606 val = ptr[(c1 & 0x7f) - 0x21];
1610 c1 = val & 0xff;
1612 if (p1) *p1 = c1;
1621 if (p1) *p1 = c1 + ((c2 & 1) ? ((c1 < 0x60) ? 0x1f : 0x20) : 0x7e);
1626 s2e_conv(nkf_char c2, nkf_char c1, nkf_char *p2, nkf_char *p1)
1632 if (0xFC < c1) return 1;
1635 val = shiftjis_cp932[c2 - CP932_TABLE_BEGIN][c1 - 0x40];
1638 c1 = val & 0xff;
1643 val = cp932inv[c2 - CP932INV_TABLE_BEGIN][c1 - 0x40];
1646 c1 = val & 0xff;
1652 val = shiftjis_x0212[c2 - 0xfa][c1 - 0x40];
1656 c1 = val & 0xff;
1659 c1 = val & 0xff;
1662 if (p1) *p1 = c1;
1669 if(c2 <= 0xF3 || (c2 == 0xF4 && c1 < 0x9F)){ /* k=1, 3<=k<=5, k=8, 12<=k<=15 */
1670 c2 = PREFIX_EUCG3 | 0x20 | shift_jisx0213_s1a3_table[c2 - 0xF0][0x9E < c1];
1673 if (0x9E < c1) c2++;
1679 if (0x9E < c1) c2++;
1681 if (c1 < 0x9F)
1682 c1 = c1 - ((c1 > DEL) ? SP : 0x1F);
1684 c1 = c1 - 0x7E;
1692 if (p1) *p1 = c1;
1730 nkf_utf8_to_unicode(nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4)
1733 if (c1 <= 0x7F) {
1735 wc = c1;
1737 else if (c1 <= 0xC1) {
1741 else if (c1 <= 0xDF) {
1743 wc = (c1 & 0x1F) << 6;
1746 else if (c1 <= 0xEF) {
1748 wc = (c1 & 0x0F) << 12;
1754 wc = (c1 & 0x0F) << 18;
1768 unicode_to_jis_common2(nkf_char c1, nkf_char c0,
1778 c1 -= 0x80;
1779 if (c1 < 0 || psize <= c1) return 1;
1780 p = pp[c1];
1798 c1 = val & 0xFF;
1800 if (p1) *p1 = c1;
1805 unicode_to_jis_common(nkf_char c2, nkf_char c1, nkf_char c0, nkf_char *p2, nkf_char *p1)
1839 if(no_best_fit_chars_table_932_C2[c1&0x3F]) return 1;
1842 if(no_best_fit_chars_table_932_C3[c1&0x3F]) return 1;
1848 if(no_best_fit_chars_table_C2[c1&0x3F]) return 1;
1851 if(no_best_fit_chars_table_932_C3[c1&0x3F]) return 1;
1855 if(c2 == 0xC2 && no_best_fit_chars_table_C2_ms[c1&0x3F]) return 1;
1859 switch(c1){
1879 ret = unicode_to_jis_common2(c2, c1, pp, sizeof_utf8_to_euc_2bytes, p2, p1);
1883 if(c2 == 0xE3 && c1 == 0x82 && c0 == 0x94) return 1;
1887 switch(c1){
1897 if(c1 == 0x80 || c0 == 0x9C) return 1;
1903 switch(c1){
1916 switch(c1){
1926 switch(c1){
1947 ret = unicode_to_jis_common2(c1, c0, ppp[c2 - 0xE0], sizeof_utf8_to_euc_C2, p2, p1);
1973 e2w_conv(nkf_char c2, nkf_char c1)
1979 switch (c1) {
1989 if(ms_ucs_map_f == UCS_MAP_ASCII&& c2 == NKF_INT32_C(0x8F22) && c1 == 0x43){
2013 c1 = (c1 & 0x7f) - 0x21;
2014 if (0<=c1 && c1<sizeof_euc_to_utf8_1byte) {
2015 nkf_char val = p[c1];
2017 nkf_char euc = (c2+0x21)<<8 | (c1+0x21);
2034 e2w_combining(nkf_char comb, nkf_char c2, nkf_char c1)
2043 euc = (c2&0x7f)<<8 | (c1&0x7f);
2052 w2e_conv(nkf_char c2, nkf_char c1, nkf_char c0, nkf_char *p2, nkf_char *p1)
2056 if (!c1){
2060 ret = unicode_to_jis_common(c2, c1, c0, p2, p1);
2064 if (p1) *p1 = nkf_char_unicode_new(nkf_utf8_to_unicode(c2, c1, c0, 0));
2076 nkf_char c1, c2, c3, c4;
2084 nkf_unicode_to_utf8(val, &c1, &c2, &c3, &c4);
2085 ret = unicode_to_jis_common(c1, c2, c3, p2, p1);
2095 c1 = (val >> 10) + NKF_INT32_C(0xD7C0); /* high surrogate */
2098 if (x0213_1_surrogate_table[i][1] == c1 && x0213_1_surrogate_table[i][2] == c2) {
2105 if (x0213_2_surrogate_table[i][1] == c1 && x0213_2_surrogate_table[i][2] == c2) {
2120 e_iconv(nkf_char c2, nkf_char c1, nkf_char c0)
2124 c2 = GETA1; c1 = GETA2;
2127 c1 &= 0x7f;
2134 if (!cp51932_f && !x0213_f && 0xF5 <= c1 && c1 <= 0xFE && 0xA1 <= c0 && c0 <= 0xFE) {
2136 c1 = nkf_char_unicode_new((c1 - 0xF5) * 94 + c0 - 0xA1 + 0xE3AC);
2139 c2 = (c2 << 8) | (c1 & 0x7f);
2140 c1 = c0 & 0x7f;
2144 if (e2s_conv(c2, c1, &s2, &s1) == 0){
2145 s2e_conv(s2, s1, &c2, &c1);
2147 c1 &= 0x7f;
2158 if (!cp51932_f && ms_ucs_map_f && 0xF5 <= c2 && c2 <= 0xFE && 0xA1 <= c1 && c1 <= 0xFE) {
2160 c1 = nkf_char_unicode_new((c2 - 0xF5) * 94 + c1 - 0xA1 + 0xE000);
2163 c1 &= 0x7f;
2168 if (e2s_conv(c2, c1, &s2, &s1) == 0){
2169 s2e_conv(s2, s1, &c2, &c1);
2171 c1 &= 0x7f;
2179 (*oconv)(c2, c1);
2184 s_iconv(ARG_UNUSED nkf_char c2, nkf_char c1, ARG_UNUSED nkf_char c0)
2188 c2 = GETA1; c1 = GETA2;
2190 c1 &= 0x7f;
2194 } else if (!x0213_f && 0xF0 <= c2 && c2 <= 0xF9 && 0x40 <= c1 && c1 <= 0xFC) {
2196 if(c1 == 0x7F) return 0;
2197 c1 = nkf_char_unicode_new((c2 - 0xF0) * 188 + (c1 - 0x40 - (0x7E < c1)) + 0xE000);
2200 nkf_char ret = s2e_conv(c2, c1, &c2, &c1);
2203 (*oconv)(c2, c1);
2232 w_iconv(nkf_char c1, nkf_char c2, nkf_char c3)
2247 if (c1 < 0 || 0xff < c1) {
2248 }else if (c1 == 0) { /* 0 : 1 byte*/
2250 } else if ((c1 & 0xC0) == 0x80) { /* 0x80-0xbf : trail byte */
2253 switch (w_iconv_utf8_1st_byte[c1 - 0xC0]) {
2293 if (c1 == 0 || c1 == EOF){
2294 } else if ((c1 & 0xf8) == 0xf0) { /* 4 bytes */
2295 c2 = nkf_char_unicode_new(nkf_utf8_to_unicode(c1, c2, c3, c4));
2296 c1 = 0;
2298 if (x0213_f && x0213_wait_combining_p(nkf_utf8_to_unicode(c1, c2, c3, c4)))
2300 ret = w2e_conv(c1, c2, c3, &c1, &c2);
2303 (*oconv)(c1, c2);
2309 w_iconv_nocombine(nkf_char c1, nkf_char c2, nkf_char c3)
2312 nkf_char ret = w2e_conv(c1, c2, c3, &c1, &c2);
2314 (*oconv)(c1, c2);
2325 nkf_char c1, c2;
2330 c1 = wc;
2337 ret = w16e_conv(wc, &c2, &c1);
2341 c1 = nkf_char_unicode_new(wc);
2345 (*oconv)(c2, c1);
2352 nkf_char c1, c2;
2367 c1 = x0213_combining_table[i][0] & 0x7f;
2368 (*oconv)(c2, c1);
2381 w_iconv_combine(nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4, nkf_char c5, nkf_char c6)
2384 wc = nkf_utf8_to_unicode(c1, c2, c3, 0);
2394 nkf_iconv_utf_16(nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4)
2398 if (c1 == EOF) {
2404 if (0xD8 <= c1 && c1 <= 0xDB) {
2406 wc = UTF16_TO_UTF32(c1 << 8 | c2, c3 << 8 | c4);
2409 wc = c1 << 8 | c2;
2414 wc = UTF16_TO_UTF32(c2 << 8 | c1, c4 << 8 | c3);
2417 wc = c2 << 8 | c1;
2425 nkf_iconv_utf_16_combine(nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4)
2433 wc = c1 << 8 | c2;
2440 wc = c2 << 8 | c1;
2449 nkf_iconv_utf_16_nocombine(nkf_char c1, nkf_char c2)
2453 wc = c1 << 8 | c2;
2455 wc = c2 << 8 | c1;
2460 w_iconv16(nkf_char c2, nkf_char c1, ARG_UNUSED nkf_char c0)
2462 (*oconv)(c2, c1);
2467 w_iconv32(nkf_char c2, nkf_char c1, ARG_UNUSED nkf_char c0)
2469 (*oconv)(c2, c1);
2474 utf32_to_nkf_char(nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4)
2483 wc = c3 << 16 | c2 << 8 | c1;
2486 wc = c1 << 16 | c4 << 8 | c3;
2489 wc = c4 << 16 | c1 << 8 | c2;
2498 nkf_iconv_utf_32(nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4)
2502 if (c1 == EOF) {
2507 wc = utf32_to_nkf_char(c1, c2, c3, c4);
2515 nkf_iconv_utf_32_combine(nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4, nkf_char c5, nkf_char c6, nkf_char c7, nkf_char c8)
2519 wc = utf32_to_nkf_char(c1, c2, c3, c4);
2530 nkf_iconv_utf_32_nocombine(nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4)
2534 wc = utf32_to_nkf_char(c1, c2, c3, c4);
2592 j_oconv(nkf_char c2, nkf_char c1)
2595 if (c2 == 0 && nkf_char_unicode_p(c1)){
2596 w16e_conv(c1, &c2, &c1);
2597 if (c2 == 0 && nkf_char_unicode_p(c1)){
2598 c2 = c1 & VALUE_MASK;
2601 c1 &= 0xFFF;
2602 c2 = 0x7F + c1 / 94;
2603 c1 = 0x21 + c1 % 94;
2605 if (encode_fallback) (*encode_fallback)(c1);
2613 (*o_putc)(c1);
2621 (*o_putc)(c1|0x80);
2625 (*o_putc)(c1);
2630 (*o_putc)(c1);
2634 ? c2<0x20 || 0x92<c2 || c1<0x20 || 0x7e<c1
2635 : c2<0x20 || 0x7e<c2 || c1<0x20 || 0x7e<c1) return;
2638 (*o_putc)(c1);
2643 e_oconv(nkf_char c2, nkf_char c1)
2645 if (c2 == 0 && nkf_char_unicode_p(c1)){
2646 w16e_conv(c1, &c2, &c1);
2647 if (c2 == 0 && nkf_char_unicode_p(c1)){
2648 c2 = c1 & VALUE_MASK;
2651 c1 &= 0xFFF;
2652 c2 = c1 / 94;
2654 c1 = 0x21 + c1 % 94;
2658 (*o_putc)(c1 | 0x080);
2661 (*o_putc)(c1 | 0x080);
2665 if (encode_fallback) (*encode_fallback)(c1);
2675 (*o_putc)(c1);
2678 (*o_putc)(SS2); (*o_putc)(c1|0x80);
2681 (*o_putc)(c1 | 0x080);
2688 if (e2s_conv(c2, c1, &s2, &s1) == 0){
2689 s2e_conv(s2, s1, &c2, &c1);
2695 (*o_putc)(c1);
2700 (*o_putc)(c1 | 0x080);
2704 (*o_putc)(c1 | 0x080);
2708 if (!nkf_isgraph(c1) || !nkf_isgraph(c2)) {
2714 (*o_putc)(c1 | 0x080);
2719 s_oconv(nkf_char c2, nkf_char c1)
2722 if (c2 == 0 && nkf_char_unicode_p(c1)){
2723 w16e_conv(c1, &c2, &c1);
2724 if (c2 == 0 && nkf_char_unicode_p(c1)){
2725 c2 = c1 & VALUE_MASK;
2728 c1 &= 0xFFF;
2729 c2 = c1 / 188 + (cp932inv_f ? 0xF0 : 0xEB);
2730 c1 = c1 % 188;
2731 c1 += 0x40 + (c1 > 0x3e);
2733 (*o_putc)(c1);
2736 if(encode_fallback)(*encode_fallback)(c1);
2747 (*o_putc)(c1);
2750 (*o_putc)(c1|0x80);
2753 (*o_putc)(c1 | 0x080);
2757 if (e2s_conv(c2, c1, &c2, &c1) == 0){
2759 (*o_putc)(c1);
2763 if (!nkf_isprint(c1) || !nkf_isprint(c2)) {
2768 e2s_conv(c2, c1, &c2, &c1);
2773 nkf_char c = cp932inv[c2 - CP932INV_TABLE_BEGIN][c1 - 0x40];
2776 c1 = c & 0xff;
2782 if (prefix_table[(unsigned char)c1]){
2783 (*o_putc)(prefix_table[(unsigned char)c1]);
2785 (*o_putc)(c1);
2791 nkf_unicode_to_utf8(val, &c1, &c2, &c3, &c4); \
2792 (*o_putc)(c1); \
2799 w_oconv(nkf_char c2, nkf_char c1)
2816 if (c2 == 0 && nkf_char_unicode_p(c1)){
2817 val = c1 & VALUE_MASK;
2823 (*o_putc)(c1);
2825 val = e2w_conv(c2, c1);
2827 val2 = e2w_combining(val, c2, c1);
2835 #define OUTPUT_UTF16_BYTES(c1, c2) do { \
2837 (*o_putc)(c1); \
2841 (*o_putc)(c1); \
2848 c1 = val & 0xff; \
2849 OUTPUT_UTF16_BYTES(c1, c2); \
2854 c1 = (val & 0x3FF) + NKF_INT32_C(0xDC00); /* low surrogate */ \
2856 OUTPUT_UTF16_BYTES(c1 & 0xff, (c1 >> 8) & 0xff); \
2862 w_oconv16(nkf_char c2, nkf_char c1)
2874 if (c2 == 0 && nkf_char_unicode_p(c1)) {
2875 OUTPUT_UTF16(c1);
2878 val = e2w_conv(c2, c1);
2880 val2 = e2w_combining(val, c2, c1);
2885 OUTPUT_UTF16_BYTES(c1, c2);
2904 w_oconv32(nkf_char c2, nkf_char c1)
2927 c1 |= 0x80;
2928 } else if (c2 == 0 && nkf_char_unicode_p(c1)) {
2929 c1 &= VALUE_MASK;
2932 val = e2w_conv(c2, c1);
2934 val2 = e2w_combining(val, c2, c1);
2937 c1 = val;
2939 OUTPUT_UTF32(c1);
3010 nkf_char c1 = ptr->buf[1];
3016 if ((c1 & 0x70) == 0x20){
3017 set_code_score(ptr, score_table_8FA0[c1 & 0x0f]);
3018 }else if ((c1 & 0x70) == 0x60){
3019 set_code_score(ptr, score_table_8FE0[c1 & 0x0f]);
3020 }else if ((c1 & 0x70) == 0x70){
3021 set_code_score(ptr, score_table_8FF0[c1 & 0x0f]);
3026 }else if (!e2w_conv(c2, c1)){
3367 h_conv(FILE *f, nkf_char c1, nkf_char c2)
3379 push_hold_buf(c1);
3421 c1 = hold_buf[hold_index++];
3422 if (nkf_char_unicode_p(c1)) {
3423 (*oconv)(0, c1);
3426 else if (c1 <= DEL){
3427 (*iconv)(0, c1, 0);
3429 }else if (iconv == s_iconv && 0xa1 <= c1 && c1 <= 0xdf){
3430 (*iconv)(JIS_X_0201_1976_K, c1, 0);
3446 switch ((*iconv)(c1, c2, 0)) { /* can be EUC/SJIS/UTF-8 */
3463 (*iconv)(c1, c2, (c3<<8)|c4);
3471 w_iconv_nocombine(c1, c2, 0);
3478 w_iconv_nocombine(c1, c2, 0);
3485 if (w_iconv_combine(c1, c2, 0, c3, c4, 0)) {
3486 w_iconv_nocombine(c1, c2, 0);
3509 if ((*iconv)(c1, c2, c3) == -3) {
3516 w_iconv_nocombine(c1, c2, c3);
3523 w_iconv_nocombine(c1, c2, c3);
3534 w_iconv_nocombine(c1, c2, c3);
3546 if (w_iconv_combine(c1, c2, c3, c4, c5, c6)) {
3547 w_iconv_nocombine(c1, c2, c3);
3691 nkf_char c, c1;
3699 c1= (*i_bgetc)(f);
3701 if (c1=='@'|| c1=='B') {
3702 nkf_buf_push(nkf_state->broken_buf, c1);
3706 (*i_bungetc)(c1,f);
3711 c1= (*i_bgetc)(f);
3713 if (c1=='J'|| c1=='B') {
3714 nkf_buf_push(nkf_state->broken_buf, c1);
3718 (*i_bungetc)(c1,f);
3736 eol_conv(nkf_char c2, nkf_char c1)
3739 if (c2 == 0 && c1 == LF) {
3742 } else if (c2 == 0 && c1 == CR && input_eol == LF) input_eol = EOF;
3747 if (prev_cr || (c2 == 0 && c1 == LF)) {
3752 if (c2 == 0 && c1 == CR) prev_cr = CR;
3753 else if (c2 != 0 || c1 != LF) (*o_eol_conv)(c2, c1);
3810 #define char_size(c2,c1) (c2?2:1)
3813 fold_conv(nkf_char c2, nkf_char c1)
3818 if (c1== CR && !fold_preserve_f) {
3820 }else if (c1== LF&&f_prev==CR && fold_preserve_f) {
3823 } else if (c1== BS) {
3828 } else if ((c1==LF && !fold_preserve_f)
3829 || ((c1==CR||(c1==LF&&f_prev!=CR))
3833 f_prev = c1;
3836 } else if ((f_prev == c1 && !fold_preserve_f)
3848 f_prev = c1;
3853 f_prev = c1;
3862 } else if (c1=='\f') {
3866 } else if ((c2==0 && nkf_isblank(c1)) || (c2 == '!' && c1 == '!')) {
3881 f_prev = c1;
3884 f_line += c2 == JIS_X_0201_1976_K ? 1: char_size(c2,c1);
3889 f_line = char_size(c2,c1);
3893 if (c1==(0xde&0x7f)) fold_state = 1; /* $B!+(B*/
3894 else if (c1==(0xdf&0x7f)) fold_state = 1; /* $B!,(B*/
3895 else if (c1==(0xa4&0x7f)) fold_state = 1; /* $B!#(B*/
3896 else if (c1==(0xa3&0x7f)) fold_state = 1; /* $B!$(B*/
3897 else if (c1==(0xa1&0x7f)) fold_state = 1; /* $B!W(B*/
3898 else if (c1==(0xb0&0x7f)) fold_state = 1; /* - */
3899 else if (SP<=c1 && c1<=(0xdf&0x7f)) { /* X0201 */
3908 if ( c1==')'|| /* { [ ( */
3909 c1==']'||
3910 c1=='}'||
3911 c1=='.'||
3912 c1==','||
3913 c1=='!'||
3914 c1=='?'||
3915 c1=='/'||
3916 c1==':'||
3917 c1==';') {
3921 f_line = char_size(c2,c1);
3926 f_line = char_size(c2,c1);
3933 if (c1=='"') fold_state = 1; /* $B!"(B */
3934 else if (c1=='#') fold_state = 1; /* $B!#(B */
3935 else if (c1=='W') fold_state = 1; /* $B!W(B */
3936 else if (c1=='K') fold_state = 1; /* $B!K(B */
3937 else if (c1=='$') fold_state = 1; /* $B!$(B */
3938 else if (c1=='%') fold_state = 1; /* $B!%(B */
3939 else if (c1=='\'') fold_state = 1; /* $B!\(B */
3940 else if (c1=='(') fold_state = 1; /* $B!((B */
3941 else if (c1==')') fold_state = 1; /* $B!)(B */
3942 else if (c1=='*') fold_state = 1; /* $B!*(B */
3943 else if (c1=='+') fold_state = 1; /* $B!+(B */
3944 else if (c1==',') fold_state = 1; /* $B!,(B */
3948 f_line = char_size(c2,c1);
3952 f_line = char_size(c2,c1);
3963 (*o_fconv)(c2,c1);
3975 (*o_fconv)(c2,c1);
3982 z_conv(nkf_char c2, nkf_char c1)
3985 /* if (c2) c1 &= 0x7f; assertion */
3987 if (c2 == JIS_X_0201_1976_K && (c1 == 0x20 || c1 == 0x7D || c1 == 0x7E)) {
3988 (*o_zconv)(c2,c1);
3995 if (c1 == (0xde&0x7f)) { /* $BByE@(B */
3999 } else if (c1 == (0xdf&0x7f) && ev[(z_prev1-SP)*2]) { /* $BH>ByE@(B */
4003 } else if (x0213_f && c1 == (0xdf&0x7f) && ev_x0213[(z_prev1-SP)*2]) { /* $BH>ByE@(B */
4013 if (dv[(c1-SP)*2] || ev[(c1-SP)*2] || (x0213_f && ev_x0213[(c1-SP)*2])) {
4015 z_prev1 = c1;
4019 (*o_zconv)(cv[(c1-SP)*2], cv[(c1-SP)*2+1]);
4026 (*o_zconv)(c2, c1);
4035 if (0x21==c1) {
4038 c1 = SP;
4044 } else if (alpha_f&1 && 0x20<c1 && c1<0x7f && fv[c1-0x20]) {
4046 c1 = fv[c1-0x20];
4053 switch (c1){
4069 switch (c1) {
4124 if (fullwidth_to_halfwidth[c1-0x20]){
4125 c2 = fullwidth_to_halfwidth[c1-0x20];
4132 } else if (c2 == 0 && nkf_char_unicode_p(c1) &&
4133 ((c1&VALUE_MASK) == 0x3099 || (c1&VALUE_MASK) == 0x309A)) { /* $B9g@.MQByE@!&H>ByE@(B */
4134 (*o_zconv)(JIS_X_0201_1976_K, 0x5E + (c1&VALUE_MASK) - 0x3099);
4138 (*o_zconv)(c2,c1);
4160 rot_conv(nkf_char c2, nkf_char c1)
4163 c1 = rot13(c1);
4165 c1 = rot47(c1);
4168 (*o_rot_conv)(c2,c1);
4172 hira_conv(nkf_char c2, nkf_char c1)
4176 if (0x20 < c1 && c1 < 0x74) {
4178 (*o_hira_conv)(c2,c1);
4180 } else if (c1 == 0x74 && nkf_enc_unicode_p(output_encoding)) {
4182 c1 = nkf_char_unicode_new(0x3094);
4183 (*o_hira_conv)(c2,c1);
4186 } else if (c2 == 0x21 && (c1 == 0x33 || c1 == 0x34)) {
4187 c1 += 2;
4188 (*o_hira_conv)(c2,c1);
4193 if (c2 == 0 && c1 == nkf_char_unicode_new(0x3094)) {
4195 c1 = 0x74;
4196 } else if (c2 == 0x24 && 0x20 < c1 && c1 < 0x74) {
4198 } else if (c2 == 0x21 && (c1 == 0x35 || c1 == 0x36)) {
4199 c1 -= 2;
4202 (*o_hira_conv)(c2,c1);
4207 iso2022jp_check_conv(nkf_char c2, nkf_char c1)
4233 if(c2 >= 0x00 && c2 <= 0x20 && c1 >= 0x7f && c1 <= 0xff) {
4235 c1 = GETA2;
4239 c1 = GETA2;
4245 c = (c2 << 8) + c1;
4248 c1 = GETA2;
4251 (*o_iso2022jp_check_conv)(c2,c1);
4275 nkf_char (*mime_priority_func[])(nkf_char c2, nkf_char c1, nkf_char c0) = {
4313 static nkf_char (*mime_iconv_back)(nkf_char c2,nkf_char c1,nkf_char c0) = NULL;
4417 nkf_char c1 = 0;
4429 if (((r[i] = c1 = (*i_getc)(f))==EOF) || nkf_toupper(c1) != p[i]) {
4436 if (k==i && nkf_toupper(c1)==p[k]) break;
4441 (*i_ungetc)(c1,f);
4445 return c1;
4463 return c1;
4469 nkf_char c1 = 0;
4480 c1 = (*i_getc)(f); mime_input_buf(mime_input_state.last++) = (unsigned char)c1;
4481 if (c1==LF||c1==SP||c1==CR||
4482 c1=='-'||c1=='_'||is_alnum(c1)) continue;
4483 if (c1=='=') {
4485 (*i_ungetc)(c1,f);
4489 if (c1!='?') break;
4491 /* c1=='?' */
4492 c1 = (*i_getc)(f); mime_input_buf(mime_input_state.last++) = (unsigned char)c1;
4493 if (!(++i<MAXRECOVER) || c1==EOF) break;
4494 if (c1=='b'||c1=='B') {
4496 } else if (c1=='q'||c1=='Q') {
4501 c1 = (*i_getc)(f); mime_input_buf(mime_input_state.last++) = (unsigned char)c1;
4502 if (!(++i<MAXRECOVER) || c1==EOF) break;
4503 if (c1!='?') {
4515 return c1;
4520 return c1; /* used only for checking EOF */
4612 nkf_char c1, c2, c3;
4613 c1 = (*g)(f);
4614 if (c1 != ch){
4615 return c1;
4620 return c1;
4626 return c1;
4805 nkf_char c1, c2, c3, c4, cc;
4826 if ((c1 = (*i_mgetc)(f)) == EOF) return (EOF);
4828 if (c1=='_' && mimebuf_f != FIXED_MIME) return SP;
4829 if (c1<=SP || DEL<=c1) {
4831 return c1;
4833 if (c1!='=' && (c1!='?' || mimebuf_f == FIXED_MIME)) {
4834 return c1;
4839 if (c1=='?'&&c2=='=' && mimebuf_f != FIXED_MIME) {
4844 while ((c1=(*i_getc)(f))!=EOF) {
4845 switch (c1) {
4848 if (c1==LF) {
4849 if ((c1=(*i_getc)(f))!=EOF && nkf_isblank(c1)) {
4853 i_ungetc(c1,f);
4855 c1 = LF;
4857 if ((c1=(*i_getc)(f))!=EOF && c1 == LF) {
4858 if ((c1=(*i_getc)(f))!=EOF && nkf_isblank(c1)) {
4862 i_ungetc(c1,f);
4866 i_ungetc(c1,f);
4868 c1 = CR;
4873 lwsp_buf[lwsp_count] = (unsigned char)c1;
4883 if (lwsp_count > 0 && (c1 != '=' || (lwsp_buf[lwsp_count-1] != SP && lwsp_buf[lwsp_count-1] != TAB))) {
4884 i_ungetc(c1,f);
4887 c1 = lwsp_buf[0];
4890 return c1;
4892 if (c1=='='&&c2<SP) { /* this is soft wrap */
4893 while((c1 = (*i_mgetc)(f)) <=SP) {
4894 if (c1 == EOF) return (EOF);
4899 if (c1=='?') {
4902 return c1;
4927 while ((c1 = (*i_mgetc)(f))<=SP) {
4928 if (c1==EOF)
4939 if ((c1 == '?') && (c2 == '=')) {
4943 while ((c1=(*i_getc)(f))!=EOF) {
4944 switch (c1) {
4947 if (c1==LF) {
4948 if ((c1=(*i_getc)(f))!=EOF && nkf_isblank(c1)) {
4952 i_ungetc(c1,f);
4954 c1 = LF;
4956 if ((c1=(*i_getc)(f))!=EOF) {
4957 if (c1==SP) {
4960 } else if ((c1=(*i_getc)(f))!=EOF && nkf_isblank(c1)) {
4964 i_ungetc(c1,f);
4968 i_ungetc(c1,f);
4970 c1 = CR;
4975 lwsp_buf[lwsp_count] = (unsigned char)c1;
4985 if (lwsp_count > 0 && (c1 != '=' || (lwsp_buf[lwsp_count-1] != SP && lwsp_buf[lwsp_count-1] != TAB))) {
4986 i_ungetc(c1,f);
4989 c1 = lwsp_buf[0];
4992 return c1;
5015 t1 = 0x3f & base64decode(c1);
5030 return c1;
5093 mime_prechar(nkf_char c2, nkf_char c1)
5104 if ((c2 != 0 || c1 > DEL) && base64_count + mimeout_state.count/3*4> 66) {
5480 base64_conv(nkf_char c2, nkf_char c1)
5482 mime_prechar(c2, c1);
5483 (*o_base64conv)(c2,c1);
5822 #define MORE c2=c1;continue /* need one more byte */
5823 #define SEND (void)0 /* output c1 and c2, get next */
5835 nkf_char c1=0, c2=0, c3=0, c4=0;
5857 while ((c1 = (*i_getc)(f)) != EOF &&
5862 if (nkf_iconv_utf_32(c1, c2, c3, c4) == (size_t)NKF_ICONV_WAIT_COMBINING_CHAR) {
5867 if (nkf_iconv_utf_32_combine(c1, c2, c3, c4, c5, c6, c7, c8)) {
5872 nkf_iconv_utf_32_nocombine(c1, c2, c3, c4);
5875 nkf_iconv_utf_32_nocombine(c1, c2, c3, c4);
5882 while ((c1 = (*i_getc)(f)) != EOF &&
5884 size_t ret = nkf_iconv_utf_16(c1, c2, 0, 0);
5888 nkf_iconv_utf_16(c1, c2, c3, c4);
5892 if (nkf_iconv_utf_16_combine(c1, c2, c3, c4)) {
5895 nkf_iconv_utf_16_nocombine(c1, c2);
5898 nkf_iconv_utf_16_nocombine(c1, c2);
5906 while ((c1 = (*i_getc)(f)) != EOF) {
5910 code_status(c1);
5918 if (h_conv(f, c2, c1)==EOF) {
5927 if (c1 < 0x40) {
5940 else if (nkf_char_unicode_p(c1)) {
5941 (*oconv)(0, c1);
5946 if (input_mode == JIS_X_0208 && DEL <= c1 && c1 < 0x92) {
5950 0xA1 <= c1 && c1 <= 0xDF) {
5953 c1 &= 0x7f;
5955 } else if (c1 > DEL) {
5963 c1 &= 0x7f;
5966 else if ((iconv == s_iconv && 0xA0 <= c1 && c1 <= 0xDF) ||
5967 (ms_ucs_map_f == UCS_MAP_CP10001 && (c1 == 0xFD || c1 == 0xFE))) {
5970 c1 &= 0x7f;
5978 } else if (SP < c1 && c1 < DEL) {
5985 } else if (nkf_byte_jisx0201_katakana_p(c1)){
5997 } else if (c1 == '=' && mime_f && !mime_decode_mode) {
5999 if ((c1 = (*i_getc)(f)) == EOF) {
6002 } else if (c1 == '?') {
6014 (*i_ungetc)(c1,f);
6021 } else if (c1 == SI && (!is_8bit || mime_decode_mode)) {
6024 } else if (c1 == SO && (!is_8bit || mime_decode_mode)) {
6027 } else if (c1 == ESC && (!is_8bit || mime_decode_mode)) {
6028 if ((c1 = (*i_getc)(f)) == EOF) {
6032 else if (c1 == '&') {
6034 if ((c1 = (*i_getc)(f)) == EOF) {
6040 else if (c1 == '$') {
6042 if ((c1 = (*i_getc)(f)) == EOF) {
6047 } else if (c1 == '@' || c1 == 'B') {
6051 } else if (c1 == '(') {
6053 if ((c1 = (*i_getc)(f)) == EOF) {
6060 } else if (c1 == '@'|| c1 == 'B') {
6065 } else if (c1 == 'D'){
6069 } else if (c1 == 'O' || c1 == 'Q'){
6072 } else if (c1 == 'P'){
6080 (*oconv)(0, c1);
6091 (*oconv)(0, c1);
6094 } else if (c1 == '(') {
6096 if ((c1 = (*i_getc)(f)) == EOF) {
6102 else if (c1 == 'I') {
6108 else if (c1 == 'B' || c1 == 'J' || c1 == 'H') {
6123 else if (c1 == '.') {
6125 if ((c1 = (*i_getc)(f)) == EOF) {
6128 else if (c1 == 'A') {
6139 else if (c1 == 'N') {
6141 c1 = (*i_getc)(f);
6146 (*i_ungetc)(c1, f);
6157 } else if (c1 == ESC && iconv == s_iconv) {
6159 if ((c1 = (*i_getc)(f)) == EOF) {
6162 } else if (c1 == '$') {
6164 if ((c1 = (*i_getc)(f)) == EOF) {
6166 } else if (('E' <= c1 && c1 <= 'G') ||
6167 ('O' <= c1 && c1 <= 'Q')) {
6177 c3 = nkf_char_unicode_new(jphone_emoji_first_table[c1 % 7]);
6178 if ((c1 = (*i_getc)(f)) == EOF) LAST;
6179 while (SP <= c1 && c1 <= 'z') {
6180 (*oconv)(0, c1 + c3);
6181 if ((c1 = (*i_getc)(f)) == EOF) LAST;
6196 } else if (c1 == LF || c1 == CR) {
6201 if (c1 == LF) {
6202 if ((c1=(*i_getc)(f))!=EOF && c1 == SP) {
6206 i_ungetc(c1,f);
6208 c1 = LF;
6210 } else { /* if (c1 == CR)*/
6211 if ((c1=(*i_getc)(f))!=EOF) {
6212 if (c1==SP) {
6215 } else if (c1 == LF && (c1=(*i_getc)(f))!=EOF && c1 == SP) {
6219 i_ungetc(c1,f);
6223 i_ungetc(c1,f);
6225 c1 = CR;
6235 switch ((*iconv)(c2, c1, 0)) { /* can be EUC / SJIS / UTF-8 */
6243 (*iconv)(c2, c1, c3|c4);
6251 if (w_iconv_combine(c2, c1, 0, c3, c4, 0)) {
6254 w_iconv_nocombine(c2, c1, 0);
6258 w_iconv_nocombine(c2, c1, 0);
6261 w_iconv_nocombine(c2, c1, 0);
6268 if ((*iconv)(c2, c1, c3) == -3) {
6274 if (w_iconv_combine(c2, c1, c3, c4, c5, c6)) {
6278 w_iconv_nocombine(c2, c1, c3);
6283 w_iconv_nocombine(c2, c1, c3);
6287 w_iconv_nocombine(c2, c1, c3);
6290 w_iconv_nocombine(c2, c1, c3);
6301 0x21 <= c1 && c1 <= 0x7E) {
6303 c1 = nkf_char_unicode_new((c2 - 0x7F) * 94 + c1 - 0x21 + 0xE000);
6306 (*oconv)(c2, c1); /* this is JIS, not SJIS/EUC case */
6310 (*oconv)(PREFIX_EUCG3 | c2, c1);
6314 (*oconv)(PREFIX_EUCG3 | c2, c1);
6317 (*oconv)(input_mode, c1); /* other special case */