summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2012-11-19 13:14:24 -0700
committerKarl Williamson <public@khwilliamson.com>2012-11-19 17:13:02 -0700
commit840f8e9207353b89e0c2790e03fe16f44071615b (patch)
tree49898c5d54c2715bede005060d81145ea27ace01
parenta35d759aff667e2ddcde81fae0f6dbaecf27e7b1 (diff)
downloadperl-840f8e9207353b89e0c2790e03fe16f44071615b.tar.gz
handy.h: Add isVERTWS_uni(), isVERTWS_utf8()
These two macros match the same things as \v does in patterns. I'm leaving them undocumented for now.
-rw-r--r--ext/XS-APItest/APItest.pm2
-rw-r--r--ext/XS-APItest/APItest.xs14
-rw-r--r--ext/XS-APItest/t/handy.t3
-rw-r--r--handy.h2
-rw-r--r--regcharclass.h12
-rwxr-xr-xregen/regcharclass.pl2
6 files changed, 33 insertions, 2 deletions
diff --git a/ext/XS-APItest/APItest.pm b/ext/XS-APItest/APItest.pm
index 71c9cc18cb..68ec99ca34 100644
--- a/ext/XS-APItest/APItest.pm
+++ b/ext/XS-APItest/APItest.pm
@@ -5,7 +5,7 @@ use strict;
use warnings;
use Carp;
-our $VERSION = '0.45';
+our $VERSION = '0.46';
require XSLoader;
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs
index 8d5b312743..2afbcd03ca 100644
--- a/ext/XS-APItest/APItest.xs
+++ b/ext/XS-APItest/APItest.xs
@@ -3585,6 +3585,20 @@ test_isBLANK_utf8(unsigned char * p)
RETVAL
bool
+test_isVERTWS_uni(UV ord)
+ CODE:
+ RETVAL = isVERTWS_uni(ord);
+ OUTPUT:
+ RETVAL
+
+bool
+test_isVERTWS_utf8(unsigned char * p)
+ CODE:
+ RETVAL = isVERTWS_utf8(p);
+ OUTPUT:
+ RETVAL
+
+bool
test_isUPPER_uni(UV ord)
CODE:
RETVAL = isUPPER_uni(ord);
diff --git a/ext/XS-APItest/t/handy.t b/ext/XS-APItest/t/handy.t
index f822b8cc76..9433409d48 100644
--- a/ext/XS-APItest/t/handy.t
+++ b/ext/XS-APItest/t/handy.t
@@ -28,6 +28,7 @@ my %properties = (
punct => 'XPosixPunct',
quotemeta => '_Perl_Quotemeta',
space => 'XPerlSpace',
+ vertws => 'VertSpace',
upper => 'Upper',
xdigit => 'XDigit',
);
@@ -86,6 +87,7 @@ foreach my $name (sort keys %properties) {
}
next;
}
+ if ($name ne 'vertws') {
$ret = truth eval "test_is${function}_A($i)";
if ($@) {
fail($@);
@@ -102,6 +104,7 @@ foreach my $name (sort keys %properties) {
my $truth = truth($matches && $i < 256);
is ($ret, $truth, "is${function}_L1( $display_name ) == $truth");
}
+ }
next if $name eq 'alnumc';
$ret = truth eval "test_is${function}_uni($i)";
diff --git a/handy.h b/handy.h
index 613129e7a7..e657919e44 100644
--- a/handy.h
+++ b/handy.h
@@ -930,6 +930,7 @@ EXTCONST U32 PL_charclass[];
#define isIDFIRST_uni(c) _generic_uni(_CC_IDFIRST, is_uni_idfirst, c)
#define isALPHA_uni(c) _generic_uni(_CC_ALPHA, is_uni_alpha, c)
#define isSPACE_uni(c) _generic_uni(_CC_SPACE, is_uni_space, c)
+#define isVERTWS_uni(c) _generic_uni(_CC_VERTSPACE, is_VERTWS_cp_high, c)
#define isDIGIT_uni(c) _generic_uni(_CC_DIGIT, is_uni_digit, c)
#define isUPPER_uni(c) _generic_uni(_CC_UPPER, is_uni_upper, c)
#define isLOWER_uni(c) _generic_uni(_CC_LOWER, is_uni_lower, c)
@@ -1001,6 +1002,7 @@ EXTCONST U32 PL_charclass[];
#define isALPHA_utf8(p) _generic_utf8(_CC_ALPHA, is_utf8_alpha, p)
#define isBLANK_utf8(p) _generic_utf8(_CC_BLANK, is_utf8_blank, p)
#define isSPACE_utf8(p) _generic_utf8(_CC_SPACE, is_utf8_space, p)
+#define isVERTWS_utf8(p) _generic_utf8(_CC_VERTSPACE, is_VERTWS_high, p)
#define isDIGIT_utf8(p) _generic_utf8(_CC_DIGIT, is_utf8_digit, p)
#define isUPPER_utf8(p) _generic_utf8(_CC_UPPER, is_utf8_upper, p)
#define isLOWER_utf8(p) _generic_utf8(_CC_LOWER, is_utf8_lower, p)
diff --git a/regcharclass.h b/regcharclass.h
index f7b42294d4..497d0914cd 100644
--- a/regcharclass.h
+++ b/regcharclass.h
@@ -269,6 +269,14 @@
: 0 )
/*** GENERATED CODE ***/
+#define is_VERTWS_high(s) \
+( ( ( ( 0xE2 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 )
+
+/*** GENERATED CODE ***/
+#define is_VERTWS_high_safe(s,e) \
+( ( ( ( ((e)-(s) > 2) && ( 0xE2 == ((U8*)s)[0] ) ) && ( 0x80 == ((U8*)s)[1] ) ) && ( ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 )
+
+/*** GENERATED CODE ***/
#define is_VERTWS_latin1(s) \
( ( 0x0A <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) || 0x85 == ((U8*)s)[0] )
@@ -284,6 +292,10 @@
( 0x85 == cp || ( 0x85 < cp && \
( 0x2028 == cp || 0x2029 == cp ) ) ) ) )
+/*** GENERATED CODE ***/
+#define is_VERTWS_cp_high(cp) \
+( 0x2028 == cp || 0x2029 == cp )
+
/*
REPLACEMENT: Unicode REPLACEMENT CHARACTER
diff --git a/regen/regcharclass.pl b/regen/regcharclass.pl
index 06ce4065d9..830a014fed 100755
--- a/regen/regcharclass.pl
+++ b/regen/regcharclass.pl
@@ -1393,7 +1393,7 @@ HORIZWS: Horizontal Whitespace: \h \H
\p{HorizSpace}
VERTWS: Vertical Whitespace: \v \V
-=> generic UTF8 LATIN1 cp :fast safe
+=> generic UTF8 high LATIN1 cp cp_high :fast safe
\p{VertSpace}
REPLACEMENT: Unicode REPLACEMENT CHARACTER