* subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
[svn.git] / subversion / bindings / swig / svn_wc.i
blob22422eb48f9a018d8315f0fe780fbcc19424e022
1 /*
2 * ====================================================================
3 * Copyright (c) 2000-2006 CollabNet. All rights reserved.
5 * This software is licensed as described in the file COPYING, which
6 * you should have received as part of this distribution. The terms
7 * are also available at http://subversion.tigris.org/license-1.html.
8 * If newer versions of this license are posted there, you may use a
9 * newer version instead, at your option.
11 * This software consists of voluntary contributions made by many
12 * individuals. For exact contribution history, see the revision
13 * history and logs, available at http://subversion.tigris.org/.
14 * ====================================================================
16 * svn_wc.i: SWIG interface file for svn_wc.h
19 #if defined(SWIGPYTHON)
20 %module(package="libsvn") wc
21 #elif defined(SWIGPERL)
22 %module "SVN::_Wc"
23 #elif defined(SWIGRUBY)
24 %module "svn::ext::wc"
25 #endif
27 %include svn_global.swg
28 %import core.i
29 %import svn_delta.i
30 %import svn_ra.i
32 /* -----------------------------------------------------------------------
33 ### these functions require a pool, which we don't have immediately
34 ### handy. just eliminate these funcs for now.
36 %ignore svn_wc_set_auth_file;
38 /* ### ignore this structure because the accessors will need a pool */
39 %ignore svn_wc_keywords_t;
41 #ifdef SWIGRUBY
42 %ignore svn_wc_external_item_create;
43 %ignore svn_wc_external_item_dup;
44 %ignore svn_wc_external_item2_dup;
45 %ignore svn_wc_revision_status;
46 %ignore svn_wc_committed_queue_create;
47 %ignore svn_wc_init_traversal_info;
48 %ignore svn_wc_entry;
49 %ignore svn_wc_notify;
51 #endif
53 /* -----------------------------------------------------------------------
54 %apply-ing of typemaps defined elsewhere
57 /* svn_wc_get_prop_diffs() */
58 %apply apr_array_header_t **OUTPUT_OF_PROP {
59 apr_array_header_t **propchanges
62 %apply apr_hash_t *PROPHASH {
63 apr_hash_t *baseprops,
64 apr_hash_t *new_base_props,
65 apr_hash_t *new_props
69 svn_wc_queue_committed()
70 svn_wc_process_committed4()
71 svn_wc_process_committed3()
72 svn_wc_process_committed2()
73 svn_wc_process_committed()
75 #ifdef SWIGPYTHON
76 %typemap(in) apr_array_header_t *wcprop_changes
77 (apr_pool_t *_global_pool = NULL, PyObject *_global_py_pool = NULL)
79 if (_global_pool == NULL)
81 if (svn_swig_py_get_parent_pool(args, $descriptor(apr_pool_t *),
82 &_global_py_pool, &_global_pool))
83 SWIG_fail;
86 $1 = svn_swig_py_proparray_from_dict($input, _global_pool);
87 if (PyErr_Occurred()) {
88 SWIG_fail;
91 #endif
93 /* svn_wc_match_ignore_list() */
94 %apply const apr_array_header_t *STRINGLIST {
95 apr_array_header_t *list
98 %apply const apr_array_header_t *STRINGLIST_MAY_BE_NULL {
99 apr_array_header_t *changelists
102 /* svn_wc_cleanup2() */
103 %apply const char *MAY_BE_NULL {
104 const char *diff3_cmd,
105 const char *uuid,
106 const char *repos,
107 const char *new_text_path,
108 const char *copyfrom_url,
109 const char *rev_date,
110 const char *rev_author,
111 const char *trail_url
114 %hash_argout_typemap(entries, svn_wc_entry_t *)
115 %hash_argout_typemap(externals_p, svn_wc_external_item_t *)
117 #ifdef SWIGPYTHON
118 %callback_typemap(svn_wc_notify_func_t notify_func, void *notify_baton,
119 svn_swig_py_notify_func,
122 #endif
124 #ifndef SWIGPERL
125 %callback_typemap(svn_wc_notify_func2_t notify_func, void *notify_baton,
126 svn_swig_py_notify_func2,
128 svn_swig_rb_notify_func2)
129 #endif
131 #ifdef SWIGRUBY
132 %callback_typemap(const svn_wc_entry_callbacks2_t *walk_callbacks,
133 void *walk_baton,
136 svn_swig_rb_wc_entry_callbacks2())
137 #endif
139 #ifndef SWIGRUBY
140 %callback_typemap(svn_wc_status_func_t status_func, void *status_baton,
141 svn_swig_py_status_func,
142 svn_swig_pl_status_func,
144 #endif
146 #ifndef SWIGPERL
147 %callback_typemap(svn_wc_status_func2_t status_func, void *status_baton,
148 svn_swig_py_status_func2,
150 svn_swig_rb_wc_status_func)
151 #endif
153 #ifdef SWIGRUBY
154 %callback_typemap(const svn_wc_diff_callbacks2_t *callbacks,
155 void *callback_baton,
158 svn_swig_rb_wc_diff_callbacks2())
160 %callback_typemap(svn_wc_relocation_validator3_t validator,
161 void *validator_baton,
164 svn_swig_rb_wc_relocation_validator3)
165 #endif
168 #ifdef SWIGRUBY
169 %apply const char *NOT_NULL {
170 const char *changelist,
171 const char *matching_changelist
173 #endif
176 /* svn_wc_translated2() */
177 #ifdef SWIGRUBY
178 %apply const char **TO_TEMP_FILE {
179 const char **xlated_path
181 #endif
183 /* svn_wc_queue_committed() */
184 #ifdef SWIGRUBY
185 %typemap(in) svn_wc_committed_queue_t **queue (void *tempp=NULL) {
186 SWIG_ConvertPtr($input, &tempp, $*1_descriptor, 0);
187 $1 = ($1_ltype)&tempp;
190 %typemap(argout) svn_wc_committed_queue_t **queue {
191 %append_output(argv[0]);
193 #endif
196 svn_wc_get_update_editor3()
197 svn_wc_get_switch_editor3()
199 #ifdef SWIGRUBY
200 %typemap(in) svn_revnum_t *target_revision
202 $1 = apr_palloc(_global_pool, sizeof(svn_revnum_t));
203 if (NIL_P($input)) {
204 *$1 = SVN_INVALID_REVNUM;
205 } else {
206 *$1 = NUM2LONG($input);
210 %typemap(argout) svn_revnum_t *target_revision
212 %append_output(LONG2NUM((long)$1));
214 #endif
216 /* svn_wc_notify_t */
217 #ifdef SWIGRUBY
218 %typemap(out) svn_error_t *err
220 $result = $1 ? svn_swig_rb_svn_error_to_rb_error($1) : Qnil;
222 #endif
225 /* ----------------------------------------------------------------------- */
228 #include "svn_md5.h"
231 %include svn_wc_h.swg
235 %inline %{
236 static svn_error_t *
237 svn_wc_swig_init_asp_dot_net_hack (apr_pool_t *pool)
239 #if defined(WIN32) || defined(__CYGWIN__)
240 if (getenv ("SVN_ASP_DOT_NET_HACK"))
241 SVN_ERR (svn_wc_set_adm_dir("_svn", pool));
242 #endif /* WIN32 */
243 return SVN_NO_ERROR;
247 #if defined(SWIGPYTHON)
248 %pythoncode %{ svn_wc_swig_init_asp_dot_net_hack() %}
249 #endif
251 #ifdef SWIGRUBY
252 %extend svn_wc_external_item2_t
254 svn_wc_external_item2_t(apr_pool_t *pool) {
255 svn_error_t *err;
256 const svn_wc_external_item2_t *self;
257 err = svn_wc_external_item_create(&self, pool);
258 if (err)
259 svn_swig_rb_handle_svn_error(err);
260 return (svn_wc_external_item2_t *)self;
263 ~svn_wc_external_item2_t() {
266 svn_wc_external_item2_t *dup(apr_pool_t *pool) {
267 return svn_wc_external_item2_dup(self, pool);
271 %extend svn_wc_revision_status_t
273 svn_wc_revision_status_t(const char *wc_path,
274 const char *trail_url,
275 svn_boolean_t committed,
276 svn_cancel_func_t cancel_func,
277 void *cancel_baton,
278 apr_pool_t *pool) {
279 svn_error_t *err;
280 svn_wc_revision_status_t *self;
281 err = svn_wc_revision_status(&self, wc_path, trail_url, committed,
282 cancel_func, cancel_baton, pool);
283 if (err)
284 svn_swig_rb_handle_svn_error(err);
285 return self;
288 ~svn_wc_revision_status_t() {
292 /* Dummy declaration */
293 struct svn_wc_committed_queue_t
297 %extend svn_wc_committed_queue_t
299 svn_wc_committed_queue_t(apr_pool_t *pool) {
300 return svn_wc_committed_queue_create(pool);
303 ~svn_wc_committed_queue_t() {
307 /* Dummy declaration */
308 struct svn_wc_traversal_info_t
312 %extend svn_wc_traversal_info_t
314 svn_wc_traversal_info_t(apr_pool_t *pool) {
315 return svn_wc_init_traversal_info(pool);
318 ~svn_wc_traversal_info_t() {
322 %extend svn_wc_entry_t
324 svn_wc_entry_t(const char *path, svn_wc_adm_access_t *adm_access,
325 svn_boolean_t show_hidden, apr_pool_t *pool) {
326 const svn_wc_entry_t *self;
327 svn_wc_entry(&self, path, adm_access, show_hidden, pool);
328 return (svn_wc_entry_t *)self;
331 ~svn_wc_entry_t() {
335 %extend svn_wc_notify_t
337 svn_wc_notify_t(const char *path, svn_wc_notify_action_t action,
338 apr_pool_t *pool) {
339 return svn_wc_create_notify(path, action, pool);
342 ~svn_wc_notify_t() {
345 #endif