/[pcre]/code/trunk/pcre_internal.h
ViewVC logotype

Diff of /code/trunk/pcre_internal.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 189 by ph10, Thu Jul 5 11:50:49 2007 UTC revision 243 by ph10, Thu Sep 13 09:28:14 2007 UTC
# Line 67  be absolutely sure we get our version. * Line 67  be absolutely sure we get our version. *
67  #endif  #endif
68    
69    
 /* Get the definitions provided by running "configure" */  
   
 #include "config.h"  
   
70  /* Standard C headers plus the external interface definition. The only time  /* Standard C headers plus the external interface definition. The only time
71  setjmp and stdarg are used is when NO_RECURSE is set. */  setjmp and stdarg are used is when NO_RECURSE is set. */
72    
# Line 112  PCRE_EXP_DATA_DEFN only if they are not Line 108  PCRE_EXP_DATA_DEFN only if they are not
108    
109  #ifndef PCRE_EXP_DECL  #ifndef PCRE_EXP_DECL
110  #  ifdef _WIN32  #  ifdef _WIN32
111  #    ifdef DLL_EXPORT  #    ifndef PCRE_STATIC
112  #      define PCRE_EXP_DECL       extern __declspec(dllexport)  #      define PCRE_EXP_DECL       extern __declspec(dllexport)
113  #      define PCRE_EXP_DEFN       __declspec(dllexport)  #      define PCRE_EXP_DEFN       __declspec(dllexport)
114  #      define PCRE_EXP_DATA_DEFN  __declspec(dllexport)  #      define PCRE_EXP_DATA_DEFN  __declspec(dllexport)
# Line 121  PCRE_EXP_DATA_DEFN only if they are not Line 117  PCRE_EXP_DATA_DEFN only if they are not
117  #      define PCRE_EXP_DEFN  #      define PCRE_EXP_DEFN
118  #      define PCRE_EXP_DATA_DEFN  #      define PCRE_EXP_DATA_DEFN
119  #    endif  #    endif
 #  
120  #  else  #  else
121  #    ifdef __cplusplus  #    ifdef __cplusplus
122  #      define PCRE_EXP_DECL       extern "C"  #      define PCRE_EXP_DECL       extern "C"
# Line 363  capturing parenthesis numbers in back re Line 358  capturing parenthesis numbers in back re
358    
359  /* When UTF-8 encoding is being used, a character is no longer just a single  /* When UTF-8 encoding is being used, a character is no longer just a single
360  byte. The macros for character handling generate simple sequences when used in  byte. The macros for character handling generate simple sequences when used in
361  byte-mode, and more complicated ones for UTF-8 characters. */  byte-mode, and more complicated ones for UTF-8 characters. BACKCHAR should
362    never be called in byte mode. To make sure it can never even appear when UTF-8
363    support is omitted, we don't even define it. */
364    
365  #ifndef SUPPORT_UTF8  #ifndef SUPPORT_UTF8
366  #define GETCHAR(c, eptr) c = *eptr;  #define GETCHAR(c, eptr) c = *eptr;
# Line 371  byte-mode, and more complicated ones for Line 368  byte-mode, and more complicated ones for
368  #define GETCHARINC(c, eptr) c = *eptr++;  #define GETCHARINC(c, eptr) c = *eptr++;
369  #define GETCHARINCTEST(c, eptr) c = *eptr++;  #define GETCHARINCTEST(c, eptr) c = *eptr++;
370  #define GETCHARLEN(c, eptr, len) c = *eptr;  #define GETCHARLEN(c, eptr, len) c = *eptr;
371  #define BACKCHAR(eptr)  /* #define BACKCHAR(eptr) */
372    
373  #else   /* SUPPORT_UTF8 */  #else   /* SUPPORT_UTF8 */
374    
# Line 464  if there are extra bytes. This is called Line 461  if there are extra bytes. This is called
461      }      }
462    
463  /* If the pointer is not at the start of a character, move it back until  /* If the pointer is not at the start of a character, move it back until
464  it is. Called only in UTF-8 mode. */  it is. This is called only in UTF-8 mode - we don't put a test within the macro
465    because almost all calls are already within a block of UTF-8 only code. */
466    
467  #define BACKCHAR(eptr) while((*eptr & 0xc0) == 0x80) eptr--;  #define BACKCHAR(eptr) while((*eptr & 0xc0) == 0x80) eptr--
468    
469  #endif  #endif
470    
# Line 483  Standard C system should have one. */ Line 481  Standard C system should have one. */
481    
482  #define PCRE_IMS (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL)  #define PCRE_IMS (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL)
483    
484  /* Private options flags start at the most significant end of the four bytes.  /* Private flags containing information about the compiled regex. They used to
485  The public options defined in pcre.h start at the least significant end. Make  live at the top end of the options word, but that got almost full, so now they
486  sure they don't overlap! The bits are getting a bit scarce now -- when we run  are in a 16-bit flags word. */
487  out, there is a dummy word in the structure that could be used for the private  
488  bits. */  #define PCRE_NOPARTIAL     0x0001  /* can't use partial with this regex */
489    #define PCRE_FIRSTSET      0x0002  /* first_byte is set */
490  #define PCRE_NOPARTIAL     0x80000000  /* can't use partial with this regex */  #define PCRE_REQCHSET      0x0004  /* req_byte is set */
491  #define PCRE_FIRSTSET      0x40000000  /* first_byte is set */  #define PCRE_STARTLINE     0x0008  /* start after \n for multiline */
492  #define PCRE_REQCHSET      0x20000000  /* req_byte is set */  #define PCRE_JCHANGED      0x0010  /* j option used in regex */
493  #define PCRE_STARTLINE     0x10000000  /* start after \n for multiline */  #define PCRE_HASCRORLF     0x0020  /* explicit \r or \n in pattern */
 #define PCRE_JCHANGED      0x08000000  /* j option changes within regex */  
