Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 108 lines (97 sloc) 2.243 kb
83b5d2f5 » Junio C Hamano
2006-09-17 builtin-grep: make pieces of it available as library.
1 #ifndef GREP_H
2 #define GREP_H
7e8f59d5 » René Scharfe
2009-03-07 grep: color patterns in output
3 #include "color.h"
83b5d2f5 » Junio C Hamano
2006-09-17 builtin-grep: make pieces of it available as library.
4
5 enum grep_pat_token {
6 GREP_PATTERN,
480c1ca6 » Junio C Hamano
2006-09-20 Update grep internal for grepping only in head/body
7 GREP_PATTERN_HEAD,
8 GREP_PATTERN_BODY,
83b5d2f5 » Junio C Hamano
2006-09-17 builtin-grep: make pieces of it available as library.
9 GREP_AND,
10 GREP_OPEN_PAREN,
11 GREP_CLOSE_PAREN,
12 GREP_NOT,
13 GREP_OR,
14 };
15
480c1ca6 » Junio C Hamano
2006-09-20 Update grep internal for grepping only in head/body
16 enum grep_context {
17 GREP_CONTEXT_HEAD,
18 GREP_CONTEXT_BODY,
19 };
20
a4d7d2c6 » gitster
2008-09-04 log --author/--committer: really match only with name part
21 enum grep_header_field {
22 GREP_HEADER_AUTHOR = 0,
23 GREP_HEADER_COMMITTER,
24 };
25
83b5d2f5 » Junio C Hamano
2006-09-17 builtin-grep: make pieces of it available as library.
26 struct grep_pat {
27 struct grep_pat *next;
28 const char *origin;
29 int no;
30 enum grep_pat_token token;
31 const char *pattern;
a4d7d2c6 » gitster
2008-09-04 log --author/--committer: really match only with name part
32 enum grep_header_field field;
83b5d2f5 » Junio C Hamano
2006-09-17 builtin-grep: make pieces of it available as library.
33 regex_t regexp;
c822255c » René Scharfe
2009-01-10 grep: don't call regexec() for fixed strings
34 unsigned fixed:1;
5183bf67 » briancollins
2009-11-06 grep: Allow case insensitive search of fixed-strings
35 unsigned ignore_case:1;
d7eb527d » René Scharfe
2009-03-07 grep: remove grep_opt argument from match_expr_eval()
36 unsigned word_regexp:1;
83b5d2f5 » Junio C Hamano
2006-09-17 builtin-grep: make pieces of it available as library.
37 };
38
39 enum grep_expr_node {
40 GREP_NODE_ATOM,
41 GREP_NODE_NOT,
42 GREP_NODE_AND,
43 GREP_NODE_OR,
44 };
45
46 struct grep_expr {
47 enum grep_expr_node node;
0ab7befa » Junio C Hamano
2006-09-27 grep --all-match
48 unsigned hit;
83b5d2f5 » Junio C Hamano
2006-09-17 builtin-grep: make pieces of it available as library.
49 union {
50 struct grep_pat *atom;
51 struct grep_expr *unary;
52 struct {
53 struct grep_expr *left;
54 struct grep_expr *right;
55 } binary;
56 } u;
57 };
58
59 struct grep_opt {
60 struct grep_pat *pattern_list;
61 struct grep_pat **pattern_tail;
62 struct grep_expr *pattern_expression;
493b7a08 » drizzd
2009-09-05 grep: accept relative paths outside current working directory
63 const char *prefix;
83b5d2f5 » Junio C Hamano
2006-09-17 builtin-grep: make pieces of it available as library.
64 int prefix_length;
65 regex_t regexp;
3e230fa1 » René Scharfe
2009-05-07 grep: use parseopt
66 int linenum;
67 int invert;
5183bf67 » briancollins
2009-11-06 grep: Allow case insensitive search of fixed-strings
68 int ignore_case;
3e230fa1 » René Scharfe
2009-05-07 grep: use parseopt
69 int status_only;
70 int name_only;
71 int unmatch_name_only;
72 int count;
73 int word_regexp;
74 int fixed;
75 int all_match;
83b5d2f5 » Junio C Hamano
2006-09-17 builtin-grep: make pieces of it available as library.
76 #define GREP_BINARY_DEFAULT 0
77 #define GREP_BINARY_NOMATCH 1
78 #define GREP_BINARY_TEXT 2
3e230fa1 » René Scharfe
2009-05-07 grep: use parseopt
79 int binary;
80 int extended;
81 int relative;
82 int pathname;
83 int null_following_name;
7e8f59d5 » René Scharfe
2009-03-07 grep: color patterns in output
84 int color;
a91f453f » Michał Kiedrowicz
2009-07-22 grep: Add --max-depth option.
85 int max_depth;
2944e4e6 » René Scharfe
2009-07-02 grep: add option -p/--show-function
86 int funcname;
7e8f59d5 » René Scharfe
2009-03-07 grep: color patterns in output
87 char color_match[COLOR_MAXLEN];
83b5d2f5 » Junio C Hamano
2006-09-17 builtin-grep: make pieces of it available as library.
88 int regflags;
89 unsigned pre_context;
90 unsigned post_context;
5dd06d38 » René Scharfe
2009-07-02 grep: move context hunk mark handling into show_line()
91 unsigned last_shown;
046802d0 » René Scharfe
2009-07-02 grep: print context hunk marks between files
92 int show_hunk_mark;
60ecac98 » René Scharfe
2009-07-02 grep -p: support user defined regular expressions
93 void *priv;
5b594f45 » Fredrik Kuivinen
2010-01-25 Threaded grep
94
95 void (*output)(struct grep_opt *opt, const void *data, size_t size);
96 void *output_priv;
83b5d2f5 » Junio C Hamano
2006-09-17 builtin-grep: make pieces of it available as library.
97 };
98
99 extern void append_grep_pattern(struct grep_opt *opt, const char *pat, const char *origin, int no, enum grep_pat_token t);
a4d7d2c6 » gitster
2008-09-04 log --author/--committer: really match only with name part
100 extern void append_header_grep_pattern(struct grep_opt *, enum grep_header_field, const char *);
83b5d2f5 » Junio C Hamano
2006-09-17 builtin-grep: make pieces of it available as library.
101 extern void compile_grep_patterns(struct grep_opt *opt);
b48fb5b6 » Junio C Hamano
2006-09-27 grep: free expressions and patterns when done.
102 extern void free_grep_patterns(struct grep_opt *opt);
83b5d2f5 » Junio C Hamano
2006-09-17 builtin-grep: make pieces of it available as library.
103 extern int grep_buffer(struct grep_opt *opt, const char *name, char *buf, unsigned long size);
104
5b594f45 » Fredrik Kuivinen
2010-01-25 Threaded grep
105 extern struct grep_opt *grep_opt_dup(const struct grep_opt *opt);
106 extern int grep_threads_ok(const struct grep_opt *opt);
107
83b5d2f5 » Junio C Hamano
2006-09-17 builtin-grep: make pieces of it available as library.
108 #endif
Something went wrong with that request. Please try again.