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

Re: Things I learned making cvs2svn work today

From: Greg Stein <gstein_at_lyra.org>
Date: 2002-02-04 11:35:39 CET

On Sun, Feb 03, 2002 at 08:08:19PM -0500, Daniel Berlin wrote:
>...
> +++ ./svn_fs.i Sat Feb 2 23:56:32 2002
> @@ -63,6 +63,9 @@
> all uses of "const char **" are returning strings
> */
>
> +%typemap(ignore) const char ** (const char *temp) {
> + $1 = (char **) &temp;
> +}
> %apply const char **OUTPUT { const char ** };

That ignore typemap shouldn't be needed because of the %apply. The apply
should pick up the ignore typemap defined for 'const char **OUTPUT' in
svn_string.i. My wrapper code for svn_fs.h shows this is working fine.

(I've using the CVS version of SWIG, which ought to be 1.3.11 right now)

>...
> +/*
> -----------------------------------------------------------------------
> + void ** is returning a baton or something like it.
> +*/
> +
> +%typemap(ignore) void ** (void * temp) {
> + $1 = &temp;
> +}
> +%typemap(python,argout) void ** {
> + $result = t_output_helper(
> + $result,
> + SWIG_NewPointerObj(*$1, $*1_descriptor, 0));
> +}

This should have been handled by the application of OUTPARAM to void** at
the top of the file.

> +%typemap(ignore) svn_revnum_t * (svn_revnum_t temp) {
> + $1 = &temp;
> +}

We need to be extra careful with applying unnamed typemaps to svn_revnum_t
because SWIG doesn't distinguish between that an 'svn_fs_id_t'. Note the
special handling to distinguish the uses of revnum and id_d at the bottom of
svn_fs.i.

Can you try running without the above local changes? I'd like to hope that
it will work out alright for you, since I'm seeing the output is okay.

>...
> +++ ./util.i Sun Feb 3 15:27:10 2002
> @@ -18,7 +18,7 @@
>
> %module _util
>
> -%include "typemaps.i"
> +%include typemaps.i
>
> %import apr.i
> %import svn_types.i
> @@ -56,6 +56,14 @@
> */
> %apply const char **OUTPUT { const char ** };
>
> +%typemap(python, in) FILE * {
> + $1 = PyFile_AsFile($input);
> + if ($1 == 0) {
> + PyErr_SetString(PyExc_ValueError, "Must pass in a valid file
> object");
> + return NULL;
> + }
> +}

Good stuff. I've applied this part of the patch.

>...
> +++ ./apr.i Sun Feb 3 15:54:18 2002
> @@ -106,7 +106,7 @@
> %typemap(python,argout) apr_file_t ** {
> $result = t_output_helper(
> $result,
> - SWIG_NewPointerObj(*$1, $*1_descriptor), 0);
> + SWIG_NewPointerObj(*$1, $*1_descriptor, 0));

Eek :-) ... I've also applied this one.

Thanks,
-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 21 14:37:04 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.