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

Re: Learning the Python API - early questions

From: Russell Yanofsky <rey4_at_columbia.edu>
Date: 2003-10-19 20:54:55 CEST

Barry Scott wrote:
> At 18-10-2003 22:45, Russell Yanofsky wrote:
>> It will if you explicitly instatiate the templates. There's an
>> example of this at http://www.swig.org/tutorial.html in the "Surely
>> there's more to it..." section. There's also more in-depth
>> documentation on doing this at
>> http://www.swig.org/Doc1.3/SWIGPlus.html#n28.
>
> I added:
>
> %include <string>
> %include <list>
>
> %template(std_string) std::string;
> %template(DirEntries) svn::DirEntries;
> %template(StatusEntries) svn::StatusEntries;
> %template(LogEntries) svn::LogEntries;
>
> Fails because SWIG cannot parse the MCVC6 header files...

You shouldn't need to %include those headers at all unless you need users to
be able to manipulate string and list objects from python code. If you do
need that, then you haven't created a very "pythonic" api, and you'll have
to wrap these types by declaring them in the .i file.

> I see other solving the problems by using %typemap code specific
> to python. Which does not help get other languages working.

As I see it, most of the "problems" you mention aren't really problems at
all, just cases where you want to take advantage of python's syntactic
sugar. Not surprisingly, typemaps that you write for these cases will use
python specific code. Typemaps that add real functionality (like typemaps
supporting callbacks) do not need to use python specific code (although the
subversion C bindings currently do anyway).

- Russ

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Oct 19 20:55:48 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.