2 * Character Set Conversion Library 1.2
4 * (c) 1998--2005 Martin Mares <mj@ucw.cz>
5 * (c) 2007 Pavel Charvat <pchar@ucw.cz>
7 * This software may be freely distributed and used according to the terms
8 * of the GNU Lesser General Public License.
11 #ifndef _CHARSET_CHARCONV_H
12 #define _CHARSET_CHARCONV_H
16 /* Parameters supplied by the caller */
18 const unsigned char *source; /* Current position in source buffer */
19 const unsigned char *source_end; /* End of source buffer */
20 unsigned char *dest; /* Current position in destination buffer */
21 unsigned char *dest_start; /* First byte of destination buffer */
22 unsigned char *dest_end; /* End of destination buffer */
24 /* Internal variables */
26 int (*convert)(struct conv_context *);
27 int source_charset, dest_charset;
28 unsigned short int *in_to_x;
29 unsigned short int *x_to_out;
30 unsigned int state, code, remains;
31 unsigned char *string_at;
34 void conv_init(struct conv_context *);
35 void conv_set_charset(struct conv_context *, int, int);
36 #define conv_run(c) ((c)->convert(c))
38 #define CONV_SOURCE_END 1
39 #define CONV_DEST_END 2
44 CONV_CHARSET_ISO_8859_1,
45 CONV_CHARSET_ISO_8859_2,
46 CONV_CHARSET_ISO_8859_3,
47 CONV_CHARSET_ISO_8859_4,
48 CONV_CHARSET_ISO_8859_5,
49 CONV_CHARSET_ISO_8859_6,
50 CONV_CHARSET_ISO_8859_7,
51 CONV_CHARSET_ISO_8859_8,
52 CONV_CHARSET_ISO_8859_9,
53 CONV_CHARSET_ISO_8859_10,
54 CONV_CHARSET_ISO_8859_11,
55 CONV_CHARSET_ISO_8859_13,
56 CONV_CHARSET_ISO_8859_14,
57 CONV_CHARSET_ISO_8859_15,
58 CONV_CHARSET_ISO_8859_16,
63 CONV_CHARSET_CSN369103,
68 CONV_CHARSET_UTF16_BE,
69 CONV_CHARSET_UTF16_LE,
73 /* Conversion of a single character between current non-UTF8 charset and Unicode */
74 int conv_in_to_ucs(struct conv_context *c, unsigned int y);
75 int conv_ucs_to_out(struct conv_context *c, unsigned int ucs);
77 /* For those brave ones who want to mess with charconv internals */
78 unsigned int conv_x_to_ucs(unsigned int x);
79 unsigned int conv_ucs_to_x(unsigned int ucs);
80 unsigned int conv_x_count(void);
84 int find_charset_by_name(const char *);
85 char *charset_name(int);