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

Re: svn commit: r25741 - branches/ctypes-python-bindings/csvn

From: David James <james_at_cs.toronto.edu>
Date: 2007-07-14 21:51:12 CEST

On 7/14/07, David James <james@cs.toronto.edu> wrote:
> Hi Sage,
>
> On 7/14/07, sage@tigris.org <sage@tigris.org> wrote:
> > + def set_progress_func(self, progress_func):
> > + """Setup a callback for network progress information. This callback
> > + should accept two apr_off_t objects, being the number of bytes sent
> > + and the number of bytes to send.
> > +
> > + For details of apr_off_t objects, see the apr_off_t documentation."""
>
> In the wrapper, why don't we just convert the apr_off_t objects into
> regular Python numbers? We might need to add a bit of logic to handle
> cross-platform compatibility, but I think it'd be worth it for the
> ease of use.
>
> Here's a cross-platform function for converting apr_off_t into an integer.
> [... snip fancy function ...]

Actually, I've updated ctypesgen so that it marks apr_off_t as a
64-bit int, so that you don't need to do any fancy math to convert
between apr_off_t and Python integers. If you update to the latest
version of ctypesgen and rerun autogen.py, you'll be able to convert
an apr_off_t to a Python integer by simply accessing "progress.value"
and "total.value". We should do this in our wrapper function (i.e. in
_progress_func_wrapper) so that the library users won't have to.

Cheers,

David

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Jul 14 21:51:25 2007

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