PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
regexport.h File Reference
#include "regex/regex.h"
Include dependency graph for regexport.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  regex_arc_t
 

Functions

int pg_reg_getnumstates (const regex_t *regex)
 
int pg_reg_getinitialstate (const regex_t *regex)
 
int pg_reg_getfinalstate (const regex_t *regex)
 
int pg_reg_getnumoutarcs (const regex_t *regex, int st)
 
void pg_reg_getoutarcs (const regex_t *regex, int st, regex_arc_t *arcs, int arcs_len)
 
int pg_reg_getnumcolors (const regex_t *regex)
 
int pg_reg_colorisbegin (const regex_t *regex, int co)
 
int pg_reg_colorisend (const regex_t *regex, int co)
 
int pg_reg_getnumcharacters (const regex_t *regex, int co)
 
void pg_reg_getcharacters (const regex_t *regex, int co, pg_wchar *chars, int chars_len)
 

Function Documentation

int pg_reg_colorisbegin ( const regex_t regex,
int  co 
)

Definition at line 191 of file regexport.c.

References assert, cnfa::bos, regex_t::re_guts, regex_t::re_magic, and REMAGIC.

Referenced by addKey().

192 {
193  struct cnfa *cnfa;
194 
195  assert(regex != NULL && regex->re_magic == REMAGIC);
196  cnfa = &((struct guts *) regex->re_guts)->search;
197 
198  if (co == cnfa->bos[0] || co == cnfa->bos[1])
199  return true;
200  else
201  return false;
202 }
Definition: regguts.h:354
#define REMAGIC
Definition: regguts.h:96
int re_magic
Definition: regex.h:57
#define assert(TEST)
Definition: imath.c:37
color bos[2]
Definition: regguts.h:362
Definition: regguts.h:462
char * re_guts
Definition: regex.h:78
int pg_reg_colorisend ( const regex_t regex,
int  co 
)

Definition at line 208 of file regexport.c.

References assert, cnfa::eos, regex_t::re_guts, regex_t::re_magic, and REMAGIC.

Referenced by addKey().

209 {
210  struct cnfa *cnfa;
211 
212  assert(regex != NULL && regex->re_magic == REMAGIC);
213  cnfa = &((struct guts *) regex->re_guts)->search;
214 
215  if (co == cnfa->eos[0] || co == cnfa->eos[1])
216  return true;
217  else
218  return false;
219 }
Definition: regguts.h:354
#define REMAGIC
Definition: regguts.h:96
int re_magic
Definition: regex.h:57
#define assert(TEST)
Definition: imath.c:37
Definition: regguts.h:462
char * re_guts
Definition: regex.h:78
color eos[2]
Definition: regguts.h:363
void pg_reg_getcharacters ( const regex_t regex,
int  co,
pg_wchar chars,
int  chars_len 
)

Definition at line 265 of file regexport.c.

References assert, colormap::cd, CHR_MIN, colordesc::flags, colormap::locolormap, colormap::max, MAX_SIMPLE_CHR, PSEUDO, regex_t::re_guts, regex_t::re_magic, and REMAGIC.

Referenced by getColorInfo().

267 {
268  struct colormap *cm;
269  chr c;
270 
271  assert(regex != NULL && regex->re_magic == REMAGIC);
272  cm = &((struct guts *) regex->re_guts)->cmap;
273 
274  if (co <= 0 || co > cm->max || chars_len <= 0)
275  return;
276  if (cm->cd[co].flags & PSEUDO)
277  return;
278 
279  /*
280  * We need only examine the low character map; there should not be any
281  * matching entries in the high map.
282  */
283  for (c = CHR_MIN; c <= MAX_SIMPLE_CHR; c++)
284  {
285  if (cm->locolormap[c - CHR_MIN] == co)
286  {
287  *chars++ = c;
288  if (--chars_len == 0)
289  break;
290  }
291  }
292 }
color * locolormap
Definition: regguts.h:218
#define REMAGIC
Definition: regguts.h:96
struct colordesc * cd
Definition: regguts.h:214
int re_magic
Definition: regex.h:57
pg_wchar chr
Definition: regcustom.h:68
char * c
#define assert(TEST)
Definition: imath.c:37
#define CHR_MIN
Definition: regcustom.h:74
Definition: regguts.h:462
int flags
Definition: regguts.h:162
char * re_guts
Definition: regex.h:78
#define PSEUDO
Definition: regguts.h:164
static char chars[TZ_MAX_CHARS]
Definition: zic.c:386
size_t max
Definition: regguts.h:212
#define MAX_SIMPLE_CHR
Definition: regcustom.h:97
int pg_reg_getfinalstate ( const regex_t regex)

