Back to index

php5  5.3.10
php_pcre.h
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | PHP Version 5                                                        |
00004    +----------------------------------------------------------------------+
00005    | Copyright (c) 1997-2012 The PHP Group                                |
00006    +----------------------------------------------------------------------+
00007    | This source file is subject to version 3.01 of the PHP license,      |
00008    | that is bundled with this package in the file LICENSE, and is        |
00009    | available through the world-wide-web at the following url:           |
00010    | http://www.php.net/license/3_01.txt                                  |
00011    | If you did not receive a copy of the PHP license and are unable to   |
00012    | obtain it through the world-wide-web, please send a note to          |
00013    | license@php.net so we can mail you a copy immediately.               |
00014    +----------------------------------------------------------------------+
00015    | Author: Andrei Zmievski <andrei@php.net>                             |
00016    +----------------------------------------------------------------------+
00017  */
00018  
00019 /* $Id: php_pcre.h 321634 2012-01-01 13:15:04Z felipe $ */
00020 
00021 #ifndef PHP_PCRE_H
00022 #define PHP_PCRE_H
00023 
00024 #if HAVE_PCRE || HAVE_BUNDLED_PCRE
00025 
00026 #if HAVE_BUNDLED_PCRE
00027 #include "pcrelib/pcre.h"
00028 #else
00029 #include "pcre.h"
00030 #endif
00031 
00032 #if HAVE_LOCALE_H
00033 #include <locale.h>
00034 #endif
00035 
00036 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);
00037 PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *options TSRMLS_DC);
00038 PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_extra **extra, int *preg_options, int *coptions TSRMLS_DC);
00039 
00040 extern zend_module_entry pcre_module_entry;
00041 #define pcre_module_ptr &pcre_module_entry
00042 
00043 typedef struct {
00044        pcre *re;
00045        pcre_extra *extra;
00046        int preg_options;
00047 #if HAVE_SETLOCALE
00048        char *locale;
00049        unsigned const char *tables;
00050 #endif
00051        int compile_options;
00052        int refcount;
00053 } pcre_cache_entry;
00054 
00055 PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_len TSRMLS_DC);
00056 
00057 PHPAPI void  php_pcre_match_impl(  pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
00058        zval *subpats, int global, int use_flags, long flags, long start_offset TSRMLS_DC);
00059 
00060 PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value, 
00061        int is_callable_replace, int *result_len, int limit, int *replace_count TSRMLS_DC);
00062 
00063 PHPAPI void  php_pcre_split_impl(  pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
00064        long limit_val, long flags TSRMLS_DC);
00065 
00066 PHPAPI void  php_pcre_grep_impl(   pcre_cache_entry *pce, zval *input, zval *return_value,
00067        long flags TSRMLS_DC);
00068 
00069 ZEND_BEGIN_MODULE_GLOBALS(pcre)
00070        HashTable pcre_cache;
00071        long backtrack_limit;
00072        long recursion_limit;
00073        int  error_code;
00074 ZEND_END_MODULE_GLOBALS(pcre)
00075 
00076 #ifdef ZTS
00077 # define PCRE_G(v) TSRMG(pcre_globals_id, zend_pcre_globals *, v)
00078 #else
00079 # define PCRE_G(v)   (pcre_globals.v)
00080 #endif
00081 
00082 #else
00083 
00084 #define pcre_module_ptr NULL
00085 
00086 #endif /* HAVE_PCRE || HAVE_BUNDLED_PCRE */
00087 
00088 #define phpext_pcre_ptr pcre_module_ptr
00089 
00090 #endif /* PHP_PCRE_H */