php_string.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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. | Authors: Rasmus Lerdorf <rasmus@php.net> |
  16. | Stig Sæther Bakken <ssb@php.net> |
  17. +----------------------------------------------------------------------+
  18. */
  19. #ifndef PHP_STRING_H
  20. #define PHP_STRING_H
  21. PHP_FUNCTION(strspn);
  22. PHP_FUNCTION(strcspn);
  23. PHP_FUNCTION(str_replace);
  24. PHP_FUNCTION(str_ireplace);
  25. PHP_FUNCTION(rtrim);
  26. PHP_FUNCTION(trim);
  27. PHP_FUNCTION(ltrim);
  28. PHP_FUNCTION(soundex);
  29. PHP_FUNCTION(levenshtein);
  30. PHP_FUNCTION(count_chars);
  31. PHP_FUNCTION(wordwrap);
  32. PHP_FUNCTION(explode);
  33. PHP_FUNCTION(implode);
  34. PHP_FUNCTION(strtok);
  35. PHP_FUNCTION(strtoupper);
  36. PHP_FUNCTION(strtolower);
  37. PHP_FUNCTION(basename);
  38. PHP_FUNCTION(dirname);
  39. PHP_FUNCTION(pathinfo);
  40. PHP_FUNCTION(strstr);
  41. PHP_FUNCTION(strpos);
  42. PHP_FUNCTION(stripos);
  43. PHP_FUNCTION(strrpos);
  44. PHP_FUNCTION(strripos);
  45. PHP_FUNCTION(strrchr);
  46. PHP_FUNCTION(substr);
  47. PHP_FUNCTION(quotemeta);
  48. PHP_FUNCTION(ucfirst);
  49. PHP_FUNCTION(lcfirst);
  50. PHP_FUNCTION(ucwords);
  51. PHP_FUNCTION(strtr);
  52. PHP_FUNCTION(strrev);
  53. PHP_FUNCTION(hebrev);
  54. PHP_FUNCTION(hebrevc);
  55. PHP_FUNCTION(user_sprintf);
  56. PHP_FUNCTION(user_printf);
  57. PHP_FUNCTION(vprintf);
  58. PHP_FUNCTION(vsprintf);
  59. PHP_FUNCTION(addcslashes);
  60. PHP_FUNCTION(addslashes);
  61. PHP_FUNCTION(stripcslashes);
  62. PHP_FUNCTION(stripslashes);
  63. PHP_FUNCTION(chr);
  64. PHP_FUNCTION(ord);
  65. PHP_FUNCTION(nl2br);
  66. PHP_FUNCTION(setlocale);
  67. PHP_FUNCTION(localeconv);
  68. PHP_FUNCTION(nl_langinfo);
  69. PHP_FUNCTION(stristr);
  70. PHP_FUNCTION(chunk_split);
  71. PHP_FUNCTION(parse_str);
  72. PHP_FUNCTION(str_getcsv);
  73. PHP_FUNCTION(bin2hex);
  74. PHP_FUNCTION(hex2bin);
  75. PHP_FUNCTION(similar_text);
  76. PHP_FUNCTION(strip_tags);
  77. PHP_FUNCTION(str_repeat);
  78. PHP_FUNCTION(substr_replace);
  79. PHP_FUNCTION(strnatcmp);
  80. PHP_FUNCTION(strnatcasecmp);
  81. PHP_FUNCTION(substr_count);
  82. PHP_FUNCTION(str_pad);
  83. PHP_FUNCTION(sscanf);
  84. PHP_FUNCTION(str_shuffle);
  85. PHP_FUNCTION(str_word_count);
  86. PHP_FUNCTION(str_split);
  87. PHP_FUNCTION(strpbrk);
  88. PHP_FUNCTION(substr_compare);
  89. PHP_FUNCTION(utf8_encode);
  90. PHP_FUNCTION(utf8_decode);
  91. #ifdef HAVE_STRCOLL
  92. PHP_FUNCTION(strcoll);
  93. #endif
  94. #if HAVE_STRFMON
  95. PHP_FUNCTION(money_format);
  96. #endif
  97. #if defined(HAVE_LOCALECONV) && defined(ZTS)
  98. PHP_MINIT_FUNCTION(localeconv);
  99. PHP_MSHUTDOWN_FUNCTION(localeconv);
  100. #endif
  101. #if HAVE_NL_LANGINFO
  102. PHP_MINIT_FUNCTION(nl_langinfo);
  103. #endif
  104. #if ZEND_INTRIN_SSE4_2_FUNC_PTR
  105. PHP_MINIT_FUNCTION(string_intrin);
  106. #endif
  107. #define strnatcmp(a, b) \
  108. strnatcmp_ex(a, strlen(a), b, strlen(b), 0)
  109. #define strnatcasecmp(a, b) \
  110. strnatcmp_ex(a, strlen(a), b, strlen(b), 1)
  111. PHPAPI int strnatcmp_ex(char const *a, size_t a_len, char const *b, size_t b_len, int fold_case);
  112. #ifdef HAVE_LOCALECONV
  113. PHPAPI struct lconv *localeconv_r(struct lconv *out);
  114. #endif
  115. PHPAPI char *php_strtoupper(char *s, size_t len);
  116. PHPAPI char *php_strtolower(char *s, size_t len);
  117. PHPAPI zend_string *php_string_toupper(zend_string *s);
  118. PHPAPI zend_string *php_string_tolower(zend_string *s);
  119. PHPAPI char *php_strtr(char *str, size_t len, const char *str_from, const char *str_to, size_t trlen);
  120. #if ZEND_INTRIN_SSE4_2_FUNC_PTR
  121. PHPAPI extern zend_string *(*php_addslashes)(zend_string *str);
  122. PHPAPI extern void (*php_stripslashes)(zend_string *str);
  123. #else
  124. PHPAPI zend_string *php_addslashes(zend_string *str);
  125. PHPAPI void php_stripslashes(zend_string *str);
  126. #endif
  127. PHPAPI zend_string *php_addcslashes_str(const char *str, size_t len, char *what, size_t what_len);
  128. PHPAPI zend_string *php_addcslashes(zend_string *str, char *what, size_t what_len);
  129. PHPAPI void php_stripcslashes(zend_string *str);
  130. PHPAPI zend_string *php_basename(const char *s, size_t len, char *suffix, size_t sufflen);
  131. PHPAPI size_t php_dirname(char *str, size_t len);
  132. PHPAPI char *php_stristr(char *s, char *t, size_t s_len, size_t t_len);
  133. PHPAPI zend_string *php_str_to_str(const char *haystack, size_t length, const char *needle,
  134. size_t needle_len, const char *str, size_t str_len);
  135. PHPAPI zend_string *php_trim(zend_string *str, char *what, size_t what_len, int mode);
  136. PHPAPI size_t php_strip_tags(char *rbuf, size_t len, uint8_t *state, const char *allow, size_t allow_len);
  137. PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, uint8_t *stateptr, const char *allow, size_t allow_len, zend_bool allow_tag_spaces);
  138. PHPAPI void php_implode(const zend_string *delim, zval *arr, zval *return_value);
  139. PHPAPI void php_explode(const zend_string *delim, zend_string *str, zval *return_value, zend_long limit);
  140. PHPAPI size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end);
  141. PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end);
  142. PHPAPI int string_natural_compare_function_ex(zval *result, zval *op1, zval *op2, zend_bool case_insensitive);
  143. PHPAPI int string_natural_compare_function(zval *result, zval *op1, zval *op2);
  144. PHPAPI int string_natural_case_compare_function(zval *result, zval *op1, zval *op2);
  145. #ifndef HAVE_STRERROR
  146. PHPAPI char *php_strerror(int errnum);
  147. #define strerror php_strerror
  148. #endif
  149. #ifndef HAVE_MBLEN
  150. # define php_mblen(ptr, len) 1
  151. # define php_mb_reset()
  152. #elif defined(_REENTRANT) && defined(HAVE_MBRLEN) && defined(HAVE_MBSTATE_T)
  153. # ifdef PHP_WIN32
  154. # include <wchar.h>
  155. # endif
  156. # define php_mblen(ptr, len) ((int) mbrlen(ptr, len, &BG(mblen_state)))
  157. # define php_mb_reset() memset(&BG(mblen_state), 0, sizeof(BG(mblen_state)))
  158. #else
  159. # define php_mblen(ptr, len) mblen(ptr, len)
  160. # define php_mb_reset() php_ignore_value(mblen(NULL, 0))
  161. #endif
  162. void register_string_constants(INIT_FUNC_ARGS);
  163. #endif /* PHP_STRING_H */