home *** CD-ROM | disk | FTP | other *** search
- #ifndef REGEX_H
- #define REGEX_H
-
- /*
- * Copyright (C) 1985 Richard M. Stallman
- *
- * This software may be redistributed under the terms described in the file
- * LICENSE in this directory.
- */
-
- #ifndef RE_NREGS
- #define RE_NREGS 10
- #endif
-
- /* This data structure is used to represent a compiled pattern. */
-
- struct re_pattern_buffer {
- char *buffer; /* Space holding the compiled pattern
- * commands. */
- int allocated; /* Size of space that buffer points
- * to */
- int used; /* Length of portion of buffer actually
- * occupied */
- char *fastmap;/* Pointer to fastmap, if any, or zero if
- * none. */
- /*
- * re_search uses the fastmap, if there is one, to skip quickly over
- * totally implausible characters
- */
- char *translate; /* Translate table to apply to all
- * characters before comparing. Or
- * zero for no translation. The
- * translation is applied to a
- * pattern when it is compiled and to
- * data when it is matched. */
- char fastmap_accurate;
- /*
- * Set to zero when a new pattern is stored, set to one when the
- * fastmap is updated from it.
- */
- char can_be_null; /* Set to one by compiling fastmap if
- * this pattern might match the null
- * string. It does not necessarily
- * match the null string in that
- * case, but if this is zero, it
- * cannot. */
- };
-
- /*
- * Structure to store "register" contents data in.
- *
- * Pass the address of such a structure as an argument to re_match, etc., if you
- * want this information back.
- *
- * start[i] and end[i] record the string matched by \( ... \) grouping i, for i
- * from 1 to RE_NREGS - 1. start[0] and end[0] record the entire string
- * matched.
- */
-
- struct re_registers {
- int start[RE_NREGS];
- int end[RE_NREGS];
- };
-
- #ifndef NO_PROTO
- char *re_compile_pattern PROTO((char *, int, struct re_pattern_buffer *));
- VOID re_compile_fastmap PROTO((struct re_pattern_buffer *));
- int re_search
- PROTO((struct re_pattern_buffer *, char *, int, int, int,
- struct re_registers *));
- int re_search_2
- PROTO((struct re_pattern_buffer *, char *, int, char *, int,
- int, int, struct re_registers *, int));
- int re_match
- PROTO((struct re_pattern_buffer *, char *, int, int,
- struct re_registers *));
- int re_match_2
- PROTO((struct re_pattern_buffer *, char *, int, char *, int,
- int, struct re_registers *, int));
- char *re_comp PROTO((char *));
- int re_exec PROTO((char *));
- VOID *alloca PROTO((unsigned));
- #endif
-
- /* Is this really advertised? */
- extern VOID re_compile_fastmap();
- extern int re_search(), re_search_2();
- extern int re_match(), re_match_2();
-
- /* 4.2 bsd compatibility (yuck) */
- extern char *re_comp();
- extern int re_exec();
-
- #ifdef SYNTAX_TABLE
- extern char *re_syntax_table;
- #endif
-
- #endif
-