494    
495  /* Options for the "extra" block produced by pcre_study(). */  /* Options for the "extra" block produced by pcre_study(). */
496    
# Line 509  time, run time, or study time, respectiv Line 506  time, run time, or study time, respectiv
506    (PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \    (PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \
507     PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY|PCRE_UTF8| \     PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY|PCRE_UTF8| \
508     PCRE_NO_AUTO_CAPTURE|PCRE_NO_UTF8_CHECK|PCRE_AUTO_CALLOUT|PCRE_FIRSTLINE| \     PCRE_NO_AUTO_CAPTURE|PCRE_NO_UTF8_CHECK|PCRE_AUTO_CALLOUT|PCRE_FIRSTLINE| \
509     PCRE_DUPNAMES|PCRE_NEWLINE_BITS)     PCRE_DUPNAMES|PCRE_NEWLINE_BITS|PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE)
510    
511  #define PUBLIC_EXEC_OPTIONS \  #define PUBLIC_EXEC_OPTIONS \
512    (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \    (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \
513     PCRE_PARTIAL|PCRE_NEWLINE_BITS)     PCRE_PARTIAL|PCRE_NEWLINE_BITS|PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE)
514    
515  #define PUBLIC_DFA_EXEC_OPTIONS \  #define PUBLIC_DFA_EXEC_OPTIONS \
516    (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \    (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \
517     PCRE_PARTIAL|PCRE_DFA_SHORTEST|PCRE_DFA_RESTART|PCRE_NEWLINE_BITS)     PCRE_PARTIAL|PCRE_DFA_SHORTEST|PCRE_DFA_RESTART|PCRE_NEWLINE_BITS| \
518       PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE)
519    
520  #define PUBLIC_STUDY_OPTIONS 0   /* None defined */  #define PUBLIC_STUDY_OPTIONS 0   /* None defined */
521    
# Line 610  enum { ESC_A = 1, ESC_G, ESC_K, ESC_B, E Line 608  enum { ESC_A = 1, ESC_G, ESC_K, ESC_B, E
608         ESC_V, ESC_v, ESC_X, ESC_Z, ESC_z, ESC_E, ESC_Q, ESC_k, ESC_REF };         ESC_V, ESC_v, ESC_X, ESC_Z, ESC_z, ESC_E, ESC_Q, ESC_k, ESC_REF };
609    
610    
611  /* Opcode table: OP_BRA must be last, as all values >= it are used for brackets  /* Opcode table: Starting from 1 (i.e. after OP_END), the values up to
 that extract substrings. Starting from 1 (i.e. after OP_END), the values up to  
612  OP_EOD must correspond in order to the list of escapes immediately above.  OP_EOD must correspond in order to the list of escapes immediately above.
613    
 To keep stored, compiled patterns compatible, new opcodes should be added  
 immediately before OP_BRA, where (since release 7.0) a gap is left for this  
 purpose.  
   
614  *** NOTE NOTE NOTE *** Whenever this list is updated, the two macro definitions  *** NOTE NOTE NOTE *** Whenever this list is updated, the two macro definitions
615  that follow must also be updated to match. There is also a table called  that follow must also be updated to match. There is also a table called
616  "coptable" in pcre_dfa_exec.c that must be updated. */  "coptable" in pcre_dfa_exec.c that must be updated. */
# Line 744  enum { Line 737  enum {
737    as there's a test for >= ONCE for a subpattern that isn't an assertion. */    as there's a test for >= ONCE for a subpattern that isn't an assertion. */
738    
739    OP_ONCE,           /* 92 Atomic group */    OP_ONCE,           /* 92 Atomic group */
740    OP_BRA,            /* 83 Start of non-capturing bracket */    OP_BRA,            /* 93 Start of non-capturing bracket */
741    OP_CBRA,           /* 94 Start of capturing bracket */    OP_CBRA,           /* 94 Start of capturing bracket */
742    OP_COND,           /* 95 Conditional group */    OP_COND,           /* 95 Conditional group */
743    
# Line 760  enum { Line 753  enum {
753    OP_DEF,            /* 101 The DEFINE condition */    OP_DEF,            /* 101 The DEFINE condition */
754    
755    OP_BRAZERO,        /* 102 These two must remain together and in this */    OP_BRAZERO,        /* 102 These two must remain together and in this */
756    OP_BRAMINZERO      /* 103 order. */    OP_BRAMINZERO,     /* 103 order. */
757    
758      /* These are backtracking control verbs */
759    
760      OP_PRUNE,          /* 104 */
761      OP_SKIP,           /* 105 */
762      OP_THEN,           /* 106 */
763      OP_COMMIT,         /* 107 */
764    
765      /* These are forced failure and success verbs */
766    
767      OP_FAIL,           /* 108 */
768      OP_ACCEPT          /* 109 */
769  };  };
770    
771    
# Line 783  for debugging. The macro is referenced o Line 788  for debugging. The macro is referenced o
788    "class", "nclass", "xclass", "Ref", "Recurse", "Callout",       \    "class", "nclass", "xclass", "Ref", "Recurse", "Callout",       \
789    "Alt", "Ket", "KetRmax", "KetRmin", "Assert", "Assert not",     \    "Alt", "Ket", "KetRmax", "KetRmin", "Assert", "Assert not",     \
790    "AssertB", "AssertB not", "Reverse",                            \    "AssertB", "AssertB not", "Reverse",                            \
791    "Once", "Bra 0", "Bra", "Cond", "SBra 0", "SBra", "SCond",      \    "Once", "Bra", "CBra", "Cond", "SBra", "SCBra", "SCond",        \
792    "Cond ref", "Cond rec", "Cond def", "Brazero", "Braminzero"    "Cond ref", "Cond rec", "Cond def", "Brazero", "Braminzero",    \
793      "*PRUNE", "*SKIP", "*THEN", "*COMMIT", "*FAIL", "*ACCEPT"
794    
795    
796  /* This macro defines the length of fixed length operations in the compiled  /* This macro defines the length of fixed length operations in the compiled
# Line 848  in UTF-8 mode. The code that uses this t Line 854  in UTF-8 mode. The code that uses this t
854    3,                             /* RREF                                   */ \    3,                             /* RREF                                   */ \
855    1,                             /* DEF                                    */ \    1,                             /* DEF                                    */ \
856    1, 1,                          /* BRAZERO, BRAMINZERO                    */ \    1, 1,                          /* BRAZERO, BRAMINZERO                    */ \
857      1, 1, 1, 1,                    /* PRUNE, SKIP, THEN, COMMIT,             */ \
858      1, 1                           /* FAIL, ACCEPT                           */
859    
860    
861  /* A magic value for OP_RREF to indicate the "any recursion" condition. */  /* A magic value for OP_RREF to indicate the "any recursion" condition. */
# Line 862  enum { ERR0, ERR1, ERR2, ERR3, ERR4, Line 870  enum { ERR0, ERR1, ERR2, ERR3, ERR4,
870         ERR20, ERR21, ERR22, ERR23, ERR24, ERR25, ERR26, ERR27, ERR28, ERR29,         ERR20, ERR21, ERR22, ERR23, ERR24, ERR25, ERR26, ERR27, ERR28, ERR29,
871         ERR30, ERR31, ERR32, ERR33, ERR34, ERR35, ERR36, ERR37, ERR38, ERR39,         ERR30, ERR31, ERR32, ERR33, ERR34, ERR35, ERR36, ERR37, ERR38, ERR39,
872         ERR40, ERR41, ERR42, ERR43, ERR44, ERR45, ERR46, ERR47, ERR48, ERR49,         ERR40, ERR41, ERR42, ERR43, ERR44, ERR45, ERR46, ERR47, ERR48, ERR49,
873         ERR50, ERR51, ERR52, ERR53, ERR54, ERR55, ERR56, ERR57, ERR58 };         ERR50, ERR51, ERR52, ERR53, ERR54, ERR55, ERR56, ERR57, ERR58, ERR59,
874           ERR60, ERR61 };
875    
876  /* The real format of the start of the pcre block; the index of names and the  /* The real format of the start of the pcre block; the index of names and the
877  code vector run on as long as necessary after the end. We store an explicit  code vector run on as long as necessary after the end. We store an explicit
# Line 884  NOTE NOTE NOTE: Line 893  NOTE NOTE NOTE:
893  typedef struct real_pcre {  typedef struct real_pcre {
894    pcre_uint32 magic_number;    pcre_uint32 magic_number;
895    pcre_uint32 size;               /* Total that was malloced */    pcre_uint32 size;               /* Total that was malloced */
896    pcre_uint32 options;    pcre_uint32 options;            /* Public options */
897    pcre_uint32 dummy1;             /* For future use, maybe */    pcre_uint16 flags;              /* Private flags */
898      pcre_uint16 dummy1;             /* For future use */
899    pcre_uint16 top_bracket;    pcre_uint16 top_bracket;
900    pcre_uint16 top_backref;    pcre_uint16 top_backref;
901    pcre_uint16 first_byte;    pcre_uint16 first_byte;
# Line 929  typedef struct compile_data { Line 938  typedef struct compile_data {
938    int  top_backref;             /* Maximum back reference */    int  top_backref;             /* Maximum back reference */
939    unsigned int backref_map;     /* Bitmap of low back refs */    unsigned int backref_map;     /* Bitmap of low back refs */
940    int  external_options;        /* External (initial) options */    int  external_options;        /* External (initial) options */
941      int  external_flags;          /* External flag bits to be set */
942    int  req_varyopt;             /* "After variable item" flag for reqbyte */    int  req_varyopt;             /* "After variable item" flag for reqbyte */
943    BOOL nopartial;               /* Set TRUE if partial won't work */    BOOL had_accept;              /* (*ACCEPT) encountered */
944    int  nltype;                  /* Newline type */    int  nltype;                  /* Newline type */
945    int  nllen;                   /* Newline string length */    int  nllen;                   /* Newline string length */
946    uschar nl[4];                 /* Newline string when fixed length */    uschar nl[4];                 /* Newline string when fixed length */
# Line 989  typedef struct match_data { Line 999  typedef struct match_data {
999    BOOL   notempty;              /* Empty string match not wanted */    BOOL   notempty;              /* Empty string match not wanted */
1000    BOOL   partial;               /* PARTIAL flag */    BOOL   partial;               /* PARTIAL flag */
1001    BOOL   hitend;                /* Hit the end of the subject at some point */    BOOL   hitend;                /* Hit the end of the subject at some point */
1002      BOOL   bsr_anycrlf;           /* \R is just any CRLF, not full Unicode */
1003    const uschar *start_code;     /* For use when recursing */    const uschar *start_code;     /* For use when recursing */
1004    USPTR  start_subject;         /* Start of the subject string */    USPTR  start_subject;         /* Start of the subject string */
1005    USPTR  end_subject;           /* End of the subject string */    USPTR  end_subject;           /* End of the subject string */
# Line 1053  total length. */ Line 1064  total length. */
1064  #define tables_length (ctypes_offset + 256)  #define tables_length (ctypes_offset + 256)
1065    
1066  /* Layout of the UCP type table that translates property names into types and  /* Layout of the UCP type table that translates property names into types and
1067  codes. */  codes. Each entry used to point directly to a name, but to reduce the number of
1068    relocations in shared libraries, it now has an offset into a single string
1069    instead. */
1070    
1071  typedef struct {  typedef struct {
1072    const char *name;    pcre_uint16 name_offset;
1073    pcre_uint16 type;    pcre_uint16 type;
1074    pcre_uint16 value;    pcre_uint16 value;
1075  } ucp_type_table;  } ucp_type_table;
# Line 1074  extern const uschar _pcre_utf8_table4[]; Line 1087  extern const uschar _pcre_utf8_table4[];
1087    
1088  extern const int    _pcre_utf8_table1_size;  extern const int    _pcre_utf8_table1_size;
1089    
1090    extern const char   _pcre_utt_names[];
1091  extern const ucp_type_table _pcre_utt[];  extern const ucp_type_table _pcre_utt[];
1092  extern const int _pcre_utt_size;  extern const int _pcre_utt_size;
1093    

Legend:
Removed from v.189  
changed lines
  Added in v.243

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12