diff options
author | Karl Williamson <public@khwilliamson.com> | 2013-03-06 17:04:58 -0700 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2013-08-29 09:56:01 -0600 |
commit | 3ded5eb052cdc3f861ec0c0ff85348086d653be0 (patch) | |
tree | 083de4868d3d4a4501e073eab45791f8ea9673a6 /inline.h | |
parent | 2b2119c310896ddf8836a35a7e810b8c94733c20 (diff) | |
download | perl-3ded5eb052cdc3f861ec0c0ff85348086d653be0.tar.gz |
handy.h: Allow bootstrapping to non-ASCII platform
This adds a bunch of macros and moves things around to support
conditional compilation when Configure is called with
-DBOOTSTRAP_CHARSET. Doing so causes the usual macros that are
table-driven to not be used, since the table may not be valid when
bringing Perl up for the first time on a non-ASCII platform.
This allows it to compile using the platform's native C library ctype
functions, which should work enough to compile miniperl, and allow the
table to be changed to be valid. Then Configure can be re-run to not
bootstrap, and normal compilation can proceed
Diffstat (limited to 'inline.h')
-rw-r--r-- | inline.h | 47 |
1 files changed, 47 insertions, 0 deletions
@@ -201,6 +201,53 @@ S_croak_memory_wrap(void) #pragma clang diagnostic pop #endif +#ifdef BOOTSTRAP_CHARSET +static bool +S_bootstrap_ctype(U8 character, UV classnum, bool full_Latin1) +{ + /* See comments in handy.h. This is placed in this file primarily to avoid + * having to have an entry for it in embed.fnc */ + + dTHX; + + if (! full_Latin1 && ! isASCII(character)) { + return FALSE; + } + + switch (classnum) { + case _CC_ALPHANUMERIC: return isALPHANUMERIC_L1(character); + case _CC_ALPHA: return isALPHA_L1(character); + case _CC_ASCII: return isASCII_L1(character); + case _CC_BLANK: return isBLANK_L1(character); + case _CC_CASED: return isLOWER_L1(character) + || isUPPER_L1(character); + case _CC_CNTRL: return isCNTRL_L1(character); + case _CC_DIGIT: return isDIGIT_L1(character); + case _CC_GRAPH: return isGRAPH_L1(character); + case _CC_LOWER: return isLOWER_L1(character); + case _CC_PRINT: return isPRINT_L1(character); + case _CC_PSXSPC: return isPSXSPC_L1(character); + case _CC_PUNCT: return isPUNCT_L1(character); + case _CC_SPACE: return isSPACE_L1(character); + case _CC_UPPER: return isUPPER_L1(character); + case _CC_WORDCHAR: return isWORDCHAR_L1(character); + case _CC_XDIGIT: return isXDIGIT_L1(character); + case _CC_VERTSPACE: return isSPACE_L1(character) && ! isBLANK_L1(character); + case _CC_IDFIRST: return isIDFIRST_L1(character); + case _CC_QUOTEMETA: return _isQUOTEMETA(character); + case _CC_CHARNAME_CONT: return isCHARNAME_CONT(character); + case _CC_NONLATIN1_FOLD: return _HAS_NONLATIN1_FOLD_CLOSURE_ONLY_FOR_USE_BY_REGCOMP_DOT_C_AND_REGEXEC_DOT_C(character); + case _CC_NON_FINAL_FOLD: return _IS_NON_FINAL_FOLD_ONLY_FOR_USE_BY_REGCOMP_DOT_C(character); + case _CC_IS_IN_SOME_FOLD: return _IS_IN_SOME_FOLD_ONLY_FOR_USE_BY_REGCOMP_DOT_C(character); + case _CC_BACKSLASH_FOO_LBRACE_IS_META: return 0; + + + default: break; + } + Perl_croak(aTHX_ "panic: bootstrap_ctype() has an unexpected character class '%"UVxf"'", classnum); +} +#endif + /* ------------------------------- utf8.h ------------------------------- */ PERL_STATIC_INLINE void |