1 | /* |
2 | +----------------------------------------------------------------------+ |
3 | | PHP Version 5 | |
4 | +----------------------------------------------------------------------+ |
5 | | Copyright (c) 1997-2015 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 | |
19 | /* $Id$ */ |
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 **, int *options TSRMLS_DC); |
38 | PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_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 *; |
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 /* HAVE_PCRE || HAVE_BUNDLED_PCRE */ |
87 | |
88 | #define phpext_pcre_ptr pcre_module_ptr |
89 | |
90 | #endif /* PHP_PCRE_H */ |
91 | |