summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>1999-11-20 23:16:11 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>1999-11-20 23:16:11 +0000
commit651d50a82f77e75fa718106593fa79ce8e68cc9c (patch)
treed7bc92c609eddcd4c568d6f7e1b07accc0406230
parent7423a9f8e9945e3943a8d70f606e8714d7352aea (diff)
Notes
-rw-r--r--gnu/usr.bin/grep/dfa.h51
1 files changed, 32 insertions, 19 deletions
diff --git a/gnu/usr.bin/grep/dfa.h b/gnu/usr.bin/grep/dfa.h
index 32e05fc2aa4a..1e125158dd38 100644
--- a/gnu/usr.bin/grep/dfa.h
+++ b/gnu/usr.bin/grep/dfa.h
@@ -1,5 +1,5 @@
/* 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
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
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 */
+/* $FreeBSD$ */
+
/* FIXME:
2. We should not export so much of the DFA internals.
In addition to clobbering modularity, we eat up valuable
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. */
+#ifndef CHARBITS
#define CHARBITS 8
+#endif
/* First integer value that is greater than any character code. */
#define NOTCHAR (1 << CHARBITS)
/* INTBITS need not be exact, just a lower bound. */
+#ifndef INTBITS
#define INTBITS (CHARBITS * sizeof (int))
+#endif
/* Number of ints required to hold a bit for every character. */
#define CHARCLASS_INTS ((NOTCHAR + INTBITS - 1) / INTBITS)
@@ -301,16 +322,14 @@ struct dfa
/* Entry points. */
-#if __STDC__
-
/* dfasyntax() takes two arguments; the first sets the syntax bits described
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.
Final argument is a flag specifying whether to build a searching or an
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
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.
Returns NULL if no match is found, or a pointer to the first
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. */
-extern void dfafree(struct dfa *);
+extern void dfafree PARAMS ((struct dfa *));
/* Entry points for people who know what they're doing. */
/* 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. */
-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
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
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. */
@@ -351,10 +370,4 @@ extern void dfastate(int, struct dfa *, int []);
takes a single argument, a NUL-terminated string describing the error.
The default dfaerror() prints the error message to stderr and exits.
The user can provide a different dfafree() if so desired. */
-extern void dfaerror(char *);
-
-#else /* ! __STDC__ */
-extern void dfasyntax(), dfacomp(), dfafree(), dfainit(), dfaparse();
-extern void dfaanalyze(), dfastate(), dfaerror();
-extern char *dfaexec();
-#endif /* ! __STDC__ */
+extern void dfaerror PARAMS ((const char *));