1 /*
2 * Regular expressions, ex-style. Allocating and freeing memory for each
3 * regular expression would cause memory problems, so a buffer is allocated
4 * instead in which a regular expression can be compiled.
5 */
6 # define RXBUFSZ 2048
7 # define NSUBEXP 9
8
9 typedef struct {
10 bool valid; /* is the present matcher valid? */
11 bool anchor; /* is the match anchored (^pattern) */
12 char firstc; /* first character in match, if any */
13 char *start; /* start of matching sequence */
14 int size; /* size of matching sequence */
15 struct {
16 char *start; /* start of subexpression */
17 int size; /* size of subexpression */
18 } se[NSUBEXP];
19 char buffer[RXBUFSZ]; /* buffer to hold matcher */
20 } rxbuf;
21
22 extern rxbuf *rx_new P((void));
23 extern void rx_del P((rxbuf*));
24 extern char *rx_comp P((rxbuf*, char*));
25 extern int rx_exec P((rxbuf*, char*, int, int));
26
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.