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