source: valtobtest/subversion-1.6.2/subversion/libsvn_diff/diff.h @ 3

Last change on this file since 3 was 3, checked in by valtob, 15 years ago

subversion source 1.6.2 as test

File size: 4.5 KB
Line 
1/*
2 * diff.h :  private header file
3 *
4 * ====================================================================
5 * Copyright (c) 2000-2004 CollabNet.  All rights reserved.
6 *
7 * This software is licensed as described in the file COPYING, which
8 * you should have received as part of this distribution.  The terms
9 * are also available at http://subversion.tigris.org/license-1.html.
10 * If newer versions of this license are posted there, you may use a
11 * newer version instead, at your option.
12 *
13 * This software consists of voluntary contributions made by many
14 * individuals.  For exact contribution history, see the revision
15 * history and logs, available at http://subversion.tigris.org/.
16 * ====================================================================
17 */
18
19#if !defined(DIFF_H)
20#define DIFF_H
21
22#include <apr.h>
23#include <apr_pools.h>
24#include <apr_general.h>
25
26#include "svn_diff.h"
27#include "svn_types.h"
28
29#define SVN_DIFF__UNIFIED_CONTEXT_SIZE 3
30
31typedef struct svn_diff__node_t svn_diff__node_t;
32typedef struct svn_diff__tree_t svn_diff__tree_t;
33typedef struct svn_diff__position_t svn_diff__position_t;
34typedef struct svn_diff__lcs_t svn_diff__lcs_t;
35
36typedef enum svn_diff__type_e
37{
38  svn_diff__type_common,
39  svn_diff__type_diff_modified,
40  svn_diff__type_diff_latest,
41  svn_diff__type_diff_common,
42  svn_diff__type_conflict
43} svn_diff__type_e;
44
45struct svn_diff_t {
46  svn_diff_t *next;
47  svn_diff__type_e type;
48  apr_off_t original_start;
49  apr_off_t original_length;
50  apr_off_t modified_start;
51  apr_off_t modified_length;
52  apr_off_t latest_start;
53  apr_off_t latest_length;
54  svn_diff_t *resolved_diff;
55};
56
57struct svn_diff__position_t
58{
59  svn_diff__position_t *next;
60  svn_diff__node_t     *node;
61  apr_off_t             offset;
62};
63
64struct svn_diff__lcs_t
65{
66  svn_diff__lcs_t      *next;
67  svn_diff__position_t *position[2];
68  apr_off_t             length;
69  int                   refcount;
70};
71
72
73/* State used when normalizing whitespace and EOL styles. */
74typedef enum svn_diff__normalize_state_t
75{
76  /* Initial state; not in a sequence of whitespace. */
77  svn_diff__normalize_state_normal,
78  /* We're in a sequence of whitespace characters.  Only entered if
79     we ignore whitespace. */
80  svn_diff__normalize_state_whitespace,
81  /* The previous character was CR. */
82  svn_diff__normalize_state_cr
83} svn_diff__normalize_state_t;
84
85
86svn_diff__lcs_t *
87svn_diff__lcs(svn_diff__position_t *position_list1, /* pointer to tail (ring) */
88              svn_diff__position_t *position_list2, /* pointer to tail (ring) */
89              apr_pool_t *pool);
90
91
92/*
93 * Support functions to build a tree of token positions
94 */
95void
96svn_diff__tree_create(svn_diff__tree_t **tree, apr_pool_t *pool);
97
98
99/*
100 * Get all tokens from a datasource.  Return the
101 * last item in the (circular) list.
102 */
103svn_error_t *
104svn_diff__get_tokens(svn_diff__position_t **position_list,
105                     svn_diff__tree_t *tree,
106                     void *diff_baton,
107                     const svn_diff_fns_t *vtable,
108                     svn_diff_datasource_e datasource,
109                     apr_pool_t *pool);
110
111
112/* Morph a svn_lcs_t into a svn_diff_t. */
113svn_diff_t *
114svn_diff__diff(svn_diff__lcs_t *lcs,
115               apr_off_t original_start, apr_off_t modified_start,
116               svn_boolean_t want_common,
117               apr_pool_t *pool);
118
119void
120svn_diff__resolve_conflict(svn_diff_t *hunk,
121                           svn_diff__position_t **position_list1,
122                           svn_diff__position_t **position_list2,
123                           apr_pool_t *pool);
124
125
126/*
127 * Return an adler32 checksum based on CHECKSUM, updated with
128 * DATA of size LEN.
129 */
130apr_uint32_t
131svn_diff__adler32(apr_uint32_t checksum, const char *data, apr_off_t len);
132
133
134/* Normalize the characters pointed to by BUF of length *LENGTHP, starting
135 * in state *STATEP according to the OPTIONS.
136 * Adjust *LENGTHP and *STATEP to be the length of the normalized buffer and
137 * the final state, respectively.
138 * Normalized data is written to the memory at *TGT. BUF and TGT may point
139 * to the same memory area.  The memory area pointed to by *TGT should be
140 * large enough to hold *LENGTHP bytes.
141 * When on return *TGT is not equal to the value passed in, it points somewhere
142 * into the memory region designated by BUF and *LENGTHP.
143 */
144void
145svn_diff__normalize_buffer(char **tgt,
146                           apr_off_t *lengthp,
147                           svn_diff__normalize_state_t *statep,
148                           const char *buf,
149                           const svn_diff_file_options_t *opts);
150
151
152#endif /* DIFF_H */
Note: See TracBrowser for help on using the repository browser.