summaryrefslogtreecommitdiff
path: root/subversion/bindings/swig/svn_wc.i
blob: 2efe84705fea8bdc9480114256088424548319d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
/*
 * ====================================================================
 *    Licensed to the Apache Software Foundation (ASF) under one
 *    or more contributor license agreements.  See the NOTICE file
 *    distributed with this work for additional information
 *    regarding copyright ownership.  The ASF licenses this file
 *    to you under the Apache License, Version 2.0 (the
 *    "License"); you may not use this file except in compliance
 *    with the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing,
 *    software distributed under the License is distributed on an
 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *    KIND, either express or implied.  See the License for the
 *    specific language governing permissions and limitations
 *    under the License.
 * ====================================================================
 *
 * svn_wc.i: SWIG interface file for svn_wc.h
 */

#if defined(SWIGPYTHON)
%module(package="libsvn") wc
#elif defined(SWIGPERL)
%module "SVN::_Wc"
#elif defined(SWIGRUBY)
%module "svn::ext::wc"
#endif

%include svn_global.swg
%import core.i
%import svn_delta.i
%import svn_ra.i

/* -----------------------------------------------------------------------
   ### these functions require a pool, which we don't have immediately
   ### handy. just eliminate these funcs for now.
*/
%ignore svn_wc_set_auth_file;

/* ### ignore these structures because the accessors will need a pool */
%ignore svn_wc_keywords_t;
%ignore svn_wc_conflict_description2_t;
%ignore svn_wc_conflict_result_t;

#ifdef SWIGRUBY
%ignore svn_wc_external_item_create;
%ignore svn_wc_external_item2_create;
%ignore svn_wc_external_item_dup;
%ignore svn_wc_external_item2_dup;
%ignore svn_wc_revision_status;
%ignore svn_wc_committed_queue_create;
%ignore svn_wc_init_traversal_info;
%ignore svn_wc_entry;
%ignore svn_wc_notify;

#endif

/* -----------------------------------------------------------------------
   %apply-ing of typemaps defined elsewhere
*/

/* svn_wc_get_prop_diffs() */
%apply apr_array_header_t **OUTPUT_OF_PROP {
  apr_array_header_t **propchanges
};

%apply apr_hash_t *PROPHASH {
  apr_hash_t *baseprops,
  apr_hash_t *new_base_props,
  apr_hash_t *new_props
};

/*
   svn_wc_queue_committed()
   svn_wc_process_committed4()
   svn_wc_process_committed3()
   svn_wc_process_committed2()
   svn_wc_process_committed()
*/
#ifdef SWIGPYTHON
%typemap(in) apr_array_header_t *wcprop_changes
  (apr_pool_t *_global_pool = NULL, PyObject *_global_py_pool = NULL)
{
  if (_global_pool == NULL)
  {
    if (svn_swig_py_get_parent_pool(args, $descriptor(apr_pool_t *),
                                    &_global_py_pool, &_global_pool))
      SWIG_fail;
  }

  $1 = svn_swig_py_proparray_from_dict($input, _global_pool);
  if (PyErr_Occurred()) {
    SWIG_fail;
  }
}
#endif

/* svn_wc_match_ignore_list() */
%apply const apr_array_header_t *STRINGLIST {
  apr_array_header_t *list
}

#ifdef SWIGRUBY
%apply const apr_array_header_t *STRINGLIST_MAY_BE_NULL {
  apr_array_header_t *changelists
}
#else
%apply const apr_array_header_t *STRINGLIST {
  apr_array_header_t *changelists
}
#endif

/* svn_wc_cleanup2() */
%apply const char *MAY_BE_NULL {
    const char *diff3_cmd,
    const char *uuid,
    const char *repos,
    const char *new_text_path,
    const char *copyfrom_url,
    const char *rev_date,
    const char *rev_author,
    const char *trail_url
}

%hash_argout_typemap(entries, svn_wc_entry_t *)
%hash_argout_typemap(externals_p, svn_wc_external_item_t *)

#ifdef SWIGPYTHON
%callback_typemap(svn_wc_notify_func_t notify_func, void *notify_baton,
                  svn_swig_py_notify_func,
                  ,
                  )
#endif

#ifndef SWIGPERL
%callback_typemap(svn_wc_notify_func2_t notify_func, void *notify_baton,
                  svn_swig_py_notify_func2,
                  ,
                  svn_swig_rb_notify_func2)
#endif

#ifdef SWIGRUBY
%callback_typemap(const svn_wc_entry_callbacks2_t *walk_callbacks,
                  void *walk_baton,
                  ,
                  ,
                  svn_swig_rb_wc_entry_callbacks2())
#endif

#ifndef SWIGRUBY
%callback_typemap(svn_wc_status_func_t status_func, void *status_baton,
                  svn_swig_py_status_func,
                  svn_swig_pl_status_func,
                  )
#endif

%callback_typemap(svn_wc_status_func2_t status_func, void *status_baton,
                  svn_swig_py_status_func2,
                  svn_swig_pl_status_func2,
                  svn_swig_rb_wc_status_func)

#ifdef SWIGPERL
%callback_typemap(svn_wc_status_func3_t status_func, void *status_baton,
                  ,
                  svn_swig_pl_status_func3,
                  ) 
#endif

