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 ***/
148 svn_diff_file_output_unified3(svn_stream_t *output_stream,
150 const char *original_path,
151 const char *modified_path,
152 const char *original_header,
153 const char *modified_header,
154 const char *header_encoding,
155 const char *relative_to_dir,
156 svn_boolean_t show_c_function,
159 return svn_error_trace(
160 svn_diff_file_output_unified4(output_stream,
169 -1 /* context_size */,
170 NULL, NULL, /* cancel */
175 svn_diff_file_output_unified2(svn_stream_t *output_stream,
177 const char *original_path,
178 const char *modified_path,
179 const char *original_header,
180 const char *modified_header,
181 const char *header_encoding,
184 return svn_diff_file_output_unified3(output_stream, diff,
185 original_path, modified_path,
186 original_header, modified_header,
187 header_encoding, NULL, FALSE, pool);
191 svn_diff_file_output_unified(svn_stream_t *output_stream,
193 const char *original_path,
194 const char *modified_path,
195 const char *original_header,
196 const char *modified_header,
199 return svn_diff_file_output_unified2(output_stream, diff,
200 original_path, modified_path,
201 original_header, modified_header,
202 SVN_APR_LOCALE_CHARSET, pool);
206 svn_diff_file_diff(svn_diff_t **diff,
207 const char *original,
208 const char *modified,
211 return svn_diff_file_diff_2(diff, original, modified,
212 svn_diff_file_options_create(pool), pool);
216 svn_diff_file_diff3(svn_diff_t **diff,
217 const char *original,
218 const char *modified,
222 return svn_diff_file_diff3_2(diff, original, modified, latest,
223 svn_diff_file_options_create(pool), pool);
227 svn_diff_file_diff4(svn_diff_t **diff,
228 const char *original,
229 const char *modified,
231 const char *ancestor,
234 return svn_diff_file_diff4_2(diff, original, modified, latest, ancestor,
235 svn_diff_file_options_create(pool), pool);
239 svn_diff_file_output_merge(svn_stream_t *output_stream,
241 const char *original_path,
242 const char *modified_path,
243 const char *latest_path,
244 const char *conflict_original,
245 const char *conflict_modified,
246 const char *conflict_latest,
247 const char *conflict_separator,
248 svn_boolean_t display_original_in_conflict,
249 svn_boolean_t display_resolved_conflicts,
252 svn_diff_conflict_display_style_t style =
253 svn_diff_conflict_display_modified_latest;
255 if (display_resolved_conflicts)
256 style = svn_diff_conflict_display_resolved_modified_latest;
258 if (display_original_in_conflict)
259 style = svn_diff_conflict_display_modified_original_latest;
261 return svn_diff_file_output_merge2(output_stream,
275 svn_diff_file_output_merge2(svn_stream_t *output_stream,
277 const char *original_path,
278 const char *modified_path,
279 const char *latest_path,
280 const char *conflict_original,
281 const char *conflict_modified,
282 const char *conflict_latest,
283 const char *conflict_separator,
284 svn_diff_conflict_display_style_t conflict_style,
287 return svn_error_trace(svn_diff_file_output_merge3(output_stream,
296 NULL, NULL, /* cancel */
300 /*** From diff.c ***/
302 svn_diff_diff(svn_diff_t **diff,
304 const svn_diff_fns_t *vtable,
307 svn_diff_fns2_t *diff_fns2;
308 struct fns_wrapper_baton *fwb;
310 wrap_diff_fns(&diff_fns2, &fwb, vtable, diff_baton, pool);
311 return svn_diff_diff_2(diff, fwb, diff_fns2, pool);
315 /*** From diff3.c ***/
317 svn_diff_diff3(svn_diff_t **diff,
319 const svn_diff_fns_t *vtable,
322 svn_diff_fns2_t *diff_fns2;
323 struct fns_wrapper_baton *fwb;
325 wrap_diff_fns(&diff_fns2, &fwb, vtable, diff_baton, pool);
326 return svn_diff_diff3_2(diff, fwb, diff_fns2, pool);
330 /*** From diff4.c ***/
332 svn_diff_diff4(svn_diff_t **diff,
334 const svn_diff_fns_t *vtable,
337 svn_diff_fns2_t *diff_fns2;
338 struct fns_wrapper_baton *fwb;
340 wrap_diff_fns(&diff_fns2, &fwb, vtable, diff_baton, pool);
341 return svn_diff_diff4_2(diff, fwb, diff_fns2, pool);
344 /*** From util.c ***/
346 svn_diff_output(svn_diff_t *diff,
348 const svn_diff_output_fns_t *output_fns)
350 return svn_error_trace(svn_diff_output2(diff, output_baton, output_fns,
351 NULL, NULL /* cancel */));
354 /*** From diff_memory.c ***/
356 svn_diff_mem_string_output_merge(svn_stream_t *output_stream,
358 const svn_string_t *original,
359 const svn_string_t *modified,
360 const svn_string_t *latest,
361 const char *conflict_original,
362 const char *conflict_modified,
363 const char *conflict_latest,
364 const char *conflict_separator,
365 svn_boolean_t display_original_in_conflict,
366 svn_boolean_t display_resolved_conflicts,
369 svn_diff_conflict_display_style_t style =
370 svn_diff_conflict_display_modified_latest;
372 if (display_resolved_conflicts)
373 style = svn_diff_conflict_display_resolved_modified_latest;
375 if (display_original_in_conflict)
376 style = svn_diff_conflict_display_modified_original_latest;
378 return svn_diff_mem_string_output_merge2(output_stream,
392 svn_diff_mem_string_output_merge2(svn_stream_t *output_stream,
394 const svn_string_t *original,
395 const svn_string_t *modified,
396 const svn_string_t *latest,
397 const char *conflict_original,
398 const char *conflict_modified,
399 const char *conflict_latest,
400 const char *conflict_separator,
401 svn_diff_conflict_display_style_t style,
404 return svn_error_trace(svn_diff_mem_string_output_merge3(output_stream, diff,
418 svn_diff_mem_string_output_unified(svn_stream_t *output_stream,
420 const char *original_header,
421 const char *modified_header,
422 const char *header_encoding,
423 const svn_string_t *original,
424 const svn_string_t *modified,
427 return svn_error_trace(svn_diff_mem_string_output_unified2(output_stream,
440 svn_diff_mem_string_output_unified2(svn_stream_t *output_stream,
442 svn_boolean_t with_diff_header,
443 const char *hunk_delimiter,
444 const char *original_header,
445 const char *modified_header,
446 const char *header_encoding,
447 const svn_string_t *original,
448 const svn_string_t *modified,
451 return svn_error_trace(svn_diff_mem_string_output_unified3(output_stream,