/[pcre]/code/branches/pcre16/pcre_internal.h
ViewVC logotype

Diff of /code/branches/pcre16/pcre_internal.h

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

revision 763 by zherczeg, Tue Nov 22 21:46:22 2011 UTC revision 764 by zherczeg, Wed Nov 23 17:23:20 2011 UTC
# Line 40  POSSIBILITY OF SUCH DAMAGE. Line 40  POSSIBILITY OF SUCH DAMAGE.
40    
41  /* This header contains definitions that are shared between the different  /* This header contains definitions that are shared between the different
42  modules, but which are not relevant to the exported API. This includes some  modules, but which are not relevant to the exported API. This includes some
43  functions whose names all begin with "_pcre_". */  functions whose names all begin with "_pcre_" or "_pcre16_" depending on
44    the PRIV macro. */
45    
46  #ifndef PCRE_INTERNAL_H  #ifndef PCRE_INTERNAL_H
47  #define PCRE_INTERNAL_H  #define PCRE_INTERNAL_H
# Line 251  start/end of string field names are. */ Line 252  start/end of string field names are. */
252  #define IS_NEWLINE(p) \  #define IS_NEWLINE(p) \
253    ((NLBLOCK->nltype != NLTYPE_FIXED)? \    ((NLBLOCK->nltype != NLTYPE_FIXED)? \
254      ((p) < NLBLOCK->PSEND && \      ((p) < NLBLOCK->PSEND && \
255       _pcre_is_newline((p), NLBLOCK->nltype, NLBLOCK->PSEND, &(NLBLOCK->nllen),\       PRIV(is_newline)((p), NLBLOCK->nltype, NLBLOCK->PSEND, &(NLBLOCK->nllen),\
256         utf8)) \         utf8)) \
257      : \      : \
258      ((p) <= NLBLOCK->PSEND - NLBLOCK->nllen && \      ((p) <= NLBLOCK->PSEND - NLBLOCK->nllen && \
# Line 265  start/end of string field names are. */ Line 266  start/end of string field names are. */
266  #define WAS_NEWLINE(p) \  #define WAS_NEWLINE(p) \
267    ((NLBLOCK->nltype != NLTYPE_FIXED)? \    ((NLBLOCK->nltype != NLTYPE_FIXED)? \
268      ((p) > NLBLOCK->PSSTART && \      ((p) > NLBLOCK->PSSTART && \
269       _pcre_was_newline((p), NLBLOCK->nltype, NLBLOCK->PSSTART, \       PRIV(was_newline)((p), NLBLOCK->nltype, NLBLOCK->PSSTART, \
270         &(NLBLOCK->nllen), utf8)) \         &(NLBLOCK->nllen), utf8)) \
271      : \      : \
272      ((p) >= NLBLOCK->PSSTART + NLBLOCK->nllen && \      ((p) >= NLBLOCK->PSSTART + NLBLOCK->nllen && \
# Line 359  The macros are controlled by the value o Line 360  The macros are controlled by the value o
360  the config.h file, but can be overridden by using -D on the command line. This  the config.h file, but can be overridden by using -D on the command line. This
361  is automated on Unix systems via the "configure" command. */  is automated on Unix systems via the "configure" command. */
362    
363    #ifdef COMPILE_PCRE8
364    
365  #if LINK_SIZE == 2  #if LINK_SIZE == 2
366    
367  #define PUT(a,n,d)   \  #define PUT(a,n,d)   \
# Line 395  is automated on Unix systems via the "co Line 398  is automated on Unix systems via the "co
398  #define GET(a,n) \  #define GET(a,n) \
399    (((a)[n] << 24) | ((a)[(n)+1] << 16) | ((a)[(n)+2] << 8) | (a)[(n)+3])    (((a)[n] << 24) | ((a)[(n)+1] << 16) | ((a)[(n)+2] << 8) | (a)[(n)+3])
400    
401  #define MAX_PATTERN_SIZE (1 << 30)   /* Keep it positive */  /* Keep it positive */
402    #define MAX_PATTERN_SIZE (1 << 30)
403    
404    #else
405    #error LINK_SIZE must be either 2, 3, or 4
406    #endif
407    
408    #else /* COMPILE_PCRE8 */
409    
410    #ifdef COMPILE_PCRE16
411    
412    #if LINK_SIZE == 2
413    
414    #undef LINK_SIZE
415    #define LINK_SIZE 1
416    
417    #define PUT(a,n,d)   \
418      (a[n] = (d))
419    
420    #define GET(a,n) \
421      (a[n])
422    
423    #define MAX_PATTERN_SIZE (1 << 16)
424    
425    #elif LINK_SIZE == 3 || LINK_SIZE == 4
426    
427    #define PUT(a,n,d)   \
428      (a[n] = (d) >> 16), \
429      (a[(n)+1] = (d) & 65536)
430    
431    #define GET(a,n) \
432      (((a)[n] << 16) | (a)[(n)+1])
433    
434    /* Keep it positive */
435    #define MAX_PATTERN_SIZE (1 << 30)
436    
437  #else  #else
438  #error LINK_SIZE must be either 2, 3, or 4  #error LINK_SIZE must be either 2, 3, or 4
439  #endif  #endif
440    
441    #else
442    #error Unsupported compiling mode
443    #endif /* COMPILE_PCRE16 */
444    
445    #endif /* COMPILE_PCRE8 */
446    
447  /* Convenience macro defined in terms of the others */  /* Convenience macro defined in terms of the others */
448    
# Line 423  capturing parenthesis numbers in back re Line 464  capturing parenthesis numbers in back re
464  #define GET2(a,n) \  #define GET2(a,n) \
465    (((a)[n] << 8) | (a)[(n)+1])    (((a)[n] << 8) | (a)[(n)+1])
466    
467    #else /* COMPILE_PCRE8 */
468    
469  #elif defined(COMPILE_PCRE16)  #ifdef COMPILE_PCRE16
470    
471  #define IMM2_SIZE 1  #define IMM2_SIZE 1
472    
# Line 436  capturing parenthesis numbers in back re Line 478  capturing parenthesis numbers in back re
478    
479  #else  #else
480  #error Unsupported compiling mode  #error Unsupported compiling mode
481    #endif /* COMPILE_PCRE16 */
482    
483  #endif /* COMPILE_PCRE8 */  #endif /* COMPILE_PCRE8 */
484    
485  #define PUT2INC(a,n,d)  PUT2(a,n,d), a += IMM2_SIZE  #define PUT2INC(a,n,d)  PUT2(a,n,d), a += IMM2_SIZE
# Line 459  UTF-8 support is omitted, we don't even Line 503  UTF-8 support is omitted, we don't even
503  #else   /* SUPPORT_UTF8 */  #else   /* SUPPORT_UTF8 */
504    
505  /* These macros were originally written in the form of loops that used data  /* These macros were originally written in the form of loops that used data
506  from the tables whose names start with _pcre_utf8_table. They were rewritten by  from the tables whose names start with PRIV(utf8_table). They were rewritten by
507  a user so as not to use loops, because in some environments this gives a  a user so as not to use loops, because in some environments this gives a
508  significant performance advantage, and it seems never to do any harm. */  significant performance advantage, and it seems never to do any harm. */
509    
# Line 1929  total length. */ Line 1973  total length. */
1973  #define ctypes_offset (cbits_offset + cbit_length)  #define ctypes_offset (cbits_offset + cbit_length)
1974  #define tables_length (ctypes_offset + 256)  #define tables_length (ctypes_offset + 256)
1975    
1976    /* Internal function prefix */
1977    
1978    #ifdef COMPILE_PCRE8
1979    #define PRIV(name) _pcre_##name
1980    #else
1981    #ifdef COMPILE_PCRE16
1982    #define PRIV(name) _pcre16_##name
1983    #else
1984    #error Unsupported compiling mode
1985    #endif /* COMPILE_PCRE16 */
1986    #endif /* COMPILE_PCRE8 */
1987    
1988  /* 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
1989  codes. Each entry used to point directly to a name, but to reduce the number of  codes. Each entry used to point directly to a name, but to reduce the number of
1990  relocations in shared libraries, it now has an offset into a single string  relocations in shared libraries, it now has an offset into a single string
# Line 1946  of the exported public functions. They h Line 2002  of the exported public functions. They h
2002  but are not part of the PCRE public API. The data for these tables is in the  but are not part of the PCRE public API. The data for these tables is in the
2003  pcre_tables.c module. */  pcre_tables.c module. */
2004    
2005  extern const int            _pcre_utf8_table1[];  extern const int            PRIV(utf8_table1)[];
2006  extern const int            _pcre_utf8_table2[];  extern const int            PRIV(utf8_table2)[];
2007  extern const int            _pcre_utf8_table3[];  extern const int            PRIV(utf8_table3)[];
2008  extern const pcre_uint8     _pcre_utf8_table4[];  extern const pcre_uint8     PRIV(utf8_table4)[];
2009    
2010  extern const int            _pcre_utf8_table1_size;  extern const int            PRIV(utf8_table1_size);
2011    
2012  extern const char           _pcre_utt_names[];  extern const char           PRIV(utt_names)[];
2013  extern const ucp_type_table _pcre_utt[];  extern const ucp_type_table PRIV(utt)[];
2014  extern const int            _pcre_utt_size;  extern const int            PRIV(utt_size);
2015    
2016  extern const pcre_uint8     _pcre_default_tables[];  extern const pcre_uint8     PRIV(default_tables)[];
2017    
2018  extern const pcre_uint8     _pcre_OP_lengths[];  extern const pcre_uint8     PRIV(OP_lengths)[];
2019    
2020    
2021  /* Internal shared functions. These are functions that are used by more than  /* Internal shared functions. These are functions that are used by more than
# Line 1981  sense, but are not part of the PCRE publ Line 2037  sense, but are not part of the PCRE publ
2037    
2038  #else  #else
2039    
2040  extern int               _pcre_strcmp_uc_uc(const pcre_uchar *,  extern int               PRIV(strcmp_uc_uc)(const pcre_uchar *,
2041                             const pcre_uchar *);                             const pcre_uchar *);
2042  extern int               _pcre_strcmp_uc_c8(const pcre_uchar *,  extern int               PRIV(strcmp_uc_c8)(const pcre_uchar *,
2043                             const char *);                             const char *);
2044  extern int               _pcre_strncmp_uc_uc(const pcre_uchar *,  extern int               PRIV(strncmp_uc_uc)(const pcre_uchar *,
2045                             const pcre_uchar *, unsigned int num);                             const pcre_uchar *, unsigned int num);
2046  extern int               _pcre_strncmp_uc_c8(const pcre_uchar *,  extern int               PRIV(strncmp_uc_c8)(const pcre_uchar *,
2047                             const char *, unsigned int num);                             const char *, unsigned int num);
2048  extern unsigned int      _pcre_strlen_uc(const pcre_uchar *str);  extern unsigned int      PRIV(strlen_uc)(const pcre_uchar *str);
2049    
2050  #define STRCMP_UC_UC(str1, str2) \  #define STRCMP_UC_UC(str1, str2) \
2051    _pcre_strcmp_uc_uc((str1), (str2))    PRIV(strcmp_uc_uc)((str1), (str2))
2052  #define STRCMP_UC_C8(str1, str2) \  #define STRCMP_UC_C8(str1, str2) \
2053    _pcre_strcmp_uc_c8((str1), (str2))    PRIV(strcmp_uc_c8)((str1), (str2))
2054  #define STRNCMP_UC_UC(str1, str2, num) \  #define STRNCMP_UC_UC(str1, str2, num) \
2055    _pcre_strncmp_uc_uc((str1), (str2), (num))    PRIV(strncmp_uc_uc)((str1), (str2), (num))
2056  #define STRNCMP_UC_C8(str1, str2, num) \  #define STRNCMP_UC_C8(str1, str2, num) \
2057    _pcre_strncmp_uc_c8((str1), (str2), (num))    PRIV(strncmp_uc_c8)((str1), (str2), (num))
2058  #define STRLEN_UC(str) _pcre_strlen_uc(str)  #define STRLEN_UC(str) PRIV(strlen_uc)(str)
2059    
2060  #endif /* COMPILE_PCRE8 */  #endif /* COMPILE_PCRE8 */
2061    
2062  extern const pcre_uchar *_pcre_find_bracket(const pcre_uchar *, BOOL, int);  extern const pcre_uchar *PRIV(find_bracket)(const pcre_uchar *, BOOL, int);
2063  extern BOOL              _pcre_is_newline(PCRE_PUCHAR, int, PCRE_PUCHAR,  extern BOOL              PRIV(is_newline)(PCRE_PUCHAR, int, PCRE_PUCHAR,
2064                             int *, BOOL);                             int *, BOOL);
2065  extern int               _pcre_ord2utf8(int, pcre_uint8 *);  extern int               PRIV(ord2utf8)(int, pcre_uint8 *);
2066  extern real_pcre        *_pcre_try_flipped(const real_pcre *, real_pcre *,  extern real_pcre        *PRIV(try_flipped)(const real_pcre *, real_pcre *,
2067                             const pcre_study_data *, pcre_study_data *);                             const pcre_study_data *, pcre_study_data *);
2068  #ifndef COMPILE_PCRE16  #ifndef COMPILE_PCRE16
2069  extern int               _pcre_valid_utf8(PCRE_PUCHAR, int, int *);  extern int               PRIV(valid_utf8)(PCRE_PUCHAR, int, int *);
2070  #else  #else
2071  extern int               _pcre16_valid_utf16(PCRE_PUCHAR, int, int *);  extern int               PRIV(valid_utf16)(PCRE_PUCHAR, int, int *);
2072  #endif  #endif
2073  extern BOOL              _pcre_was_newline(PCRE_PUCHAR, int, PCRE_PUCHAR,  extern BOOL              PRIV(was_newline)(PCRE_PUCHAR, int, PCRE_PUCHAR,
2074                             int *, BOOL);                             int *, BOOL);
2075  extern BOOL              _pcre_xclass(int, const pcre_uchar *);  extern BOOL              PRIV(xclass)(int, const pcre_uchar *);
2076    
2077  #ifdef SUPPORT_JIT  #ifdef SUPPORT_JIT
2078  extern void              _pcre_jit_compile(const real_pcre *, pcre_extra *);  extern void              PRIV(jit_compile)(const real_pcre *, pcre_extra *);
2079  extern int               _pcre_jit_exec(const real_pcre *, void *, PCRE_SPTR,  extern int               PRIV(jit_exec)(const real_pcre *, void *, PCRE_SPTR,
2080                             int, int, int, int, int *, int);                             int, int, int, int, int *, int);
2081  extern void              _pcre_jit_free(void *);  extern void              PRIV(jit_free)(void *);
2082  #endif  #endif
2083    
2084  /* Unicode character database (UCD) */  /* Unicode character database (UCD) */
# Line 2033  typedef struct { Line 2089  typedef struct {
2089    pcre_int32 other_case;    pcre_int32 other_case;
2090  } ucd_record;  } ucd_record;
2091    
2092  extern const ucd_record  _pcre_ucd_records[];  extern const ucd_record  PRIV(ucd_records)[];
2093  extern const pcre_uint8  _pcre_ucd_stage1[];  extern const pcre_uint8  PRIV(ucd_stage1)[];
2094  extern const pcre_uint16 _pcre_ucd_stage2[];  extern const pcre_uint16 PRIV(ucd_stage2)[];
2095  extern const int         _pcre_ucp_gentype[];  extern const int         PRIV(ucp_gentype)[];
2096  #ifdef SUPPORT_JIT  #ifdef SUPPORT_JIT
2097  extern const int         _pcre_ucp_typerange[];  extern const int         PRIV(ucp_typerange)[];
2098  #endif  #endif
2099    
2100  /* UCD access macros */  /* UCD access macros */
2101    
2102  #define UCD_BLOCK_SIZE 128  #define UCD_BLOCK_SIZE 128
2103  #define GET_UCD(ch) (_pcre_ucd_records + \  #define GET_UCD(ch) (PRIV(ucd_records) + \
2104          _pcre_ucd_stage2[_pcre_ucd_stage1[(ch) / UCD_BLOCK_SIZE] * \          PRIV(ucd_stage2)[PRIV(ucd_stage1)[(ch) / UCD_BLOCK_SIZE] * \
2105          UCD_BLOCK_SIZE + (ch) % UCD_BLOCK_SIZE])          UCD_BLOCK_SIZE + (ch) % UCD_BLOCK_SIZE])
2106    
2107  #define UCD_CHARTYPE(ch)  GET_UCD(ch)->chartype  #define UCD_CHARTYPE(ch)  GET_UCD(ch)->chartype
2108  #define UCD_SCRIPT(ch)    GET_UCD(ch)->script  #define UCD_SCRIPT(ch)    GET_UCD(ch)->script
2109  #define UCD_CATEGORY(ch)  _pcre_ucp_gentype[UCD_CHARTYPE(ch)]  #define UCD_CATEGORY(ch)  PRIV(ucp_gentype)[UCD_CHARTYPE(ch)]
2110  #define UCD_OTHERCASE(ch) (ch + GET_UCD(ch)->other_case)  #define UCD_OTHERCASE(ch) (ch + GET_UCD(ch)->other_case)
2111    
2112  #endif  #endif

Legend:
Removed from v.763  
changed lines
  Added in v.764

  ViewVC Help
Powered by ViewVC 1.1.5