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