Cache-Memcached-Fast
view release on metacpan or search on metacpan
#ifndef IS_NUMBER_IN_UV
#define IS_NUMBER_IN_UV 0x01
#endif
#ifndef IS_NUMBER_GREATER_THAN_UV_MAX
#define IS_NUMBER_GREATER_THAN_UV_MAX 0x02
#endif
#ifndef IS_NUMBER_NOT_INT
#define IS_NUMBER_NOT_INT 0x04
#endif
#ifndef IS_NUMBER_NEG
#define IS_NUMBER_NEG 0x08
#endif
#ifndef IS_NUMBER_INFINITY
#define IS_NUMBER_INFINITY 0x10
#endif
#ifndef IS_NUMBER_NAN
#define IS_NUMBER_NAN 0x20
#endif
#ifndef GROK_NUMERIC_RADIX
#define GROK_NUMERIC_RADIX(sp, send) grok_numeric_radix(sp, send)
#endif
#ifndef PERL_SCAN_GREATER_THAN_UV_MAX
#define PERL_SCAN_GREATER_THAN_UV_MAX 0x02
#endif
#ifndef PERL_SCAN_SILENT_ILLDIGIT
#define PERL_SCAN_SILENT_ILLDIGIT 0x04
#endif
#ifndef PERL_SCAN_ALLOW_UNDERSCORES
#define PERL_SCAN_ALLOW_UNDERSCORES 0x01
#endif
#ifndef PERL_SCAN_DISALLOW_PREFIX
#define PERL_SCAN_DISALLOW_PREFIX 0x02
#endif
#ifndef grok_numeric_radix
#if defined(NEED_grok_numeric_radix)
static bool DPPP_(my_grok_numeric_radix)(pTHX_ const char * * sp, const char * send);
static
#else
extern bool DPPP_(my_grok_numeric_radix)(pTHX_ const char * * sp, const char * send);
#endif
#if defined(NEED_grok_numeric_radix) || defined(NEED_grok_numeric_radix_GLOBAL)
#ifdef grok_numeric_radix
#undef grok_numeric_radix
#endif
#define grok_numeric_radix(a,b) DPPP_(my_grok_numeric_radix)(aTHX_ a,b)
#define Perl_grok_numeric_radix DPPP_(my_grok_numeric_radix)
bool
DPPP_(my_grok_numeric_radix)(pTHX_ const char **sp, const char *send)
{
#ifdef USE_LOCALE_NUMERIC
#ifdef PL_numeric_radix_sv
if (PL_numeric_radix_sv && IN_LOCALE) {
STRLEN len;
char* radix = SvPV(PL_numeric_radix_sv, len);
if (*sp + len <= send && memEQ(*sp, radix, len)) {
*sp += len;
return TRUE;
}
}
#else
#include <locale.h>
dTHR;
struct lconv *lc = localeconv();
char *radix = lc->decimal_point;
if (radix && IN_LOCALE) {
STRLEN len = strlen(radix);
if (*sp + len <= send && memEQ(*sp, radix, len)) {
*sp += len;
return TRUE;
}
}
#endif
#endif
if (*sp < send && **sp == '.') {
++*sp;
return TRUE;
}
return FALSE;
}
#endif
#endif
#ifndef grok_number
#if defined(NEED_grok_number)
static int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep);
static
#else
extern int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep);
#endif
#if defined(NEED_grok_number) || defined(NEED_grok_number_GLOBAL)
#ifdef grok_number
#undef grok_number
#endif
#define grok_number(a,b,c) DPPP_(my_grok_number)(aTHX_ a,b,c)
#define Perl_grok_number DPPP_(my_grok_number)
int
DPPP_(my_grok_number)(pTHX_ const char *pv, STRLEN len, UV *valuep)
{
const char *s = pv;
const char *send = pv + len;
const UV max_div_10 = UV_MAX / 10;
const char max_mod_10 = UV_MAX % 10;
int numtype = 0;
int sawinf = 0;
int sawnan = 0;
while (s < send && isSPACE(*s))
s++;
if (s == send) {
return 0;
} else if (*s == '-') {
s++;
numtype = IS_NUMBER_NEG;
}
else if (*s == '+')
s++;
if (s == send)
return 0;
if (isDIGIT(*s)) {
UV value = *s - '0';
if (++s < send) {
int digit = *s - '0';
if (digit >= 0 && digit <= 9) {
value = value * 10 + digit;
if (++s < send) {
sv_setpvs(dsv, "");
if (dq == '"')
sv_catpvs(dsv, "\"");
else if (flags & PERL_PV_PRETTY_LTGT)
sv_catpvs(dsv, "<");
if (start_color != NULL)
sv_catpv(dsv, D_PPP_CONSTPV_ARG(start_color));
pv_escape(dsv, str, count, max, &escaped, flags | PERL_PV_ESCAPE_NOCLEAR);
if (end_color != NULL)
sv_catpv(dsv, D_PPP_CONSTPV_ARG(end_color));
if (dq == '"')
sv_catpvs(dsv, "\"");
else if (flags & PERL_PV_PRETTY_LTGT)
sv_catpvs(dsv, ">");
if ((flags & PERL_PV_PRETTY_ELLIPSES) && escaped < count)
sv_catpvs(dsv, "...");
return SvPVX(dsv);
}
#endif
#endif
#ifndef pv_display
#if defined(NEED_pv_display)
static char * DPPP_(my_pv_display)(pTHX_ SV * dsv, const char * pv, STRLEN cur, STRLEN len, STRLEN pvlim);
static
#else
extern char * DPPP_(my_pv_display)(pTHX_ SV * dsv, const char * pv, STRLEN cur, STRLEN len, STRLEN pvlim);
#endif
#if defined(NEED_pv_display) || defined(NEED_pv_display_GLOBAL)
#ifdef pv_display
#undef pv_display
#endif
#define pv_display(a,b,c,d,e) DPPP_(my_pv_display)(aTHX_ a,b,c,d,e)
#define Perl_pv_display DPPP_(my_pv_display)
char *
DPPP_(my_pv_display)(pTHX_ SV *dsv, const char *pv, STRLEN cur, STRLEN len, STRLEN pvlim)
{
pv_pretty(dsv, pv, cur, pvlim, NULL, NULL, PERL_PV_PRETTY_DUMP);
if (len > cur && pv[cur] == '\0')
sv_catpvs(dsv, "\\0");
return SvPVX(dsv);
}
#endif
#endif
#if PERL_VERSION_LT(5,27,9)
#ifndef LC_NUMERIC_LOCK
#define LC_NUMERIC_LOCK
#endif
#ifndef LC_NUMERIC_UNLOCK
#define LC_NUMERIC_UNLOCK
#endif
#if PERL_VERSION_LT(5,19,0)
#undef STORE_LC_NUMERIC_SET_STANDARD
#undef RESTORE_LC_NUMERIC
#undef DECLARATION_FOR_LC_NUMERIC_MANIPULATION
#ifdef USE_LOCALE
#ifndef DECLARATION_FOR_LC_NUMERIC_MANIPULATION
#define DECLARATION_FOR_LC_NUMERIC_MANIPULATION char *LoC_
#endif
#ifndef STORE_NUMERIC_SET_STANDARD
#define STORE_NUMERIC_SET_STANDARD() \
LoC_ = savepv(setlocale(LC_NUMERIC, NULL)); \
SAVEFREEPV(LoC_); \
setlocale(LC_NUMERIC, "C");
#endif
#ifndef RESTORE_LC_NUMERIC
#define RESTORE_LC_NUMERIC() \
setlocale(LC_NUMERIC, LoC_);
#endif
#else
#ifndef DECLARATION_FOR_LC_NUMERIC_MANIPULATION
#define DECLARATION_FOR_LC_NUMERIC_MANIPULATION
#endif
#ifndef STORE_LC_NUMERIC_SET_STANDARD
#define STORE_LC_NUMERIC_SET_STANDARD()
#endif
#ifndef RESTORE_LC_NUMERIC
#define RESTORE_LC_NUMERIC()
#endif
#endif
#endif
#endif
#ifndef LOCK_NUMERIC_STANDARD
#define LOCK_NUMERIC_STANDARD()
#endif
#ifndef UNLOCK_NUMERIC_STANDARD
#define UNLOCK_NUMERIC_STANDARD()
#endif
#ifndef LOCK_LC_NUMERIC_STANDARD
#define LOCK_LC_NUMERIC_STANDARD LOCK_NUMERIC_STANDARD
#endif
#ifndef UNLOCK_LC_NUMERIC_STANDARD
#define UNLOCK_LC_NUMERIC_STANDARD UNLOCK_NUMERIC_STANDARD
#endif
#ifndef switch_to_global_locale
#define switch_to_global_locale()
#endif
#ifdef sync_locale
#if (PERL_BCDVERSION < 0x5027009)
#if (PERL_BCDVERSION >= 0x5021003)
#undef sync_locale
#define sync_locale() (Perl_sync_locale(aTHX), 1)
#elif defined(sync_locale)
#undef sync_locale
#define sync_locale() (new_ctype(setlocale(LC_CTYPE, NULL)), \
new_collate(setlocale(LC_COLLATE, NULL)), \
set_numeric_local(), \
new_numeric(setlocale(LC_NUMERIC, NULL)), \
1)
#elif defined(new_ctype) && defined(LC_CTYPE)
#define sync_locale() (new_ctype(setlocale(LC_CTYPE, NULL)), 1)
#endif
#endif
#endif
#ifndef sync_locale
#define sync_locale() 1
#endif
#endif
( run in 1.881 second using v1.01-cache-2.11-cpan-ceb78f64989 )