You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Patrick Mayweg <ma...@qint.de> on 2004/03/17 11:57:33 UTC

[PATCH]fixing the long long problem for the perl-swig bindings.

Hi,
the problem with using the non standard types "long long" and "unsigned 
long long" happens also to be in subversion/bindings/swig/swigutil_pl.c.
This patch replace all the system dependend types and printf format 
strings with the apr types and macros.
[[
 * swigutil.c (svn_swig_pl_callback_thunk)
    replace the non standard types and printf format string with their 
apr counterparts
]]

Index: swigutil_pl.c
===================================================================
--- swigutil_pl.c    (revision 9065)
+++ swigutil_pl.c    (working copy)
@@ -312,14 +312,14 @@
          * it available as a string.  If not then perl will convert
          * it to an IV for us.  So this handles the problem gracefully */
         c = malloc(30);
-        snprintf(c,30,"%lld",va_arg(ap, long long));
+        snprintf(c,30,"%" APR_INT64_T_FMT,va_arg(ap, apr_int64_t));
         XPUSHs(sv_2mortal(newSVpv(c, 0)));
         free(c);
         break;
        
     case 'U': /* unsigned long long */
         c = malloc(30);
-        snprintf(c,30,"%llu",va_arg(ap, unsigned long long));
+        snprintf(c,30,"%"APR_INT64_T_FMT,va_arg(ap, apr_uint64_t));
         XPUSHs(sv_2mortal(newSVpv(c, 0)));
         free(c);
         break;



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH]fixing the long long problem for the perl-swig bindings.

Posted by Ben Reser <be...@reser.org>.
On Thu, Mar 18, 2004 at 07:39:56AM +0100, Patrick Mayweg wrote:
> After look through the perl include files, I have found in config.h the 
> types "Quad_t" and "I64TYPE" which look like they were perls way of 
> describing 64bit integers.

Can't use those.  They may be of a different C type than APR's vars
which will cause GCC to emit warnings.

-- 
Ben Reser <be...@reser.org>
http://ben.reser.org

"Conscience is the inner voice which warns us somebody may be looking."
- H.L. Mencken

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH]fixing the long long problem for the perl-swig bindings.

Posted by Patrick Mayweg <ma...@qint.de>.
Patrick Mayweg wrote:

> Hi Ben,
> Ben Reser wrote:
>
>> On Wed, Mar 17, 2004 at 12:57:33PM +0100, Patrick Mayweg wrote:
>>  
>>
>>> Hi,
>>> the problem with using the non standard types "long long" and 
>>> "unsigned long long" happens also to be in 
>>> subversion/bindings/swig/swigutil_pl.c.
>>> This patch replace all the system dependend types and printf format 
>>> strings with the apr types and macros.
>>> [[
>>> * swigutil.c (svn_swig_pl_callback_thunk)
>>>   replace the non standard types and printf format string with their 
>>> apr counterparts
>>> ]]
>>>
>>> Index: swigutil_pl.c
>>> ===================================================================
>>> --- swigutil_pl.c    (revision 9065)
>>> +++ swigutil_pl.c    (working copy)
>>> @@ -312,14 +312,14 @@
>>>         * it available as a string.  If not then perl will convert
>>>         * it to an IV for us.  So this handles the problem 
>>> gracefully */
>>>        c = malloc(30);
>>> -        snprintf(c,30,"%lld",va_arg(ap, long long));
>>> +        snprintf(c,30,"%" APR_INT64_T_FMT,va_arg(ap, apr_int64_t));
>>>        XPUSHs(sv_2mortal(newSVpv(c, 0)));
>>>        free(c);
>>>        break;
>>>          case 'U': /* unsigned long long */
>>>        c = malloc(30);
>>> -        snprintf(c,30,"%llu",va_arg(ap, unsigned long long));
>>> +        snprintf(c,30,"%"APR_INT64_T_FMT,va_arg(ap, apr_uint64_t));
>>>        XPUSHs(sv_2mortal(newSVpv(c, 0)));
>>>        free(c);
>>>        break;
>>>   
>>
>>
>> I need to seriously sit down and rework this code.  I did a little fixup
>> on it to get around int vs long sizes but I really should handle apr
>> types better.  I think there may be cases where we're actually passing C
>> types into this function and sometimes apr types.  So before I make this
>> change I want to actually sit down and track all of these down and look
>> at them.  I also want to update the documentation too.
>>
>>  
>>
> Please remember that "long long" is not portable. A 64bit integer can 
> be anything from "long", "long long" or "__int64" depending on your 
> compiler.

