1 /*- 2 * Copyright (c) 1992 Henry Spencer. 3 * Copyright (c) 1992 The Regents of the University of California. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * Henry Spencer of the University of Toronto. 8 * 9 * %sccs.include.redist.c% 10 * 11 * @(#)regex.h 5.1 (Berkeley) 08/28/92 12 */ 13 14 #ifndef _REGEX_H_ 15 #define _REGEX_H_ 16 17 /* types */ 18 typedef off_t regoff_t; 19 20 typedef struct { 21 int re_magic; 22 size_t re_nsub; /* number of parenthesized subexpressions */ 23 struct re_guts *re_g; /* none of your business :-) */ 24 } regex_t; 25 26 typedef struct { 27 regoff_t rm_so; /* start of match */ 28 regoff_t rm_eo; /* end of match */ 29 } regmatch_t; 30 31 int regcomp __P((regex_t *, const char *, int)); 32 size_t regerror __P((int, const regex_t *, char *, size_t)); 33 int regexec __P((const regex_t *, 34 const char *, size_t, regmatch_t [], int)); 35 void regfree __P((regex_t *)); 36 37 /* regcomp() flags */ 38 #define REG_EXTENDED 001 39 #define REG_ICASE 002 40 #define REG_NOSUB 004 41 #define REG_NEWLINE 010 42 43 /* regexec() flags */ 44 #define REG_NOTBOL 00001 45 #define REG_NOTEOL 00002 46 #define REG_STARTEND 00004 47 #define REG_TRACE 00400 /* debugging tracing */ 48 #define REG_LARGE 01000 /* force large state model for debug */ 49 50 /* errors */ 51 #define REG_NOMATCH (1) 52 #define REG_BADPAT (2) 53 #define REG_ECOLLATE (3) 54 #define REG_ECTYPE (4) 55 #define REG_EESCAPE (5) 56 #define REG_ESUBREG (6) 57 #define REG_EBRACK (7) 58 #define REG_EPAREN (8) 59 #define REG_EBRACE (9) 60 #define REG_BADBR (10) 61 #define REG_ERANGE (11) 62 #define REG_ESPACE (12) 63 #define REG_BADRPT (13) 64 #define REG_EMPTY (14) /* empty component */ 65 #define REG_ASSERT (15) /* assertion failure */ 66 67 #endif /* !_REGEX_H_ */ 68