2 * swigutil_py.h : utility functions and stuff for the SWIG Python bindings
4 * ====================================================================
5 * Copyright (c) 2000-2004 CollabNet. All rights reserved.
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.
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 * ====================================================================
20 #ifndef SVN_SWIG_SWIGUTIL_PY_H
21 #define SVN_SWIG_SWIGUTIL_PY_H
26 #include <apr_pools.h>
27 #include <apr_strings.h>
29 #include <apr_tables.h>
31 #include "svn_types.h"
32 #include "svn_string.h"
33 #include "svn_delta.h"
34 #include "svn_client.h"
35 #include "svn_repos.h"
37 /* Define DLL export magic on Windows. */
39 # ifdef SVN_SWIG_SWIGUTIL_PY_C
40 # define SVN_SWIG_SWIGUTIL_EXPORT __declspec(dllexport)
42 # define SVN_SWIG_SWIGUTIL_EXPORT __declspec(dllimport)
45 # define SVN_SWIG_SWIGUTIL_EXPORT
50 #endif /* __cplusplus */
54 /* Initialize the libsvn_swig_py library. */
55 SVN_SWIG_SWIGUTIL_EXPORT
56 apr_status_t
svn_swig_py_initialize(void);
60 /* Functions to manage python's global interpreter lock */
61 SVN_SWIG_SWIGUTIL_EXPORT
62 void svn_swig_py_release_py_lock(void);
64 SVN_SWIG_SWIGUTIL_EXPORT
65 void svn_swig_py_acquire_py_lock(void);
68 /*** Automatic Pool Management Functions ***/
70 /* Set the application pool */
71 SVN_SWIG_SWIGUTIL_EXPORT
72 void svn_swig_py_set_application_pool(PyObject
*py_pool
, apr_pool_t
*pool
);
74 /* Clear the application pool */
75 SVN_SWIG_SWIGUTIL_EXPORT
76 void svn_swig_py_clear_application_pool(void);
78 /* Get the pool argument from the last element of tuple args.
79 * If the last element of args is not a pool, create a new
80 * subpool. Return 0 if successful. Return 1 if an error
83 SVN_SWIG_SWIGUTIL_EXPORT
84 int svn_swig_py_get_pool_arg(PyObject
*args
, swig_type_info
*type
,
85 PyObject
**py_pool
, apr_pool_t
**pool
);
87 /* Get the parent pool of the first argument in the specified
88 * argument list. Return 0 if successful. Return 1 if an error
91 SVN_SWIG_SWIGUTIL_EXPORT
92 int svn_swig_py_get_parent_pool(PyObject
*args
, swig_type_info
*type
,
93 PyObject
**py_pool
, apr_pool_t
**pool
);
96 /*** SWIG Wrappers ***/
98 /* Wrapper for SWIG_NewPointerObj */
99 SVN_SWIG_SWIGUTIL_EXPORT
100 PyObject
*svn_swig_NewPointerObj(void *obj
, swig_type_info
*type
,
101 PyObject
*pool
, PyObject
*args
);
103 /* Wrapper for SWIG_ConvertPtr */
104 SVN_SWIG_SWIGUTIL_EXPORT
105 int svn_swig_ConvertPtr(PyObject
*input
, void **obj
, swig_type_info
*type
);
107 /* Wrapper for SWIG_MustGetPtr */
108 SVN_SWIG_SWIGUTIL_EXPORT
109 void *svn_swig_MustGetPtr(void *input
, swig_type_info
*type
, int argnum
);
111 /*** Functions to expose a custom SubversionException ***/
113 /* raise a subversion exception, created from a normal subversion
114 error. consume the error. */
115 SVN_SWIG_SWIGUTIL_EXPORT
116 void svn_swig_py_svn_exception(svn_error_t
*err
);
120 /* helper function to convert an apr_hash_t* (char* -> svnstring_t*) to
122 SVN_SWIG_SWIGUTIL_EXPORT
123 PyObject
*svn_swig_py_prophash_to_dict(apr_hash_t
*hash
);
125 /* helper function to convert an apr_hash_t* (svn_revnum_t* -> const
126 char *) to a Python dict */
127 SVN_SWIG_SWIGUTIL_EXPORT
128 PyObject
*svn_swig_py_locationhash_to_dict(apr_hash_t
*hash
);
130 /* helper function to convert an apr_array_header_t* (of
131 svn_merge_range_t *) to a Python list */
132 SVN_SWIG_SWIGUTIL_EXPORT
133 PyObject
*svn_swig_py_rangelist_to_list(apr_array_header_t
*rangelist
,
134 swig_type_info
*type
,
137 /* helper function to convert an apr_hash_t* (const char *->array of
138 svn_merge_range_t *) to a Python dict */
139 SVN_SWIG_SWIGUTIL_EXPORT
140 PyObject
*svn_swig_py_mergeinfo_to_dict(apr_hash_t
*hash
,
141 swig_type_info
*type
,
144 /* helper function to convert an apr_hash_t* (const char *->hash of
145 mergeinfo hashes) to a Python dict */
146 SVN_SWIG_SWIGUTIL_EXPORT
147 PyObject
*svn_swig_py_mergeinfo_catalog_to_dict(apr_hash_t
*hash
,
148 swig_type_info
*type
,
151 /* helper function to convert an apr_hash_t *(const char *->const char
152 *) to a Python dict */
154 SVN_SWIG_SWIGUTIL_EXPORT
155 PyObject
*svn_swig_py_stringhash_to_dict(apr_hash_t
*hash
);
157 /* convert a hash of 'const char *' -> TYPE into a Python dict */
158 SVN_SWIG_SWIGUTIL_EXPORT
159 PyObject
*svn_swig_py_convert_hash(apr_hash_t
*hash
, swig_type_info
*type
,
162 /* helper function to convert a 'char **' into a Python list of string
164 SVN_SWIG_SWIGUTIL_EXPORT
165 PyObject
*svn_swig_py_c_strings_to_list(char **strings
);
167 /* helper function to convert an array of 'const char *' to a Python list
169 SVN_SWIG_SWIGUTIL_EXPORT
170 PyObject
*svn_swig_py_array_to_list(const apr_array_header_t
*strings
);
172 /* helper function to convert a hash mapping char * to svn_string_t * to a
173 * Python dict mapping str to str. */
174 SVN_SWIG_SWIGUTIL_EXPORT
175 PyObject
*svn_swig_py_changed_path_hash_to_dict(apr_hash_t
*hash
);
177 SVN_SWIG_SWIGUTIL_EXPORT
178 apr_array_header_t
*svn_swig_py_rangelist_to_array(PyObject
*list
,
181 /* helper function to convert an array of 'svn_revnum_t' to a Python list
183 SVN_SWIG_SWIGUTIL_EXPORT
184 PyObject
*svn_swig_py_revarray_to_list(const apr_array_header_t
*revs
);
186 /* helper function to convert a Python dictionary mapping strings to
187 strings into an apr_hash_t mapping const char *'s to const char *'s,
188 allocated in POOL. */
189 SVN_SWIG_SWIGUTIL_EXPORT
190 apr_hash_t
*svn_swig_py_stringhash_from_dict(PyObject
*dict
,
193 /* helper function to convert a Python dictionary mapping strings to
194 rangelists into an apr_hash_t mapping const char *'s to rangelists,
195 allocated in POOL. */
196 SVN_SWIG_SWIGUTIL_EXPORT
197 apr_hash_t
*svn_swig_py_mergeinfo_from_dict(PyObject
*dict
,
200 /* helper function to convert a Python dictionary mapping strings to
201 strings into an 'apr_array_header_t *' of svn_prop_t *
202 allocated in POOL. */
203 SVN_SWIG_SWIGUTIL_EXPORT
204 apr_array_header_t
*svn_swig_py_proparray_from_dict(PyObject
*dict
,
207 /* helper function to convert a 'apr_array_header_t *' of 'svn_prop_t
208 to a Python dictionary mapping strings to strings. */
209 SVN_SWIG_SWIGUTIL_EXPORT
210 PyObject
*svn_swig_py_proparray_to_dict(const apr_array_header_t
*array
);
212 /* helper function to convert a Python dictionary mapping strings to
213 strings into an apr_hash_t mapping const char *'s to svn_string_t's,
214 allocated in POOL. */
215 SVN_SWIG_SWIGUTIL_EXPORT
216 apr_hash_t
*svn_swig_py_prophash_from_dict(PyObject
*dict
,
219 /* helper function to convert a Python dictionary mapping strings to
220 integers into an apr_hash_t mapping const char *'s to revnums,
221 allocated in POOL. */
222 SVN_SWIG_SWIGUTIL_EXPORT
223 apr_hash_t
*svn_swig_py_path_revs_hash_from_dict(PyObject
*dict
,
226 /* helper function to convert a Python dictionary mapping strings to
227 strings into an apr_hash_t mapping const char *'s to svn_string_t *'s,
228 allocated in POOL. */
229 SVN_SWIG_SWIGUTIL_EXPORT
230 apr_hash_t
*svn_swig_py_changed_path_hash_from_dict(PyObject
*dict
,
233 /* helper function to convert a Python sequence of strings into an
234 'apr_array_header_t *' of 'const char *' objects. Note that the
235 objects must remain alive -- the values are not copied. This is
236 appropriate for incoming arguments which are defined to last the
237 duration of the function's execution. */
238 SVN_SWIG_SWIGUTIL_EXPORT
239 const apr_array_header_t
*svn_swig_py_strings_to_array(PyObject
*source
,
242 /* like svn_swig_py_strings_to_array(), but for array's of 'svn_revnum_t's. */
243 SVN_SWIG_SWIGUTIL_EXPORT
244 const apr_array_header_t
*svn_swig_py_revnums_to_array(PyObject
*source
,
247 /* make an editor that "thunks" from C callbacks up to Python */
248 SVN_SWIG_SWIGUTIL_EXPORT
249 void svn_swig_py_make_editor(const svn_delta_editor_t
**editor
,
254 SVN_SWIG_SWIGUTIL_EXPORT
255 apr_file_t
*svn_swig_py_make_file(PyObject
*py_file
,
258 SVN_SWIG_SWIGUTIL_EXPORT
259 svn_stream_t
*svn_swig_py_make_stream(PyObject
*py_io
,
262 /* a notify function that executes a Python function that is passed in
263 via the baton argument */
264 SVN_SWIG_SWIGUTIL_EXPORT
265 void svn_swig_py_notify_func(void *baton
,
267 svn_wc_notify_action_t action
,
268 svn_node_kind_t kind
,
269 const char *mime_type
,
270 svn_wc_notify_state_t content_state
,
271 svn_wc_notify_state_t prop_state
,
272 svn_revnum_t revision
);
274 SVN_SWIG_SWIGUTIL_EXPORT
275 void svn_swig_py_notify_func2(void *baton
,
276 const svn_wc_notify_t
*notify
,
279 /* a status function that executes a Python function that is passed in
280 via the baton argument */
281 SVN_SWIG_SWIGUTIL_EXPORT
282 void svn_swig_py_status_func(void *baton
,
284 svn_wc_status_t
*status
);
286 /* a svn_delta_path_driver callback that executes a Python function
287 that is passed in via the baton argument */
288 SVN_SWIG_SWIGUTIL_EXPORT
289 svn_error_t
*svn_swig_py_delta_path_driver_cb_func(void **dir_baton
,
291 void *callback_baton
,
295 /* a status function that executes a Python function that is passed in
296 via the baton argument */
297 SVN_SWIG_SWIGUTIL_EXPORT
298 void svn_swig_py_status_func2(void *baton
,
300 svn_wc_status2_t
*status
);
302 /* a cancel function that executes a Python function passed in via the
303 cancel_baton argument. */
304 SVN_SWIG_SWIGUTIL_EXPORT
305 svn_error_t
*svn_swig_py_cancel_func(void *cancel_baton
);
307 /* thunked fs get_locks function */
308 SVN_SWIG_SWIGUTIL_EXPORT
309 svn_error_t
*svn_swig_py_fs_get_locks_func(void *baton
,
313 /* thunked commit log fetcher */
314 SVN_SWIG_SWIGUTIL_EXPORT
315 svn_error_t
*svn_swig_py_get_commit_log_func(const char **log_msg
,
316 const char **tmp_file
,
317 const apr_array_header_t
*
322 /* thunked repos authz callback function */
323 SVN_SWIG_SWIGUTIL_EXPORT
324 svn_error_t
*svn_swig_py_repos_authz_func(svn_boolean_t
*allowed
,
330 /* thunked history callback function */
331 SVN_SWIG_SWIGUTIL_EXPORT
332 svn_error_t
*svn_swig_py_repos_history_func(void *baton
,
334 svn_revnum_t revision
,
337 /* thunked log receiver function */
338 SVN_SWIG_SWIGUTIL_EXPORT
339 svn_error_t
*svn_swig_py_log_receiver(void *py_receiver
,
340 apr_hash_t
*changed_paths
,
347 /* thunked log receiver2 function */
348 SVN_SWIG_SWIGUTIL_EXPORT
349 svn_error_t
*svn_swig_py_log_entry_receiver(void *baton
,
350 svn_log_entry_t
*log_entry
,
353 /* thunked info receiver function */
354 SVN_SWIG_SWIGUTIL_EXPORT
355 svn_error_t
*svn_swig_py_info_receiver_func(void *py_receiver
,
357 const svn_info_t
*info
,
360 /* thunked location segments receiver function */
361 SVN_SWIG_SWIGUTIL_EXPORT
363 svn_swig_py_location_segment_receiver_func(svn_location_segment_t
*segment
,
367 /* thunked blame receiver function */
368 SVN_SWIG_SWIGUTIL_EXPORT
369 svn_error_t
*svn_swig_py_client_blame_receiver_func(void *baton
,
371 svn_revnum_t revision
,
377 /* thunked changelist receiver function */
378 SVN_SWIG_SWIGUTIL_EXPORT
379 svn_error_t
*svn_swig_py_changelist_receiver_func(void *baton
,
381 const char *changelist
,
384 /* auth provider callbacks */
385 SVN_SWIG_SWIGUTIL_EXPORT
386 svn_error_t
*svn_swig_py_auth_simple_prompt_func(
387 svn_auth_cred_simple_t
**cred
,
390 const char *username
,
391 svn_boolean_t may_save
,
394 SVN_SWIG_SWIGUTIL_EXPORT
395 svn_error_t
*svn_swig_py_auth_username_prompt_func(
396 svn_auth_cred_username_t
**cred
,
399 svn_boolean_t may_save
,
402 SVN_SWIG_SWIGUTIL_EXPORT
403 svn_error_t
*svn_swig_py_auth_ssl_server_trust_prompt_func(
404 svn_auth_cred_ssl_server_trust_t
**cred
,
407 apr_uint32_t failures
,
408 const svn_auth_ssl_server_cert_info_t
*cert_info
,
409 svn_boolean_t may_save
,
412 SVN_SWIG_SWIGUTIL_EXPORT
413 svn_error_t
*svn_swig_py_auth_ssl_client_cert_prompt_func(
414 svn_auth_cred_ssl_client_cert_t
**cred
,
417 svn_boolean_t may_save
,
420 SVN_SWIG_SWIGUTIL_EXPORT
421 svn_error_t
*svn_swig_py_auth_ssl_client_cert_pw_prompt_func(
422 svn_auth_cred_ssl_client_cert_pw_t
**cred
,
425 svn_boolean_t may_save
,
428 SVN_SWIG_SWIGUTIL_EXPORT
430 svn_swig_py_setup_ra_callbacks(svn_ra_callbacks2_t
**callbacks
,
432 PyObject
*py_callbacks
,
434 SVN_SWIG_SWIGUTIL_EXPORT
435 svn_error_t
*svn_swig_py_commit_callback2(const svn_commit_info_t
*commit_info
,
439 SVN_SWIG_SWIGUTIL_EXPORT
440 svn_error_t
*svn_swig_py_commit_callback(svn_revnum_t new_revision
,
446 SVN_SWIG_SWIGUTIL_EXPORT
447 svn_error_t
*svn_swig_py_ra_file_rev_handler_func(
451 apr_hash_t
*rev_props
,
452 svn_txdelta_window_handler_t
*delta_handler
,
454 apr_array_header_t
*prop_diffs
,
457 SVN_SWIG_SWIGUTIL_EXPORT
458 svn_error_t
*svn_swig_py_ra_lock_callback(
461 svn_boolean_t do_lock
,
462 const svn_lock_t
*lock
,
466 SVN_SWIG_SWIGUTIL_EXPORT
467 extern const svn_ra_reporter2_t swig_py_ra_reporter2
;
471 #endif /* __cplusplus */
473 #endif /* SVN_SWIG_SWIGUTIL_PY_H */