X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;f=pcrs.h;h=4b22a1b83ea37c8bf1b72d57d56555af403d392d;hb=04aa89ebca169045e35eca0cdc57600db62b1e09;hp=e6ab0e3e1e8b406411ed578e77b566f1f6fc57f1;hpb=2c4a5a9be699d2b6219a1e2630a0c2820dc78bef;p=privoxy.git diff --git a/pcrs.h b/pcrs.h index e6ab0e3e..4b22a1b8 100644 --- a/pcrs.h +++ b/pcrs.h @@ -11,6 +11,16 @@ * * Revisions : * $Log: pcrs.h,v $ + * Revision 1.13 2006/07/18 14:48:47 david__schmidt + * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch) + * with what was really the latest development (the v_3_0_branch branch) + * + * Revision 1.11 2002/03/08 14:18:23 oes + * Fixing -Wconversion warnings + * + * Revision 1.10 2002/03/08 13:44:48 oes + * Hiding internal functions, preventing double inclusion of pcre.h + * * Revision 1.9 2001/08/18 11:35:29 oes * - Introduced pcrs_strerror() * - added pcrs_execute_list() @@ -56,7 +66,7 @@ * *********************************************************************/ -#define PCRS_H_VERSION "$Id: pcrs.h,v 1.9 2001/08/18 11:35:29 oes Exp $" +#define PCRS_H_VERSION "$Id: pcrs.h,v 1.13 2006/07/18 14:48:47 david__schmidt Exp $" #ifndef _PCRE_H @@ -79,12 +89,20 @@ extern "C" { #define PCRS_MAX_MATCH_INIT 40 /* Initial amount of matches that can be stored in global searches */ #define PCRS_MAX_MATCH_GROW 1.6 /* Factor by which storage for matches is extended if exhausted */ -/* Error codes */ -#define PCRS_ERR_NOMEM -10 /* Failed to acquire memory. */ -#define PCRS_ERR_CMDSYNTAX -11 /* Syntax of s///-command */ -#define PCRS_ERR_STUDY -12 /* pcre error while studying the pattern */ -#define PCRS_ERR_BADJOB -13 /* NULL job pointer, pattern or substitute */ -#define PCRS_WARN_BADREF -14 /* Backreference out of range */ +/* + * PCRS error codes + * + * 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. + */ +#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 */ /* Flags */ #define PCRS_GLOBAL 1 /* Job should be applied globally, as with perl's g option */ @@ -99,12 +117,12 @@ extern "C" { /* A compiled substitute */ typedef struct { - char *text; /* The plaintext part of the substitute, with all backreferences stripped */ - int backrefs; /* The number of backreferences */ - int block_offset[PCRS_MAX_SUBMATCHES]; /* Array with the offsets of all plaintext blocks in text */ - int block_length[PCRS_MAX_SUBMATCHES]; /* Array with the lengths of all plaintext blocks in text */ - int backref[PCRS_MAX_SUBMATCHES]; /* Array with the backref number for all plaintext block borders */ - int backref_count[PCRS_MAX_SUBMATCHES + 2]; /* Array with the number of references to each backref index */ + char *text; /* The plaintext part of the substitute, with all backreferences stripped */ + int backrefs; /* The number of backreferences */ + int block_offset[PCRS_MAX_SUBMATCHES]; /* Array with the offsets of all plaintext blocks in text */ + size_t block_length[PCRS_MAX_SUBMATCHES]; /* Array with the lengths of all plaintext blocks in text */ + int backref[PCRS_MAX_SUBMATCHES]; /* Array with the backref number for all plaintext block borders */ + int backref_count[PCRS_MAX_SUBMATCHES + 2]; /* Array with the number of references to each backref index */ } pcrs_substitute; @@ -116,9 +134,9 @@ typedef struct { */ typedef struct { - int submatches; /* Number of captured subpatterns */ - int submatch_offset[PCRS_MAX_SUBMATCHES + 2]; /* Offset for each submatch in the subject */ - int submatch_length[PCRS_MAX_SUBMATCHES + 2]; /* Length of each submatch in the subject */ + int submatches; /* Number of captured subpatterns */ + int submatch_offset[PCRS_MAX_SUBMATCHES + 2]; /* Offset for each submatch in the subject */ + size_t submatch_length[PCRS_MAX_SUBMATCHES + 2]; /* Length of each submatch in the subject */ } pcrs_match;