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
14 #ifdef CONFIG_UCW_CLEAN_ABI
15 #define charset_name ucw_charset_name
16 #define conv_in_to_ucs ucw_conv_in_to_ucs
17 #define conv_init ucw_conv_init
18 #define conv_set_charset ucw_conv_set_charset
19 #define conv_ucs_to_out ucw_conv_ucs_to_out
20 #define conv_ucs_to_x ucw_conv_ucs_to_x
21 #define conv_x_count ucw_conv_x_count
22 #define conv_x_to_ucs ucw_conv_x_to_ucs
23 #define find_charset_by_name ucw_find_charset_by_name
28 /* Parameters supplied by the caller */
30 const unsigned char *source; /* Current position in source buffer */
31 const unsigned char *source_end; /* End of source buffer */
32 unsigned char *dest; /* Current position in destination buffer */
33 unsigned char *dest_start; /* First byte of destination buffer */
34 unsigned char *dest_end; /* End of destination buffer */
36 /* Internal variables */
38 int (*convert)(struct conv_context *);
39 int source_charset, dest_charset;
40 unsigned short int *in_to_x;
41 unsigned short int *x_to_out;
42 uint state, code, remains;
43 unsigned char *string_at;
46 void conv_init(struct conv_context *);
47 void conv_set_charset(struct conv_context *, int, int);
48 #define conv_run(c) ((c)->convert(c))
50 #define CONV_SOURCE_END 1
51 #define CONV_DEST_END 2
56 CONV_CHARSET_ISO_8859_1,
57 CONV_CHARSET_ISO_8859_2,
58 CONV_CHARSET_ISO_8859_3,
59 CONV_CHARSET_ISO_8859_4,
60 CONV_CHARSET_ISO_8859_5,
61 CONV_CHARSET_ISO_8859_6,
62 CONV_CHARSET_ISO_8859_7,
63 CONV_CHARSET_ISO_8859_8,
64 CONV_CHARSET_ISO_8859_9,
65 CONV_CHARSET_ISO_8859_10,
66 CONV_CHARSET_ISO_8859_11,
67 CONV_CHARSET_ISO_8859_13,
68 CONV_CHARSET_ISO_8859_14,
69 CONV_CHARSET_ISO_8859_15,
70 CONV_CHARSET_ISO_8859_16,
75 CONV_CHARSET_CSN369103,
80 CONV_CHARSET_UTF16_BE,
81 CONV_CHARSET_UTF16_LE,
85 /* Conversion of a single character between current non-UTF8 charset and Unicode */
86 int conv_in_to_ucs(struct conv_context *c, uint y);
87 int conv_ucs_to_out(struct conv_context *c, uint ucs);
89 /* For those brave ones who want to mess with charconv internals */
90 uint conv_x_to_ucs(uint x);
91 uint conv_ucs_to_x(uint ucs);
92 uint conv_x_count(void);
96 int find_charset_by_name(const char *);
97 char *charset_name(int);