source: vendor/diffutils/2.8.1/src/diff.h@ 2859

Last change on this file since 2859 was 2556, checked in by bird, 20 years ago

diffutils 2.8.1

File size: 11.6 KB
RevLine 
[2556]1/* Shared definitions for GNU DIFF
2
3 Copyright (C) 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1998, 2001,
4 2002 Free Software Foundation, Inc.
5
6 This file is part of GNU DIFF.
7
8 GNU DIFF is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GNU DIFF is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; see the file COPYING.
20 If not, write to the Free Software Foundation,
21 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
22
23#include "system.h"
24#include <stdio.h>
25
26#define TAB_WIDTH 8
27
28/* What kind of changes a hunk contains. */
29enum changes
30{
31 /* No changes: lines common to both files. */
32 UNCHANGED,
33
34 /* Deletes only: lines taken from just the first file. */
35 OLD,
36
37 /* Inserts only: lines taken from just the second file. */
38 NEW,
39
40 /* Both deletes and inserts: a hunk containing both old and new lines. */
41 CHANGED
42};
43
44
45/* Variables for command line options */
46
47#ifndef GDIFF_MAIN
48# define XTERN extern
49#else
50# define XTERN
51#endif
52
53enum output_style
54{
55 /* No output style specified. */
56 OUTPUT_UNSPECIFIED,
57
58 /* Default output style. */
59 OUTPUT_NORMAL,
60
61 /* Output the differences with lines of context before and after (-c). */
62 OUTPUT_CONTEXT,
63
64 /* Output the differences in a unified context diff format (-u). */
65 OUTPUT_UNIFIED,
66
67 /* Output the differences as commands suitable for `ed' (-e). */
68 OUTPUT_ED,
69
70 /* Output the diff as a forward ed script (-f). */
71 OUTPUT_FORWARD_ED,
72
73 /* Like -f, but output a count of changed lines in each "command" (-n). */
74 OUTPUT_RCS,
75
76 /* Output merged #ifdef'd file (-D). */
77 OUTPUT_IFDEF,
78
79 /* Output sdiff style (-y). */
80 OUTPUT_SDIFF
81};
82
83/* True for output styles that are robust,
84 i.e. can handle a file that ends in a non-newline. */
85#define ROBUST_OUTPUT_STYLE(S) ((S) != OUTPUT_ED && (S) != OUTPUT_FORWARD_ED)
86
87XTERN enum output_style output_style;
88
89/* Nonzero if output cannot be generated for identical files. */
90XTERN bool no_diff_means_no_output;
91
92/* Number of lines of context to show in each set of diffs.
93 This is zero when context is not to be shown. */
94XTERN lin context;
95
96/* Consider all files as text files (-a).
97 Don't interpret codes over 0177 as implying a "binary file". */
98XTERN bool text;
99
100/* Number of lines to keep in identical prefix and suffix. */
101XTERN lin horizon_lines;
102
103/* The significance of white space during comparisons. */
104XTERN enum
105{
106 /* All white space is significant (the default). */
107 IGNORE_NO_WHITE_SPACE,
108
109 /* Ignore changes due to tab expansion (-E). */
110 IGNORE_TAB_EXPANSION,
111
112 /* Ignore changes in horizontal white space (-b). */
113 IGNORE_SPACE_CHANGE,
114
115 /* Ignore all horizontal white space (-w). */
116 IGNORE_ALL_SPACE
117} ignore_white_space;
118
119/* Ignore changes that affect only blank lines (-B). */
120XTERN bool ignore_blank_lines;
121
122/* Files can be compared byte-by-byte, as if they were binary.
123 This depends on various options. */
124XTERN bool files_can_be_treated_as_binary;
125
126/* Ignore differences in case of letters (-i). */
127XTERN bool ignore_case;
128
129/* Ignore differences in case of letters in file names. */
130XTERN bool ignore_file_name_case;
131
132/* File labels for `-c' output headers (--label). */
133XTERN char *file_label[2];
134
135/* Regexp to identify function-header lines (-F). */
136XTERN struct re_pattern_buffer function_regexp;
137
138/* Ignore changes that affect only lines matching this regexp (-I). */
139XTERN struct re_pattern_buffer ignore_regexp;
140
141/* Say only whether files differ, not how (-q). */
142XTERN bool brief;
143
144/* Expand tabs in the output so the text lines up properly
145 despite the characters added to the front of each line (-t). */
146XTERN bool expand_tabs;
147
148/* Use a tab in the output, rather than a space, before the text of an
149 input line, so as to keep the proper alignment in the input line
150 without changing the characters in it (-T). */
151XTERN bool initial_tab;
152
153/* Remove trailing carriage returns from input. */
154XTERN bool strip_trailing_cr;
155
156/* In directory comparison, specify file to start with (-S).
157 This is used for resuming an aborted comparison.
158 All file names less than this name are ignored. */
159XTERN char const *starting_file;
160
161/* Pipe each file's output through pr (-l). */
162XTERN bool paginate;
163
164/* Line group formats for unchanged, old, new, and changed groups. */
165XTERN char const *group_format[CHANGED + 1];
166
167/* Line formats for unchanged, old, and new lines. */
168XTERN char const *line_format[NEW + 1];
169
170/* If using OUTPUT_SDIFF print extra information to help the sdiff filter. */
171XTERN bool sdiff_merge_assist;
172
173/* Tell OUTPUT_SDIFF to show only the left version of common lines. */
174XTERN bool left_column;
175
176/* Tell OUTPUT_SDIFF to not show common lines. */
177XTERN bool suppress_common_lines;
178
179/* The half line width and column 2 offset for OUTPUT_SDIFF. */
180XTERN unsigned int sdiff_half_width;
181XTERN unsigned int sdiff_column2_offset;
182
183/* String containing all the command options diff received,
184 with spaces between and at the beginning but none at the end.
185 If there were no options given, this string is empty. */
186XTERN char *switch_string;
187
188/* Use heuristics for better speed with large files with a small
189 density of changes. */
190XTERN bool speed_large_files;
191
192/* Patterns that match file names to be excluded. */
193XTERN struct exclude *excluded;
194