1 /* 2 +----------------------------------------------------------------------+ 3 | PHP Version 5 | 4 +----------------------------------------------------------------------+ 5 | Copyright (c) 1997-2016 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 /* $Id: 3c53602d908d11ea0b36a3a4204d287944102ee8 $ */ 21 22 #ifndef PHP_ICONV_H 23 #define PHP_ICONV_H 24 25 #ifdef PHP_WIN32 26 # ifdef PHP_ICONV_EXPORTS 27 # define PHP_ICONV_API __declspec(dllexport) 28 # else 29 # define PHP_ICONV_API __declspec(dllimport) 30 # endif 31 #elif defined(__GNUC__) && __GNUC__ >= 4 32 # define PHP_ICONV_API __attribute__ ((visibility("default"))) 33 #else 34 # define PHP_ICONV_API 35 #endif 36 37 #ifdef PHP_ATOM_INC 38 #include "ext/iconv/php_have_iconv.h" 39 #include "ext/iconv/php_have_libiconv.h" 40 #include "ext/iconv/php_iconv_aliased_libiconv.h" 41 #include "ext/iconv/php_have_glibc_iconv.h" 42 #include "ext/iconv/php_have_bsd_iconv.h" 43 #include "ext/iconv/php_have_ibm_iconv.h" 44 #include "ext/iconv/php_iconv_supports_errno.h" 45 #include "ext/iconv/php_php_iconv_impl.h" 46 #include "ext/iconv/php_php_iconv_h_path.h" 47 #endif 48 49 #ifdef HAVE_ICONV 50 extern zend_module_entry iconv_module_entry; 51 #define iconv_module_ptr &iconv_module_entry 52 53 PHP_MINIT_FUNCTION(miconv); 54 PHP_MSHUTDOWN_FUNCTION(miconv); 55 PHP_MINFO_FUNCTION(miconv); 56 57 PHP_NAMED_FUNCTION(php_if_iconv); 58 PHP_FUNCTION(ob_iconv_handler); 59 PHP_FUNCTION(iconv_get_encoding); 60 PHP_FUNCTION(iconv_set_encoding); 61 PHP_FUNCTION(iconv_strlen); 62 PHP_FUNCTION(iconv_substr); 63 PHP_FUNCTION(iconv_strpos); 64 PHP_FUNCTION(iconv_strrpos); 65 PHP_FUNCTION(iconv_mime_encode); 66 PHP_FUNCTION(iconv_mime_decode); 67 PHP_FUNCTION(iconv_mime_decode_headers); 68 69 ZEND_BEGIN_MODULE_GLOBALS(iconv) 70 char *input_encoding; 71 char *internal_encoding; 72 char *output_encoding; 73 ZEND_END_MODULE_GLOBALS(iconv) 74 75 #ifdef ZTS 76 # define ICONVG(v) TSRMG(iconv_globals_id, zend_iconv_globals *, v) 77 #else 78 # define ICONVG(v) (iconv_globals.v) 79 #endif 80 81 #ifdef HAVE_IBM_ICONV 82 # define ICONV_ASCII_ENCODING "IBM-850" 83 # define ICONV_UCS4_ENCODING "UCS-4" 84 #else 85 # define ICONV_ASCII_ENCODING "ASCII" 86 # define ICONV_UCS4_ENCODING "UCS-4LE" 87 #endif 88 89 #ifndef ICONV_CSNMAXLEN 90 #define ICONV_CSNMAXLEN 64 91 #endif 92 93 /* {{{ typedef enum php_iconv_err_t */ 94 typedef enum _php_iconv_err_t { 95 PHP_ICONV_ERR_SUCCESS = SUCCESS, 96 PHP_ICONV_ERR_CONVERTER = 1, 97 PHP_ICONV_ERR_WRONG_CHARSET = 2, 98 PHP_ICONV_ERR_TOO_BIG = 3, 99 PHP_ICONV_ERR_ILLEGAL_SEQ = 4, 100 PHP_ICONV_ERR_ILLEGAL_CHAR = 5, 101 PHP_ICONV_ERR_UNKNOWN = 6, 102 PHP_ICONV_ERR_MALFORMED = 7, 103 PHP_ICONV_ERR_ALLOC = 8 104 } php_iconv_err_t; 105 /* }}} */ 106 107 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); 108 109 #else 110 111 #define iconv_module_ptr NULL 112 113 #endif /* HAVE_ICONV */ 114 115 #define phpext_iconv_ptr iconv_module_ptr 116 117 #endif /* PHP_ICONV_H */ 118 119 /* 120 * Local variables: 121 * tab-width: 4 122 * c-basic-offset: 4 123 * End: 124 */ 125