Max 5 API Reference
00001 /* Copyright (C) 1999-2003, 2005 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., 51 Franklin Street, 00017 Fifth Floor, Boston, MA 02110-1301, USA. */ 00018 00019 00020 /* When installed, this file is called "iconv.h". */ 00021 00022 #ifndef _LIBICONV_H 00023 #define _LIBICONV_H 00024 00025 #define _LIBICONV_VERSION 0x010A /* version number: (major<<8) + minor */ 00026 extern int _libiconv_version; /* Likewise */ 00027 00028 /* We would like to #include any system header file which could define 00029 iconv_t, 1. in order to eliminate the risk that the user gets compilation 00030 errors because some other system header file includes /usr/include/iconv.h 00031 which defines iconv_t or declares iconv after this file, 2. when compiling 00032 for LIBICONV_PLUG, we need the proper iconv_t type in order to produce 00033 binary compatible code. 00034 But gcc's #include_next is not portable. Thus, once libiconv's iconv.h 00035 has been installed in /usr/local/include, there is no way any more to 00036 include the original /usr/include/iconv.h. We simply have to get away 00037 without it. 00038 Ad 1. The risk that a system header file does 00039 #include "iconv.h" or #include_next "iconv.h" 00040 is small. They all do #include <iconv.h>. 00041 Ad 2. The iconv_t type is a pointer type in all cases I have seen. (It 00042 has to be a scalar type because (iconv_t)(-1) is a possible return value 00043 from iconv_open().) */ 00044 00045 /* Define iconv_t ourselves. */ 00046 #undef iconv_t 00047 #define iconv_t libiconv_t 00048 typedef void* iconv_t; 00049 00050 /* Get size_t declaration. */ 00051 #include <stddef.h> 00052 00053 /* Get errno declaration and values. */ 00054 #include <errno.h> 00055 /* Some systems, like SunOS 4, don't have EILSEQ. Some systems, like BSD/OS, 00056 have EILSEQ in a different header. On these systems, define EILSEQ 00057 ourselves. */ 00058 #ifndef EILSEQ 00059 #define EILSEQ 00060 #endif 00061 00062 00063 #ifdef __cplusplus 00064 extern "C" { 00065 #endif 00066 00067 00068 /* Allocates descriptor for code conversion from encoding `fromcode' to 00069 encoding `tocode'. */ 00070 #ifndef LIBICONV_PLUG 00071 #define iconv_open libiconv_open 00072 #endif 00073 extern iconv_t iconv_open (const char* tocode, const char* fromcode); 00074 00075 /* Converts, using conversion descriptor `cd', at most `*inbytesleft' bytes 00076 starting at `*inbuf', writing at most `*outbytesleft' bytes starting at 00077 `*outbuf'. 00078 Decrements `*inbytesleft' and increments `*inbuf' by the same amount. 00079 Decrements `*outbytesleft' and increments `*outbuf' by the same amount. */ 00080 #ifndef LIBICONV_PLUG 00081 #define iconv libiconv 00082 #endif 00083 extern size_t iconv (iconv_t cd, const char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft); 00084 00085 /* Frees resources allocated for conversion descriptor `cd'. */ 00086 #ifndef LIBICONV_PLUG 00087 #define iconv_close libiconv_close 00088 #endif 00089 extern int iconv_close (iconv_t cd); 00090 00091 00092 #ifndef LIBICONV_PLUG 00093 00094 /* Nonstandard extensions. */ 00095 00096 /* Control of attributes. */ 00097 #define iconvctl libiconvctl 00098 extern int iconvctl (iconv_t cd, int request, void* argument); 00099 00100 /* Hook performed after every successful conversion of a Unicode character. */ 00101 typedef void (*iconv_unicode_char_hook) (unsigned int uc, void* data); 00102 /* Hook performed after every successful conversion of a wide character. */ 00103 typedef void (*iconv_wide_char_hook) (wchar_t wc, void* data); 00104 /* Set of hooks. */ 00105 struct iconv_hooks { 00106 iconv_unicode_char_hook uc_hook; 00107 iconv_wide_char_hook wc_hook; 00108 void* data; 00109 }; 00110 00111 /* Requests for iconvctl. */ 00112 #define ICONV_TRIVIALP 0 /* int *argument */ 00113 #define ICONV_GET_TRANSLITERATE 1 /* int *argument */ 00114 #define ICONV_SET_TRANSLITERATE 2 /* const int *argument */ 00115 #define ICONV_GET_DISCARD_ILSEQ 3 /* int *argument */ 00116 #define ICONV_SET_DISCARD_ILSEQ 4 /* const int *argument */ 00117 #define ICONV_SET_HOOKS 5 /* const struct iconv_hooks *argument */ 00118 00119 /* Listing of locale independent encodings. */ 00120 #define iconvlist libiconvlist 00121 extern void iconvlist (int (*do_one) (unsigned int namescount, 00122 const char * const * names, 00123 void* data), 00124 void* data); 00125 00126 /* Canonicalize an encoding name. 00127 The result is either a canonical encoding name, or name itself. */ 00128 extern const char * iconv_canonicalize (const char * name); 00129 00130 /* Support for relocatable packages. */ 00131 00132 /* Sets the original and the current installation prefix of the package. 00133 Relocation simply replaces a pathname starting with the original prefix 00134 by the corresponding pathname with the current prefix instead. Both 00135 prefixes should be directory names without trailing slash (i.e. use "" 00136 instead of "/"). */ 00137 extern void libiconv_set_relocation_prefix (const char *orig_prefix, 00138 const char *curr_prefix); 00139 00140 #endif 00141 00142 00143 #ifdef __cplusplus 00144 } 00145 #endif 00146 00147 00148 #endif /* _LIBICONV_H */
Copyright © 2008, Cycling '74