summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-10-14 13:29:22 +0100
committerNicholas Clark <nick@ccl4.org>2010-10-14 14:34:28 +0100
commit8cf6f931c54936a38eedd3d17d5fa1d5af1b9009 (patch)
treed1454e028f6b92f0458daaf6522aac4117323a00
parent17b8ae88c658cb5fe05998ab824e6c02cfba7dcd (diff)
downloadperl-8cf6f931c54936a38eedd3d17d5fa1d5af1b9009.tar.gz
Convert lib/Tie/Hash/NamedCapture.pm to an XS module in ext/
Initially move only Tie::Hash::NamedCapture::flags from universal.c to it.
-rw-r--r--MANIFEST3
-rwxr-xr-xMakefile.SH2
-rwxr-xr-xPorting/Maintainers.pl1
-rw-r--r--ext/Tie-Hash-NamedCapture/NamedCapture.pm (renamed from lib/Tie/Hash/NamedCapture.pm)8
-rw-r--r--ext/Tie-Hash-NamedCapture/NamedCapture.xs14
-rw-r--r--universal.c15
-rw-r--r--win32/Makefile1
-rw-r--r--win32/makefile.mk1
8 files changed, 24 insertions, 21 deletions
diff --git a/MANIFEST b/MANIFEST
index 3dda418baa..58c85ca736 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -3342,6 +3342,8 @@ ext/Socket/t/Socket.t See if Socket works
ext/Sys-Hostname/Hostname.pm Sys::Hostname extension Perl module
ext/Sys-Hostname/Hostname.xs Sys::Hostname extension external subroutines
ext/Sys-Hostname/t/Hostname.t See if Sys::Hostname works
+ext/Tie-Hash-NamedCapture/NamedCapture.pm Implements %- and %+ behaviour
+ext/Tie-Hash-NamedCapture/NamedCapture.xs Implements %- and %+ behaviour
ext/Tie-Memoize/lib/Tie/Memoize.pm Base class for memoized tied hashes
ext/Tie-Memoize/t/Tie-Memoize.t Test for Tie::Memoize
ext/Time-Local/lib/Time/Local.pm Reverse translation of localtime, gmtime
@@ -3744,7 +3746,6 @@ lib/Tie/ExtraHash.t Test for Tie::ExtraHash (in Tie/Hash.pm)
lib/Tie/Handle.pm Base class for tied handles
lib/Tie/Handle/stdhandle_from_handle.t Test for Tie::StdHandle/Handle backwards compat
lib/Tie/Handle/stdhandle.t Test for Tie::StdHandle
-lib/Tie/Hash/NamedCapture.pm Implements %- and %+ behaviour
lib/Tie/Hash.pm Base class for tied hashes
lib/Tie/Hash.t See if Tie::Hash works
lib/Tie/Scalar.pm Base class for tied scalars
diff --git a/Makefile.SH b/Makefile.SH
index 65595835ef..998a6eeafe 100755
--- a/Makefile.SH
+++ b/Makefile.SH
@@ -1315,7 +1315,7 @@ _cleaner2:
-rmdir lib/Package lib/Params
-rmdir lib/Pod/Perldoc lib/Pod/Simple lib/Pod/Text
-rmdir lib/Sys lib/Scalar/Util lib/Scalar
- -rmdir lib/Term/UI lib/Thread
+ -rmdir lib/Term/UI lib/Thread lib/Tie/Hash
-rmdir lib/Test/Builder/Tester lib/Test/Builder lib/Test
-rmdir lib/Unicode/Collate
-rmdir lib/XS/APItest lib/XS
diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl
index 9fe49e53af..5d87de2bc0 100755
--- a/Porting/Maintainers.pl
+++ b/Porting/Maintainers.pl
@@ -1676,6 +1676,7 @@ use File::Glob qw(:case);
ext/SDBM_File/
ext/Socket/
ext/Sys-Hostname/
+ ext/Tie-Hash-NamedCapture/
ext/Tie-Memoize/
ext/XS-APItest/
ext/XS-Typemap/
diff --git a/lib/Tie/Hash/NamedCapture.pm b/ext/Tie-Hash-NamedCapture/NamedCapture.pm
index 58ae743d87..065d68deff 100644
--- a/lib/Tie/Hash/NamedCapture.pm
+++ b/ext/Tie-Hash-NamedCapture/NamedCapture.pm
@@ -1,10 +1,10 @@
+use strict;
package Tie::Hash::NamedCapture;
-our $VERSION = "0.06";
+our $VERSION = "0.07";
-# The real meat implemented in XS in universal.c in the core, but this
-# method was left behind because gv.c expects a Purl-Perl method in
-# this package when it loads the tie magic for %+ and %-
+require XSLoader;
+XSLoader::load(__PACKAGE__);
my ($one, $all) = Tie::Hash::NamedCapture::flags();
diff --git a/ext/Tie-Hash-NamedCapture/NamedCapture.xs b/ext/Tie-Hash-NamedCapture/NamedCapture.xs
new file mode 100644
index 0000000000..b51dedae78
--- /dev/null
+++ b/ext/Tie-Hash-NamedCapture/NamedCapture.xs
@@ -0,0 +1,14 @@
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+MODULE = Tie::Hash::NamedCapture PACKAGE = Tie::Hash::NamedCapture
+PROTOTYPES: DISABLE
+
+void
+flags(...)
+ PPCODE:
+ EXTEND(SP, 2);
+ mPUSHu(RXapif_ONE);
+ mPUSHu(RXapif_ALL);
+
diff --git a/universal.c b/universal.c
index 58d00e07cc..2cfb241bcb 100644
--- a/universal.c
+++ b/universal.c
@@ -1366,20 +1366,6 @@ XS(XS_Tie_Hash_NamedCapture_SCALAR)
S_named_capture_common(aTHX_ cv, FALSE, 1, FALSE, RXapif_SCALAR);
}
-XS(XS_Tie_Hash_NamedCapture_flags)
-{
- dVAR;
- dXSARGS;
-
- if (items != 0)
- croak_xs_usage(cv, "");
-
- mXPUSHu(RXapif_ONE);
- mXPUSHu(RXapif_ALL);
- PUTBACK;
- return;
-}
-
struct xsub_details {
const char *name;
XSUBADDR_t xsub;
@@ -1438,7 +1424,6 @@ struct xsub_details details[] = {
{"Tie::Hash::NamedCapture::FIRSTKEY", XS_Tie_Hash_NamedCapture_FIRSTK, NULL},
{"Tie::Hash::NamedCapture::NEXTKEY", XS_Tie_Hash_NamedCapture_NEXTK, NULL},
{"Tie::Hash::NamedCapture::SCALAR", XS_Tie_Hash_NamedCapture_SCALAR, NULL},
- {"Tie::Hash::NamedCapture::flags", XS_Tie_Hash_NamedCapture_flags, NULL}
};
void
diff --git a/win32/Makefile b/win32/Makefile
index 9816d56a16..9e8f630112 100644
--- a/win32/Makefile
+++ b/win32/Makefile
@@ -1180,6 +1180,7 @@ distclean: realclean
-if exist $(LIBDIR)\Test rmdir /s /q $(LIBDIR)\Test
-if exist $(LIBDIR)\Thread rmdir /s /q $(LIBDIR)\Thread
-if exist $(LIBDIR)\threads rmdir /s /q $(LIBDIR)\threads
+ -if exist $(LIBDIR)\Tie\Hash rmdir /s /q $(LIBDIR)\Tie\Hash
-if exist $(LIBDIR)\Unicode\Collate rmdir /s /q $(LIBDIR)\Unicode\Collate
-if exist $(LIBDIR)\XS rmdir /s /q $(LIBDIR)\XS
-if exist $(LIBDIR)\Win32API rmdir /s /q $(LIBDIR)\Win32API
diff --git a/win32/makefile.mk b/win32/makefile.mk
index bbba91e4b9..d8a188d290 100644
--- a/win32/makefile.mk
+++ b/win32/makefile.mk
@@ -1544,6 +1544,7 @@ distclean: realclean
-if exist $(LIBDIR)\Test rmdir /s /q $(LIBDIR)\Test
-if exist $(LIBDIR)\Thread rmdir /s /q $(LIBDIR)\Thread
-if exist $(LIBDIR)\threads rmdir /s /q $(LIBDIR)\threads
+ -if exist $(LIBDIR)\Tie\Hash rmdir /s /q $(LIBDIR)\Tie\Hash
-if exist $(LIBDIR)\Unicode\Collate rmdir /s /q $(LIBDIR)\Unicode\Collate
-if exist $(LIBDIR)\XS rmdir /s /q $(LIBDIR)\XS
-if exist $(LIBDIR)\Win32API rmdir /s /q $(LIBDIR)\Win32API