1
/* Copyright (C) 1999-2023 Free Software Foundation, Inc.
1
/* Copyright (C) 1999-2024 Free Software Foundation, Inc.
2
2
This file is part of the GNU LIBICONV Library.
4
4
The GNU LIBICONV Library is free software; you can redistribute it
34
34
/* We would like to #include any system header file which could define
35
iconv_t, 1. in order to eliminate the risk that the user gets compilation
35
iconv_t, in order to eliminate the risk that the user gets compilation
36
36
errors because some other system header file includes /usr/include/iconv.h
37
which defines iconv_t or declares iconv after this file, 2. when compiling
38
for LIBICONV_PLUG, we need the proper iconv_t type in order to produce
39
binary compatible code.
37
which defines iconv_t or declares iconv after this file.
40
38
But gcc's #include_next is not portable. Thus, once libiconv's iconv.h
41
39
has been installed in /usr/local/include, there is no way any more to
42
40
include the original /usr/include/iconv.h. We simply have to get away
44
Ad 1. The risk that a system header file does
42
The risk that a system header file does
45
43
#include "iconv.h" or #include_next "iconv.h"
46
is small. They all do #include <iconv.h>.
47
Ad 2. The iconv_t type is a pointer type in all cases I have seen. (It
48
has to be a scalar type because (iconv_t)(-1) is a possible return value
49
from iconv_open().) */
44
is small. They all do #include <iconv.h>. */
51
46
/* Define iconv_t ourselves. */
75
70
/* Allocates descriptor for code conversion from encoding ‘fromcode’ to
76
71
encoding ‘tocode’. */
78
72
#define iconv_open libiconv_open
80
73
extern iconv_t iconv_open (const char* tocode, const char* fromcode);
82
75
/* Converts, using conversion descriptor ‘cd’, at most ‘*inbytesleft’ bytes
85
78
Decrements ‘*inbytesleft’ and increments ‘*inbuf’ by the same amount.
86
79
Decrements ‘*outbytesleft’ and increments ‘*outbuf’ by the same amount. */
88
80
#define iconv libiconv
90
81
extern size_t iconv (iconv_t cd, @ICONV_CONST@ char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);
92
83
/* Frees resources allocated for conversion descriptor ‘cd’. */
94
84
#define iconv_close libiconv_close
96
85
extern int iconv_close (iconv_t cd);
194
180
void* callback_arg),
195
181
void* callback_arg,
198
/* If the wchar_t type does not exist, these two fallback functions are never
199
invoked. Their argument list therefore does not matter. */
200
typedef void (*iconv_wchar_mb_to_wc_fallback) ();
201
typedef void (*iconv_wchar_wc_to_mb_fallback) ();
203
183
/* Set of fallbacks. */
204
184
struct iconv_fallbacks {
205
185
iconv_unicode_mb_to_uc_fallback mb_to_uc_fallback;
218
198
#define ICONV_SURFACE_EBCDIC_ZOS_UNIX 1
220
200
/* Requests for iconvctl. */
221
#define ICONV_TRIVIALP 0 /* int *argument */
222
#define ICONV_GET_TRANSLITERATE 1 /* int *argument */
223
#define ICONV_SET_TRANSLITERATE 2 /* const int *argument */
224
#define ICONV_GET_DISCARD_ILSEQ 3 /* int *argument */
225
#define ICONV_SET_DISCARD_ILSEQ 4 /* const int *argument */
226
#define ICONV_SET_HOOKS 5 /* const struct iconv_hooks *argument */
227
#define ICONV_SET_FALLBACKS 6 /* const struct iconv_fallbacks *argument */
228
#define ICONV_GET_FROM_SURFACE 7 /* unsigned int *argument */
229
#define ICONV_SET_FROM_SURFACE 8 /* const unsigned int *argument */
230
#define ICONV_GET_TO_SURFACE 9 /* unsigned int *argument */
231
#define ICONV_SET_TO_SURFACE 10 /* const unsigned int *argument */
201
#define ICONV_TRIVIALP 0 /* int *argument */
202
#define ICONV_GET_TRANSLITERATE 1 /* int *argument */
203
#define ICONV_SET_TRANSLITERATE 2 /* const int *argument */
204
#define ICONV_GET_DISCARD_ILSEQ 3 /* int *argument */
205
#define ICONV_SET_DISCARD_ILSEQ 4 /* const int *argument */
206
#define ICONV_SET_HOOKS 5 /* const struct iconv_hooks *argument */
207
#define ICONV_SET_FALLBACKS 6 /* const struct iconv_fallbacks *argument */
208
#define ICONV_GET_FROM_SURFACE 7 /* unsigned int *argument */
209
#define ICONV_SET_FROM_SURFACE 8 /* const unsigned int *argument */
210
#define ICONV_GET_TO_SURFACE 9 /* unsigned int *argument */
211
#define ICONV_SET_TO_SURFACE 10 /* const unsigned int *argument */
212
#define ICONV_GET_DISCARD_INVALID 11 /* int *argument */
213
#define ICONV_SET_DISCARD_INVALID 12 /* const int *argument */
214
#define ICONV_GET_DISCARD_NON_IDENTICAL 13 /* int *argument */
215
#define ICONV_SET_DISCARD_NON_IDENTICAL 14 /* const int *argument */
233
217
/* Listing of locale independent encodings. */
234
218
#define iconvlist libiconvlist