38 typedef unsigned reg_syntax_t;
42 #define RE_BACKSLASH_ESCAPE_IN_LISTS (1) 47 #define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1) 53 #define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1) 67 #define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1) 75 #define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1) 79 #define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1) 83 #define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1) 87 #define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1) 91 #define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1) 96 #define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1) 100 #define RE_LIMITED_OPS (RE_INTERVALS << 1) 104 #define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1) 109 #define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1) 113 #define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1) 117 #define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1) 121 #define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1) 127 #define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1) 131 #define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1) 137 extern reg_syntax_t re_syntax_options;
143 #define RE_SYNTAX_EMACS 0 145 #define RE_SYNTAX_AWK \ 146 (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \ 147 | RE_NO_BK_PARENS | RE_NO_BK_REFS \ 148 | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \ 149 | RE_UNMATCHED_RIGHT_PAREN_ORD) 151 #define RE_SYNTAX_POSIX_AWK \ 152 (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS) 154 #define RE_SYNTAX_GREP \ 155 (RE_BK_PLUS_QM | RE_CHAR_CLASSES \ 156 | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \ 159 #define RE_SYNTAX_EGREP \ 160 (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \ 161 | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \ 162 | RE_NEWLINE_ALT | RE_NO_BK_PARENS \ 165 #define RE_SYNTAX_POSIX_EGREP \ 166 (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES) 169 #define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC 171 #define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC 174 #define _RE_SYNTAX_POSIX_COMMON \ 175 (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \ 176 | RE_INTERVALS | RE_NO_EMPTY_RANGES) 178 #define RE_SYNTAX_POSIX_BASIC \ 179 (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM) 184 #define RE_SYNTAX_POSIX_MINIMAL_BASIC \ 185 (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS) 187 #define RE_SYNTAX_POSIX_EXTENDED \ 188 (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \ 189 | RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \ 190 | RE_NO_BK_PARENS | RE_NO_BK_VBAR \ 191 | RE_UNMATCHED_RIGHT_PAREN_ORD) 195 #define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \ 196 (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \ 197 | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \ 198 | RE_NO_BK_PARENS | RE_NO_BK_REFS \ 199 | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD) 208 #define RE_DUP_MAX ((1 << 15) - 1) 215 #define REG_EXTENDED 1 219 #define REG_ICASE (REG_EXTENDED << 1) 224 #define REG_NEWLINE (REG_ICASE << 1) 228 #define REG_NOSUB (REG_NEWLINE << 1) 241 #define REG_NOTEOL (1 << 1) 278 struct re_pattern_buffer
284 unsigned char *buffer;
287 unsigned long allocated;
314 unsigned can_be_null : 1;
320 #define REGS_UNALLOCATED 0 321 #define REGS_REALLOCATE 1 323 unsigned regs_allocated : 2;
327 unsigned fastmap_accurate : 1;
335 unsigned not_bol : 1;
338 unsigned not_eol : 1;
341 unsigned newline_anchor : 1;
346 typedef struct re_pattern_buffer regex_t;
351 #define RE_EXACTN_VALUE 1 354 typedef int regoff_t;
394 #define _RE_ARGS(args) args 398 #define _RE_ARGS(args) () 404 extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax));
409 extern const char *re_compile_pattern
410 _RE_ARGS ((
const char *pattern,
int length,
411 struct re_pattern_buffer *buffer));
417 extern int re_compile_fastmap _RE_ARGS ((
struct re_pattern_buffer *buffer));
426 _RE_ARGS ((
struct re_pattern_buffer *buffer,
const char *
string,
427 int length,
int start,
int range,
struct re_registers *regs));
432 extern int re_search_2
433 _RE_ARGS ((
struct re_pattern_buffer *buffer,
const char *string1,
434 int length1,
const char *string2,
int length2,
435 int start,
int range,
struct re_registers *regs,
int stop));
441 _RE_ARGS ((
struct re_pattern_buffer *buffer,
const char *
string,
442 int length,
int start,
struct re_registers *regs));
446 extern int re_match_2
447 _RE_ARGS ((
struct re_pattern_buffer *buffer,
const char *string1,
448 int length1,
const char *string2,
int length2,
449 int start,
struct re_registers *regs,
int stop));
464 extern void re_set_registers
465 _RE_ARGS ((
struct re_pattern_buffer *buffer,
struct re_registers *regs,
466 unsigned num_regs, regoff_t *starts, regoff_t *ends));
469 extern char *re_comp _RE_ARGS ((
const char *));
470 extern int re_exec _RE_ARGS ((
const char *));
473 extern int regcomp _RE_ARGS ((regex_t *preg,
const char *pattern,
int cflags));
475 _RE_ARGS ((
const regex_t *preg,
const char *
string,
size_t nmatch,
476 regmatch_t pmatch[],
int eflags));
477 extern size_t regerror
478 _RE_ARGS ((
int errcode,
const regex_t *preg,
char *errbuf,
479 size_t errbuf_size));
480 extern void regfree _RE_ARGS ((regex_t *preg));