+#ifdef EBCDIC /* Both versions assume well-formed UTF8 */
+# define UTF8_IS_SUPER(s) (NATIVE_TO_I8(*(s)) >= 0xF9 \
+ && (NATIVE_TO_I8(*(s)) > 0xF9) || (NATIVE_TO_I8(*((s)) + 1 >= 0xA2)))
+#else
+# define UTF8_IS_SUPER(s) (*(s) >= 0xF4 \
+ && (*(s) > 0xF4 || (*((s) + 1) >= 0x90)))
+#endif
+
+/* These are now machine generated, and the 'given' clause is no longer
+ * applicable */
+#define UTF8_IS_NONCHAR_GIVEN_THAT_NON_SUPER_AND_GE_PROBLEMATIC(s) \
+ cBOOL(is_NONCHAR_utf8(s))
+#define UTF8_IS_NONCHAR_(s) \
+ UTF8_IS_NONCHAR_GIVEN_THAT_NON_SUPER_AND_GE_PROBLEMATIC(s)
+
+#define UNICODE_SURROGATE_FIRST 0xD800
+#define UNICODE_SURROGATE_LAST 0xDFFF
+#define UNICODE_REPLACEMENT 0xFFFD
+#define UNICODE_BYTE_ORDER_MARK 0xFEFF
+
+/* Though our UTF-8 encoding can go beyond this,
+ * let's be conservative and do as Unicode says. */
+#define PERL_UNICODE_MAX 0x10FFFF
+
+#define UNICODE_WARN_SURROGATE 0x0001 /* UTF-16 surrogates */
+#define UNICODE_WARN_NONCHAR 0x0002 /* Non-char code points */
+#define UNICODE_WARN_SUPER 0x0004 /* Above 0x10FFFF */
+#define UNICODE_WARN_FE_FF 0x0008 /* Above 0x10FFFF */
+#define UNICODE_DISALLOW_SURROGATE 0x0010
+#define UNICODE_DISALLOW_NONCHAR 0x0020
+#define UNICODE_DISALLOW_SUPER 0x0040
+#define UNICODE_DISALLOW_FE_FF 0x0080
+#define UNICODE_WARN_ILLEGAL_INTERCHANGE \
+ (UNICODE_WARN_SURROGATE|UNICODE_WARN_NONCHAR|UNICODE_WARN_SUPER)
+#define UNICODE_DISALLOW_ILLEGAL_INTERCHANGE \
+ (UNICODE_DISALLOW_SURROGATE|UNICODE_DISALLOW_NONCHAR|UNICODE_DISALLOW_SUPER)
+
+/* For backward source compatibility, as are now the default */
+#define UNICODE_ALLOW_SURROGATE 0
+#define UNICODE_ALLOW_SUPER 0
+#define UNICODE_ALLOW_ANY 0
+
+#define UNICODE_IS_SURROGATE(c) ((c) >= UNICODE_SURROGATE_FIRST && \
+ (c) <= UNICODE_SURROGATE_LAST)
+#define UNICODE_IS_REPLACEMENT(c) ((c) == UNICODE_REPLACEMENT)
+#define UNICODE_IS_BYTE_ORDER_MARK(c) ((c) == UNICODE_BYTE_ORDER_MARK)
+#define UNICODE_IS_NONCHAR(c) ((c >= 0xFDD0 && c <= 0xFDEF) \
+ /* The other noncharacters end in FFFE or FFFF, which \
+ * the mask below catches both of, but beyond the last \
+ * official unicode code point, they aren't \
+ * noncharacters, since those aren't Unicode \
+ * characters at all */ \
+ || ((((c & 0xFFFE) == 0xFFFE)) && ! UNICODE_IS_SUPER(c)))
+#define UNICODE_IS_SUPER(c) ((c) > PERL_UNICODE_MAX)
+#define UNICODE_IS_FE_FF(c) ((c) > 0x7FFFFFFF)
+
+#ifdef HAS_QUAD
+# define UTF8_QUAD_MAX UINT64_C(0x1000000000)
+#endif
+
+#define LATIN_SMALL_LETTER_SHARP_S LATIN_SMALL_LETTER_SHARP_S_NATIVE
+#define LATIN_SMALL_LETTER_Y_WITH_DIAERESIS \
+ LATIN_SMALL_LETTER_Y_WITH_DIAERESIS_NATIVE
+#define MICRO_SIGN MICRO_SIGN_NATIVE
+#define LATIN_CAPITAL_LETTER_A_WITH_RING_ABOVE \
+ LATIN_CAPITAL_LETTER_A_WITH_RING_ABOVE_NATIVE
+#define LATIN_SMALL_LETTER_A_WITH_RING_ABOVE \
+ LATIN_SMALL_LETTER_A_WITH_RING_ABOVE_NATIVE
+#define UNICODE_GREEK_CAPITAL_LETTER_SIGMA 0x03A3
+#define UNICODE_GREEK_SMALL_LETTER_FINAL_SIGMA 0x03C2
+#define UNICODE_GREEK_SMALL_LETTER_SIGMA 0x03C3
+#define GREEK_SMALL_LETTER_MU 0x03BC
+#define GREEK_CAPITAL_LETTER_MU 0x039C /* Upper and title case of MICRON */
+#define LATIN_CAPITAL_LETTER_Y_WITH_DIAERESIS 0x0178 /* Also is title case */
+#define LATIN_CAPITAL_LETTER_SHARP_S 0x1E9E
+#define LATIN_SMALL_LETTER_LONG_S 0x017F
+#define KELVIN_SIGN 0x212A
+#define ANGSTROM_SIGN 0x212B
+
+#define UNI_DISPLAY_ISPRINT 0x0001
+#define UNI_DISPLAY_BACKSLASH 0x0002
+#define UNI_DISPLAY_QQ (UNI_DISPLAY_ISPRINT|UNI_DISPLAY_BACKSLASH)
+#define UNI_DISPLAY_REGEX (UNI_DISPLAY_ISPRINT|UNI_DISPLAY_BACKSLASH)
+
+#define ANYOF_FOLD_SHARP_S(node, input, end) \
+ (ANYOF_BITMAP_TEST(node, LATIN_SMALL_LETTER_SHARP_S) && \
+ (ANYOF_NONBITMAP(node)) && \
+ (ANYOF_FLAGS(node) & ANYOF_LOC_NONBITMAP_FOLD) && \
+ ((end) > (input) + 1) && \
+ toLOWER((input)[0]) == 's' && \
+ toLOWER((input)[1]) == 's')
+#define SHARP_S_SKIP 2
+
+/* If you want to exclude surrogates, and beyond legal Unicode, see the blame
+ * log for earlier versions which gave details for these */
+
+#ifndef EBCDIC
+/* This was generated by regen/regcharclass.pl, and then moved here. The lines
+ * that generated it were then commented out. This was done solely because it
+ * takes on the order of 10 minutes to generate, and is never going to change.
+ * The EBCDIC equivalent hasn't been commented out in regcharclass.pl, so it
+ * should generate and run the correct stuff */
+/*** GENERATED CODE ***/
+#define is_UTF8_CHAR_utf8_safe(s,e) \
+( ((e)-(s) > 3) ? \
+ ( ( ( ((U8*)s)[0] & 0x80 ) == 0x00 ) ? 1 \
+ : ( 0xC2 <= ((U8*)s)[0] && ((U8*)s)[0] <= 0xDF ) ? \
+ ( ( ( ((U8*)s)[1] & 0xC0 ) == 0x80 ) ? 2 : 0 ) \
+ : ( 0xE0 == ((U8*)s)[0] ) ? \
+ ( ( ( ( ((U8*)s)[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( 0xC2 <= ((U8*)s)[0] && ((U8*)s)[0] <= 0xDF ) ? \
+ ( ( ( ((U8*)s)[1] & 0xC0 ) == 0x80 ) ? 2 : 0 ) \
+ : 0 ) \
+: ((e)-(s) > 0) ? \
+ ( ( ((U8*)s)[0] & 0x80 ) == 0x00 ) \
+: 0 )
+#endif
+
+/* IS_UTF8_CHAR(p) is strictly speaking wrong (not UTF-8) because it
+ * (1) allows UTF-8 encoded UTF-16 surrogates
+ * (2) it allows code points past U+10FFFF.
+ * The Perl_is_utf8_char() full "slow" code will handle the Perl
+ * "extended UTF-8". */
+#define IS_UTF8_CHAR(p, n) (is_UTF8_CHAR_utf8_safe(p, (p) + (n)) == n)
+
+/* regen/regcharclass.pl generates is_UTF8_CHAR_utf8_safe() macros for up to
+ * these number of bytes. So this has to be coordinated with it */