/[pcre]/code/trunk/pcre_study.c
ViewVC logotype

Diff of /code/trunk/pcre_study.c

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

revision 1054 by ph10, Mon Sep 10 11:02:48 2012 UTC revision 1055 by chpe, Tue Oct 16 15:53:30 2012 UTC
# Line 224  for (;;) Line 224  for (;;)
224      case OP_NOTPOSPLUSI:      case OP_NOTPOSPLUSI:
225      branchlength++;      branchlength++;
226      cc += 2;      cc += 2;
227  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
228      if (utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);      if (utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
229  #endif  #endif
230      break;      break;
# Line 245  for (;;) Line 245  for (;;)
245      case OP_NOTEXACTI:      case OP_NOTEXACTI:
246      branchlength += GET2(cc,1);      branchlength += GET2(cc,1);
247      cc += 2 + IMM2_SIZE;      cc += 2 + IMM2_SIZE;
248  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
249      if (utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);      if (utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
250  #endif  #endif
251      break;      break;
# Line 486  for (;;) Line 486  for (;;)
486      case OP_NOTPOSQUERYI:      case OP_NOTPOSQUERYI:
487    
488      cc += PRIV(OP_lengths)[op];      cc += PRIV(OP_lengths)[op];
489  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
490      if (utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);      if (utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
491  #endif  #endif
492      break;      break;
# Line 538  Arguments: Line 538  Arguments:
538    p             points to the character    p             points to the character
539    caseless      the caseless flag    caseless      the caseless flag
540    cd            the block with char table pointers    cd            the block with char table pointers
541    utf           TRUE for UTF-8 / UTF-16 mode    utf           TRUE for UTF-8 / UTF-16 / UTF-32 mode
542    
543  Returns:        pointer after the character  Returns:        pointer after the character
544  */  */
# Line 577  if (caseless && (cd->ctypes[c] & ctype_l Line 577  if (caseless && (cd->ctypes[c] & ctype_l
577  return p + 1;  return p + 1;
578  #endif  /* COMPILE_PCRE8 */  #endif  /* COMPILE_PCRE8 */
579    
580  #ifdef COMPILE_PCRE16  #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
581  if (c > 0xff)  if (c > 0xff)
582    {    {
583    c = 0xff;    c = 0xff;
# Line 701  function fails unless the result is SSB_ Line 701  function fails unless the result is SSB_
701  Arguments:  Arguments:
702    code         points to an expression    code         points to an expression
703    start_bits   points to a 32-byte table, initialized to 0    start_bits   points to a 32-byte table, initialized to 0
704    utf          TRUE if in UTF-8 / UTF-16 mode    utf          TRUE if in UTF-8 / UTF-16 / UTF-32 mode
705    cd           the block with char table pointers    cd           the block with char table pointers
706    
707  Returns:       SSB_FAIL     => Failed to find any starting bytes  Returns:       SSB_FAIL     => Failed to find any starting bytes
# Line 1000  do Line 1000  do
1000          SET_BIT(0xE1);  /* For U+1680, U+180E */          SET_BIT(0xE1);  /* For U+1680, U+180E */
1001          SET_BIT(0xE2);  /* For U+2000 - U+200A, U+202F, U+205F */          SET_BIT(0xE2);  /* For U+2000 - U+200A, U+202F, U+205F */
1002          SET_BIT(0xE3);  /* For U+3000 */          SET_BIT(0xE3);  /* For U+3000 */
1003  #endif  /* COMPILE_PCRE8 */  #elif defined COMPILE_PCRE16 || defined COMPILE_PCRE32
 #ifdef COMPILE_PCRE16  
1004          SET_BIT(0xA0);          SET_BIT(0xA0);
1005          SET_BIT(0xFF);  /* For characters > 255 */          SET_BIT(0xFF);  /* For characters > 255 */
1006  #endif  /* COMPILE_PCRE16 */  #endif  /* COMPILE_PCRE[8|16|32] */
1007          }          }
1008        else        else
1009  #endif /* SUPPORT_UTF */  #endif /* SUPPORT_UTF */
# Line 1012  do Line 1011  do
1011  #ifndef EBCDIC  #ifndef EBCDIC
1012          SET_BIT(0xA0);          SET_BIT(0xA0);
1013  #endif  /* Not EBCDIC */  #endif  /* Not EBCDIC */
1014  #ifdef COMPILE_PCRE16  #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
1015          SET_BIT(0xFF);  /* For characters > 255 */          SET_BIT(0xFF);  /* For characters > 255 */
1016  #endif  /* COMPILE_PCRE16 */  #endif  /* COMPILE_PCRE[16|32] */
1017          }          }
1018        try_next = FALSE;        try_next = FALSE;
1019        break;        break;
# Line 1031  do Line 1030  do
1030  #ifdef COMPILE_PCRE8  #ifdef COMPILE_PCRE8
1031          SET_BIT(0xC2);  /* For U+0085 */          SET_BIT(0xC2);  /* For U+0085 */
1032          SET_BIT(0xE2);  /* For U+2028, U+2029 */          SET_BIT(0xE2);  /* For U+2028, U+2029 */
1033  #endif  /* COMPILE_PCRE8 */  #elif defined COMPILE_PCRE16 || defined COMPILE_PCRE32
 #ifdef COMPILE_PCRE16  
1034          SET_BIT(CHAR_NEL);          SET_BIT(CHAR_NEL);
1035          SET_BIT(0xFF);  /* For characters > 255 */          SET_BIT(0xFF);  /* For characters > 255 */
1036  #endif  /* COMPILE_PCRE16 */  #endif  /* COMPILE_PCRE[8|16|32] */
1037          }          }
1038        else        else
1039  #endif /* SUPPORT_UTF */  #endif /* SUPPORT_UTF */
1040          {          {
1041          SET_BIT(CHAR_NEL);          SET_BIT(CHAR_NEL);
1042  #ifdef COMPILE_PCRE16  #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
1043          SET_BIT(0xFF);  /* For characters > 255 */          SET_BIT(0xFF);  /* For characters > 255 */
1044  #endif  #endif
1045          }          }
# Line 1139  do Line 1137  do
1137            SET_BIT(0xE1);  /* For U+1680, U+180E */            SET_BIT(0xE1);  /* For U+1680, U+180E */
1138            SET_BIT(0xE2);  /* For U+2000 - U+200A, U+202F, U+205F */            SET_BIT(0xE2);  /* For U+2000 - U+200A, U+202F, U+205F */
1139            SET_BIT(0xE3);  /* For U+3000 */            SET_BIT(0xE3);  /* For U+3000 */
1140  #endif  /* COMPILE_PCRE8 */  #elif defined COMPILE_PCRE16 || defined COMPILE_PCRE32
 #ifdef COMPILE_PCRE16  
