Nik Clayton wrote:
> is necessary. Of course, now I have segfaults, but I can work on those :-)
I've fixed those, and am now moving on to the next challenge.
The bulk of the work takes place in a new function,
svn_swig_pl_thunk_list_receiver(). Here's what I've got so far.
svn_error_t *svn_swig_pl_thunk_list_receiver(void *baton,
const char *path,
const svn_dirent_t *dirent,
const svn_lock_t *lock,
const char *abs_path,
apr_pool_t *pool)
{
SV *receiver = baton;
if (!SvOK(receiver))
return SVN_NO_ERROR;
svn_swig_pl_callback_thunk(CALL_SV, receiver, NULL, "sOOsS", path,
&PL_sv_undef,
&PL_sv_undef, abs_path,
pool, POOLINFO);
return SVN_NO_ERROR;
}
This (part of the attached patch) is enough to get svn_client_list() working
from the Perl bindings. With one caveat. In the call to
svn_swig_pl_callback_thunk() note the two references to &PL_sv_undef. This
is passing in C<undef> to the Perl callback, where it's expecting to see an
svn_dirent_t and an svn_lock_t.
I see from the .i and .swg files in the repo that both these types have been
wrapped by the bindings. But I can't for the life of me work out how I go
from the arguments passed to svn_swig_pl_thunk_list_receiver() (*dirent and
*lock), to appropriate arguments to include in the call in to
svn_swig_pl_callback_thunk(). Looking through the other code to see if
there are any examples of something similar haven't been fruitful.
Anyone know how to do this?
The complete patch is attached.
N
=== subversion/bindings/swig/include/svn_types.swg
==================================================================
--- subversion/bindings/swig/include/svn_types.swg (revision 23492)
+++ subversion/bindings/swig/include/svn_types.swg (local)
@@ -598,6 +598,19 @@
#endif
/* -----------------------------------------------------------------------
+ Callback: svn_client_list_func_t
+ svn_client_list()
+*/
+
+#ifdef SWIGPERL
+%typemap(in) (svn_client_list_func_t list_func,
+ void *baton) {
+ $1 = svn_swig_pl_thunk_list_receiver;
+ $2 = (void *)$input;
+}
+#endif
+
+/* -----------------------------------------------------------------------
Callback: svn_log_message_receiver_t
svn_client_log()
svn_ra get_log()
=== subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c
==================================================================
--- subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c (revision 23492)
+++ subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c (local)
@@ -1,3 +1,4 @@
+
/*
* swigutil_pl.c: utility functions for the SWIG Perl bindings
*
@@ -777,6 +778,39 @@
svn_swig_pl_hold_ref_in_pool(pool, perl_editor);
}
+svn_error_t *svn_swig_pl_thunk_list_receiver(void *baton,
+ const char *path,
+ const svn_dirent_t *dirent,
+ const svn_lock_t *lock,
+ const char *abs_path,
+ apr_pool_t *pool)
+{
+ SV *receiver = baton;
+ swig_type_info *dirent_type = _SWIG_TYPE("svn_dirent_t *");
+ swig_type_info *lock_type = _SWIG_TYPE("svn_lock_t *");
+
+ if (!SvOK(receiver))
+ return SVN_NO_ERROR;
+
+ svn_swig_pl_callback_thunk(CALL_SV, receiver, NULL, "sOOsS", path,
+ &PL_sv_undef,
+ &PL_sv_undef, abs_path,
+ pool, POOLINFO);
+
+ return SVN_NO_ERROR;
+}
+
svn_error_t *svn_swig_pl_thunk_log_receiver(void *baton,
apr_hash_t *changed_paths,
svn_revnum_t rev,
=== subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.h
==================================================================
--- subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.h (revision 23492)
+++ subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.h (local)
@@ -95,6 +95,14 @@
SV *svn_swig_pl_convert_array(const apr_array_header_t *array,
swig_type_info *tinfo);
+/* thunked list receiver function. */
+svn_error_t *svn_swig_pl_thunk_list_receiver(void *baton,
+ const char *path,
+ const svn_dirent_t *dirent,
+ const svn_lock_t *lock,
+ const char *abs_path,
+ apr_pool_t *pool);
+
/* thunked log receiver function. */
svn_error_t * svn_swig_pl_thunk_log_receiver(void *py_receiver,
apr_hash_t *changed_paths,
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Feb 27 22:55:59 2007