[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Perl bindings?

From: Dave Rolsky <autarch_at_urth.org>
Date: 2003-03-18 18:40:30 CET

On Tue, 18 Mar 2003, Paul Lussier wrote:

> It appears at first glance that most of the work has been done by
> creating the swig interface files in subversion/bindings/swig.
> Of course, I might also be completely wrong about that :)

That's about half the work. The rest is creating the C <=> Perl typemaps
for the various data structures used in Subversion that need to be
accessed from Perl. Swig is capable of handling simple types like int,
float, char *, etc. But for more complex types you often have to give it
some help. And this help needs to be done once for every language you're
binding to.

So for example, you see this in svn_fs.i:

 %typemap(python, argout, fragment="t_output_helper")
 apr_array_header_t **names_p {
     $result = t_output_helper($result, svn_swig_py_array_to_list(*$1));
 }

This is doing something to massage a return type of **names_p into
something Python can deal with. In this case, it looks like it's
converting a C array into a Python list. The svn_swig_py_array_to_list
function is defined in swigutil_py.c. You'll see a bunch of helper code
in here, and you'll probably need some similar helper code for Perl.

> So now I'm wondering how I tell swig where these headers are located.
> I've been pondering the swig website, and they make it sound almost
> trivial to use swig to create perl bindings.

Ha! It's a lot easier than doing it by hand, but it's most certainly not
trivial.

> At this point, I'm assuming that I was incorrect in thinking that the
> bindings/swig/ directory was where I need to start.

I think that's where you need to start.

> >Any swig experts out there?
>
> That's what I need right now :) Any takers ?

I'm not an expert by any means, but I've used it a bit before. If someone
else starts working on Perl bindings, I'll help if I can.

-dave

/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Mar 18 18:41:53 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.