8 typedef int pcre_extra;
27 enum grep_header_field {
28 GREP_HEADER_AUTHOR = 0,
31 #define GREP_HEADER_FIELD_MAX (GREP_HEADER_COMMITTER + 1)
34 struct grep_pat *next;
37 enum grep_pat_token token;
40 enum grep_header_field field;
43 pcre_extra *pcre_extra_info;
45 unsigned ignore_case:1;
46 unsigned word_regexp:1;
58 enum grep_expr_node node;
61 struct grep_pat *atom;
62 struct grep_expr *unary;
64 struct grep_expr *left;
65 struct grep_expr *right;
71 struct grep_pat *pattern_list;
72 struct grep_pat **pattern_tail;
73 struct grep_pat *header_list;
74 struct grep_pat **header_tail;
75 struct grep_expr *pattern_expression;
84 int unmatch_name_only;
89 #define GREP_BINARY_DEFAULT 0
90 #define GREP_BINARY_NOMATCH 1
91 #define GREP_BINARY_TEXT 2
97 int null_following_name;
101 char color_context[COLOR_MAXLEN];
102 char color_filename[COLOR_MAXLEN];
103 char color_function[COLOR_MAXLEN];
104 char color_lineno[COLOR_MAXLEN];
105 char color_match[COLOR_MAXLEN];
106 char color_selected[COLOR_MAXLEN];
107 char color_sep[COLOR_MAXLEN];
109 unsigned pre_context;
110 unsigned post_context;
117 void (*output)(struct grep_opt *opt, const void *data, size_t size);
121 extern void append_grep_pat(struct grep_opt *opt, const char *pat, size_t patlen, const char *origin, int no, enum grep_pat_token t);
122 extern void append_grep_pattern(struct grep_opt *opt, const char *pat, const char *origin, int no, enum grep_pat_token t);
123 extern void append_header_grep_pattern(struct grep_opt *, enum grep_header_field, const char *);
124 extern void compile_grep_patterns(struct grep_opt *opt);
125 extern void free_grep_patterns(struct grep_opt *opt);
126 extern int grep_buffer(struct grep_opt *opt, const char *name, char *buf, unsigned long size);
128 extern struct grep_opt *grep_opt_dup(const struct grep_opt *opt);
129 extern int grep_threads_ok(const struct grep_opt *opt);