1 /* 2 +----------------------------------------------------------------------+ 3 | PHP Version 7 | 4 +----------------------------------------------------------------------+ 5 | Copyright (c) 1997-2018 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 | Author: Tsukada Takuya <tsukada@fminn.nagano.nagano.jp> | 16 +----------------------------------------------------------------------+ 17 */ 18 19 /* $Id$ */ 20 21 /* 22 * PHP 4 Multibyte String module "mbstring" (currently only for Japanese) 23 * 24 * History: 25 * 2000.5.19 Release php-4.0RC2_jstring-1.0 26 * 2001.4.1 Release php4_jstring-1.0.91 27 * 2001.4.30 Release php4-jstring-1.1 (contribute to The PHP Group) 28 * 2001.5.1 Renamed from jstring to mbstring (hirokawa@php.net) 29 */ 30 31 /* 32 * PHP3 Internationalization support program. 33 * 34 * Copyright (c) 1999,2000 by the PHP3 internationalization team. 35 * All rights reserved. 36 * 37 * See README_PHP3-i18n-ja for more detail. 38 * 39 * Authors: 40 * Hironori Sato <satoh@jpnnet.com> 41 * Shigeru Kanemoto <sgk@happysize.co.jp> 42 * Tsukada Takuya <tsukada@fminn.nagano.nagano.jp> 43 */ 44 45 46 #ifndef _MBSTRING_H 47 #define _MBSTRING_H 48 49 #ifdef COMPILE_DL_MBSTRING 50 #undef HAVE_MBSTRING 51 #define HAVE_MBSTRING 1 52 #endif 53 54 #include "php_version.h" 55 #define PHP_MBSTRING_VERSION PHP_VERSION 56 57 #ifdef PHP_WIN32 58 # undef MBSTRING_API 59 # ifdef MBSTRING_EXPORTS 60 # define MBSTRING_API __declspec(dllexport) 61 # elif defined(COMPILE_DL_MBSTRING) 62 # define MBSTRING_API __declspec(dllimport) 63 # else 64 # define MBSTRING_API /* nothing special */ 65 # endif 66 #elif defined(__GNUC__) && __GNUC__ >= 4 67 # undef MBSTRING_API 68 # define MBSTRING_API __attribute__ ((visibility("default"))) 69 #else 70 # undef MBSTRING_API 71 # define MBSTRING_API /* nothing special */ 72 #endif 73 74 75 #if HAVE_MBSTRING 76 77 #include "libmbfl/mbfl/mbfilter.h" 78 #include "SAPI.h" 79 80 #define PHP_MBSTRING_API 20021024 81 82 extern zend_module_entry mbstring_module_entry; 83 #define mbstring_module_ptr &mbstring_module_entry 84 85 PHP_MINIT_FUNCTION(mbstring); 86 PHP_MSHUTDOWN_FUNCTION(mbstring); 87 PHP_RINIT_FUNCTION(mbstring); 88 PHP_RSHUTDOWN_FUNCTION(mbstring); 89 PHP_MINFO_FUNCTION(mbstring); 90 91 /* functions in php_unicode.c */ 92 PHP_FUNCTION(mb_convert_case); 93 PHP_FUNCTION(mb_strtoupper); 94 PHP_FUNCTION(mb_strtolower); 95 96 /* php function registration */ 97 PHP_FUNCTION(mb_language); 98 PHP_FUNCTION(mb_internal_encoding); 99 PHP_FUNCTION(mb_http_input); 100 PHP_FUNCTION(mb_http_output); 101 PHP_FUNCTION(mb_detect_order); 102 PHP_FUNCTION(mb_substitute_character); 103 PHP_FUNCTION(mb_preferred_mime_name); 104 PHP_FUNCTION(mb_parse_str); 105 PHP_FUNCTION(mb_output_handler); 106 PHP_FUNCTION(mb_strlen); 107 PHP_FUNCTION(mb_strpos); 108 PHP_FUNCTION(mb_strrpos); 109 PHP_FUNCTION(mb_stripos); 110 PHP_FUNCTION(mb_strripos); 111 PHP_FUNCTION(mb_strstr); 112 PHP_FUNCTION(mb_strrchr); 113 PHP_FUNCTION(mb_stristr); 114 PHP_FUNCTION(mb_strrichr); 115 PHP_FUNCTION(mb_substr_count); 116 PHP_FUNCTION(mb_substr); 117 PHP_FUNCTION(mb_strcut); 118 PHP_FUNCTION(mb_strwidth); 119 PHP_FUNCTION(mb_strimwidth); 120 PHP_FUNCTION(mb_convert_encoding); 121 PHP_FUNCTION(mb_detect_encoding); 122 PHP_FUNCTION(mb_list_encodings); 123 PHP_FUNCTION(mb_encoding_aliases); 124 PHP_FUNCTION(mb_convert_kana); 125 PHP_FUNCTION(mb_encode_mimeheader); 126 PHP_FUNCTION(mb_decode_mimeheader); 127 PHP_FUNCTION(mb_convert_variables); 128 PHP_FUNCTION(mb_encode_numericentity); 129 PHP_FUNCTION(mb_decode_numericentity); 130 PHP_FUNCTION(mb_send_mail); 131 PHP_FUNCTION(mb_get_info); 132 PHP_FUNCTION(mb_check_encoding); 133 PHP_FUNCTION(mb_ord); 134 PHP_FUNCTION(mb_chr); 135 PHP_FUNCTION(mb_scrub); 136 137 138 MBSTRING_API char *php_mb_safe_strrchr_ex(const char *s, unsigned int c, 139 size_t nbytes, const mbfl_encoding *enc); 140 MBSTRING_API char *php_mb_safe_strrchr(const char *s, unsigned int c, 141 size_t nbytes); 142 143 MBSTRING_API char * php_mb_convert_encoding(const char *input, size_t length, 144 const char *_to_encoding, 145 const char *_from_encodings, 146 size_t *output_len); 147 148 MBSTRING_API int php_mb_check_encoding_list(const char *encoding_list); 149 150 MBSTRING_API size_t php_mb_mbchar_bytes_ex(const char *s, const mbfl_encoding *enc); 151 MBSTRING_API size_t php_mb_mbchar_bytes(const char *s); 152 153 MBSTRING_API int php_mb_encoding_detector_ex(const char *arg_string, int arg_length, 154 char *arg_list); 155 156 MBSTRING_API int php_mb_encoding_converter_ex(char **str, int *len, const char *encoding_to, 157 const char *encoding_from); 158 MBSTRING_API int php_mb_stripos(int mode, const char *old_haystack, unsigned int old_haystack_len, const char *old_needle, unsigned int old_needle_len, long offset, const char *from_encoding); 159 MBSTRING_API int php_mb_check_encoding(const char *input, size_t length, const char *enc); 160 161 /* internal use only */ 162 int _php_mb_ini_mbstring_internal_encoding_set(const char *new_value, uint32_t new_value_length); 163 164 ZEND_BEGIN_MODULE_GLOBALS(mbstring) 165 char *internal_encoding_name; 166 enum mbfl_no_language language; 167 const mbfl_encoding *internal_encoding; 168 const mbfl_encoding *current_internal_encoding; 169 const mbfl_encoding *http_output_encoding; 170 const mbfl_encoding *current_http_output_encoding; 171 const mbfl_encoding *http_input_identify; 172 const mbfl_encoding *http_input_identify_get; 173 const mbfl_encoding *http_input_identify_post; 174 const mbfl_encoding *http_input_identify_cookie; 175 const mbfl_encoding *http_input_identify_string; 176 const mbfl_encoding **http_input_list; 177 size_t http_input_list_size; 178 const mbfl_encoding **detect_order_list; 179 size_t detect_order_list_size; 180 const mbfl_encoding **current_detect_order_list; 181 size_t current_detect_order_list_size; 182 enum mbfl_no_encoding *default_detect_order_list; 183 size_t default_detect_order_list_size; 184 int filter_illegal_mode; 185 int filter_illegal_substchar; 186 int current_filter_illegal_mode; 187 int current_filter_illegal_substchar; 188 long func_overload; 189 zend_bool encoding_translation; 190 long strict_detection; 191 long illegalchars; 192 mbfl_buffer_converter *outconv; 193 void *http_output_conv_mimetypes; 194 #if HAVE_MBREGEX 195 struct _zend_mb_regex_globals *mb_regex_globals; 196 #endif 197 ZEND_END_MODULE_GLOBALS(mbstring) 198 199 #define MB_OVERLOAD_MAIL 1 200 #define MB_OVERLOAD_STRING 2 201 #define MB_OVERLOAD_REGEX 4 202 203 struct mb_overload_def { 204 int type; 205 char *orig_func; 206 char *ovld_func; 207 char *save_func; 208 }; 209 210 #define MBSTRG(v) ZEND_MODULE_GLOBALS_ACCESSOR(mbstring, v) 211 212 #if defined(ZTS) && defined(COMPILE_DL_MBSTRING) 213 ZEND_TSRMLS_CACHE_EXTERN() 214 #endif 215 216 #else /* HAVE_MBSTRING */ 217 218 #define mbstring_module_ptr NULL 219 220 #endif /* HAVE_MBSTRING */ 221 222 #define phpext_mbstring_ptr mbstring_module_ptr 223 224 #endif /* _MBSTRING_H */ 225 226 /* 227 * Local variables: 228 * tab-width: 4 229 * c-basic-offset: 4 230 * End: 231 */ 232