develooper Front page | perl.perl5.porters | Postings from February 2012

Re: XS Typemap documentation and related changes

Thread Previous | Thread Next
From:
Craig A. Berry
Date:
February 2, 2012 17:21
Subject:
Re: XS Typemap documentation and related changes
Message ID:
CA+vYcVwFdBQ_3Xq21TU_3MP4wMVzivSd82Trtn9u3WWrnoKVDw@mail.gmail.com
On Thu, Feb 2, 2012 at 1:21 AM, Steffen Mueller <smueller@cpan.org> wrote:
> On 02/02/2012 05:50 AM, Craig A. Berry wrote:
>>
>> On Wed, Feb 1, 2012 at 1:47 AM, Steffen Mueller<smueller@cpan.org>  wrote:
>>>
>>> Hi all,
>>>
>>> The changes outlined below are now in blead. You know where to find me
>>> for
>>> sending bombs.
>>
>>
>> No bombs, just a couple of friendly stun grenades from the compiler I'm
>> using:
>
> [...]
>
> Pushed a change to disable these tests.

I reverted that change and pushed the following, which builds and
passes on  VMS and OS X:

commit 08d5d1db9586f83ed261965aabe8db9e99502648
Author: Craig A. Berry <craigberry@mac.com>
Date:   Thu Feb 2 18:50:44 2012 -0600

    Resurrect PerlIO-related typemap tests.

    Apparently we were just missing the fact that T_IN and T_OUT are
    pointers to PerlIO structs, not PerlIO structs themselves, which
    kinda makes sense as you wouldn't normally have an entire struct
    as a return value.

diff --git a/ext/XS-Typemap/Typemap.xs b/ext/XS-Typemap/Typemap.xs
index d69a700..3dc5b88 100644
--- a/ext/XS-Typemap/Typemap.xs
+++ b/ext/XS-Typemap/Typemap.xs
@@ -30,8 +30,8 @@ typedef int intTLONG; /* T_LONG */
 typedef short shortOPQ;   /* T_OPAQUE */
 typedef int intOpq;   /* T_OPAQUEPTR */
 typedef unsigned intUnsigned; /* T_U_INT */
-typedef PerlIO inputfh; /* T_IN */
-typedef PerlIO outputfh; /* T_OUT */
+typedef PerlIO * inputfh; /* T_IN */
+typedef PerlIO * outputfh; /* T_OUT */

 /* A structure to test T_OPAQUEPTR and T_PACKED */
 struct t_opaqueptr {
[end]

I find it a bit strange that lib/ExtUtils/typemap has:

PerlIO *		T_INOUT
FileHandle		T_PTROBJ
InputStream		T_IN
InOutStream		T_INOUT
OutputStream		T_OUT

So we know that T_INOUT is a pointer to PerlIO because it's defined
twice, one of them being as the InOutStream alias, or convenience
synonym, or whatever it should be called in this context, but nothing
similar exists for T_IN and T_OUT.

I have no idea and could not (easily) figure out how xsubpp converts
something such as InputStream to an actual C typedef (presumably
"PerlIO *").  But thanks to Steffen for starting to swat at the
cobwebs.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About