1 /* reading patches */
2 
3 /* Copyright (C) 1986, 1987, 1988 Larry Wall
4 
5    Copyright (C) 1990-1993, 1997-2003, 2009-2012 Free Software Foundation, Inc.
6 
7    This program is free software: you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation, either version 3 of the License, or
10    (at your option) any later version.
11 
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16 
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19 
20 enum nametype { OLD, NEW, INDEX, NONE };
21 
22 lin pch_end (void) _GL_ATTRIBUTE_PURE;
23 lin pch_first (void) _GL_ATTRIBUTE_PURE;
24 lin pch_hunk_beg (void) _GL_ATTRIBUTE_PURE;
25 char const *pch_c_function (void) _GL_ATTRIBUTE_PURE;
26 bool pch_git_diff (void) _GL_ATTRIBUTE_PURE;
27 char const * pch_timestr (bool which) _GL_ATTRIBUTE_PURE;
28 char const *pch_sha1 (bool which) _GL_ATTRIBUTE_PURE;
29 mode_t pch_mode (bool which) _GL_ATTRIBUTE_PURE;
30 lin pch_newfirst (void) _GL_ATTRIBUTE_PURE;
31 lin pch_prefix_context (void) _GL_ATTRIBUTE_PURE;
32 lin pch_ptrn_lines (void) _GL_ATTRIBUTE_PURE;
33 lin pch_repl_lines (void) _GL_ATTRIBUTE_PURE;
34 lin pch_suffix_context (void) _GL_ATTRIBUTE_PURE;
35 bool pch_swap (void);
36 bool pch_write_line (lin, FILE *);
37 bool there_is_another_patch (bool, mode_t *);
38 char *pfetch (lin) _GL_ATTRIBUTE_PURE;
39 char pch_char (lin) _GL_ATTRIBUTE_PURE;
40 int another_hunk (enum diff, bool);
41 int pch_says_nonexistent (bool) _GL_ATTRIBUTE_PURE;
42 size_t pch_line_len (lin) _GL_ATTRIBUTE_PURE;
43 const char *pch_name(enum nametype) _GL_ATTRIBUTE_PURE;
44 bool pch_copy (void) _GL_ATTRIBUTE_PURE;
45 bool pch_rename (void) _GL_ATTRIBUTE_PURE;
46 void do_ed_script (char const *, char const *, bool *, FILE *);
47 void open_patch_file (char const *);
48 void re_patch (void);
49 void pch_normalize (enum diff);
50 
51 XTERN struct timespec p_timestamp[2];  /* timestamps in patch headers */
52 
53 /* Return timestamp of patch header for file WHICH (false = old, true = new),
54    or a timestamp with tv_sec == -1 if there was no timestamp or an error in
55    the timestamp.  */
56 
pch_timestamp(bool which)57 static inline struct timespec pch_timestamp (bool which)
58 {
59   return p_timestamp[which];
60 }
61