2 * Copyright (C) 1999-2002, 2004-2007 Free Software Foundation, Inc.
3 * This file is part of the GNU LIBICONV Library.
5 * The GNU LIBICONV Library is free software; you can redistribute it
6 * and/or modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * The GNU LIBICONV Library is distributed in the hope that it will be
11 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with the GNU LIBICONV Library; see the file COPYING.LIB.
17 * If not, write to the Free Software Foundation, Inc., 51 Franklin Street,
18 * Fifth Floor, Boston, MA 02110-1301, USA.
21 /* This file defines all the converters. */
24 /* Our own notion of wide character, as UCS-4, according to ISO-10646-1. */
25 typedef unsigned int ucs4_t
;
27 /* State used by a conversion. 0 denotes the initial state. */
28 typedef unsigned int state_t
;
30 /* iconv_t is an opaque type. This is the real iconv_t type. */
31 typedef struct conv_struct
* conv_t
;
34 * Data type for conversion multibyte -> unicode
37 int (*xxx_mbtowc
) (conv_t conv
, ucs4_t
*pwc
, unsigned char const *s
, int n
);
39 * int xxx_mbtowc (conv_t conv, ucs4_t *pwc, unsigned char const *s, int n)
40 * converts the byte sequence starting at s to a wide character. Up to n bytes
41 * are available at s. n is >= 1.
42 * Result is number of bytes consumed (if a wide character was read),
43 * or -1 if invalid, or -2 if n too small, or -2-(number of bytes consumed)
44 * if only a shift sequence was read.
46 int (*xxx_flushwc
) (conv_t conv
, ucs4_t
*pwc
);
48 * int xxx_flushwc (conv_t conv, ucs4_t *pwc)
49 * returns to the initial state and stores the pending wide character, if any.
50 * Result is 1 (if a wide character was read) or 0 if none was pending.
54 /* Return code if invalid. (xxx_mbtowc) */
56 /* Return code if only a shift sequence of n bytes was read. (xxx_mbtowc) */
57 #define RET_TOOFEW(n) (-2-(n))
60 * Data type for conversion unicode -> multibyte
63 int (*xxx_wctomb
) (conv_t conv
, unsigned char *r
, ucs4_t wc
, int n
);
65 * int xxx_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
66 * converts the wide character wc to the character set xxx, and stores the
67 * result beginning at r. Up to n bytes may be written at r. n is >= 1.
68 * Result is number of bytes written, or -1 if invalid, or -2 if n too small.
70 int (*xxx_reset
) (conv_t conv
, unsigned char *r
, int n
);
72 * int xxx_reset (conv_t conv, unsigned char *r, int n)
73 * stores a shift sequences returning to the initial state beginning at r.
74 * Up to n bytes may be written at r. n is >= 0.
75 * Result is number of bytes written, or -2 if n too small.
79 /* Return code if invalid. (xxx_wctomb) */
81 /* Return code if output buffer is too small. (xxx_wctomb, xxx_reset) */
82 #define RET_TOOSMALL -2
85 * Contents of a conversion descriptor.
88 struct loop_funcs lfuncs
;
89 /* Input (conversion multibyte -> unicode) */
91 struct mbtowc_funcs ifuncs
;
93 /* Output (conversion unicode -> multibyte) */
95 struct wctomb_funcs ofuncs
;
101 #ifndef LIBICONV_PLUG
102 struct iconv_fallbacks fallbacks
;
103 struct iconv_hooks hooks
;
108 * Include all the converters.
113 /* General multi-byte encodings */
128 #include "ucs2internal.h"
129 #include "ucs2swapped.h"
130 #include "ucs4internal.h"
131 #include "ucs4swapped.h"
135 /* 8-bit encodings */
136 #include "iso8859_1.h"
137 #include "iso8859_2.h"
138 #include "iso8859_3.h"
139 #include "iso8859_4.h"
140 #include "iso8859_5.h"
141 #include "iso8859_6.h"
142 #include "iso8859_7.h"
143 #include "iso8859_8.h"
144 #include "iso8859_9.h"
145 #include "iso8859_10.h"
146 #include "iso8859_11.h"
147 #include "iso8859_13.h"
148 #include "iso8859_14.h"
149 #include "iso8859_15.h"
150 #include "iso8859_16.h"
166 #include "mac_roman.h"
167 #include "mac_centraleurope.h"
168 #include "mac_iceland.h"
169 #include "mac_croatian.h"
170 #include "mac_romania.h"
171 #include "mac_cyrillic.h"
172 #include "mac_ukraine.h"
173 #include "mac_greek.h"
174 #include "mac_turkish.h"
175 #include "mac_hebrew.h"
176 #include "mac_arabic.h"
177 #include "mac_thai.h"
178 #include "hp_roman8.h"
179 #include "nextstep.h"
180 #include "armscii_8.h"
181 #include "georgian_academy.h"
182 #include "georgian_ps.h"
193 /* CJK character sets [CCS = coded character set] [CJKV.INF chapter 3] */
196 unsigned short indx
; /* index into big table */
197 unsigned short used
; /* bitmask of used entries */
200 #include "iso646_jp.h"
201 #include "jisx0201.h"
202 #include "jisx0208.h"
203 #include "jisx0212.h"
205 #include "iso646_cn.h"
207 #include "isoir165.h"
208 /*#include "gb12345.h"*/
210 #include "cns11643.h"
214 #include "johab_hangul.h"
216 /* CJK encodings [CES = character encoding scheme] [CJKV.INF chapter 4] */
221 #include "iso2022_jp.h"
222 #include "iso2022_jp1.h"
223 #include "iso2022_jp2.h"
229 #include "iso2022_cn.h"
230 #include "iso2022_cnext.h"
233 #include "ces_big5.h"
235 #include "big5hkscs1999.h"
236 #include "big5hkscs2001.h"
237 #include "big5hkscs2004.h"
242 #include "iso2022_kr.h"
244 /* Encodings used by system dependent locales. */
259 #include "dec_kanji.h"
260 #include "dec_hanyu.h"
282 #include "euc_jisx0213.h"
283 #include "shift_jisx0213.h"
284 #include "iso2022_jp3.h"
285 #include "big5_2003.h"