From 9f2abfdef8903cce0a7b12ce12788ce7e9f72ed1 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Mon, 19 Sep 2016 09:59:32 -0600 Subject: Add API Unicode handling functions These functions are all extensions of the is_utf8_string_foo() functions, that restrict the UTF-8 recognized as valid in various ways. There are named ones for the two definitions that Unicode makes, and foo_flags ones for more custom restrictions. The named ones are implemented as tries, while the flags ones provide complete generality --- proto.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'proto.h') diff --git a/proto.h b/proto.h index 7c2a821cde..6e5461dc02 100644 --- a/proto.h +++ b/proto.h @@ -1328,6 +1328,15 @@ PERL_CALLCONV bool Perl_isIDFIRST_lazy(pTHX_ const char* p) __attribute__warn_unused_result__ __attribute__pure__; */ +PERL_STATIC_INLINE bool S_is_c9strict_utf8_string(const U8 *s, const STRLEN len) + __attribute__pure__; +#define PERL_ARGS_ASSERT_IS_C9STRICT_UTF8_STRING \ + assert(s) + +/* PERL_CALLCONV bool is_c9strict_utf8_string_loc(const U8 *s, const STRLEN len, const U8 **ep); */ +PERL_STATIC_INLINE bool S_is_c9strict_utf8_string_loclen(const U8 *s, const STRLEN len, const U8 **ep, STRLEN *el); +#define PERL_ARGS_ASSERT_IS_C9STRICT_UTF8_STRING_LOCLEN \ + assert(s) /* PERL_CALLCONV bool Perl_is_invariant_string(const U8* const s, const STRLEN len) __attribute__warn_unused_result__ __attribute__pure__; */ @@ -1335,6 +1344,15 @@ PERL_CALLCONV bool Perl_isIDFIRST_lazy(pTHX_ const char* p) PERL_CALLCONV I32 Perl_is_lvalue_sub(pTHX) __attribute__warn_unused_result__; +PERL_STATIC_INLINE bool S_is_strict_utf8_string(const U8 *s, const STRLEN len) + __attribute__pure__; +#define PERL_ARGS_ASSERT_IS_STRICT_UTF8_STRING \ + assert(s) + +/* PERL_CALLCONV bool is_strict_utf8_string_loc(const U8 *s, const STRLEN len, const U8 **ep); */ +PERL_STATIC_INLINE bool S_is_strict_utf8_string_loclen(const U8 *s, const STRLEN len, const U8 **ep, STRLEN *el); +#define PERL_ARGS_ASSERT_IS_STRICT_UTF8_STRING_LOCLEN \ + assert(s) PERL_CALLCONV bool Perl_is_uni_alnum(pTHX_ UV c) __attribute__deprecated__ __attribute__warn_unused_result__ @@ -1614,14 +1632,23 @@ PERL_STATIC_INLINE bool Perl_is_utf8_string(const U8 *s, const STRLEN len) #define PERL_ARGS_ASSERT_IS_UTF8_STRING \ assert(s) +PERL_STATIC_INLINE bool S_is_utf8_string_flags(const U8 *s, const STRLEN len, const U32 flags) + __attribute__pure__; +#define PERL_ARGS_ASSERT_IS_UTF8_STRING_FLAGS \ + assert(s) + #ifndef NO_MATHOMS PERL_CALLCONV bool Perl_is_utf8_string_loc(const U8 *s, const STRLEN len, const U8 **ep); #define PERL_ARGS_ASSERT_IS_UTF8_STRING_LOC \ assert(s); assert(ep) #endif +/* PERL_CALLCONV bool is_utf8_string_loc_flags(const U8 *s, const STRLEN len, const U8 **ep, const U32 flags); */ PERL_STATIC_INLINE bool Perl_is_utf8_string_loclen(const U8 *s, const STRLEN len, const U8 **ep, STRLEN *el); #define PERL_ARGS_ASSERT_IS_UTF8_STRING_LOCLEN \ assert(s) +PERL_STATIC_INLINE bool S_is_utf8_string_loclen_flags(const U8 *s, const STRLEN len, const U8 **ep, STRLEN *el, const U32 flags); +#define PERL_ARGS_ASSERT_IS_UTF8_STRING_LOCLEN_FLAGS \ + assert(s) PERL_CALLCONV bool Perl_is_utf8_upper(pTHX_ const U8 *p) __attribute__deprecated__ __attribute__warn_unused_result__; -- cgit v1.2.1