mbstring.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. #ifndef _MBSTRING_H
  19. #define _MBSTRING_H
  20. #include "php_version.h"
  21. #define PHP_MBSTRING_VERSION PHP_VERSION
  22. #ifdef PHP_WIN32
  23. # undef MBSTRING_API
  24. # ifdef MBSTRING_EXPORTS
  25. # define MBSTRING_API __declspec(dllexport)
  26. # elif defined(COMPILE_DL_MBSTRING)
  27. # define MBSTRING_API __declspec(dllimport)
  28. # else
  29. # define MBSTRING_API /* nothing special */
  30. # endif
  31. #elif defined(__GNUC__) && __GNUC__ >= 4
  32. # undef MBSTRING_API
  33. # define MBSTRING_API __attribute__ ((visibility("default")))
  34. #else
  35. # undef MBSTRING_API
  36. # define MBSTRING_API /* nothing special */
  37. #endif
  38. #include "libmbfl/mbfl/mbfilter.h"
  39. #include "SAPI.h"
  40. #define PHP_MBSTRING_API 20021024
  41. extern zend_module_entry mbstring_module_entry;
  42. #define phpext_mbstring_ptr &mbstring_module_entry
  43. PHP_MINIT_FUNCTION(mbstring);
  44. PHP_MSHUTDOWN_FUNCTION(mbstring);
  45. PHP_RINIT_FUNCTION(mbstring);
  46. PHP_RSHUTDOWN_FUNCTION(mbstring);
  47. PHP_MINFO_FUNCTION(mbstring);
  48. MBSTRING_API char *php_mb_safe_strrchr_ex(const char *s, unsigned int c,
  49. size_t nbytes, const mbfl_encoding *enc);
  50. MBSTRING_API char *php_mb_safe_strrchr(const char *s, unsigned int c,
  51. size_t nbytes);
  52. MBSTRING_API char *php_mb_convert_encoding_ex(
  53. const char *input, size_t length,
  54. const mbfl_encoding *to_encoding, const mbfl_encoding *from_encoding, size_t *output_len);
  55. MBSTRING_API char * php_mb_convert_encoding(
  56. const char *input, size_t length, const mbfl_encoding *to_encoding,
  57. const mbfl_encoding **from_encodings, size_t num_from_encodings, size_t *output_len);
  58. MBSTRING_API size_t php_mb_mbchar_bytes_ex(const char *s, const mbfl_encoding *enc);
  59. MBSTRING_API size_t php_mb_mbchar_bytes(const char *s);
  60. 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);
  61. MBSTRING_API int php_mb_check_encoding(const char *input, size_t length, const mbfl_encoding *encoding);
  62. ZEND_BEGIN_MODULE_GLOBALS(mbstring)
  63. char *internal_encoding_name;
  64. const mbfl_encoding *internal_encoding;
  65. const mbfl_encoding *current_internal_encoding;
  66. const mbfl_encoding *http_output_encoding;
  67. const mbfl_encoding *current_http_output_encoding;
  68. const mbfl_encoding *http_input_identify;
  69. const mbfl_encoding *http_input_identify_get;
  70. const mbfl_encoding *http_input_identify_post;
  71. const mbfl_encoding *http_input_identify_cookie;
  72. const mbfl_encoding *http_input_identify_string;
  73. const mbfl_encoding **http_input_list;
  74. size_t http_input_list_size;
  75. const mbfl_encoding **detect_order_list;
  76. size_t detect_order_list_size;
  77. const mbfl_encoding **current_detect_order_list;
  78. size_t current_detect_order_list_size;
  79. enum mbfl_no_encoding *default_detect_order_list;
  80. size_t default_detect_order_list_size;
  81. int filter_illegal_mode;
  82. int filter_illegal_substchar;
  83. int current_filter_illegal_mode;
  84. int current_filter_illegal_substchar;
  85. enum mbfl_no_language language;
  86. bool encoding_translation;
  87. bool strict_detection;
  88. size_t illegalchars;
  89. mbfl_buffer_converter *outconv;
  90. void *http_output_conv_mimetypes;
  91. #ifdef HAVE_MBREGEX
  92. struct _zend_mb_regex_globals *mb_regex_globals;
  93. zend_long regex_stack_limit;
  94. #endif
  95. zend_string *last_used_encoding_name;
  96. const mbfl_encoding *last_used_encoding;
  97. /* Whether an explicit internal_encoding / http_output / http_input encoding was set. */
  98. bool internal_encoding_set;
  99. bool http_output_set;
  100. bool http_input_set;
  101. #ifdef HAVE_MBREGEX
  102. zend_long regex_retry_limit;
  103. #endif
  104. ZEND_END_MODULE_GLOBALS(mbstring)
  105. #define MBSTRG(v) ZEND_MODULE_GLOBALS_ACCESSOR(mbstring, v)
  106. #if defined(ZTS) && defined(COMPILE_DL_MBSTRING)
  107. ZEND_TSRMLS_CACHE_EXTERN()
  108. #endif
  109. #endif /* _MBSTRING_H */