grep-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changes to grep/src/grep.h


From: Charles Levert
Subject: Changes to grep/src/grep.h
Date: Tue, 08 Nov 2005 21:47:38 -0500

Index: grep/src/grep.h
diff -u grep/src/grep.h:1.11 grep/src/grep.h:1.12
--- grep/src/grep.h:1.11        Tue Nov  8 21:35:33 2005
+++ grep/src/grep.h     Wed Nov  9 02:47:35 2005
@@ -20,19 +20,48 @@
 # define __attribute__(x)
 #endif
 
+/* We build specialized legacy "egrep" and "fgrep" programs.
+   No program adjusts its behavior according to its argv[0].
+   No scripts are provided as an alternative.  Distributors
+   are free to do otherwise, but it is their burden to do so.  */
+#if !defined(GREP_PROGRAM) && !defined(EGREP_PROGRAM) && 
!defined(FGREP_PROGRAM)
+# define GREP_PROGRAM
+#endif
+
+/* The two functions each matcher provides.  */
+#define COMPILE_RET void
+#define COMPILE_ARGS \
+  (char const *pattern, size_t size)
+#define EXECUTE_RET size_t
+#define EXECUTE_ARGS \
+  (char const *buf, size_t size, size_t *match_size, int exact)
+
+#ifdef GREP_PROGRAM
+/* Function definitions.  */
+# define COMPILE_FCT(f) static COMPILE_RET f COMPILE_ARGS
+# define EXECUTE_FCT(f) static EXECUTE_RET f EXECUTE_ARGS
+/* Function pointer types.  */
+typedef COMPILE_RET (*compile_fp_t) PARAMS (COMPILE_ARGS);
+typedef EXECUTE_RET (*execute_fp_t) PARAMS (EXECUTE_ARGS);
+
 /* grep.c expects the matchers vector to be terminated
    by an entry with a NULL compile, and to contain at least
    an entry named "default". */
-
 extern struct matcher
 {
   char name[8];
-  void (*compile) PARAMS ((char const *, size_t));
-  size_t (*execute) PARAMS ((char const *, size_t, size_t *, int));
+  compile_fp_t compile;
+  execute_fp_t execute;
 } const matchers[];
-
-/* Exported from fgrepmat.c, egrepmat.c, grepmat.c.  */
-extern char const *matcher;
+#else /* !GREP_PROGRAM */
+/* Straight functions for specialized "egrep" and "fgrep" programs.  */
+/* Function definitions.  */
+# define COMPILE_FCT(f) COMPILE_RET compile COMPILE_ARGS
+# define EXECUTE_FCT(f) EXECUTE_RET execute EXECUTE_ARGS
+/* Function prototypes.  */
+extern COMPILE_RET compile PARAMS (COMPILE_ARGS);
+extern EXECUTE_RET execute PARAMS (EXECUTE_ARGS);
+#endif /* GREP_PROGRAM */
 
 /* The following flags are exported from grep for the matchers
    to look at. */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]