[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: Daniel Berlin <dan_at_dberlin.org>
Date: 2002-02-04 02:08:19 CET

On Sun, 3 Feb 2002, Greg Stein wrote:

> On Sat, Feb 02, 2002 at 08:42:32PM -0500, Daniel Berlin wrote:
> >...
> > In 1.3.10 only the first %typemap(ignore) it sees does code replacement.
>
> Eek. Yah, that's bad :-)
>
> > There's a bug in swig's emit.cxx. It'll still ignore the arguments, but
> > never output the actual code inside the typemap except for the first one.
> > This of course, results in unitialized values (since it never does the $1
> > = &temp usually inside)
>
> If I were to guess, you probably have more "SWIG fu" than me :-)
>
> (but that's easy; this is really the first time that I've used SWIG, so I
> don't claim to have much 'fu at all :-)
>
> >...
> > > If not, then we may want to think about your approach of passing in tuples.
> > > However, I'd think in most of the cases where a pool is needed to allocate a
> > > stringbuf or whatnot, there is already a pool available as another parameter
> > > which can be used.
> >
> > Hopefully.
>
> Note that we can usually change the signature if needed to ensure that we
> have that pool parameter :-)
:)

>
>
> Still waiting for your SWIG bindings patches...
Yes, i sent them, but they haven't appeared yet (dberlin.org is
in flux, so i'm not *too* surprised). I've appended them here, and edited
out some changes to svn_client and svn_wc, and the svn_string changes,
since they aren't necessary for the cvs2svn i sent. Hopefully, the diffs
still work okay.

Index: ./svn_fs.i
===================================================================
--- ./svn_fs.i
+++ ./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 ** };

 /*
-----------------------------------------------------------------------
@@ -75,6 +78,23 @@
 %typemap(python, argout) char *** {
     $result = t_output_helper($result, svn_swig_c_strings_to_list(*$1));
 }
+
+/*
-----------------------------------------------------------------------
+ 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));
+}
+%typemap(ignore) svn_revnum_t * (svn_revnum_t temp) {
+ $1 = &temp;
+}
+

Index: ./util.i
===================================================================
--- ./util.i
+++ ./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;
+ }
+}
+
 /*
-----------------------------------------------------------------------
    fix up the svn_stream_read() ptr/len arguments
 */

Index: ./apr.i
===================================================================
--- ./apr.i
+++ ./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));
 }

---------------------------------------------------------------------
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.