After look through the perl include files, I have found in config.h the 
types "Quad_t" and "I64TYPE" which look like they were perls way of 
describing 64bit integers.

>
> I have another question. After appling the above patch, the build stop 
> because swig is looking for "delta_editor.hi", which I did not find. 
> Do you have any idea where that may be ?
>
> Regards,
> Patrick
>
>
Patrick


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH]fixing the long long problem for the perl-swig bindings.

Posted by Ben Reser <be...@reser.org>.
On Thu, Mar 18, 2004 at 09:30:39AM +0100, Patrick Mayweg wrote:
> So it will not be generated on win32 right now, since neither 
> Makefile.PL is run nor the resulting Makefile is run.
> If you want the binding available on win32, we must find a way for these 
> things to be run.

Look at Makefile.PL, it's pretty obvious how they are generated.

But really Perl modules need make to build.  The effort to re-engineer
the perl build system is not worth it.  Installing gnu make is simply a
hell of a lot easier.

-- 
Ben Reser <be...@reser.org>
http://ben.reser.org

"Conscience is the inner voice which warns us somebody may be looking."
- H.L. Mencken

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH]fixing the long long problem for the perl-swig bindings.

Posted by Patrick Mayweg <ma...@qint.de>.
Hi Ben,
Ben Reser wrote:

>On Thu, Mar 18, 2004 at 07:30:38AM +0100, Patrick Mayweg wrote:
>  
>
>>Please remember that "long long" is not portable. A 64bit integer can be 
>>anything from "long", "long long" or "__int64" depending on your compiler.
>>    
>>
>
>In some places SWIG handles that for us, in others it doesn't.  :(
>
>  
>
>>I have another question. After appling the above patch, the build stop 
>>because swig is looking for "delta_editor.hi", which I did not find. Do 
>>you have any idea where that may be ?
>>    
>>
>
>Autogenerated by the Makefile that Makefile.PL generates.  Should be in
>subversion/bindings/swig/perl
>
>  
>
So it will not be generated on win32 right now, since neither 
Makefile.PL is run nor the resulting Makefile is run.
If you want the binding available on win32, we must find a way for these 
things to be run.

Patrick



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH]fixing the long long problem for the perl-swig bindings.

Posted by Ben Reser <be...@reser.org>.
On Thu, Mar 18, 2004 at 07:30:38AM +0100, Patrick Mayweg wrote:
> Please remember that "long long" is not portable. A 64bit integer can be 
> anything from "long", "long long" or "__int64" depending on your compiler.

In some places SWIG handles that for us, in others it doesn't.  :(

> I have another question. After appling the above patch, the build stop 
> because swig is looking for "delta_editor.hi", which I did not find. Do 
> you have any idea where that may be ?

Autogenerated by the Makefile that Makefile.PL generates.  Should be in
subversion/bindings/swig/perl

-- 
Ben Reser <be...@reser.org>
http://ben.reser.org

"Conscience is the inner voice which warns us somebody may be looking."
- H.L. Mencken

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH]fixing the long long problem for the perl-swig bindings.

Posted by Patrick Mayweg <ma...@qint.de>.
Hi Ben,
Ben Reser wrote:

