| 
version 1.1, 2012/02/21 23:05:51
 | 
version 1.1.1.5, 2014/06/15 19:46:03
 | 
| 
 Line 6
 | 
 Line 6
 | 
 |  and semantics are as close as possible to those of the Perl 5 language. | 
  and semantics are as close as possible to those of the Perl 5 language. | 
 |   | 
   | 
 |                         Written by Philip Hazel | 
                         Written by Philip Hazel | 
|            Copyright (c) 1997-2010 University of Cambridge |            Copyright (c) 1997-2012 University of Cambridge | 
 |   | 
   | 
 |  ----------------------------------------------------------------------------- | 
  ----------------------------------------------------------------------------- | 
 |  Redistribution and use in source and binary forms, with or without | 
  Redistribution and use in source and binary forms, with or without | 
| 
 Line 110  static const int eint[] = {
 | 
 Line 110  static const int eint[] = {
 | 
 |    REG_BADPAT,  /* POSIX collating elements are not supported */ | 
    REG_BADPAT,  /* POSIX collating elements are not supported */ | 
 |    REG_INVARG,  /* this version of PCRE is not compiled with PCRE_UTF8 support */ | 
    REG_INVARG,  /* this version of PCRE is not compiled with PCRE_UTF8 support */ | 
 |    REG_BADPAT,  /* spare error */ | 
    REG_BADPAT,  /* spare error */ | 
|   REG_BADPAT,  /* character value in \x{...} sequence is too large */ |   REG_BADPAT,  /* character value in \x{} or \o{} is too large */ | 
 |    /* 35 */ | 
    /* 35 */ | 
 |    REG_BADPAT,  /* invalid condition (?(0) */ | 
    REG_BADPAT,  /* invalid condition (?(0) */ | 
 |    REG_BADPAT,  /* \C not allowed in lookbehind assertion */ | 
    REG_BADPAT,  /* \C not allowed in lookbehind assertion */ | 
| 
 Line 157  static const int eint[] = {
 | 
 Line 157  static const int eint[] = {
 | 
 |    REG_BADPAT,  /* internal error: unknown opcode in find_fixedlength() */ | 
    REG_BADPAT,  /* internal error: unknown opcode in find_fixedlength() */ | 
 |    REG_BADPAT,  /* \N is not supported in a class */ | 
    REG_BADPAT,  /* \N is not supported in a class */ | 
 |    REG_BADPAT,  /* too many forward references */ | 
    REG_BADPAT,  /* too many forward references */ | 
 |   | 
    REG_BADPAT,  /* disallowed UTF-8/16/32 code point (>= 0xd800 && <= 0xdfff) */ | 
 |   | 
    REG_BADPAT,  /* invalid UTF-16 string (should not occur) */ | 
 |   | 
    /* 75 */ | 
 |   | 
    REG_BADPAT,  /* overlong MARK name */ | 
 |   | 
    REG_BADPAT,  /* character value in \u.... sequence is too large */ | 
 |   | 
    REG_BADPAT,  /* invalid UTF-32 string (should not occur) */ | 
 |   | 
    REG_BADPAT,  /* setting UTF is disabled by the application */ | 
 |   | 
    REG_BADPAT,  /* non-hex character in \\x{} (closing brace missing?) */ | 
 |   | 
    /* 80 */ | 
 |   | 
    REG_BADPAT,  /* non-octal character in \o{} (closing brace missing?) */ | 
 |   | 
    REG_BADPAT,  /* missing opening brace after \o */ | 
 |   | 
    REG_BADPAT,  /* parentheses too deeply nested */ | 
 |   | 
    REG_BADPAT,  /* invalid range in character class */ | 
 |   | 
    REG_BADPAT   /* group name must start with a non-digit */ | 
 |  }; | 
  }; | 
 |   | 
   | 
 |  /* Table of texts corresponding to POSIX error codes */ | 
  /* Table of texts corresponding to POSIX error codes */ | 
| 
 Line 227  return length + addlength;
 | 
 Line 241  return length + addlength;
 | 
 |  PCREPOSIX_EXP_DEFN void PCRE_CALL_CONVENTION | 
  PCREPOSIX_EXP_DEFN void PCRE_CALL_CONVENTION | 
 |  regfree(regex_t *preg) | 
  regfree(regex_t *preg) | 
 |  { | 
  { | 
| (pcre_free)(preg->re_pcre); | (PUBL(free))(preg->re_pcre); | 
 |  } | 
  } | 
 |   | 
   | 
 |   | 
   | 
| 
 Line 254  const char *errorptr;
 | 
 Line 268  const char *errorptr;
 | 
 |  int erroffset; | 
  int erroffset; | 
 |  int errorcode; | 
  int errorcode; | 
 |  int options = 0; | 
  int options = 0; | 
 |   | 
  int re_nsub = 0; | 
 |   | 
   | 
 |  if ((cflags & REG_ICASE) != 0)    options |= PCRE_CASELESS; | 
  if ((cflags & REG_ICASE) != 0)    options |= PCRE_CASELESS; | 
 |  if ((cflags & REG_NEWLINE) != 0)  options |= PCRE_MULTILINE; | 
  if ((cflags & REG_NEWLINE) != 0)  options |= PCRE_MULTILINE; | 
| 
 Line 272  should not happen, but we all make mistakes), return R
 | 
 Line 287  should not happen, but we all make mistakes), return R
 | 
 |   | 
   | 
 |  if (preg->re_pcre == NULL) | 
  if (preg->re_pcre == NULL) | 
 |    { | 
    { | 
|   return (errorcode < sizeof(eint)/sizeof(const int))? |   return (errorcode < (int)(sizeof(eint)/sizeof(const int)))? | 
 |      eint[errorcode] : REG_BADPAT; | 
      eint[errorcode] : REG_BADPAT; | 
 |    } | 
    } | 
 |   | 
   | 
