]>
Commit | Line | Data |
---|---|---|
be58e70d JK |
1 | #ifndef USERDIFF_H |
2 | #define USERDIFF_H | |
3 | ||
d9bae1a1 JK |
4 | #include "notes-cache.h" |
5 | ||
acd00ea0 | 6 | struct index_state; |
bd7ad45b | 7 | struct repository; |
acd00ea0 | 8 | |
be58e70d JK |
9 | struct userdiff_funcname { |
10 | const char *pattern; | |
11 | int cflags; | |
12 | }; | |
13 | ||
14 | struct userdiff_driver { | |
15 | const char *name; | |
16 | const char *external; | |
a4cf900e | 17 | const char *algorithm; |
122aa6f9 | 18 | int binary; |
be58e70d | 19 | struct userdiff_funcname funcname; |
80c49c3d | 20 | const char *word_regex; |
be391449 | 21 | const char *word_regex_multi_byte; |
9cb92c39 | 22 | const char *textconv; |
d9bae1a1 JK |
23 | struct notes_cache *textconv_cache; |
24 | int textconv_want_cache; | |
be58e70d | 25 | }; |
f12fa9ee ÆAB |
26 | enum userdiff_driver_type { |
27 | USERDIFF_DRIVER_TYPE_BUILTIN = 1<<0, | |
28 | USERDIFF_DRIVER_TYPE_CUSTOM = 1<<1, | |
29 | }; | |
30 | typedef int (*each_userdiff_driver_fn)(struct userdiff_driver *, | |
31 | enum userdiff_driver_type, void *); | |
be58e70d | 32 | |
c7534ef4 | 33 | int userdiff_config(const char *k, const char *v); |
be58e70d | 34 | struct userdiff_driver *userdiff_find_by_name(const char *name); |
acd00ea0 NTND |
35 | struct userdiff_driver *userdiff_find_by_path(struct index_state *istate, |
36 | const char *path); | |
be58e70d | 37 | |
a64e6a44 JK |
38 | /* |
39 | * Initialize any textconv-related fields in the driver and return it, or NULL | |
40 | * if it does not have textconv enabled at all. | |
41 | */ | |
bd7ad45b NTND |
42 | struct userdiff_driver *userdiff_get_textconv(struct repository *r, |
43 | struct userdiff_driver *driver); | |
3813e690 | 44 | |
f12fa9ee ÆAB |
45 | /* |
46 | * Iterate over all userdiff drivers. The userdiff_driver_type | |
47 | * argument to each_userdiff_driver_fn indicates their type. Return | |
48 | * non-zero to exit early from the loop. | |
49 | */ | |
50 | int for_each_userdiff_driver(each_userdiff_driver_fn, void *); | |
51 | ||
be58e70d | 52 | #endif /* USERDIFF */ |