This is the stock 2.3 file (+ FreeBSD id). Since someone majorly SPAMMED

the repository by NOT vendor importing the virgin 2.0 sources, CVS had no
idea what to do here.
This commit is contained in:
David E. O'Brien 1999-11-20 23:16:11 +00:00
parent 7423a9f8e9
commit 651d50a82f

View File

@ -1,5 +1,5 @@
/* dfa.h - declarations for GNU deterministic regexp compiler /* dfa.h - declarations for GNU deterministic regexp compiler
Copyright (C) 1988 Free Software Foundation, Inc. Copyright (C) 1988, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -13,23 +13,44 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */
/* Written June, 1988 by Mike Haertel */ /* Written June, 1988 by Mike Haertel */
/* $FreeBSD$ */
/* FIXME: /* FIXME:
2. We should not export so much of the DFA internals. 2. We should not export so much of the DFA internals.
In addition to clobbering modularity, we eat up valuable In addition to clobbering modularity, we eat up valuable
name space. */ name space. */
# undef PARAMS
#if __STDC__
# ifndef _PTR_T
# define _PTR_T
typedef void * ptr_t;
# endif
# define PARAMS(x) x
#else
# ifndef _PTR_T
# define _PTR_T
typedef char * ptr_t;
# endif
# define PARAMS(x) ()
#endif
/* Number of bits in an unsigned char. */ /* Number of bits in an unsigned char. */
#ifndef CHARBITS
#define CHARBITS 8 #define CHARBITS 8
#endif
/* First integer value that is greater than any character code. */ /* First integer value that is greater than any character code. */
#define NOTCHAR (1 << CHARBITS) #define NOTCHAR (1 << CHARBITS)
/* INTBITS need not be exact, just a lower bound. */ /* INTBITS need not be exact, just a lower bound. */
#ifndef INTBITS
#define INTBITS (CHARBITS * sizeof (int)) #define INTBITS (CHARBITS * sizeof (int))
#endif
/* Number of ints required to hold a bit for every character. */ /* Number of ints required to hold a bit for every character. */
#define CHARCLASS_INTS ((NOTCHAR + INTBITS - 1) / INTBITS) #define CHARCLASS_INTS ((NOTCHAR + INTBITS - 1) / INTBITS)
@ -301,16 +322,14 @@ struct dfa
/* Entry points. */ /* Entry points. */
#if __STDC__
/* dfasyntax() takes two arguments; the first sets the syntax bits described /* dfasyntax() takes two arguments; the first sets the syntax bits described
earlier in this file, and the second sets the case-folding flag. */ earlier in this file, and the second sets the case-folding flag. */
extern void dfasyntax(int, int); extern void dfasyntax PARAMS ((reg_syntax_t, int));
/* Compile the given string of the given length into the given struct dfa. /* Compile the given string of the given length into the given struct dfa.
Final argument is a flag specifying whether to build a searching or an Final argument is a flag specifying whether to build a searching or an
exact matcher. */ exact matcher. */
extern void dfacomp(char *, size_t, struct dfa *, int); extern void dfacomp PARAMS ((char *, size_t, struct dfa *, int));
/* Execute the given struct dfa on the buffer of characters. The /* Execute the given struct dfa on the buffer of characters. The
first char * points to the beginning, and the second points to the first char * points to the beginning, and the second points to the
@ -324,26 +343,26 @@ extern void dfacomp(char *, size_t, struct dfa *, int);
order to verify backreferencing; otherwise the flag will be cleared. order to verify backreferencing; otherwise the flag will be cleared.
Returns NULL if no match is found, or a pointer to the first Returns NULL if no match is found, or a pointer to the first
character after the first & shortest matching string in the buffer. */ character after the first & shortest matching string in the buffer. */
extern char *dfaexec(struct dfa *, char *, char *, int, int *, int *); extern char *dfaexec PARAMS ((struct dfa *, char *, char *, int, int *, int *));
/* Free the storage held by the components of a struct dfa. */ /* Free the storage held by the components of a struct dfa. */
extern void dfafree(struct dfa *); extern void dfafree PARAMS ((struct dfa *));
/* Entry points for people who know what they're doing. */ /* Entry points for people who know what they're doing. */
/* Initialize the components of a struct dfa. */ /* Initialize the components of a struct dfa. */
extern void dfainit(struct dfa *); extern void dfainit PARAMS ((struct dfa *));
/* Incrementally parse a string of given length into a struct dfa. */ /* Incrementally parse a string of given length into a struct dfa. */
extern void dfaparse(char *, size_t, struct dfa *); extern void dfaparse PARAMS ((char *, size_t, struct dfa *));
/* Analyze a parsed regexp; second argument tells whether to build a searching /* Analyze a parsed regexp; second argument tells whether to build a searching
or an exact matcher. */ or an exact matcher. */
extern void dfaanalyze(struct dfa *, int); extern void dfaanalyze PARAMS ((struct dfa *, int));
/* Compute, for each possible character, the transitions out of a given /* Compute, for each possible character, the transitions out of a given
state, storing them in an array of integers. */ state, storing them in an array of integers. */
extern void dfastate(int, struct dfa *, int []); extern void dfastate PARAMS ((int, struct dfa *, int []));
/* Error handling. */ /* Error handling. */
@ -351,10 +370,4 @@ extern void dfastate(int, struct dfa *, int []);
takes a single argument, a NUL-terminated string describing the error. takes a single argument, a NUL-terminated string describing the error.
The default dfaerror() prints the error message to stderr and exits. The default dfaerror() prints the error message to stderr and exits.
The user can provide a different dfafree() if so desired. */ The user can provide a different dfafree() if so desired. */
extern void dfaerror(char *); extern void dfaerror PARAMS ((const char *));
#else /* ! __STDC__ */
extern void dfasyntax(), dfacomp(), dfafree(), dfainit(), dfaparse();
extern void dfaanalyze(), dfastate(), dfaerror();
extern char *dfaexec();
#endif /* ! __STDC__ */