X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=pcrs.h;h=31fb8871a634c8e27e9d9a3e6bc1dab885ddeef6;hp=6b635fb4bd90af03b4b5c65d0cb2aa557fa92c1d;hb=5b35453b1f37ce1059d8b99c9a64b2d123fdbfe9;hpb=f3310405a509cb57305535b5b3356a543a9d21fe diff --git a/pcrs.h b/pcrs.h index 6b635fb4..31fb8871 100644 --- a/pcrs.h +++ b/pcrs.h @@ -1,5 +1,5 @@ -#ifndef _PCRS_H -#define _PCRS_H +#ifndef PCRS_H_INCLUDED +#define PCRS_H_INCLUDED /********************************************************************* * @@ -26,6 +26,14 @@ * * Revisions : * $Log: pcrs.h,v $ + * Revision 1.5 2001/07/18 17:27:00 oes + * Changed interface; Cosmetics + * + * Revision 1.4 2001/06/29 13:33:19 oes + * - Cleaned up, commented and adapted to reflect the + * changes in pcrs.c + * - Introduced the PCRS_* flags + * * Revision 1.3 2001/06/09 10:58:57 jongfoster * Removing a single unused #define which referenced BUFSIZ * @@ -49,11 +57,15 @@ * *********************************************************************/ -#define PCRS_H_VERSION "$Id: pcrs.h,v 1.3 2001/06/09 10:58:57 jongfoster Exp $" +#define PCRS_H_VERSION "$Id: pcrs.h,v 1.5 2001/07/18 17:27:00 oes Exp $" #include +#ifdef __cplusplus +extern "C" { +#endif + /* * Constants: */ @@ -74,14 +86,14 @@ /* Flags */ #define PCRS_GLOBAL 1 /* Job should be applied globally, as with perl's g option */ #define PCRS_SUCCESS 2 /* Job did previously match */ -#define PCRS_TRIVIAL 4 /* No backreferences need to be parsed in the substitute */ +#define PCRS_TRIVIAL 4 /* Backreferences in the substitute are ignored */ /* * Data types: */ /* A compiled substitute */ -typedef struct S_PCRS_SUBSTITUTE { +typedef struct PCRS_SUBSTITUTE { 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 */ @@ -90,20 +102,20 @@ typedef struct S_PCRS_SUBSTITUTE { int backref_count[PCRS_MAX_SUBMATCHES]; /* Array with the number of reference to each backref index */ } pcrs_substitute; -typedef struct S_PCRS_MATCH { +typedef struct PCRS_MATCH { /* char *buffer; */ int submatches; /* Number of submatches. Note: The zeroth is the whole match */ int submatch_offset[PCRS_MAX_SUBMATCHES]; /* Offset for each submatch in the subject */ int submatch_length[PCRS_MAX_SUBMATCHES]; /* Length of each submatch in the subject */ } pcrs_match; -typedef struct S_PCRS_JOB { +typedef struct PCRS_JOB { pcre *pattern; /* The compiled pcre pattern */ pcre_extra *hints; /* The pcre hints for the pattern */ int options; /* The pcre options (numeric) */ int flags; /* The pcrs and user flags (see "Flags" above) */ pcrs_substitute *substitute; /* The compiles pcrs substitute */ - struct S_PCRS_JOB *next; /* Pointer for chaining jobs to joblists */ + struct PCRS_JOB *next; /* Pointer for chaining jobs to joblists */ } pcrs_job; /* @@ -111,8 +123,8 @@ typedef struct S_PCRS_JOB { */ /* Main usage */ -extern pcrs_job *pcrs_compile(char *command, int *errptr); -extern pcrs_job *pcrs_make_job(char *pattern, char *substitute, char *options, int *errptr); +extern pcrs_job *pcrs_compile_command(char *command, int *errptr); +extern pcrs_job *pcrs_compile(char *pattern, char *substitute, char *options, int *errptr); extern int pcrs_execute(pcrs_job *job, char *subject, int subject_length, char **result, int *result_length); /* Freeing jobs */ @@ -123,7 +135,11 @@ extern void pcrs_free_joblist(pcrs_job *joblist); extern int pcrs_compile_perl_options(char *optstring, int *flags); extern pcrs_substitute *pcrs_compile_replacement(char *replacement, int trivialflag, int *errptr); -#endif /* ndef _PCRS_H */ +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* ndef PCRS_H_INCLUDED */ /* Local Variables: