]> git.lyx.org Git - lyx.git/blob - 3rdparty/libiconv/1.15/include/iconv.h.build.in
Show cursor correctly whn loading file
[lyx.git] / 3rdparty / libiconv / 1.15 / include / iconv.h.build.in
1 /* Copyright (C) 1999-2003, 2005-2006, 2008-2011 Free Software Foundation, Inc.
2    This file is part of the GNU LIBICONV Library.
3
4    The GNU LIBICONV Library is free software; you can redistribute it
5    and/or modify it under the terms of the GNU Library General Public
6    License as published by the Free Software Foundation; either version 2
7    of the License, or (at your option) any later version.
8
9    The GNU LIBICONV Library is distributed in the hope that it will be
10    useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Library General Public License for more details.
13
14    You should have received a copy of the GNU Library General Public
15    License along with the GNU LIBICONV Library; see the file COPYING.LIB.
16    If not, see <http://www.gnu.org/licenses/>.  */
17
18 /* When installed, this file is called "iconv.h". */
19
20 #ifndef _LIBICONV_H
21 #define _LIBICONV_H
22
23 #define _LIBICONV_VERSION 0x010F    /* version number: (major<<8) + minor */
24
25 #if @HAVE_VISIBILITY@ && BUILDING_LIBICONV
26 #define LIBICONV_DLL_EXPORTED __attribute__((__visibility__("default")))
27 #else
28 #define LIBICONV_DLL_EXPORTED
29 #endif
30 extern LIBICONV_DLL_EXPORTED @DLL_VARIABLE@ int _libiconv_version; /* Likewise */
31
32 /* We would like to #include any system header file which could define
33    iconv_t, 1. in order to eliminate the risk that the user gets compilation
34    errors because some other system header file includes /usr/include/iconv.h
35    which defines iconv_t or declares iconv after this file, 2. when compiling
36    for LIBICONV_PLUG, we need the proper iconv_t type in order to produce
37    binary compatible code.
38    But gcc's #include_next is not portable. Thus, once libiconv's iconv.h
39    has been installed in /usr/local/include, there is no way any more to
40    include the original /usr/include/iconv.h. We simply have to get away
41    without it.
42    Ad 1. The risk that a system header file does
43    #include "iconv.h"  or  #include_next "iconv.h"
44    is small. They all do #include <iconv.h>.
45    Ad 2. The iconv_t type is a pointer type in all cases I have seen. (It
46    has to be a scalar type because (iconv_t)(-1) is a possible return value
47    from iconv_open().) */
48
49 /* Define iconv_t ourselves. */
50 #undef iconv_t
51 #define iconv_t libiconv_t
52 typedef void* iconv_t;
53
54 /* Get size_t declaration.
55    Get wchar_t declaration if it exists. */
56 #include <stddef.h>
57
58 /* Get errno declaration and values. */
59 #include <errno.h>
60 /* Some systems, like SunOS 4, don't have EILSEQ. Some systems, like BSD/OS,
61    have EILSEQ in a different header.  On these systems, define EILSEQ
62    ourselves. */
63 #ifndef EILSEQ
64 #define EILSEQ @EILSEQ@
65 #endif
66
67
68 #ifdef __cplusplus
69 extern "C" {
70 #endif
71
72
73 /* Allocates descriptor for code conversion from encoding ‘fromcode’ to
74    encoding ‘tocode’. */
75 #ifndef LIBICONV_PLUG
76 #define iconv_open libiconv_open
77 #endif
78 extern LIBICONV_DLL_EXPORTED iconv_t iconv_open (const char* tocode, const char* fromcode);
79
80 /* Converts, using conversion descriptor ‘cd’, at most ‘*inbytesleft’ bytes
81    starting at ‘*inbuf’, writing at most ‘*outbytesleft’ bytes starting at
82    ‘*outbuf’.
83    Decrements ‘*inbytesleft’ and increments ‘*inbuf’ by the same amount.
84    Decrements ‘*outbytesleft’ and increments ‘*outbuf’ by the same amount. */
85 #ifndef LIBICONV_PLUG
86 #define iconv libiconv
87 #endif
88 extern LIBICONV_DLL_EXPORTED size_t iconv (iconv_t cd, @ICONV_CONST@ char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);
89
90 /* Frees resources allocated for conversion descriptor ‘cd’. */
91 #ifndef LIBICONV_PLUG
92 #define iconv_close libiconv_close
93 #endif
94 extern LIBICONV_DLL_EXPORTED int iconv_close (iconv_t cd);
95
96
97 #ifdef __cplusplus
98 }
99 #endif
100
101
102 #ifndef LIBICONV_PLUG
103
104 /* Nonstandard extensions. */
105
106 #if @USE_MBSTATE_T@
107 #if @BROKEN_WCHAR_H@
108 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
109    <wchar.h>.
110    BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
111    included before <wchar.h>.  */
112 #include <stddef.h>
113 #include <stdio.h>
114 #include <time.h>
115 #endif
116 #include <wchar.h>
117 #endif
118
119 #ifdef __cplusplus
120 extern "C" {
121 #endif
122
123 /* A type that holds all memory needed by a conversion descriptor.
124    A pointer to such an object can be used as an iconv_t. */
125 typedef struct {
126   void* dummy1[28];
127 #if @USE_MBSTATE_T@
128   mbstate_t dummy2;
129 #endif
130 } iconv_allocation_t;
131
132 /* Allocates descriptor for code conversion from encoding ‘fromcode’ to
133    encoding ‘tocode’ into preallocated memory. Returns an error indicator
134    (0 or -1 with errno set). */
135 #define iconv_open_into libiconv_open_into
136 extern LIBICONV_DLL_EXPORTED int iconv_open_into (const char* tocode, const char* fromcode,
137                             iconv_allocation_t* resultp);
138
139 /* Control of attributes. */
140 #define iconvctl libiconvctl
141 extern LIBICONV_DLL_EXPORTED int iconvctl (iconv_t cd, int request, void* argument);
142
143 /* Hook performed after every successful conversion of a Unicode character. */
144 typedef void (*iconv_unicode_char_hook) (unsigned int uc, void* data);
145 /* Hook performed after every successful conversion of a wide character. */
146 typedef void (*iconv_wide_char_hook) (wchar_t wc, void* data);
147 /* Set of hooks. */
148 struct iconv_hooks {
149   iconv_unicode_char_hook uc_hook;
150   iconv_wide_char_hook wc_hook;
151   void* data;
152 };
153
154 /* Fallback function.  Invoked when a small number of bytes could not be
155    converted to a Unicode character.  This function should process all
156    bytes from inbuf and may produce replacement Unicode characters by calling
157    the write_replacement callback repeatedly.  */
158 typedef void (*iconv_unicode_mb_to_uc_fallback)
159              (const char* inbuf, size_t inbufsize,
160               void (*write_replacement) (const unsigned int *buf, size_t buflen,
161                                          void* callback_arg),
162               void* callback_arg,
163               void* data);
164 /* Fallback function.  Invoked when a Unicode character could not be converted
165    to the target encoding.  This function should process the character and
166    may produce replacement bytes (in the target encoding) by calling the
167    write_replacement callback repeatedly.  */
168 typedef void (*iconv_unicode_uc_to_mb_fallback)
169              (unsigned int code,
170               void (*write_replacement) (const char *buf, size_t buflen,
171                                          void* callback_arg),
172               void* callback_arg,
173               void* data);
174 #if @HAVE_WCHAR_T@
175 /* Fallback function.  Invoked when a number of bytes could not be converted to
176    a wide character.  This function should process all bytes from inbuf and may
177    produce replacement wide characters by calling the write_replacement
178    callback repeatedly.  */
179 typedef void (*iconv_wchar_mb_to_wc_fallback)
180              (const char* inbuf, size_t inbufsize,
181               void (*write_replacement) (const wchar_t *buf, size_t buflen,
182                                          void* callback_arg),
183               void* callback_arg,
184               void* data);
185 /* Fallback function.  Invoked when a wide character could not be converted to
186    the target encoding.  This function should process the character and may
187    produce replacement bytes (in the target encoding) by calling the
188    write_replacement callback repeatedly.  */
189 typedef void (*iconv_wchar_wc_to_mb_fallback)
190              (wchar_t code,
191               void (*write_replacement) (const char *buf, size_t buflen,
192                                          void* callback_arg),
193               void* callback_arg,
194               void* data);
195 #else
196 /* If the wchar_t type does not exist, these two fallback functions are never
197    invoked.  Their argument list therefore does not matter.  */
198 typedef void (*iconv_wchar_mb_to_wc_fallback) ();
199 typedef void (*iconv_wchar_wc_to_mb_fallback) ();
200 #endif
201 /* Set of fallbacks. */
202 struct iconv_fallbacks {
203   iconv_unicode_mb_to_uc_fallback mb_to_uc_fallback;
204   iconv_unicode_uc_to_mb_fallback uc_to_mb_fallback;
205   iconv_wchar_mb_to_wc_fallback mb_to_wc_fallback;
206   iconv_wchar_wc_to_mb_fallback wc_to_mb_fallback;
207   void* data;
208 };
209
210 /* Requests for iconvctl. */
211 #define ICONV_TRIVIALP            0  /* int *argument */
212 #define ICONV_GET_TRANSLITERATE   1  /* int *argument */
213 #define ICONV_SET_TRANSLITERATE   2  /* const int *argument */
214 #define ICONV_GET_DISCARD_ILSEQ   3  /* int *argument */
215 #define ICONV_SET_DISCARD_ILSEQ   4  /* const int *argument */
216 #define ICONV_SET_HOOKS           5  /* const struct iconv_hooks *argument */
217 #define ICONV_SET_FALLBACKS       6  /* const struct iconv_fallbacks *argument */
218
219 /* Listing of locale independent encodings. */
220 #define iconvlist libiconvlist
221 extern LIBICONV_DLL_EXPORTED void iconvlist (int (*do_one) (unsigned int namescount,
222                                       const char * const * names,
223                                       void* data),
224                        void* data);
225
226 /* Canonicalize an encoding name.
227    The result is either a canonical encoding name, or name itself. */
228 extern LIBICONV_DLL_EXPORTED const char * iconv_canonicalize (const char * name);
229
230 /* Support for relocatable packages.  */
231
232 /* Sets the original and the current installation prefix of the package.
233    Relocation simply replaces a pathname starting with the original prefix
234    by the corresponding pathname with the current prefix instead.  Both
235    prefixes should be directory names without trailing slash (i.e. use ""
236    instead of "/").  */
237 extern LIBICONV_DLL_EXPORTED void libiconv_set_relocation_prefix (const char *orig_prefix,
238                                             const char *curr_prefix);
239
240 #ifdef __cplusplus
241 }
242 #endif
243
244 #endif
245
246
247 #endif /* _LIBICONV_H */