Back to index

php5  5.3.10
php_iconv.h
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | PHP Version 5                                                        |
00004    +----------------------------------------------------------------------+
00005    | Copyright (c) 1997-2012 The PHP Group                                |
00006    +----------------------------------------------------------------------+
00007    | This source file is subject to version 3.01 of the PHP license,      |
00008    | that is bundled with this package in the file LICENSE, and is        |
00009    | available through the world-wide-web at the following url:           |
00010    | http://www.php.net/license/3_01.txt                                  |
00011    | If you did not receive a copy of the PHP license and are unable to   |
00012    | obtain it through the world-wide-web, please send a note to          |
00013    | license@php.net so we can mail you a copy immediately.               |
00014    +----------------------------------------------------------------------+
00015    | Authors: Rui Hirokawa <rui_hirokawa@ybb.ne.jp>                       |
00016    |          Stig Bakken <ssb@php.net>                                   |
00017    +----------------------------------------------------------------------+
00018  */
00019 
00020 /* $Revision: 321634 $ */
00021 
00022 #ifndef PHP_ICONV_H
00023 #define PHP_ICONV_H
00024 
00025 #ifdef PHP_WIN32
00026 # ifdef PHP_ICONV_EXPORTS
00027 #  define PHP_ICONV_API __declspec(dllexport)
00028 # else
00029 #  define PHP_ICONV_API __declspec(dllimport)
00030 # endif 
00031 #elif defined(__GNUC__) && __GNUC__ >= 4
00032 # define PHP_ICONV_API __attribute__ ((visibility("default")))
00033 #else
00034 # define PHP_ICONV_API
00035 #endif
00036 
00037 #ifdef PHP_ATOM_INC
00038 #include "ext/iconv/php_have_iconv.h"
00039 #include "ext/iconv/php_have_libiconv.h"
00040 #include "ext/iconv/php_iconv_aliased_libiconv.h"
00041 #include "ext/iconv/php_have_glibc_iconv.h"
00042 #include "ext/iconv/php_have_bsd_iconv.h"
00043 #include "ext/iconv/php_have_ibm_iconv.h"
00044 #include "ext/iconv/php_iconv_supports_errno.h"
00045 #include "ext/iconv/php_php_iconv_impl.h"
00046 #include "ext/iconv/php_php_iconv_h_path.h"
00047 #endif
00048 
00049 #ifdef HAVE_ICONV
00050 extern zend_module_entry iconv_module_entry;
00051 #define iconv_module_ptr &iconv_module_entry
00052 
00053 PHP_MINIT_FUNCTION(miconv);
00054 PHP_MSHUTDOWN_FUNCTION(miconv);
00055 PHP_MINFO_FUNCTION(miconv);
00056 
00057 PHP_NAMED_FUNCTION(php_if_iconv);
00058 PHP_FUNCTION(ob_iconv_handler);
00059 PHP_FUNCTION(iconv_get_encoding);
00060 PHP_FUNCTION(iconv_set_encoding);
00061 PHP_FUNCTION(iconv_strlen);
00062 PHP_FUNCTION(iconv_substr);
00063 PHP_FUNCTION(iconv_strpos);
00064 PHP_FUNCTION(iconv_strrpos);
00065 PHP_FUNCTION(iconv_mime_encode);
00066 PHP_FUNCTION(iconv_mime_decode);
00067 PHP_FUNCTION(iconv_mime_decode_headers);
00068 
00069 ZEND_BEGIN_MODULE_GLOBALS(iconv)
00070        char *input_encoding;
00071        char *internal_encoding;
00072        char *output_encoding;
00073 ZEND_END_MODULE_GLOBALS(iconv)
00074 
00075 #ifdef ZTS
00076 # define ICONVG(v) TSRMG(iconv_globals_id, zend_iconv_globals *, v)
00077 #else
00078 # define ICONVG(v) (iconv_globals.v)
00079 #endif
00080 
00081 #ifdef HAVE_IBM_ICONV
00082 # define ICONV_INPUT_ENCODING "ISO8859-1"
00083 # define ICONV_OUTPUT_ENCODING "ISO8859-1"
00084 # define ICONV_INTERNAL_ENCODING "ISO8859-1"
00085 # define ICONV_ASCII_ENCODING "IBM-850"
00086 # define ICONV_UCS4_ENCODING "UCS-4"
00087 #else
00088 # define ICONV_INPUT_ENCODING "ISO-8859-1"
00089 # define ICONV_OUTPUT_ENCODING "ISO-8859-1"
00090 # define ICONV_INTERNAL_ENCODING "ISO-8859-1"
00091 # define ICONV_ASCII_ENCODING "ASCII"
00092 # define ICONV_UCS4_ENCODING "UCS-4LE"
00093 #endif
00094 
00095 #ifndef ICONV_CSNMAXLEN
00096 #define ICONV_CSNMAXLEN 64
00097 #endif
00098 
00099 /* {{{ typedef enum php_iconv_err_t */
00100 typedef enum _php_iconv_err_t {
00101        PHP_ICONV_ERR_SUCCESS           = SUCCESS,
00102        PHP_ICONV_ERR_CONVERTER         = 1,
00103        PHP_ICONV_ERR_WRONG_CHARSET     = 2,
00104        PHP_ICONV_ERR_TOO_BIG           = 3,
00105        PHP_ICONV_ERR_ILLEGAL_SEQ       = 4,
00106        PHP_ICONV_ERR_ILLEGAL_CHAR      = 5,
00107        PHP_ICONV_ERR_UNKNOWN           = 6,
00108        PHP_ICONV_ERR_MALFORMED         = 7,
00109        PHP_ICONV_ERR_ALLOC             = 8
00110 } php_iconv_err_t;
00111 /* }}} */
00112 
00113 PHP_ICONV_API php_iconv_err_t php_iconv_string(const char * in_p, size_t in_len, char **out, size_t *out_len, const char *out_charset, const char *in_charset);
00114 
00115 #else
00116 
00117 #define iconv_module_ptr NULL
00118 
00119 #endif /* HAVE_ICONV */
00120 
00121 #define phpext_iconv_ptr iconv_module_ptr
00122 
00123 #endif /* PHP_ICONV_H */
00124 
00125 /*
00126  * Local variables:
00127  * tab-width: 4
00128  * c-basic-offset: 4
00129  * End:
00130  */