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

Re: Perl bindings for Subversion using SWIG

From: <gstein_at_lyra.org>
Date: 2003-01-27 13:28:30 CET

On Fri, Jan 24, 2003 at 06:14:34PM -0600, Dave Rolsky wrote:
 On Fri, 24 Jan 2003 pwd@mdtsoft.com wrote:
 
  I have used XS some but as the swig xxx.i files are already written
  it looks like swig should be not too hard.
 
 Yes and no. You still have to write the Perl-specific SWIG stuff, which
 is the hard part. Take a look at the existing swig files and you'll see
 that most of the ugly stuff is language-specific (Python, Java).

Right. You teach SWIG how to map between Subversion types and the languages'
types. For example, how to convert Subversion's svn_string_t to and from
Perl's string type.

 If you aren't an expert with either SWIG or XS my guess is that Inline::C
 is probably the easiest way to do this. Of course, I idly tried working
 on a Subversion wrapper using Inline::C, and I got nowhere. But I really
 don't know much about C, and I didn't try all _that_ hard.

I'm not familiar with Inline::C, but get the impression it is about
inserting C code into Perl code? Does that mean you would have to manually
write a Perl function for each SVN function you want to expose? And then
update those mapping functions every time we change the SVN API?

How, um... tedious... :-)

 My guess that the really hard part is simply grokking the subversion API,
 and understanding what needs exposure to Perl and what doesn't.

That is where the existing .i files come in. They define a subset of the API
which is interesting to other languages. For example, they don't expose
much of APR since (presumably) the languages all have their own portable
equivalents of that functionality. And they don't expose string functions
since (again) the languages are assumed to have ample string facilities.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 14 02:19:20 2006

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.