Definition at line 64 of file regexport.c.

References assert, cnfa::post, regex_t::re_guts, regex_t::re_magic, and REMAGIC.

Referenced by addKey().

65 {
66  struct cnfa *cnfa;
67 
68  assert(regex != NULL && regex->re_magic == REMAGIC);
69  cnfa = &((struct guts *) regex->re_guts)->search;
70 
71  return cnfa->post;
72 }
Definition: regguts.h:354
#define REMAGIC
Definition: regguts.h:96
int re_magic
Definition: regex.h:57
#define assert(TEST)
Definition: imath.c:37
Definition: regguts.h:462
int post
Definition: regguts.h:361
char * re_guts
Definition: regex.h:78
int pg_reg_getinitialstate ( const regex_t regex)

Definition at line 50 of file regexport.c.

References assert, cnfa::pre, regex_t::re_guts, regex_t::re_magic, and REMAGIC.

Referenced by transformGraph().

51 {
52  struct cnfa *cnfa;
53 
54  assert(regex != NULL && regex->re_magic == REMAGIC);
55  cnfa = &((struct guts *) regex->re_guts)->search;
56 
57  return cnfa->pre;
58 }
Definition: regguts.h:354
int pre
Definition: regguts.h:360
#define REMAGIC
Definition: regguts.h:96
int re_magic
Definition: regex.h:57
#define assert(TEST)
Definition: imath.c:37
Definition: regguts.h:462
char * re_guts
Definition: regex.h:78
int pg_reg_getnumcharacters ( const regex_t regex,
int  co 
)

Definition at line 229 of file regexport.c.

References assert, colormap::cd, colordesc::flags, colormap::max, colordesc::nschrs, colordesc::nuchrs, PSEUDO, regex_t::re_guts, regex_t::re_magic, and REMAGIC.

Referenced by getColorInfo().

230 {
231  struct colormap *cm;
232 
233  assert(regex != NULL && regex->re_magic == REMAGIC);
234  cm = &((struct guts *) regex->re_guts)->cmap;
235 
236  if (co <= 0 || co > cm->max) /* we reject 0 which is WHITE */
237  return -1;
238  if (cm->cd[co].flags & PSEUDO) /* also pseudocolors (BOS etc) */
239  return -1;
240 
241  /*
242  * If the color appears anywhere in the high colormap, treat its number of
243  * members as uncertain. In principle we could determine all the specific
244  * chrs corresponding to each such entry, but it would be expensive
245  * (particularly if character class tests are required) and it doesn't
246  * seem worth it.
247  */
248  if (cm->cd[co].nuchrs != 0)
249  return -1;
250 
251  /* OK, return the known number of member chrs */
252  return cm->cd[co].nschrs;
253 }
#define REMAGIC
Definition: regguts.h:96
struct colordesc * cd
Definition: regguts.h:214
int re_magic
Definition: regex.h:57
#define assert(TEST)
Definition: imath.c:37
Definition: regguts.h:462
int nschrs
Definition: regguts.h:156
int flags
Definition: regguts.h:162
char * re_guts
Definition: regex.h:78
#define PSEUDO
Definition: regguts.h:164
int nuchrs
Definition: regguts.h:157
size_t max
Definition: regguts.h:212
int pg_reg_getnumcolors ( const regex_t regex)

