In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/f91dcd139f8093525e1a00c3803de98b1bf89cab?hp=8c6c6997cf2a8cd5e947a61f94ca02dd8b963334>
- Log ----------------------------------------------------------------- commit f91dcd139f8093525e1a00c3803de98b1bf89cab Author: Karl Williamson <[email protected]> Date: Wed Nov 28 20:16:06 2012 -0700 Make isIDFIRST_uni() return identically as isIDFIRST_utf8() These two macros should have the same results for the same input code points. Prior to this patch, the _uni() macro returned the official Unicode ID_Start property, and the _utf8() macro returned Perl's slightly restricted definition. Now both return Perl's. M embed.fnc M embed.h M ext/XS-APItest/t/handy.t M handy.h M proto.h M utf8.c commit d65654cb6cbb4fc9585a24b036a3a7a4cc1f1fa5 Author: Karl Williamson <[email protected]> Date: Wed Nov 28 19:51:43 2012 -0700 Remove double underscore in internal function name This function was added in 5.16, and has no callers in CPAN. It is undocumented and marked as changeable. Its name has two underscores in a row by mistake. This removes one of them. M embed.fnc M embed.h M handy.h M proto.h M utf8.c commit 4f6ef7cc505297417746e20a3bf81a0247b8b64c Author: Karl Williamson <[email protected]> Date: Wed Nov 28 20:40:12 2012 -0700 XS-APItest/t/handy.t: Turn off non_unicode warnings Tests here use above-Unicode code points, so the warnings these might otherwise generate should be forced off. M ext/XS-APItest/t/handy.t commit 83adc448c422fb39103f1c69b2cd9cb91392f31b Author: Karl Williamson <[email protected]> Date: Wed Nov 28 20:35:45 2012 -0700 charnames: Check for enabled warnings before warning This message should be suppressed if non_unicode warnings are turned off. M lib/_charnames.pm M lib/charnames.pm ----------------------------------------------------------------------- Summary of changes: embed.fnc | 3 ++- embed.h | 3 ++- ext/XS-APItest/t/handy.t | 5 +++++ handy.h | 11 +++++------ lib/_charnames.pm | 6 ++++-- lib/charnames.pm | 2 +- proto.h | 7 +++++-- utf8.c | 12 ++++++++++-- 8 files changed, 34 insertions(+), 15 deletions(-) diff --git a/embed.fnc b/embed.fnc index 409d75a..a1e1f5e 100644 --- a/embed.fnc +++ b/embed.fnc @@ -626,6 +626,7 @@ Amp |UV |to_uni_fold |UV c|NN U8 *p|NN STRLEN *lenp AMp |UV |_to_uni_fold_flags|UV c|NN U8 *p|NN STRLEN *lenp|const U8 flags ApPR |bool |is_uni_alnum_lc|UV c ApPR |bool |is_uni_idfirst_lc|UV c +AMpR |bool |_is_uni_perl_idstart|UV c ApPR |bool |is_uni_alpha_lc|UV c ApPR |bool |is_uni_ascii_lc|UV c ApPR |bool |is_uni_space_lc|UV c @@ -646,7 +647,7 @@ Anpd |bool |is_utf8_string_loclen|NN const U8 *s|STRLEN len|NULLOK const U8 **ep ApR |bool |is_utf8_alnum |NN const U8 *p ApR |bool |is_utf8_idfirst|NN const U8 *p ApR |bool |is_utf8_xidfirst|NN const U8 *p -AMpR |bool |_is_utf8__perl_idstart|NN const U8 *p +AMpR |bool |_is_utf8_perl_idstart|NN const U8 *p ApR |bool |is_utf8_idcont |NN const U8 *p ApR |bool |is_utf8_xidcont |NN const U8 *p ApR |bool |is_utf8_alpha |NN const U8 *p diff --git a/embed.h b/embed.h index c5b169d..e19a9df 100644 --- a/embed.h +++ b/embed.h @@ -27,7 +27,8 @@ /* Hide global symbols */ #define Gv_AMupdate(a,b) Perl_Gv_AMupdate(aTHX_ a,b) -#define _is_utf8__perl_idstart(a) Perl__is_utf8__perl_idstart(aTHX_ a) +#define _is_uni_perl_idstart(a) Perl__is_uni_perl_idstart(aTHX_ a) +#define _is_utf8_perl_idstart(a) Perl__is_utf8_perl_idstart(aTHX_ a) #define _to_uni_fold_flags(a,b,c,d) Perl__to_uni_fold_flags(aTHX_ a,b,c,d) #define _to_utf8_fold_flags(a,b,c,d,e) Perl__to_utf8_fold_flags(aTHX_ a,b,c,d,e) #define _to_utf8_lower_flags(a,b,c,d,e) Perl__to_utf8_lower_flags(aTHX_ a,b,c,d,e) diff --git a/ext/XS-APItest/t/handy.t b/ext/XS-APItest/t/handy.t index 9433409..4c852c5 100644 --- a/ext/XS-APItest/t/handy.t +++ b/ext/XS-APItest/t/handy.t @@ -57,8 +57,13 @@ foreach my $name (sort keys %properties) { last if $above_latins > 5; } + # This makes sure we are using the Perl definition of idfirst, and not the + # Unicode. There are a few differences. + push @code_points, ord "\N{ESTIMATED SYMBOL}" if $name eq 'idfirst'; + # And finally one non-Unicode code point. push @code_points, 0x110000; # Above Unicode, no prop should match + no warnings 'non_unicode'; for my $i (@code_points) { my $function = uc($name); diff --git a/handy.h b/handy.h index 178d975..5134c9d 100644 --- a/handy.h +++ b/handy.h @@ -927,7 +927,7 @@ EXTCONST U32 PL_charclass[]; #define isWORDCHAR_uni(c) _generic_uni(_CC_WORDCHAR, is_uni_alnum, c) #define isALNUM_uni(c) isWORDCHAR_uni(c) #define isBLANK_uni(c) _generic_uni(_CC_BLANK, is_HORIZWS_cp_high, c) -#define isIDFIRST_uni(c) _generic_uni(_CC_IDFIRST, is_uni_idfirst, c) +#define isIDFIRST_uni(c) _generic_uni(_CC_IDFIRST, _is_uni_perl_idstart, c) #define isALPHA_uni(c) _generic_uni(_CC_ALPHA, is_uni_alpha, c) #define isSPACE_uni(c) _generic_uni(_CC_SPACE, is_XPERLSPACE_cp_high, c) #define isVERTWS_uni(c) _generic_uni(_CC_VERTSPACE, is_VERTWS_cp_high, c) @@ -992,12 +992,11 @@ EXTCONST U32 PL_charclass[]; /* To prevent S_scan_word in toke.c from hanging, we have to make sure that * IDFIRST is an alnum. See * http://rt.perl.org/rt3/Ticket/Display.html?id=74022 for more detail than you - * ever wanted to know about. XXX It is unclear if this should extend to - * isIDFIRST_uni() which it hasn't so far. (In the ASCII range, there isn't a - * difference.) This used to be not the XID version, but we decided to go with - * the more modern Unicode definition */ + * ever wanted to know about. (In the ASCII range, there isn't a difference.) + * This used to be not the XID version, but we decided to go with the more + * modern Unicode definition */ #define isIDFIRST_utf8(p) _generic_utf8(_CC_IDFIRST, \ - _is_utf8__perl_idstart, p) + _is_utf8_perl_idstart, p) #define isIDCONT_utf8(p) _generic_utf8(_CC_WORDCHAR, is_utf8_xidcont, p) #define isALPHA_utf8(p) _generic_utf8(_CC_ALPHA, is_utf8_alpha, p) diff --git a/lib/_charnames.pm b/lib/_charnames.pm index bbb7378..c9bca48 100644 --- a/lib/_charnames.pm +++ b/lib/_charnames.pm @@ -7,7 +7,7 @@ package _charnames; use strict; use warnings; use File::Spec; -our $VERSION = '1.33'; +our $VERSION = '1.34'; use unicore::Name; # mktables-generated algorithmically-defined names use bytes (); # for $bytes::hint_bits @@ -765,7 +765,9 @@ sub viacode { # Here there is no user-defined alias, return any official one. return $return if defined $return; - if (CORE::hex($hex) > 0x10FFFF) { + if (CORE::hex($hex) > 0x10FFFF + && warnings::enabled('non_unicode')) + { carp "Unicode characters only allocated up to U+10FFFF (you asked for U+$hex)"; } return; diff --git a/lib/charnames.pm b/lib/charnames.pm index 559dc4f..2dd3b62 100644 --- a/lib/charnames.pm +++ b/lib/charnames.pm @@ -1,7 +1,7 @@ package charnames; use strict; use warnings; -our $VERSION = '1.33'; +our $VERSION = '1.34'; use unicore::Name; # mktables-generated algorithmically-defined names use _charnames (); # The submodule for this where most of the work gets done diff --git a/proto.h b/proto.h index 10d8889..f9d7b9e 100644 --- a/proto.h +++ b/proto.h @@ -32,10 +32,13 @@ PERL_CALLCONV void Perl_Slab_Free(pTHX_ void *op) #define PERL_ARGS_ASSERT_SLAB_FREE \ assert(op) -PERL_CALLCONV bool Perl__is_utf8__perl_idstart(pTHX_ const U8 *p) +PERL_CALLCONV bool Perl__is_uni_perl_idstart(pTHX_ UV c) + __attribute__warn_unused_result__; + +PERL_CALLCONV bool Perl__is_utf8_perl_idstart(pTHX_ const U8 *p) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); -#define PERL_ARGS_ASSERT__IS_UTF8__PERL_IDSTART \ +#define PERL_ARGS_ASSERT__IS_UTF8_PERL_IDSTART \ assert(p) PERL_CALLCONV UV Perl__to_uni_fold_flags(pTHX_ UV c, U8 *p, STRLEN *lenp, const U8 flags) diff --git a/utf8.c b/utf8.c index b4810f1..70620af 100644 --- a/utf8.c +++ b/utf8.c @@ -1499,6 +1499,14 @@ Perl_is_uni_idfirst(pTHX_ UV c) } bool +Perl__is_uni_perl_idstart(pTHX_ UV c) +{ + U8 tmpbuf[UTF8_MAXBYTES+1]; + uvchr_to_utf8(tmpbuf, c); + return _is_utf8_perl_idstart(tmpbuf); +} + +bool Perl_is_uni_alpha(pTHX_ UV c) { U8 tmpbuf[UTF8_MAXBYTES+1]; @@ -1997,11 +2005,11 @@ Perl_is_utf8_xidfirst(pTHX_ const U8 *p) /* The naming is historical. */ } bool -Perl__is_utf8__perl_idstart(pTHX_ const U8 *p) +Perl__is_utf8_perl_idstart(pTHX_ const U8 *p) { dVAR; - PERL_ARGS_ASSERT__IS_UTF8__PERL_IDSTART; + PERL_ARGS_ASSERT__IS_UTF8_PERL_IDSTART; return is_utf8_common(p, &PL_utf8_perl_idstart, "_Perl_IDStart"); } -- Perl5 Master Repository
