php_pcre.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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: Andrei Zmievski <andrei@php.net> |
  16. +----------------------------------------------------------------------+
  17. */
  18. /* $Id$ */
  19. #ifndef PHP_PCRE_H
  20. #define PHP_PCRE_H
  21. #if HAVE_PCRE || HAVE_BUNDLED_PCRE
  22. #if HAVE_BUNDLED_PCRE
  23. #include "pcrelib/pcre.h"
  24. #else
  25. #include "pcre.h"
  26. #endif
  27. #if HAVE_LOCALE_H
  28. #include <locale.h>
  29. #endif
  30. PHPAPI char *php_pcre_replace(char *regex, int regex_len, char *subject, int subject_len, zval *replace_val, int is_callable_replace, int *result_len, int limit, int *replace_count TSRMLS_DC);
  31. PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *options TSRMLS_DC);
  32. PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_extra **extra, int *preg_options, int *coptions TSRMLS_DC);
  33. extern zend_module_entry pcre_module_entry;
  34. #define pcre_module_ptr &pcre_module_entry
  35. typedef struct {
  36. pcre *re;
  37. pcre_extra *extra;
  38. int preg_options;
  39. #if HAVE_SETLOCALE
  40. char *locale;
  41. unsigned const char *tables;
  42. #endif
  43. int compile_options;
  44. int refcount;
  45. } pcre_cache_entry;
  46. PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_len TSRMLS_DC);
  47. PHPAPI void php_pcre_match_impl( pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
  48. zval *subpats, int global, int use_flags, long flags, long start_offset TSRMLS_DC);
  49. PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
  50. int is_callable_replace, int *result_len, int limit, int *replace_count TSRMLS_DC);
  51. PHPAPI void php_pcre_split_impl( pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
  52. long limit_val, long flags TSRMLS_DC);
  53. PHPAPI void php_pcre_grep_impl( pcre_cache_entry *pce, zval *input, zval *return_value,
  54. long flags TSRMLS_DC);
  55. ZEND_BEGIN_MODULE_GLOBALS(pcre)
  56. HashTable pcre_cache;
  57. long backtrack_limit;
  58. long recursion_limit;
  59. int error_code;
  60. ZEND_END_MODULE_GLOBALS(pcre)
  61. #ifdef ZTS
  62. # define PCRE_G(v) TSRMG(pcre_globals_id, zend_pcre_globals *, v)
  63. #else
  64. # define PCRE_G(v) (pcre_globals.v)
  65. #endif
  66. #else
  67. #define pcre_module_ptr NULL
  68. #endif /* HAVE_PCRE || HAVE_BUNDLED_PCRE */
  69. #define phpext_pcre_ptr pcre_module_ptr
  70. #endif /* PHP_PCRE_H */