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

Diff of /code/trunk/pcre_get.c

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

revision 91 by nigel, Sat Feb 24 21:41:34 2007 UTC revision 359 by ph10, Wed Jul 9 16:20:19 2008 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-2006 University of Cambridge             Copyright (c) 1997-2008 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 43  from the subject string after a regex ma Line 43  from the subject string after a regex ma
43  for these functions came from Scott Wimer. */  for these functions came from Scott Wimer. */
44    
45    
46    #ifdef HAVE_CONFIG_H
47    #include "config.h"
48    #endif
49    
50  #include "pcre_internal.h"  #include "pcre_internal.h"
51    
52    
# Line 61  Returns:      the number of the named pa Line 65  Returns:      the number of the named pa
65                  (PCRE_ERROR_NOSUBSTRING) if not found                  (PCRE_ERROR_NOSUBSTRING) if not found
66  */  */
67    
68  int  PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
69  pcre_get_stringnumber(const pcre *code, const char *stringname)  pcre_get_stringnumber(const pcre *code, const char *stringname)
70  {  {
71  int rc;  int rc;
# Line 110  Returns:      the length of each entry, Line 114  Returns:      the length of each entry,
114                  (PCRE_ERROR_NOSUBSTRING) if not found                  (PCRE_ERROR_NOSUBSTRING) if not found
115  */  */
116    
117  int  PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
118  pcre_get_stringtable_entries(const pcre *code, const char *stringname,  pcre_get_stringtable_entries(const pcre *code, const char *stringname,
119    char **firstptr, char **lastptr)    char **firstptr, char **lastptr)
120  {  {
# Line 185  const real_pcre *re = (const real_pcre * Line 189  const real_pcre *re = (const real_pcre *
189  int entrysize;  int entrysize;
190  char *first, *last;  char *first, *last;
191  uschar *entry;  uschar *entry;
192  if ((re->options & (PCRE_DUPNAMES | PCRE_JCHANGED)) == 0)  if ((re->options & PCRE_DUPNAMES) == 0 && (re->flags & PCRE_JCHANGED) == 0)
193    return pcre_get_stringnumber(code, stringname);    return pcre_get_stringnumber(code, stringname);
194  entrysize = pcre_get_stringtable_entries(code, stringname, &first, &last);  entrysize = pcre_get_stringtable_entries(code, stringname, &first, &last);
195  if (entrysize <= 0) return entrysize;  if (entrysize <= 0) return entrysize;
# Line 227  Returns:         if successful: Line 231  Returns:         if successful:
231                     PCRE_ERROR_NOSUBSTRING (-7) no such captured substring                     PCRE_ERROR_NOSUBSTRING (-7) no such captured substring
232  */  */
233    
234  int  PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
235  pcre_copy_substring(const char *subject, int *ovector, int stringcount,  pcre_copy_substring(const char *subject, int *ovector, int stringcount,
236    int stringnumber, char *buffer, int size)    int stringnumber, char *buffer, int size)
237  {  {
# Line 272  Returns:         if successful: Line 276  Returns:         if successful:
276                     PCRE_ERROR_NOSUBSTRING (-7) no such captured substring                     PCRE_ERROR_NOSUBSTRING (-7) no such captured substring
277  */  */
278    
279  int  PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
280  pcre_copy_named_substring(const pcre *code, const char *subject, int *ovector,  pcre_copy_named_substring(const pcre *code, const char *subject, int *ovector,
281    int stringcount, const char *stringname, char *buffer, int size)    int stringcount, const char *stringname, char *buffer, int size)
282  {  {
# Line 304  Returns:         if successful: 0 Line 308  Returns:         if successful: 0
308                     PCRE_ERROR_NOMEMORY (-6) failed to get store                     PCRE_ERROR_NOMEMORY (-6) failed to get store
309  */  */
310    
311  int  PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
312  pcre_get_substring_list(const char *subject, int *ovector, int stringcount,  pcre_get_substring_list(const char *subject, int *ovector, int stringcount,
313    const char ***listptr)    const char ***listptr)
314  {  {
# Line 349  Argument:   the result of a previous pcr Line 353  Argument:   the result of a previous pcr
353  Returns:    nothing  Returns:    nothing
354  */  */
355    
356  void  PCRE_EXP_DEFN void PCRE_CALL_CONVENTION
357  pcre_free_substring_list(const char **pointer)  pcre_free_substring_list(const char **pointer)
358  {  {
359  (pcre_free)((void *)pointer);  (pcre_free)((void *)pointer);
# Line 382  Returns:         if successful: Line 386  Returns:         if successful:
386                     PCRE_ERROR_NOSUBSTRING (-7) substring not present                     PCRE_ERROR_NOSUBSTRING (-7) substring not present
387  */  */
388    
389  int  PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
390  pcre_get_substring(const char *subject, int *ovector, int stringcount,  pcre_get_substring(const char *subject, int *ovector, int stringcount,
391    int stringnumber, const char **stringptr)    int stringnumber, const char **stringptr)
392  {  {
# Line 429  Returns:         if successful: Line 433  Returns:         if successful:
433                     PCRE_ERROR_NOSUBSTRING (-7) no such captured substring                     PCRE_ERROR_NOSUBSTRING (-7) no such captured substring
434  */  */
435    
436  int  PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
437  pcre_get_named_substring(const pcre *code, const char *subject, int *ovector,  pcre_get_named_substring(const pcre *code, const char *subject, int *ovector,
438    int stringcount, const char *stringname, const char **stringptr)    int stringcount, const char *stringname, const char **stringptr)
439  {  {
440  int n = get_first_set(code, stringname, ovector);  int n = get_first_set(code, stringname, ovector);
441  if (n <= 0) return n;  if (n <= 0) return n;
442  return pcre_get_substring(subject, ovector, stringcount, n, stringptr);  return pcre_get_substring(subject, ovector, stringcount, n, stringptr);
   
443  }  }
444    
445    
# Line 453  Argument:   the result of a previous pcr Line 456  Argument:   the result of a previous pcr
456  Returns:    nothing  Returns:    nothing
457  */  */
458    
459  void  PCRE_EXP_DEFN void PCRE_CALL_CONVENTION
460  pcre_free_substring(const char *pointer)  pcre_free_substring(const char *pointer)
461  {  {
462  (pcre_free)((void *)pointer);  (pcre_free)((void *)pointer);

Legend:
Removed from v.91  
changed lines
  Added in v.359

  ViewVC Help
Powered by ViewVC 1.1.5