You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

218 lines
6.2 KiB

25 years ago
25 years ago
24 years ago
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 4 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 2001 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 2.02 of the PHP license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available at through the world-wide-web at |
  10. | http://www.php.net/license/2_02.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. * PHP4 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. #undef PHPAPI
  47. #define PHPAPI
  48. #endif
  49. #if HAVE_MBSTRING
  50. #include "mbfilter.h"
  51. #include "SAPI.h"
  52. #define PHP_MBSTRING_API 20020405
  53. PHPAPI char * php_mb_convert_encoding(char *input, size_t length, char *_to_encoding, char *_from_encodings, size_t *output_len TSRMLS_DC);
  54. PHPAPI int php_mb_check_encoding_list(const char *encoding_list TSRMLS_DC);
  55. #if HAVE_MBREGEX
  56. #include "mbregex.h"
  57. #endif
  58. extern zend_module_entry mbstring_module_entry;
  59. #define mbstring_module_ptr &mbstring_module_entry
  60. PHP_MINIT_FUNCTION(mbstring);
  61. PHP_MSHUTDOWN_FUNCTION(mbstring);
  62. PHP_RINIT_FUNCTION(mbstring);
  63. PHP_RSHUTDOWN_FUNCTION(mbstring);
  64. PHP_MINFO_FUNCTION(mbstring);
  65. /* php function registration */
  66. PHP_FUNCTION(mb_language);
  67. PHP_FUNCTION(mb_internal_encoding);
  68. PHP_FUNCTION(mb_http_input);
  69. PHP_FUNCTION(mb_http_output);
  70. PHP_FUNCTION(mb_detect_order);
  71. PHP_FUNCTION(mb_substitute_character);
  72. PHP_FUNCTION(mb_preferred_mime_name);
  73. PHP_FUNCTION(mb_parse_str);
  74. PHP_FUNCTION(mb_output_handler);
  75. PHP_FUNCTION(mb_strlen);
  76. PHP_FUNCTION(mb_strpos);
  77. PHP_FUNCTION(mb_strrpos);
  78. PHP_FUNCTION(mb_substr);
  79. PHP_FUNCTION(mb_strcut);
  80. PHP_FUNCTION(mb_strwidth);
  81. PHP_FUNCTION(mb_strimwidth);
  82. PHP_FUNCTION(mb_convert_encoding);
  83. PHP_FUNCTION(mb_detect_encoding);
  84. PHP_FUNCTION(mb_convert_kana);
  85. PHP_FUNCTION(mb_encode_mimeheader);
  86. PHP_FUNCTION(mb_decode_mimeheader);
  87. PHP_FUNCTION(mb_convert_variables);
  88. PHP_FUNCTION(mb_encode_numericentity);
  89. PHP_FUNCTION(mb_decode_numericentity);
  90. PHP_FUNCTION(mb_send_mail);
  91. PHP_FUNCTION(mb_get_info);
  92. #if HAVE_MBREGEX
  93. PHP_FUNCTION(mb_regex_encoding);
  94. PHP_FUNCTION(mb_ereg);
  95. PHP_FUNCTION(mb_eregi);
  96. PHP_FUNCTION(mb_ereg_replace);
  97. PHP_FUNCTION(mb_eregi_replace);
  98. PHP_FUNCTION(mb_split);
  99. PHP_FUNCTION(mb_ereg_match);
  100. PHP_FUNCTION(mb_ereg_search);
  101. PHP_FUNCTION(mb_ereg_search_pos);
  102. PHP_FUNCTION(mb_ereg_search_regs);
  103. PHP_FUNCTION(mb_ereg_search_init);
  104. PHP_FUNCTION(mb_ereg_search_getregs);
  105. PHP_FUNCTION(mb_ereg_search_getpos);
  106. PHP_FUNCTION(mb_ereg_search_setpos);
  107. #endif
  108. #if HAVE_MBREGEX
  109. #define PHP_MBREGEX_MAXCACHE 50
  110. int php_mbregex_name2mbctype(const char *pname);
  111. #endif
  112. char *mbstr_strrchr(const char *s, char c TSRMLS_DC);
  113. int mbstr_is_mb_leadbyte(const char *s TSRMLS_DC);
  114. PHPAPI int mbstr_encoding_translation(TSRMLS_D);
  115. ZEND_BEGIN_MODULE_GLOBALS(mbstring)
  116. int language;
  117. int current_language;
  118. int internal_encoding;
  119. int current_internal_encoding;
  120. #ifdef ZEND_MULTIBYTE
  121. int *script_encoding_list;
  122. int script_encoding_list_size;
  123. #endif /* ZEND_MULTIBYTE */
  124. int http_output_encoding;
  125. int current_http_output_encoding;
  126. int http_input_identify;
  127. int http_input_identify_get;
  128. int http_input_identify_post;
  129. int http_input_identify_cookie;
  130. int http_input_identify_string;
  131. int *http_input_list;
  132. int http_input_list_size;
  133. int *detect_order_list;
  134. int detect_order_list_size;
  135. int *current_detect_order_list;
  136. int current_detect_order_list_size;
  137. int filter_illegal_mode;
  138. int filter_illegal_substchar;
  139. int current_filter_illegal_mode;
  140. int current_filter_illegal_substchar;
  141. long func_overload;
  142. int encoding_translation;
  143. mbfl_buffer_converter *outconv;
  144. #if HAVE_MBREGEX
  145. int default_mbctype;
  146. int current_mbctype;
  147. HashTable ht_rc;
  148. zval **search_str;
  149. zval *search_str_val;
  150. unsigned int search_pos;
  151. mb_regex_t *search_re;
  152. struct mbre_registers *search_regs;
  153. #endif
  154. ZEND_END_MODULE_GLOBALS(mbstring)
  155. #define MB_OVERLOAD_MAIL 1
  156. #define MB_OVERLOAD_STRING 2
  157. #define MB_OVERLOAD_REGEX 4
  158. struct mb_overload_def {
  159. int type;
  160. char *orig_func;
  161. char *ovld_func;
  162. char *save_func;
  163. };
  164. #ifdef ZTS
  165. #define MBSTRG(v) TSRMG(mbstring_globals_id, zend_mbstring_globals *, v)
  166. #else
  167. #define MBSTRG(v) (mbstring_globals.v)
  168. #endif
  169. #ifdef ZEND_MULTIBYTE
  170. PHPAPI int php_mbstring_set_zend_encoding(TSRMLS_D);
  171. char* php_mbstring_encoding_detector(char *string, int length, char *list
  172. TSRMLS_DC);
  173. int php_mbstring_encoding_converter(char **to, int *to_length, char *from,
  174. int from_length, const char *encoding_to, const char *encoding_from
  175. TSRMLS_DC);
  176. int php_mbstring_oddlen(char *string, int length, const char *encoding TSRMLS_DC);
  177. #endif /* ZEND_MULTIBYTE */
  178. SAPI_POST_HANDLER_FUNC(php_mbstr_post_handler);
  179. SAPI_API SAPI_TREAT_DATA_FUNC(mbstr_treat_data);
  180. #else /* HAVE_MBSTRING */
  181. #define mbstring_module_ptr NULL
  182. #endif /* HAVE_MBSTRING */
  183. #define phpext_mbstring_ptr mbstring_module_ptr
  184. #endif /* _MBSTRING_H */
  185. /*
  186. * Local variables:
  187. * tab-width: 4
  188. * c-basic-offset: 4
  189. * End:
  190. */