* subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
[svn.git] / subversion / bindings / swig / svn_fs.i
bloba20ff72e194c9ba2848eb26f3f00d1d9586dd625
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_fs.i: SWIG interface file for svn_fs.h
19 #if defined(SWIGPYTHON)
20 %module(package="libsvn") fs
21 #elif defined(SWIGPERL)
22 %module "SVN::_Fs"
23 #elif defined(SWIGRUBY)
24 %module "svn::ext::fs"
25 #endif
27 %include svn_global.swg
28 %import core.i
29 %import svn_delta.i
31 /* -----------------------------------------------------------------------
32 do not generate any constructors or destructors (of structures) -- all
33 structures are going to come /out/ of the FS (so we don't need to
34 construct the things) and will live in a pool (so we don't need to
35 destroy the things).
37 %nodefault;
39 /* Redundant from 1.1 onwards, so not worth manually wrapping the callback. */
40 %ignore svn_fs_set_berkeley_errcall;
42 /* ### need to deal with IN params which have "const" and OUT params which
43 ### return non-const type. SWIG's type checking may see these as
44 ### incompatible. */
46 %apply const char *MAY_BE_NULL {
47 const char *base_checksum,
48 const char *result_checksum,
49 const char *token,
50 const char *uuid,
51 const char *comment
54 #ifdef SWIGPYTHON
55 %apply svn_stream_t *WRAPPED_STREAM { svn_stream_t * };
56 #endif
58 %hash_argout_typemap(entries_p, svn_fs_dirent_t *)
59 %hash_argout_typemap(changed_paths_p, svn_fs_path_change_t *)
61 #ifndef SWIGPERL
62 %callback_typemap(svn_fs_get_locks_callback_t get_locks_func,
63 void *get_locks_baton,
64 svn_swig_py_fs_get_locks_func,
66 svn_swig_rb_fs_get_locks_callback)
67 #endif
68 /* -----------------------------------------------------------------------
69 svn_fs_get_merge_info
72 #ifdef SWIGPYTHON
73 %typemap(argout) apr_hash_t **minfohash
75 %append_output(svn_swig_py_stringhash_to_dict(*$1));
77 #endif
79 %apply apr_hash_t *MERGEINFO { apr_hash_t *mergeinhash };
81 /* -----------------------------------------------------------------------
82 Fix the return value for svn_fs_commit_txn(). If the conflict result is
83 NULL, then %append_output() is passed Py_None, but that goofs up
84 because that is *also* the marker for "I haven't started assembling a
85 multi-valued return yet" which means the second return value (new_rev)
86 will not cause a 2-tuple to be manufactured.
88 The answer is to explicitly create a 2-tuple return value.
90 FIXME: Do the Perl and Ruby bindings need to do something similar?
92 #ifdef SWIGPYTHON
93 %typemap(argout) (const char **conflict_p, svn_revnum_t *new_rev) {
94 /* this is always Py_None */
95 Py_DECREF($result);
96 /* build the result tuple */
97 $result = Py_BuildValue("zi", *$1, (long)*$2);
99 #endif
101 /* Ruby fixups for functions not following the pool convention. */
102 #ifdef SWIGRUBY
103 %ignore svn_fs_set_warning_func;
104 %ignore svn_fs_root_fs;
106 %inline %{
107 static void
108 svn_fs_set_warning_func_wrapper(svn_fs_t *fs,
109 svn_fs_warning_callback_t warning,
110 void *warning_baton,
111 apr_pool_t *pool)
113 svn_fs_set_warning_func(fs, warning, warning_baton);
116 static svn_fs_t *
117 svn_fs_root_fs_wrapper(svn_fs_root_t *root, apr_pool_t *pool)
119 return svn_fs_root_fs(root);
122 #endif
124 /* ----------------------------------------------------------------------- */
127 #include "svn_md5.h"
130 %include svn_fs_h.swg
132 #ifdef SWIGRUBY
133 %define_close_related_methods(fs);
134 #endif