>On Wed, Mar 17, 2004 at 12:57:33PM +0100, Patrick Mayweg wrote:
>  
>
>>Hi,
>>the problem with using the non standard types "long long" and "unsigned 
>>long long" happens also to be in subversion/bindings/swig/swigutil_pl.c.
>>This patch replace all the system dependend types and printf format 
>>strings with the apr types and macros.
>>[[
>>* swigutil.c (svn_swig_pl_callback_thunk)
>>   replace the non standard types and printf format string with their 
>>apr counterparts
>>]]
>>
>>Index: swigutil_pl.c
>>===================================================================
>>--- swigutil_pl.c    (revision 9065)
>>+++ swigutil_pl.c    (working copy)
>>@@ -312,14 +312,14 @@
>>         * it available as a string.  If not then perl will convert
>>         * it to an IV for us.  So this handles the problem gracefully */
>>        c = malloc(30);
>>-        snprintf(c,30,"%lld",va_arg(ap, long long));
>>+        snprintf(c,30,"%" APR_INT64_T_FMT,va_arg(ap, apr_int64_t));
>>        XPUSHs(sv_2mortal(newSVpv(c, 0)));
>>        free(c);
>>        break;
>>       
>>    case 'U': /* unsigned long long */
>>        c = malloc(30);
>>-        snprintf(c,30,"%llu",va_arg(ap, unsigned long long));
>>+        snprintf(c,30,"%"APR_INT64_T_FMT,va_arg(ap, apr_uint64_t));
>>        XPUSHs(sv_2mortal(newSVpv(c, 0)));
>>        free(c);
>>        break;
>>    
>>
>
>I need to seriously sit down and rework this code.  I did a little fixup
>on it to get around int vs long sizes but I really should handle apr
>types better.  I think there may be cases where we're actually passing C
>types into this function and sometimes apr types.  So before I make this
>change I want to actually sit down and track all of these down and look
>at them.  I also want to update the documentation too.
>
>  
>
Please remember that "long long" is not portable. A 64bit integer can be 
anything from "long", "long long" or "__int64" depending on your compiler.

I have another question. After appling the above patch, the build stop 
because swig is looking for "delta_editor.hi", which I did not find. Do 
you have any idea where that may be ?

Regards,
Patrick


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH]fixing the long long problem for the perl-swig bindings.

Posted by Ben Reser <be...@reser.org>.
On Wed, Mar 17, 2004 at 10:59:33AM -0800, Ben Reser wrote:
> I need to seriously sit down and rework this code.  I did a little fixup
> on it to get around int vs long sizes but I really should handle apr
> types better.  I think there may be cases where we're actually passing C
> types into this function and sometimes apr types.  So before I make this
> change I want to actually sit down and track all of these down and look
> at them.  I also want to update the documentation too.

Done in r9315.

-- 
Ben Reser <be...@reser.org>
http://ben.reser.org

"Conscience is the inner voice which warns us somebody may be looking."
- H.L. Mencken

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH]fixing the long long problem for the perl-swig bindings.

Posted by Ben Reser <be...@reser.org>.
On Wed, Mar 17, 2004 at 12:57:33PM +0100, Patrick Mayweg wrote:
> Hi,
> the problem with using the non standard types "long long" and "unsigned 
> long long" happens also to be in subversion/bindings/swig/swigutil_pl.c.
> This patch replace all the system dependend types and printf format 
> strings with the apr types and macros.
> [[
> * swigutil.c (svn_swig_pl_callback_thunk)
>    replace the non standard types and printf format string with their 
> apr counterparts
> ]]
> 
> Index: swigutil_pl.c
> ===================================================================
> --- swigutil_pl.c    (revision 9065)
> +++ swigutil_pl.c    (working copy)
> @@ -312,14 +312,14 @@
>          * it available as a string.  If not then perl will convert
>          * it to an IV for us.  So this handles the problem gracefully */
>         c = malloc(30);
> -        snprintf(c,30,"%lld",va_arg(ap, long long));
> +        snprintf(c,30,"%" APR_INT64_T_FMT,va_arg(ap, apr_int64_t));
>         XPUSHs(sv_2mortal(newSVpv(c, 0)));
>         free(c);
>         break;
>        
>     case 'U': /* unsigned long long */
>         c = malloc(30);
> -        snprintf(c,30,"%llu",va_arg(ap, unsigned long long));
> +        snprintf(c,30,"%"APR_INT64_T_FMT,va_arg(ap, apr_uint64_t));
>         XPUSHs(sv_2mortal(newSVpv(c, 0)));
>         free(c);
>         break;

I need to seriously sit down and rework this code.  I did a little fixup
on it to get around int vs long sizes but I really should handle apr
types better.  I think there may be cases where we're actually passing C
types into this function and sometimes apr types.  So before I make this
change I want to actually sit down and track all of these down and look
at them.  I also want to update the documentation too.

-- 
Ben Reser <be...@reser.org>
http://ben.reser.org

"Conscience is the inner voice which warns us somebody may be looking."
- H.L. Mencken

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org