mbstring.h 7.1 KB

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