Intial commit
[profile/ivi/w3m.git] / libwc / iso2022.h
1
2 #ifndef _WC_ISO2022_H
3 #define _WC_ISO2022_H
4
5 #define WC_C_ESC        0x1B    /* '\033' */
6 #define WC_C_SS2        0x4E    /* ESC 'N' */
7 #define WC_C_SS3        0x4F    /* ESC 'O' */
8 #define WC_C_LS2        0x6E    /* ESC 'n' */
9 #define WC_C_LS3        0x6F    /* ESC 'o' */
10 #define WC_C_LS1R       0x7E    /* ESC '~' */
11 #define WC_C_LS2R       0x7D    /* ESC '}' */
12 #define WC_C_LS3R       0x7C    /* ESC '|' */
13 #define WC_C_G0_CS94    0x28    /* ESC '(' F */
14 #define WC_C_G1_CS94    0x29    /* ESC ')' F */
15 #define WC_C_G2_CS94    0x2A    /* ESC '*' F */
16 #define WC_C_G3_CS94    0x2B    /* ESC '+' F */
17 #define WC_C_G0_CS96    0x2C    /* ESC ',' F */ /* ISO 2022 does not permit */
18 #define WC_C_G1_CS96    0x2D    /* ESC '-' F */
19 #define WC_C_G2_CS96    0x2E    /* ESC '.' F */
20 #define WC_C_G3_CS96    0x2F    /* ESC '/' F */
21 #define WC_C_MBCS       0x24    /* ESC '$' G F */
22 #define WC_C_CS942      0x21    /* ESC G '!' F */
23 #define WC_C_C0         0x21    /* ESC '!' F */
24 #define WC_C_C1         0x22    /* ESC '"' F */
25 #define WC_C_REP        0x26    /* ESC '&' F ESC '"' F */
26 #define WC_C_CSWSR      0x25    /* ESC '%' F */
27 #define WC_C_CSWOSR     0x2F    /* ESC '%' '/' F */
28
29 #define WC_C_SO         0x0E    /* '\016' */
30 #define WC_C_SI         0x0F    /* '\017' */
31 #define WC_C_SS2R       0x8E
32 #define WC_C_SS3R       0x8F
33
34 #define WC_F_ISO_646_US         0x42    /* 'B' */
35 #define WC_F_ISO_646_IRV        WC_F_ISO_646_US
36 #define WC_F_US_ASCII           WC_F_ISO_646_US
37 #define WC_F_JIS_X_0201K        0x49    /* 'I' */
38 #define WC_F_JIS_X_0201         0x4A    /* 'J' */
39 #define WC_F_GB_1988            0x54    /* 'T' */
40
41 #define WC_F_ISO_8859_1         0x41    /* 'A' */
42 #define WC_F_ISO_8859_2         0x42    /* 'B' */
43 #define WC_F_ISO_8859_3         0x43    /* 'C' */
44 #define WC_F_ISO_8859_4         0x44    /* 'D' */
45 #define WC_F_ISO_8859_5         0x4C    /* 'L' */
46 #define WC_F_ISO_8859_6         0x47    /* 'G' */
47 #define WC_F_ISO_8859_7         0x46    /* 'F' */
48 #define WC_F_ISO_8859_8         0x48    /* 'H' */
49 #define WC_F_ISO_8859_9         0x4D    /* 'M' */
50 #define WC_F_ISO_8859_10        0x56    /* 'V' */
51 #define WC_F_ISO_8859_11        0x54    /* 'T' */
52 #define WC_F_TIS_620            WC_F_ISO_8859_11
53 #define WC_F_ISO_8859_13        0x59    /* 'Y' */
54 #define WC_F_ISO_8859_14        0x5F    /* '_' */
55 #define WC_F_ISO_8859_15        0x62    /* 'b' */
56 #define WC_F_ISO_8859_16        0x66    /* 'f' */
57
58 #define WC_F_JIS_C_6226         0x40    /* '@' */
59 #define WC_F_GB_2312            0x41    /* 'A' */
60 #define WC_F_JIS_X_0208         0x42    /* 'B' */
61 #define WC_F_KS_X_1001          0x43    /* 'C' */
62 #define WC_F_KS_C_5601          WC_F_KS_X_1001
63 #define WC_F_JIS_X_0212         0x44    /* 'D' */
64 #define WC_F_ISO_IR_165         0x45    /* 'E' */
65 #define WC_F_CCITT_GB           WC_F_ISO_IR_165
66 #define WC_F_CNS_11643_1        0x47    /* 'G' */
67 #define WC_F_CNS_11643_2        0x48    /* 'H' */
68 #define WC_F_CNS_11643_3        0x49    /* 'I' */
69 #define WC_F_CNS_11643_4        0x4A    /* 'J' */
70 #define WC_F_CNS_11643_5        0x4B    /* 'K' */
71 #define WC_F_CNS_11643_6        0x4C    /* 'L' */
72 #define WC_F_CNS_11643_7        0x4D    /* 'M' */
73 #define WC_F_KPS_9566           0x4E    /* 'N' */
74 #define WC_F_JIS_X_0213_1       0x4F    /* 'O' */
75 #define WC_F_JIS_X_0213_2       0x50    /* 'P' */
76
77 #define WC_ISO_NOSTATE          0
78 #define WC_ISO_MBYTE1           1
79 #define WC_EUC_NOSTATE          0
80 #define WC_EUC_MBYTE1           2       /* for EUC (G1) */
81 #define WC_EUC_TW_SS2           3       /* for EUC_TW (G2) */
82 #define WC_EUC_TW_MBYTE1        4       /* for EUC_TW (G2) */
83 #define WC_EUC_TW_MBYTE2        5       /* for EUC_TW (G2) */
84 #define WC_ISO_ESC              6
85 #define WC_ISO_CSWSR            0x10
86 #define WC_ISO_CSWOSR           0x20
87
88 #define WC_ISO_MAP_CG   0xF0
89 #define WC_ISO_MAP_C0   0x10                    /* 0x00 - 0x1F */
90 #define WC_ISO_MAP_GL   0x00                    /* 0x21 - 0x7E */
91 #define WC_ISO_MAP_GL96 0x20                    /* 0x20,  0x7F */
92 #define WC_ISO_MAP_C1   0x50                    /* 0x80 - 0x9F */
93 #define WC_ISO_MAP_GR   0x40                    /* 0xA1 - 0xFE */
94 #define WC_ISO_MAP_GR96 0x60                    /* 0xA0,  0xFF */
95 #define WC_ISO_MAP_SO   (0x1 | WC_ISO_MAP_C0)   /* 0x0E */
96 #define WC_ISO_MAP_SI   (0x2 | WC_ISO_MAP_C0)   /* 0x0F */
97 #define WC_ISO_MAP_ESC  (0x3 | WC_ISO_MAP_C0)   /* 0x1B */
98 #define WC_ISO_MAP_SS2  (0x4 | WC_ISO_MAP_C1)   /* 0x8E */
99 #define WC_ISO_MAP_SS3  (0x5 | WC_ISO_MAP_C1)   /* 0x8F */
100 #define WC_ISO_MAP_DETECT       0x4F
101
102 #define WC_CS94WUL_N(U,L)       (((U) - 0x21) * 0x5E + (L) - 0x21)
103 #define WC_CS94W_N(c)   WC_CS94WUL_N(((c) >> 8) & 0x7F, (c) & 0x7F)     
104 #define WC_CS96WUL_N(U,L)       (((U) - 0x20) * 0x60 + (L) - 0x20)
105 #define WC_CS96W_N(c)   WC_CS96WUL_N(((c) >> 8) & 0x7F, (c) & 0x7F)     
106 #define WC_N_CS94WU(c)  ((c) / 0x5E + 0x21)
107 #define WC_N_CS94WL(c)  ((c) % 0x5E + 0x21)
108 #define WC_N_CS94W(c)   ((WC_N_CS94WU(c) << 8) + WC_N_CS94WL(c))
109 #define WC_N_CS96WU(c)  ((c) / 0x60 + 0x20)
110 #define WC_N_CS96WL(c)  ((c) % 0x60 + 0x20)
111 #define WC_N_CS96W(c)   ((WC_N_CS96WU(c) << 8) + WC_N_CS96WL(c))
112
113 extern wc_uint8 WC_ISO_MAP[];
114
115 extern Str  wc_conv_from_iso2022(Str is, wc_ces ces);
116 extern void wc_push_to_iso2022(Str os, wc_wchar_t cc, wc_status *st);
117 extern void wc_push_to_euc(Str os, wc_wchar_t cc, wc_status *st);
118 extern void wc_push_to_eucjp(Str os, wc_wchar_t cc, wc_status *st);
119 extern void wc_push_to_euctw(Str os, wc_wchar_t cc, wc_status *st);
120 extern void wc_push_to_iso8859(Str os, wc_wchar_t cc, wc_status *st);
121 extern void wc_push_to_iso2022_end(Str os, wc_status *st);
122 extern int  wc_parse_iso2022_esc(wc_uchar **ptr, wc_status *st);
123 extern void wc_push_iso2022_esc(Str os, wc_ccs ccs, wc_uchar g, wc_uint8 invoke, wc_status *st);
124 extern void wc_create_gmap(wc_status *st);
125 extern Str  wc_char_conv_from_iso2022(wc_uchar c, wc_status *st);
126
127 #endif