2 * deprecated.c: holding file for all deprecated APIs.
3 * "we can't lose 'em, but we can shun 'em!"
5 * ====================================================================
6 * Licensed to the Apache Software Foundation (ASF) under one
7 * or more contributor license agreements. See the NOTICE file
8 * distributed with this work for additional information
9 * regarding copyright ownership. The ASF licenses this file
10 * to you under the Apache License, Version 2.0 (the
11 * "License"); you may not use this file except in compliance
12 * with the License. You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing,
17 * software distributed under the License is distributed on an
18 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19 * KIND, either express or implied. See the License for the
20 * specific language governing permissions and limitations
22 * ====================================================================
25 /* ==================================================================== */
31 /* We define this here to remove any further warnings about the usage of
32 deprecated functions in this file. */
33 #define SVN_DEPRECATED
38 #include "svn_private_config.h"
44 struct fns_wrapper_baton
46 /* We put the old baton in front of this one, so that we can still use
47 this baton in place of the old. This prevents us from having to
48 implement simple wrappers around each member of diff_fns_t. */
50 const svn_diff_fns_t *vtable;
54 datasources_open(void *baton,
55 apr_off_t *prefix_lines,
56 apr_off_t *suffix_lines,
57 const svn_diff_datasource_e *datasources,
58 apr_size_t datasource_len)
60 struct fns_wrapper_baton *fwb = baton;
63 /* Just iterate over the datasources, using the old singular version. */
64 for (i = 0; i < datasource_len; i++)
66 SVN_ERR(fwb->vtable->datasource_open(fwb->old_baton, datasources[i]));
69 /* Don't claim any prefix or suffix matches. */
77 datasource_close(void *baton,
78 svn_diff_datasource_e datasource)
80 struct fns_wrapper_baton *fwb = baton;
81 return fwb->vtable->datasource_close(fwb->old_baton, datasource);
85 datasource_get_next_token(apr_uint32_t *hash,
88 svn_diff_datasource_e datasource)
90 struct fns_wrapper_baton *fwb = baton;
91 return fwb->vtable->datasource_get_next_token(hash, token, fwb->old_baton,
96 token_compare(void *baton,
101 struct fns_wrapper_baton *fwb = baton;
102 return fwb->vtable->token_compare(fwb->old_baton, ltoken, rtoken, compare);
106 token_discard(void *baton,
109 struct fns_wrapper_baton *fwb = baton;
110 fwb->vtable->token_discard(fwb->old_baton, token);
114 token_discard_all(void *baton)
116 struct fns_wrapper_baton *fwb = baton;
117 fwb->vtable->token_discard_all(fwb->old_baton);
122 wrap_diff_fns(svn_diff_fns2_t **diff_fns2,
123 struct fns_wrapper_baton **baton2,
124 const svn_diff_fns_t *diff_fns,
126 apr_pool_t *result_pool)
128 /* Initialize the return vtable. */
129 *diff_fns2 = apr_palloc(result_pool, sizeof(**diff_fns2));
131 (*diff_fns2)->datasources_open = datasources_open;
132 (*diff_fns2)->datasource_close = datasource_close;
133 (*diff_fns2)->datasource_get_next_token = datasource_get_next_token;
134 (*diff_fns2)->token_compare = token_compare;
135 (*diff_fns2)->token_discard = token_discard;
136 (*diff_fns2)->token_discard_all = token_discard_all;
138 /* Initialize the wrapper baton. */
139 *baton2 = apr_palloc(result_pool, sizeof (**baton2));
140 (*baton2)->old_baton = baton;
141 (*baton2)->vtable = diff_fns;
145 /*** From diff_file.c ***/
147 svn_diff_file_output_unified2(svn_stream_t *output_stream,
149 const char *original_path,
150 const char *modified_path,
151 const char *original_header,
152 const char *modified_header,
153 const char *header_encoding,
156 return svn_diff_file_output_unified3(output_stream, diff,
157 original_path, modified_path,
158 original_header, modified_header,
159 header_encoding, NULL, FALSE, pool);
163 svn_diff_file_output_unified(svn_stream_t *output_stream,
165 const char *original_path,
166 const char *modified_path,
167 const char *original_header,
168 const char *modified_header,
171 return svn_diff_file_output_unified2(output_stream, diff,
172 original_path, modified_path,
173 original_header, modified_header,
174 SVN_APR_LOCALE_CHARSET, pool);
178 svn_diff_file_diff(svn_diff_t **diff,
179 const char *original,
180 const char *modified,
183 return svn_diff_file_diff_2(diff, original, modified,
184 svn_diff_file_options_create(pool), pool);
188 svn_diff_file_diff3(svn_diff_t **diff,
189 const char *original,
190 const char *modified,
194 return svn_diff_file_diff3_2(diff, original, modified, latest,
195 svn_diff_file_options_create(pool), pool);
199 svn_diff_file_diff4(svn_diff_t **diff,
200 const char *original,
201 const char *modified,
203 const char *ancestor,
206 return svn_diff_file_diff4_2(diff, original, modified, latest, ancestor,
207 svn_diff_file_options_create(pool), pool);
211 svn_diff_file_output_merge(svn_stream_t *output_stream,
213 const char *original_path,
214 const char *modified_path,
215 const char *latest_path,
216 const char *conflict_original,
217 const char *conflict_modified,
218 const char *conflict_latest,
219 const char *conflict_separator,
220 svn_boolean_t display_original_in_conflict,
221 svn_boolean_t display_resolved_conflicts,
224 svn_diff_conflict_display_style_t style =
225 svn_diff_conflict_display_modified_latest;
227 if (display_resolved_conflicts)
228 style = svn_diff_conflict_display_resolved_modified_latest;
230 if (display_original_in_conflict)
231 style = svn_diff_conflict_display_modified_original_latest;
233 return svn_diff_file_output_merge2(output_stream,
247 /*** From diff.c ***/
249 svn_diff_diff(svn_diff_t **diff,
251 const svn_diff_fns_t *vtable,
254 svn_diff_fns2_t *diff_fns2;
255 struct fns_wrapper_baton *fwb;
257 wrap_diff_fns(&diff_fns2, &fwb, vtable, diff_baton, pool);
258 return svn_diff_diff_2(diff, fwb, diff_fns2, pool);
262 /*** From diff3.c ***/
264 svn_diff_diff3(svn_diff_t **diff,
266 const svn_diff_fns_t *vtable,
269 svn_diff_fns2_t *diff_fns2;
270 struct fns_wrapper_baton *fwb;
272 wrap_diff_fns(&diff_fns2, &fwb, vtable, diff_baton, pool);
273 return svn_diff_diff3_2(diff, fwb, diff_fns2, pool);
277 /*** From diff4.c ***/
279 svn_diff_diff4(svn_diff_t **diff,
281 const svn_diff_fns_t *vtable,
284 svn_diff_fns2_t *diff_fns2;
285 struct fns_wrapper_baton *fwb;
287 wrap_diff_fns(&diff_fns2, &fwb, vtable, diff_baton, pool);
288 return svn_diff_diff4_2(diff, fwb, diff_fns2, pool);