| preg->re_nsub = pcre_info((const pcre *)preg->re_pcre, NULL, NULL); | (void)pcre_fullinfo((const pcre *)preg->re_pcre, NULL, PCRE_INFO_CAPTURECOUNT, | 
|   |   &re_nsub); | 
|   | preg->re_nsub = (size_t)re_nsub; | 
 |  return 0; | 
  return 0; | 
 |  } | 
  } | 
 |   | 
   | 
| 
 Line 308  int *ovector = NULL;
 | 
 Line 325  int *ovector = NULL;
 | 
 |  int small_ovector[POSIX_MALLOC_THRESHOLD * 3]; | 
  int small_ovector[POSIX_MALLOC_THRESHOLD * 3]; | 
 |  BOOL allocated_ovector = FALSE; | 
  BOOL allocated_ovector = FALSE; | 
 |  BOOL nosub = | 
  BOOL nosub = | 
|   (((const pcre *)preg->re_pcre)->options & PCRE_NO_AUTO_CAPTURE) != 0; |   (REAL_PCRE_OPTIONS((const pcre *)preg->re_pcre) & PCRE_NO_AUTO_CAPTURE) != 0; | 
 |   | 
   | 
 |  if ((eflags & REG_NOTBOL) != 0) options |= PCRE_NOTBOL; | 
  if ((eflags & REG_NOTBOL) != 0) options |= PCRE_NOTBOL; | 
 |  if ((eflags & REG_NOTEOL) != 0) options |= PCRE_NOTEOL; | 
  if ((eflags & REG_NOTEOL) != 0) options |= PCRE_NOTEOL; | 
| 
 Line 402  switch(rc)
 | 
 Line 419  switch(rc)
 | 
 |    case PCRE_ERROR_MATCHLIMIT: return REG_ESPACE; | 
    case PCRE_ERROR_MATCHLIMIT: return REG_ESPACE; | 
 |    case PCRE_ERROR_BADUTF8: return REG_INVARG; | 
    case PCRE_ERROR_BADUTF8: return REG_INVARG; | 
 |    case PCRE_ERROR_BADUTF8_OFFSET: return REG_INVARG; | 
    case PCRE_ERROR_BADUTF8_OFFSET: return REG_INVARG; | 
 |   | 
    case PCRE_ERROR_BADMODE: return REG_INVARG; | 
 |    default: return REG_ASSERT; | 
    default: return REG_ASSERT; | 
 |    } | 
    } | 
 |  } | 
  } |