|
1 /* Copyright (C) 1999-2003 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, write to the Free Software Foundation, Inc., 59 Temple Place - |
|
17 Suite 330, Boston, MA 02111-1307, USA. */ |
|
18 |
|
19 /* When installed, this file is called "iconv.h". */ |
|
20 |
|
21 #ifndef _LIBICONV_H |
|
22 #define _LIBICONV_H |
|
23 |
|
24 #define _LIBICONV_VERSION 0x0109 /* version number: (major<<8) + minor */ |
|
25 |
|
26 #ifdef LIBICONV_STATIC |
|
27 #define LIBICONV_DLL_EXPORTED |
|
28 #else /* LIBICONV_STATIC */ |
|
29 #ifdef BUILDING_LIBICONV |
|
30 #define LIBICONV_DLL_EXPORTED __declspec(dllexport) |
|
31 #else |
|
32 #define LIBICONV_DLL_EXPORTED __declspec(dllimport) |
|
33 #endif |
|
34 #endif /* LIBICONV_STATIC */ |
|
35 extern LIBICONV_DLL_EXPORTED int _libiconv_version; /* Likewise */ |
|
36 |
|
37 /* We would like to #include any system header file which could define |
|
38 iconv_t, 1. in order to eliminate the risk that the user gets compilation |
|
39 errors because some other system header file includes /usr/include/iconv.h |
|
40 which defines iconv_t or declares iconv after this file, 2. when compiling |
|
41 for LIBICONV_PLUG, we need the proper iconv_t type in order to produce |
|
42 binary compatible code. |
|
43 But gcc's #include_next is not portable. Thus, once libiconv's iconv.h |
|
44 has been installed in /usr/local/include, there is no way any more to |
|
45 include the original /usr/include/iconv.h. We simply have to get away |
|
46 without it. |
|
47 Ad 1. The risk that a system header file does |
|
48 #include "iconv.h" or #include_next "iconv.h" |
|
49 is small. They all do #include <iconv.h>. |
|
50 Ad 2. The iconv_t type is a pointer type in all cases I have seen. (It |
|
51 has to be a scalar type because (iconv_t)(-1) is a possible return value |
|
52 from iconv_open().) */ |
|
53 |
|
54 /* Define iconv_t ourselves. */ |
|
55 #undef iconv_t |
|
56 #define iconv_t libiconv_t |
|
57 typedef void* iconv_t; |
|
58 |
|
59 /* Get size_t declaration. */ |
|
60 #include <stddef.h> |
|
61 |
|
62 /* Get errno declaration and values. */ |
|
63 #include <errno.h> |
|
64 /* Some systems, like SunOS 4, don't have EILSEQ. Some systems, like BSD/OS, |
|
65 have EILSEQ in a different header. On these systems, define EILSEQ |
|
66 ourselves. */ |
|
67 #ifndef EILSEQ |
|
68 #define EILSEQ |
|
69 #endif |
|
70 |
|
71 |
|
72 #ifdef __cplusplus |
|
73 extern "C" { |
|
74 #endif |
|
75 |
|
76 |
|
77 /* Allocates descriptor for code conversion from encoding `fromcode' to |
|
78 encoding `tocode'. */ |
|
79 #ifndef LIBICONV_PLUG |
|
80 #define iconv_open libiconv_open |
|
81 #endif |
|
82 extern LIBICONV_DLL_EXPORTED iconv_t iconv_open (const char* tocode, const char* fromcode); |
|
83 |
|
84 /* Converts, using conversion descriptor `cd', at most `*inbytesleft' bytes |
|
85 starting at `*inbuf', writing at most `*outbytesleft' bytes starting at |
|
86 `*outbuf'. |
|
87 Decrements `*inbytesleft' and increments `*inbuf' by the same amount. |
|
88 Decrements `*outbytesleft' and increments `*outbuf' by the same amount. */ |
|
89 #ifndef LIBICONV_PLUG |
|
90 #define iconv libiconv |
|
91 #endif |
|
92 extern LIBICONV_DLL_EXPORTED size_t iconv (iconv_t cd, const char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft); |
|
93 |
|
94 /* Frees resources allocated for conversion descriptor `cd'. */ |
|
95 #ifndef LIBICONV_PLUG |
|
96 #define iconv_close libiconv_close |
|
97 #endif |
|
98 extern LIBICONV_DLL_EXPORTED int iconv_close (iconv_t cd); |
|
99 |
|
100 |
|
101 #ifndef LIBICONV_PLUG |
|
102 |
|
103 /* Nonstandard extensions. */ |
|
104 |
|
105 /* Control of attributes. */ |
|
106 #define iconvctl libiconvctl |
|
107 extern LIBICONV_DLL_EXPORTED int iconvctl (iconv_t cd, int request, void* argument); |
|
108 |
|
109 /* Requests for iconvctl. */ |
|
110 #define ICONV_TRIVIALP 0 /* int *argument */ |
|
111 #define ICONV_GET_TRANSLITERATE 1 /* int *argument */ |
|
112 #define ICONV_SET_TRANSLITERATE 2 /* const int *argument */ |
|
113 #define ICONV_GET_DISCARD_ILSEQ 3 /* int *argument */ |
|
114 #define ICONV_SET_DISCARD_ILSEQ 4 /* const int *argument */ |
|
115 |
|
116 /* Listing of locale independent encodings. */ |
|
117 #define iconvlist libiconvlist |
|
118 extern LIBICONV_DLL_EXPORTED void iconvlist (int (*do_one) (unsigned int namescount, |
|
119 const char * const * names, |
|
120 void* data), |
|
121 void* data); |
|
122 |
|
123 /* Support for relocatable packages. */ |
|
124 |
|
125 /* Sets the original and the current installation prefix of the package. |
|
126 Relocation simply replaces a pathname starting with the original prefix |
|
127 by the corresponding pathname with the current prefix instead. Both |
|
128 prefixes should be directory names without trailing slash (i.e. use "" |
|
129 instead of "/"). */ |
|
130 extern LIBICONV_DLL_EXPORTED void libiconv_set_relocation_prefix (const char *orig_prefix, |
|
131 const char *curr_prefix); |
|
132 |
|
133 #endif |
|
134 |
|
135 |
|
136 #ifdef __cplusplus |
|
137 } |
|
138 #endif |
|
139 |
|
140 |
|
141 #endif /* _LIBICONV_H */ |