From dd17f8472bb45e438fb453aaca1e60741838e624 Mon Sep 17 00:00:00 2001
From: John Peacock <jpeacock@cpan.org>
Date: Sun, 29 Dec 2013 12:26:30 -0500
Subject: [PATCH 18/18] Apply patch from Sprout to make vxs.inc better
---
cpan/version/lib/version.pm | 4 +--
vxs.inc | 83 +++++++++++++++++++++++----------------------
2 files changed, 45 insertions(+), 42 deletions(-)
diff --git a/cpan/version/lib/version.pm b/cpan/version/lib/version.pm
index e6620c2..b21f1bd 100644
--- a/cpan/version/lib/version.pm
+++ b/cpan/version/lib/version.pm
@@ -4,13 +4,13 @@ package version;
use 5.005_05;
use strict;
-use vars qw(@ISA $VERSION $CLASS $STRICT $LAX *declare *qv);
+use vars qw(@ISA $VERSION $CLASS *declare *qv);
$VERSION = 0.9905;
$CLASS = 'version';
# avoid using Exporter
-use version::regex;
+require version::regex;
*version::is_lax = \&version::regex::is_lax;
*version::is_strict = \&version::regex::is_strict;
diff --git a/vxs.inc b/vxs.inc
index 25918e6..cb894f2 100644
--- a/vxs.inc
+++ b/vxs.inc
@@ -3,48 +3,51 @@
#ifdef PERL_CORE
# define VXS_CLASS "version"
+# define VXSp(name) XS_##name
#else
# define VXS_CLASS "version::vxs"
+# define VXSp(name) VXS_##name
#endif
+#define VXS(name) XS(VXSp(name))
#ifdef VXS_XSUB_DETAILS
# ifdef PERL_CORE
{"UNIVERSAL::VERSION", XS_UNIVERSAL_VERSION, NULL},
# else
- {VXS_CLASS "::_VERSION", XS_UNIVERSAL_VERSION, NULL},
+ {VXS_CLASS "::_VERSION", VXS_UNIVERSAL_VERSION, NULL},
# endif
- {VXS_CLASS "::()", XS_version_noop, NULL},
- {VXS_CLASS "::new", XS_version_new, NULL},
- {VXS_CLASS "::parse", XS_version_new, NULL},
- {VXS_CLASS "::(\"\"", XS_version_stringify, NULL},
- {VXS_CLASS "::stringify", XS_version_stringify, NULL},
- {VXS_CLASS "::(0+", XS_version_numify, NULL},
- {VXS_CLASS "::numify", XS_version_numify, NULL},
- {VXS_CLASS "::normal", XS_version_normal, NULL},
- {VXS_CLASS "::(cmp", XS_version_vcmp, NULL},
- {VXS_CLASS "::(<=>", XS_version_vcmp, NULL},
+ {VXS_CLASS "::()", VXSp(version_noop), NULL},
+ {VXS_CLASS "::new", VXSp(version_new), NULL},
+ {VXS_CLASS "::parse", VXSp(version_new), NULL},
+ {VXS_CLASS "::(\"\"", VXSp(version_stringify), NULL},
+ {VXS_CLASS "::stringify", VXSp(version_stringify), NULL},
+ {VXS_CLASS "::(0+", VXSp(version_numify), NULL},
+ {VXS_CLASS "::numify", VXSp(version_numify), NULL},
+ {VXS_CLASS "::normal", VXSp(version_normal), NULL},
+ {VXS_CLASS "::(cmp", VXSp(version_vcmp), NULL},
+ {VXS_CLASS "::(<=>", VXSp(version_vcmp), NULL},
# ifdef PERL_CORE
{VXS_CLASS "::vcmp", XS_version_vcmp, NULL},
# else
- {VXS_CLASS "::VCMP", XS_version_vcmp, NULL},
+ {VXS_CLASS "::VCMP", VXS_version_vcmp, NULL},
# endif
- {VXS_CLASS "::(bool", XS_version_boolean, NULL},
- {VXS_CLASS "::boolean", XS_version_boolean, NULL},
- {VXS_CLASS "::(+", XS_version_noop, NULL},
- {VXS_CLASS "::(-", XS_version_noop, NULL},
- {VXS_CLASS "::(*", XS_version_noop, NULL},
- {VXS_CLASS "::(/", XS_version_noop, NULL},
- {VXS_CLASS "::(+=", XS_version_noop, NULL},
- {VXS_CLASS "::(-=", XS_version_noop, NULL},
- {VXS_CLASS "::(*=", XS_version_noop, NULL},
- {VXS_CLASS "::(/=", XS_version_noop, NULL},
- {VXS_CLASS "::(abs", XS_version_noop, NULL},
- {VXS_CLASS "::(nomethod", XS_version_noop, NULL},
- {VXS_CLASS "::noop", XS_version_noop, NULL},
- {VXS_CLASS "::is_alpha", XS_version_is_alpha, NULL},
- {VXS_CLASS "::qv", XS_version_qv, NULL},
- {VXS_CLASS "::declare", XS_version_qv, NULL},
- {VXS_CLASS "::is_qv", XS_version_is_qv, NULL},
+ {VXS_CLASS "::(bool", VXSp(version_boolean), NULL},
+ {VXS_CLASS "::boolean", VXSp(version_boolean), NULL},
+ {VXS_CLASS "::(+", VXSp(version_noop), NULL},
+ {VXS_CLASS "::(-", VXSp(version_noop), NULL},
+ {VXS_CLASS "::(*", VXSp(version_noop), NULL},
+ {VXS_CLASS "::(/", VXSp(version_noop), NULL},
+ {VXS_CLASS "::(+=", VXSp(version_noop), NULL},
+ {VXS_CLASS "::(-=", VXSp(version_noop), NULL},
+ {VXS_CLASS "::(*=", VXSp(version_noop), NULL},
+ {VXS_CLASS "::(/=", VXSp(version_noop), NULL},
+ {VXS_CLASS "::(abs", VXSp(version_noop), NULL},
+ {VXS_CLASS "::(nomethod", VXSp(version_noop), NULL},
+ {VXS_CLASS "::noop", VXSp(version_noop), NULL},
+ {VXS_CLASS "::is_alpha", VXSp(version_is_alpha), NULL},
+ {VXS_CLASS "::qv", VXSp(version_qv), NULL},
+ {VXS_CLASS "::declare", VXSp(version_qv), NULL},
+ {VXS_CLASS "::is_qv", VXSp(version_is_qv), NULL},
#else
#ifndef dVAR
@@ -64,7 +67,7 @@ typedef char HVNAME;
# define HEKf "s"
#endif
-XS(XS_UNIVERSAL_VERSION)
+VXS(UNIVERSAL_VERSION)
{
dVAR;
dXSARGS;
@@ -165,7 +168,7 @@ XS(XS_UNIVERSAL_VERSION)
XSRETURN(1);
}
-XS(XS_version_new)
+VXS(version_new)
{
dVAR;
dXSARGS;
@@ -233,7 +236,7 @@ XS(XS_version_new)
Perl_croak(aTHX_ varname " is not of type version"); \
} STMT_END
-XS(XS_version_stringify)
+VXS(version_stringify)
{
dVAR;
dXSARGS;
@@ -251,7 +254,7 @@ XS(XS_version_stringify)
}
}
-XS(XS_version_numify)
+VXS(version_numify)
{
dVAR;
dXSARGS;
@@ -267,7 +270,7 @@ XS(XS_version_numify)
}
}
-XS(XS_version_normal)
+VXS(version_normal)
{
dVAR;
dXSARGS;
@@ -285,7 +288,7 @@ XS(XS_version_normal)
}
}
-XS(XS_version_vcmp)
+VXS(version_vcmp)
{
dVAR;
dXSARGS;
@@ -325,7 +328,7 @@ XS(XS_version_vcmp)
}
}
-XS(XS_version_boolean)
+VXS(version_boolean)
{
dVAR;
dXSARGS;
@@ -348,7 +351,7 @@ XS(XS_version_boolean)
}
}
-XS(XS_version_noop)
+VXS(version_noop)
{
dVAR;
dXSARGS;
@@ -361,7 +364,7 @@ XS(XS_version_noop)
XSRETURN_EMPTY;
}
-XS(XS_version_is_alpha)
+VXS(version_is_alpha)
{
dVAR;
dXSARGS;
@@ -380,7 +383,7 @@ XS(XS_version_is_alpha)
}
}
-XS(XS_version_qv)
+VXS(version_qv)
{
dVAR;
dXSARGS;
@@ -434,7 +437,7 @@ XS(XS_version_qv)
return;
}
-XS(XS_version_is_qv)
+VXS(version_is_qv)
{
dVAR;
dXSARGS;
--
1.8.3.2