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 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);
37 PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *options TSRMLS_DC);
38 PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_extra **extra, int *preg_options, int *coptions TSRMLS_DC);
39
40 extern zend_module_entry pcre_module_entry;
41 #define pcre_module_ptr &pcre_module_entry
42
43 typedef struct {
44 pcre *re;
45 pcre_extra *extra;
46 int preg_options;
47 #if HAVE_SETLOCALE
48 char *locale;
49 unsigned const char *tables;
50 #endif
51 int compile_options;
52 int refcount;
53 } pcre_cache_entry;
54
55 PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_len TSRMLS_DC);
56
57 PHPAPI void php_pcre_match_impl( pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
58 zval *subpats, int global, int use_flags, long flags, long start_offset TSRMLS_DC);
59
60 PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
61 int is_callable_replace, int *result_len, int limit, int *replace_count TSRMLS_DC);
62
63 PHPAPI void php_pcre_split_impl( pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
64 long limit_val, long flags TSRMLS_DC);
65
66 PHPAPI void php_pcre_grep_impl( pcre_cache_entry *pce, zval *input, zval *return_value,
67 long flags TSRMLS_DC);
68
69 ZEND_BEGIN_MODULE_GLOBALS(pcre)
70 HashTable pcre_cache;
71 long backtrack_limit;
72 long recursion_limit;
73 int error_code;
74 ZEND_END_MODULE_GLOBALS(pcre)
75
76 #ifdef ZTS
77 # define PCRE_G(v) TSRMG(pcre_globals_id, zend_pcre_globals *, v)
78 #else
79 # define PCRE_G(v) (pcre_globals.v)
80 #endif
81
82 #else
83
84 #define pcre_module_ptr NULL
85
86 #endif
87
88 #define phpext_pcre_ptr pcre_module_ptr
89
90 #endif