Definition at line 174 of file regexport.c.

References assert, colormap::max, regex_t::re_guts, regex_t::re_magic, and REMAGIC.

Referenced by getColorInfo().

175 {
176  struct colormap *cm;
177 
178  assert(regex != NULL && regex->re_magic == REMAGIC);
179  cm = &((struct guts *) regex->re_guts)->cmap;
180 
181  return cm->max + 1;
182 }
#define REMAGIC
Definition: regguts.h:96
int re_magic
Definition: regex.h:57
#define assert(TEST)
Definition: imath.c:37
Definition: regguts.h:462
char * re_guts
Definition: regex.h:78
size_t max
Definition: regguts.h:212
int pg_reg_getnumoutarcs ( const regex_t regex,
int  st 
)

Definition at line 134 of file regexport.c.

References assert, cnfa::nstates, regex_t::re_guts, regex_t::re_magic, REMAGIC, and traverse_lacons().

Referenced by addArcs(), and addKey().

135 {
136  struct cnfa *cnfa;
137  int arcs_count;
138 
139  assert(regex != NULL && regex->re_magic == REMAGIC);
140  cnfa = &((struct guts *) regex->re_guts)->search;
141 
142  if (st < 0 || st >= cnfa->nstates)
143  return 0;
144  arcs_count = 0;
145  traverse_lacons(cnfa, st, &arcs_count, NULL, 0);
146  return arcs_count;
147 }
static void traverse_lacons(struct cnfa *cnfa, int st, int *arcs_count, regex_arc_t *arcs, int arcs_len)
Definition: regexport.c:93
Definition: regguts.h:354
#define REMAGIC
Definition: regguts.h:96
int nstates
Definition: regguts.h:356
int re_magic
Definition: regex.h:57
#define assert(TEST)
Definition: imath.c:37
Definition: regguts.h:462
char * re_guts
Definition: regex.h:78
int pg_reg_getnumstates ( const regex_t regex)

Definition at line 36 of file regexport.c.

References assert, cnfa::nstates, regex_t::re_guts, regex_t::re_magic, and REMAGIC.

37 {
38  struct cnfa *cnfa;
39 
40  assert(regex != NULL && regex->re_magic == REMAGIC);
41  cnfa = &((struct guts *) regex->re_guts)->search;
42 
43  return cnfa->nstates;
44 }
Definition: regguts.h:354
#define REMAGIC
Definition: regguts.h:96
int nstates
Definition: regguts.h:356
int re_magic
Definition: regex.h:57
#define assert(TEST)
Definition: imath.c:37
Definition: regguts.h:462
char * re_guts
Definition: regex.h:78
void pg_reg_getoutarcs ( const regex_t regex,
int  st,
regex_arc_t arcs,
int  arcs_len 
)

Definition at line 155 of file regexport.c.

References assert, cnfa::nstates, regex_t::re_guts, regex_t::re_magic, REMAGIC, and traverse_lacons().

Referenced by addArcs(), and addKey().

157 {
158  struct cnfa *cnfa;
159  int arcs_count;
160 
161  assert(regex != NULL && regex->re_magic == REMAGIC);
162  cnfa = &((struct guts *) regex->re_guts)->search;
163 
164  if (st < 0 || st >= cnfa->nstates || arcs_len <= 0)
165  return;
166  arcs_count = 0;
167  traverse_lacons(cnfa, st, &arcs_count, arcs, arcs_len);
168 }
static void traverse_lacons(struct cnfa *cnfa, int st, int *arcs_count, regex_arc_t *arcs, int arcs_len)
Definition: regexport.c:93
Definition: regguts.h:354
#define REMAGIC
Definition: regguts.h:96
int nstates
Definition: regguts.h:356
int re_magic
Definition: regex.h:57
#define assert(TEST)
Definition: imath.c:37
Definition: regguts.h:462
char * re_guts
Definition: regex.h:78