5
/* Copyright (C) 1995, 1996 Tom Lord
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU Library General Public License as published by
9
* the Free Software Foundation; either version 2, or (at your option)
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU Library General Public License for more details.
17
* You should have received a copy of the GNU Library General Public License
18
* along with this software; see the file COPYING. If not, write to
19
* the Free Software Foundation, 59 Temple Place - Suite 330,
20
* Boston, MA 02111-1307, USA.
27
struct rexp_node * pattern;
28
struct rexp_node ** subexps;
30
unsigned char * translate;
31
unsigned int newline_anchor:1;/* If true, an anchor at a newline matches.*/
32
unsigned int no_sub:1; /* If set, don't return register offsets. */
33
unsigned int is_anchored:1;
34
unsigned int is_nullable:1;
35
unsigned char fastmap[256];
39
typedef struct rx_posix_regex regex_t;
41
/* Type for byte offsets within the string. POSIX mandates this. */
44
typedef struct rx_registers
46
regoff_t rm_so; /* Byte offset from string's start to substring's start. */
47
regoff_t rm_eo; /* Byte offset from string's start to substring's end. */
48
regoff_t final_tag; /* data from the cut operator (only pmatch[0]) */
53
/* If any error codes are removed, changed, or added, update the
54
* `rx_error_msg' table.
56
#define REG_NOERROR 0 /* Success. */
57
#define REG_NOMATCH 1 /* Didn't find a match (for regexec). */
59
/* POSIX regcomp return error codes.
60
* (In the order listed in the standard.)
62
#define REG_BADPAT 2 /* Invalid pattern. */
63
#define REG_ECOLLATE 3 /* Not implemented. */
64
#define REG_ECTYPE 4 /* Invalid character class name. */
65
#define REG_EESCAPE 5 /* Trailing backslash. */
66
#define REG_ESUBREG 6 /* Invalid back reference. */
67
#define REG_EBRACK 7 /* Unmatched left bracket. */
68
#define REG_EPAREN 8 /* Parenthesis imbalance. */
69
#define REG_EBRACE 9 /* Unmatched \{. */
70
#define REG_BADBR 10 /* Invalid contents of \{\}. */
71
#define REG_ERANGE 11 /* Invalid range end. */
72
#define REG_ESPACE 12 /* Ran out of memory. */
73
#define REG_BADRPT 13 /* No preceding re for repetition op. */
75
/* Error codes we've added.
77
#define REG_EEND 14 /* Premature end. */
78
#define REG_ESIZE 15 /* Compiled pattern bigger than 2^16 bytes. */
79
#define REG_ERPAREN 16 /* Unmatched ) or \); not returned from regcomp. */
83
* POSIX `cflags' bits (i.e., information for `regcomp').
86
/* If this bit is set, then use extended regular expression syntax.
87
* If not set, then use basic regular expression syntax.
89
#define REG_EXTENDED 1
91
/* If this bit is set, then ignore case when matching.
92
* If not set, then case is significant.
94
#define REG_ICASE (REG_EXTENDED << 1)
96
/* If this bit is set, then anchors do not match at newline
97
* characters in the string.
98
* If not set, then anchors do match at newlines.
100
#define REG_NEWLINE (REG_ICASE << 1)
102
/* If this bit is set, then report only success or fail in regexec.
103
* If not set, then returns differ between not matching and errors.
105
#define REG_NOSUB (REG_NEWLINE << 1)
109
* POSIX `eflags' bits (i.e., information for regexec).
112
/* If this bit is set, then the beginning-of-line operator doesn't match
113
* the beginning of the string (presumably because it's not the
114
* beginning of a line).
115
* If not set, then the beginning-of-line operator does match the
116
* beginning of the string.
120
/* Like REG_NOTBOL, except for the end-of-line.
122
#define REG_NOTEOL (REG_NOTBOL << 1)
124
/* For regnexec only. Allocate register storage and return that. */
125
#define REG_ALLOC_REGS (REG_NOTEOL << 1)
129
extern int regncomp (regex_t * preg,
130
const char * pattern, int len,
132
extern int regcomp (regex_t * preg, const char * pattern, int cflags);
133
extern size_t regerror (int errcode,
135
char *errbuf, size_t errbuf_size);
136
extern int regnexec (const regex_t *preg,
137
const char *string, int len,
138
size_t nmatch, regmatch_t **pmatch,
140
extern int regexec (const regex_t *preg,
142
size_t nmatch, regmatch_t pmatch[],
144
extern void regfree (regex_t *preg);
147
extern int regncomp ();
148
extern int regcomp ();
149
extern size_t regerror ();
150
extern int regnexec ();
151
extern int regexec ();
152
extern void regfree ();
155
#endif /* INST_RXPOSIXH */