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

Re: [patch] Building the Ruby bindings on windows with SWIG > 1.3.24

From: Joe Swatosh <joe.swatosh_at_gmail.com>
Date: 2007-04-12 07:07:58 CEST

On 4/11/07, Joe Swatosh <joe.swatosh@gmail.com> wrote:
> Hi kou,
>
> On 4/11/07, Kouhei Sutou <kou@cozmixng.org> wrote:
> > Hi Joe,
> >
> > 2007/4/12, Joe Swatosh <joe.swatosh@gmail.com>:
> > > Okay, third time's the charm, (actually the same as the second patch, but this
> > > time I'm sure of the testing) I got it building and testing with these
> > > results....
> >
> > There are some %apply in apr.i:
> > /* If sizeof(apr_off_t) > sizeof(apr_int64_t), apr_off_t will get truncated
> > * to a 64-bit integer */
> > %apply long long { apr_off_t, apr_int64_t }
> > %apply long long *OUTPUT { apr_int64_t * };
> > %apply unsigned long long { apr_uint64_t }
> >
> > Is it enought that we define 'long long' and unsigned long long' typemap?
> >
> > What about the attached patch?
> >
>
> I haven't tried it yet (waiting for other tests), but I don't think it
> will work. Without the "%clear long long" SWIG was generating
> functions using long long instead of apr_int64_t. VC6 will generate
> errors for any mention of long long. When my other tests are done,
> I'll try it and give a 'for certain' answer.
> --
> Joe
>

With your patch as it stands, SWIG generated the following two
functions that VC6
cannot compile:

/*@SWIG:%ruby_aux_method@*/
SWIGINTERN VALUE SWIG_AUX_NUM2LL(VALUE *args)
{
  VALUE obj = args[0];
  VALUE type = TYPE(obj);
  long long *res = (long long *)(args[1]);
  *res = type == T_FIXNUM ? NUM2LL(obj) : rb_big2ll(obj);
  return obj;
}
/*@SWIG@*/

SWIGINTERN int
SWIG_AsVal_long_SS_long (VALUE obj, long long *val)
{
  VALUE type = TYPE(obj);
  if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
    long long v;
    VALUE a[2];
    a[0] = obj;
    a[1] = (VALUE)(&v);
    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LL), (VALUE)a,
RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
      if (val) *val = v;
      return SWIG_OK;
    }
  }
  return SWIG_TypeError;
}

After I added the
%clear long long;
at the front of your patch those functions were not generated and it
worked fine.

--
Joe
Index: subversion/bindings/swig/include/svn_global.swg
===================================================================
--- subversion/bindings/swig/include/svn_global.swg     (revision 24543)
+++ subversion/bindings/swig/include/svn_global.swg     (working copy)
@@ -146,6 +146,27 @@
#ifdef SWIGRUBY
+%clear long long;
+
+%typemap (in) long long
+{
+  $1 = ($1_ltype)NUM2LL($input);
+}
+
+%typemap (in) unsigned long long
+{
+  $1 = ($1_ltype)NUM2ULL($input);
+}
+
+%typemap (out) long long
+{
+  $result = LL2NUM((apr_int64_t)($1));
+}
+
+%typemap(argout) long long *OUTPUT {
+  %append_output(LL2NUM(*$1));
+}
+
/* Ruby has strict capitalization conventions -
    tell SWIG to not warn as it renames things to follow these. */
#pragma SWIG nowarn=801
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Apr 12 07:08:20 2007

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.