/[pcre]/code/tags/pcre-8.11/pcreposix.c
ViewVC logotype

Diff of /code/tags/pcre-8.11/pcreposix.c

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

revision 336 by ph10, Sat Apr 12 15:59:03 2008 UTC revision 388 by ph10, Wed Mar 11 17:03:17 2009 UTC
# Line 6  Line 6 
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.
7    
8                         Written by Philip Hazel                         Written by Philip Hazel
9             Copyright (c) 1997-2008 University of Cambridge             Copyright (c) 1997-2009 University of Cambridge
10    
11  -----------------------------------------------------------------------------  -----------------------------------------------------------------------------
12  Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
# Line 160  static const char *const pstring[] = { Line 160  static const char *const pstring[] = {
160  *          Translate error code to string        *  *          Translate error code to string        *
161  *************************************************/  *************************************************/
162    
163  PCREPOSIX_EXP_DEFN size_t  PCREPOSIX_EXP_DEFN size_t PCRE_CALL_CONVENTION
164  regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)  regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)
165  {  {
166  const char *message, *addmessage;  const char *message, *addmessage;
# Line 195  return length + addlength; Line 195  return length + addlength;
195  *           Free store held by a regex           *  *           Free store held by a regex           *
196  *************************************************/  *************************************************/
197    
198  PCREPOSIX_EXP_DEFN void  PCREPOSIX_EXP_DEFN void PCRE_CALL_CONVENTION
199  regfree(regex_t *preg)  regfree(regex_t *preg)
200  {  {
201  (pcre_free)(preg->re_pcre);  (pcre_free)(preg->re_pcre);
# Line 218  Returns:      0 on success Line 218  Returns:      0 on success
218                various non-zero codes on failure                various non-zero codes on failure
219  */  */
220    
221  PCREPOSIX_EXP_DEFN int  PCREPOSIX_EXP_DEFN int PCRE_CALL_CONVENTION
222  regcomp(regex_t *preg, const char *pattern, int cflags)  regcomp(regex_t *preg, const char *pattern, int cflags)
223  {  {
224  const char *errorptr;  const char *errorptr;
# Line 260  If REG_NOSUB was specified at compile ti Line 260  If REG_NOSUB was specified at compile ti
260  be set. When this is the case, the nmatch and pmatch arguments are ignored, and  be set. When this is the case, the nmatch and pmatch arguments are ignored, and
261  the only result is yes/no/error. */  the only result is yes/no/error. */
262    
263  PCREPOSIX_EXP_DEFN int  PCREPOSIX_EXP_DEFN int PCRE_CALL_CONVENTION
264  regexec(const regex_t *preg, const char *string, size_t nmatch,  regexec(const regex_t *preg, const char *string, size_t nmatch,
265    regmatch_t pmatch[], int eflags)    regmatch_t pmatch[], int eflags)
266  {  {
# Line 274  BOOL nosub = Line 274  BOOL nosub =
274    
275  if ((eflags & REG_NOTBOL) != 0) options |= PCRE_NOTBOL;  if ((eflags & REG_NOTBOL) != 0) options |= PCRE_NOTBOL;
276  if ((eflags & REG_NOTEOL) != 0) options |= PCRE_NOTEOL;  if ((eflags & REG_NOTEOL) != 0) options |= PCRE_NOTEOL;
277    if ((eflags & REG_NOTEMPTY) != 0) options |= PCRE_NOTEMPTY;
278    
279  ((regex_t *)preg)->re_erroffset = (size_t)(-1);  /* Only has meaning after compile */  ((regex_t *)preg)->re_erroffset = (size_t)(-1);  /* Only has meaning after compile */
280    
# Line 299  else if (nmatch > 0) Line 300  else if (nmatch > 0)
300    
301  /* REG_STARTEND is a BSD extension, to allow for non-NUL-terminated strings.  /* REG_STARTEND is a BSD extension, to allow for non-NUL-terminated strings.
302  The man page from OS X says "REG_STARTEND affects only the location of the  The man page from OS X says "REG_STARTEND affects only the location of the
303  string, not how it is matched". That is why the "so" value is used to bump the  string, not how it is matched". That is why the "so" value is used to bump the
304  start location rather than being passed as a PCRE "starting offset". */  start location rather than being passed as a PCRE "starting offset". */
305    
306  if ((eflags & REG_STARTEND) != 0)  if ((eflags & REG_STARTEND) != 0)
307    {    {
308    so = pmatch[0].rm_so;    so = pmatch[0].rm_so;
309    eo = pmatch[0].rm_eo;    eo = pmatch[0].rm_eo;
310    }    }
311  else  else
312    {    {
313    so = 0;    so = 0;
314    eo = strlen(string);    eo = strlen(string);

Legend:
Removed from v.336  
changed lines
  Added in v.388

  ViewVC Help
Powered by ViewVC 1.1.5