iconv.h

00001 /* Copyright (C) 1999-2003 Free Software Foundation, Inc.
00002    This file is part of the GNU LIBICONV Library.
00003 
00004    The GNU LIBICONV Library is free software; you can redistribute it
00005    and/or modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either version 2
00007    of the License, or (at your option) any later version.
00008 
00009    The GNU LIBICONV Library is distributed in the hope that it will be
00010    useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public
00015    License along with the GNU LIBICONV Library; see the file COPYING.LIB.
00016    If not, write to the Free Software Foundation, Inc., 59 Temple Place -
00017    Suite 330, Boston, MA 02111-1307, USA.  */
00018 
00019 /* When installed, this file is called "iconv.h". */
00020 
00021 #ifndef _LIBICONV_H
00022 #define _LIBICONV_H
00023 
00024 #define _LIBICONV_VERSION 0x0109    /* version number: (major<<8) + minor */
00025 extern int _libiconv_version;       /* Likewise */
00026 
00027 /* We would like to #include any system header file which could define
00028    iconv_t, 1. in order to eliminate the risk that the user gets compilation
00029    errors because some other system header file includes /usr/include/iconv.h
00030    which defines iconv_t or declares iconv after this file, 2. when compiling
00031    for LIBICONV_PLUG, we need the proper iconv_t type in order to produce
00032    binary compatible code.
00033    But gcc's #include_next is not portable. Thus, once libiconv's iconv.h
00034    has been installed in /usr/local/include, there is no way any more to
00035    include the original /usr/include/iconv.h. We simply have to get away
00036    without it.
00037    Ad 1. The risk that a system header file does
00038    #include "iconv.h"  or  #include_next "iconv.h"
00039    is small. They all do #include <iconv.h>.
00040    Ad 2. The iconv_t type is a pointer type in all cases I have seen. (It
00041    has to be a scalar type because (iconv_t)(-1) is a possible return value
00042    from iconv_open().) */
00043 
00044 /* Define iconv_t ourselves. */
00045 #undef iconv_t
00046 #define iconv_t libiconv_t
00047 typedef void* iconv_t;
00048 
00049 /* Get size_t declaration. */
00050 #include <stddef.h>
00051 
00052 /* Get errno declaration and values. */
00053 #include <errno.h>
00054 /* Some systems, like SunOS 4, don't have EILSEQ. Some systems, like BSD/OS,
00055    have EILSEQ in a different header.  On these systems, define EILSEQ
00056    ourselves. */
00057 #ifndef EILSEQ
00058 #define EILSEQ @EILSEQ@
00059 #endif
00060 
00061 
00062 #ifdef __cplusplus
00063 extern "C" {
00064 #endif
00065 
00066 
00067 /* Allocates descriptor for code conversion from encoding `fromcode' to
00068    encoding `tocode'. */
00069 #ifndef LIBICONV_PLUG
00070 #define iconv_open libiconv_open
00071 #endif
00072 extern iconv_t iconv_open (const char* tocode, const char* fromcode);
00073 
00074 /* Converts, using conversion descriptor `cd', at most `*inbytesleft' bytes
00075    starting at `*inbuf', writing at most `*outbytesleft' bytes starting at
00076    `*outbuf'.
00077    Decrements `*inbytesleft' and increments `*inbuf' by the same amount.
00078    Decrements `*outbytesleft' and increments `*outbuf' by the same amount. */
00079 #ifndef LIBICONV_PLUG
00080 #define iconv libiconv
00081 #endif
00082 extern size_t iconv (iconv_t cd, const char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);
00083 
00084 /* Frees resources allocated for conversion descriptor `cd'. */
00085 #ifndef LIBICONV_PLUG
00086 #define iconv_close libiconv_close
00087 #endif
00088 extern int iconv_close (iconv_t cd);
00089 
00090 
00091 #ifndef LIBICONV_PLUG
00092 
00093 /* Nonstandard extensions. */
00094 
00095 /* Control of attributes. */
00096 #define iconvctl libiconvctl
00097 extern int iconvctl (iconv_t cd, int request, void* argument);
00098 
00099 /* Requests for iconvctl. */
00100 #define ICONV_TRIVIALP            0  /* int *argument */
00101 #define ICONV_GET_TRANSLITERATE   1  /* int *argument */
00102 #define ICONV_SET_TRANSLITERATE   2  /* const int *argument */
00103 #define ICONV_GET_DISCARD_ILSEQ   3  /* int *argument */
00104 #define ICONV_SET_DISCARD_ILSEQ   4  /* const int *argument */
00105 
00106 /* Listing of locale independent encodings. */
00107 #define iconvlist libiconvlist
00108 extern void iconvlist (int (*do_one) (unsigned int namescount,
00109                                       const char * const * names,
00110                                       void* data),
00111                        void* data);
00112 
00113 /* Support for relocatable packages.  */
00114 
00115 /* Sets the original and the current installation prefix of the package.
00116    Relocation simply replaces a pathname starting with the original prefix
00117    by the corresponding pathname with the current prefix instead.  Both
00118    prefixes should be directory names without trailing slash (i.e. use ""
00119    instead of "/").  */
00120 extern void libiconv_set_relocation_prefix (const char *orig_prefix,
00121                                             const char *curr_prefix);
00122 
00123 #endif
00124 
00125 
00126 #ifdef __cplusplus
00127 }
00128 #endif
00129 
00130 
00131 #endif /* _LIBICONV_H */
00132 

Generated on Wed Jul 26 13:30:46 2006 for XSB by  doxygen 1.4.5