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

Diff of /code/trunk/pcre_fullinfo.c

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

revision 145 by ph10, Wed Apr 4 14:06:52 2007 UTC revision 788 by ph10, Tue Dec 6 15:38:01 2011 UTC
# Line 2  Line 2 
2  *      Perl-Compatible Regular Expressions       *  *      Perl-Compatible Regular Expressions       *
3  *************************************************/  *************************************************/
4    
5  /*PCRE is a library of functions to support regular expressions whose syntax  /* PCRE is a library of functions to support regular expressions whose syntax
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-2007 University of Cambridge             Copyright (c) 1997-2011 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 42  POSSIBILITY OF SUCH DAMAGE. Line 42  POSSIBILITY OF SUCH DAMAGE.
42  information about a compiled pattern. */  information about a compiled pattern. */
43    
44    
45    #ifdef HAVE_CONFIG_H
46    #include "config.h"
47    #endif
48    
49  #include "pcre_internal.h"  #include "pcre_internal.h"
50    
51    
# Line 61  Arguments: Line 65  Arguments:
65  Returns:           0 if data returned, negative on error  Returns:           0 if data returned, negative on error
66  */  */
67    
68  PCRE_EXP_DEFN int  PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
69  pcre_fullinfo(const pcre *argument_re, const pcre_extra *extra_data, int what,  pcre_fullinfo(const pcre *argument_re, const pcre_extra *extra_data, int what,
70    void *where)    void *where)
71  {  {
# Line 85  if (re->magic_number != MAGIC_NUMBER) Line 89  if (re->magic_number != MAGIC_NUMBER)
89  switch (what)  switch (what)
90    {    {
91    case PCRE_INFO_OPTIONS:    case PCRE_INFO_OPTIONS:
92    *((unsigned long int *)where) = re->options & PUBLIC_OPTIONS;    *((unsigned long int *)where) = re->options & PUBLIC_COMPILE_OPTIONS;
93    break;    break;
94    
95    case PCRE_INFO_SIZE:    case PCRE_INFO_SIZE:
# Line 96  switch (what) Line 100  switch (what)
100    *((size_t *)where) = (study == NULL)? 0 : study->size;    *((size_t *)where) = (study == NULL)? 0 : study->size;
101    break;    break;
102    
103      case PCRE_INFO_JITSIZE:
104    #ifdef SUPPORT_JIT
105      *((size_t *)where) =
106          (extra_data != NULL &&
107          (extra_data->flags & PCRE_EXTRA_EXECUTABLE_JIT) != 0 &&
108          extra_data->executable_jit != NULL)?
109        _pcre_jit_get_size(extra_data->executable_jit) : 0;
110    #else
111      *((size_t *)where) = 0;
112    #endif
113    
114      break;
115    
116    case PCRE_INFO_CAPTURECOUNT:    case PCRE_INFO_CAPTURECOUNT:
117    *((int *)where) = re->top_bracket;    *((int *)where) = re->top_bracket;
118    break;    break;
# Line 106  switch (what) Line 123  switch (what)
123    
124    case PCRE_INFO_FIRSTBYTE:    case PCRE_INFO_FIRSTBYTE:
125    *((int *)where) =    *((int *)where) =
126      ((re->options & PCRE_FIRSTSET) != 0)? re->first_byte :      ((re->flags & PCRE_FIRSTSET) != 0)? re->first_byte :
127      ((re->options & PCRE_STARTLINE) != 0)? -1 : -2;      ((re->flags & PCRE_STARTLINE) != 0)? -1 : -2;
128    break;    break;
129    
130    /* Make sure we pass back the pointer to the bit vector in the external    /* Make sure we pass back the pointer to the bit vector in the external
# Line 115  switch (what) Line 132  switch (what)
132    
133    case PCRE_INFO_FIRSTTABLE:    case PCRE_INFO_FIRSTTABLE:
134    *((const uschar **)where) =    *((const uschar **)where) =
135      (study != NULL && (study->options & PCRE_STUDY_MAPPED) != 0)?      (study != NULL && (study->flags & PCRE_STUDY_MAPPED) != 0)?
136        ((const pcre_study_data *)extra_data->study_data)->start_bits : NULL;        ((const pcre_study_data *)extra_data->study_data)->start_bits : NULL;
137    break;    break;
138    
139      case PCRE_INFO_MINLENGTH:
140      *((int *)where) =
141        (study != NULL && (study->flags & PCRE_STUDY_MINLEN) != 0)?
142          study->minlength : -1;
143      break;
144    
145      case PCRE_INFO_JIT:
146      *((int *)where) = extra_data != NULL &&
147                        (extra_data->flags & PCRE_EXTRA_EXECUTABLE_JIT) != 0 &&
148                        extra_data->executable_jit != NULL;
149      break;
150    
151    case PCRE_INFO_LASTLITERAL:    case PCRE_INFO_LASTLITERAL:
152    *((int *)where) =    *((int *)where) =
153      ((re->options & PCRE_REQCHSET) != 0)? re->req_byte : -1;      ((re->flags & PCRE_REQCHSET) != 0)? re->req_byte : -1;
154    break;    break;
155    
156    case PCRE_INFO_NAMEENTRYSIZE:    case PCRE_INFO_NAMEENTRYSIZE:
# Line 140  switch (what) Line 169  switch (what)
169    *((const uschar **)where) = (const uschar *)(_pcre_default_tables);    *((const uschar **)where) = (const uschar *)(_pcre_default_tables);
170    break;    break;
171    
172      /* From release 8.00 this will always return TRUE because NOPARTIAL is
173      no longer ever set (the restrictions have been removed). */
174    
175      case PCRE_INFO_OKPARTIAL:
176      *((int *)where) = (re->flags & PCRE_NOPARTIAL) == 0;
177      break;
178    
179      case PCRE_INFO_JCHANGED:
180      *((int *)where) = (re->flags & PCRE_JCHANGED) != 0;
181      break;
182    
183      case PCRE_INFO_HASCRORLF:
184      *((int *)where) = (re->flags & PCRE_HASCRORLF) != 0;
185      break;
186    
187    default: return PCRE_ERROR_BADOPTION;    default: return PCRE_ERROR_BADOPTION;
188    }    }
189    

Legend:
Removed from v.145  
changed lines
  Added in v.788

  ViewVC Help
Powered by ViewVC 1.1.5