1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #ifndef PHP_PCRE_H
22 #define PHP_PCRE_H
23
24 #if HAVE_PCRE || HAVE_BUNDLED_PCRE
25
26 #if HAVE_BUNDLED_PCRE
27 #include "pcrelib/pcre.h"
28 #else
29 #include "pcre.h"
30 #endif
31
32 #if HAVE_LOCALE_H
33 #include <locale.h>
34 #endif
35
36 PHPAPI zend_string *php_pcre_replace(zend_string *regex, zend_string *subject_str, char *subject, int subject_len, zval *replace_val, int is_callable_replace, int limit, int *replace_count);
37 PHPAPI pcre* pcre_get_compiled_regex(zend_string *regex, pcre_extra **extra, int *options);
38 PHPAPI pcre* pcre_get_compiled_regex_ex(zend_string *regex, pcre_extra **extra, int *preg_options, int *coptions);
39
40 extern zend_module_entry pcre_module_entry;
41 #define pcre_module_ptr &pcre_module_entry
42
43 #include "php_version.h"
44 #define PHP_PCRE_VERSION PHP_VERSION
45
46 typedef struct {
47 pcre *re;
48 pcre_extra *extra;
49 int preg_options;
50 int capture_count;
51 int name_count;
52 #if HAVE_SETLOCALE
53 zend_string *locale;
54 unsigned const char *tables;
55 #endif
56 int compile_options;
57 int refcount;
58 } pcre_cache_entry;
59
60 PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex);
61
62 PHPAPI void php_pcre_match_impl( pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
63 zval *subpats, int global, int use_flags, zend_long flags, zend_long start_offset);
64
65 PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *subject_str, char *subject, int subject_len, zval *return_value,
66 int is_callable_replace, int limit, int *replace_count);
67
68 PHPAPI void php_pcre_split_impl( pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
69 zend_long limit_val, zend_long flags);
70
71 PHPAPI void php_pcre_grep_impl( pcre_cache_entry *pce, zval *input, zval *return_value,
72 zend_long flags);
73
74 ZEND_BEGIN_MODULE_GLOBALS(pcre)
75 HashTable pcre_cache;
76 zend_long backtrack_limit;
77 zend_long recursion_limit;
78 #ifdef PCRE_STUDY_JIT_COMPILE
79 zend_bool jit;
80 #endif
81 int error_code;
82 ZEND_END_MODULE_GLOBALS(pcre)
83
84 PHPAPI ZEND_EXTERN_MODULE_GLOBALS(pcre)
85 #define PCRE_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(pcre, v)
86
87 #else
88
89 #define pcre_module_ptr NULL
90
91 #endif
92
93 #define phpext_pcre_ptr pcre_module_ptr
94
95 #endif