mbstring.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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. | Hironori Sato <satoh@jpnnet.com> |
  17. | Shigeru Kanemoto <sgk@happysize.co.jp> |
  18. +----------------------------------------------------------------------+
  19. */
  20. #ifndef _MBSTRING_H
  21. #define _MBSTRING_H
  22. #ifdef COMPILE_DL_MBSTRING
  23. #undef HAVE_MBSTRING
  24. #define HAVE_MBSTRING 1
  25. #endif
  26. #include "php_version.h"
  27. #define PHP_MBSTRING_VERSION PHP_VERSION
  28. #ifdef PHP_WIN32
  29. # undef MBSTRING_API
  30. # ifdef MBSTRING_EXPORTS
  31. # define MBSTRING_API __declspec(dllexport)
  32. # elif defined(COMPILE_DL_MBSTRING)
  33. # define MBSTRING_API __declspec(dllimport)
  34. # else
  35. # define MBSTRING_API /* nothing special */
  36. # endif
  37. #elif defined(__GNUC__) && __GNUC__ >= 4
  38. # undef MBSTRING_API
  39. # define MBSTRING_API __attribute__ ((visibility("default")))
  40. #else
  41. # undef MBSTRING_API
  42. # define MBSTRING_API /* nothing special */
  43. #endif
  44. #if HAVE_MBSTRING
  45. #include "libmbfl/mbfl/mbfilter.h"
  46. #include "SAPI.h"
  47. #define PHP_MBSTRING_API 20021024
  48. extern zend_module_entry mbstring_module_entry;
  49. #define mbstring_module_ptr &mbstring_module_entry
  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. /* functions in php_unicode.c */
  56. PHP_FUNCTION(mb_convert_case);
  57. PHP_FUNCTION(mb_strtoupper);
  58. PHP_FUNCTION(mb_strtolower);
  59. /* php function registration */
  60. PHP_FUNCTION(mb_language);
  61. PHP_FUNCTION(mb_internal_encoding);
  62. PHP_FUNCTION(mb_http_input);
  63. PHP_FUNCTION(mb_http_output);
  64. PHP_FUNCTION(mb_detect_order);
  65. PHP_FUNCTION(mb_substitute_character);
  66. PHP_FUNCTION(mb_preferred_mime_name);
  67. PHP_FUNCTION(mb_parse_str);
  68. PHP_FUNCTION(mb_output_handler);
  69. PHP_FUNCTION(mb_strlen);
  70. PHP_FUNCTION(mb_strpos);
  71. PHP_FUNCTION(mb_strrpos);
  72. PHP_FUNCTION(mb_stripos);
  73. PHP_FUNCTION(mb_strripos);
  74. PHP_FUNCTION(mb_strstr);
  75. PHP_FUNCTION(mb_strrchr);
  76. PHP_FUNCTION(mb_stristr);
  77. PHP_FUNCTION(mb_strrichr);
  78. PHP_FUNCTION(mb_substr_count);
  79. PHP_FUNCTION(mb_substr);
  80. PHP_FUNCTION(mb_strcut);
  81. PHP_FUNCTION(mb_strwidth);
  82. PHP_FUNCTION(mb_strimwidth);
  83. PHP_FUNCTION(mb_convert_encoding);
  84. PHP_FUNCTION(mb_detect_encoding);
  85. PHP_FUNCTION(mb_list_encodings);
  86. PHP_FUNCTION(mb_encoding_aliases);
  87. PHP_FUNCTION(mb_convert_kana);
  88. PHP_FUNCTION(mb_encode_mimeheader);
  89. PHP_FUNCTION(mb_decode_mimeheader);
  90. PHP_FUNCTION(mb_convert_variables);
  91. PHP_FUNCTION(mb_encode_numericentity);
  92. PHP_FUNCTION(mb_decode_numericentity);
  93. PHP_FUNCTION(mb_send_mail);
  94. PHP_FUNCTION(mb_get_info);
  95. PHP_FUNCTION(mb_check_encoding);
  96. PHP_FUNCTION(mb_ord);
  97. PHP_FUNCTION(mb_chr);
  98. PHP_FUNCTION(mb_scrub);
  99. MBSTRING_API char *php_mb_safe_strrchr_ex(const char *s, unsigned int c,
  100. size_t nbytes, const mbfl_encoding *enc);
  101. MBSTRING_API char *php_mb_safe_strrchr(const char *s, unsigned int c,
  102. size_t nbytes);
  103. MBSTRING_API char *php_mb_convert_encoding_ex(
  104. const char *input, size_t length,
  105. const mbfl_encoding *to_encoding, const mbfl_encoding *from_encoding, size_t *output_len);
  106. MBSTRING_API char * php_mb_convert_encoding(const char *input, size_t length,
  107. const char *_to_encoding,
  108. const char *_from_encodings,
  109. size_t *output_len);
  110. MBSTRING_API int php_mb_check_encoding_list(const char *encoding_list);
  111. MBSTRING_API size_t php_mb_mbchar_bytes_ex(const char *s, const mbfl_encoding *enc);
  112. MBSTRING_API size_t php_mb_mbchar_bytes(const char *s);
  113. 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 char *from_encoding);
  114. MBSTRING_API int php_mb_check_encoding(const char *input, size_t length, const char *enc);
  115. /* internal use only */
  116. int _php_mb_ini_mbstring_internal_encoding_set(const char *new_value, size_t new_value_length);
  117. ZEND_BEGIN_MODULE_GLOBALS(mbstring)
  118. char *internal_encoding_name;
  119. const mbfl_encoding *internal_encoding;
  120. const mbfl_encoding *current_internal_encoding;
  121. const mbfl_encoding *http_output_encoding;
  122. const mbfl_encoding *current_http_output_encoding;
  123. const mbfl_encoding *http_input_identify;
  124. const mbfl_encoding *http_input_identify_get;
  125. const mbfl_encoding *http_input_identify_post;
  126. const mbfl_encoding *http_input_identify_cookie;
  127. const mbfl_encoding *http_input_identify_string;
  128. const mbfl_encoding **http_input_list;
  129. size_t http_input_list_size;
  130. const mbfl_encoding **detect_order_list;
  131. size_t detect_order_list_size;
  132. const mbfl_encoding **current_detect_order_list;
  133. size_t current_detect_order_list_size;
  134. enum mbfl_no_encoding *default_detect_order_list;
  135. size_t default_detect_order_list_size;
  136. int filter_illegal_mode;
  137. int filter_illegal_substchar;
  138. int current_filter_illegal_mode;
  139. int current_filter_illegal_substchar;
  140. zend_long func_overload;
  141. enum mbfl_no_language language;
  142. zend_bool encoding_translation;
  143. zend_bool strict_detection;
  144. size_t illegalchars;
  145. mbfl_buffer_converter *outconv;
  146. void *http_output_conv_mimetypes;
  147. #if HAVE_MBREGEX
  148. struct _zend_mb_regex_globals *mb_regex_globals;
  149. zend_long regex_stack_limit;
  150. #endif
  151. char *last_used_encoding_name;
  152. const mbfl_encoding *last_used_encoding;
  153. ZEND_END_MODULE_GLOBALS(mbstring)
  154. #define MB_OVERLOAD_MAIL 1
  155. #define MB_OVERLOAD_STRING 2
  156. #define MB_OVERLOAD_REGEX 4
  157. struct mb_overload_def {
  158. int type;
  159. char *orig_func;
  160. char *ovld_func;
  161. char *save_func;
  162. };
  163. #define MBSTRG(v) ZEND_MODULE_GLOBALS_ACCESSOR(mbstring, v)
  164. #if defined(ZTS) && defined(COMPILE_DL_MBSTRING)
  165. ZEND_TSRMLS_CACHE_EXTERN()
  166. #endif
  167. #else /* HAVE_MBSTRING */
  168. #define mbstring_module_ptr NULL
  169. #endif /* HAVE_MBSTRING */
  170. #define phpext_mbstring_ptr mbstring_module_ptr
  171. #endif /* _MBSTRING_H */
  172. /*
  173. * Local variables:
  174. * tab-width: 4
  175. * c-basic-offset: 4
  176. * End:
  177. */