1- /* Copyright (C) 1999-2022 Free Software Foundation, Inc.
1+ /* Copyright (C) 1999-2024 Free Software Foundation, Inc.
22 This file is part of the GNU LIBICONV Library.
33
44 The GNU LIBICONV Library is free software; you can redistribute it
2020#ifndef _LIBICONV_H
2121#define _LIBICONV_H
2222
23- #define _LIBICONV_VERSION 0x0111 /* version number: (major<<8) + minor */
23+ #ifdef __cplusplus
24+ extern "C" {
25+ #endif
26+
27+ #define _LIBICONV_VERSION 0x0112 /* version number: (major<<8) + minor */
2428extern __declspec (dllimport ) int _libiconv_version ; /* Likewise */
2529
30+ #ifdef __cplusplus
31+ }
32+ #endif
33+
2634/* We would like to #include any system header file which could define
27- 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
2836 errors because some other system header file includes /usr/include/iconv.h
29- which defines iconv_t or declares iconv after this file, 2. when compiling
30- for LIBICONV_PLUG, we need the proper iconv_t type in order to produce
31- binary compatible code.
37+ which defines iconv_t or declares iconv after this file.
3238 But gcc's #include_next is not portable. Thus, once libiconv's iconv.h
3339 has been installed in /usr/local/include, there is no way any more to
3440 include the original /usr/include/iconv.h. We simply have to get away
3541 without it.
36- Ad 1. The risk that a system header file does
42+ The risk that a system header file does
3743 #include "iconv.h" or #include_next "iconv.h"
38- is small. They all do #include <iconv.h>.
39- Ad 2. The iconv_t type is a pointer type in all cases I have seen. (It
40- has to be a scalar type because (iconv_t)(-1) is a possible return value
41- from iconv_open().) */
44+ is small. They all do #include <iconv.h>. */
4245
4346/* Define iconv_t ourselves. */
4447#undef iconv_t
@@ -66,25 +69,19 @@ extern "C" {
6669
6770/* Allocates descriptor for code conversion from encoding ‘fromcode’ to
6871 encoding ‘tocode’. */
69- #ifndef LIBICONV_PLUG
7072#define iconv_open libiconv_open
71- #endif
7273extern iconv_t iconv_open (const char * tocode , const char * fromcode );
7374
7475/* Converts, using conversion descriptor ‘cd’, at most ‘*inbytesleft’ bytes
7576 starting at ‘*inbuf’, writing at most ‘*outbytesleft’ bytes starting at
7677 ‘*outbuf’.
7778 Decrements ‘*inbytesleft’ and increments ‘*inbuf’ by the same amount.
7879 Decrements ‘*outbytesleft’ and increments ‘*outbuf’ by the same amount. */
79- #ifndef LIBICONV_PLUG
8080#define iconv libiconv
81- #endif
8281extern size_t iconv (iconv_t cd , char * * inbuf , size_t * inbytesleft , char * * outbuf , size_t * outbytesleft );
8382
8483/* Frees resources allocated for conversion descriptor ‘cd’. */
85- #ifndef LIBICONV_PLUG
8684#define iconv_close libiconv_close
87- #endif
8885extern int iconv_close (iconv_t cd );
8986
9087
@@ -93,8 +90,6 @@ extern int iconv_close (iconv_t cd);
9390#endif
9491
9592
96- #ifndef LIBICONV_PLUG
97-
9893/* Nonstandard extensions. */
9994
10095#if 1
@@ -165,7 +160,6 @@ typedef void (*iconv_unicode_uc_to_mb_fallback)
165160 void * callback_arg ),
166161 void * callback_arg ,
167162 void * data );
168- #if 1
169163/* Fallback function. Invoked when a number of bytes could not be converted to
170164 a wide character. This function should process all bytes from inbuf and may
171165 produce replacement wide characters by calling the write_replacement
@@ -186,12 +180,6 @@ typedef void (*iconv_wchar_wc_to_mb_fallback)
186180 void * callback_arg ),
187181 void * callback_arg ,
188182 void * data );
189- #else
190- /* If the wchar_t type does not exist, these two fallback functions are never
191- invoked. Their argument list therefore does not matter. */
192- typedef void (* iconv_wchar_mb_to_wc_fallback ) ();
193- typedef void (* iconv_wchar_wc_to_mb_fallback ) ();
194- #endif
195183/* Set of fallbacks. */
196184struct iconv_fallbacks {
197185 iconv_unicode_mb_to_uc_fallback mb_to_uc_fallback ;
@@ -201,14 +189,30 @@ struct iconv_fallbacks {
201189 void * data ;
202190};
203191
192+ /* Surfaces.
193+ The concept of surfaces is described in the 'recode' manual. */
194+ #define ICONV_SURFACE_NONE 0
195+ /* In EBCDIC encodings, 0x15 (which encodes the "newline function", see the
196+ Unicode standard, chapter 5) maps to U+000A instead of U+0085. This is
197+ for interoperability with C programs and Unix environments on z/OS. */
198+ #define ICONV_SURFACE_EBCDIC_ZOS_UNIX 1
199+
204200/* Requests for iconvctl. */
205- #define ICONV_TRIVIALP 0 /* int *argument */
206- #define ICONV_GET_TRANSLITERATE 1 /* int *argument */
207- #define ICONV_SET_TRANSLITERATE 2 /* const int *argument */
208- #define ICONV_GET_DISCARD_ILSEQ 3 /* int *argument */
209- #define ICONV_SET_DISCARD_ILSEQ 4 /* const int *argument */
210- #define ICONV_SET_HOOKS 5 /* const struct iconv_hooks *argument */
211- #define ICONV_SET_FALLBACKS 6 /* const struct iconv_fallbacks *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 */
212216
213217/* Listing of locale independent encodings. */
214218#define iconvlist libiconvlist
@@ -235,7 +239,5 @@ extern void libiconv_set_relocation_prefix (const char *orig_prefix,
235239}
236240#endif
237241
238- #endif
239-
240242
241243#endif /* _LIBICONV_H */
0 commit comments