From: Tim Jenness <tjenness@cpan.org>
Date: Tue, 27 Mar 2001 16:34:03 +0000 (-1000)
Subject: Re: [PATCH] Typemap testing
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=aa921f48035f298291146b3a8d6f142ec7cf8696;p=p5sagit%2Fp5-mst-13.2.git

Re: [PATCH] Typemap testing
Message-ID: <Pine.LNX.4.30.0103271633030.21198-100000@lapaki.jach.hawaii.edu>

p4raw-id: //depot/perl@9402
---

diff --git a/ext/XS/Typemap/Typemap.pm b/ext/XS/Typemap/Typemap.pm
index f14a0d2..ccfdfb1 100644
--- a/ext/XS/Typemap/Typemap.pm
+++ b/ext/XS/Typemap/Typemap.pm
@@ -67,7 +67,7 @@ $VERSION = '0.01';
 	   T_REF_IV_PTR_IN T_REF_IV_PTR_OUT
 	   T_PTROBJ_IN T_PTROBJ_OUT
 	   T_OPAQUE_IN T_OPAQUE_array
-	   T_OPAQUEPTR_IN T_OPAQUEPTR_OUT
+	   T_OPAQUEPTR_IN T_OPAQUEPTR_OUT T_OPAQUEPTR_OUT_short
 	   T_ARRAY
 	   T_STDIO_open T_STDIO_close T_STDIO_print
 	   /);
diff --git a/ext/XS/Typemap/Typemap.xs b/ext/XS/Typemap/Typemap.xs
index 7c24c44..ce8bb7c 100644
--- a/ext/XS/Typemap/Typemap.xs
+++ b/ext/XS/Typemap/Typemap.xs
@@ -584,6 +584,14 @@ T_OPAQUEPTR_OUT( ptr )
  OUTPUT:
   RETVAL
 
+short
+T_OPAQUEPTR_OUT_short( ptr )
+  shortOPQ * ptr
+ CODE:
+  RETVAL = *ptr;
+ OUTPUT:
+  RETVAL
+
 =item T_OPAQUE
 
 This can be used to store pointers to non-pointer types in an SV. It
diff --git a/ext/XS/Typemap/typemap b/ext/XS/Typemap/typemap
index 909221d..12928c4 100644
--- a/ext/XS/Typemap/typemap
+++ b/ext/XS/Typemap/typemap
@@ -15,3 +15,4 @@ intArray *      T_ARRAY
 intOpq          T_IV
 intOpq   *      T_OPAQUEPTR
 shortOPQ          T_OPAQUE
+shortOPQ *      T_OPAQUEPTR
diff --git a/t/lib/xs-typemap.t b/t/lib/xs-typemap.t
index a3e85da..131c32e 100644
--- a/t/lib/xs-typemap.t
+++ b/t/lib/xs-typemap.t
@@ -240,7 +240,7 @@ print "# T_OPAQUE\n";
 
 $t = 48;
 $ptr = T_OPAQUE_IN( $t );
-ok(T_OPAQUEPTR_OUT( $ptr ), $t);
+ok(T_OPAQUEPTR_OUT_short( $ptr ), $t);
 
 # T_OPAQUE_array
 my @opq = (2,4,8);