X-Git-Url: http://www.privoxy.org/gitweb/show-status?a=blobdiff_plain;f=pcrs.h;h=32cf37c291cc095c103b5518d8a7fb2d9cd061a2;hb=490b81212327bce87ced5aafa9f40e2c0f86dc6a;hp=dc9533d18379251b4b0f1ee8e5c0caec598b7606;hpb=f67b3326138f428863c21c7738e0c8db87fa6f5c;p=privoxy.git diff --git a/pcrs.h b/pcrs.h index dc9533d1..32cf37c2 100644 --- a/pcrs.h +++ b/pcrs.h @@ -7,16 +7,44 @@ * * Purpose : Header file for pcrs.c * - * Copyright : see pcrs.c + * Copyright : Written and Copyright (C) 2000, 2001 by Andreas S. Oesterhelt + * + * + * Copyright (C) 2006, 2007 Fabian Keil + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will + * be useful, but WITHOUT ANY WARRANTY; without even the + * implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * The GNU General Public License should be included with + * this file. If not, you can view it at + * http://www.gnu.org/copyleft/gpl.html + * or write to the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston, MA 02111-1307, USA. * *********************************************************************/ -#define PCRS_H_VERSION "$Id: pcrs.h,v 1.18 2013/11/24 14:23:28 fabiankeil Exp $" - +#ifdef HAVE_PCRE2 +#define PCRE2_CODE_UNIT_WIDTH 8 +#define PCREn(x) PCRE2_ ## x +#ifndef _PCRE2_H +#include +#endif +#else +#define PCREn(x) PCRE_ ## x #ifndef _PCRE_H #include #endif +#endif /* * Constants: @@ -36,21 +64,23 @@ * They are supposed to be handled together with PCRE error * codes and have to start with an offset to prevent overlaps. * - * PCRE 6.7 uses error codes from -1 to -21, PCRS error codes - * below -100 should be safe for a while. + * PCRE 6.7 uses error codes from -1 to -21, + * PCRE2 10.42 uses error codes from -66 to 101. + * PCRS error codes below -300 should be safe for a while. */ -#define PCRS_ERR_NOMEM -100 /* Failed to acquire memory. */ -#define PCRS_ERR_CMDSYNTAX -101 /* Syntax of s///-command */ -#define PCRS_ERR_STUDY -102 /* pcre error while studying the pattern */ -#define PCRS_ERR_BADJOB -103 /* NULL job pointer, pattern or substitute */ -#define PCRS_WARN_BADREF -104 /* Backreference out of range */ -#define PCRS_WARN_TRUNCATION -105 /* At least one pcrs variable was too big, +#define PCRS_ERR_NOMEM -300 /* Failed to acquire memory. */ +#define PCRS_ERR_CMDSYNTAX -301 /* Syntax of s///-command */ +#define PCRS_ERR_STUDY -302 /* pcre error while studying the pattern */ +#define PCRS_ERR_BADJOB -303 /* NULL job pointer, pattern or substitute */ +#define PCRS_WARN_BADREF -304 /* Backreference out of range */ +#define PCRS_WARN_TRUNCATION -305 /* At least one pcrs variable was too big, * only the first part was used. */ /* Flags */ -#define PCRS_GLOBAL 1 /* Job should be applied globally, as with perl's g option */ -#define PCRS_TRIVIAL 2 /* Backreferences in the substitute are ignored */ -#define PCRS_SUCCESS 4 /* Job did previously match */ +#define PCRS_GLOBAL 0x08000000u /* Job should be applied globally, as with perl's g option */ +#define PCRS_TRIVIAL 0x10000000u /* Backreferences in the substitute are ignored */ +#define PCRS_SUCCESS 0x20000000u /* Job did previously match */ +#define PCRS_DYNAMIC 0x40000000u /* Job is dynamic (used to disable JIT compilation) */ /* @@ -87,10 +117,14 @@ typedef struct { /* A PCRS job */ typedef struct PCRS_JOB { +#ifdef HAVE_PCRE2 + pcre2_code *pattern; +#else pcre *pattern; /* The compiled pcre pattern */ pcre_extra *hints; /* The pcre hints for the pattern */ +#endif int options; /* The pcre options (numeric) */ - int flags; /* The pcrs and user flags (see "Flags" above) */ + unsigned int flags; /* The pcrs and user flags (see "Flags" above) */ pcrs_substitute *substitute; /* The compiled pcrs substitute */ struct PCRS_JOB *next; /* Pointer for chaining jobs to joblists */ } pcrs_job;