1141            SET_BIT(0xA0);            SET_BIT(0xA0);
1142            SET_BIT(0xFF);  /* For characters > 255 */            SET_BIT(0xFF);  /* For characters > 255 */
1143  #endif  /* COMPILE_PCRE16 */  #endif  /* COMPILE_PCRE[8|16|32] */
1144            }            }
1145          else          else
1146  #endif /* SUPPORT_UTF */  #endif /* SUPPORT_UTF */
# Line 1164  do Line 1161  do
1161  #ifdef COMPILE_PCRE8  #ifdef COMPILE_PCRE8
1162            SET_BIT(0xC2);  /* For U+0085 */            SET_BIT(0xC2);  /* For U+0085 */
1163            SET_BIT(0xE2);  /* For U+2028, U+2029 */            SET_BIT(0xE2);  /* For U+2028, U+2029 */
1164  #endif  /* COMPILE_PCRE8 */  #elif defined COMPILE_PCRE16 || defined COMPILE_PCRE32
 #ifdef COMPILE_PCRE16  
1165            SET_BIT(CHAR_NEL);            SET_BIT(CHAR_NEL);
1166            SET_BIT(0xFF);  /* For characters > 255 */            SET_BIT(0xFF);  /* For characters > 255 */
1167  #endif  /* COMPILE_PCRE16 */  #endif  /* COMPILE_PCRE16 */
# Line 1229  do Line 1225  do
1225          memset(start_bits+25, 0xff, 7);      /* Bits for 0xc9 - 0xff */          memset(start_bits+25, 0xff, 7);      /* Bits for 0xc9 - 0xff */
1226          }          }
1227  #endif  #endif
1228  #ifdef COMPILE_PCRE16  #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
1229        SET_BIT(0xFF);                         /* For characters > 255 */        SET_BIT(0xFF);                         /* For characters > 255 */
1230  #endif  #endif
1231        /* Fall through */        /* Fall through */
# Line 1325  Returns:    pointer to a pcre[16]_extra Line 1321  Returns:    pointer to a pcre[16]_extra
1321              NULL on error or if no optimization possible              NULL on error or if no optimization possible
1322  */  */
1323    
1324  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
1325  PCRE_EXP_DEFN pcre_extra * PCRE_CALL_CONVENTION  PCRE_EXP_DEFN pcre_extra * PCRE_CALL_CONVENTION
1326  pcre_study(const pcre *external_re, int options, const char **errorptr)  pcre_study(const pcre *external_re, int options, const char **errorptr)
1327  #else  #elif defined COMPILE_PCRE16
1328  PCRE_EXP_DEFN pcre16_extra * PCRE_CALL_CONVENTION  PCRE_EXP_DEFN pcre16_extra * PCRE_CALL_CONVENTION
1329  pcre16_study(const pcre16 *external_re, int options, const char **errorptr)  pcre16_study(const pcre16 *external_re, int options, const char **errorptr)
1330    #elif defined COMPILE_PCRE32
1331    PCRE_EXP_DEFN pcre32_extra * PCRE_CALL_CONVENTION
1332    pcre32_study(const pcre32 *external_re, int options, const char **errorptr)
1333  #endif  #endif
1334  {  {
1335  int min;  int min;
# Line 1353  if (re == NULL || re->magic_number != MA Line 1352  if (re == NULL || re->magic_number != MA
1352    
1353  if ((re->flags & PCRE_MODE) == 0)  if ((re->flags & PCRE_MODE) == 0)
1354    {    {
1355  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
1356    *errorptr = "argument is compiled in 16 bit mode";    *errorptr = "argument not compiled in 8 bit mode";
1357  #else  #elif defined COMPILE_PCRE16
1358    *errorptr = "argument is compiled in 8 bit mode";    *errorptr = "argument not compiled in 16 bit mode";
1359    #elif defined COMPILE_PCRE32
1360      *errorptr = "argument not compiled in 32 bit mode";
1361  #endif  #endif
1362    return NULL;    return NULL;
1363    }    }
# Line 1383  if ((re->options & PCRE_ANCHORED) == 0 & Line 1384  if ((re->options & PCRE_ANCHORED) == 0 &
1384    
1385    tables = re->tables;    tables = re->tables;
1386    
1387  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
1388    if (tables == NULL)    if (tables == NULL)
1389      (void)pcre_fullinfo(external_re, NULL, PCRE_INFO_DEFAULT_TABLES,      (void)pcre_fullinfo(external_re, NULL, PCRE_INFO_DEFAULT_TABLES,
1390      (void *)(&tables));      (void *)(&tables));
1391  #else  #elif defined COMPILE_PCRE16
1392    if (tables == NULL)    if (tables == NULL)
1393      (void)pcre16_fullinfo(external_re, NULL, PCRE_INFO_DEFAULT_TABLES,      (void)pcre16_fullinfo(external_re, NULL, PCRE_INFO_DEFAULT_TABLES,
1394      (void *)(&tables));      (void *)(&tables));
1395    #elif defined COMPILE_PCRE32
1396      if (tables == NULL)
1397        (void)pcre32_fullinfo(external_re, NULL, PCRE_INFO_DEFAULT_TABLES,
1398        (void *)(&tables));
1399  #endif  #endif
1400    
1401    compile_block.lcc = tables + lcc_offset;    compile_block.lcc = tables + lcc_offset;
# Line 1503  if (bits_set || min > 0 || (options & ( Line 1508  if (bits_set || min > 0 || (options & (
1508    if (study->flags == 0 && (extra->flags & PCRE_EXTRA_EXECUTABLE_JIT) == 0 &&    if (study->flags == 0 && (extra->flags & PCRE_EXTRA_EXECUTABLE_JIT) == 0 &&
1509        (options & PCRE_STUDY_EXTRA_NEEDED) == 0)        (options & PCRE_STUDY_EXTRA_NEEDED) == 0)
1510      {      {
1511  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
1512      pcre_free_study(extra);      pcre_free_study(extra);
1513  #endif  #elif defined COMPILE_PCRE16
 #ifdef COMPILE_PCRE16  
1514      pcre16_free_study(extra);      pcre16_free_study(extra);
1515    #elif defined COMPILE_PCRE32
1516        pcre32_free_study(extra);
1517  #endif  #endif
1518      extra = NULL;      extra = NULL;
1519      }      }
# Line 1528  Argument:   a pointer to the pcre[16]_ex Line 1534  Argument:   a pointer to the pcre[16]_ex
1534  Returns:    nothing  Returns:    nothing
1535  */  */
1536    
1537  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
1538  PCRE_EXP_DEFN void  PCRE_EXP_DEFN void
1539  pcre_free_study(pcre_extra *extra)  pcre_free_study(pcre_extra *extra)
1540  #else  #elif defined COMPILE_PCRE16
1541  PCRE_EXP_DEFN void  PCRE_EXP_DEFN void
1542  pcre16_free_study(pcre16_extra *extra)  pcre16_free_study(pcre16_extra *extra)
1543    #elif defined COMPILE_PCRE32
1544    PCRE_EXP_DEFN void
1545    pcre32_free_study(pcre32_extra *extra)
1546  #endif  #endif
1547  {  {
1548  if (extra == NULL)  if (extra == NULL)

Legend:
Removed from v.1054  
changed lines
  Added in v.1055

  ViewVC Help
Powered by ViewVC 1.1.5