8 typedef int pcre_extra
;
11 #include "thread-utils.h"
29 enum grep_header_field
{
30 GREP_HEADER_AUTHOR
= 0,
33 #define GREP_HEADER_FIELD_MAX (GREP_HEADER_COMMITTER + 1)
36 struct grep_pat
*next
;
39 enum grep_pat_token token
;
42 enum grep_header_field field
;
45 pcre_extra
*pcre_extra_info
;
48 unsigned ignore_case
:1;
49 unsigned word_regexp
:1;
61 enum grep_expr_node node
;
64 struct grep_pat
*atom
;
65 struct grep_expr
*unary
;
67 struct grep_expr
*left
;
68 struct grep_expr
*right
;
74 struct grep_pat
*pattern_list
;
75 struct grep_pat
**pattern_tail
;
76 struct grep_pat
*header_list
;
77 struct grep_pat
**header_tail
;
78 struct grep_expr
*pattern_expression
;
87 int unmatch_name_only
;
92 #define GREP_BINARY_DEFAULT 0
93 #define GREP_BINARY_NOMATCH 1
94 #define GREP_BINARY_TEXT 2
100 int null_following_name
;
105 char color_context
[COLOR_MAXLEN
];
106 char color_filename
[COLOR_MAXLEN
];
107 char color_function
[COLOR_MAXLEN
];
108 char color_lineno
[COLOR_MAXLEN
];
109 char color_match
[COLOR_MAXLEN
];
110 char color_selected
[COLOR_MAXLEN
];
111 char color_sep
[COLOR_MAXLEN
];
113 unsigned pre_context
;
114 unsigned post_context
;
122 void (*output
)(struct grep_opt
*opt
, const void *data
, size_t size
);
126 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
);
127 extern void append_grep_pattern(struct grep_opt
*opt
, const char *pat
, const char *origin
, int no
, enum grep_pat_token t
);
128 extern void append_header_grep_pattern(struct grep_opt
*, enum grep_header_field
, const char *);
129 extern void compile_grep_patterns(struct grep_opt
*opt
);
130 extern void free_grep_patterns(struct grep_opt
*opt
);
131 extern int grep_buffer(struct grep_opt
*opt
, const char *name
, char *buf
, unsigned long size
);
133 extern struct grep_opt
*grep_opt_dup(const struct grep_opt
*opt
);
134 extern int grep_threads_ok(const struct grep_opt
*opt
);
138 * Mutex used around access to the attributes machinery if
139 * opt->use_threads. Must be initialized/destroyed by callers!
141 extern pthread_mutex_t grep_attr_mutex
;