1 /* 2 +----------------------------------------------------------------------+ 3 | PHP Version 7 | 4 +----------------------------------------------------------------------+ 5 | Copyright (c) The PHP Group | 6 +----------------------------------------------------------------------+ 7 | This source file is subject to version 3.01 of the PHP license, | 8 | that is bundled with this package in the file LICENSE, and is | 9 | available through the world-wide-web at the following url: | 10 | http://www.php.net/license/3_01.txt | 11 | If you did not receive a copy of the PHP license and are unable to | 12 | obtain it through the world-wide-web, please send a note to | 13 | license@php.net so we can mail you a copy immediately. | 14 +----------------------------------------------------------------------+ 15 | Authors: Rui Hirokawa <rui_hirokawa@ybb.ne.jp> | 16 | Stig Bakken <ssb@php.net> | 17 +----------------------------------------------------------------------+ 18 */ 19 20 #ifndef PHP_ICONV_H 21 #define PHP_ICONV_H 22 23 #ifdef PHP_WIN32 24 # ifdef PHP_ICONV_EXPORTS 25 # define PHP_ICONV_API __declspec(dllexport) 26 # else 27 # define PHP_ICONV_API __declspec(dllimport) 28 # endif 29 #elif defined(__GNUC__) && __GNUC__ >= 4 30 # define PHP_ICONV_API __attribute__ ((visibility("default"))) 31 #else 32 # define PHP_ICONV_API 33 #endif 34 35 #include "php_version.h" 36 #define PHP_ICONV_VERSION PHP_VERSION 37 38 #ifdef PHP_ATOM_INC 39 #include "ext/iconv/php_have_iconv.h" 40 #include "ext/iconv/php_have_libiconv.h" 41 #include "ext/iconv/php_iconv_aliased_libiconv.h" 42 #include "ext/iconv/php_have_glibc_iconv.h" 43 #include "ext/iconv/php_have_bsd_iconv.h" 44 #include "ext/iconv/php_have_ibm_iconv.h" 45 #include "ext/iconv/php_iconv_supports_errno.h" 46 #include "ext/iconv/php_php_iconv_impl.h" 47 #include "ext/iconv/php_php_iconv_h_path.h" 48 #endif 49 50 #ifdef HAVE_ICONV 51 extern zend_module_entry iconv_module_entry; 52 #define iconv_module_ptr &iconv_module_entry 53 54 PHP_MINIT_FUNCTION(miconv); 55 PHP_MSHUTDOWN_FUNCTION(miconv); 56 PHP_MINFO_FUNCTION(miconv); 57 58 PHP_NAMED_FUNCTION(php_if_iconv); 59 PHP_FUNCTION(ob_iconv_handler); 60 PHP_FUNCTION(iconv_get_encoding); 61 PHP_FUNCTION(iconv_set_encoding); 62 PHP_FUNCTION(iconv_strlen); 63 PHP_FUNCTION(iconv_substr); 64 PHP_FUNCTION(iconv_strpos); 65 PHP_FUNCTION(iconv_strrpos); 66 PHP_FUNCTION(iconv_mime_encode); 67 PHP_FUNCTION(iconv_mime_decode); 68 PHP_FUNCTION(iconv_mime_decode_headers); 69 70 ZEND_BEGIN_MODULE_GLOBALS(iconv) 71 char *input_encoding; 72 char *internal_encoding; 73 char *output_encoding; 74 ZEND_END_MODULE_GLOBALS(iconv) 75 76 #define ICONVG(v) ZEND_MODULE_GLOBALS_ACCESSOR(iconv, v) 77 78 #if defined(ZTS) && defined(COMPILE_DL_ICONV) 79 ZEND_TSRMLS_CACHE_EXTERN() 80 #endif 81 82 #ifdef HAVE_IBM_ICONV 83 # define ICONV_ASCII_ENCODING "IBM-850" 84 # define ICONV_UCS4_ENCODING "UCS-4" 85 #else 86 # define ICONV_ASCII_ENCODING "ASCII" 87 # define ICONV_UCS4_ENCODING "UCS-4LE" 88 #endif 89 90 #ifndef ICONV_CSNMAXLEN 91 #define ICONV_CSNMAXLEN 64 92 #endif 93 94 /* {{{ typedef enum php_iconv_err_t */ 95 typedef enum _php_iconv_err_t { 96 PHP_ICONV_ERR_SUCCESS = SUCCESS, 97 PHP_ICONV_ERR_CONVERTER = 1, 98 PHP_ICONV_ERR_WRONG_CHARSET = 2, 99 PHP_ICONV_ERR_TOO_BIG = 3, 100 PHP_ICONV_ERR_ILLEGAL_SEQ = 4, 101 PHP_ICONV_ERR_ILLEGAL_CHAR = 5, 102 PHP_ICONV_ERR_UNKNOWN = 6, 103 PHP_ICONV_ERR_MALFORMED = 7, 104 PHP_ICONV_ERR_ALLOC = 8 105 } php_iconv_err_t; 106 /* }}} */ 107 108 PHP_ICONV_API php_iconv_err_t php_iconv_string(const char * in_p, size_t in_len, zend_string **out, const char *out_charset, const char *in_charset); 109 110 #else 111 112 #define iconv_module_ptr NULL 113 114 #endif /* HAVE_ICONV */ 115 116 #define phpext_iconv_ptr iconv_module_ptr 117 118 #endif /* PHP_ICONV_H */ 119