summaryrefslogtreecommitdiff
path: root/cpan/Unicode-Collate
diff options
context:
space:
mode:
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>2013-12-01 15:21:38 +0000
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>2013-12-01 15:21:38 +0000
commit4779e03e2981c0d32b33717bf693fadd4a65b552 (patch)
tree755c7af9f96b464d0eb455398e2c682279627824 /cpan/Unicode-Collate
parent6fd0695329cb6bc38ec08ec9687424589587902b (diff)
downloadperl-4779e03e2981c0d32b33717bf693fadd4a65b552.tar.gz
Update Unicode-Collate to CPAN version 1.03
[DELTA] 1.03 Sun Dec 1 21:45:46 2013 - XS: now unpack_U() uses unpack('U*') in pure perl. avoid XS for the internal "utf8" encoding of perl.
Diffstat (limited to 'cpan/Unicode-Collate')
-rw-r--r--cpan/Unicode-Collate/Collate.pm6
-rw-r--r--cpan/Unicode-Collate/Collate.xs56
2 files changed, 6 insertions, 56 deletions
diff --git a/cpan/Unicode-Collate/Collate.pm b/cpan/Unicode-Collate/Collate.pm
index f72a71d8d0..7eda04b4be 100644
--- a/cpan/Unicode-Collate/Collate.pm
+++ b/cpan/Unicode-Collate/Collate.pm
@@ -17,7 +17,7 @@ use File::Spec;
no warnings 'utf8';
-our $VERSION = '1.02';
+our $VERSION = '1.03';
our $PACKAGE = __PACKAGE__;
### begin XS only ###
@@ -99,6 +99,10 @@ sub pack_U {
return pack('U*', @_);
}
+sub unpack_U {
+ return unpack('U*', shift(@_).pack('U*'));
+}
+
######
my (%VariableOK);
diff --git a/cpan/Unicode-Collate/Collate.xs b/cpan/Unicode-Collate/Collate.xs
index c339cc7734..2c0adf8351 100644
--- a/cpan/Unicode-Collate/Collate.xs
+++ b/cpan/Unicode-Collate/Collate.xs
@@ -10,33 +10,6 @@
/* This file is prepared by mkheader */
#include "ucatbl.h"
-/* Perl 5.6.1 ? */
-#ifndef utf8n_to_uvuni
-#define utf8n_to_uvuni utf8_to_uv
-#endif /* utf8n_to_uvuni */
-
-/* UTF8_ALLOW_BOM is used before Perl 5.8.0 */
-#ifndef UTF8_ALLOW_BOM
-#define UTF8_ALLOW_BOM (0)
-#endif /* UTF8_ALLOW_BOM */
-
-#ifndef UTF8_ALLOW_SURROGATE
-#define UTF8_ALLOW_SURROGATE (0)
-#endif /* UTF8_ALLOW_SURROGATE */
-
-#ifndef UTF8_ALLOW_FE_FF
-#define UTF8_ALLOW_FE_FF (0)
-#endif /* UTF8_ALLOW_FE_FF */
-
-#ifndef UTF8_ALLOW_FFFF
-#define UTF8_ALLOW_FFFF (0)
-#endif /* UTF8_ALLOW_FFFF */
-
-#define AllowAnyUTF (UTF8_ALLOW_SURROGATE|UTF8_ALLOW_BOM|UTF8_ALLOW_FE_FF|UTF8_ALLOW_FFFF)
-
-/* if utf8n_to_uvuni() sets retlen to 0 (?) */
-#define ErrRetlenIsZero "panic (Unicode::Collate): zero-length character"
-
/* At present, char > 0x10ffff are unaffected without complaint, right? */
#define VALID_UTF_MAX (0x10ffff)
#define OVER_UTF_MAX(uv) (VALID_UTF_MAX < (uv))
@@ -211,7 +184,7 @@ _isIllegal (sv)
uv = SvUVX(sv);
RETVAL = boolSV(
0x10FFFF < uv /* out of range */
- || ((uv & 0xFFFE) == 0xFFFE) /* ??FFF[EF] (cf. utf8.c) */
+ || ((uv & 0xFFFE) == 0xFFFE) /* ??FFF[EF] */
|| (0xD800 <= uv && uv <= 0xDFFF) /* unpaired surrogates */
|| (0xFDD0 <= uv && uv <= 0xFDEF) /* other non-characters */
);
@@ -685,30 +658,3 @@ visualizeSortKey (self, key)
OUTPUT:
RETVAL
-
-
-void
-unpack_U (src)
- SV* src
- PREINIT:
- STRLEN srclen, retlen;
- U8 *s, *p, *e;
- UV uv;
- PPCODE:
- s = (U8*)SvPV(src,srclen);
- if (!SvUTF8(src)) {
- SV* tmpsv = sv_mortalcopy(src);
- if (!SvPOK(tmpsv))
- (void)sv_pvn_force(tmpsv,&srclen);
- sv_utf8_upgrade(tmpsv);
- s = (U8*)SvPV(tmpsv,srclen);
- }
- e = s + srclen;
-
- for (p = s; p < e; p += retlen) {
- uv = utf8n_to_uvuni(p, e - p, &retlen, AllowAnyUTF);
- if (!retlen)
- croak(ErrRetlenIsZero);
- XPUSHs(sv_2mortal(newSVuv(uv)));
- }
-