portable: release 0.93
[got-portable.git] / lib / got_lib_diff.h
blob8aae9cbb204baa3c88860e324853c5f81cc36b56
1 /*
2 * Copyright (c) 2020 Stefan Sperling <stsp@openbsd.org>
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #include "arraylist.h"
18 #include "diff_main.h"
19 #include "diff_output.h"
21 enum got_diff_output_format {
22 GOT_DIFF_OUTPUT_UNIDIFF,
23 GOT_DIFF_OUTPUT_PLAIN,
26 struct got_diffreg_result {
27 struct diff_result *result;
28 char *map1;
29 size_t size1;
30 char *map2;
31 size_t size2;
32 struct diff_data left;
33 struct diff_data right;
36 #define GOT_DIFF_CONFLICT_MARKER_BEGIN "<<<<<<<"
37 #define GOT_DIFF_CONFLICT_MARKER_ORIG "|||||||"
38 #define GOT_DIFF_CONFLICT_MARKER_SEP "======="
39 #define GOT_DIFF_CONFLICT_MARKER_END ">>>>>>>"
41 const struct got_error *got_diff_get_config(struct diff_config **,
42 enum got_diff_algorithm, diff_atomize_func_t, void *);
43 const struct got_error *got_diff_prepare_file(FILE *, char **, size_t *,
44 struct diff_data *, const struct diff_config *, int, int);
45 const struct got_error *got_diffreg(struct got_diffreg_result **, FILE *,
46 FILE *, enum got_diff_algorithm, int, int);
47 const struct got_error *got_diffreg_output(struct got_diff_line **, size_t *,
48 struct got_diffreg_result *, int, int, const char *, const char *,
49 enum got_diff_output_format, int, FILE *);
50 const struct got_error *got_diffreg_result_free(struct got_diffreg_result *);
51 const struct got_error *got_diffreg_result_free_left(
52 struct got_diffreg_result *);
53 const struct got_error *got_diffreg_result_free_right(
54 struct got_diffreg_result *);
55 const struct got_error *got_diffreg_close(char *, size_t, char *, size_t);
57 const struct got_error *got_merge_diff3(int *, int, FILE *, FILE *, FILE *,
58 const char *, const char *, const char *, enum got_diff_algorithm);
60 const struct got_error *got_diff_files(struct got_diffreg_result **, FILE *,
61 int, const char *, FILE *, int, const char *, int, int, int, FILE *,
62 enum got_diff_algorithm);