Intial commit
[profile/ivi/w3m.git] / libwc / wc_types.h
1
2 #ifndef _WC_TYPES_H
3 #define _WC_TYPES_H
4
5 #include <Str.h>
6 #include <config.h>
7 #if defined(HAVE_STDINT_H)
8 # include <stdint.h>
9 #elif defined(HAVE_INTTYPES_H)
10 # include <inttypes.h>
11 #endif
12
13 typedef unsigned char  wc_uchar;
14 #if defined(HAVE_STDINT_H) || defined(HAVE_INTTYPES_H)
15 typedef uint8_t wc_uint8;
16 typedef uint16_t wc_uint16;
17 typedef uint32_t wc_uint32;
18 #else
19 typedef unsigned char  wc_uint8;
20 typedef unsigned short wc_uint16;
21 typedef unsigned long  wc_uint32;
22 #endif
23
24 typedef wc_uint32 wc_ccs;
25 typedef wc_uint32 wc_ces;
26 typedef wc_uint32 wc_locale;
27 typedef wc_uchar  wc_bool;
28
29 typedef struct {
30     wc_ccs ccs;
31     wc_uint32 code;
32 } wc_wchar_t;
33
34 typedef struct {
35     wc_uint16 code;
36     wc_uint16 code2;
37 } wc_map;
38
39 typedef struct {
40     wc_uint16 code;
41     wc_uint16 code2;
42     wc_uint16 code3;
43 } wc_map3;
44
45 typedef struct {
46     wc_ccs       ccs;
47     size_t       n;
48     wc_map      *map;
49     wc_wchar_t (*conv)();
50 } wc_table;
51
52 typedef struct {
53     wc_ccs   ccs;
54     wc_uchar g;
55     wc_bool  init;
56 } wc_gset;
57
58 typedef struct {
59     wc_ces    id;
60     char     *name;
61     char     *desc;
62     wc_gset  *gset;
63     wc_uchar *gset_ext;
64     Str     (*conv_from)();
65     void    (*push_to)();
66     Str     (*char_conv)();
67 } wc_ces_info;
68
69 typedef struct {
70     wc_ces   id;
71     char    *name;
72     char    *desc;
73 } wc_ces_list;
74
75 typedef struct {
76     wc_uint8 auto_detect;       /* automatically charset detect */
77     wc_bool use_combining;      /* use combining characters */
78     wc_bool use_language_tag;   /* use language_tags */
79     wc_bool ucs_conv;           /* charset conversion using Unicode */
80     wc_bool pre_conv;           /* previously charset conversion */
81     wc_bool fix_width_conv;     /* not allowed conversion between different
82                                    width charsets */
83     wc_bool use_gb12345_map;    /* use GB 12345 Unicode map instead of
84                                    GB 2312 Unicode map */
85     wc_bool use_jisx0201;       /* use JIS X 0201 Roman instead of US_ASCII */
86     wc_bool use_jisc6226;       /* use JIS C 6226:1978 instead of JIS X 0208 */
87     wc_bool use_jisx0201k;      /* use JIS X 0201 Katakana */
88     wc_bool use_jisx0212;       /* use JIS X 0212 */
89     wc_bool use_jisx0213;       /* use JIS X 0213 */
90     wc_bool strict_iso2022;     /* strict ISO 2022 */
91     wc_bool gb18030_as_ucs;     /* treat 4 bytes char. of GB18030 as Unicode */
92     wc_bool no_replace;         /* don't output replace character */
93     wc_bool use_wide;           /* use wide characters */
94 } wc_option;
95
96 typedef struct {
97     wc_ces_info *ces_info;
98     wc_uint8     gr;
99     wc_uint8     gl;
100     wc_uint8     ss;
101     wc_ccs       g0_ccs;
102     wc_ccs       g1_ccs;
103     wc_ccs       design[4];
104 #ifdef USE_UNICODE
105     wc_table   **tlist;
106     wc_table   **tlistw;
107 #endif
108     int          state;
109 #ifdef USE_UNICODE
110     Str          tag;
111     int          ntag;
112     wc_uint32    base;
113     int          shift;
114 #endif
115 } wc_status;
116
117 #endif