1 /* 2 +----------------------------------------------------------------------+ 3 | Copyright (c) The PHP Group | 4 +----------------------------------------------------------------------+ 5 | This source file is subject to version 3.01 of the PHP license, | 6 | that is bundled with this package in the file LICENSE, and is | 7 | available through the world-wide-web at the following url: | 8 | https://www.php.net/license/3_01.txt | 9 | If you did not receive a copy of the PHP license and are unable to | 10 | obtain it through the world-wide-web, please send a note to | 11 | license@php.net so we can mail you a copy immediately. | 12 +----------------------------------------------------------------------+ 13 | Author: Tsukada Takuya <tsukada@fminn.nagano.nagano.jp> | 14 | Hironori Sato <satoh@jpnnet.com> | 15 | Shigeru Kanemoto <sgk@happysize.co.jp> | 16 +----------------------------------------------------------------------+ 17 */ 18 19 #ifndef _MBSTRING_H 20 #define _MBSTRING_H 21 22 #include "php_version.h" 23 #define PHP_MBSTRING_VERSION PHP_VERSION 24 25 #ifdef PHP_WIN32 26 # undef MBSTRING_API 27 # ifdef MBSTRING_EXPORTS 28 # define MBSTRING_API __declspec(dllexport) 29 # elif defined(COMPILE_DL_MBSTRING) 30 # define MBSTRING_API __declspec(dllimport) 31 # else 32 # define MBSTRING_API /* nothing special */ 33 # endif 34 #elif defined(__GNUC__) && __GNUC__ >= 4 35 # undef MBSTRING_API 36 # define MBSTRING_API __attribute__ ((visibility("default"))) 37 #else 38 # undef MBSTRING_API 39 # define MBSTRING_API /* nothing special */ 40 #endif 41 42 #include "libmbfl/mbfl/mbfilter.h" 43 #include "SAPI.h" 44 45 #define PHP_MBSTRING_API 20021024 46 47 extern zend_module_entry mbstring_module_entry; 48 #define phpext_mbstring_ptr &mbstring_module_entry 49 50 PHP_MINIT_FUNCTION(mbstring); 51 PHP_MSHUTDOWN_FUNCTION(mbstring); 52 PHP_RINIT_FUNCTION(mbstring); 53 PHP_RSHUTDOWN_FUNCTION(mbstring); 54 PHP_MINFO_FUNCTION(mbstring); 55 56 MBSTRING_API char *php_mb_safe_strrchr_ex(const char *s, unsigned int c, 57 size_t nbytes, const mbfl_encoding *enc); 58 MBSTRING_API char *php_mb_safe_strrchr(const char *s, unsigned int c, 59 size_t nbytes); 60 61 MBSTRING_API char *php_mb_convert_encoding_ex( 62 const char *input, size_t length, 63 const mbfl_encoding *to_encoding, const mbfl_encoding *from_encoding, size_t *output_len); 64 MBSTRING_API char * php_mb_convert_encoding( 65 const char *input, size_t length, const mbfl_encoding *to_encoding, 66 const mbfl_encoding **from_encodings, size_t num_from_encodings, size_t *output_len); 67 68 MBSTRING_API size_t php_mb_mbchar_bytes_ex(const char *s, const mbfl_encoding *enc); 69 MBSTRING_API size_t php_mb_mbchar_bytes(const char *s); 70 71 MBSTRING_API size_t php_mb_stripos(int mode, const char *old_haystack, size_t old_haystack_len, const char *old_needle, size_t old_needle_len, zend_long offset, const mbfl_encoding *encoding); 72 MBSTRING_API int php_mb_check_encoding(const char *input, size_t length, const mbfl_encoding *encoding); 73 74 ZEND_BEGIN_MODULE_GLOBALS(mbstring) 75 char *internal_encoding_name; 76 const mbfl_encoding *internal_encoding; 77 const mbfl_encoding *current_internal_encoding; 78 const mbfl_encoding *http_output_encoding; 79 const mbfl_encoding *current_http_output_encoding; 80 const mbfl_encoding *http_input_identify; 81 const mbfl_encoding *http_input_identify_get; 82 const mbfl_encoding *http_input_identify_post; 83 const mbfl_encoding *http_input_identify_cookie; 84 const mbfl_encoding *http_input_identify_string; 85 const mbfl_encoding **http_input_list; 86 size_t http_input_list_size; 87 const mbfl_encoding **detect_order_list; 88 size_t detect_order_list_size; 89 const mbfl_encoding **current_detect_order_list; 90 size_t current_detect_order_list_size; 91 enum mbfl_no_encoding *default_detect_order_list; 92 size_t default_detect_order_list_size; 93 int filter_illegal_mode; 94 int filter_illegal_substchar; 95 int current_filter_illegal_mode; 96 int current_filter_illegal_substchar; 97 enum mbfl_no_language language; 98 bool encoding_translation; 99 bool strict_detection; 100 size_t illegalchars; 101 mbfl_buffer_converter *outconv; 102 void *http_output_conv_mimetypes; 103 #ifdef HAVE_MBREGEX 104 struct _zend_mb_regex_globals *mb_regex_globals; 105 zend_long regex_stack_limit; 106 #endif 107 zend_string *last_used_encoding_name; 108 const mbfl_encoding *last_used_encoding; 109 /* Whether an explicit internal_encoding / http_output / http_input encoding was set. */ 110 bool internal_encoding_set; 111 bool http_output_set; 112 bool http_input_set; 113 #ifdef HAVE_MBREGEX 114 zend_long regex_retry_limit; 115 #endif 116 ZEND_END_MODULE_GLOBALS(mbstring) 117 118 #define MBSTRG(v) ZEND_MODULE_GLOBALS_ACCESSOR(mbstring, v) 119 120 #if defined(ZTS) && defined(COMPILE_DL_MBSTRING) 121 ZEND_TSRMLS_CACHE_EXTERN() 122 #endif 123 124 #endif /* _MBSTRING_H */ 125