#ifndef SWIGPERL
%callback_typemap(const svn_wc_diff_callbacks2_t *callbacks,
                  void *callback_baton,
                  svn_swig_py_setup_wc_diff_callbacks2(&$2, $input,
                                                       _global_pool),
                  ,
                  svn_swig_rb_wc_diff_callbacks2())
#endif

#ifdef SWIGRUBY
%callback_typemap(svn_wc_relocation_validator3_t validator,
                  void *validator_baton,
                  ,
                  ,
                  svn_swig_rb_wc_relocation_validator3)
#endif


#ifdef SWIGRUBY
%apply const char *NOT_NULL {
  const char *changelist,
  const char *matching_changelist
};
#endif


/* svn_wc_translated2() */
#ifdef SWIGRUBY
%apply const char **TO_TEMP_FILE {
    const char **xlated_path
};
#endif

/* svn_wc_queue_committed() */
#ifdef SWIGRUBY
%typemap(in) svn_wc_committed_queue_t **queue (void *tempp=NULL) {
  SWIG_ConvertPtr($input, &tempp, $*1_descriptor, 0);
  $1 = ($1_ltype)&tempp;
};

%typemap(argout) svn_wc_committed_queue_t **queue {
  %append_output(argv[0]);
};
#endif

/*
   svn_wc_get_update_editor3()
   svn_wc_get_switch_editor3()
*/
#ifdef SWIGRUBY
%typemap(in) svn_revnum_t *target_revision
{
  $1 = apr_palloc(_global_pool, sizeof(svn_revnum_t));
  if (NIL_P($input)) {
    *$1 = SVN_INVALID_REVNUM;
  } else {
    *$1 = NUM2LONG($input);
  }
}

%typemap(argout) svn_revnum_t *target_revision
{
  %append_output(LONG2NUM((long)$1));
}
#endif

/* svn_wc_notify_t */
#ifdef SWIGRUBY
%typemap(out) svn_error_t *err
{
  $result = $1 ? svn_swig_rb_svn_error_to_rb_error($1) : Qnil;
}
#endif


/* ----------------------------------------------------------------------- */

%{
#include <apr_md5.h>
#include "svn_md5.h"
%}

%include svn_wc_h.swg



%inline %{
static svn_error_t *
svn_wc_swig_init_asp_dot_net_hack (apr_pool_t *pool)
{
#if defined(WIN32) || defined(__CYGWIN__)
  if (getenv ("SVN_ASP_DOT_NET_HACK"))
    SVN_ERR (svn_wc_set_adm_dir("_svn", pool));
#endif /* WIN32 */
  return SVN_NO_ERROR;
}
%}

#if defined(SWIGPYTHON)
%pythoncode %{ svn_wc_swig_init_asp_dot_net_hack() %}
#endif

#ifdef SWIGRUBY
%extend svn_wc_external_item2_t
{
  svn_wc_external_item2_t(apr_pool_t *pool) {
    svn_error_t *err;
    svn_wc_external_item2_t *self;
    err = svn_wc_external_item2_create(&self, pool);
    if (err)
      svn_swig_rb_handle_svn_error(err);
    return self;
  };

  ~svn_wc_external_item2_t() {
  };

  svn_wc_external_item2_t *dup(apr_pool_t *pool) {
    return svn_wc_external_item2_dup(self, pool);
  };
}

%extend svn_wc_revision_status_t
{
  svn_wc_revision_status_t(const char *wc_path,
                           const char *trail_url,
                           svn_boolean_t committed,
                           svn_cancel_func_t cancel_func,
                           void *cancel_baton,
                           apr_pool_t *pool) {
    svn_error_t *err;
    svn_wc_revision_status_t *self;
    err = svn_wc_revision_status(&self, wc_path, trail_url, committed,
                                 cancel_func, cancel_baton, pool);
    if (err)
      svn_swig_rb_handle_svn_error(err);
    return self;
  };

  ~svn_wc_revision_status_t() {
  };
}

/* Dummy declaration */
struct svn_wc_committed_queue_t
{
};

%extend svn_wc_committed_queue_t
{
  svn_wc_committed_queue_t(apr_pool_t *pool) {
    return svn_wc_committed_queue_create(pool);
  };

  ~svn_wc_committed_queue_t() {
  };
}

/* Dummy declaration */
struct svn_wc_traversal_info_t
{
};

%extend svn_wc_traversal_info_t
{
  svn_wc_traversal_info_t(apr_pool_t *pool) {
    return svn_wc_init_traversal_info(pool);
  };

  ~svn_wc_traversal_info_t() {
  };
}

%extend svn_wc_entry_t
{
  svn_wc_entry_t(const char *path, svn_wc_adm_access_t *adm_access,
                 svn_boolean_t show_hidden, apr_pool_t *pool) {
    const svn_wc_entry_t *self;
    svn_wc_entry(&self, path, adm_access, show_hidden, pool);
    return (svn_wc_entry_t *)self;
  };

  ~svn_wc_entry_t() {
  };
}

%extend svn_wc_notify_t
{
  svn_wc_notify_t(const char *path, svn_wc_notify_action_t action,
                  apr_pool_t *pool) {
    return svn_wc_create_notify(path, action, pool);
  };

  ~svn_wc_notify_t() {
  };
}
#endif