1 /* Copyright (C) 1999-2001 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 0x0107 /* version number: (major<<8) + minor */ 25 26 #ifdef BUILDING_LIBICONV 27 #define LIBICONV_DLL_EXPORTED __declspec(dllexport) 28 #else 29 /* #define LIBICONV_DLL_EXPORTED __declspec(dllimport) */ 30 #define LIBICONV_DLL_EXPORTED 31 #endif 32 extern LIBICONV_DLL_EXPORTED int _libiconv_version; /* Likewise */ 33 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 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. 40 But gcc's #include_next is not portable. Thus, once libiconv's iconv.h 41 has been installed in /usr/local/include, there is no way any more to 42 include the original /usr/include/iconv.h. We simply have to get away 43 without it. 44 Ad 1. The risk that a system header file does 45 #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().) */ 50 51 /* Define iconv_t ourselves. */ 52 #undef iconv_t 53 #define iconv_t libiconv_t 54 typedef void* iconv_t; 55 56 /* Get size_t declaration. */ 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. On these systems, define 62 EILSEQ ourselves, but don't define it as EINVAL, because iconv() callers 63 want to distinguish EINVAL and EILSEQ. */ 64 #ifndef EILSEQ 65 #define EILSEQ ENOENT 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, 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 98 #ifndef LIBICONV_PLUG 99 100 /* Nonstandard extensions. */ 101 102 /* Control of attributes. */ 103 #define iconvctl libiconvctl 104 extern LIBICONV_DLL_EXPORTED int iconvctl (iconv_t cd, int request, void* argument); 105 106 /* Requests for iconvctl. */ 107 #define ICONV_TRIVIALP 0 /* int *argument */ 108 #define ICONV_GET_TRANSLITERATE 1 /* int *argument */ 109 #define ICONV_SET_TRANSLITERATE 2 /* const int *argument */ 110 111 #endif 112 113 114 #ifdef __cplusplus 115 } 116 #endif 117 118 119 #endif /* _LIBICONV_H */ 120