version-0.9907/0000755000175000017500000000000012265475472013445 5ustar jpeacockjpeacockversion-0.9907/vutil/0000755000175000017500000000000012265475472014610 5ustar jpeacockjpeacockversion-0.9907/vutil/vutil.c0000644000175000017500000005666312265215276016131 0ustar jpeacockjpeacock/* This file is part of the "version" CPAN distribution. Please avoid editing it in the perl core. */ #ifndef PERL_CORE # define PERL_NO_GET_CONTEXT # include "EXTERN.h" # include "perl.h" # include "XSUB.h" # define NEED_my_snprintf # define NEED_newRV_noinc # define NEED_vnewSVpvf # define NEED_newSVpvn_flags_GLOBAL # define NEED_warner # include "ppport.h" #endif #include "vutil.h" #define VERSION_MAX 0x7FFFFFFF /* =for apidoc prescan_version Validate that a given string can be parsed as a version object, but doesn't actually perform the parsing. Can use either strict or lax validation rules. Can optionally set a number of hint variables to save the parsing code some time when tokenizing. =cut */ const char * #if VUTIL_REPLACE_CORE Perl_prescan_version2(pTHX_ const char *s, bool strict, #else Perl_prescan_version(pTHX_ const char *s, bool strict, #endif const char **errstr, bool *sqv, int *ssaw_decimal, int *swidth, bool *salpha) { bool qv = (sqv ? *sqv : FALSE); int width = 3; int saw_decimal = 0; bool alpha = FALSE; const char *d = s; PERL_ARGS_ASSERT_PRESCAN_VERSION; if (qv && isDIGIT(*d)) goto dotted_decimal_version; if (*d == 'v') { /* explicit v-string */ d++; if (isDIGIT(*d)) { qv = TRUE; } else { /* degenerate v-string */ /* requires v1.2.3 */ BADVERSION(s,errstr,"Invalid version format (dotted-decimal versions require at least three parts)"); } dotted_decimal_version: if (strict && d[0] == '0' && isDIGIT(d[1])) { /* no leading zeros allowed */ BADVERSION(s,errstr,"Invalid version format (no leading zeros)"); } while (isDIGIT(*d)) /* integer part */ d++; if (*d == '.') { saw_decimal++; d++; /* decimal point */ } else { if (strict) { /* require v1.2.3 */ BADVERSION(s,errstr,"Invalid version format (dotted-decimal versions require at least three parts)"); } else { goto version_prescan_finish; } } { int i = 0; int j = 0; while (isDIGIT(*d)) { /* just keep reading */ i++; while (isDIGIT(*d)) { d++; j++; /* maximum 3 digits between decimal */ if (strict && j > 3) { BADVERSION(s,errstr,"Invalid version format (maximum 3 digits between decimals)"); } } if (*d == '_') { if (strict) { BADVERSION(s,errstr,"Invalid version format (no underscores)"); } if ( alpha ) { BADVERSION(s,errstr,"Invalid version format (multiple underscores)"); } d++; alpha = TRUE; } else if (*d == '.') { if (alpha) { BADVERSION(s,errstr,"Invalid version format (underscores before decimal)"); } saw_decimal++; d++; } else if (!isDIGIT(*d)) { break; } j = 0; } if (strict && i < 2) { /* requires v1.2.3 */ BADVERSION(s,errstr,"Invalid version format (dotted-decimal versions require at least three parts)"); } } } /* end if dotted-decimal */ else { /* decimal versions */ int j = 0; /* may need this later */ /* special strict case for leading '.' or '0' */ if (strict) { if (*d == '.') { BADVERSION(s,errstr,"Invalid version format (0 before decimal required)"); } if (*d == '0' && isDIGIT(d[1])) { BADVERSION(s,errstr,"Invalid version format (no leading zeros)"); } } /* and we never support negative versions */ if ( *d == '-') { BADVERSION(s,errstr,"Invalid version format (negative version number)"); } /* consume all of the integer part */ while (isDIGIT(*d)) d++; /* look for a fractional part */ if (*d == '.') { /* we found it, so consume it */ saw_decimal++; d++; } else if (!*d || *d == ';' || isSPACE(*d) || *d == '{' || *d == '}') { if ( d == s ) { /* found nothing */ BADVERSION(s,errstr,"Invalid version format (version required)"); } /* found just an integer */ goto version_prescan_finish; } else if ( d == s ) { /* didn't find either integer or period */ BADVERSION(s,errstr,"Invalid version format (non-numeric data)"); } else if (*d == '_') { /* underscore can't come after integer part */ if (strict) { BADVERSION(s,errstr,"Invalid version format (no underscores)"); } else if (isDIGIT(d[1])) { BADVERSION(s,errstr,"Invalid version format (alpha without decimal)"); } else { BADVERSION(s,errstr,"Invalid version format (misplaced underscore)"); } } else { /* anything else after integer part is just invalid data */ BADVERSION(s,errstr,"Invalid version format (non-numeric data)"); } /* scan the fractional part after the decimal point*/ if (!isDIGIT(*d) && (strict || ! (!*d || *d == ';' || isSPACE(*d) || *d == '{' || *d == '}') )) { /* strict or lax-but-not-the-end */ BADVERSION(s,errstr,"Invalid version format (fractional part required)"); } while (isDIGIT(*d)) { d++; j++; if (*d == '.' && isDIGIT(d[-1])) { if (alpha) { BADVERSION(s,errstr,"Invalid version format (underscores before decimal)"); } if (strict) { BADVERSION(s,errstr,"Invalid version format (dotted-decimal versions must begin with 'v')"); } d = (char *)s; /* start all over again */ qv = TRUE; goto dotted_decimal_version; } if (*d == '_') { if (strict) { BADVERSION(s,errstr,"Invalid version format (no underscores)"); } if ( alpha ) { BADVERSION(s,errstr,"Invalid version format (multiple underscores)"); } if ( ! isDIGIT(d[1]) ) { BADVERSION(s,errstr,"Invalid version format (misplaced underscore)"); } width = j; d++; alpha = TRUE; } } } version_prescan_finish: while (isSPACE(*d)) d++; if (!isDIGIT(*d) && (! (!*d || *d == ';' || *d == '{' || *d == '}') )) { /* trailing non-numeric data */ BADVERSION(s,errstr,"Invalid version format (non-numeric data)"); } if (sqv) *sqv = qv; if (swidth) *swidth = width; if (ssaw_decimal) *ssaw_decimal = saw_decimal; if (salpha) *salpha = alpha; return d; } /* =for apidoc scan_version Returns a pointer to the next character after the parsed version string, as well as upgrading the passed in SV to an RV. Function must be called with an already existing SV like sv = newSV(0); s = scan_version(s, SV *sv, bool qv); Performs some preprocessing to the string to ensure that it has the correct characteristics of a version. Flags the object if it contains an underscore (which denotes this is an alpha version). The boolean qv denotes that the version should be interpreted as if it had multiple decimals, even if it doesn't. =cut */ const char * #if VUTIL_REPLACE_CORE Perl_scan_version2(pTHX_ const char *s, SV *rv, bool qv) #else Perl_scan_version(pTHX_ const char *s, SV *rv, bool qv) #endif { const char *start = s; const char *pos; const char *last; const char *errstr = NULL; int saw_decimal = 0; int width = 3; bool alpha = FALSE; bool vinf = FALSE; AV * av; SV * hv; PERL_ARGS_ASSERT_SCAN_VERSION; while (isSPACE(*s)) /* leading whitespace is OK */ s++; last = PRESCAN_VERSION(s, FALSE, &errstr, &qv, &saw_decimal, &width, &alpha); if (errstr) { /* "undef" is a special case and not an error */ if ( ! ( *s == 'u' && strEQ(s+1,"ndef")) ) { Perl_croak(aTHX_ "%s", errstr); } } start = s; if (*s == 'v') s++; pos = s; /* Now that we are through the prescan, start creating the object */ av = newAV(); hv = newSVrv(rv, "version"); /* create an SV and upgrade the RV */ (void)sv_upgrade(hv, SVt_PVHV); /* needs to be an HV type */ #ifndef NODEFAULT_SHAREKEYS HvSHAREKEYS_on(hv); /* key-sharing on by default */ #endif if ( qv ) (void)hv_stores(MUTABLE_HV(hv), "qv", newSViv(qv)); if ( alpha ) (void)hv_stores(MUTABLE_HV(hv), "alpha", newSViv(alpha)); if ( !qv && width < 3 ) (void)hv_stores(MUTABLE_HV(hv), "width", newSViv(width)); while (isDIGIT(*pos)) pos++; if (!isALPHA(*pos)) { I32 rev; for (;;) { rev = 0; { /* this is atoi() that delimits on underscores */ const char *end = pos; I32 mult = 1; I32 orev; /* the following if() will only be true after the decimal * point of a version originally created with a bare * floating point number, i.e. not quoted in any way */ if ( !qv && s > start && saw_decimal == 1 ) { mult *= 100; while ( s < end ) { orev = rev; rev += (*s - '0') * mult; mult /= 10; if ( (PERL_ABS(orev) > PERL_ABS(rev)) || (PERL_ABS(rev) > VERSION_MAX )) { Perl_ck_warner(aTHX_ packWARN(WARN_OVERFLOW), "Integer overflow in version %d",VERSION_MAX); s = end - 1; rev = VERSION_MAX; vinf = 1; } s++; if ( *s == '_' ) s++; } } else { while (--end >= s) { orev = rev; rev += (*end - '0') * mult; mult *= 10; if ( (PERL_ABS(orev) > PERL_ABS(rev)) || (PERL_ABS(rev) > VERSION_MAX )) { Perl_ck_warner(aTHX_ packWARN(WARN_OVERFLOW), "Integer overflow in version"); end = s - 1; rev = VERSION_MAX; vinf = 1; } } } } /* Append revision */ av_push(av, newSViv(rev)); if ( vinf ) { s = last; break; } else if ( *pos == '.' ) s = ++pos; else if ( *pos == '_' && isDIGIT(pos[1]) ) s = ++pos; else if ( *pos == ',' && isDIGIT(pos[1]) ) s = ++pos; else if ( isDIGIT(*pos) ) s = pos; else { s = pos; break; } if ( qv ) { while ( isDIGIT(*pos) ) pos++; } else { int digits = 0; while ( ( isDIGIT(*pos) || *pos == '_' ) && digits < 3 ) { if ( *pos != '_' ) digits++; pos++; } } } } if ( qv ) { /* quoted versions always get at least three terms*/ SSize_t len = AvFILLp(av); /* This for loop appears to trigger a compiler bug on OS X, as it loops infinitely. Yes, len is negative. No, it makes no sense. Compiler in question is: gcc version 3.3 20030304 (Apple Computer, Inc. build 1640) for ( len = 2 - len; len > 0; len-- ) av_push(MUTABLE_AV(sv), newSViv(0)); */ len = 2 - len; while (len-- > 0) av_push(av, newSViv(0)); } /* need to save off the current version string for later */ if ( vinf ) { SV * orig = newSVpvn("v.Inf", sizeof("v.Inf")-1); (void)hv_stores(MUTABLE_HV(hv), "original", orig); (void)hv_stores(MUTABLE_HV(hv), "vinf", newSViv(1)); } else if ( s > start ) { SV * orig = newSVpvn(start,s-start); if ( qv && saw_decimal == 1 && *start != 'v' ) { /* need to insert a v to be consistent */ sv_insert(orig, 0, 0, "v", 1); } (void)hv_stores(MUTABLE_HV(hv), "original", orig); } else { (void)hv_stores(MUTABLE_HV(hv), "original", newSVpvs("0")); av_push(av, newSViv(0)); } /* And finally, store the AV in the hash */ (void)hv_stores(MUTABLE_HV(hv), "version", newRV_noinc(MUTABLE_SV(av))); /* fix RT#19517 - special case 'undef' as string */ if ( *s == 'u' && strEQ(s+1,"ndef") ) { s += 5; } return s; } /* =for apidoc new_version Returns a new version object based on the passed in SV: SV *sv = new_version(SV *ver); Does not alter the passed in ver SV. See "upg_version" if you want to upgrade the SV. =cut */ SV * #if VUTIL_REPLACE_CORE Perl_new_version2(pTHX_ SV *ver) #else Perl_new_version(pTHX_ SV *ver) #endif { dVAR; SV * const rv = newSV(0); PERL_ARGS_ASSERT_NEW_VERSION; if ( ISA_VERSION_OBJ(ver) ) /* can just copy directly */ { SSize_t key; AV * const av = newAV(); AV *sav; /* This will get reblessed later if a derived class*/ SV * const hv = newSVrv(rv, "version"); (void)sv_upgrade(hv, SVt_PVHV); /* needs to be an HV type */ #ifndef NODEFAULT_SHAREKEYS HvSHAREKEYS_on(hv); /* key-sharing on by default */ #endif if ( SvROK(ver) ) ver = SvRV(ver); /* Begin copying all of the elements */ if ( hv_exists(MUTABLE_HV(ver), "qv", 2) ) (void)hv_stores(MUTABLE_HV(hv), "qv", newSViv(1)); if ( hv_exists(MUTABLE_HV(ver), "alpha", 5) ) (void)hv_stores(MUTABLE_HV(hv), "alpha", newSViv(1)); { SV ** svp = hv_fetchs(MUTABLE_HV(ver), "width", FALSE); if(svp) { const I32 width = SvIV(*svp); (void)hv_stores(MUTABLE_HV(hv), "width", newSViv(width)); } } { SV ** svp = hv_fetchs(MUTABLE_HV(ver), "original", FALSE); if(svp) (void)hv_stores(MUTABLE_HV(hv), "original", newSVsv(*svp)); } sav = MUTABLE_AV(SvRV(*hv_fetchs(MUTABLE_HV(ver), "version", FALSE))); /* This will get reblessed later if a derived class*/ for ( key = 0; key <= av_len(sav); key++ ) { SV * const sv = *av_fetch(sav, key, FALSE); const I32 rev = SvIV(sv); av_push(av, newSViv(rev)); } (void)hv_stores(MUTABLE_HV(hv), "version", newRV_noinc(MUTABLE_SV(av))); return rv; } #ifdef SvVOK { const MAGIC* const mg = SvVSTRING_mg(ver); if ( mg ) { /* already a v-string */ const STRLEN len = mg->mg_len; const char * const version = (const char*)mg->mg_ptr; sv_setpvn(rv,version,len); /* this is for consistency with the pure Perl class */ if ( isDIGIT(*version) ) sv_insert(rv, 0, 0, "v", 1); } else { #endif SvSetSV_nosteal(rv, ver); /* make a duplicate */ #ifdef SvVOK } } #endif return UPG_VERSION(rv, FALSE); } /* =for apidoc upg_version In-place upgrade of the supplied SV to a version object. SV *sv = upg_version(SV *sv, bool qv); Returns a pointer to the upgraded SV. Set the boolean qv if you want to force this SV to be interpreted as an "extended" version. =cut */ SV * #if VUTIL_REPLACE_CORE Perl_upg_version2(pTHX_ SV *ver, bool qv) #else Perl_upg_version(pTHX_ SV *ver, bool qv) #endif { const char *version, *s; #ifdef SvVOK const MAGIC *mg; #endif PERL_ARGS_ASSERT_UPG_VERSION; if ( SvNOK(ver) && !( SvPOK(ver) && SvCUR(ver) == 3 ) ) { STRLEN len; /* may get too much accuracy */ char tbuf[64]; SV *sv = SvNVX(ver) > 10e50 ? newSV(64) : 0; char *buf; STORE_NUMERIC_LOCAL_SET_STANDARD(); if (sv) { Perl_sv_catpvf(aTHX_ sv, "%.9"NVff, SvNVX(ver)); len = SvCUR(sv); buf = SvPVX(sv); } else { len = my_snprintf(tbuf, sizeof(tbuf), "%.9"NVff, SvNVX(ver)); buf = tbuf; } RESTORE_NUMERIC_LOCAL(); while (buf[len-1] == '0' && len > 0) len--; if ( buf[len-1] == '.' ) len--; /* eat the trailing decimal */ version = savepvn(buf, len); SAVEFREEPV(version); SvREFCNT_dec(sv); } #ifdef SvVOK else if ( (mg = SvVSTRING_mg(ver)) ) { /* already a v-string */ version = savepvn( (const char*)mg->mg_ptr,mg->mg_len ); SAVEFREEPV(version); qv = TRUE; } #endif else if ( (SvUOK(ver) && SvUVX(ver) > VERSION_MAX) || (SvIOK(ver) && SvIVX(ver) > VERSION_MAX) ) { /* out of bounds [unsigned] integer */ STRLEN len; char tbuf[64]; len = my_snprintf(tbuf, sizeof(tbuf), "%d", VERSION_MAX); version = savepvn(tbuf, len); SAVEFREEPV(version); Perl_ck_warner(aTHX_ packWARN(WARN_OVERFLOW), "Integer overflow in version %d",VERSION_MAX); } else if ( SvUOK(ver) || SvIOK(ver) ) { version = savesvpv(ver); SAVEFREEPV(version); } else if ( SvPOK(ver) )/* must be a string or something like a string */ { STRLEN len; version = savepvn(SvPV(ver,len), SvCUR(ver)); SAVEFREEPV(version); #ifndef SvVOK # if PERL_VERSION > 5 /* This will only be executed for 5.6.0 - 5.8.0 inclusive */ if ( len >= 3 && !instr(version,".") && !instr(version,"_")) { /* may be a v-string */ char *testv = (char *)version; STRLEN tlen = len; for (tlen=0; tlen < len; tlen++, testv++) { /* if one of the characters is non-text assume v-string */ if (testv[0] < ' ') { SV * const nsv = sv_newmortal(); const char *nver; const char *pos; int saw_decimal = 0; sv_setpvf(nsv,"v%vd",ver); pos = nver = savepv(SvPV_nolen(nsv)); SAVEFREEPV(pos); /* scan the resulting formatted string */ pos++; /* skip the leading 'v' */ while ( *pos == '.' || isDIGIT(*pos) ) { if ( *pos == '.' ) saw_decimal++ ; pos++; } /* is definitely a v-string */ if ( saw_decimal >= 2 ) { version = nver; } break; } } } # endif #endif } else { /* no idea what this is */ Perl_croak(aTHX_ "Invalid version format (non-numeric data)"); } s = SCAN_VERSION(version, ver, qv); if ( *s != '\0' ) Perl_ck_warner(aTHX_ packWARN(WARN_MISC), "Version string '%s' contains invalid data; " "ignoring: '%s'", version, s); return ver; } /* =for apidoc vverify Validates that the SV contains valid internal structure for a version object. It may be passed either the version object (RV) or the hash itself (HV). If the structure is valid, it returns the HV. If the structure is invalid, it returns NULL. SV *hv = vverify(sv); Note that it only confirms the bare minimum structure (so as not to get confused by derived classes which may contain additional hash entries): =over 4 =item * The SV is an HV or a reference to an HV =item * The hash contains a "version" key =item * The "version" key has a reference to an AV as its value =back =cut */ SV * #if VUTIL_REPLACE_CORE Perl_vverify2(pTHX_ SV *vs) #else Perl_vverify(pTHX_ SV *vs) #endif { SV *sv; SV **svp; PERL_ARGS_ASSERT_VVERIFY; if ( SvROK(vs) ) vs = SvRV(vs); /* see if the appropriate elements exist */ if ( SvTYPE(vs) == SVt_PVHV && (svp = hv_fetchs(MUTABLE_HV(vs), "version", FALSE)) && (sv = SvRV(*svp)) && SvTYPE(sv) == SVt_PVAV ) return vs; else return NULL; } /* =for apidoc vnumify Accepts a version object and returns the normalized floating point representation. Call like: sv = vnumify(rv); NOTE: you can pass either the object directly or the SV contained within the RV. The SV returned has a refcount of 1. =cut */ SV * #if VUTIL_REPLACE_CORE Perl_vnumify2(pTHX_ SV *vs) #else Perl_vnumify(pTHX_ SV *vs) #endif { SSize_t i, len; I32 digit; int width; bool alpha = FALSE; SV *sv; AV *av; PERL_ARGS_ASSERT_VNUMIFY; /* extract the HV from the object */ vs = VVERIFY(vs); if ( ! vs ) Perl_croak(aTHX_ "Invalid version object"); /* see if various flags exist */ if ( hv_exists(MUTABLE_HV(vs), "alpha", 5 ) ) alpha = TRUE; { SV ** svp = hv_fetchs(MUTABLE_HV(vs), "width", FALSE); if ( svp ) width = SvIV(*svp); else width = 3; } /* attempt to retrieve the version array */ if ( !(av = MUTABLE_AV(SvRV(*hv_fetchs(MUTABLE_HV(vs), "version", FALSE))) ) ) { return newSVpvs("0"); } len = av_len(av); if ( len == -1 ) { return newSVpvs("0"); } { SV * tsv = *av_fetch(av, 0, 0); digit = SvIV(tsv); } sv = Perl_newSVpvf(aTHX_ "%d.", (int)PERL_ABS(digit)); for ( i = 1 ; i < len ; i++ ) { SV * tsv = *av_fetch(av, i, 0); digit = SvIV(tsv); if ( width < 3 ) { const int denom = (width == 2 ? 10 : 100); const div_t term = div((int)PERL_ABS(digit),denom); Perl_sv_catpvf(aTHX_ sv, "%0*d_%d", width, term.quot, term.rem); } else { Perl_sv_catpvf(aTHX_ sv, "%0*d", width, (int)digit); } } if ( len > 0 ) { SV * tsv = *av_fetch(av, len, 0); digit = SvIV(tsv); if ( alpha && width == 3 ) /* alpha version */ sv_catpvs(sv,"_"); Perl_sv_catpvf(aTHX_ sv, "%0*d", width, (int)digit); } else /* len == 0 */ { sv_catpvs(sv, "000"); } return sv; } /* =for apidoc vnormal Accepts a version object and returns the normalized string representation. Call like: sv = vnormal(rv); NOTE: you can pass either the object directly or the SV contained within the RV. The SV returned has a refcount of 1. =cut */ SV * #if VUTIL_REPLACE_CORE Perl_vnormal2(pTHX_ SV *vs) #else Perl_vnormal(pTHX_ SV *vs) #endif { I32 i, len, digit; bool alpha = FALSE; SV *sv; AV *av; PERL_ARGS_ASSERT_VNORMAL; /* extract the HV from the object */ vs = VVERIFY(vs); if ( ! vs ) Perl_croak(aTHX_ "Invalid version object"); if ( hv_exists(MUTABLE_HV(vs), "alpha", 5 ) ) alpha = TRUE; av = MUTABLE_AV(SvRV(*hv_fetchs(MUTABLE_HV(vs), "version", FALSE))); len = av_len(av); if ( len == -1 ) { return newSVpvs(""); } { SV * tsv = *av_fetch(av, 0, 0); digit = SvIV(tsv); } sv = Perl_newSVpvf(aTHX_ "v%"IVdf, (IV)digit); for ( i = 1 ; i < len ; i++ ) { SV * tsv = *av_fetch(av, i, 0); digit = SvIV(tsv); Perl_sv_catpvf(aTHX_ sv, ".%"IVdf, (IV)digit); } if ( len > 0 ) { /* handle last digit specially */ SV * tsv = *av_fetch(av, len, 0); digit = SvIV(tsv); if ( alpha ) Perl_sv_catpvf(aTHX_ sv, "_%"IVdf, (IV)digit); else Perl_sv_catpvf(aTHX_ sv, ".%"IVdf, (IV)digit); } if ( len <= 2 ) { /* short version, must be at least three */ for ( len = 2 - len; len != 0; len-- ) sv_catpvs(sv,".0"); } return sv; } /* =for apidoc vstringify In order to maintain maximum compatibility with earlier versions of Perl, this function will return either the floating point notation or the multiple dotted notation, depending on whether the original version contained 1 or more dots, respectively. The SV returned has a refcount of 1. =cut */ SV * #if VUTIL_REPLACE_CORE Perl_vstringify2(pTHX_ SV *vs) #else Perl_vstringify(pTHX_ SV *vs) #endif { SV ** svp; PERL_ARGS_ASSERT_VSTRINGIFY; /* extract the HV from the object */ vs = VVERIFY(vs); if ( ! vs ) Perl_croak(aTHX_ "Invalid version object"); svp = hv_fetchs(MUTABLE_HV(vs), "original", FALSE); if (svp) { SV *pv; pv = *svp; if ( SvPOK(pv) ) return newSVsv(pv); else return &PL_sv_undef; } else { if ( hv_exists(MUTABLE_HV(vs), "qv", 2) ) return VNORMAL(vs); else return VNUMIFY(vs); } } /* =for apidoc vcmp Version object aware cmp. Both operands must already have been converted into version objects. =cut */ int #if VUTIL_REPLACE_CORE Perl_vcmp2(pTHX_ SV *lhv, SV *rhv) #else Perl_vcmp(pTHX_ SV *lhv, SV *rhv) #endif { SSize_t i,l,m,r; I32 retval; bool lalpha = FALSE; bool ralpha = FALSE; I32 left = 0; I32 right = 0; AV *lav, *rav; PERL_ARGS_ASSERT_VCMP; /* extract the HVs from the objects */ lhv = VVERIFY(lhv); rhv = VVERIFY(rhv); if ( ! ( lhv && rhv ) ) Perl_croak(aTHX_ "Invalid version object"); /* get the left hand term */ lav = MUTABLE_AV(SvRV(*hv_fetchs(MUTABLE_HV(lhv), "version", FALSE))); if ( hv_exists(MUTABLE_HV(lhv), "alpha", 5 ) ) lalpha = TRUE; /* and the right hand term */ rav = MUTABLE_AV(SvRV(*hv_fetchs(MUTABLE_HV(rhv), "version", FALSE))); if ( hv_exists(MUTABLE_HV(rhv), "alpha", 5 ) ) ralpha = TRUE; l = av_len(lav); r = av_len(rav); m = l < r ? l : r; retval = 0; i = 0; while ( i <= m && retval == 0 ) { SV * const lsv = *av_fetch(lav,i,0); SV * rsv; left = SvIV(lsv); rsv = *av_fetch(rav,i,0); right = SvIV(rsv); if ( left < right ) retval = -1; if ( left > right ) retval = +1; i++; } /* tiebreaker for alpha with identical terms */ if ( retval == 0 && l == r && left == right && ( lalpha || ralpha ) ) { if ( lalpha && !ralpha ) { retval = -1; } else if ( ralpha && !lalpha) { retval = +1; } } if ( l != r && retval == 0 ) /* possible match except for trailing 0's */ { if ( l < r ) { while ( i <= r && retval == 0 ) { SV * const rsv = *av_fetch(rav,i,0); if ( SvIV(rsv) != 0 ) retval = -1; /* not a match after all */ i++; } } else { while ( i <= l && retval == 0 ) { SV * const lsv = *av_fetch(lav,i,0); if ( SvIV(lsv) != 0 ) retval = +1; /* not a match after all */ i++; } } } return retval; } version-0.9907/vutil/lib/0000755000175000017500000000000012265475472015356 5ustar jpeacockjpeacockversion-0.9907/vutil/lib/version/0000755000175000017500000000000012265475472017043 5ustar jpeacockjpeacockversion-0.9907/vutil/lib/version/vxs.pm0000644000175000017500000000076612264530030020207 0ustar jpeacockjpeacock#!perl -w package version::vxs; use v5.10; use strict; use vars qw(@ISA $VERSION $CLASS ); $VERSION = 0.9907; $CLASS = 'version::vxs'; eval { require XSLoader; local $^W; # shut up the 'redefined' warning for UNIVERSAL::VERSION XSLoader::load('version::vxs', $VERSION); 1; } or do { require DynaLoader; push @ISA, 'DynaLoader'; local $^W; # shut up the 'redefined' warning for UNIVERSAL::VERSION bootstrap version::vxs $VERSION; }; # Preloaded methods go here. 1; version-0.9907/vutil/vxs.inc0000644000175000017500000002500012264301334016100 0ustar jpeacockjpeacock/* This file is part of the "version" CPAN distribution. Please avoid editing it in the perl core. */ #ifdef PERL_CORE # define VXS_CLASS "version" # define VXSp(name) XS_##name /* VXSXSDP = XSUB Details Proto */ # define VXSXSDP(x) x #else # define VXS_CLASS "version::vxs" # define VXSp(name) VXS_##name /* proto member is unused in version, it is used in CORE by non version xsubs */ # define VXSXSDP(x) #endif #define VXS(name) XS(VXSp(name)) #ifdef VXS_XSUB_DETAILS # ifdef PERL_CORE {"UNIVERSAL::VERSION", VXSp(universal_version), VXSXSDP(NULL)}, # endif {VXS_CLASS "::_VERSION", VXSp(universal_version), VXSXSDP(NULL)}, {VXS_CLASS "::()", VXSp(version_noop), VXSXSDP(NULL)}, {VXS_CLASS "::new", VXSp(version_new), VXSXSDP(NULL)}, {VXS_CLASS "::parse", VXSp(version_new), VXSXSDP(NULL)}, {VXS_CLASS "::(\"\"", VXSp(version_stringify), VXSXSDP(NULL)}, {VXS_CLASS "::stringify", VXSp(version_stringify), VXSXSDP(NULL)}, {VXS_CLASS "::(0+", VXSp(version_numify), VXSXSDP(NULL)}, {VXS_CLASS "::numify", VXSp(version_numify), VXSXSDP(NULL)}, {VXS_CLASS "::normal", VXSp(version_normal), VXSXSDP(NULL)}, {VXS_CLASS "::(cmp", VXSp(version_vcmp), VXSXSDP(NULL)}, {VXS_CLASS "::(<=>", VXSp(version_vcmp), VXSXSDP(NULL)}, # ifdef PERL_CORE {VXS_CLASS "::vcmp", XS_version_vcmp, VXSXSDP(NULL)}, # else {VXS_CLASS "::VCMP", VXS_version_vcmp, VXSXSDP(NULL)}, # endif {VXS_CLASS "::(bool", VXSp(version_boolean), VXSXSDP(NULL)}, {VXS_CLASS "::boolean", VXSp(version_boolean), VXSXSDP(NULL)}, {VXS_CLASS "::(+", VXSp(version_noop), VXSXSDP(NULL)}, {VXS_CLASS "::(-", VXSp(version_noop), VXSXSDP(NULL)}, {VXS_CLASS "::(*", VXSp(version_noop), VXSXSDP(NULL)}, {VXS_CLASS "::(/", VXSp(version_noop), VXSXSDP(NULL)}, {VXS_CLASS "::(+=", VXSp(version_noop), VXSXSDP(NULL)}, {VXS_CLASS "::(-=", VXSp(version_noop), VXSXSDP(NULL)}, {VXS_CLASS "::(*=", VXSp(version_noop), VXSXSDP(NULL)}, {VXS_CLASS "::(/=", VXSp(version_noop), VXSXSDP(NULL)}, {VXS_CLASS "::(abs", VXSp(version_noop), VXSXSDP(NULL)}, {VXS_CLASS "::(nomethod", VXSp(version_noop), VXSXSDP(NULL)}, {VXS_CLASS "::noop", VXSp(version_noop), VXSXSDP(NULL)}, {VXS_CLASS "::is_alpha", VXSp(version_is_alpha), VXSXSDP(NULL)}, {VXS_CLASS "::qv", VXSp(version_qv), VXSXSDP(NULL)}, {VXS_CLASS "::declare", VXSp(version_qv), VXSXSDP(NULL)}, {VXS_CLASS "::is_qv", VXSp(version_is_qv), VXSXSDP(NULL)}, #else #ifndef dVAR # define dVAR #endif #ifdef HvNAME_HEK typedef HEK HVNAME; # ifndef HEKf # define HEKfARG(arg) ((void*)(sv_2mortal(newSVhek(arg)))) # define HEKf SVf # endif #else typedef char HVNAME; # define HvNAME_HEK HvNAME_get # define HEKfARG(arg) arg # define HEKf "s" #endif VXS(universal_version) { dVAR; dXSARGS; HV *pkg; GV **gvp; GV *gv; SV *sv; const char *undef; PERL_UNUSED_ARG(cv); if (items < 1) Perl_croak(aTHX_ "Usage: UNIVERSAL::VERSION(sv, ...)"); sv = ST(0); if (SvROK(sv)) { sv = (SV*)SvRV(sv); if (!SvOBJECT(sv)) Perl_croak(aTHX_ "Cannot find version of an unblessed reference"); pkg = SvSTASH(sv); } else { pkg = gv_stashsv(sv, FALSE); } gvp = pkg ? (GV**)hv_fetchs(pkg,"VERSION",FALSE) : (GV**)NULL; if (gvp && isGV(gv = *gvp) && (sv = GvSV(gv)) && SvOK(sv)) { sv = sv_mortalcopy(sv); if ( ! ISA_VERSION_OBJ(sv) ) UPG_VERSION(sv, FALSE); undef = NULL; } else { sv = &PL_sv_undef; undef = "(undef)"; } if (items > 1) { SV *req = ST(1); if (undef) { if (pkg) { const HVNAME* const name = HvNAME_HEK(pkg); #if PERL_VERSION == 5 Perl_croak(aTHX_ "%s version %s required--this is only version ", name, SvPVx_nolen_const(req)); #else Perl_croak(aTHX_ "%"HEKf" does not define $%"HEKf "::VERSION--version check failed", HEKfARG(name), HEKfARG(name)); #endif } else { #if PERL_VERSION >= 8 Perl_croak(aTHX_ "%"SVf" defines neither package nor VERSION--version check failed", (void*)(ST(0)) ); #else Perl_croak(aTHX_ "%s does not define $%s::VERSION--version check failed", SvPVx_nolen_const(ST(0)), SvPVx_nolen_const(ST(0)) ); #endif } } if ( ! ISA_VERSION_OBJ(req) ) { /* req may very well be R/O, so create a new object */ req = sv_2mortal( NEW_VERSION(req) ); } if ( VCMP( req, sv ) > 0 ) { if ( hv_exists(MUTABLE_HV(SvRV(req)), "qv", 2 ) ) { req = VNORMAL(req); sv = VNORMAL(sv); } else { req = VSTRINGIFY(req); sv = VSTRINGIFY(sv); } Perl_croak(aTHX_ "%"HEKf" version %"SVf" required--" "this is only version %"SVf"", HEKfARG(HvNAME_HEK(pkg)), SVfARG(sv_2mortal(req)), SVfARG(sv_2mortal(sv))); } } /* if the package's $VERSION is not undef, it is upgraded to be a version object */ if (ISA_VERSION_OBJ(sv)) { ST(0) = sv_2mortal(VSTRINGIFY(sv)); } else { ST(0) = sv; } XSRETURN(1); } VXS(version_new) { dVAR; dXSARGS; SV *vs = items ? ST(1) : &PL_sv_undef; SV *rv; const char * classname = ""; STRLEN len; U32 flags = 0; SV * svarg0 = NULL; PERL_UNUSED_VAR(cv); SP -= items; if (items > 3 || items == 0) Perl_croak(aTHX_ "Usage: version::new(class, version)"); /* Just in case this is something like a tied hash */ SvGETMAGIC(vs); if ( items == 1 || ! SvOK(vs) ) { /* no param or explicit undef */ /* create empty object */ vs = sv_newmortal(); sv_setpvs(vs,"undef"); } else if (items == 3 ) { SV * svarg2; vs = sv_newmortal(); svarg2 = ST(2); #if PERL_VERSION == 5 sv_setpvf(vs,"v%s",SvPV_nolen_const(svarg2)); #else Perl_sv_setpvf(aTHX_ vs,"v%s",SvPV_nolen_const(svarg2)); #endif } svarg0 = ST(0); if ( sv_isobject(svarg0) ) { /* get the class if called as an object method */ const HV * stash = SvSTASH(SvRV(svarg0)); classname = HvNAME_get(stash); len = HvNAMELEN_get(stash); #ifdef HvNAMEUTF8 flags = HvNAMEUTF8(stash) ? SVf_UTF8 : 0; #endif } else { classname = SvPV(svarg0, len); flags = SvUTF8(svarg0); } rv = NEW_VERSION(vs); if ( len != sizeof(VXS_CLASS)-1 || strcmp(classname,VXS_CLASS) != 0 ) /* inherited new() */ #if PERL_VERSION == 5 sv_bless(rv, gv_stashpv((char *)classname, GV_ADD)); #else sv_bless(rv, gv_stashpvn(classname, len, GV_ADD | flags)); #endif mPUSHs(rv); PUTBACK; return; } #define VTYPECHECK(var, val, varname) \ STMT_START { \ SV * sv_vtc = val; \ if (ISA_VERSION_OBJ(sv_vtc)) { \ (var) = SvRV(sv_vtc); \ } \ else \ Perl_croak(aTHX_ varname " is not of type version"); \ } STMT_END VXS(version_stringify) { dVAR; dXSARGS; if (items < 1) croak_xs_usage(cv, "lobj, ..."); SP -= items; { SV * lobj; VTYPECHECK(lobj, ST(0), "lobj"); mPUSHs(VSTRINGIFY(lobj)); PUTBACK; return; } } VXS(version_numify) { dVAR; dXSARGS; if (items < 1) croak_xs_usage(cv, "lobj, ..."); SP -= items; { SV * lobj; VTYPECHECK(lobj, ST(0), "lobj"); mPUSHs(VNUMIFY(lobj)); PUTBACK; return; } } VXS(version_normal) { dVAR; dXSARGS; if (items != 1) croak_xs_usage(cv, "ver"); SP -= items; { SV * ver; VTYPECHECK(ver, ST(0), "ver"); mPUSHs(VNORMAL(ver)); PUTBACK; return; } } VXS(version_vcmp) { dVAR; dXSARGS; if (items < 1) croak_xs_usage(cv, "lobj, ..."); SP -= items; { SV * lobj; VTYPECHECK(lobj, ST(0), "lobj"); { SV *rs; SV *rvs; SV * robj = ST(1); const IV swap = (IV)SvIV(ST(2)); if ( !ISA_VERSION_OBJ(robj) ) { robj = sv_2mortal(NEW_VERSION(SvOK(robj) ? robj : newSVpvs_flags("0", SVs_TEMP))); } rvs = SvRV(robj); if ( swap ) { rs = newSViv(VCMP(rvs,lobj)); } else { rs = newSViv(VCMP(lobj,rvs)); } mPUSHs(rs); } PUTBACK; return; } } VXS(version_boolean) { dVAR; dXSARGS; SV *lobj; if (items < 1) croak_xs_usage(cv, "lobj, ..."); SP -= items; VTYPECHECK(lobj, ST(0), "lobj"); { SV * const rs = newSViv( VCMP(lobj, sv_2mortal(NEW_VERSION( sv_2mortal(newSVpvs("0")) )) ) ); mPUSHs(rs); PUTBACK; return; } } VXS(version_noop) { dVAR; dXSARGS; if (items < 1) croak_xs_usage(cv, "lobj, ..."); if (ISA_VERSION_OBJ(ST(0))) Perl_croak(aTHX_ "operation not supported with version object"); else Perl_croak(aTHX_ "lobj is not of type version"); XSRETURN_EMPTY; } static void S_version_check_key(pTHX_ CV * cv, const char * key, int keylen) { dVAR; dXSARGS; if (items != 1) croak_xs_usage(cv, "lobj"); { SV *lobj = POPs; SV *ret; VTYPECHECK(lobj, lobj, "lobj"); if ( hv_exists(MUTABLE_HV(lobj), key, keylen ) ) ret = &PL_sv_yes; else ret = &PL_sv_no; PUSHs(ret); PUTBACK; return; } } VXS(version_is_alpha) { S_version_check_key(aTHX_ cv, "alpha", 5); } VXS(version_qv) { dVAR; dXSARGS; PERL_UNUSED_ARG(cv); SP -= items; { SV * ver = ST(0); SV * sv0 = ver; SV * rv; STRLEN len = 0; const char * classname = ""; U32 flags = 0; if ( items == 2 ) { SV * sv1 = ST(1); SvGETMAGIC(sv1); if (SvOK(sv1)) { ver = sv1; } else { Perl_croak(aTHX_ "Invalid version format (version required)"); } if ( sv_isobject(sv0) ) { /* class called as an object method */ const HV * stash = SvSTASH(SvRV(sv0)); classname = HvNAME_get(stash); len = HvNAMELEN_get(stash); #ifdef HvNAMEUTF8 flags = HvNAMEUTF8(stash) ? SVf_UTF8 : 0; #endif } else { classname = SvPV(sv0, len); flags = SvUTF8(sv0); } } if ( !SvVOK(ver) ) { /* not already a v-string */ rv = sv_newmortal(); SvSetSV_nosteal(rv,ver); /* make a duplicate */ UPG_VERSION(rv, TRUE); } else { rv = sv_2mortal(NEW_VERSION(ver)); } if ( items == 2 && (len != 7 || strcmp(classname,"version")) ) { /* inherited new() */ #if PERL_VERSION == 5 sv_bless(rv, gv_stashpv((char *)classname, GV_ADD)); #else sv_bless(rv, gv_stashpvn(classname, len, GV_ADD | flags)); #endif } PUSHs(rv); } PUTBACK; return; } VXS(version_is_qv) { S_version_check_key(aTHX_ cv, "qv", 2); } #endif version-0.9907/vutil/vutil.h0000644000175000017500000001610212264744674016126 0ustar jpeacockjpeacock/* This file is part of the "version" CPAN distribution. Please avoid editing it in the perl core. */ #ifndef PERL_CORE # include "ppport.h" #endif /* The MUTABLE_*() macros cast pointers to the types shown, in such a way * (compiler permitting) that casting away const-ness will give a warning; * e.g.: * * const SV *sv = ...; * AV *av1 = (AV*)sv; <== BAD: the const has been silently cast away * AV *av2 = MUTABLE_AV(sv); <== GOOD: it may warn */ #ifndef MUTABLE_PTR # if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) # define MUTABLE_PTR(p) ({ void *_p = (p); _p; }) # else # define MUTABLE_PTR(p) ((void *) (p)) # endif # define MUTABLE_AV(p) ((AV *)MUTABLE_PTR(p)) # define MUTABLE_CV(p) ((CV *)MUTABLE_PTR(p)) # define MUTABLE_GV(p) ((GV *)MUTABLE_PTR(p)) # define MUTABLE_HV(p) ((HV *)MUTABLE_PTR(p)) # define MUTABLE_IO(p) ((IO *)MUTABLE_PTR(p)) # define MUTABLE_SV(p) ((SV *)MUTABLE_PTR(p)) #endif #ifndef SvPVx_nolen_const # if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) # define SvPVx_nolen_const(sv) ({SV *_sv = (sv); SvPV_nolen_const(_sv); }) # else # define SvPVx_nolen_const(sv) (SvPV_nolen_const(sv)) # endif #endif #ifndef PERL_ARGS_ASSERT_CK_WARNER static void Perl_ck_warner(pTHX_ U32 err, const char* pat, ...); # ifdef vwarner static void Perl_ck_warner(pTHX_ U32 err, const char* pat, ...) { va_list args; PERL_UNUSED_ARG(err); if (ckWARN(err)) { va_list args; va_start(args, pat); vwarner(err, pat, &args); va_end(args); } } # else /* yes this replicates my_warner */ static void Perl_ck_warner(pTHX_ U32 err, const char* pat, ...) { SV *sv; va_list args; PERL_UNUSED_ARG(err); va_start(args, pat); sv = vnewSVpvf(pat, &args); va_end(args); sv_2mortal(sv); warn("%s", SvPV_nolen(sv)); } # endif #endif #define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s) #define PERL_DECIMAL_VERSION \ PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION) #define PERL_VERSION_LT(r,v,s) \ (PERL_DECIMAL_VERSION < PERL_VERSION_DECIMAL(r,v,s)) #define PERL_VERSION_GE(r,v,s) \ (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s)) #if PERL_VERSION_LT(5,15,4) # define ISA_VERSION_OBJ(v) (sv_isobject(v) && sv_derived_from(v,"version")) #else # define ISA_VERSION_OBJ(v) (sv_isobject(v) && sv_derived_from_pvn(v,"version",7,0)) #endif #ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE #define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params) /* prototype to pass -Wmissing-prototypes */ STATIC void S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params); STATIC void S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params) { const GV *const gv = CvGV(cv); PERL_ARGS_ASSERT_CROAK_XS_USAGE; if (gv) { const char *const gvname = GvNAME(gv); const HV *const stash = GvSTASH(gv); const char *const hvname = stash ? HvNAME(stash) : NULL; if (hvname) Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params); else Perl_croak_nocontext("Usage: %s(%s)", gvname, params); } else { /* Pants. I don't think that it should be possible to get here. */ Perl_croak_nocontext("Usage: CODE(0x%"UVxf")(%s)", PTR2UV(cv), params); } } #ifdef PERL_IMPLICIT_CONTEXT #define croak_xs_usage(a,b) S_croak_xs_usage(aTHX_ a,b) #else #define croak_xs_usage S_croak_xs_usage #endif #endif #if PERL_VERSION_GE(5,9,0) && !defined(PERL_CORE) # define VUTIL_REPLACE_CORE 1 const char * Perl_scan_version2(pTHX_ const char *s, SV *rv, bool qv); SV * Perl_new_version2(pTHX_ SV *ver); SV * Perl_upg_version2(pTHX_ SV *sv, bool qv); SV * Perl_vstringify2(pTHX_ SV *vs); SV * Perl_vverify2(pTHX_ SV *vs); SV * Perl_vnumify2(pTHX_ SV *vs); SV * Perl_vnormal2(pTHX_ SV *vs); SV * Perl_vstringify2(pTHX_ SV *vs); int Perl_vcmp2(pTHX_ SV *lsv, SV *rsv); const char * Perl_prescan_version2(pTHX_ const char *s, bool strict, const char** errstr, bool *sqv, int *ssaw_decimal, int *swidth, bool *salpha); # define SCAN_VERSION(a,b,c) Perl_scan_version2(aTHX_ a,b,c) # define NEW_VERSION(a) Perl_new_version2(aTHX_ a) # define UPG_VERSION(a,b) Perl_upg_version2(aTHX_ a, b) # define VSTRINGIFY(a) Perl_vstringify2(aTHX_ a) # define VVERIFY(a) Perl_vverify2(aTHX_ a) # define VNUMIFY(a) Perl_vnumify2(aTHX_ a) # define VNORMAL(a) Perl_vnormal2(aTHX_ a) # define VCMP(a,b) Perl_vcmp2(aTHX_ a,b) # define PRESCAN_VERSION(a,b,c,d,e,f,g) Perl_prescan_version2(aTHX_ a,b,c,d,e,f,g) # undef is_LAX_VERSION # define is_LAX_VERSION(a,b) \ (a != Perl_prescan_version2(aTHX_ a, FALSE, b, NULL, NULL, NULL, NULL)) # undef is_STRICT_VERSION # define is_STRICT_VERSION(a,b) \ (a != Perl_prescan_version2(aTHX_ a, TRUE, b, NULL, NULL, NULL, NULL)) #else const char * Perl_scan_version(pTHX_ const char *s, SV *rv, bool qv); SV * Perl_new_version(pTHX_ SV *ver); SV * Perl_upg_version(pTHX_ SV *sv, bool qv); SV * Perl_vverify(pTHX_ SV *vs); SV * Perl_vnumify(pTHX_ SV *vs); SV * Perl_vnormal(pTHX_ SV *vs); SV * Perl_vstringify(pTHX_ SV *vs); int Perl_vcmp(pTHX_ SV *lsv, SV *rsv); const char * Perl_prescan_version(pTHX_ const char *s, bool strict, const char** errstr, bool *sqv, int *ssaw_decimal, int *swidth, bool *salpha); # define SCAN_VERSION(a,b,c) Perl_scan_version(aTHX_ a,b,c) # define NEW_VERSION(a) Perl_new_version(aTHX_ a) # define UPG_VERSION(a,b) Perl_upg_version(aTHX_ a, b) # define VSTRINGIFY(a) Perl_vstringify(aTHX_ a) # define VVERIFY(a) Perl_vverify(aTHX_ a) # define VNUMIFY(a) Perl_vnumify(aTHX_ a) # define VNORMAL(a) Perl_vnormal(aTHX_ a) # define VCMP(a,b) Perl_vcmp(aTHX_ a,b) # define PRESCAN_VERSION(a,b,c,d,e,f,g) Perl_prescan_version(aTHX_ a,b,c,d,e,f,g) # ifndef is_LAX_VERSION # define is_LAX_VERSION(a,b) \ (a != Perl_prescan_version(aTHX_ a, FALSE, b, NULL, NULL, NULL, NULL)) # endif # ifndef is_STRICT_VERSION # define is_STRICT_VERSION(a,b) \ (a != Perl_prescan_version(aTHX_ a, TRUE, b, NULL, NULL, NULL, NULL)) # endif #endif #if PERL_VERSION_LT(5,11,4) # define BADVERSION(a,b,c) \ if (b) { \ *b = c; \ } \ return a; # define PERL_ARGS_ASSERT_PRESCAN_VERSION \ assert(s); assert(sqv); assert(ssaw_decimal);\ assert(swidth); assert(salpha); # define PERL_ARGS_ASSERT_SCAN_VERSION \ assert(s); assert(rv) # define PERL_ARGS_ASSERT_NEW_VERSION \ assert(ver) # define PERL_ARGS_ASSERT_UPG_VERSION \ assert(ver) # define PERL_ARGS_ASSERT_VVERIFY \ assert(vs) # define PERL_ARGS_ASSERT_VNUMIFY \ assert(vs) # define PERL_ARGS_ASSERT_VNORMAL \ assert(vs) # define PERL_ARGS_ASSERT_VSTRINGIFY \ assert(vs) # define PERL_ARGS_ASSERT_VCMP \ assert(lhv); assert(rhv) # define PERL_ARGS_ASSERT_CK_WARNER \ assert(pat) #endif #if PERL_VERSION_LT(5,19,0) # undef STORE_NUMERIC_LOCAL_SET_STANDARD # undef RESTORE_NUMERIC_LOCAL # ifdef USE_LOCALE # define STORE_NUMERIC_LOCAL_SET_STANDARD()\ char *loc = savepv(setlocale(LC_NUMERIC, NULL)); \ SAVEFREEPV(loc); \ setlocale(LC_NUMERIC, "C"); # define RESTORE_NUMERIC_LOCAL()\ setlocale(LC_NUMERIC, loc); # else # define STORE_NUMERIC_LOCAL_SET_STANDARD() # define RESTORE_NUMERIC_LOCAL() # endif #endif version-0.9907/vutil/vxs.xs0000644000175000017500000000210712264301334015764 0ustar jpeacockjpeacock#define PERL_NO_GET_CONTEXT #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #define NEED_sv_2pv_nolen_GLOBAL #include "ppport.h" #include "vutil.h" /* -------------------------------------------------- * $Revision: 2.5 $ * --------------------------------------------------*/ typedef SV *version_vxs; #include "vxs.inc" struct xsub_details { const char *name; XSUBADDR_t xsub; #ifdef PERL_CORE const char *proto; /* ignored */ #endif }; static const struct xsub_details details[] = { #define VXS_XSUB_DETAILS #include "vxs.inc" #undef VXS_XSUB_DETAILS }; MODULE = version::vxs PACKAGE = version::vxs PROTOTYPES: DISABLE VERSIONCHECK: DISABLE BOOT: { #if (PERL_REVISION == 5 && PERL_VERSION < 9) char* file = __FILE__; #else const char* file = __FILE__; #endif const struct xsub_details *xsub = details; const struct xsub_details *end = details + sizeof(details) / sizeof(details[0]); /* register the overloading (type 'A') magic */ PL_amagic_generation++; do { newXS(xsub->name, xsub->xsub, file); } while (++xsub < end); } version-0.9907/vutil/ppport.h0000644000175000017500000053137111455175677016323 0ustar jpeacockjpeacock#if 0 <<'SKIP'; #endif /* ---------------------------------------------------------------------- ppport.h -- Perl/Pollution/Portability Version 3.19_02 Automatically created by Devel::PPPort running under perl 5.012000. Do NOT edit this file directly! -- Edit PPPort_pm.PL and the includes in parts/inc/ instead. Use 'perldoc ppport.h' to view the documentation below. ---------------------------------------------------------------------- SKIP =pod =head1 NAME ppport.h - Perl/Pollution/Portability version 3.19_02 =head1 SYNOPSIS perl ppport.h [options] [source files] Searches current directory for files if no [source files] are given --help show short help --version show version --patch=file write one patch file with changes --copy=suffix write changed copies with suffix --diff=program use diff program and options --compat-version=version provide compatibility with Perl version --cplusplus accept C++ comments --quiet don't output anything except fatal errors --nodiag don't show diagnostics --nohints don't show hints --nochanges don't suggest changes --nofilter don't filter input files --strip strip all script and doc functionality from ppport.h --list-provided list provided API --list-unsupported list unsupported API --api-info=name show Perl API portability information =head1 COMPATIBILITY This version of F is designed to support operation with Perl installations back to 5.003, and has been tested up to 5.11.5. =head1 OPTIONS =head2 --help Display a brief usage summary. =head2 --version Display the version of F. =head2 --patch=I If this option is given, a single patch file will be created if any changes are suggested. This requires a working diff program to be installed on your system. =head2 --copy=I If this option is given, a copy of each file will be saved with the given suffix that contains the suggested changes. This does not require any external programs. Note that this does not automagially add a dot between the original filename and the suffix. If you want the dot, you have to include it in the option argument. If neither C<--patch> or C<--copy> are given, the default is to simply print the diffs for each file. This requires either C or a C program to be installed. =head2 --diff=I Manually set the diff program and options to use. The default is to use C, when installed, and output unified context diffs. =head2 --compat-version=I Tell F to check for compatibility with the given Perl version. The default is to check for compatibility with Perl version 5.003. You can use this option to reduce the output of F if you intend to be backward compatible only down to a certain Perl version. =head2 --cplusplus Usually, F will detect C++ style comments and replace them with C style comments for portability reasons. Using this option instructs F to leave C++ comments untouched. =head2 --quiet Be quiet. Don't print anything except fatal errors. =head2 --nodiag Don't output any diagnostic messages. Only portability alerts will be printed. =head2 --nohints Don't output any hints. Hints often contain useful portability notes. Warnings will still be displayed. =head2 --nochanges Don't suggest any changes. Only give diagnostic output and hints unless these are also deactivated. =head2 --nofilter Don't filter the list of input files. By default, files not looking like source code (i.e. not *.xs, *.c, *.cc, *.cpp or *.h) are skipped. =head2 --strip Strip all script and documentation functionality from F. This reduces the size of F dramatically and may be useful if you want to include F in smaller modules without increasing their distribution size too much. The stripped F will have a C<--unstrip> option that allows you to undo the stripping, but only if an appropriate C module is installed. =head2 --list-provided Lists the API elements for which compatibility is provided by F. Also lists if it must be explicitly requested, if it has dependencies, and if there are hints or warnings for it. =head2 --list-unsupported Lists the API elements that are known not to be supported by F and below which version of Perl they probably won't be available or work. =head2 --api-info=I Show portability information for API elements matching I. If I is surrounded by slashes, it is interpreted as a regular expression. =head1 DESCRIPTION In order for a Perl extension (XS) module to be as portable as possible across differing versions of Perl itself, certain steps need to be taken. =over 4 =item * Including this header is the first major one. This alone will give you access to a large part of the Perl API that hasn't been available in earlier Perl releases. Use perl ppport.h --list-provided to see which API elements are provided by ppport.h. =item * You should avoid using deprecated parts of the API. For example, using global Perl variables without the C prefix is deprecated. Also, some API functions used to have a C prefix. Using this form is also deprecated. You can safely use the supported API, as F will provide wrappers for older Perl versions. =item * If you use one of a few functions or variables that were not present in earlier versions of Perl, and that can't be provided using a macro, you have to explicitly request support for these functions by adding one or more C<#define>s in your source code before the inclusion of F. These functions or variables will be marked C in the list shown by C<--list-provided>. Depending on whether you module has a single or multiple files that use such functions or variables, you want either C or global variants. For a C function or variable (used only in a single source file), use: #define NEED_function #define NEED_variable For a global function or variable (used in multiple source files), use: #define NEED_function_GLOBAL #define NEED_variable_GLOBAL Note that you mustn't have more than one global request for the same function or variable in your project. Function / Variable Static Request Global Request ----------------------------------------------------------------------------------------- PL_parser NEED_PL_parser NEED_PL_parser_GLOBAL PL_signals NEED_PL_signals NEED_PL_signals_GLOBAL eval_pv() NEED_eval_pv NEED_eval_pv_GLOBAL grok_bin() NEED_grok_bin NEED_grok_bin_GLOBAL grok_hex() NEED_grok_hex NEED_grok_hex_GLOBAL grok_number() NEED_grok_number NEED_grok_number_GLOBAL grok_numeric_radix() NEED_grok_numeric_radix NEED_grok_numeric_radix_GLOBAL grok_oct() NEED_grok_oct NEED_grok_oct_GLOBAL load_module() NEED_load_module NEED_load_module_GLOBAL my_snprintf() NEED_my_snprintf NEED_my_snprintf_GLOBAL my_sprintf() NEED_my_sprintf NEED_my_sprintf_GLOBAL my_strlcat() NEED_my_strlcat NEED_my_strlcat_GLOBAL my_strlcpy() NEED_my_strlcpy NEED_my_strlcpy_GLOBAL newCONSTSUB() NEED_newCONSTSUB NEED_newCONSTSUB_GLOBAL newRV_noinc() NEED_newRV_noinc NEED_newRV_noinc_GLOBAL newSV_type() NEED_newSV_type NEED_newSV_type_GLOBAL newSVpvn_flags() NEED_newSVpvn_flags NEED_newSVpvn_flags_GLOBAL newSVpvn_share() NEED_newSVpvn_share NEED_newSVpvn_share_GLOBAL pv_display() NEED_pv_display NEED_pv_display_GLOBAL pv_escape() NEED_pv_escape NEED_pv_escape_GLOBAL pv_pretty() NEED_pv_pretty NEED_pv_pretty_GLOBAL sv_2pv_flags() NEED_sv_2pv_flags NEED_sv_2pv_flags_GLOBAL sv_2pvbyte() NEED_sv_2pvbyte NEED_sv_2pvbyte_GLOBAL sv_catpvf_mg() NEED_sv_catpvf_mg NEED_sv_catpvf_mg_GLOBAL sv_catpvf_mg_nocontext() NEED_sv_catpvf_mg_nocontext NEED_sv_catpvf_mg_nocontext_GLOBAL sv_pvn_force_flags() NEED_sv_pvn_force_flags NEED_sv_pvn_force_flags_GLOBAL sv_setpvf_mg() NEED_sv_setpvf_mg NEED_sv_setpvf_mg_GLOBAL sv_setpvf_mg_nocontext() NEED_sv_setpvf_mg_nocontext NEED_sv_setpvf_mg_nocontext_GLOBAL vload_module() NEED_vload_module NEED_vload_module_GLOBAL vnewSVpvf() NEED_vnewSVpvf NEED_vnewSVpvf_GLOBAL warner() NEED_warner NEED_warner_GLOBAL To avoid namespace conflicts, you can change the namespace of the explicitly exported functions / variables using the C macro. Just C<#define> the macro before including C: #define DPPP_NAMESPACE MyOwnNamespace_ #include "ppport.h" The default namespace is C. =back The good thing is that most of the above can be checked by running F on your source code. See the next section for details. =head1 EXAMPLES To verify whether F is needed for your module, whether you should make any changes to your code, and whether any special defines should be used, F can be run as a Perl script to check your source code. Simply say: perl ppport.h The result will usually be a list of patches suggesting changes that should at least be acceptable, if not necessarily the most efficient solution, or a fix for all possible problems. If you know that your XS module uses features only available in newer Perl releases, if you're aware that it uses C++ comments, and if you want all suggestions as a single patch file, you could use something like this: perl ppport.h --compat-version=5.6.0 --cplusplus --patch=test.diff If you only want your code to be scanned without any suggestions for changes, use: perl ppport.h --nochanges You can specify a different C program or options, using the C<--diff> option: perl ppport.h --diff='diff -C 10' This would output context diffs with 10 lines of context. If you want to create patched copies of your files instead, use: perl ppport.h --copy=.new To display portability information for the C function, use: perl ppport.h --api-info=newSVpvn Since the argument to C<--api-info> can be a regular expression, you can use perl ppport.h --api-info=/_nomg$/ to display portability information for all C<_nomg> functions or perl ppport.h --api-info=/./ to display information for all known API elements. =head1 BUGS If this version of F is causing failure during the compilation of this module, please check if newer versions of either this module or C are available on CPAN before sending a bug report. If F was generated using the latest version of C and is causing failure of this module, please file a bug report using the CPAN Request Tracker at L. Please include the following information: =over 4 =item 1. The complete output from running "perl -V" =item 2. This file. =item 3. The name and version of the module you were trying to build. =item 4. A full log of the build that failed. =item 5. Any other information that you think could be relevant. =back For the latest version of this code, please get the C module from CPAN. =head1 COPYRIGHT Version 3.x, Copyright (c) 2004-2010, Marcus Holland-Moritz. Version 2.x, Copyright (C) 2001, Paul Marquess. Version 1.x, Copyright (C) 1999, Kenneth Albanowski. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 SEE ALSO See L. =cut use strict; # Disable broken TRIE-optimization BEGIN { eval '${^RE_TRIE_MAXBUF} = -1' if $] >= 5.009004 && $] <= 5.009005 } my $VERSION = 3.19_02; my %opt = ( quiet => 0, diag => 1, hints => 1, changes => 1, cplusplus => 0, filter => 1, strip => 0, version => 0, ); my($ppport) = $0 =~ /([\w.]+)$/; my $LF = '(?:\r\n|[\r\n])'; # line feed my $HS = "[ \t]"; # horizontal whitespace # Never use C comments in this file! my $ccs = '/'.'*'; my $cce = '*'.'/'; my $rccs = quotemeta $ccs; my $rcce = quotemeta $cce; eval { require Getopt::Long; Getopt::Long::GetOptions(\%opt, qw( help quiet diag! filter! hints! changes! cplusplus strip version patch=s copy=s diff=s compat-version=s list-provided list-unsupported api-info=s )) or usage(); }; if ($@ and grep /^-/, @ARGV) { usage() if "@ARGV" =~ /^--?h(?:elp)?$/; die "Getopt::Long not found. Please don't use any options.\n"; } if ($opt{version}) { print "This is $0 $VERSION.\n"; exit 0; } usage() if $opt{help}; strip() if $opt{strip}; if (exists $opt{'compat-version'}) { my($r,$v,$s) = eval { parse_version($opt{'compat-version'}) }; if ($@) { die "Invalid version number format: '$opt{'compat-version'}'\n"; } die "Only Perl 5 is supported\n" if $r != 5; die "Invalid version number: $opt{'compat-version'}\n" if $v >= 1000 || $s >= 1000; $opt{'compat-version'} = sprintf "%d.%03d%03d", $r, $v, $s; } else { $opt{'compat-version'} = 5; } my %API = map { /^(\w+)\|([^|]*)\|([^|]*)\|(\w*)$/ ? ( $1 => { ($2 ? ( base => $2 ) : ()), ($3 ? ( todo => $3 ) : ()), (index($4, 'v') >= 0 ? ( varargs => 1 ) : ()), (index($4, 'p') >= 0 ? ( provided => 1 ) : ()), (index($4, 'n') >= 0 ? ( nothxarg => 1 ) : ()), } ) : die "invalid spec: $_" } qw( AvFILLp|5.004050||p AvFILL||| CLASS|||n CPERLscope|5.005000||p CX_CURPAD_SAVE||| CX_CURPAD_SV||| CopFILEAV|5.006000||p CopFILEGV_set|5.006000||p CopFILEGV|5.006000||p CopFILESV|5.006000||p CopFILE_set|5.006000||p CopFILE|5.006000||p CopSTASHPV_set|5.006000||p CopSTASHPV|5.006000||p CopSTASH_eq|5.006000||p CopSTASH_set|5.006000||p CopSTASH|5.006000||p CopyD|5.009002||p Copy||| CvPADLIST||| CvSTASH||| CvWEAKOUTSIDE||| DEFSV_set|5.010001||p DEFSV|5.004050||p END_EXTERN_C|5.005000||p ENTER||| ERRSV|5.004050||p EXTEND||| EXTERN_C|5.005000||p F0convert|||n FREETMPS||| GIMME_V||5.004000|n GIMME|||n GROK_NUMERIC_RADIX|5.007002||p G_ARRAY||| G_DISCARD||| G_EVAL||| G_METHOD|5.006001||p G_NOARGS||| G_SCALAR||| G_VOID||5.004000| GetVars||| GvSVn|5.009003||p GvSV||| Gv_AMupdate||5.011000| HEf_SVKEY||5.004000| HeHASH||5.004000| HeKEY||5.004000| HeKLEN||5.004000| HePV||5.004000| HeSVKEY_force||5.004000| HeSVKEY_set||5.004000| HeSVKEY||5.004000| HeUTF8||5.010001| HeVAL||5.004000| HvNAMELEN_get|5.009003||p HvNAME_get|5.009003||p HvNAME||| INT2PTR|5.006000||p IN_LOCALE_COMPILETIME|5.007002||p IN_LOCALE_RUNTIME|5.007002||p IN_LOCALE|5.007002||p IN_PERL_COMPILETIME|5.008001||p IS_NUMBER_GREATER_THAN_UV_MAX|5.007002||p IS_NUMBER_INFINITY|5.007002||p IS_NUMBER_IN_UV|5.007002||p IS_NUMBER_NAN|5.007003||p IS_NUMBER_NEG|5.007002||p IS_NUMBER_NOT_INT|5.007002||p IVSIZE|5.006000||p IVTYPE|5.006000||p IVdf|5.006000||p LEAVE||| LVRET||| MARK||| MULTICALL||5.011005| MY_CXT_CLONE|5.009002||p MY_CXT_INIT|5.007003||p MY_CXT|5.007003||p MoveD|5.009002||p Move||| NOOP|5.005000||p NUM2PTR|5.006000||p NVTYPE|5.006000||p NVef|5.006001||p NVff|5.006001||p NVgf|5.006001||p Newxc|5.009003||p Newxz|5.009003||p Newx|5.009003||p Nullav||| Nullch||| Nullcv||| Nullhv||| Nullsv||| ORIGMARK||| PAD_BASE_SV||| PAD_CLONE_VARS||| PAD_COMPNAME_FLAGS||| PAD_COMPNAME_GEN_set||| PAD_COMPNAME_GEN||| PAD_COMPNAME_OURSTASH||| PAD_COMPNAME_PV||| PAD_COMPNAME_TYPE||| PAD_DUP||| PAD_RESTORE_LOCAL||| PAD_SAVE_LOCAL||| PAD_SAVE_SETNULLPAD||| PAD_SETSV||| PAD_SET_CUR_NOSAVE||| PAD_SET_CUR||| PAD_SVl||| PAD_SV||| PERLIO_FUNCS_CAST|5.009003||p PERLIO_FUNCS_DECL|5.009003||p PERL_ABS|5.008001||p PERL_BCDVERSION|5.011004||p PERL_GCC_BRACE_GROUPS_FORBIDDEN|5.008001||p PERL_HASH|5.004000||p PERL_INT_MAX|5.004000||p PERL_INT_MIN|5.004000||p PERL_LONG_MAX|5.004000||p PERL_LONG_MIN|5.004000||p PERL_MAGIC_arylen|5.007002||p PERL_MAGIC_backref|5.007002||p PERL_MAGIC_bm|5.007002||p PERL_MAGIC_collxfrm|5.007002||p PERL_MAGIC_dbfile|5.007002||p PERL_MAGIC_dbline|5.007002||p PERL_MAGIC_defelem|5.007002||p PERL_MAGIC_envelem|5.007002||p PERL_MAGIC_env|5.007002||p PERL_MAGIC_ext|5.007002||p PERL_MAGIC_fm|5.007002||p PERL_MAGIC_glob|5.011004||p PERL_MAGIC_isaelem|5.007002||p PERL_MAGIC_isa|5.007002||p PERL_MAGIC_mutex|5.011004||p PERL_MAGIC_nkeys|5.007002||p PERL_MAGIC_overload_elem|5.007002||p PERL_MAGIC_overload_table|5.007002||p PERL_MAGIC_overload|5.007002||p PERL_MAGIC_pos|5.007002||p PERL_MAGIC_qr|5.007002||p PERL_MAGIC_regdata|5.007002||p PERL_MAGIC_regdatum|5.007002||p PERL_MAGIC_regex_global|5.007002||p PERL_MAGIC_shared_scalar|5.007003||p PERL_MAGIC_shared|5.007003||p PERL_MAGIC_sigelem|5.007002||p PERL_MAGIC_sig|5.007002||p PERL_MAGIC_substr|5.007002||p PERL_MAGIC_sv|5.007002||p PERL_MAGIC_taint|5.007002||p PERL_MAGIC_tiedelem|5.007002||p PERL_MAGIC_tiedscalar|5.007002||p PERL_MAGIC_tied|5.007002||p PERL_MAGIC_utf8|5.008001||p PERL_MAGIC_uvar_elem|5.007003||p PERL_MAGIC_uvar|5.007002||p PERL_MAGIC_vec|5.007002||p PERL_MAGIC_vstring|5.008001||p PERL_PV_ESCAPE_ALL|5.009004||p PERL_PV_ESCAPE_FIRSTCHAR|5.009004||p PERL_PV_ESCAPE_NOBACKSLASH|5.009004||p PERL_PV_ESCAPE_NOCLEAR|5.009004||p PERL_PV_ESCAPE_QUOTE|5.009004||p PERL_PV_ESCAPE_RE|5.009005||p PERL_PV_ESCAPE_UNI_DETECT|5.009004||p PERL_PV_ESCAPE_UNI|5.009004||p PERL_PV_PRETTY_DUMP|5.009004||p PERL_PV_PRETTY_ELLIPSES|5.010000||p PERL_PV_PRETTY_LTGT|5.009004||p PERL_PV_PRETTY_NOCLEAR|5.010000||p PERL_PV_PRETTY_QUOTE|5.009004||p PERL_PV_PRETTY_REGPROP|5.009004||p PERL_QUAD_MAX|5.004000||p PERL_QUAD_MIN|5.004000||p PERL_REVISION|5.006000||p PERL_SCAN_ALLOW_UNDERSCORES|5.007003||p PERL_SCAN_DISALLOW_PREFIX|5.007003||p PERL_SCAN_GREATER_THAN_UV_MAX|5.007003||p PERL_SCAN_SILENT_ILLDIGIT|5.008001||p PERL_SHORT_MAX|5.004000||p PERL_SHORT_MIN|5.004000||p PERL_SIGNALS_UNSAFE_FLAG|5.008001||p PERL_SUBVERSION|5.006000||p PERL_SYS_INIT3||5.006000| PERL_SYS_INIT||| PERL_SYS_TERM||5.011005| PERL_UCHAR_MAX|5.004000||p PERL_UCHAR_MIN|5.004000||p PERL_UINT_MAX|5.004000||p PERL_UINT_MIN|5.004000||p PERL_ULONG_MAX|5.004000||p PERL_ULONG_MIN|5.004000||p PERL_UNUSED_ARG|5.009003||p PERL_UNUSED_CONTEXT|5.009004||p PERL_UNUSED_DECL|5.007002||p PERL_UNUSED_VAR|5.007002||p PERL_UQUAD_MAX|5.004000||p PERL_UQUAD_MIN|5.004000||p PERL_USE_GCC_BRACE_GROUPS|5.009004||p PERL_USHORT_MAX|5.004000||p PERL_USHORT_MIN|5.004000||p PERL_VERSION|5.006000||p PL_DBsignal|5.005000||p PL_DBsingle|||pn PL_DBsub|||pn PL_DBtrace|||pn PL_Sv|5.005000||p PL_bufend|5.011004||p PL_bufptr|5.011004||p PL_compiling|5.004050||p PL_copline|5.011004||p PL_curcop|5.004050||p PL_curstash|5.004050||p PL_debstash|5.004050||p PL_defgv|5.004050||p PL_diehook|5.004050||p PL_dirty|5.004050||p PL_dowarn|||pn PL_errgv|5.004050||p PL_error_count|5.011004||p PL_expect|5.011004||p PL_hexdigit|5.005000||p PL_hints|5.005000||p PL_in_my_stash|5.011004||p PL_in_my|5.011004||p PL_keyword_plugin||5.011002| PL_last_in_gv|||n PL_laststatval|5.005000||p PL_lex_state|5.011004||p PL_lex_stuff|5.011004||p PL_linestr|5.011004||p PL_modglobal||5.005000|n PL_na|5.004050||pn PL_no_modify|5.006000||p PL_ofsgv|||n PL_opfreehook||5.011000|n PL_parser|5.009005|5.009005|p PL_perl_destruct_level|5.004050||p PL_perldb|5.004050||p PL_ppaddr|5.006000||p PL_rsfp_filters|5.004050||p PL_rsfp|5.004050||p PL_rs|||n PL_signals|5.008001||p PL_stack_base|5.004050||p PL_stack_sp|5.004050||p PL_statcache|5.005000||p PL_stdingv|5.004050||p PL_sv_arenaroot|5.004050||p PL_sv_no|5.004050||pn PL_sv_undef|5.004050||pn PL_sv_yes|5.004050||pn PL_tainted|5.004050||p PL_tainting|5.004050||p PL_tokenbuf|5.011004||p POP_MULTICALL||5.011005| POPi|||n POPl|||n POPn|||n POPpbytex||5.007001|n POPpx||5.005030|n POPp|||n POPs|||n PTR2IV|5.006000||p PTR2NV|5.006000||p PTR2UV|5.006000||p PTR2nat|5.009003||p PTR2ul|5.007001||p PTRV|5.006000||p PUSHMARK||| PUSH_MULTICALL||5.011005| PUSHi||| PUSHmortal|5.009002||p PUSHn||| PUSHp||| PUSHs||| PUSHu|5.004000||p PUTBACK||| PerlIO_clearerr||5.007003| PerlIO_close||5.007003| PerlIO_context_layers||5.009004| PerlIO_eof||5.007003| PerlIO_error||5.007003| PerlIO_fileno||5.007003| PerlIO_fill||5.007003| PerlIO_flush||5.007003| PerlIO_get_base||5.007003| PerlIO_get_bufsiz||5.007003| PerlIO_get_cnt||5.007003| PerlIO_get_ptr||5.007003| PerlIO_read||5.007003| PerlIO_seek||5.007003| PerlIO_set_cnt||5.007003| PerlIO_set_ptrcnt||5.007003| PerlIO_setlinebuf||5.007003| PerlIO_stderr||5.007003| PerlIO_stdin||5.007003| PerlIO_stdout||5.007003| PerlIO_tell||5.007003| PerlIO_unread||5.007003| PerlIO_write||5.007003| Perl_signbit||5.009005|n PoisonFree|5.009004||p PoisonNew|5.009004||p PoisonWith|5.009004||p Poison|5.008000||p RETVAL|||n Renewc||| Renew||| SAVECLEARSV||| SAVECOMPPAD||| SAVEPADSV||| SAVETMPS||| SAVE_DEFSV|5.004050||p SPAGAIN||| SP||| START_EXTERN_C|5.005000||p START_MY_CXT|5.007003||p STMT_END|||p STMT_START|||p STR_WITH_LEN|5.009003||p ST||| SV_CONST_RETURN|5.009003||p SV_COW_DROP_PV|5.008001||p SV_COW_SHARED_HASH_KEYS|5.009005||p SV_GMAGIC|5.007002||p SV_HAS_TRAILING_NUL|5.009004||p SV_IMMEDIATE_UNREF|5.007001||p SV_MUTABLE_RETURN|5.009003||p SV_NOSTEAL|5.009002||p SV_SMAGIC|5.009003||p SV_UTF8_NO_ENCODING|5.008001||p SVfARG|5.009005||p SVf_UTF8|5.006000||p SVf|5.006000||p SVt_IV||| SVt_NV||| SVt_PVAV||| SVt_PVCV||| SVt_PVHV||| SVt_PVMG||| SVt_PV||| Safefree||| Slab_Alloc||| Slab_Free||| Slab_to_rw||| StructCopy||| SvCUR_set||| SvCUR||| SvEND||| SvGAMAGIC||5.006001| SvGETMAGIC|5.004050||p SvGROW||| SvIOK_UV||5.006000| SvIOK_notUV||5.006000| SvIOK_off||| SvIOK_only_UV||5.006000| SvIOK_only||| SvIOK_on||| SvIOKp||| SvIOK||| SvIVX||| SvIV_nomg|5.009001||p SvIV_set||| SvIVx||| SvIV||| SvIsCOW_shared_hash||5.008003| SvIsCOW||5.008003| SvLEN_set||| SvLEN||| SvLOCK||5.007003| SvMAGIC_set|5.009003||p SvNIOK_off||| SvNIOKp||| SvNIOK||| SvNOK_off||| SvNOK_only||| SvNOK_on||| SvNOKp||| SvNOK||| SvNVX||| SvNV_set||| SvNVx||| SvNV||| SvOK||| SvOOK_offset||5.011000| SvOOK||| SvPOK_off||| SvPOK_only_UTF8||5.006000| SvPOK_only||| SvPOK_on||| SvPOKp||| SvPOK||| SvPVX_const|5.009003||p SvPVX_mutable|5.009003||p SvPVX||| SvPV_const|5.009003||p SvPV_flags_const_nolen|5.009003||p SvPV_flags_const|5.009003||p SvPV_flags_mutable|5.009003||p SvPV_flags|5.007002||p SvPV_force_flags_mutable|5.009003||p SvPV_force_flags_nolen|5.009003||p SvPV_force_flags|5.007002||p SvPV_force_mutable|5.009003||p SvPV_force_nolen|5.009003||p SvPV_force_nomg_nolen|5.009003||p SvPV_force_nomg|5.007002||p SvPV_force|||p SvPV_mutable|5.009003||p SvPV_nolen_const|5.009003||p SvPV_nolen|5.006000||p SvPV_nomg_const_nolen|5.009003||p SvPV_nomg_const|5.009003||p SvPV_nomg|5.007002||p SvPV_renew|5.009003||p SvPV_set||| SvPVbyte_force||5.009002| SvPVbyte_nolen||5.006000| SvPVbytex_force||5.006000| SvPVbytex||5.006000| SvPVbyte|5.006000||p SvPVutf8_force||5.006000| SvPVutf8_nolen||5.006000| SvPVutf8x_force||5.006000| SvPVutf8x||5.006000| SvPVutf8||5.006000| SvPVx||| SvPV||| SvREFCNT_dec||| SvREFCNT_inc_NN|5.009004||p SvREFCNT_inc_simple_NN|5.009004||p SvREFCNT_inc_simple_void_NN|5.009004||p SvREFCNT_inc_simple_void|5.009004||p SvREFCNT_inc_simple|5.009004||p SvREFCNT_inc_void_NN|5.009004||p SvREFCNT_inc_void|5.009004||p SvREFCNT_inc|||p SvREFCNT||| SvROK_off||| SvROK_on||| SvROK||| SvRV_set|5.009003||p SvRV||| SvRXOK||5.009005| SvRX||5.009005| SvSETMAGIC||| SvSHARED_HASH|5.009003||p SvSHARE||5.007003| SvSTASH_set|5.009003||p SvSTASH||| SvSetMagicSV_nosteal||5.004000| SvSetMagicSV||5.004000| SvSetSV_nosteal||5.004000| SvSetSV||| SvTAINTED_off||5.004000| SvTAINTED_on||5.004000| SvTAINTED||5.004000| SvTAINT||| SvTRUE||| SvTYPE||| SvUNLOCK||5.007003| SvUOK|5.007001|5.006000|p SvUPGRADE||| SvUTF8_off||5.006000| SvUTF8_on||5.006000| SvUTF8||5.006000| SvUVXx|5.004000||p SvUVX|5.004000||p SvUV_nomg|5.009001||p SvUV_set|5.009003||p SvUVx|5.004000||p SvUV|5.004000||p SvVOK||5.008001| SvVSTRING_mg|5.009004||p THIS|||n UNDERBAR|5.009002||p UTF8_MAXBYTES|5.009002||p UVSIZE|5.006000||p UVTYPE|5.006000||p UVXf|5.007001||p UVof|5.006000||p UVuf|5.006000||p UVxf|5.006000||p WARN_ALL|5.006000||p WARN_AMBIGUOUS|5.006000||p WARN_ASSERTIONS|5.011004||p WARN_BAREWORD|5.006000||p WARN_CLOSED|5.006000||p WARN_CLOSURE|5.006000||p WARN_DEBUGGING|5.006000||p WARN_DEPRECATED|5.006000||p WARN_DIGIT|5.006000||p WARN_EXEC|5.006000||p WARN_EXITING|5.006000||p WARN_GLOB|5.006000||p WARN_INPLACE|5.006000||p WARN_INTERNAL|5.006000||p WARN_IO|5.006000||p WARN_LAYER|5.008000||p WARN_MALLOC|5.006000||p WARN_MISC|5.006000||p WARN_NEWLINE|5.006000||p WARN_NUMERIC|5.006000||p WARN_ONCE|5.006000||p WARN_OVERFLOW|5.006000||p WARN_PACK|5.006000||p WARN_PARENTHESIS|5.006000||p WARN_PIPE|5.006000||p WARN_PORTABLE|5.006000||p WARN_PRECEDENCE|5.006000||p WARN_PRINTF|5.006000||p WARN_PROTOTYPE|5.006000||p WARN_QW|5.006000||p WARN_RECURSION|5.006000||p WARN_REDEFINE|5.006000||p WARN_REGEXP|5.006000||p WARN_RESERVED|5.006000||p WARN_SEMICOLON|5.006000||p WARN_SEVERE|5.006000||p WARN_SIGNAL|5.006000||p WARN_SUBSTR|5.006000||p WARN_SYNTAX|5.006000||p WARN_TAINT|5.006000||p WARN_THREADS|5.008000||p WARN_UNINITIALIZED|5.006000||p WARN_UNOPENED|5.006000||p WARN_UNPACK|5.006000||p WARN_UNTIE|5.006000||p WARN_UTF8|5.006000||p WARN_VOID|5.006000||p XCPT_CATCH|5.009002||p XCPT_RETHROW|5.009002||p XCPT_TRY_END|5.009002||p XCPT_TRY_START|5.009002||p XPUSHi||| XPUSHmortal|5.009002||p XPUSHn||| XPUSHp||| XPUSHs||| XPUSHu|5.004000||p XSPROTO|5.010000||p XSRETURN_EMPTY||| XSRETURN_IV||| XSRETURN_NO||| XSRETURN_NV||| XSRETURN_PV||| XSRETURN_UNDEF||| XSRETURN_UV|5.008001||p XSRETURN_YES||| XSRETURN|||p XST_mIV||| XST_mNO||| XST_mNV||| XST_mPV||| XST_mUNDEF||| XST_mUV|5.008001||p XST_mYES||| XS_VERSION_BOOTCHECK||| XS_VERSION||| XSprePUSH|5.006000||p XS||| ZeroD|5.009002||p Zero||| _aMY_CXT|5.007003||p _pMY_CXT|5.007003||p aMY_CXT_|5.007003||p aMY_CXT|5.007003||p aTHXR_|5.011004||p aTHXR|5.011004||p aTHX_|5.006000||p aTHX|5.006000||p add_data|||n add_utf16_textfilter||| addmad||| allocmy||| amagic_call||| amagic_cmp_locale||| amagic_cmp||| amagic_i_ncmp||| amagic_ncmp||| anonymise_cv||| any_dup||| ao||| append_elem||| append_list||| append_madprops||| apply_attrs_my||| apply_attrs_string||5.006001| apply_attrs||| apply||| atfork_lock||5.007003|n atfork_unlock||5.007003|n av_arylen_p||5.009003| av_clear||| av_create_and_push||5.009005| av_create_and_unshift_one||5.009005| av_delete||5.006000| av_exists||5.006000| av_extend||| av_fetch||| av_fill||| av_iter_p||5.011000| av_len||| av_make||| av_pop||| av_push||| av_reify||| av_shift||| av_store||| av_undef||| av_unshift||| ax|||n bad_type||| bind_match||| block_end||| block_gimme||5.004000| block_start||| boolSV|5.004000||p boot_core_PerlIO||| boot_core_UNIVERSAL||| boot_core_mro||| bytes_from_utf8||5.007001| bytes_to_uni|||n bytes_to_utf8||5.006001| call_argv|5.006000||p call_atexit||5.006000| call_list||5.004000| call_method|5.006000||p call_pv|5.006000||p call_sv|5.006000||p calloc||5.007002|n cando||| cast_i32||5.006000| cast_iv||5.006000| cast_ulong||5.006000| cast_uv||5.006000| check_type_and_open||| check_uni||| checkcomma||| checkposixcc||| ckWARN|5.006000||p ck_anoncode||| ck_bitop||| ck_concat||| ck_defined||| ck_delete||| ck_die||| ck_each||| ck_eof||| ck_eval||| ck_exec||| ck_exists||| ck_exit||| ck_ftst||| ck_fun||| ck_glob||| ck_grep||| ck_index||| ck_join||| ck_lfun||| ck_listiob||| ck_match||| ck_method||| ck_null||| ck_open||| ck_readline||| ck_repeat||| ck_require||| ck_return||| ck_rfun||| ck_rvconst||| ck_sassign||| ck_select||| ck_shift||| ck_sort||| ck_spair||| ck_split||| ck_subr||| ck_substr||| ck_svconst||| ck_trunc||| ck_unpack||| ck_warner_d||5.011001|v ck_warner||5.011001|v ckwarn_common||| ckwarn_d||5.009003| ckwarn||5.009003| cl_and|||n cl_anything|||n cl_init_zero|||n cl_init|||n cl_is_anything|||n cl_or|||n clear_placeholders||| closest_cop||| convert||| cop_free||| cr_textfilter||| create_eval_scope||| croak_nocontext|||vn croak_xs_usage||5.010001| croak|||v csighandler||5.009003|n curmad||| custom_op_desc||5.007003| custom_op_name||5.007003| cv_ckproto_len||| cv_clone||| cv_const_sv||5.004000| cv_dump||| cv_undef||| cx_dump||5.005000| cx_dup||| cxinc||| dAXMARK|5.009003||p dAX|5.007002||p dITEMS|5.007002||p dMARK||| dMULTICALL||5.009003| dMY_CXT_SV|5.007003||p dMY_CXT|5.007003||p dNOOP|5.006000||p dORIGMARK||| dSP||| dTHR|5.004050||p dTHXR|5.011004||p dTHXa|5.006000||p dTHXoa|5.006000||p dTHX|5.006000||p dUNDERBAR|5.009002||p dVAR|5.009003||p dXCPT|5.009002||p dXSARGS||| dXSI32||| dXSTARG|5.006000||p deb_curcv||| deb_nocontext|||vn deb_stack_all||| deb_stack_n||| debop||5.005000| debprofdump||5.005000| debprof||| debstackptrs||5.007003| debstack||5.007003| debug_start_match||| deb||5.007003|v del_sv||| delete_eval_scope||| delimcpy||5.004000|n deprecate_commaless_var_list||| despatch_signals||5.007001| destroy_matcher||| die_nocontext|||vn die_where||| die|||v dirp_dup||| div128||| djSP||| do_aexec5||| do_aexec||| do_aspawn||| do_binmode||5.004050| do_chomp||| do_chop||| do_close||| do_delete_local||| do_dump_pad||| do_eof||| do_exec3||| do_execfree||| do_exec||| do_gv_dump||5.006000| do_gvgv_dump||5.006000| do_hv_dump||5.006000| do_ipcctl||| do_ipcget||| do_join||| do_kv||| do_magic_dump||5.006000| do_msgrcv||| do_msgsnd||| do_oddball||| do_op_dump||5.006000| do_op_xmldump||| do_open9||5.006000| do_openn||5.007001| do_open||5.004000| do_pmop_dump||5.006000| do_pmop_xmldump||| do_print||| do_readline||| do_seek||| do_semop||| do_shmio||| do_smartmatch||| do_spawn_nowait||| do_spawn||| do_sprintf||| do_sv_dump||5.006000| do_sysseek||| do_tell||| do_trans_complex_utf8||| do_trans_complex||| do_trans_count_utf8||| do_trans_count||| do_trans_simple_utf8||| do_trans_simple||| do_trans||| do_vecget||| do_vecset||| do_vop||| docatch||| doeval||| dofile||| dofindlabel||| doform||| doing_taint||5.008001|n dooneliner||| doopen_pm||| doparseform||| dopoptoeval||| dopoptogiven||| dopoptolabel||| dopoptoloop||| dopoptosub_at||| dopoptowhen||| doref||5.009003| dounwind||| dowantarray||| dump_all_perl||| dump_all||5.006000| dump_eval||5.006000| dump_exec_pos||| dump_fds||| dump_form||5.006000| dump_indent||5.006000|v dump_mstats||| dump_packsubs_perl||| dump_packsubs||5.006000| dump_sub_perl||| dump_sub||5.006000| dump_sv_child||| dump_trie_interim_list||| dump_trie_interim_table||| dump_trie||| dump_vindent||5.006000| dumpuntil||| dup_attrlist||| emulate_cop_io||| eval_pv|5.006000||p eval_sv|5.006000||p exec_failed||| expect_number||| fbm_compile||5.005000| fbm_instr||5.005000| feature_is_enabled||| fetch_cop_label||5.011000| filter_add||| filter_del||| filter_gets||| filter_read||| find_and_forget_pmops||| find_array_subscript||| find_beginning||| find_byclass||| find_hash_subscript||| find_in_my_stash||| find_runcv||5.008001| find_rundefsvoffset||5.009002| find_script||| find_uninit_var||| first_symbol|||n fold_constants||| forbid_setid||| force_ident||| force_list||| force_next||| force_strict_version||| force_version||| force_word||| forget_pmop||| form_nocontext|||vn form||5.004000|v fp_dup||| fprintf_nocontext|||vn free_global_struct||| free_tied_hv_pool||| free_tmps||| gen_constant_list||| get_arena||| get_aux_mg||| get_av|5.006000||p get_context||5.006000|n get_cvn_flags|5.009005||p get_cvs|5.011000||p get_cv|5.006000||p get_db_sub||| get_debug_opts||| get_hash_seed||| get_hv|5.006000||p get_isa_hash||| get_mstats||| get_no_modify||| get_num||| get_op_descs||5.005000| get_op_names||5.005000| get_opargs||| get_ppaddr||5.006000| get_re_arg||| get_sv|5.006000||p get_vtbl||5.005030| getcwd_sv||5.007002| getenv_len||| glob_2number||| glob_assign_glob||| glob_assign_ref||| gp_dup||| gp_free||| gp_ref||| grok_bin|5.007003||p grok_hex|5.007003||p grok_number|5.007002||p grok_numeric_radix|5.007002||p grok_oct|5.007003||p group_end||| gv_AVadd||| gv_HVadd||| gv_IOadd||| gv_SVadd||| gv_add_by_type||5.011000| gv_autoload4||5.004000| gv_check||| gv_const_sv||5.009003| gv_dump||5.006000| gv_efullname3||5.004000| gv_efullname4||5.006001| gv_efullname||| gv_ename||| gv_fetchfile_flags||5.009005| gv_fetchfile||| gv_fetchmeth_autoload||5.007003| gv_fetchmethod_autoload||5.004000| gv_fetchmethod_flags||5.011000| gv_fetchmethod||| gv_fetchmeth||| gv_fetchpvn_flags|5.009002||p gv_fetchpvs|5.009004||p gv_fetchpv||| gv_fetchsv|5.009002||p gv_fullname3||5.004000| gv_fullname4||5.006001| gv_fullname||| gv_get_super_pkg||| gv_handler||5.007001| gv_init_sv||| gv_init||| gv_name_set||5.009004| gv_stashpvn|5.004000||p gv_stashpvs|5.009003||p gv_stashpv||| gv_stashsv||| gv_try_downgrade||5.011002| he_dup||| hek_dup||| hfreeentries||| hsplit||| hv_assert||| hv_auxinit|||n hv_backreferences_p||| hv_clear_placeholders||5.009001| hv_clear||| hv_common_key_len||5.010000| hv_common||5.010000| hv_copy_hints_hv||| hv_delayfree_ent||5.004000| hv_delete_common||| hv_delete_ent||5.004000| hv_delete||| hv_eiter_p||5.009003| hv_eiter_set||5.009003| hv_exists_ent||5.004000| hv_exists||| hv_fetch_ent||5.004000| hv_fetchs|5.009003||p hv_fetch||| hv_free_ent||5.004000| hv_iterinit||| hv_iterkeysv||5.004000| hv_iterkey||| hv_iternext_flags||5.008000| hv_iternextsv||| hv_iternext||| hv_iterval||| hv_kill_backrefs||| hv_ksplit||5.004000| hv_magic_check|||n hv_magic||| hv_name_set||5.009003| hv_notallowed||| hv_placeholders_get||5.009003| hv_placeholders_p||5.009003| hv_placeholders_set||5.009003| hv_riter_p||5.009003| hv_riter_set||5.009003| hv_scalar||5.009001| hv_store_ent||5.004000| hv_store_flags||5.008000| hv_stores|5.009004||p hv_store||| hv_undef||| ibcmp_locale||5.004000|n ibcmp_utf8||5.007003| ibcmp|||n incline||| incpush_if_exists||| incpush_use_sep||| incpush||| ingroup||| init_argv_symbols||| init_debugger||| init_global_struct||| init_i18nl10n||5.006000| init_i18nl14n||5.006000| init_ids||| init_interp||| init_main_stash||| init_perllib||| init_postdump_symbols||| init_predump_symbols||| init_stacks||5.005000| init_tm||5.007002| instr|||n intro_my||| intuit_method||| intuit_more||| invert||| io_close||| isALNUMC|5.006000||p isALNUM||| isALPHA||| isASCII|5.006000||p isBLANK|5.006001||p isCNTRL|5.006000||p isDIGIT||| isGRAPH|5.006000||p isGV_with_GP|5.009004||p isLOWER||| isPRINT|5.004000||p isPSXSPC|5.006001||p isPUNCT|5.006000||p isSPACE||| isUPPER||| isXDIGIT|5.006000||p is_an_int||| is_ascii_string||5.011000|n is_gv_magical_sv||| is_handle_constructor|||n is_inplace_av||| is_list_assignment||| is_lvalue_sub||5.007001| is_uni_alnum_lc||5.006000| is_uni_alnum||5.006000| is_uni_alpha_lc||5.006000| is_uni_alpha||5.006000| is_uni_ascii_lc||5.006000| is_uni_ascii||5.006000| is_uni_cntrl_lc||5.006000| is_uni_cntrl||5.006000| is_uni_digit_lc||5.006000| is_uni_digit||5.006000| is_uni_graph_lc||5.006000| is_uni_graph||5.006000| is_uni_idfirst_lc||5.006000| is_uni_idfirst||5.006000| is_uni_lower_lc||5.006000| is_uni_lower||5.006000| is_uni_print_lc||5.006000| is_uni_print||5.006000| is_uni_punct_lc||5.006000| is_uni_punct||5.006000| is_uni_space_lc||5.006000| is_uni_space||5.006000| is_uni_upper_lc||5.006000| is_uni_upper||5.006000| is_uni_xdigit_lc||5.006000| is_uni_xdigit||5.006000| is_utf8_X_LVT||| is_utf8_X_LV_LVT_V||| is_utf8_X_LV||| is_utf8_X_L||| is_utf8_X_T||| is_utf8_X_V||| is_utf8_X_begin||| is_utf8_X_extend||| is_utf8_X_non_hangul||| is_utf8_X_prepend||| is_utf8_alnum||5.006000| is_utf8_alpha||5.006000| is_utf8_ascii||5.006000| is_utf8_char_slow|||n is_utf8_char||5.006000|n is_utf8_cntrl||5.006000| is_utf8_common||| is_utf8_digit||5.006000| is_utf8_graph||5.006000| is_utf8_idcont||5.008000| is_utf8_idfirst||5.006000| is_utf8_lower||5.006000| is_utf8_mark||5.006000| is_utf8_perl_space||5.011001| is_utf8_perl_word||5.011001| is_utf8_posix_digit||5.011001| is_utf8_print||5.006000| is_utf8_punct||5.006000| is_utf8_space||5.006000| is_utf8_string_loclen||5.009003|n is_utf8_string_loc||5.008001|n is_utf8_string||5.006001|n is_utf8_upper||5.006000| is_utf8_xdigit||5.006000| isa_lookup||| items|||n ix|||n jmaybe||| join_exact||| keyword_plugin_standard||| keyword||| leave_scope||| lex_bufutf8||5.011002| lex_discard_to||5.011002| lex_end||| lex_grow_linestr||5.011002| lex_next_chunk||5.011002| lex_peek_unichar||5.011002| lex_read_space||5.011002| lex_read_to||5.011002| lex_read_unichar||5.011002| lex_start||| lex_stuff_pvn||5.011002| lex_stuff_sv||5.011002| lex_unstuff||5.011002| linklist||| listkids||| list||| load_module_nocontext|||vn load_module|5.006000||pv localize||| looks_like_bool||| looks_like_number||| lop||| mPUSHi|5.009002||p mPUSHn|5.009002||p mPUSHp|5.009002||p mPUSHs|5.010001||p mPUSHu|5.009002||p mXPUSHi|5.009002||p mXPUSHn|5.009002||p mXPUSHp|5.009002||p mXPUSHs|5.010001||p mXPUSHu|5.009002||p mad_free||| madlex||| madparse||| magic_clear_all_env||| magic_clearenv||| magic_clearhints||| magic_clearhint||| magic_clearisa||| magic_clearpack||| magic_clearsig||| magic_dump||5.006000| magic_existspack||| magic_freearylen_p||| magic_freeovrld||| magic_getarylen||| magic_getdefelem||| magic_getnkeys||| magic_getpack||| magic_getpos||| magic_getsig||| magic_getsubstr||| magic_gettaint||| magic_getuvar||| magic_getvec||| magic_get||| magic_killbackrefs||| magic_len||| magic_methcall||| magic_methpack||| magic_nextpack||| magic_regdata_cnt||| magic_regdatum_get||| magic_regdatum_set||| magic_scalarpack||| magic_set_all_env||| magic_setamagic||| magic_setarylen||| magic_setcollxfrm||| magic_setdbline||| magic_setdefelem||| magic_setenv||| magic_sethint||| magic_setisa||| magic_setmglob||| magic_setnkeys||| magic_setpack||| magic_setpos||| magic_setregexp||| magic_setsig||| magic_setsubstr||| magic_settaint||| magic_setutf8||| magic_setuvar||| magic_setvec||| magic_set||| magic_sizepack||| magic_wipepack||| make_matcher||| make_trie_failtable||| make_trie||| malloc_good_size|||n malloced_size|||n malloc||5.007002|n markstack_grow||| matcher_matches_sv||| measure_struct||| memEQs|5.009005||p memEQ|5.004000||p memNEs|5.009005||p memNE|5.004000||p mem_collxfrm||| mem_log_common|||n mess_alloc||| mess_nocontext|||vn mess||5.006000|v method_common||| mfree||5.007002|n mg_clear||| mg_copy||| mg_dup||| mg_find||| mg_free||| mg_get||| mg_length||5.005000| mg_localize||| mg_magical||| mg_set||| mg_size||5.005000| mini_mktime||5.007002| missingterm||| mode_from_discipline||| modkids||| mod||| more_bodies||| more_sv||| moreswitches||| mro_get_from_name||5.010001| mro_get_linear_isa_dfs||| mro_get_linear_isa||5.009005| mro_get_private_data||5.010001| mro_isa_changed_in||| mro_meta_dup||| mro_meta_init||| mro_method_changed_in||5.009005| mro_register||5.010001| mro_set_mro||5.010001| mro_set_private_data||5.010001| mul128||| mulexp10|||n my_atof2||5.007002| my_atof||5.006000| my_attrs||| my_bcopy|||n my_betoh16|||n my_betoh32|||n my_betoh64|||n my_betohi|||n my_betohl|||n my_betohs|||n my_bzero|||n my_chsize||| my_clearenv||| my_cxt_index||| my_cxt_init||| my_dirfd||5.009005| my_exit_jump||| my_exit||| my_failure_exit||5.004000| my_fflush_all||5.006000| my_fork||5.007003|n my_htobe16|||n my_htobe32|||n my_htobe64|||n my_htobei|||n my_htobel|||n my_htobes|||n my_htole16|||n my_htole32|||n my_htole64|||n my_htolei|||n my_htolel|||n my_htoles|||n my_htonl||| my_kid||| my_letoh16|||n my_letoh32|||n my_letoh64|||n my_letohi|||n my_letohl|||n my_letohs|||n my_lstat||| my_memcmp||5.004000|n my_memset|||n my_ntohl||| my_pclose||5.004000| my_popen_list||5.007001| my_popen||5.004000| my_setenv||| my_snprintf|5.009004||pvn my_socketpair||5.007003|n my_sprintf|5.009003||pvn my_stat||| my_strftime||5.007002| my_strlcat|5.009004||pn my_strlcpy|5.009004||pn my_swabn|||n my_swap||| my_unexec||| my_vsnprintf||5.009004|n need_utf8|||n newANONATTRSUB||5.006000| newANONHASH||| newANONLIST||| newANONSUB||| newASSIGNOP||| newATTRSUB||5.006000| newAVREF||| newAV||| newBINOP||| newCONDOP||| newCONSTSUB|5.004050||p newCVREF||| newDEFSVOP||| newFORM||| newFOROP||| newGIVENOP||5.009003| newGIVWHENOP||| newGP||| newGVOP||| newGVREF||| newGVgen||| newHVREF||| newHVhv||5.005000| newHV||| newIO||| newLISTOP||| newLOGOP||| newLOOPEX||| newLOOPOP||| newMADPROP||| newMADsv||| newMYSUB||| newNULLLIST||| newOP||| newPADOP||| newPMOP||| newPROG||| newPVOP||| newRANGE||| newRV_inc|5.004000||p newRV_noinc|5.004000||p newRV||| newSLICEOP||| newSTATEOP||| newSUB||| newSVOP||| newSVREF||| newSV_type|5.009005||p newSVhek||5.009003| newSViv||| newSVnv||| newSVpvf_nocontext|||vn newSVpvf||5.004000|v newSVpvn_flags|5.010001||p newSVpvn_share|5.007001||p newSVpvn_utf8|5.010001||p newSVpvn|5.004050||p newSVpvs_flags|5.010001||p newSVpvs_share|5.009003||p newSVpvs|5.009003||p newSVpv||| newSVrv||| newSVsv||| newSVuv|5.006000||p newSV||| newTOKEN||| newUNOP||| newWHENOP||5.009003| newWHILEOP||5.009003| newXS_flags||5.009004| newXSproto||5.006000| newXS||5.006000| new_collate||5.006000| new_constant||| new_ctype||5.006000| new_he||| new_logop||| new_numeric||5.006000| new_stackinfo||5.005000| new_version||5.009000| new_warnings_bitfield||| next_symbol||| nextargv||| nextchar||| ninstr|||n no_bareword_allowed||| no_fh_allowed||| no_op||| not_a_number||| nothreadhook||5.008000| nuke_stacks||| num_overflow|||n offer_nice_chunk||| oopsAV||| oopsHV||| op_clear||| op_const_sv||| op_dump||5.006000| op_free||| op_getmad_weak||| op_getmad||| op_null||5.007002| op_refcnt_dec||| op_refcnt_inc||| op_refcnt_lock||5.009002| op_refcnt_unlock||5.009002| op_xmldump||| open_script||| opt_scalarhv||| pMY_CXT_|5.007003||p pMY_CXT|5.007003||p pTHX_|5.006000||p pTHX|5.006000||p packWARN|5.007003||p pack_cat||5.007003| pack_rec||| package_version||| package||| packlist||5.008001| pad_add_anon||| pad_add_name_sv||| pad_add_name||| pad_alloc||| pad_block_start||| pad_check_dup||| pad_compname_type||| pad_findlex||| pad_findmy||5.011002| pad_fixup_inner_anons||| pad_free||| pad_leavemy||| pad_new||| pad_peg|||n pad_push||| pad_reset||| pad_setsv||| pad_sv||| pad_swipe||| pad_tidy||| pad_undef||| parse_body||| parse_unicode_opts||| parser_dup||| parser_free||| path_is_absolute|||n peep||| pending_Slabs_to_ro||| perl_alloc_using|||n perl_alloc|||n perl_clone_using|||n perl_clone|||n perl_construct|||n perl_destruct||5.007003|n perl_free|||n perl_parse||5.006000|n perl_run|||n pidgone||| pm_description||| pmflag||| pmop_dump||5.006000| pmop_xmldump||| pmruntime||| pmtrans||| pop_scope||| pregcomp||5.009005| pregexec||| pregfree2||5.011000| pregfree||| prepend_elem||| prepend_madprops||| prescan_version||5.011004| printbuf||| printf_nocontext|||vn process_special_blocks||| ptr_table_clear||5.009005| ptr_table_fetch||5.009005| ptr_table_find|||n ptr_table_free||5.009005| ptr_table_new||5.009005| ptr_table_split||5.009005| ptr_table_store||5.009005| push_scope||| put_byte||| pv_display|5.006000||p pv_escape|5.009004||p pv_pretty|5.009004||p pv_uni_display||5.007003| qerror||| qsortsvu||| re_compile||5.009005| re_croak2||| re_dup_guts||| re_intuit_start||5.009005| re_intuit_string||5.006000| readpipe_override||| realloc||5.007002|n reentrant_free||| reentrant_init||| reentrant_retry|||vn reentrant_size||| ref_array_or_hash||| refcounted_he_chain_2hv||| refcounted_he_fetch||| refcounted_he_free||| refcounted_he_new_common||| refcounted_he_new||| refcounted_he_value||| refkids||| refto||| ref||5.011005| reg_check_named_buff_matched||| reg_named_buff_all||5.009005| reg_named_buff_exists||5.009005| reg_named_buff_fetch||5.009005| reg_named_buff_firstkey||5.009005| reg_named_buff_iter||| reg_named_buff_nextkey||5.009005| reg_named_buff_scalar||5.009005| reg_named_buff||| reg_namedseq||| reg_node||| reg_numbered_buff_fetch||| reg_numbered_buff_length||| reg_numbered_buff_store||| reg_qr_package||| reg_recode||| reg_scan_name||| reg_skipcomment||| reg_temp_copy||| reganode||| regatom||| regbranch||| regclass_swash||5.009004| regclass||| regcppop||| regcppush||| regcurly|||n regdump_extflags||| regdump||5.005000| regdupe_internal||| regexec_flags||5.005000| regfree_internal||5.009005| reghop3|||n reghop4|||n reghopmaybe3|||n reginclass||| reginitcolors||5.006000| reginsert||| regmatch||| regnext||5.005000| regpiece||| regpposixcc||| regprop||| regrepeat||| regtail_study||| regtail||| regtry||| reguni||| regwhite|||n reg||| repeatcpy|||n report_evil_fh||| report_uninit||| require_pv||5.006000| require_tie_mod||| restore_magic||| rninstr|||n rsignal_restore||| rsignal_save||| rsignal_state||5.004000| rsignal||5.004000| run_body||| run_user_filter||| runops_debug||5.005000| runops_standard||5.005000| rvpv_dup||| rxres_free||| rxres_restore||| rxres_save||| safesyscalloc||5.006000|n safesysfree||5.006000|n safesysmalloc||5.006000|n safesysrealloc||5.006000|n same_dirent||| save_I16||5.004000| save_I32||| save_I8||5.006000| save_adelete||5.011000| save_aelem_flags||5.011000| save_aelem||5.004050| save_alloc||5.006000| save_aptr||| save_ary||| save_bool||5.008001| save_clearsv||| save_delete||| save_destructor_x||5.006000| save_destructor||5.006000| save_freeop||| save_freepv||| save_freesv||| save_generic_pvref||5.006001| save_generic_svref||5.005030| save_gp||5.004000| save_hash||| save_hdelete||5.011000| save_hek_flags|||n save_helem_flags||5.011000| save_helem||5.004050| save_hints||| save_hptr||| save_int||| save_item||| save_iv||5.005000| save_lines||| save_list||| save_long||| save_magic||| save_mortalizesv||5.007001| save_nogv||| save_op||| save_padsv_and_mortalize||5.010001| save_pptr||| save_pushi32ptr||| save_pushptri32ptr||| save_pushptrptr||| save_pushptr||5.010001| save_re_context||5.006000| save_scalar_at||| save_scalar||| save_set_svflags||5.009000| save_shared_pvref||5.007003| save_sptr||| save_svref||| save_vptr||5.006000| savepvn||| savepvs||5.009003| savepv||| savesharedpvn||5.009005| savesharedpv||5.007003| savestack_grow_cnt||5.008001| savestack_grow||| savesvpv||5.009002| sawparens||| scalar_mod_type|||n scalarboolean||| scalarkids||| scalarseq||| scalarvoid||| scalar||| scan_bin||5.006000| scan_commit||| scan_const||| scan_formline||| scan_heredoc||| scan_hex||| scan_ident||| scan_inputsymbol||| scan_num||5.007001| scan_oct||| scan_pat||| scan_str||| scan_subst||| scan_trans||| scan_version||5.009001| scan_vstring||5.009005| scan_word||| scope||| screaminstr||5.005000| search_const||| seed||5.008001| sequence_num||| sequence_tail||| sequence||| set_context||5.006000|n set_numeric_local||5.006000| set_numeric_radix||5.006000| set_numeric_standard||5.006000| setdefout||| share_hek_flags||| share_hek||5.004000| si_dup||| sighandler|||n simplify_sort||| skipspace0||| skipspace1||| skipspace2||| skipspace||| softref2xv||| sortcv_stacked||| sortcv_xsub||| sortcv||| sortsv_flags||5.009003| sortsv||5.007003| space_join_names_mortal||| ss_dup||| stack_grow||| start_force||| start_glob||| start_subparse||5.004000| stashpv_hvname_match||5.011005| stdize_locale||| store_cop_label||| strEQ||| strGE||| strGT||| strLE||| strLT||| strNE||| str_to_version||5.006000| strip_return||| strnEQ||| strnNE||| study_chunk||| sub_crush_depth||| sublex_done||| sublex_push||| sublex_start||| sv_2bool||| sv_2cv||| sv_2io||| sv_2iuv_common||| sv_2iuv_non_preserve||| sv_2iv_flags||5.009001| sv_2iv||| sv_2mortal||| sv_2num||| sv_2nv||| sv_2pv_flags|5.007002||p sv_2pv_nolen|5.006000||p sv_2pvbyte_nolen|5.006000||p sv_2pvbyte|5.006000||p sv_2pvutf8_nolen||5.006000| sv_2pvutf8||5.006000| sv_2pv||| sv_2uv_flags||5.009001| sv_2uv|5.004000||p sv_add_arena||| sv_add_backref||| sv_backoff||| sv_bless||| sv_cat_decode||5.008001| sv_catpv_mg|5.004050||p sv_catpvf_mg_nocontext|||pvn sv_catpvf_mg|5.006000|5.004000|pv sv_catpvf_nocontext|||vn sv_catpvf||5.004000|v sv_catpvn_flags||5.007002| sv_catpvn_mg|5.004050||p sv_catpvn_nomg|5.007002||p sv_catpvn||| sv_catpvs|5.009003||p sv_catpv||| sv_catsv_flags||5.007002| sv_catsv_mg|5.004050||p sv_catsv_nomg|5.007002||p sv_catsv||| sv_catxmlpvn||| sv_catxmlsv||| sv_chop||| sv_clean_all||| sv_clean_objs||| sv_clear||| sv_cmp_locale||5.004000| sv_cmp||| sv_collxfrm||| sv_compile_2op||5.008001| sv_copypv||5.007003| sv_dec||| sv_del_backref||| sv_derived_from||5.004000| sv_destroyable||5.010000| sv_does||5.009004| sv_dump||| sv_dup_inc_multiple||| sv_dup||| sv_eq||| sv_exp_grow||| sv_force_normal_flags||5.007001| sv_force_normal||5.006000| sv_free2||| sv_free_arenas||| sv_free||| sv_gets||5.004000| sv_grow||| sv_i_ncmp||| sv_inc||| sv_insert_flags||5.010001| sv_insert||| sv_isa||| sv_isobject||| sv_iv||5.005000| sv_kill_backrefs||| sv_len_utf8||5.006000| sv_len||| sv_magic_portable|5.011005|5.004000|p sv_magicext||5.007003| sv_magic||| sv_mortalcopy||| sv_ncmp||| sv_newmortal||| sv_newref||| sv_nolocking||5.007003| sv_nosharing||5.007003| sv_nounlocking||| sv_nv||5.005000| sv_peek||5.005000| sv_pos_b2u_midway||| sv_pos_b2u||5.006000| sv_pos_u2b_cached||| sv_pos_u2b_flags||5.011005| sv_pos_u2b_forwards|||n sv_pos_u2b_midway|||n sv_pos_u2b||5.006000| sv_pvbyten_force||5.006000| sv_pvbyten||5.006000| sv_pvbyte||5.006000| sv_pvn_force_flags|5.007002||p sv_pvn_force||| sv_pvn_nomg|5.007003|5.005000|p sv_pvn||5.005000| sv_pvutf8n_force||5.006000| sv_pvutf8n||5.006000| sv_pvutf8||5.006000| sv_pv||5.006000| sv_recode_to_utf8||5.007003| sv_reftype||| sv_release_COW||| sv_replace||| sv_report_used||| sv_reset||| sv_rvweaken||5.006000| sv_setiv_mg|5.004050||p sv_setiv||| sv_setnv_mg|5.006000||p sv_setnv||| sv_setpv_mg|5.004050||p sv_setpvf_mg_nocontext|||pvn sv_setpvf_mg|5.006000|5.004000|pv sv_setpvf_nocontext|||vn sv_setpvf||5.004000|v sv_setpviv_mg||5.008001| sv_setpviv||5.008001| sv_setpvn_mg|5.004050||p sv_setpvn||| sv_setpvs|5.009004||p sv_setpv||| sv_setref_iv||| sv_setref_nv||| sv_setref_pvn||| sv_setref_pv||| sv_setref_uv||5.007001| sv_setsv_cow||| sv_setsv_flags||5.007002| sv_setsv_mg|5.004050||p sv_setsv_nomg|5.007002||p sv_setsv||| sv_setuv_mg|5.004050||p sv_setuv|5.004000||p sv_tainted||5.004000| sv_taint||5.004000| sv_true||5.005000| sv_unglob||| sv_uni_display||5.007003| sv_unmagic||| sv_unref_flags||5.007001| sv_unref||| sv_untaint||5.004000| sv_upgrade||| sv_usepvn_flags||5.009004| sv_usepvn_mg|5.004050||p sv_usepvn||| sv_utf8_decode||5.006000| sv_utf8_downgrade||5.006000| sv_utf8_encode||5.006000| sv_utf8_upgrade_flags_grow||5.011000| sv_utf8_upgrade_flags||5.007002| sv_utf8_upgrade_nomg||5.007002| sv_utf8_upgrade||5.007001| sv_uv|5.005000||p sv_vcatpvf_mg|5.006000|5.004000|p sv_vcatpvfn||5.004000| sv_vcatpvf|5.006000|5.004000|p sv_vsetpvf_mg|5.006000|5.004000|p sv_vsetpvfn||5.004000| sv_vsetpvf|5.006000|5.004000|p sv_xmlpeek||| svtype||| swallow_bom||| swash_fetch||5.007002| swash_get||| swash_init||5.006000| sys_init3||5.010000|n sys_init||5.010000|n sys_intern_clear||| sys_intern_dup||| sys_intern_init||| sys_term||5.010000|n taint_env||| taint_proper||| tmps_grow||5.006000| toLOWER||| toUPPER||| to_byte_substr||| to_uni_fold||5.007003| to_uni_lower_lc||5.006000| to_uni_lower||5.007003| to_uni_title_lc||5.006000| to_uni_title||5.007003| to_uni_upper_lc||5.006000| to_uni_upper||5.007003| to_utf8_case||5.007003| to_utf8_fold||5.007003| to_utf8_lower||5.007003| to_utf8_substr||| to_utf8_title||5.007003| to_utf8_upper||5.007003| token_free||| token_getmad||| tokenize_use||| tokeq||| tokereport||| too_few_arguments||| too_many_arguments||| uiv_2buf|||n unlnk||| unpack_rec||| unpack_str||5.007003| unpackstring||5.008001| unshare_hek_or_pvn||| unshare_hek||| unsharepvn||5.004000| unwind_handler_stack||| update_debugger_info||| upg_version||5.009005| usage||| utf16_textfilter||| utf16_to_utf8_reversed||5.006001| utf16_to_utf8||5.006001| utf8_distance||5.006000| utf8_hop||5.006000| utf8_length||5.007001| utf8_mg_pos_cache_update||| utf8_to_bytes||5.006001| utf8_to_uvchr||5.007001| utf8_to_uvuni||5.007001| utf8n_to_uvchr||| utf8n_to_uvuni||5.007001| utilize||| uvchr_to_utf8_flags||5.007003| uvchr_to_utf8||| uvuni_to_utf8_flags||5.007003| uvuni_to_utf8||5.007001| validate_suid||| varname||| vcmp||5.009000| vcroak||5.006000| vdeb||5.007003| vdie_common||| vdie_croak_common||| vdie||| vform||5.006000| visit||| vivify_defelem||| vivify_ref||| vload_module|5.006000||p vmess||5.006000| vnewSVpvf|5.006000|5.004000|p vnormal||5.009002| vnumify||5.009000| vstringify||5.009000| vverify||5.009003| vwarner||5.006000| vwarn||5.006000| wait4pid||| warn_nocontext|||vn warner_nocontext|||vn warner|5.006000|5.004000|pv warn|||v watch||| whichsig||| write_no_mem||| write_to_stderr||| xmldump_all_perl||| xmldump_all||| xmldump_attr||| xmldump_eval||| xmldump_form||| xmldump_indent|||v xmldump_packsubs_perl||| xmldump_packsubs||| xmldump_sub_perl||| xmldump_sub||| xmldump_vindent||| yyerror||| yylex||| yyparse||| yywarn||| ); if (exists $opt{'list-unsupported'}) { my $f; for $f (sort { lc $a cmp lc $b } keys %API) { next unless $API{$f}{todo}; print "$f ", '.'x(40-length($f)), " ", format_version($API{$f}{todo}), "\n"; } exit 0; } # Scan for possible replacement candidates my(%replace, %need, %hints, %warnings, %depends); my $replace = 0; my($hint, $define, $function); sub find_api { my $code = shift; $code =~ s{ / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]*) | "[^"\\]*(?:\\.[^"\\]*)*" | '[^'\\]*(?:\\.[^'\\]*)*' }{}egsx; grep { exists $API{$_} } $code =~ /(\w+)/mg; } while () { if ($hint) { my $h = $hint->[0] eq 'Hint' ? \%hints : \%warnings; if (m{^\s*\*\s(.*?)\s*$}) { for (@{$hint->[1]}) { $h->{$_} ||= ''; # suppress warning with older perls $h->{$_} .= "$1\n"; } } else { undef $hint } } $hint = [$1, [split /,?\s+/, $2]] if m{^\s*$rccs\s+(Hint|Warning):\s+(\w+(?:,?\s+\w+)*)\s*$}; if ($define) { if ($define->[1] =~ /\\$/) { $define->[1] .= $_; } else { if (exists $API{$define->[0]} && $define->[1] !~ /^DPPP_\(/) { my @n = find_api($define->[1]); push @{$depends{$define->[0]}}, @n if @n } undef $define; } } $define = [$1, $2] if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(.*)}; if ($function) { if (/^}/) { if (exists $API{$function->[0]}) { my @n = find_api($function->[1]); push @{$depends{$function->[0]}}, @n if @n } undef $function; } else { $function->[1] .= $_; } } $function = [$1, ''] if m{^DPPP_\(my_(\w+)\)}; $replace = $1 if m{^\s*$rccs\s+Replace:\s+(\d+)\s+$rcce\s*$}; $replace{$2} = $1 if $replace and m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+)}; $replace{$2} = $1 if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+).*$rccs\s+Replace\s+$rcce}; $replace{$1} = $2 if m{^\s*$rccs\s+Replace (\w+) with (\w+)\s+$rcce\s*$}; if (m{^\s*$rccs\s+(\w+(\s*,\s*\w+)*)\s+depends\s+on\s+(\w+(\s*,\s*\w+)*)\s+$rcce\s*$}) { my @deps = map { s/\s+//g; $_ } split /,/, $3; my $d; for $d (map { s/\s+//g; $_ } split /,/, $1) { push @{$depends{$d}}, @deps; } } $need{$1} = 1 if m{^#if\s+defined\(NEED_(\w+)(?:_GLOBAL)?\)}; } for (values %depends) { my %s; $_ = [sort grep !$s{$_}++, @$_]; } if (exists $opt{'api-info'}) { my $f; my $count = 0; my $match = $opt{'api-info'} =~ m!^/(.*)/$! ? $1 : "^\Q$opt{'api-info'}\E\$"; for $f (sort { lc $a cmp lc $b } keys %API) { next unless $f =~ /$match/; print "\n=== $f ===\n\n"; my $info = 0; if ($API{$f}{base} || $API{$f}{todo}) { my $base = format_version($API{$f}{base} || $API{$f}{todo}); print "Supported at least starting from perl-$base.\n"; $info++; } if ($API{$f}{provided}) { my $todo = $API{$f}{todo} ? format_version($API{$f}{todo}) : "5.003"; print "Support by $ppport provided back to perl-$todo.\n"; print "Support needs to be explicitly requested by NEED_$f.\n" if exists $need{$f}; print "Depends on: ", join(', ', @{$depends{$f}}), ".\n" if exists $depends{$f}; print "\n$hints{$f}" if exists $hints{$f}; print "\nWARNING:\n$warnings{$f}" if exists $warnings{$f}; $info++; } print "No portability information available.\n" unless $info; $count++; } $count or print "Found no API matching '$opt{'api-info'}'."; print "\n"; exit 0; } if (exists $opt{'list-provided'}) { my $f; for $f (sort { lc $a cmp lc $b } keys %API) { next unless $API{$f}{provided}; my @flags; push @flags, 'explicit' if exists $need{$f}; push @flags, 'depend' if exists $depends{$f}; push @flags, 'hint' if exists $hints{$f}; push @flags, 'warning' if exists $warnings{$f}; my $flags = @flags ? ' ['.join(', ', @flags).']' : ''; print "$f$flags\n"; } exit 0; } my @files; my @srcext = qw( .xs .c .h .cc .cpp -c.inc -xs.inc ); my $srcext = join '|', map { quotemeta $_ } @srcext; if (@ARGV) { my %seen; for (@ARGV) { if (-e) { if (-f) { push @files, $_ unless $seen{$_}++; } else { warn "'$_' is not a file.\n" } } else { my @new = grep { -f } glob $_ or warn "'$_' does not exist.\n"; push @files, grep { !$seen{$_}++ } @new; } } } else { eval { require File::Find; File::Find::find(sub { $File::Find::name =~ /($srcext)$/i and push @files, $File::Find::name; }, '.'); }; if ($@) { @files = map { glob "*$_" } @srcext; } } if (!@ARGV || $opt{filter}) { my(@in, @out); my %xsc = map { /(.*)\.xs$/ ? ("$1.c" => 1, "$1.cc" => 1) : () } @files; for (@files) { my $out = exists $xsc{$_} || /\b\Q$ppport\E$/i || !/($srcext)$/i; push @{ $out ? \@out : \@in }, $_; } if (@ARGV && @out) { warning("Skipping the following files (use --nofilter to avoid this):\n| ", join "\n| ", @out); } @files = @in; } die "No input files given!\n" unless @files; my(%files, %global, %revreplace); %revreplace = reverse %replace; my $filename; my $patch_opened = 0; for $filename (@files) { unless (open IN, "<$filename") { warn "Unable to read from $filename: $!\n"; next; } info("Scanning $filename ..."); my $c = do { local $/; }; close IN; my %file = (orig => $c, changes => 0); # Temporarily remove C/XS comments and strings from the code my @ccom; $c =~ s{ ( ^$HS*\#$HS*include\b[^\r\n]+\b(?:\Q$ppport\E|XSUB\.h)\b[^\r\n]* | ^$HS*\#$HS*(?:define|elif|if(?:def)?)\b[^\r\n]* ) | ( ^$HS*\#[^\r\n]* | "[^"\\]*(?:\\.[^"\\]*)*" | '[^'\\]*(?:\\.[^'\\]*)*' | / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]* ) ) }{ defined $2 and push @ccom, $2; defined $1 ? $1 : "$ccs$#ccom$cce" }mgsex; $file{ccom} = \@ccom; $file{code} = $c; $file{has_inc_ppport} = $c =~ /^$HS*#$HS*include[^\r\n]+\b\Q$ppport\E\b/m; my $func; for $func (keys %API) { my $match = $func; $match .= "|$revreplace{$func}" if exists $revreplace{$func}; if ($c =~ /\b(?:Perl_)?($match)\b/) { $file{uses_replace}{$1}++ if exists $revreplace{$func} && $1 eq $revreplace{$func}; $file{uses_Perl}{$func}++ if $c =~ /\bPerl_$func\b/; if (exists $API{$func}{provided}) { $file{uses_provided}{$func}++; if (!exists $API{$func}{base} || $API{$func}{base} > $opt{'compat-version'}) { $file{uses}{$func}++; my @deps = rec_depend($func); if (@deps) { $file{uses_deps}{$func} = \@deps; for (@deps) { $file{uses}{$_} = 0 unless exists $file{uses}{$_}; } } for ($func, @deps) { $file{needs}{$_} = 'static' if exists $need{$_}; } } } if (exists $API{$func}{todo} && $API{$func}{todo} > $opt{'compat-version'}) { if ($c =~ /\b$func\b/) { $file{uses_todo}{$func}++; } } } } while ($c =~ /^$HS*#$HS*define$HS+(NEED_(\w+?)(_GLOBAL)?)\b/mg) { if (exists $need{$2}) { $file{defined $3 ? 'needed_global' : 'needed_static'}{$2}++; } else { warning("Possibly wrong #define $1 in $filename") } } for (qw(uses needs uses_todo needed_global needed_static)) { for $func (keys %{$file{$_}}) { push @{$global{$_}{$func}}, $filename; } } $files{$filename} = \%file; } # Globally resolve NEED_'s my $need; for $need (keys %{$global{needs}}) { if (@{$global{needs}{$need}} > 1) { my @targets = @{$global{needs}{$need}}; my @t = grep $files{$_}{needed_global}{$need}, @targets; @targets = @t if @t; @t = grep /\.xs$/i, @targets; @targets = @t if @t; my $target = shift @targets; $files{$target}{needs}{$need} = 'global'; for (@{$global{needs}{$need}}) { $files{$_}{needs}{$need} = 'extern' if $_ ne $target; } } } for $filename (@files) { exists $files{$filename} or next; info("=== Analyzing $filename ==="); my %file = %{$files{$filename}}; my $func; my $c = $file{code}; my $warnings = 0; for $func (sort keys %{$file{uses_Perl}}) { if ($API{$func}{varargs}) { unless ($API{$func}{nothxarg}) { my $changes = ($c =~ s{\b(Perl_$func\s*\(\s*)(?!aTHX_?)(\)|[^\s)]*\))} { $1 . ($2 eq ')' ? 'aTHX' : 'aTHX_ ') . $2 }ge); if ($changes) { warning("Doesn't pass interpreter argument aTHX to Perl_$func"); $file{changes} += $changes; } } } else { warning("Uses Perl_$func instead of $func"); $file{changes} += ($c =~ s{\bPerl_$func(\s*)\((\s*aTHX_?)?\s*} {$func$1(}g); } } for $func (sort keys %{$file{uses_replace}}) { warning("Uses $func instead of $replace{$func}"); $file{changes} += ($c =~ s/\b$func\b/$replace{$func}/g); } for $func (sort keys %{$file{uses_provided}}) { if ($file{uses}{$func}) { if (exists $file{uses_deps}{$func}) { diag("Uses $func, which depends on ", join(', ', @{$file{uses_deps}{$func}})); } else { diag("Uses $func"); } } $warnings += hint($func); } unless ($opt{quiet}) { for $func (sort keys %{$file{uses_todo}}) { print "*** WARNING: Uses $func, which may not be portable below perl ", format_version($API{$func}{todo}), ", even with '$ppport'\n"; $warnings++; } } for $func (sort keys %{$file{needed_static}}) { my $message = ''; if (not exists $file{uses}{$func}) { $message = "No need to define NEED_$func if $func is never used"; } elsif (exists $file{needs}{$func} && $file{needs}{$func} ne 'static') { $message = "No need to define NEED_$func when already needed globally"; } if ($message) { diag($message); $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_$func\b.*$LF//mg); } } for $func (sort keys %{$file{needed_global}}) { my $message = ''; if (not exists $global{uses}{$func}) { $message = "No need to define NEED_${func}_GLOBAL if $func is never used"; } elsif (exists $file{needs}{$func}) { if ($file{needs}{$func} eq 'extern') { $message = "No need to define NEED_${func}_GLOBAL when already needed globally"; } elsif ($file{needs}{$func} eq 'static') { $message = "No need to define NEED_${func}_GLOBAL when only used in this file"; } } if ($message) { diag($message); $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_${func}_GLOBAL\b.*$LF//mg); } } $file{needs_inc_ppport} = keys %{$file{uses}}; if ($file{needs_inc_ppport}) { my $pp = ''; for $func (sort keys %{$file{needs}}) { my $type = $file{needs}{$func}; next if $type eq 'extern'; my $suffix = $type eq 'global' ? '_GLOBAL' : ''; unless (exists $file{"needed_$type"}{$func}) { if ($type eq 'global') { diag("Files [@{$global{needs}{$func}}] need $func, adding global request"); } else { diag("File needs $func, adding static request"); } $pp .= "#define NEED_$func$suffix\n"; } } if ($pp && ($c =~ s/^(?=$HS*#$HS*define$HS+NEED_\w+)/$pp/m)) { $pp = ''; $file{changes}++; } unless ($file{has_inc_ppport}) { diag("Needs to include '$ppport'"); $pp .= qq(#include "$ppport"\n) } if ($pp) { $file{changes} += ($c =~ s/^($HS*#$HS*define$HS+NEED_\w+.*?)^/$1$pp/ms) || ($c =~ s/^(?=$HS*#$HS*include.*\Q$ppport\E)/$pp/m) || ($c =~ s/^($HS*#$HS*include.*XSUB.*\s*?)^/$1$pp/m) || ($c =~ s/^/$pp/); } } else { if ($file{has_inc_ppport}) { diag("No need to include '$ppport'"); $file{changes} += ($c =~ s/^$HS*?#$HS*include.*\Q$ppport\E.*?$LF//m); } } # put back in our C comments my $ix; my $cppc = 0; my @ccom = @{$file{ccom}}; for $ix (0 .. $#ccom) { if (!$opt{cplusplus} && $ccom[$ix] =~ s!^//!!) { $cppc++; $file{changes} += $c =~ s/$rccs$ix$rcce/$ccs$ccom[$ix] $cce/; } else { $c =~ s/$rccs$ix$rcce/$ccom[$ix]/; } } if ($cppc) { my $s = $cppc != 1 ? 's' : ''; warning("Uses $cppc C++ style comment$s, which is not portable"); } my $s = $warnings != 1 ? 's' : ''; my $warn = $warnings ? " ($warnings warning$s)" : ''; info("Analysis completed$warn"); if ($file{changes}) { if (exists $opt{copy}) { my $newfile = "$filename$opt{copy}"; if (-e $newfile) { error("'$newfile' already exists, refusing to write copy of '$filename'"); } else { local *F; if (open F, ">$newfile") { info("Writing copy of '$filename' with changes to '$newfile'"); print F $c; close F; } else { error("Cannot open '$newfile' for writing: $!"); } } } elsif (exists $opt{patch} || $opt{changes}) { if (exists $opt{patch}) { unless ($patch_opened) { if (open PATCH, ">$opt{patch}") { $patch_opened = 1; } else { error("Cannot open '$opt{patch}' for writing: $!"); delete $opt{patch}; $opt{changes} = 1; goto fallback; } } mydiff(\*PATCH, $filename, $c); } else { fallback: info("Suggested changes:"); mydiff(\*STDOUT, $filename, $c); } } else { my $s = $file{changes} == 1 ? '' : 's'; info("$file{changes} potentially required change$s detected"); } } else { info("Looks good"); } } close PATCH if $patch_opened; exit 0; sub try_use { eval "use @_;"; return $@ eq '' } sub mydiff { local *F = shift; my($file, $str) = @_; my $diff; if (exists $opt{diff}) { $diff = run_diff($opt{diff}, $file, $str); } if (!defined $diff and try_use('Text::Diff')) { $diff = Text::Diff::diff($file, \$str, { STYLE => 'Unified' }); $diff = <
$tmp") { print F $str; close F; if (open F, "$prog $file $tmp |") { while () { s/\Q$tmp\E/$file.patched/; $diff .= $_; } close F; unlink $tmp; return $diff; } unlink $tmp; } else { error("Cannot open '$tmp' for writing: $!"); } return undef; } sub rec_depend { my($func, $seen) = @_; return () unless exists $depends{$func}; $seen = {%{$seen||{}}}; return () if $seen->{$func}++; my %s; grep !$s{$_}++, map { ($_, rec_depend($_, $seen)) } @{$depends{$func}}; } sub parse_version { my $ver = shift; if ($ver =~ /^(\d+)\.(\d+)\.(\d+)$/) { return ($1, $2, $3); } elsif ($ver !~ /^\d+\.[\d_]+$/) { die "cannot parse version '$ver'\n"; } $ver =~ s/_//g; $ver =~ s/$/000000/; my($r,$v,$s) = $ver =~ /(\d+)\.(\d{3})(\d{3})/; $v = int $v; $s = int $s; if ($r < 5 || ($r == 5 && $v < 6)) { if ($s % 10) { die "cannot parse version '$ver'\n"; } } return ($r, $v, $s); } sub format_version { my $ver = shift; $ver =~ s/$/000000/; my($r,$v,$s) = $ver =~ /(\d+)\.(\d{3})(\d{3})/; $v = int $v; $s = int $s; if ($r < 5 || ($r == 5 && $v < 6)) { if ($s % 10) { die "invalid version '$ver'\n"; } $s /= 10; $ver = sprintf "%d.%03d", $r, $v; $s > 0 and $ver .= sprintf "_%02d", $s; return $ver; } return sprintf "%d.%d.%d", $r, $v, $s; } sub info { $opt{quiet} and return; print @_, "\n"; } sub diag { $opt{quiet} and return; $opt{diag} and print @_, "\n"; } sub warning { $opt{quiet} and return; print "*** ", @_, "\n"; } sub error { print "*** ERROR: ", @_, "\n"; } my %given_hints; my %given_warnings; sub hint { $opt{quiet} and return; my $func = shift; my $rv = 0; if (exists $warnings{$func} && !$given_warnings{$func}++) { my $warn = $warnings{$func}; $warn =~ s!^!*** !mg; print "*** WARNING: $func\n", $warn; $rv++; } if ($opt{hints} && exists $hints{$func} && !$given_hints{$func}++) { my $hint = $hints{$func}; $hint =~ s/^/ /mg; print " --- hint for $func ---\n", $hint; } $rv; } sub usage { my($usage) = do { local(@ARGV,$/)=($0); <> } =~ /^=head\d$HS+SYNOPSIS\s*^(.*?)\s*^=/ms; my %M = ( 'I' => '*' ); $usage =~ s/^\s*perl\s+\S+/$^X $0/; $usage =~ s/([A-Z])<([^>]+)>/$M{$1}$2$M{$1}/g; print < }; my($copy) = $self =~ /^=head\d\s+COPYRIGHT\s*^(.*?)^=\w+/ms; $copy =~ s/^(?=\S+)/ /gms; $self =~ s/^$HS+Do NOT edit.*?(?=^-)/$copy/ms; $self =~ s/^SKIP.*(?=^__DATA__)/SKIP if (\@ARGV && \$ARGV[0] eq '--unstrip') { eval { require Devel::PPPort }; \$@ and die "Cannot require Devel::PPPort, please install.\\n"; if (eval \$Devel::PPPort::VERSION < $VERSION) { die "$0 was originally generated with Devel::PPPort $VERSION.\\n" . "Your Devel::PPPort is only version \$Devel::PPPort::VERSION.\\n" . "Please install a newer version, or --unstrip will not work.\\n"; } Devel::PPPort::WriteFile(\$0); exit 0; } print <$0" or die "cannot strip $0: $!\n"; print OUT "$pl$c\n"; exit 0; } __DATA__ */ #ifndef _P_P_PORTABILITY_H_ #define _P_P_PORTABILITY_H_ #ifndef DPPP_NAMESPACE # define DPPP_NAMESPACE DPPP_ #endif #define DPPP_CAT2(x,y) CAT2(x,y) #define DPPP_(name) DPPP_CAT2(DPPP_NAMESPACE, name) #ifndef PERL_REVISION # if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION)) # define PERL_PATCHLEVEL_H_IMPLICIT # include # endif # if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL))) # include # endif # ifndef PERL_REVISION # define PERL_REVISION (5) /* Replace: 1 */ # define PERL_VERSION PATCHLEVEL # define PERL_SUBVERSION SUBVERSION /* Replace PERL_PATCHLEVEL with PERL_VERSION */ /* Replace: 0 */ # endif #endif #define _dpppDEC2BCD(dec) ((((dec)/100)<<8)|((((dec)%100)/10)<<4)|((dec)%10)) #define PERL_BCDVERSION ((_dpppDEC2BCD(PERL_REVISION)<<24)|(_dpppDEC2BCD(PERL_VERSION)<<12)|_dpppDEC2BCD(PERL_SUBVERSION)) /* It is very unlikely that anyone will try to use this with Perl 6 (or greater), but who knows. */ #if PERL_REVISION != 5 # error ppport.h only works with Perl version 5 #endif /* PERL_REVISION != 5 */ #ifndef dTHR # define dTHR dNOOP #endif #ifndef dTHX # define dTHX dNOOP #endif #ifndef dTHXa # define dTHXa(x) dNOOP #endif #ifndef pTHX # define pTHX void #endif #ifndef pTHX_ # define pTHX_ #endif #ifndef aTHX # define aTHX #endif #ifndef aTHX_ # define aTHX_ #endif #if (PERL_BCDVERSION < 0x5006000) # ifdef USE_THREADS # define aTHXR thr # define aTHXR_ thr, # else # define aTHXR # define aTHXR_ # endif # define dTHXR dTHR #else # define aTHXR aTHX # define aTHXR_ aTHX_ # define dTHXR dTHX #endif #ifndef dTHXoa # define dTHXoa(x) dTHXa(x) #endif #ifdef I_LIMITS # include #endif #ifndef PERL_UCHAR_MIN # define PERL_UCHAR_MIN ((unsigned char)0) #endif #ifndef PERL_UCHAR_MAX # ifdef UCHAR_MAX # define PERL_UCHAR_MAX ((unsigned char)UCHAR_MAX) # else # ifdef MAXUCHAR # define PERL_UCHAR_MAX ((unsigned char)MAXUCHAR) # else # define PERL_UCHAR_MAX ((unsigned char)~(unsigned)0) # endif # endif #endif #ifndef PERL_USHORT_MIN # define PERL_USHORT_MIN ((unsigned short)0) #endif #ifndef PERL_USHORT_MAX # ifdef USHORT_MAX # define PERL_USHORT_MAX ((unsigned short)USHORT_MAX) # else # ifdef MAXUSHORT # define PERL_USHORT_MAX ((unsigned short)MAXUSHORT) # else # ifdef USHRT_MAX # define PERL_USHORT_MAX ((unsigned short)USHRT_MAX) # else # define PERL_USHORT_MAX ((unsigned short)~(unsigned)0) # endif # endif # endif #endif #ifndef PERL_SHORT_MAX # ifdef SHORT_MAX # define PERL_SHORT_MAX ((short)SHORT_MAX) # else # ifdef MAXSHORT /* Often used in */ # define PERL_SHORT_MAX ((short)MAXSHORT) # else # ifdef SHRT_MAX # define PERL_SHORT_MAX ((short)SHRT_MAX) # else # define PERL_SHORT_MAX ((short) (PERL_USHORT_MAX >> 1)) # endif # endif # endif #endif #ifndef PERL_SHORT_MIN # ifdef SHORT_MIN # define PERL_SHORT_MIN ((short)SHORT_MIN) # else # ifdef MINSHORT # define PERL_SHORT_MIN ((short)MINSHORT) # else # ifdef SHRT_MIN # define PERL_SHORT_MIN ((short)SHRT_MIN) # else # define PERL_SHORT_MIN (-PERL_SHORT_MAX - ((3 & -1) == 3)) # endif # endif # endif #endif #ifndef PERL_UINT_MAX # ifdef UINT_MAX # define PERL_UINT_MAX ((unsigned int)UINT_MAX) # else # ifdef MAXUINT # define PERL_UINT_MAX ((unsigned int)MAXUINT) # else # define PERL_UINT_MAX (~(unsigned int)0) # endif # endif #endif #ifndef PERL_UINT_MIN # define PERL_UINT_MIN ((unsigned int)0) #endif #ifndef PERL_INT_MAX # ifdef INT_MAX # define PERL_INT_MAX ((int)INT_MAX) # else # ifdef MAXINT /* Often used in */ # define PERL_INT_MAX ((int)MAXINT) # else # define PERL_INT_MAX ((int)(PERL_UINT_MAX >> 1)) # endif # endif #endif #ifndef PERL_INT_MIN # ifdef INT_MIN # define PERL_INT_MIN ((int)INT_MIN) # else # ifdef MININT # define PERL_INT_MIN ((int)MININT) # else # define PERL_INT_MIN (-PERL_INT_MAX - ((3 & -1) == 3)) # endif # endif #endif #ifndef PERL_ULONG_MAX # ifdef ULONG_MAX # define PERL_ULONG_MAX ((unsigned long)ULONG_MAX) # else # ifdef MAXULONG # define PERL_ULONG_MAX ((unsigned long)MAXULONG) # else # define PERL_ULONG_MAX (~(unsigned long)0) # endif # endif #endif #ifndef PERL_ULONG_MIN # define PERL_ULONG_MIN ((unsigned long)0L) #endif #ifndef PERL_LONG_MAX # ifdef LONG_MAX # define PERL_LONG_MAX ((long)LONG_MAX) # else # ifdef MAXLONG # define PERL_LONG_MAX ((long)MAXLONG) # else # define PERL_LONG_MAX ((long) (PERL_ULONG_MAX >> 1)) # endif # endif #endif #ifndef PERL_LONG_MIN # ifdef LONG_MIN # define PERL_LONG_MIN ((long)LONG_MIN) # else # ifdef MINLONG # define PERL_LONG_MIN ((long)MINLONG) # else # define PERL_LONG_MIN (-PERL_LONG_MAX - ((3 & -1) == 3)) # endif # endif #endif #if defined(HAS_QUAD) && (defined(convex) || defined(uts)) # ifndef PERL_UQUAD_MAX # ifdef ULONGLONG_MAX # define PERL_UQUAD_MAX ((unsigned long long)ULONGLONG_MAX) # else # ifdef MAXULONGLONG # define PERL_UQUAD_MAX ((unsigned long long)MAXULONGLONG) # else # define PERL_UQUAD_MAX (~(unsigned long long)0) # endif # endif # endif # ifndef PERL_UQUAD_MIN # define PERL_UQUAD_MIN ((unsigned long long)0L) # endif # ifndef PERL_QUAD_MAX # ifdef LONGLONG_MAX # define PERL_QUAD_MAX ((long long)LONGLONG_MAX) # else # ifdef MAXLONGLONG # define PERL_QUAD_MAX ((long long)MAXLONGLONG) # else # define PERL_QUAD_MAX ((long long) (PERL_UQUAD_MAX >> 1)) # endif # endif # endif # ifndef PERL_QUAD_MIN # ifdef LONGLONG_MIN # define PERL_QUAD_MIN ((long long)LONGLONG_MIN) # else # ifdef MINLONGLONG # define PERL_QUAD_MIN ((long long)MINLONGLONG) # else # define PERL_QUAD_MIN (-PERL_QUAD_MAX - ((3 & -1) == 3)) # endif # endif # endif #endif /* This is based on code from 5.003 perl.h */ #ifdef HAS_QUAD # ifdef cray #ifndef IVTYPE # define IVTYPE int #endif #ifndef IV_MIN # define IV_MIN PERL_INT_MIN #endif #ifndef IV_MAX # define IV_MAX PERL_INT_MAX #endif #ifndef UV_MIN # define UV_MIN PERL_UINT_MIN #endif #ifndef UV_MAX # define UV_MAX PERL_UINT_MAX #endif # ifdef INTSIZE #ifndef IVSIZE # define IVSIZE INTSIZE #endif # endif # else # if defined(convex) || defined(uts) #ifndef IVTYPE # define IVTYPE long long #endif #ifndef IV_MIN # define IV_MIN PERL_QUAD_MIN #endif #ifndef IV_MAX # define IV_MAX PERL_QUAD_MAX #endif #ifndef UV_MIN # define UV_MIN PERL_UQUAD_MIN #endif #ifndef UV_MAX # define UV_MAX PERL_UQUAD_MAX #endif # ifdef LONGLONGSIZE #ifndef IVSIZE # define IVSIZE LONGLONGSIZE #endif # endif # else #ifndef IVTYPE # define IVTYPE long #endif #ifndef IV_MIN # define IV_MIN PERL_LONG_MIN #endif #ifndef IV_MAX # define IV_MAX PERL_LONG_MAX #endif #ifndef UV_MIN # define UV_MIN PERL_ULONG_MIN #endif #ifndef UV_MAX # define UV_MAX PERL_ULONG_MAX #endif # ifdef LONGSIZE #ifndef IVSIZE # define IVSIZE LONGSIZE #endif # endif # endif # endif #ifndef IVSIZE # define IVSIZE 8 #endif #ifndef PERL_QUAD_MIN # define PERL_QUAD_MIN IV_MIN #endif #ifndef PERL_QUAD_MAX # define PERL_QUAD_MAX IV_MAX #endif #ifndef PERL_UQUAD_MIN # define PERL_UQUAD_MIN UV_MIN #endif #ifndef PERL_UQUAD_MAX # define PERL_UQUAD_MAX UV_MAX #endif #else #ifndef IVTYPE # define IVTYPE long #endif #ifndef IV_MIN # define IV_MIN PERL_LONG_MIN #endif #ifndef IV_MAX # define IV_MAX PERL_LONG_MAX #endif #ifndef UV_MIN # define UV_MIN PERL_ULONG_MIN #endif #ifndef UV_MAX # define UV_MAX PERL_ULONG_MAX #endif #endif #ifndef IVSIZE # ifdef LONGSIZE # define IVSIZE LONGSIZE # else # define IVSIZE 4 /* A bold guess, but the best we can make. */ # endif #endif #ifndef UVTYPE # define UVTYPE unsigned IVTYPE #endif #ifndef UVSIZE # define UVSIZE IVSIZE #endif #ifndef sv_setuv # define sv_setuv(sv, uv) \ STMT_START { \ UV TeMpUv = uv; \ if (TeMpUv <= IV_MAX) \ sv_setiv(sv, TeMpUv); \ else \ sv_setnv(sv, (double)TeMpUv); \ } STMT_END #endif #ifndef newSVuv # define newSVuv(uv) ((uv) <= IV_MAX ? newSViv((IV)uv) : newSVnv((NV)uv)) #endif #ifndef sv_2uv # define sv_2uv(sv) ((PL_Sv = (sv)), (UV) (SvNOK(PL_Sv) ? SvNV(PL_Sv) : sv_2nv(PL_Sv))) #endif #ifndef SvUVX # define SvUVX(sv) ((UV)SvIVX(sv)) #endif #ifndef SvUVXx # define SvUVXx(sv) SvUVX(sv) #endif #ifndef SvUV # define SvUV(sv) (SvIOK(sv) ? SvUVX(sv) : sv_2uv(sv)) #endif #ifndef SvUVx # define SvUVx(sv) ((PL_Sv = (sv)), SvUV(PL_Sv)) #endif /* Hint: sv_uv * Always use the SvUVx() macro instead of sv_uv(). */ #ifndef sv_uv # define sv_uv(sv) SvUVx(sv) #endif #if !defined(SvUOK) && defined(SvIOK_UV) # define SvUOK(sv) SvIOK_UV(sv) #endif #ifndef XST_mUV # define XST_mUV(i,v) (ST(i) = sv_2mortal(newSVuv(v)) ) #endif #ifndef XSRETURN_UV # define XSRETURN_UV(v) STMT_START { XST_mUV(0,v); XSRETURN(1); } STMT_END #endif #ifndef PUSHu # define PUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); PUSHTARG; } STMT_END #endif #ifndef XPUSHu # define XPUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); XPUSHTARG; } STMT_END #endif #ifdef HAS_MEMCMP #ifndef memNE # define memNE(s1,s2,l) (memcmp(s1,s2,l)) #endif #ifndef memEQ # define memEQ(s1,s2,l) (!memcmp(s1,s2,l)) #endif #else #ifndef memNE # define memNE(s1,s2,l) (bcmp(s1,s2,l)) #endif #ifndef memEQ # define memEQ(s1,s2,l) (!bcmp(s1,s2,l)) #endif #endif #ifndef memEQs # define memEQs(s1, l, s2) \ (sizeof(s2)-1 == l && memEQ(s1, (s2 ""), (sizeof(s2)-1))) #endif #ifndef memNEs # define memNEs(s1, l, s2) !memEQs(s1, l, s2) #endif #ifndef MoveD # define MoveD(s,d,n,t) memmove((char*)(d),(char*)(s), (n) * sizeof(t)) #endif #ifndef CopyD # define CopyD(s,d,n,t) memcpy((char*)(d),(char*)(s), (n) * sizeof(t)) #endif #ifdef HAS_MEMSET #ifndef ZeroD # define ZeroD(d,n,t) memzero((char*)(d), (n) * sizeof(t)) #endif #else #ifndef ZeroD # define ZeroD(d,n,t) ((void)memzero((char*)(d), (n) * sizeof(t)), d) #endif #endif #ifndef PoisonWith # define PoisonWith(d,n,t,b) (void)memset((char*)(d), (U8)(b), (n) * sizeof(t)) #endif #ifndef PoisonNew # define PoisonNew(d,n,t) PoisonWith(d,n,t,0xAB) #endif #ifndef PoisonFree # define PoisonFree(d,n,t) PoisonWith(d,n,t,0xEF) #endif #ifndef Poison # define Poison(d,n,t) PoisonFree(d,n,t) #endif #ifndef Newx # define Newx(v,n,t) New(0,v,n,t) #endif #ifndef Newxc # define Newxc(v,n,t,c) Newc(0,v,n,t,c) #endif #ifndef Newxz # define Newxz(v,n,t) Newz(0,v,n,t) #endif #ifndef PERL_UNUSED_DECL # ifdef HASATTRIBUTE # if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER) # define PERL_UNUSED_DECL # else # define PERL_UNUSED_DECL __attribute__((unused)) # endif # else # define PERL_UNUSED_DECL # endif #endif #ifndef PERL_UNUSED_ARG # if defined(lint) && defined(S_SPLINT_S) /* www.splint.org */ # include # define PERL_UNUSED_ARG(x) NOTE(ARGUNUSED(x)) # else # define PERL_UNUSED_ARG(x) ((void)x) # endif #endif #ifndef PERL_UNUSED_VAR # define PERL_UNUSED_VAR(x) ((void)x) #endif #ifndef PERL_UNUSED_CONTEXT # ifdef USE_ITHREADS # define PERL_UNUSED_CONTEXT PERL_UNUSED_ARG(my_perl) # else # define PERL_UNUSED_CONTEXT # endif #endif #ifndef NOOP # define NOOP /*EMPTY*/(void)0 #endif #ifndef dNOOP # define dNOOP extern int /*@unused@*/ Perl___notused PERL_UNUSED_DECL #endif #ifndef NVTYPE # if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) # define NVTYPE long double # else # define NVTYPE double # endif typedef NVTYPE NV; #endif #ifndef INT2PTR # if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE) # define PTRV UV # define INT2PTR(any,d) (any)(d) # else # if PTRSIZE == LONGSIZE # define PTRV unsigned long # else # define PTRV unsigned # endif # define INT2PTR(any,d) (any)(PTRV)(d) # endif #endif #ifndef PTR2ul # if PTRSIZE == LONGSIZE # define PTR2ul(p) (unsigned long)(p) # else # define PTR2ul(p) INT2PTR(unsigned long,p) # endif #endif #ifndef PTR2nat # define PTR2nat(p) (PTRV)(p) #endif #ifndef NUM2PTR # define NUM2PTR(any,d) (any)PTR2nat(d) #endif #ifndef PTR2IV # define PTR2IV(p) INT2PTR(IV,p) #endif #ifndef PTR2UV # define PTR2UV(p) INT2PTR(UV,p) #endif #ifndef PTR2NV # define PTR2NV(p) NUM2PTR(NV,p) #endif #undef START_EXTERN_C #undef END_EXTERN_C #undef EXTERN_C #ifdef __cplusplus # define START_EXTERN_C extern "C" { # define END_EXTERN_C } # define EXTERN_C extern "C" #else # define START_EXTERN_C # define END_EXTERN_C # define EXTERN_C extern #endif #if defined(PERL_GCC_PEDANTIC) # ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN # define PERL_GCC_BRACE_GROUPS_FORBIDDEN # endif #endif #if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) && !defined(__cplusplus) # ifndef PERL_USE_GCC_BRACE_GROUPS # define PERL_USE_GCC_BRACE_GROUPS # endif #endif #undef STMT_START #undef STMT_END #ifdef PERL_USE_GCC_BRACE_GROUPS # define STMT_START (void)( /* gcc supports ``({ STATEMENTS; })'' */ # define STMT_END ) #else # if defined(VOIDFLAGS) && (VOIDFLAGS) && (defined(sun) || defined(__sun__)) && !defined(__GNUC__) # define STMT_START if (1) # define STMT_END else (void)0 # else # define STMT_START do # define STMT_END while (0) # endif #endif #ifndef boolSV # define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no) #endif /* DEFSV appears first in 5.004_56 */ #ifndef DEFSV # define DEFSV GvSV(PL_defgv) #endif #ifndef SAVE_DEFSV # define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv)) #endif #ifndef DEFSV_set # define DEFSV_set(sv) (DEFSV = (sv)) #endif /* Older perls (<=5.003) lack AvFILLp */ #ifndef AvFILLp # define AvFILLp AvFILL #endif #ifndef ERRSV # define ERRSV get_sv("@",FALSE) #endif /* Hint: gv_stashpvn * This function's backport doesn't support the length parameter, but * rather ignores it. Portability can only be ensured if the length * parameter is used for speed reasons, but the length can always be * correctly computed from the string argument. */ #ifndef gv_stashpvn # define gv_stashpvn(str,len,create) gv_stashpv(str,create) #endif /* Replace: 1 */ #ifndef get_cv # define get_cv perl_get_cv #endif #ifndef get_sv # define get_sv perl_get_sv #endif #ifndef get_av # define get_av perl_get_av #endif #ifndef get_hv # define get_hv perl_get_hv #endif /* Replace: 0 */ #ifndef dUNDERBAR # define dUNDERBAR dNOOP #endif #ifndef UNDERBAR # define UNDERBAR DEFSV #endif #ifndef dAX # define dAX I32 ax = MARK - PL_stack_base + 1 #endif #ifndef dITEMS # define dITEMS I32 items = SP - MARK #endif #ifndef dXSTARG # define dXSTARG SV * targ = sv_newmortal() #endif #ifndef dAXMARK # define dAXMARK I32 ax = POPMARK; \ register SV ** const mark = PL_stack_base + ax++ #endif #ifndef XSprePUSH # define XSprePUSH (sp = PL_stack_base + ax - 1) #endif #if (PERL_BCDVERSION < 0x5005000) # undef XSRETURN # define XSRETURN(off) \ STMT_START { \ PL_stack_sp = PL_stack_base + ax + ((off) - 1); \ return; \ } STMT_END #endif #ifndef XSPROTO # define XSPROTO(name) void name(pTHX_ CV* cv) #endif #ifndef SVfARG # define SVfARG(p) ((void*)(p)) #endif #ifndef PERL_ABS # define PERL_ABS(x) ((x) < 0 ? -(x) : (x)) #endif #ifndef dVAR # define dVAR dNOOP #endif #ifndef SVf # define SVf "_" #endif #ifndef UTF8_MAXBYTES # define UTF8_MAXBYTES UTF8_MAXLEN #endif #ifndef CPERLscope # define CPERLscope(x) x #endif #ifndef PERL_HASH # define PERL_HASH(hash,str,len) \ STMT_START { \ const char *s_PeRlHaSh = str; \ I32 i_PeRlHaSh = len; \ U32 hash_PeRlHaSh = 0; \ while (i_PeRlHaSh--) \ hash_PeRlHaSh = hash_PeRlHaSh * 33 + *s_PeRlHaSh++; \ (hash) = hash_PeRlHaSh; \ } STMT_END #endif #ifndef PERLIO_FUNCS_DECL # ifdef PERLIO_FUNCS_CONST # define PERLIO_FUNCS_DECL(funcs) const PerlIO_funcs funcs # define PERLIO_FUNCS_CAST(funcs) (PerlIO_funcs*)(funcs) # else # define PERLIO_FUNCS_DECL(funcs) PerlIO_funcs funcs # define PERLIO_FUNCS_CAST(funcs) (funcs) # endif #endif /* provide these typedefs for older perls */ #if (PERL_BCDVERSION < 0x5009003) # ifdef ARGSproto typedef OP* (CPERLscope(*Perl_ppaddr_t))(ARGSproto); # else typedef OP* (CPERLscope(*Perl_ppaddr_t))(pTHX); # endif typedef OP* (CPERLscope(*Perl_check_t)) (pTHX_ OP*); #endif #ifndef isPSXSPC # define isPSXSPC(c) (isSPACE(c) || (c) == '\v') #endif #ifndef isBLANK # define isBLANK(c) ((c) == ' ' || (c) == '\t') #endif #ifdef EBCDIC #ifndef isALNUMC # define isALNUMC(c) isalnum(c) #endif #ifndef isASCII # define isASCII(c) isascii(c) #endif #ifndef isCNTRL # define isCNTRL(c) iscntrl(c) #endif #ifndef isGRAPH # define isGRAPH(c) isgraph(c) #endif #ifndef isPRINT # define isPRINT(c) isprint(c) #endif #ifndef isPUNCT # define isPUNCT(c) ispunct(c) #endif #ifndef isXDIGIT # define isXDIGIT(c) isxdigit(c) #endif #else # if (PERL_BCDVERSION < 0x5010000) /* Hint: isPRINT * The implementation in older perl versions includes all of the * isSPACE() characters, which is wrong. The version provided by * Devel::PPPort always overrides a present buggy version. */ # undef isPRINT # endif #ifndef isALNUMC # define isALNUMC(c) (isALPHA(c) || isDIGIT(c)) #endif #ifndef isASCII # define isASCII(c) ((c) <= 127) #endif #ifndef isCNTRL # define isCNTRL(c) ((c) < ' ' || (c) == 127) #endif #ifndef isGRAPH # define isGRAPH(c) (isALNUM(c) || isPUNCT(c)) #endif #ifndef isPRINT # define isPRINT(c) (((c) >= 32 && (c) < 127)) #endif #ifndef isPUNCT # define isPUNCT(c) (((c) >= 33 && (c) <= 47) || ((c) >= 58 && (c) <= 64) || ((c) >= 91 && (c) <= 96) || ((c) >= 123 && (c) <= 126)) #endif #ifndef isXDIGIT # define isXDIGIT(c) (isDIGIT(c) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F')) #endif #endif #ifndef PERL_SIGNALS_UNSAFE_FLAG #define PERL_SIGNALS_UNSAFE_FLAG 0x0001 #if (PERL_BCDVERSION < 0x5008000) # define D_PPP_PERL_SIGNALS_INIT PERL_SIGNALS_UNSAFE_FLAG #else # define D_PPP_PERL_SIGNALS_INIT 0 #endif #if defined(NEED_PL_signals) static U32 DPPP_(my_PL_signals) = D_PPP_PERL_SIGNALS_INIT; #elif defined(NEED_PL_signals_GLOBAL) U32 DPPP_(my_PL_signals) = D_PPP_PERL_SIGNALS_INIT; #else extern U32 DPPP_(my_PL_signals); #endif #define PL_signals DPPP_(my_PL_signals) #endif /* Hint: PL_ppaddr * Calling an op via PL_ppaddr requires passing a context argument * for threaded builds. Since the context argument is different for * 5.005 perls, you can use aTHXR (supplied by ppport.h), which will * automatically be defined as the correct argument. */ #if (PERL_BCDVERSION <= 0x5005005) /* Replace: 1 */ # define PL_ppaddr ppaddr # define PL_no_modify no_modify /* Replace: 0 */ #endif #if (PERL_BCDVERSION <= 0x5004005) /* Replace: 1 */ # define PL_DBsignal DBsignal # define PL_DBsingle DBsingle # define PL_DBsub DBsub # define PL_DBtrace DBtrace # define PL_Sv Sv # define PL_bufend bufend # define PL_bufptr bufptr # define PL_compiling compiling # define PL_copline copline # define PL_curcop curcop # define PL_curstash curstash # define PL_debstash debstash # define PL_defgv defgv # define PL_diehook diehook # define PL_dirty dirty # define PL_dowarn dowarn # define PL_errgv errgv # define PL_error_count error_count # define PL_expect expect # define PL_hexdigit hexdigit # define PL_hints hints # define PL_in_my in_my # define PL_laststatval laststatval # define PL_lex_state lex_state # define PL_lex_stuff lex_stuff # define PL_linestr linestr # define PL_na na # define PL_perl_destruct_level perl_destruct_level # define PL_perldb perldb # define PL_rsfp_filters rsfp_filters # define PL_rsfp rsfp # define PL_stack_base stack_base # define PL_stack_sp stack_sp # define PL_statcache statcache # define PL_stdingv stdingv # define PL_sv_arenaroot sv_arenaroot # define PL_sv_no sv_no # define PL_sv_undef sv_undef # define PL_sv_yes sv_yes # define PL_tainted tainted # define PL_tainting tainting # define PL_tokenbuf tokenbuf /* Replace: 0 */ #endif /* Warning: PL_parser * For perl versions earlier than 5.9.5, this is an always * non-NULL dummy. Also, it cannot be dereferenced. Don't * use it if you can avoid is and unless you absolutely know * what you're doing. * If you always check that PL_parser is non-NULL, you can * define DPPP_PL_parser_NO_DUMMY to avoid the creation of * a dummy parser structure. */ #if (PERL_BCDVERSION >= 0x5009005) # ifdef DPPP_PL_parser_NO_DUMMY # define D_PPP_my_PL_parser_var(var) ((PL_parser ? PL_parser : \ (croak("panic: PL_parser == NULL in %s:%d", \ __FILE__, __LINE__), (yy_parser *) NULL))->var) # else # ifdef DPPP_PL_parser_NO_DUMMY_WARNING # define D_PPP_parser_dummy_warning(var) # else # define D_PPP_parser_dummy_warning(var) \ warn("warning: dummy PL_" #var " used in %s:%d", __FILE__, __LINE__), # endif # define D_PPP_my_PL_parser_var(var) ((PL_parser ? PL_parser : \ (D_PPP_parser_dummy_warning(var) &DPPP_(dummy_PL_parser)))->var) #if defined(NEED_PL_parser) static yy_parser DPPP_(dummy_PL_parser); #elif defined(NEED_PL_parser_GLOBAL) yy_parser DPPP_(dummy_PL_parser); #else extern yy_parser DPPP_(dummy_PL_parser); #endif # endif /* PL_expect, PL_copline, PL_rsfp, PL_rsfp_filters, PL_linestr, PL_bufptr, PL_bufend, PL_lex_state, PL_lex_stuff, PL_tokenbuf depends on PL_parser */ /* Warning: PL_expect, PL_copline, PL_rsfp, PL_rsfp_filters, PL_linestr, PL_bufptr, PL_bufend, PL_lex_state, PL_lex_stuff, PL_tokenbuf * Do not use this variable unless you know exactly what you're * doint. It is internal to the perl parser and may change or even * be removed in the future. As of perl 5.9.5, you have to check * for (PL_parser != NULL) for this variable to have any effect. * An always non-NULL PL_parser dummy is provided for earlier * perl versions. * If PL_parser is NULL when you try to access this variable, a * dummy is being accessed instead and a warning is issued unless * you define DPPP_PL_parser_NO_DUMMY_WARNING. * If DPPP_PL_parser_NO_DUMMY is defined, the code trying to access * this variable will croak with a panic message. */ # define PL_expect D_PPP_my_PL_parser_var(expect) # define PL_copline D_PPP_my_PL_parser_var(copline) # define PL_rsfp D_PPP_my_PL_parser_var(rsfp) # define PL_rsfp_filters D_PPP_my_PL_parser_var(rsfp_filters) # define PL_linestr D_PPP_my_PL_parser_var(linestr) # define PL_bufptr D_PPP_my_PL_parser_var(bufptr) # define PL_bufend D_PPP_my_PL_parser_var(bufend) # define PL_lex_state D_PPP_my_PL_parser_var(lex_state) # define PL_lex_stuff D_PPP_my_PL_parser_var(lex_stuff) # define PL_tokenbuf D_PPP_my_PL_parser_var(tokenbuf) # define PL_in_my D_PPP_my_PL_parser_var(in_my) # define PL_in_my_stash D_PPP_my_PL_parser_var(in_my_stash) # define PL_error_count D_PPP_my_PL_parser_var(error_count) #else /* ensure that PL_parser != NULL and cannot be dereferenced */ # define PL_parser ((void *) 1) #endif #ifndef mPUSHs # define mPUSHs(s) PUSHs(sv_2mortal(s)) #endif #ifndef PUSHmortal # define PUSHmortal PUSHs(sv_newmortal()) #endif #ifndef mPUSHp # define mPUSHp(p,l) sv_setpvn(PUSHmortal, (p), (l)) #endif #ifndef mPUSHn # define mPUSHn(n) sv_setnv(PUSHmortal, (NV)(n)) #endif #ifndef mPUSHi # define mPUSHi(i) sv_setiv(PUSHmortal, (IV)(i)) #endif #ifndef mPUSHu # define mPUSHu(u) sv_setuv(PUSHmortal, (UV)(u)) #endif #ifndef mXPUSHs # define mXPUSHs(s) XPUSHs(sv_2mortal(s)) #endif #ifndef XPUSHmortal # define XPUSHmortal XPUSHs(sv_newmortal()) #endif #ifndef mXPUSHp # define mXPUSHp(p,l) STMT_START { EXTEND(sp,1); sv_setpvn(PUSHmortal, (p), (l)); } STMT_END #endif #ifndef mXPUSHn # define mXPUSHn(n) STMT_START { EXTEND(sp,1); sv_setnv(PUSHmortal, (NV)(n)); } STMT_END #endif #ifndef mXPUSHi # define mXPUSHi(i) STMT_START { EXTEND(sp,1); sv_setiv(PUSHmortal, (IV)(i)); } STMT_END #endif #ifndef mXPUSHu # define mXPUSHu(u) STMT_START { EXTEND(sp,1); sv_setuv(PUSHmortal, (UV)(u)); } STMT_END #endif /* Replace: 1 */ #ifndef call_sv # define call_sv perl_call_sv #endif #ifndef call_pv # define call_pv perl_call_pv #endif #ifndef call_argv # define call_argv perl_call_argv #endif #ifndef call_method # define call_method perl_call_method #endif #ifndef eval_sv # define eval_sv perl_eval_sv #endif /* Replace: 0 */ #ifndef PERL_LOADMOD_DENY # define PERL_LOADMOD_DENY 0x1 #endif #ifndef PERL_LOADMOD_NOIMPORT # define PERL_LOADMOD_NOIMPORT 0x2 #endif #ifndef PERL_LOADMOD_IMPORT_OPS # define PERL_LOADMOD_IMPORT_OPS 0x4 #endif #ifndef G_METHOD # define G_METHOD 64 # ifdef call_sv # undef call_sv # endif # if (PERL_BCDVERSION < 0x5006000) # define call_sv(sv, flags) ((flags) & G_METHOD ? perl_call_method((char *) SvPV_nolen_const(sv), \ (flags) & ~G_METHOD) : perl_call_sv(sv, flags)) # else # define call_sv(sv, flags) ((flags) & G_METHOD ? Perl_call_method(aTHX_ (char *) SvPV_nolen_const(sv), \ (flags) & ~G_METHOD) : Perl_call_sv(aTHX_ sv, flags)) # endif #endif /* Replace perl_eval_pv with eval_pv */ #ifndef eval_pv #if defined(NEED_eval_pv) static SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error); static #else extern SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error); #endif #ifdef eval_pv # undef eval_pv #endif #define eval_pv(a,b) DPPP_(my_eval_pv)(aTHX_ a,b) #define Perl_eval_pv DPPP_(my_eval_pv) #if defined(NEED_eval_pv) || defined(NEED_eval_pv_GLOBAL) SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error) { dSP; SV* sv = newSVpv(p, 0); PUSHMARK(sp); eval_sv(sv, G_SCALAR); SvREFCNT_dec(sv); SPAGAIN; sv = POPs; PUTBACK; if (croak_on_error && SvTRUE(GvSV(errgv))) croak(SvPVx(GvSV(errgv), na)); return sv; } #endif #endif #ifndef vload_module #if defined(NEED_vload_module) static void DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args); static #else extern void DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args); #endif #ifdef vload_module # undef vload_module #endif #define vload_module(a,b,c,d) DPPP_(my_vload_module)(aTHX_ a,b,c,d) #define Perl_vload_module DPPP_(my_vload_module) #if defined(NEED_vload_module) || defined(NEED_vload_module_GLOBAL) void DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args) { dTHR; dVAR; OP *veop, *imop; OP * const modname = newSVOP(OP_CONST, 0, name); /* 5.005 has a somewhat hacky force_normal that doesn't croak on SvREADONLY() if PL_compling is true. Current perls take care in ck_require() to correctly turn off SvREADONLY before calling force_normal_flags(). This seems a better fix than fudging PL_compling */ SvREADONLY_off(((SVOP*)modname)->op_sv); modname->op_private |= OPpCONST_BARE; if (ver) { veop = newSVOP(OP_CONST, 0, ver); } else veop = NULL; if (flags & PERL_LOADMOD_NOIMPORT) { imop = sawparens(newNULLLIST()); } else if (flags & PERL_LOADMOD_IMPORT_OPS) { imop = va_arg(*args, OP*); } else { SV *sv; imop = NULL; sv = va_arg(*args, SV*); while (sv) { imop = append_elem(OP_LIST, imop, newSVOP(OP_CONST, 0, sv)); sv = va_arg(*args, SV*); } } { const line_t ocopline = PL_copline; COP * const ocurcop = PL_curcop; const int oexpect = PL_expect; #if (PERL_BCDVERSION >= 0x5004000) utilize(!(flags & PERL_LOADMOD_DENY), start_subparse(FALSE, 0), veop, modname, imop); #else utilize(!(flags & PERL_LOADMOD_DENY), start_subparse(), modname, imop); #endif PL_expect = oexpect; PL_copline = ocopline; PL_curcop = ocurcop; } } #endif #endif #ifndef load_module #if defined(NEED_load_module) static void DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...); static #else extern void DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...); #endif #ifdef load_module # undef load_module #endif #define load_module DPPP_(my_load_module) #define Perl_load_module DPPP_(my_load_module) #if defined(NEED_load_module) || defined(NEED_load_module_GLOBAL) void DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...) { va_list args; va_start(args, ver); vload_module(flags, name, ver, &args); va_end(args); } #endif #endif #ifndef newRV_inc # define newRV_inc(sv) newRV(sv) /* Replace */ #endif #ifndef newRV_noinc #if defined(NEED_newRV_noinc) static SV * DPPP_(my_newRV_noinc)(SV *sv); static #else extern SV * DPPP_(my_newRV_noinc)(SV *sv); #endif #ifdef newRV_noinc # undef newRV_noinc #endif #define newRV_noinc(a) DPPP_(my_newRV_noinc)(aTHX_ a) #define Perl_newRV_noinc DPPP_(my_newRV_noinc) #if defined(NEED_newRV_noinc) || defined(NEED_newRV_noinc_GLOBAL) SV * DPPP_(my_newRV_noinc)(SV *sv) { SV *rv = (SV *)newRV(sv); SvREFCNT_dec(sv); return rv; } #endif #endif /* Hint: newCONSTSUB * Returns a CV* as of perl-5.7.1. This return value is not supported * by Devel::PPPort. */ /* newCONSTSUB from IO.xs is in the core starting with 5.004_63 */ #if (PERL_BCDVERSION < 0x5004063) && (PERL_BCDVERSION != 0x5004005) #if defined(NEED_newCONSTSUB) static void DPPP_(my_newCONSTSUB)(HV *stash, const char *name, SV *sv); static #else extern void DPPP_(my_newCONSTSUB)(HV *stash, const char *name, SV *sv); #endif #ifdef newCONSTSUB # undef newCONSTSUB #endif #define newCONSTSUB(a,b,c) DPPP_(my_newCONSTSUB)(aTHX_ a,b,c) #define Perl_newCONSTSUB DPPP_(my_newCONSTSUB) #if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL) /* This is just a trick to avoid a dependency of newCONSTSUB on PL_parser */ /* (There's no PL_parser in perl < 5.005, so this is completely safe) */ #define D_PPP_PL_copline PL_copline void DPPP_(my_newCONSTSUB)(HV *stash, const char *name, SV *sv) { U32 oldhints = PL_hints; HV *old_cop_stash = PL_curcop->cop_stash; HV *old_curstash = PL_curstash; line_t oldline = PL_curcop->cop_line; PL_curcop->cop_line = D_PPP_PL_copline; PL_hints &= ~HINT_BLOCK_SCOPE; if (stash) PL_curstash = PL_curcop->cop_stash = stash; newSUB( #if (PERL_BCDVERSION < 0x5003022) start_subparse(), #elif (PERL_BCDVERSION == 0x5003022) start_subparse(0), #else /* 5.003_23 onwards */ start_subparse(FALSE, 0), #endif newSVOP(OP_CONST, 0, newSVpv((char *) name, 0)), newSVOP(OP_CONST, 0, &PL_sv_no), /* SvPV(&PL_sv_no) == "" -- GMB */ newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv)) ); PL_hints = oldhints; PL_curcop->cop_stash = old_cop_stash; PL_curstash = old_curstash; PL_curcop->cop_line = oldline; } #endif #endif /* * Boilerplate macros for initializing and accessing interpreter-local * data from C. All statics in extensions should be reworked to use * this, if you want to make the extension thread-safe. See ext/re/re.xs * for an example of the use of these macros. * * Code that uses these macros is responsible for the following: * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts" * 2. Declare a typedef named my_cxt_t that is a structure that contains * all the data that needs to be interpreter-local. * 3. Use the START_MY_CXT macro after the declaration of my_cxt_t. * 4. Use the MY_CXT_INIT macro such that it is called exactly once * (typically put in the BOOT: section). * 5. Use the members of the my_cxt_t structure everywhere as * MY_CXT.member. * 6. Use the dMY_CXT macro (a declaration) in all the functions that * access MY_CXT. */ #if defined(MULTIPLICITY) || defined(PERL_OBJECT) || \ defined(PERL_CAPI) || defined(PERL_IMPLICIT_CONTEXT) #ifndef START_MY_CXT /* This must appear in all extensions that define a my_cxt_t structure, * right after the definition (i.e. at file scope). The non-threads * case below uses it to declare the data as static. */ #define START_MY_CXT #if (PERL_BCDVERSION < 0x5004068) /* Fetches the SV that keeps the per-interpreter data. */ #define dMY_CXT_SV \ SV *my_cxt_sv = get_sv(MY_CXT_KEY, FALSE) #else /* >= perl5.004_68 */ #define dMY_CXT_SV \ SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY, \ sizeof(MY_CXT_KEY)-1, TRUE) #endif /* < perl5.004_68 */ /* This declaration should be used within all functions that use the * interpreter-local data. */ #define dMY_CXT \ dMY_CXT_SV; \ my_cxt_t *my_cxtp = INT2PTR(my_cxt_t*,SvUV(my_cxt_sv)) /* Creates and zeroes the per-interpreter data. * (We allocate my_cxtp in a Perl SV so that it will be released when * the interpreter goes away.) */ #define MY_CXT_INIT \ dMY_CXT_SV; \ /* newSV() allocates one more than needed */ \ my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\ Zero(my_cxtp, 1, my_cxt_t); \ sv_setuv(my_cxt_sv, PTR2UV(my_cxtp)) /* This macro must be used to access members of the my_cxt_t structure. * e.g. MYCXT.some_data */ #define MY_CXT (*my_cxtp) /* Judicious use of these macros can reduce the number of times dMY_CXT * is used. Use is similar to pTHX, aTHX etc. */ #define pMY_CXT my_cxt_t *my_cxtp #define pMY_CXT_ pMY_CXT, #define _pMY_CXT ,pMY_CXT #define aMY_CXT my_cxtp #define aMY_CXT_ aMY_CXT, #define _aMY_CXT ,aMY_CXT #endif /* START_MY_CXT */ #ifndef MY_CXT_CLONE /* Clones the per-interpreter data. */ #define MY_CXT_CLONE \ dMY_CXT_SV; \ my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\ Copy(INT2PTR(my_cxt_t*, SvUV(my_cxt_sv)), my_cxtp, 1, my_cxt_t);\ sv_setuv(my_cxt_sv, PTR2UV(my_cxtp)) #endif #else /* single interpreter */ #ifndef START_MY_CXT #define START_MY_CXT static my_cxt_t my_cxt; #define dMY_CXT_SV dNOOP #define dMY_CXT dNOOP #define MY_CXT_INIT NOOP #define MY_CXT my_cxt #define pMY_CXT void #define pMY_CXT_ #define _pMY_CXT #define aMY_CXT #define aMY_CXT_ #define _aMY_CXT #endif /* START_MY_CXT */ #ifndef MY_CXT_CLONE #define MY_CXT_CLONE NOOP #endif #endif #ifndef IVdf # if IVSIZE == LONGSIZE # define IVdf "ld" # define UVuf "lu" # define UVof "lo" # define UVxf "lx" # define UVXf "lX" # else # if IVSIZE == INTSIZE # define IVdf "d" # define UVuf "u" # define UVof "o" # define UVxf "x" # define UVXf "X" # endif # endif #endif #ifndef NVef # if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \ defined(PERL_PRIfldbl) && (PERL_BCDVERSION != 0x5006000) /* Not very likely, but let's try anyway. */ # define NVef PERL_PRIeldbl # define NVff PERL_PRIfldbl # define NVgf PERL_PRIgldbl # else # define NVef "e" # define NVff "f" # define NVgf "g" # endif #endif #ifndef SvREFCNT_inc # ifdef PERL_USE_GCC_BRACE_GROUPS # define SvREFCNT_inc(sv) \ ({ \ SV * const _sv = (SV*)(sv); \ if (_sv) \ (SvREFCNT(_sv))++; \ _sv; \ }) # else # define SvREFCNT_inc(sv) \ ((PL_Sv=(SV*)(sv)) ? (++(SvREFCNT(PL_Sv)),PL_Sv) : NULL) # endif #endif #ifndef SvREFCNT_inc_simple # ifdef PERL_USE_GCC_BRACE_GROUPS # define SvREFCNT_inc_simple(sv) \ ({ \ if (sv) \ (SvREFCNT(sv))++; \ (SV *)(sv); \ }) # else # define SvREFCNT_inc_simple(sv) \ ((sv) ? (SvREFCNT(sv)++,(SV*)(sv)) : NULL) # endif #endif #ifndef SvREFCNT_inc_NN # ifdef PERL_USE_GCC_BRACE_GROUPS # define SvREFCNT_inc_NN(sv) \ ({ \ SV * const _sv = (SV*)(sv); \ SvREFCNT(_sv)++; \ _sv; \ }) # else # define SvREFCNT_inc_NN(sv) \ (PL_Sv=(SV*)(sv),++(SvREFCNT(PL_Sv)),PL_Sv) # endif #endif #ifndef SvREFCNT_inc_void # ifdef PERL_USE_GCC_BRACE_GROUPS # define SvREFCNT_inc_void(sv) \ ({ \ SV * const _sv = (SV*)(sv); \ if (_sv) \ (void)(SvREFCNT(_sv)++); \ }) # else # define SvREFCNT_inc_void(sv) \ (void)((PL_Sv=(SV*)(sv)) ? ++(SvREFCNT(PL_Sv)) : 0) # endif #endif #ifndef SvREFCNT_inc_simple_void # define SvREFCNT_inc_simple_void(sv) STMT_START { if (sv) SvREFCNT(sv)++; } STMT_END #endif #ifndef SvREFCNT_inc_simple_NN # define SvREFCNT_inc_simple_NN(sv) (++SvREFCNT(sv), (SV*)(sv)) #endif #ifndef SvREFCNT_inc_void_NN # define SvREFCNT_inc_void_NN(sv) (void)(++SvREFCNT((SV*)(sv))) #endif #ifndef SvREFCNT_inc_simple_void_NN # define SvREFCNT_inc_simple_void_NN(sv) (void)(++SvREFCNT((SV*)(sv))) #endif #ifndef newSV_type #if defined(NEED_newSV_type) static SV* DPPP_(my_newSV_type)(pTHX_ svtype const t); static #else extern SV* DPPP_(my_newSV_type)(pTHX_ svtype const t); #endif #ifdef newSV_type # undef newSV_type #endif #define newSV_type(a) DPPP_(my_newSV_type)(aTHX_ a) #define Perl_newSV_type DPPP_(my_newSV_type) #if defined(NEED_newSV_type) || defined(NEED_newSV_type_GLOBAL) SV* DPPP_(my_newSV_type)(pTHX_ svtype const t) { SV* const sv = newSV(0); sv_upgrade(sv, t); return sv; } #endif #endif #if (PERL_BCDVERSION < 0x5006000) # define D_PPP_CONSTPV_ARG(x) ((char *) (x)) #else # define D_PPP_CONSTPV_ARG(x) (x) #endif #ifndef newSVpvn # define newSVpvn(data,len) ((data) \ ? ((len) ? newSVpv((data), (len)) : newSVpv("", 0)) \ : newSV(0)) #endif #ifndef newSVpvn_utf8 # define newSVpvn_utf8(s, len, u) newSVpvn_flags((s), (len), (u) ? SVf_UTF8 : 0) #endif #ifndef SVf_UTF8 # define SVf_UTF8 0 #endif #ifndef newSVpvn_flags #if defined(NEED_newSVpvn_flags) static SV * DPPP_(my_newSVpvn_flags)(pTHX_ const char *s, STRLEN len, U32 flags); static #else extern SV * DPPP_(my_newSVpvn_flags)(pTHX_ const char *s, STRLEN len, U32 flags); #endif #ifdef newSVpvn_flags # undef newSVpvn_flags #endif #define newSVpvn_flags(a,b,c) DPPP_(my_newSVpvn_flags)(aTHX_ a,b,c) #define Perl_newSVpvn_flags DPPP_(my_newSVpvn_flags) #if defined(NEED_newSVpvn_flags) || defined(NEED_newSVpvn_flags_GLOBAL) SV * DPPP_(my_newSVpvn_flags)(pTHX_ const char *s, STRLEN len, U32 flags) { SV *sv = newSVpvn(D_PPP_CONSTPV_ARG(s), len); SvFLAGS(sv) |= (flags & SVf_UTF8); return (flags & SVs_TEMP) ? sv_2mortal(sv) : sv; } #endif #endif /* Backwards compatibility stuff... :-( */ #if !defined(NEED_sv_2pv_flags) && defined(NEED_sv_2pv_nolen) # define NEED_sv_2pv_flags #endif #if !defined(NEED_sv_2pv_flags_GLOBAL) && defined(NEED_sv_2pv_nolen_GLOBAL) # define NEED_sv_2pv_flags_GLOBAL #endif /* Hint: sv_2pv_nolen * Use the SvPV_nolen() or SvPV_nolen_const() macros instead of sv_2pv_nolen(). */ #ifndef sv_2pv_nolen # define sv_2pv_nolen(sv) SvPV_nolen(sv) #endif #ifdef SvPVbyte /* Hint: SvPVbyte * Does not work in perl-5.6.1, ppport.h implements a version * borrowed from perl-5.7.3. */ #if (PERL_BCDVERSION < 0x5007000) #if defined(NEED_sv_2pvbyte) static char * DPPP_(my_sv_2pvbyte)(pTHX_ SV *sv, STRLEN *lp); static #else extern char * DPPP_(my_sv_2pvbyte)(pTHX_ SV *sv, STRLEN *lp); #endif #ifdef sv_2pvbyte # undef sv_2pvbyte #endif #define sv_2pvbyte(a,b) DPPP_(my_sv_2pvbyte)(aTHX_ a,b) #define Perl_sv_2pvbyte DPPP_(my_sv_2pvbyte) #if defined(NEED_sv_2pvbyte) || defined(NEED_sv_2pvbyte_GLOBAL) char * DPPP_(my_sv_2pvbyte)(pTHX_ SV *sv, STRLEN *lp) { sv_utf8_downgrade(sv,0); return SvPV(sv,*lp); } #endif /* Hint: sv_2pvbyte * Use the SvPVbyte() macro instead of sv_2pvbyte(). */ #undef SvPVbyte #define SvPVbyte(sv, lp) \ ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK) \ ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_2pvbyte(sv, &lp)) #endif #else # define SvPVbyte SvPV # define sv_2pvbyte sv_2pv #endif #ifndef sv_2pvbyte_nolen # define sv_2pvbyte_nolen(sv) sv_2pv_nolen(sv) #endif /* Hint: sv_pvn * Always use the SvPV() macro instead of sv_pvn(). */ /* Hint: sv_pvn_force * Always use the SvPV_force() macro instead of sv_pvn_force(). */ /* If these are undefined, they're not handled by the core anyway */ #ifndef SV_IMMEDIATE_UNREF # define SV_IMMEDIATE_UNREF 0 #endif #ifndef SV_GMAGIC # define SV_GMAGIC 0 #endif #ifndef SV_COW_DROP_PV # define SV_COW_DROP_PV 0 #endif #ifndef SV_UTF8_NO_ENCODING # define SV_UTF8_NO_ENCODING 0 #endif #ifndef SV_NOSTEAL # define SV_NOSTEAL 0 #endif #ifndef SV_CONST_RETURN # define SV_CONST_RETURN 0 #endif #ifndef SV_MUTABLE_RETURN # define SV_MUTABLE_RETURN 0 #endif #ifndef SV_SMAGIC # define SV_SMAGIC 0 #endif #ifndef SV_HAS_TRAILING_NUL # define SV_HAS_TRAILING_NUL 0 #endif #ifndef SV_COW_SHARED_HASH_KEYS # define SV_COW_SHARED_HASH_KEYS 0 #endif #if (PERL_BCDVERSION < 0x5007002) #if defined(NEED_sv_2pv_flags) static char * DPPP_(my_sv_2pv_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags); static #else extern char * DPPP_(my_sv_2pv_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags); #endif #ifdef sv_2pv_flags # undef sv_2pv_flags #endif #define sv_2pv_flags(a,b,c) DPPP_(my_sv_2pv_flags)(aTHX_ a,b,c) #define Perl_sv_2pv_flags DPPP_(my_sv_2pv_flags) #if defined(NEED_sv_2pv_flags) || defined(NEED_sv_2pv_flags_GLOBAL) char * DPPP_(my_sv_2pv_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags) { STRLEN n_a = (STRLEN) flags; return sv_2pv(sv, lp ? lp : &n_a); } #endif #if defined(NEED_sv_pvn_force_flags) static char * DPPP_(my_sv_pvn_force_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags); static #else extern char * DPPP_(my_sv_pvn_force_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags); #endif #ifdef sv_pvn_force_flags # undef sv_pvn_force_flags #endif #define sv_pvn_force_flags(a,b,c) DPPP_(my_sv_pvn_force_flags)(aTHX_ a,b,c) #define Perl_sv_pvn_force_flags DPPP_(my_sv_pvn_force_flags) #if defined(NEED_sv_pvn_force_flags) || defined(NEED_sv_pvn_force_flags_GLOBAL) char * DPPP_(my_sv_pvn_force_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags) { STRLEN n_a = (STRLEN) flags; return sv_pvn_force(sv, lp ? lp : &n_a); } #endif #endif #if (PERL_BCDVERSION < 0x5008008) || ( (PERL_BCDVERSION >= 0x5009000) && (PERL_BCDVERSION < 0x5009003) ) # define DPPP_SVPV_NOLEN_LP_ARG &PL_na #else # define DPPP_SVPV_NOLEN_LP_ARG 0 #endif #ifndef SvPV_const # define SvPV_const(sv, lp) SvPV_flags_const(sv, lp, SV_GMAGIC) #endif #ifndef SvPV_mutable # define SvPV_mutable(sv, lp) SvPV_flags_mutable(sv, lp, SV_GMAGIC) #endif #ifndef SvPV_flags # define SvPV_flags(sv, lp, flags) \ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_2pv_flags(sv, &lp, flags)) #endif #ifndef SvPV_flags_const # define SvPV_flags_const(sv, lp, flags) \ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ? ((lp = SvCUR(sv)), SvPVX_const(sv)) : \ (const char*) sv_2pv_flags(sv, &lp, flags|SV_CONST_RETURN)) #endif #ifndef SvPV_flags_const_nolen # define SvPV_flags_const_nolen(sv, flags) \ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ? SvPVX_const(sv) : \ (const char*) sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, flags|SV_CONST_RETURN)) #endif #ifndef SvPV_flags_mutable # define SvPV_flags_mutable(sv, lp, flags) \ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ? ((lp = SvCUR(sv)), SvPVX_mutable(sv)) : \ sv_2pv_flags(sv, &lp, flags|SV_MUTABLE_RETURN)) #endif #ifndef SvPV_force # define SvPV_force(sv, lp) SvPV_force_flags(sv, lp, SV_GMAGIC) #endif #ifndef SvPV_force_nolen # define SvPV_force_nolen(sv) SvPV_force_flags_nolen(sv, SV_GMAGIC) #endif #ifndef SvPV_force_mutable # define SvPV_force_mutable(sv, lp) SvPV_force_flags_mutable(sv, lp, SV_GMAGIC) #endif #ifndef SvPV_force_nomg # define SvPV_force_nomg(sv, lp) SvPV_force_flags(sv, lp, 0) #endif #ifndef SvPV_force_nomg_nolen # define SvPV_force_nomg_nolen(sv) SvPV_force_flags_nolen(sv, 0) #endif #ifndef SvPV_force_flags # define SvPV_force_flags(sv, lp, flags) \ ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \ ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_pvn_force_flags(sv, &lp, flags)) #endif #ifndef SvPV_force_flags_nolen # define SvPV_force_flags_nolen(sv, flags) \ ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \ ? SvPVX(sv) : sv_pvn_force_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, flags)) #endif #ifndef SvPV_force_flags_mutable # define SvPV_force_flags_mutable(sv, lp, flags) \ ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \ ? ((lp = SvCUR(sv)), SvPVX_mutable(sv)) \ : sv_pvn_force_flags(sv, &lp, flags|SV_MUTABLE_RETURN)) #endif #ifndef SvPV_nolen # define SvPV_nolen(sv) \ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ? SvPVX(sv) : sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, SV_GMAGIC)) #endif #ifndef SvPV_nolen_const # define SvPV_nolen_const(sv) \ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ? SvPVX_const(sv) : sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, SV_GMAGIC|SV_CONST_RETURN)) #endif #ifndef SvPV_nomg # define SvPV_nomg(sv, lp) SvPV_flags(sv, lp, 0) #endif #ifndef SvPV_nomg_const # define SvPV_nomg_const(sv, lp) SvPV_flags_const(sv, lp, 0) #endif #ifndef SvPV_nomg_const_nolen # define SvPV_nomg_const_nolen(sv) SvPV_flags_const_nolen(sv, 0) #endif #ifndef SvPV_renew # define SvPV_renew(sv,n) STMT_START { SvLEN_set(sv, n); \ SvPV_set((sv), (char *) saferealloc( \ (Malloc_t)SvPVX(sv), (MEM_SIZE)((n)))); \ } STMT_END #endif #ifndef SvMAGIC_set # define SvMAGIC_set(sv, val) \ STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \ (((XPVMG*) SvANY(sv))->xmg_magic = (val)); } STMT_END #endif #if (PERL_BCDVERSION < 0x5009003) #ifndef SvPVX_const # define SvPVX_const(sv) ((const char*) (0 + SvPVX(sv))) #endif #ifndef SvPVX_mutable # define SvPVX_mutable(sv) (0 + SvPVX(sv)) #endif #ifndef SvRV_set # define SvRV_set(sv, val) \ STMT_START { assert(SvTYPE(sv) >= SVt_RV); \ (((XRV*) SvANY(sv))->xrv_rv = (val)); } STMT_END #endif #else #ifndef SvPVX_const # define SvPVX_const(sv) ((const char*)((sv)->sv_u.svu_pv)) #endif #ifndef SvPVX_mutable # define SvPVX_mutable(sv) ((sv)->sv_u.svu_pv) #endif #ifndef SvRV_set # define SvRV_set(sv, val) \ STMT_START { assert(SvTYPE(sv) >= SVt_RV); \ ((sv)->sv_u.svu_rv = (val)); } STMT_END #endif #endif #ifndef SvSTASH_set # define SvSTASH_set(sv, val) \ STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \ (((XPVMG*) SvANY(sv))->xmg_stash = (val)); } STMT_END #endif #if (PERL_BCDVERSION < 0x5004000) #ifndef SvUV_set # define SvUV_set(sv, val) \ STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \ (((XPVIV*) SvANY(sv))->xiv_iv = (IV) (val)); } STMT_END #endif #else #ifndef SvUV_set # define SvUV_set(sv, val) \ STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \ (((XPVUV*) SvANY(sv))->xuv_uv = (val)); } STMT_END #endif #endif #if (PERL_BCDVERSION >= 0x5004000) && !defined(vnewSVpvf) #if defined(NEED_vnewSVpvf) static SV * DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args); static #else extern SV * DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args); #endif #ifdef vnewSVpvf # undef vnewSVpvf #endif #define vnewSVpvf(a,b) DPPP_(my_vnewSVpvf)(aTHX_ a,b) #define Perl_vnewSVpvf DPPP_(my_vnewSVpvf) #if defined(NEED_vnewSVpvf) || defined(NEED_vnewSVpvf_GLOBAL) SV * DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args) { register SV *sv = newSV(0); sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); return sv; } #endif #endif #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vcatpvf) # define sv_vcatpvf(sv, pat, args) sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)) #endif #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vsetpvf) # define sv_vsetpvf(sv, pat, args) sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)) #endif #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_catpvf_mg) #if defined(NEED_sv_catpvf_mg) static void DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...); static #else extern void DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...); #endif #define Perl_sv_catpvf_mg DPPP_(my_sv_catpvf_mg) #if defined(NEED_sv_catpvf_mg) || defined(NEED_sv_catpvf_mg_GLOBAL) void DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...) { va_list args; va_start(args, pat); sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); SvSETMAGIC(sv); va_end(args); } #endif #endif #ifdef PERL_IMPLICIT_CONTEXT #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_catpvf_mg_nocontext) #if defined(NEED_sv_catpvf_mg_nocontext) static void DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...); static #else extern void DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...); #endif #define sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext) #define Perl_sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext) #if defined(NEED_sv_catpvf_mg_nocontext) || defined(NEED_sv_catpvf_mg_nocontext_GLOBAL) void DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...) { dTHX; va_list args; va_start(args, pat); sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); SvSETMAGIC(sv); va_end(args); } #endif #endif #endif /* sv_catpvf_mg depends on sv_catpvf_mg_nocontext */ #ifndef sv_catpvf_mg # ifdef PERL_IMPLICIT_CONTEXT # define sv_catpvf_mg Perl_sv_catpvf_mg_nocontext # else # define sv_catpvf_mg Perl_sv_catpvf_mg # endif #endif #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vcatpvf_mg) # define sv_vcatpvf_mg(sv, pat, args) \ STMT_START { \ sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); \ SvSETMAGIC(sv); \ } STMT_END #endif #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_setpvf_mg) #if defined(NEED_sv_setpvf_mg) static void DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...); static #else extern void DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...); #endif #define Perl_sv_setpvf_mg DPPP_(my_sv_setpvf_mg) #if defined(NEED_sv_setpvf_mg) || defined(NEED_sv_setpvf_mg_GLOBAL) void DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...) { va_list args; va_start(args, pat); sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); SvSETMAGIC(sv); va_end(args); } #endif #endif #ifdef PERL_IMPLICIT_CONTEXT #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_setpvf_mg_nocontext) #if defined(NEED_sv_setpvf_mg_nocontext) static void DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...); static #else extern void DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...); #endif #define sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext) #define Perl_sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext) #if defined(NEED_sv_setpvf_mg_nocontext) || defined(NEED_sv_setpvf_mg_nocontext_GLOBAL) void DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...) { dTHX; va_list args; va_start(args, pat); sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); SvSETMAGIC(sv); va_end(args); } #endif #endif #endif /* sv_setpvf_mg depends on sv_setpvf_mg_nocontext */ #ifndef sv_setpvf_mg # ifdef PERL_IMPLICIT_CONTEXT # define sv_setpvf_mg Perl_sv_setpvf_mg_nocontext # else # define sv_setpvf_mg Perl_sv_setpvf_mg # endif #endif #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vsetpvf_mg) # define sv_vsetpvf_mg(sv, pat, args) \ STMT_START { \ sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); \ SvSETMAGIC(sv); \ } STMT_END #endif /* Hint: newSVpvn_share * The SVs created by this function only mimic the behaviour of * shared PVs without really being shared. Only use if you know * what you're doing. */ #ifndef newSVpvn_share #if defined(NEED_newSVpvn_share) static SV * DPPP_(my_newSVpvn_share)(pTHX_ const char *src, I32 len, U32 hash); static #else extern SV * DPPP_(my_newSVpvn_share)(pTHX_ const char *src, I32 len, U32 hash); #endif #ifdef newSVpvn_share # undef newSVpvn_share #endif #define newSVpvn_share(a,b,c) DPPP_(my_newSVpvn_share)(aTHX_ a,b,c) #define Perl_newSVpvn_share DPPP_(my_newSVpvn_share) #if defined(NEED_newSVpvn_share) || defined(NEED_newSVpvn_share_GLOBAL) SV * DPPP_(my_newSVpvn_share)(pTHX_ const char *src, I32 len, U32 hash) { SV *sv; if (len < 0) len = -len; if (!hash) PERL_HASH(hash, (char*) src, len); sv = newSVpvn((char *) src, len); sv_upgrade(sv, SVt_PVIV); SvIVX(sv) = hash; SvREADONLY_on(sv); SvPOK_on(sv); return sv; } #endif #endif #ifndef SvSHARED_HASH # define SvSHARED_HASH(sv) (0 + SvUVX(sv)) #endif #ifndef HvNAME_get # define HvNAME_get(hv) HvNAME(hv) #endif #ifndef HvNAMELEN_get # define HvNAMELEN_get(hv) (HvNAME_get(hv) ? (I32)strlen(HvNAME_get(hv)) : 0) #endif #ifndef GvSVn # define GvSVn(gv) GvSV(gv) #endif #ifndef isGV_with_GP # define isGV_with_GP(gv) isGV(gv) #endif #ifndef gv_fetchpvn_flags # define gv_fetchpvn_flags(name, len, flags, svt) gv_fetchpv(name, flags, svt) #endif #ifndef gv_fetchsv # define gv_fetchsv(name, flags, svt) gv_fetchpv(SvPV_nolen_const(name), flags, svt) #endif #ifndef get_cvn_flags # define get_cvn_flags(name, namelen, flags) get_cv(name, flags) #endif #ifndef WARN_ALL # define WARN_ALL 0 #endif #ifndef WARN_CLOSURE # define WARN_CLOSURE 1 #endif #ifndef WARN_DEPRECATED # define WARN_DEPRECATED 2 #endif #ifndef WARN_EXITING # define WARN_EXITING 3 #endif #ifndef WARN_GLOB # define WARN_GLOB 4 #endif #ifndef WARN_IO # define WARN_IO 5 #endif #ifndef WARN_CLOSED # define WARN_CLOSED 6 #endif #ifndef WARN_EXEC # define WARN_EXEC 7 #endif #ifndef WARN_LAYER # define WARN_LAYER 8 #endif #ifndef WARN_NEWLINE # define WARN_NEWLINE 9 #endif #ifndef WARN_PIPE # define WARN_PIPE 10 #endif #ifndef WARN_UNOPENED # define WARN_UNOPENED 11 #endif #ifndef WARN_MISC # define WARN_MISC 12 #endif #ifndef WARN_NUMERIC # define WARN_NUMERIC 13 #endif #ifndef WARN_ONCE # define WARN_ONCE 14 #endif #ifndef WARN_OVERFLOW # define WARN_OVERFLOW 15 #endif #ifndef WARN_PACK # define WARN_PACK 16 #endif #ifndef WARN_PORTABLE # define WARN_PORTABLE 17 #endif #ifndef WARN_RECURSION # define WARN_RECURSION 18 #endif #ifndef WARN_REDEFINE # define WARN_REDEFINE 19 #endif #ifndef WARN_REGEXP # define WARN_REGEXP 20 #endif #ifndef WARN_SEVERE # define WARN_SEVERE 21 #endif #ifndef WARN_DEBUGGING # define WARN_DEBUGGING 22 #endif #ifndef WARN_INPLACE # define WARN_INPLACE 23 #endif #ifndef WARN_INTERNAL # define WARN_INTERNAL 24 #endif #ifndef WARN_MALLOC # define WARN_MALLOC 25 #endif #ifndef WARN_SIGNAL # define WARN_SIGNAL 26 #endif #ifndef WARN_SUBSTR # define WARN_SUBSTR 27 #endif #ifndef WARN_SYNTAX # define WARN_SYNTAX 28 #endif #ifndef WARN_AMBIGUOUS # define WARN_AMBIGUOUS 29 #endif #ifndef WARN_BAREWORD # define WARN_BAREWORD 30 #endif #ifndef WARN_DIGIT # define WARN_DIGIT 31 #endif #ifndef WARN_PARENTHESIS # define WARN_PARENTHESIS 32 #endif #ifndef WARN_PRECEDENCE # define WARN_PRECEDENCE 33 #endif #ifndef WARN_PRINTF # define WARN_PRINTF 34 #endif #ifndef WARN_PROTOTYPE # define WARN_PROTOTYPE 35 #endif #ifndef WARN_QW # define WARN_QW 36 #endif #ifndef WARN_RESERVED # define WARN_RESERVED 37 #endif #ifndef WARN_SEMICOLON # define WARN_SEMICOLON 38 #endif #ifndef WARN_TAINT # define WARN_TAINT 39 #endif #ifndef WARN_THREADS # define WARN_THREADS 40 #endif #ifndef WARN_UNINITIALIZED # define WARN_UNINITIALIZED 41 #endif #ifndef WARN_UNPACK # define WARN_UNPACK 42 #endif #ifndef WARN_UNTIE # define WARN_UNTIE 43 #endif #ifndef WARN_UTF8 # define WARN_UTF8 44 #endif #ifndef WARN_VOID # define WARN_VOID 45 #endif #ifndef WARN_ASSERTIONS # define WARN_ASSERTIONS 46 #endif #ifndef packWARN # define packWARN(a) (a) #endif #ifndef ckWARN # ifdef G_WARN_ON # define ckWARN(a) (PL_dowarn & G_WARN_ON) # else # define ckWARN(a) PL_dowarn # endif #endif #if (PERL_BCDVERSION >= 0x5004000) && !defined(warner) #if defined(NEED_warner) static void DPPP_(my_warner)(U32 err, const char *pat, ...); static #else extern void DPPP_(my_warner)(U32 err, const char *pat, ...); #endif #define Perl_warner DPPP_(my_warner) #if defined(NEED_warner) || defined(NEED_warner_GLOBAL) void DPPP_(my_warner)(U32 err, const char *pat, ...) { SV *sv; va_list args; PERL_UNUSED_ARG(err); va_start(args, pat); sv = vnewSVpvf(pat, &args); va_end(args); sv_2mortal(sv); warn("%s", SvPV_nolen(sv)); } #define warner Perl_warner #define Perl_warner_nocontext Perl_warner #endif #endif /* concatenating with "" ensures that only literal strings are accepted as argument * note that STR_WITH_LEN() can't be used as argument to macros or functions that * under some configurations might be macros */ #ifndef STR_WITH_LEN # define STR_WITH_LEN(s) (s ""), (sizeof(s)-1) #endif #ifndef newSVpvs # define newSVpvs(str) newSVpvn(str "", sizeof(str) - 1) #endif #ifndef newSVpvs_flags # define newSVpvs_flags(str, flags) newSVpvn_flags(str "", sizeof(str) - 1, flags) #endif #ifndef newSVpvs_share # define newSVpvs_share(str) newSVpvn_share(str "", sizeof(str) - 1, 0) #endif #ifndef sv_catpvs # define sv_catpvs(sv, str) sv_catpvn(sv, str "", sizeof(str) - 1) #endif #ifndef sv_setpvs # define sv_setpvs(sv, str) sv_setpvn(sv, str "", sizeof(str) - 1) #endif #ifndef hv_fetchs # define hv_fetchs(hv, key, lval) hv_fetch(hv, key "", sizeof(key) - 1, lval) #endif #ifndef hv_stores # define hv_stores(hv, key, val) hv_store(hv, key "", sizeof(key) - 1, val, 0) #endif #ifndef gv_fetchpvs # define gv_fetchpvs(name, flags, svt) gv_fetchpvn_flags(name "", sizeof(name) - 1, flags, svt) #endif #ifndef gv_stashpvs # define gv_stashpvs(name, flags) gv_stashpvn(name "", sizeof(name) - 1, flags) #endif #ifndef get_cvs # define get_cvs(name, flags) get_cvn_flags(name "", sizeof(name)-1, flags) #endif #ifndef SvGETMAGIC # define SvGETMAGIC(x) STMT_START { if (SvGMAGICAL(x)) mg_get(x); } STMT_END #endif #ifndef PERL_MAGIC_sv # define PERL_MAGIC_sv '\0' #endif #ifndef PERL_MAGIC_overload # define PERL_MAGIC_overload 'A' #endif #ifndef PERL_MAGIC_overload_elem # define PERL_MAGIC_overload_elem 'a' #endif #ifndef PERL_MAGIC_overload_table # define PERL_MAGIC_overload_table 'c' #endif #ifndef PERL_MAGIC_bm # define PERL_MAGIC_bm 'B' #endif #ifndef PERL_MAGIC_regdata # define PERL_MAGIC_regdata 'D' #endif #ifndef PERL_MAGIC_regdatum # define PERL_MAGIC_regdatum 'd' #endif #ifndef PERL_MAGIC_env # define PERL_MAGIC_env 'E' #endif #ifndef PERL_MAGIC_envelem # define PERL_MAGIC_envelem 'e' #endif #ifndef PERL_MAGIC_fm # define PERL_MAGIC_fm 'f' #endif #ifndef PERL_MAGIC_regex_global # define PERL_MAGIC_regex_global 'g' #endif #ifndef PERL_MAGIC_isa # define PERL_MAGIC_isa 'I' #endif #ifndef PERL_MAGIC_isaelem # define PERL_MAGIC_isaelem 'i' #endif #ifndef PERL_MAGIC_nkeys # define PERL_MAGIC_nkeys 'k' #endif #ifndef PERL_MAGIC_dbfile # define PERL_MAGIC_dbfile 'L' #endif #ifndef PERL_MAGIC_dbline # define PERL_MAGIC_dbline 'l' #endif #ifndef PERL_MAGIC_mutex # define PERL_MAGIC_mutex 'm' #endif #ifndef PERL_MAGIC_shared # define PERL_MAGIC_shared 'N' #endif #ifndef PERL_MAGIC_shared_scalar # define PERL_MAGIC_shared_scalar 'n' #endif #ifndef PERL_MAGIC_collxfrm # define PERL_MAGIC_collxfrm 'o' #endif #ifndef PERL_MAGIC_tied # define PERL_MAGIC_tied 'P' #endif #ifndef PERL_MAGIC_tiedelem # define PERL_MAGIC_tiedelem 'p' #endif #ifndef PERL_MAGIC_tiedscalar # define PERL_MAGIC_tiedscalar 'q' #endif #ifndef PERL_MAGIC_qr # define PERL_MAGIC_qr 'r' #endif #ifndef PERL_MAGIC_sig # define PERL_MAGIC_sig 'S' #endif #ifndef PERL_MAGIC_sigelem # define PERL_MAGIC_sigelem 's' #endif #ifndef PERL_MAGIC_taint # define PERL_MAGIC_taint 't' #endif #ifndef PERL_MAGIC_uvar # define PERL_MAGIC_uvar 'U' #endif #ifndef PERL_MAGIC_uvar_elem # define PERL_MAGIC_uvar_elem 'u' #endif #ifndef PERL_MAGIC_vstring # define PERL_MAGIC_vstring 'V' #endif #ifndef PERL_MAGIC_vec # define PERL_MAGIC_vec 'v' #endif #ifndef PERL_MAGIC_utf8 # define PERL_MAGIC_utf8 'w' #endif #ifndef PERL_MAGIC_substr # define PERL_MAGIC_substr 'x' #endif #ifndef PERL_MAGIC_defelem # define PERL_MAGIC_defelem 'y' #endif #ifndef PERL_MAGIC_glob # define PERL_MAGIC_glob '*' #endif #ifndef PERL_MAGIC_arylen # define PERL_MAGIC_arylen '#' #endif #ifndef PERL_MAGIC_pos # define PERL_MAGIC_pos '.' #endif #ifndef PERL_MAGIC_backref # define PERL_MAGIC_backref '<' #endif #ifndef PERL_MAGIC_ext # define PERL_MAGIC_ext '~' #endif /* That's the best we can do... */ #ifndef sv_catpvn_nomg # define sv_catpvn_nomg sv_catpvn #endif #ifndef sv_catsv_nomg # define sv_catsv_nomg sv_catsv #endif #ifndef sv_setsv_nomg # define sv_setsv_nomg sv_setsv #endif #ifndef sv_pvn_nomg # define sv_pvn_nomg sv_pvn #endif #ifndef SvIV_nomg # define SvIV_nomg SvIV #endif #ifndef SvUV_nomg # define SvUV_nomg SvUV #endif #ifndef sv_catpv_mg # define sv_catpv_mg(sv, ptr) \ STMT_START { \ SV *TeMpSv = sv; \ sv_catpv(TeMpSv,ptr); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_catpvn_mg # define sv_catpvn_mg(sv, ptr, len) \ STMT_START { \ SV *TeMpSv = sv; \ sv_catpvn(TeMpSv,ptr,len); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_catsv_mg # define sv_catsv_mg(dsv, ssv) \ STMT_START { \ SV *TeMpSv = dsv; \ sv_catsv(TeMpSv,ssv); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_setiv_mg # define sv_setiv_mg(sv, i) \ STMT_START { \ SV *TeMpSv = sv; \ sv_setiv(TeMpSv,i); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_setnv_mg # define sv_setnv_mg(sv, num) \ STMT_START { \ SV *TeMpSv = sv; \ sv_setnv(TeMpSv,num); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_setpv_mg # define sv_setpv_mg(sv, ptr) \ STMT_START { \ SV *TeMpSv = sv; \ sv_setpv(TeMpSv,ptr); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_setpvn_mg # define sv_setpvn_mg(sv, ptr, len) \ STMT_START { \ SV *TeMpSv = sv; \ sv_setpvn(TeMpSv,ptr,len); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_setsv_mg # define sv_setsv_mg(dsv, ssv) \ STMT_START { \ SV *TeMpSv = dsv; \ sv_setsv(TeMpSv,ssv); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_setuv_mg # define sv_setuv_mg(sv, i) \ STMT_START { \ SV *TeMpSv = sv; \ sv_setuv(TeMpSv,i); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_usepvn_mg # define sv_usepvn_mg(sv, ptr, len) \ STMT_START { \ SV *TeMpSv = sv; \ sv_usepvn(TeMpSv,ptr,len); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef SvVSTRING_mg # define SvVSTRING_mg(sv) (SvMAGICAL(sv) ? mg_find(sv, PERL_MAGIC_vstring) : NULL) #endif /* Hint: sv_magic_portable * This is a compatibility function that is only available with * Devel::PPPort. It is NOT in the perl core. * Its purpose is to mimic the 5.8.0 behaviour of sv_magic() when * it is being passed a name pointer with namlen == 0. In that * case, perl 5.8.0 and later store the pointer, not a copy of it. * The compatibility can be provided back to perl 5.004. With * earlier versions, the code will not compile. */ #if (PERL_BCDVERSION < 0x5004000) /* code that uses sv_magic_portable will not compile */ #elif (PERL_BCDVERSION < 0x5008000) # define sv_magic_portable(sv, obj, how, name, namlen) \ STMT_START { \ SV *SvMp_sv = (sv); \ char *SvMp_name = (char *) (name); \ I32 SvMp_namlen = (namlen); \ if (SvMp_name && SvMp_namlen == 0) \ { \ MAGIC *mg; \ sv_magic(SvMp_sv, obj, how, 0, 0); \ mg = SvMAGIC(SvMp_sv); \ mg->mg_len = -42; /* XXX: this is the tricky part */ \ mg->mg_ptr = SvMp_name; \ } \ else \ { \ sv_magic(SvMp_sv, obj, how, SvMp_name, SvMp_namlen); \ } \ } STMT_END #else # define sv_magic_portable(a, b, c, d, e) sv_magic(a, b, c, d, e) #endif #ifdef USE_ITHREADS #ifndef CopFILE # define CopFILE(c) ((c)->cop_file) #endif #ifndef CopFILEGV # define CopFILEGV(c) (CopFILE(c) ? gv_fetchfile(CopFILE(c)) : Nullgv) #endif #ifndef CopFILE_set # define CopFILE_set(c,pv) ((c)->cop_file = savepv(pv)) #endif #ifndef CopFILESV # define CopFILESV(c) (CopFILE(c) ? GvSV(gv_fetchfile(CopFILE(c))) : Nullsv) #endif #ifndef CopFILEAV # define CopFILEAV(c) (CopFILE(c) ? GvAV(gv_fetchfile(CopFILE(c))) : Nullav) #endif #ifndef CopSTASHPV # define CopSTASHPV(c) ((c)->cop_stashpv) #endif #ifndef CopSTASHPV_set # define CopSTASHPV_set(c,pv) ((c)->cop_stashpv = ((pv) ? savepv(pv) : Nullch)) #endif #ifndef CopSTASH # define CopSTASH(c) (CopSTASHPV(c) ? gv_stashpv(CopSTASHPV(c),GV_ADD) : Nullhv) #endif #ifndef CopSTASH_set # define CopSTASH_set(c,hv) CopSTASHPV_set(c, (hv) ? HvNAME(hv) : Nullch) #endif #ifndef CopSTASH_eq # define CopSTASH_eq(c,hv) ((hv) && (CopSTASHPV(c) == HvNAME(hv) \ || (CopSTASHPV(c) && HvNAME(hv) \ && strEQ(CopSTASHPV(c), HvNAME(hv))))) #endif #else #ifndef CopFILEGV # define CopFILEGV(c) ((c)->cop_filegv) #endif #ifndef CopFILEGV_set # define CopFILEGV_set(c,gv) ((c)->cop_filegv = (GV*)SvREFCNT_inc(gv)) #endif #ifndef CopFILE_set # define CopFILE_set(c,pv) CopFILEGV_set((c), gv_fetchfile(pv)) #endif #ifndef CopFILESV # define CopFILESV(c) (CopFILEGV(c) ? GvSV(CopFILEGV(c)) : Nullsv) #endif #ifndef CopFILEAV # define CopFILEAV(c) (CopFILEGV(c) ? GvAV(CopFILEGV(c)) : Nullav) #endif #ifndef CopFILE # define CopFILE(c) (CopFILESV(c) ? SvPVX(CopFILESV(c)) : Nullch) #endif #ifndef CopSTASH # define CopSTASH(c) ((c)->cop_stash) #endif #ifndef CopSTASH_set # define CopSTASH_set(c,hv) ((c)->cop_stash = (hv)) #endif #ifndef CopSTASHPV # define CopSTASHPV(c) (CopSTASH(c) ? HvNAME(CopSTASH(c)) : Nullch) #endif #ifndef CopSTASHPV_set # define CopSTASHPV_set(c,pv) CopSTASH_set((c), gv_stashpv(pv,GV_ADD)) #endif #ifndef CopSTASH_eq # define CopSTASH_eq(c,hv) (CopSTASH(c) == (hv)) #endif #endif /* USE_ITHREADS */ #ifndef IN_PERL_COMPILETIME # define IN_PERL_COMPILETIME (PL_curcop == &PL_compiling) #endif #ifndef IN_LOCALE_RUNTIME # define IN_LOCALE_RUNTIME (PL_curcop->op_private & HINT_LOCALE) #endif #ifndef IN_LOCALE_COMPILETIME # define IN_LOCALE_COMPILETIME (PL_hints & HINT_LOCALE) #endif #ifndef IN_LOCALE # define IN_LOCALE (IN_PERL_COMPILETIME ? IN_LOCALE_COMPILETIME : IN_LOCALE_RUNTIME) #endif #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 #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) #if defined(NEED_grok_numeric_radix) || defined(NEED_grok_numeric_radix_GLOBAL) 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 /* older perls don't have PL_numeric_radix_sv so the radix * must manually be requested from locale.h */ #include dTHR; /* needed for older threaded perls */ 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 /* USE_LOCALE_NUMERIC */ /* always try "." if numeric radix didn't match because * we may have data from different locales mixed */ 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 #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) #if defined(NEED_grok_number) || defined(NEED_grok_number_GLOBAL) 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; /* next must be digit or the radix separator or beginning of infinity */ if (isDIGIT(*s)) { /* UVs are at least 32 bits, so the first 9 decimal digits cannot overflow. */ UV value = *s - '0'; /* This construction seems to be more optimiser friendly. (without it gcc does the isDIGIT test and the *s - '0' separately) With it gcc on arm is managing 6 instructions (6 cycles) per digit. In theory the optimiser could deduce how far to unroll the loop before checking for overflow. */ if (++s < send) { int digit = *s - '0'; if (digit >= 0 && digit <= 9) { value = value * 10 + digit; if (++s < send) { digit = *s - '0'; if (digit >= 0 && digit <= 9) { value = value * 10 + digit; if (++s < send) { digit = *s - '0'; if (digit >= 0 && digit <= 9) { value = value * 10 + digit; if (++s < send) { digit = *s - '0'; if (digit >= 0 && digit <= 9) { value = value * 10 + digit; if (++s < send) { digit = *s - '0'; if (digit >= 0 && digit <= 9) { value = value * 10 + digit; if (++s < send) { digit = *s - '0'; if (digit >= 0 && digit <= 9) { value = value * 10 + digit; if (++s < send) { digit = *s - '0'; if (digit >= 0 && digit <= 9) { value = value * 10 + digit; if (++s < send) { digit = *s - '0'; if (digit >= 0 && digit <= 9) { value = value * 10 + digit; if (++s < send) { /* Now got 9 digits, so need to check each time for overflow. */ digit = *s - '0'; while (digit >= 0 && digit <= 9 && (value < max_div_10 || (value == max_div_10 && digit <= max_mod_10))) { value = value * 10 + digit; if (++s < send) digit = *s - '0'; else break; } if (digit >= 0 && digit <= 9 && (s < send)) { /* value overflowed. skip the remaining digits, don't worry about setting *valuep. */ do { s++; } while (s < send && isDIGIT(*s)); numtype |= IS_NUMBER_GREATER_THAN_UV_MAX; goto skip_value; } } } } } } } } } } } } } } } } } } numtype |= IS_NUMBER_IN_UV; if (valuep) *valuep = value; skip_value: if (GROK_NUMERIC_RADIX(&s, send)) { numtype |= IS_NUMBER_NOT_INT; while (s < send && isDIGIT(*s)) /* optional digits after the radix */ s++; } } else if (GROK_NUMERIC_RADIX(&s, send)) { numtype |= IS_NUMBER_NOT_INT | IS_NUMBER_IN_UV; /* valuep assigned below */ /* no digits before the radix means we need digits after it */ if (s < send && isDIGIT(*s)) { do { s++; } while (s < send && isDIGIT(*s)); if (valuep) { /* integer approximation is valid - it's 0. */ *valuep = 0; } } else return 0; } else if (*s == 'I' || *s == 'i') { s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; s++; if (s == send || (*s != 'F' && *s != 'f')) return 0; s++; if (s < send && (*s == 'I' || *s == 'i')) { s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; s++; if (s == send || (*s != 'I' && *s != 'i')) return 0; s++; if (s == send || (*s != 'T' && *s != 't')) return 0; s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0; s++; } sawinf = 1; } else if (*s == 'N' || *s == 'n') { /* XXX TODO: There are signaling NaNs and quiet NaNs. */ s++; if (s == send || (*s != 'A' && *s != 'a')) return 0; s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; s++; sawnan = 1; } else return 0; if (sawinf) { numtype &= IS_NUMBER_NEG; /* Keep track of sign */ numtype |= IS_NUMBER_INFINITY | IS_NUMBER_NOT_INT; } else if (sawnan) { numtype &= IS_NUMBER_NEG; /* Keep track of sign */ numtype |= IS_NUMBER_NAN | IS_NUMBER_NOT_INT; } else if (s < send) { /* we can have an optional exponent part */ if (*s == 'e' || *s == 'E') { /* The only flag we keep is sign. Blow away any "it's UV" */ numtype &= IS_NUMBER_NEG; numtype |= IS_NUMBER_NOT_INT; s++; if (s < send && (*s == '-' || *s == '+')) s++; if (s < send && isDIGIT(*s)) { do { s++; } while (s < send && isDIGIT(*s)); } else return 0; } } while (s < send && isSPACE(*s)) s++; if (s >= send) return numtype; if (len == 10 && memEQ(pv, "0 but true", 10)) { if (valuep) *valuep = 0; return IS_NUMBER_IN_UV; } return 0; } #endif #endif /* * The grok_* routines have been modified to use warn() instead of * Perl_warner(). Also, 'hexdigit' was the former name of PL_hexdigit, * which is why the stack variable has been renamed to 'xdigit'. */ #ifndef grok_bin #if defined(NEED_grok_bin) static UV DPPP_(my_grok_bin)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); static #else extern UV DPPP_(my_grok_bin)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); #endif #ifdef grok_bin # undef grok_bin #endif #define grok_bin(a,b,c,d) DPPP_(my_grok_bin)(aTHX_ a,b,c,d) #define Perl_grok_bin DPPP_(my_grok_bin) #if defined(NEED_grok_bin) || defined(NEED_grok_bin_GLOBAL) UV DPPP_(my_grok_bin)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) { const char *s = start; STRLEN len = *len_p; UV value = 0; NV value_nv = 0; const UV max_div_2 = UV_MAX / 2; bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; bool overflowed = FALSE; if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) { /* strip off leading b or 0b. for compatibility silently suffer "b" and "0b" as valid binary numbers. */ if (len >= 1) { if (s[0] == 'b') { s++; len--; } else if (len >= 2 && s[0] == '0' && s[1] == 'b') { s+=2; len-=2; } } } for (; len-- && *s; s++) { char bit = *s; if (bit == '0' || bit == '1') { /* Write it in this wonky order with a goto to attempt to get the compiler to make the common case integer-only loop pretty tight. With gcc seems to be much straighter code than old scan_bin. */ redo: if (!overflowed) { if (value <= max_div_2) { value = (value << 1) | (bit - '0'); continue; } /* Bah. We're just overflowed. */ warn("Integer overflow in binary number"); overflowed = TRUE; value_nv = (NV) value; } value_nv *= 2.0; /* If an NV has not enough bits in its mantissa to * represent a UV this summing of small low-order numbers * is a waste of time (because the NV cannot preserve * the low-order bits anyway): we could just remember when * did we overflow and in the end just multiply value_nv by the * right amount. */ value_nv += (NV)(bit - '0'); continue; } if (bit == '_' && len && allow_underscores && (bit = s[1]) && (bit == '0' || bit == '1')) { --len; ++s; goto redo; } if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) warn("Illegal binary digit '%c' ignored", *s); break; } if ( ( overflowed && value_nv > 4294967295.0) #if UVSIZE > 4 || (!overflowed && value > 0xffffffff ) #endif ) { warn("Binary number > 0b11111111111111111111111111111111 non-portable"); } *len_p = s - start; if (!overflowed) { *flags = 0; return value; } *flags = PERL_SCAN_GREATER_THAN_UV_MAX; if (result) *result = value_nv; return UV_MAX; } #endif #endif #ifndef grok_hex #if defined(NEED_grok_hex) static UV DPPP_(my_grok_hex)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); static #else extern UV DPPP_(my_grok_hex)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); #endif #ifdef grok_hex # undef grok_hex #endif #define grok_hex(a,b,c,d) DPPP_(my_grok_hex)(aTHX_ a,b,c,d) #define Perl_grok_hex DPPP_(my_grok_hex) #if defined(NEED_grok_hex) || defined(NEED_grok_hex_GLOBAL) UV DPPP_(my_grok_hex)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) { const char *s = start; STRLEN len = *len_p; UV value = 0; NV value_nv = 0; const UV max_div_16 = UV_MAX / 16; bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; bool overflowed = FALSE; const char *xdigit; if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) { /* strip off leading x or 0x. for compatibility silently suffer "x" and "0x" as valid hex numbers. */ if (len >= 1) { if (s[0] == 'x') { s++; len--; } else if (len >= 2 && s[0] == '0' && s[1] == 'x') { s+=2; len-=2; } } } for (; len-- && *s; s++) { xdigit = strchr((char *) PL_hexdigit, *s); if (xdigit) { /* Write it in this wonky order with a goto to attempt to get the compiler to make the common case integer-only loop pretty tight. With gcc seems to be much straighter code than old scan_hex. */ redo: if (!overflowed) { if (value <= max_div_16) { value = (value << 4) | ((xdigit - PL_hexdigit) & 15); continue; } warn("Integer overflow in hexadecimal number"); overflowed = TRUE; value_nv = (NV) value; } value_nv *= 16.0; /* If an NV has not enough bits in its mantissa to * represent a UV this summing of small low-order numbers * is a waste of time (because the NV cannot preserve * the low-order bits anyway): we could just remember when * did we overflow and in the end just multiply value_nv by the * right amount of 16-tuples. */ value_nv += (NV)((xdigit - PL_hexdigit) & 15); continue; } if (*s == '_' && len && allow_underscores && s[1] && (xdigit = strchr((char *) PL_hexdigit, s[1]))) { --len; ++s; goto redo; } if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) warn("Illegal hexadecimal digit '%c' ignored", *s); break; } if ( ( overflowed && value_nv > 4294967295.0) #if UVSIZE > 4 || (!overflowed && value > 0xffffffff ) #endif ) { warn("Hexadecimal number > 0xffffffff non-portable"); } *len_p = s - start; if (!overflowed) { *flags = 0; return value; } *flags = PERL_SCAN_GREATER_THAN_UV_MAX; if (result) *result = value_nv; return UV_MAX; } #endif #endif #ifndef grok_oct #if defined(NEED_grok_oct) static UV DPPP_(my_grok_oct)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); static #else extern UV DPPP_(my_grok_oct)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); #endif #ifdef grok_oct # undef grok_oct #endif #define grok_oct(a,b,c,d) DPPP_(my_grok_oct)(aTHX_ a,b,c,d) #define Perl_grok_oct DPPP_(my_grok_oct) #if defined(NEED_grok_oct) || defined(NEED_grok_oct_GLOBAL) UV DPPP_(my_grok_oct)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) { const char *s = start; STRLEN len = *len_p; UV value = 0; NV value_nv = 0; const UV max_div_8 = UV_MAX / 8; bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; bool overflowed = FALSE; for (; len-- && *s; s++) { /* gcc 2.95 optimiser not smart enough to figure that this subtraction out front allows slicker code. */ int digit = *s - '0'; if (digit >= 0 && digit <= 7) { /* Write it in this wonky order with a goto to attempt to get the compiler to make the common case integer-only loop pretty tight. */ redo: if (!overflowed) { if (value <= max_div_8) { value = (value << 3) | digit; continue; } /* Bah. We're just overflowed. */ warn("Integer overflow in octal number"); overflowed = TRUE; value_nv = (NV) value; } value_nv *= 8.0; /* If an NV has not enough bits in its mantissa to * represent a UV this summing of small low-order numbers * is a waste of time (because the NV cannot preserve * the low-order bits anyway): we could just remember when * did we overflow and in the end just multiply value_nv by the * right amount of 8-tuples. */ value_nv += (NV)digit; continue; } if (digit == ('_' - '0') && len && allow_underscores && (digit = s[1] - '0') && (digit >= 0 && digit <= 7)) { --len; ++s; goto redo; } /* Allow \octal to work the DWIM way (that is, stop scanning * as soon as non-octal characters are seen, complain only iff * someone seems to want to use the digits eight and nine). */ if (digit == 8 || digit == 9) { if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) warn("Illegal octal digit '%c' ignored", *s); } break; } if ( ( overflowed && value_nv > 4294967295.0) #if UVSIZE > 4 || (!overflowed && value > 0xffffffff ) #endif ) { warn("Octal number > 037777777777 non-portable"); } *len_p = s - start; if (!overflowed) { *flags = 0; return value; } *flags = PERL_SCAN_GREATER_THAN_UV_MAX; if (result) *result = value_nv; return UV_MAX; } #endif #endif #if !defined(my_snprintf) #if defined(NEED_my_snprintf) static int DPPP_(my_my_snprintf)(char * buffer, const Size_t len, const char * format, ...); static #else extern int DPPP_(my_my_snprintf)(char * buffer, const Size_t len, const char * format, ...); #endif #define my_snprintf DPPP_(my_my_snprintf) #define Perl_my_snprintf DPPP_(my_my_snprintf) #if defined(NEED_my_snprintf) || defined(NEED_my_snprintf_GLOBAL) int DPPP_(my_my_snprintf)(char *buffer, const Size_t len, const char *format, ...) { dTHX; int retval; va_list ap; va_start(ap, format); #ifdef HAS_VSNPRINTF retval = vsnprintf(buffer, len, format, ap); #else retval = vsprintf(buffer, format, ap); #endif va_end(ap); if (retval < 0 || (len > 0 && (Size_t)retval >= len)) Perl_croak(aTHX_ "panic: my_snprintf buffer overflow"); return retval; } #endif #endif #if !defined(my_sprintf) #if defined(NEED_my_sprintf) static int DPPP_(my_my_sprintf)(char * buffer, const char * pat, ...); static #else extern int DPPP_(my_my_sprintf)(char * buffer, const char * pat, ...); #endif #define my_sprintf DPPP_(my_my_sprintf) #define Perl_my_sprintf DPPP_(my_my_sprintf) #if defined(NEED_my_sprintf) || defined(NEED_my_sprintf_GLOBAL) int DPPP_(my_my_sprintf)(char *buffer, const char* pat, ...) { va_list args; va_start(args, pat); vsprintf(buffer, pat, args); va_end(args); return strlen(buffer); } #endif #endif #ifdef NO_XSLOCKS # ifdef dJMPENV # define dXCPT dJMPENV; int rEtV = 0 # define XCPT_TRY_START JMPENV_PUSH(rEtV); if (rEtV == 0) # define XCPT_TRY_END JMPENV_POP; # define XCPT_CATCH if (rEtV != 0) # define XCPT_RETHROW JMPENV_JUMP(rEtV) # else # define dXCPT Sigjmp_buf oldTOP; int rEtV = 0 # define XCPT_TRY_START Copy(top_env, oldTOP, 1, Sigjmp_buf); rEtV = Sigsetjmp(top_env, 1); if (rEtV == 0) # define XCPT_TRY_END Copy(oldTOP, top_env, 1, Sigjmp_buf); # define XCPT_CATCH if (rEtV != 0) # define XCPT_RETHROW Siglongjmp(top_env, rEtV) # endif #endif #if !defined(my_strlcat) #if defined(NEED_my_strlcat) static Size_t DPPP_(my_my_strlcat)(char * dst, const char * src, Size_t size); static #else extern Size_t DPPP_(my_my_strlcat)(char * dst, const char * src, Size_t size); #endif #define my_strlcat DPPP_(my_my_strlcat) #define Perl_my_strlcat DPPP_(my_my_strlcat) #if defined(NEED_my_strlcat) || defined(NEED_my_strlcat_GLOBAL) Size_t DPPP_(my_my_strlcat)(char *dst, const char *src, Size_t size) { Size_t used, length, copy; used = strlen(dst); length = strlen(src); if (size > 0 && used < size - 1) { copy = (length >= size - used) ? size - used - 1 : length; memcpy(dst + used, src, copy); dst[used + copy] = '\0'; } return used + length; } #endif #endif #if !defined(my_strlcpy) #if defined(NEED_my_strlcpy) static Size_t DPPP_(my_my_strlcpy)(char * dst, const char * src, Size_t size); static #else extern Size_t DPPP_(my_my_strlcpy)(char * dst, const char * src, Size_t size); #endif #define my_strlcpy DPPP_(my_my_strlcpy) #define Perl_my_strlcpy DPPP_(my_my_strlcpy) #if defined(NEED_my_strlcpy) || defined(NEED_my_strlcpy_GLOBAL) Size_t DPPP_(my_my_strlcpy)(char *dst, const char *src, Size_t size) { Size_t length, copy; length = strlen(src); if (size > 0) { copy = (length >= size) ? size - 1 : length; memcpy(dst, src, copy); dst[copy] = '\0'; } return length; } #endif #endif #ifndef PERL_PV_ESCAPE_QUOTE # define PERL_PV_ESCAPE_QUOTE 0x0001 #endif #ifndef PERL_PV_PRETTY_QUOTE # define PERL_PV_PRETTY_QUOTE PERL_PV_ESCAPE_QUOTE #endif #ifndef PERL_PV_PRETTY_ELLIPSES # define PERL_PV_PRETTY_ELLIPSES 0x0002 #endif #ifndef PERL_PV_PRETTY_LTGT # define PERL_PV_PRETTY_LTGT 0x0004 #endif #ifndef PERL_PV_ESCAPE_FIRSTCHAR # define PERL_PV_ESCAPE_FIRSTCHAR 0x0008 #endif #ifndef PERL_PV_ESCAPE_UNI # define PERL_PV_ESCAPE_UNI 0x0100 #endif #ifndef PERL_PV_ESCAPE_UNI_DETECT # define PERL_PV_ESCAPE_UNI_DETECT 0x0200 #endif #ifndef PERL_PV_ESCAPE_ALL # define PERL_PV_ESCAPE_ALL 0x1000 #endif #ifndef PERL_PV_ESCAPE_NOBACKSLASH # define PERL_PV_ESCAPE_NOBACKSLASH 0x2000 #endif #ifndef PERL_PV_ESCAPE_NOCLEAR # define PERL_PV_ESCAPE_NOCLEAR 0x4000 #endif #ifndef PERL_PV_ESCAPE_RE # define PERL_PV_ESCAPE_RE 0x8000 #endif #ifndef PERL_PV_PRETTY_NOCLEAR # define PERL_PV_PRETTY_NOCLEAR PERL_PV_ESCAPE_NOCLEAR #endif #ifndef PERL_PV_PRETTY_DUMP # define PERL_PV_PRETTY_DUMP PERL_PV_PRETTY_ELLIPSES|PERL_PV_PRETTY_QUOTE #endif #ifndef PERL_PV_PRETTY_REGPROP # define PERL_PV_PRETTY_REGPROP PERL_PV_PRETTY_ELLIPSES|PERL_PV_PRETTY_LTGT|PERL_PV_ESCAPE_RE #endif /* Hint: pv_escape * Note that unicode functionality is only backported to * those perl versions that support it. For older perl * versions, the implementation will fall back to bytes. */ #ifndef pv_escape #if defined(NEED_pv_escape) static char * DPPP_(my_pv_escape)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, STRLEN * const escaped, const U32 flags); static #else extern char * DPPP_(my_pv_escape)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, STRLEN * const escaped, const U32 flags); #endif #ifdef pv_escape # undef pv_escape #endif #define pv_escape(a,b,c,d,e,f) DPPP_(my_pv_escape)(aTHX_ a,b,c,d,e,f) #define Perl_pv_escape DPPP_(my_pv_escape) #if defined(NEED_pv_escape) || defined(NEED_pv_escape_GLOBAL) char * DPPP_(my_pv_escape)(pTHX_ SV *dsv, char const * const str, const STRLEN count, const STRLEN max, STRLEN * const escaped, const U32 flags) { const char esc = flags & PERL_PV_ESCAPE_RE ? '%' : '\\'; const char dq = flags & PERL_PV_ESCAPE_QUOTE ? '"' : esc; char octbuf[32] = "%123456789ABCDF"; STRLEN wrote = 0; STRLEN chsize = 0; STRLEN readsize = 1; #if defined(is_utf8_string) && defined(utf8_to_uvchr) bool isuni = flags & PERL_PV_ESCAPE_UNI ? 1 : 0; #endif const char *pv = str; const char * const end = pv + count; octbuf[0] = esc; if (!(flags & PERL_PV_ESCAPE_NOCLEAR)) sv_setpvs(dsv, ""); #if defined(is_utf8_string) && defined(utf8_to_uvchr) if ((flags & PERL_PV_ESCAPE_UNI_DETECT) && is_utf8_string((U8*)pv, count)) isuni = 1; #endif for (; pv < end && (!max || wrote < max) ; pv += readsize) { const UV u = #if defined(is_utf8_string) && defined(utf8_to_uvchr) isuni ? utf8_to_uvchr((U8*)pv, &readsize) : #endif (U8)*pv; const U8 c = (U8)u & 0xFF; if (u > 255 || (flags & PERL_PV_ESCAPE_ALL)) { if (flags & PERL_PV_ESCAPE_FIRSTCHAR) chsize = my_snprintf(octbuf, sizeof octbuf, "%"UVxf, u); else chsize = my_snprintf(octbuf, sizeof octbuf, "%cx{%"UVxf"}", esc, u); } else if (flags & PERL_PV_ESCAPE_NOBACKSLASH) { chsize = 1; } else { if (c == dq || c == esc || !isPRINT(c)) { chsize = 2; switch (c) { case '\\' : /* fallthrough */ case '%' : if (c == esc) octbuf[1] = esc; else chsize = 1; break; case '\v' : octbuf[1] = 'v'; break; case '\t' : octbuf[1] = 't'; break; case '\r' : octbuf[1] = 'r'; break; case '\n' : octbuf[1] = 'n'; break; case '\f' : octbuf[1] = 'f'; break; case '"' : if (dq == '"') octbuf[1] = '"'; else chsize = 1; break; default: chsize = my_snprintf(octbuf, sizeof octbuf, pv < end && isDIGIT((U8)*(pv+readsize)) ? "%c%03o" : "%c%o", esc, c); } } else { chsize = 1; } } if (max && wrote + chsize > max) { break; } else if (chsize > 1) { sv_catpvn(dsv, octbuf, chsize); wrote += chsize; } else { char tmp[2]; my_snprintf(tmp, sizeof tmp, "%c", c); sv_catpvn(dsv, tmp, 1); wrote++; } if (flags & PERL_PV_ESCAPE_FIRSTCHAR) break; } if (escaped != NULL) *escaped= pv - str; return SvPVX(dsv); } #endif #endif #ifndef pv_pretty #if defined(NEED_pv_pretty) static char * DPPP_(my_pv_pretty)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, char const * const start_color, char const * const end_color, const U32 flags); static #else extern char * DPPP_(my_pv_pretty)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, char const * const start_color, char const * const end_color, const U32 flags); #endif #ifdef pv_pretty # undef pv_pretty #endif #define pv_pretty(a,b,c,d,e,f,g) DPPP_(my_pv_pretty)(aTHX_ a,b,c,d,e,f,g) #define Perl_pv_pretty DPPP_(my_pv_pretty) #if defined(NEED_pv_pretty) || defined(NEED_pv_pretty_GLOBAL) char * DPPP_(my_pv_pretty)(pTHX_ SV *dsv, char const * const str, const STRLEN count, const STRLEN max, char const * const start_color, char const * const end_color, const U32 flags) { const U8 dq = (flags & PERL_PV_PRETTY_QUOTE) ? '"' : '%'; STRLEN escaped; if (!(flags & PERL_PV_PRETTY_NOCLEAR)) 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 #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) #if defined(NEED_pv_display) || defined(NEED_pv_display_GLOBAL) 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 #endif /* _P_P_PORTABILITY_H_ */ /* End of File ppport.h */ version-0.9907/Changes0000644000175000017500000027055012265475472014751 0ustar jpeacockjpeacock2014-01-15 John Peacock * .hgtags: Tagging version '0.9907' using shipit. [59f891910a94] [tip] 2014-01-14 John Peacock * Makefile.PL, README, lib/version.pm, vperl/vpp.pm: Stop supporting Perl releases prior to v5.6.2. Tweak the code to prevent locale from causing troubles where it cannot be used, e.g. Android. [0eb90073ce68] [0.9907] * vutil/vutil.c: That is lval not the length of the key [00fff6f82ffd] 2014-01-13 John Peacock * README: Final tweaks before releasing [7b1b98341550] * Makefile.PL, README, t/07locale.t, vperl/vpp.pm: Better way to handle locale under Android [5ba9c78a80f2] 2014-01-13 Piotr Roszatycki * vutil/vutil.h: Check USE_LOCALE [9a4981da2550] 2014-01-13 John Peacock * README: Correct spelling [bb0b009054a5] 2014-01-12 John Peacock * Makefile.PL, vperl/vpp.pm: Isolate the locale testing to make it easier to deal with on Android. On Android, strip out 'use locale' so that it doesn't fall over. [bf28d1047cf5] * README, lib/version.pm, lib/version/regex.pm, t/00impl-pp.t, t/01base.t, t/02derived.t, t/03require.t, t/05sigdie.t, t/06noop.t, t/07locale.t, t/08_corelist.t, t/09_list_util.t, vperl/vpp.pm, vutil/lib/version/vxs.pm: $VERSION++ for CPAN release. [bf8d867fdd67] 2014-01-11 John Peacock * vutil/vutil.h: The new macros, and indeed the previous macros, do not work on Perl prior to 5.19.0 because the bug is actually how in Perl itself handles the locale bits. So we just go back to effectively always saving the locale. Resolves: https://rt.cpan.org/Ticket/Display.html?id=91987 [9dc839b97fbb] 2014-01-06 bulk88 * vutil/vutil.c, vutil/vutil.h, vutil/vxs.inc, vutil/vxs.xs: various XS optimizations and a leak fix vutil.h -restore 5.10 and 5.12 compatiblity, S_croak_xs_usage came from Win32::API vutil.c -add PERL_NO_GET_CONTEXT to both translation units -remove all hv_exists/hv_fetchs patterns and replace with 1 hv key getter -remove all SvIV(*av_fetch patterns, av_fetch is called multiple times in the SvIV macro -in new_version, directly use version * directly, savepvn isn't needed and doesn't convert character encoding either -in upg_version, recently this function was converted to use SAVEFREEPV this savesvpv was missed vxs.inc -make xsub details table smaller in the binary by getting rid of the NULL entries, version doesn't use prototypes, but in CORE other xsubs use them in this table -in VXS(version_new) don't read PL_stack_base more than necessary -in VTYPECHECK, make this macro eval the SV* only once. ST(123) was multi evaling/multiple recalcs of it, also this now makes POPs safe to pass. -in VXS(version_vcmp) take advantage of sv_2mortal's return val for smaller machine code -because of XSUB details table, ALIAS:/XSANY can't be used, factor out VXS(version_is_alpha) and VXS(version_is_qv), and make the XS stubs tailcall friendly on regcall ABIs -in S_version_check_key use SP semantics instead of ax, less machine code -in VXS(version_qv) don't read PL_stack_base more than necessary, this fnc could be further cleaned up, since it has obvious signs of xsubpp and hand written portions [f9d01679492f] 2014-01-05 John Peacock * vutil/vutil.c, vutil/vutil.h, vutil/vxs.inc: This was more subtle than I had initially understood [649e700fadae] * vutil/vutil.h: Somewhat faster because we avoid a strlen() call [11fb73b0be3f] * MANIFEST, Makefile.PL, vutil/vxs.xs: Apparently we do still need this, at least for Windows. grrr [b4d4e0057b40] 2014-01-04 John Peacock * vutil/vutil.c: Only need to compare the remaining string [8f1352c79510] * vutil/vutil.c: Use AvFILLp since we know av is not magical [a5367b183ff0] * vutil/vutil.c: Arrange for all saved strings to be cleaned up on scope exit [7a76ab3bbf84] * vutil/vutil.c: Use macro instead of function call for efficiency [d03bfc7f7f0f] * MANIFEST, Makefile.PL, vutil/vxs.xs: Do not need vxs.xs any longer [c2cc74f7ebf4] * vutil/vxs.inc: Remove unnecessary variable. Resolves: https://rt.cpan.org/Ticket/Display.html?id=91867 [190410bc3966] * vutil/vutil.c: Use equivalent macro from Perl [ffc872209ccb] * .hgtags: Tagging version '0.9906' using shipit. [f3985248813a] * README: Update README for new CPAN release. [9f49d95d787c] [0.9906] * lib/version.pm, lib/version/Internals.pod, lib/version/regex.pm, t /00impl-pp.t, t/01base.t, t/02derived.t, t/03require.t, t/04strict_lax.t, t/05sigdie.t, t/06noop.t, t/07locale.t, t/08_corelist.t, t/09_list_util.t, vperl/vpp.pm, vutil/lib/version/vxs.pm: Restore $version::LAX functionality, resolves: https://rt.cpan.org/Ticket/Display.html?id=91858 [3129d0a133d9] 2014-01-04 Karl Williamson * vutil/vxs.inc: vxs.inc: Move code to after declarations This macro, added in e1c774b6, is actual code, and needs to be after the declarations, so that C89 compilers compile it. [d2ac7d3ab38f] 2014-01-04 John Peacock * .hgtags: Tagging version '0.9905' using shipit. [5b7173e3cf28] * README: Ready to release to CPAN [143beb1ecc7c] [0.9905] * Makefile.PL, lib/version.pm, t/09_list_util.t, vperl/vpp.pm: Finally resolve all test failures going back to 5.005_04 [e291744a1699] * lib/version/typemap: Merge from sprout branch now that it is in the core [414c7e7bdab3] * Ready to merge to default [0e5b9977f472] 2013-12-29 John Peacock * t/coretests.pm, vperl/vpp.pm, vutil/vutil.c: Protect against arrayref/hashref being used to initialize. [cae5dc47e323] * vutil/vxs.inc: Always export version::_VERSION method [3ef36df5fa82] 2013-12-29 Father Chrysostomos * vutil/vxs.inc: Use VXS_ prefix for XSUB bodies in CPAN version The names of the functions in core and in the CPAN version will con- flict otherwise. Since perl versions before 5.16.0 did not have XS_INTERNAL (which could solve this problem another way, making the functions static), it’s easier just to use different names. [e5ff1195df80] 2013-12-29 John Peacock * MANIFEST, Makefile.PL, vutil/vxs.in, vutil/vxs.inc: Revert these changes prior to importing patch from Sprout [aa7f38340804] * lib/version.pm, vutil/lib/version/vxs.pm: Mark block to be deleted when adding to Perl core. Simplify usage of version::regex. [45e5f442c363] 2013-12-26 John Peacock * vutil/vutil.c: Improve upg_version for abusively large NV case. From: Daniel Dragan Date: Thu, 26 Dec 2013 01:09:39 -0500 Subject: [PATCH] remove redundant SV operations from upg_version sv is empty because it is new, setpvf will do useless sv_vsetpvf(sv, "") before calling sv_vcatpvfn_flags, just call sv_catpvf. sv_vcatpvfn_flags does a sv_pvn_force_flags, so sv will always be POK afterwards, so just access members directly and remove SV conversion check and branch. upg_version should be a tiny bit faster in case abusively long versions are parsed. This commit improves the commit 78e230aef1 for perl #112478. [255cc73939b7] 2013-12-25 John Peacock * Makefile.PL: Prevent shadowed version.pm. Resolves https://rt.cpan.org/Ticket/Display.html?id=88909 [234d5fe16460] * MANIFEST, t/09_list_util.t, vutil/vutil.c, vutil/vxs.in: Don't steal SV's when you can help it. Resolves https://rt.cpan.org/Ticket/Display.html?id=91323 [87b481c20881] * t/coretests.pm, vutil/vutil.c: Need to handle [unsigned] integers differently. [1f178af738e5] 2013-12-22 Karl Williamson * t/07locale.t: t/07locale.t: 'use locale' needs to be moved A test that is supposed to be outside the scope of 'use locale' is instead within the scope. [e9c9b887a74b] * t/07locale.t: t/07locale.t: Tests were likely skipped The logic was wrong in the loop exit, so that on the many machines that don't have an Afghan locale, most tests in the file are skipped. The problem is that it wasn't testing if changing to the trial locale actually worked. [7b9d5921f6dd] 2013-12-07 John Peacock * t/coretests.pm, vperl/vpp.pm: Do not hardcode 'version' when $CLASS is correct [b1f2e197e70e] 2013-11-30 John Peacock * vperl/vpp.pm: Go back to the old style since we need to still support older Perls [8c3dd9b09c8c] * lib/version.pm, lib/version/regex.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm: Be consistent about what minimum Perl version we support [3a1ba8a49521] * MANIFEST, Makefile.PL, README, lib/version.pm, lib/version/typemap, t/00impl-xs.t, vutil/lib/version/vxs.pm, vutil/vxs.in: Complete exercise to make version:vpp independent. Deprecate XS code in all Perl releases prior to v5.10 [e8095080969c] 2013-11-19 John Peacock * lib/version.pm, lib/version/regex.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm: Finally have all tests passing [6e0377fec777] 2013-11-17 John Peacock * MANIFEST, Makefile.PL, lib/version.pm, lib/version/regex.pm, t/02derived.t, vperl/vpp.pm, vutil/lib/version/vxs.pm: Move regexes to independent class and make both implementation class completely standalone [192ce2309a99] 2013-11-12 John Peacock * t/coretests.pm: Do not assume what the class is here [2caf7c7a3b12] 2013-11-03 Father Chrysostomos * vutil/vxs.in: vxs.inc: Fix thinko This was causing test failures after rebasing against blead. [886acc1dc1c9] 2013-11-03 John Peacock * MANIFEST, Makefile.PL, vutil/vxs.in, vutil/vxs.inc: Rename vxs.inc to vxs.in so we can edit on the fly out-of-core [dab16fd6384e] 2013-10-23 John Peacock * MANIFEST: Add new implementation class tests to MANIFEST. [88bf30fb7335] * Makefile.PL: Need to rename XS_UNIVERSAL_VERSION as well. [ec99e6586265] 2013-10-22 John Peacock * vperl/vpp.pm: Merge from default [e61323b2f598] * Makefile.PL, t/00impl-pp.t, t/00impl-xs.t, vperl/vpp.pm: Dupe the import() routine so that version:vpp is standalone [8464fd2353e7] * Makefile.PL: Need to rename the XS functions outside of the core [2b38b93a93d9] 2013-10-18 John Peacock * lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, t/05sigdie.t, t/06noop.t, t/07locale.t, t/08_corelist.t, vperl/vpp.pm, vutil/lib/version/vxs.pm: Bump $VERSION. Make version::vpp a completely standalone class and test it. [68da07b3d1d1] 2013-10-16 John Peacock * lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, t/05sigdie.t, t/06noop.t, t/07locale.t, t/08_corelist.t, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/vxs.xs: Bump $VERSION everywhere. Make details[] static array [0303b632df78] 2013-10-08 Father Chrysostomos * vutil/vxs.inc: vxs.inc: qv: Backport perl 5.16's utf8 and null handling ppport.h provides HvNAMELEN_get, but we have to use #ifdefs for HvNAMEUTF8. [35248c2474c9] * t/coretests.pm: Another test for #88495, this time with qv This bug was also caused by perl commit ed1db70e122, the CPAN version being unaffected. [4fa3d433a173] * vutil/vxs.inc: vxs.inc: new: Backport perl 5.16's utf8 and null handling ppport.h provides HvNAMELEN_get, but we have to use #ifdefs for HvNAMEUTF8. [24a3f9dc48f1] * vutil/vxs.inc: vxs.inc: new: Don't hard-code class name [e761e21c1db2] * t/coretests.pm: Test rt.cpan.org #88495 This string comparison bug has only ever existed in the perl core. It was ed1db70e1224 in 5.16 that introduced it [8c74c593ab60] * vutil/vxs.inc: vxs.inc: new: Avoid Perl_sv_setpvf_nocontext sv_setpvf expands to Perl_sv_setpvf_nocontext under threaded builds starting from 5.6. Perl_sv_setpvf_nocontext is slow because it has to call a special OS-provided function to fetch the interpreter object associated with the current thread. Just passing the interpreter through is faster. This is what the blead version of this routine already does. perl 5.005 does not have long Perl_* names, so we have to do it the old way for that version. [5ffa46f7c2d6] * vutil/vxs.inc: vxs.inc: new: check arglist first, don't read beyond Check the number of arguments before reading any. Using ST(1) when items == 1 *shouldn’t* cause any problems if the value returned is never used, but it could theoretically read into unallocated memory. Also, don’t bother with get-magic if we are going to croak anyway (>3 args). [77e4604d43f1] * vutil/vxs.inc: vxs.inc: Remove use of Null(...) This is not defined under PERL_CORE. [ccb2049fc81c] * vutil/vxs.inc: vxs.inc:VERSION: backport utf8 and null handling from blead Since older perls than 5.16 didn’t have HEKf and 5.8 not even HvNAME_HEK, we need an #ifdef maze. [d1b03ff71c8d] * vutil/vxs.inc: RT #88572: Better usage msg for UNIVERSAL::VERSION() I.e., mention UNIVERSAL::VERSION rather than version::vxs::_VERSION. [89e6712c44cf] * MANIFEST, Makefile.PL, vutil/vxs.inc, vutil/vxs.xs: Extract XS routines into a separate file This way the same vxs.inc can be included by the perl’s universal.c and by our vxs.xs. [e42f0b6eee81] * vutil/vutil.c, vutil/vutil.h: Make vutil.* meet the Perl core's needs This brings version.pm and perl’s copies of vutil.* into synch. [de6daa4fa5f0] 2013-09-23 John Peacock * vutil/vutil.c: Handle integer-only versions that overflow either UV or IV [57698e44e5ee] 2013-09-05 John Peacock * vutil/vutil.c: Use savepvn() for efficiency [96ed7a4be81e] 2013-09-02 John Peacock * .hgtags: Tagging version '0.9904' using shipit. [4fab8f3e7a2c] * t/08_corelist.t: Almost forgot to add this [4e3713e87478] [0.9904] * vutil/vxs.xs: Delete this useless code path [5effc1d02853] * README: Fixup typo in README [7b9cc580738a] * MANIFEST, Makefile.PL, README, t/07locale.t, vutil/vutil.c, vutil/vxs.xs: A couple subtle changes from bleadperl. Also, require parent to be installed even if it should have been installed already (Thanks RHEL!). Handle magical initializers (like tied hash elements), but only test where we can do it easily. [6fd396e1006b] 2013-08-20 John Peacock * README, lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, t/04strict_lax.t, t/05sigdie.t, t/06noop.t, t/07locale.t, t/coretests.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm: Final sync with bleadperl [4d748bda798b] 2013-08-18 John Peacock * .hgtags: Tagging version '0.9903' using shipit. [02af417226b0] * vutil/lib/version/vxs.pm: Missed one VERSION++ [8c04e6e6f195] [0.9903] * README: Final tweaks before release to CPAN [a63c5368dbae] 2013-08-16 John Peacock * lib/version.pod: More whitespace normalization [bebbe00cbd68] 2013-08-15 John Peacock * lib/version.pm, lib/version/Internals.pod, t/01base.t, t/02derived.t, t/03require.t, t/04strict_lax.t, t/05sigdie.t, t/06noop.t, t/07locale.t, t/coretests.pm, vperl/vpp.pm: Merge with core perl changes and bump $VERSION for release. [cf81a9587bf2] 2013-07-06 John Peacock * lib/version/Internals.pod: Resolve https://rt.cpan.org/Ticket/Display.html?id=86582 [f831a867b6be] * Makefile.PL: Always install version::vpp even when installing XS code Resolves https://rt.cpan.org/Ticket/Display.html?id=84616 [e983c52f6935] * Makefile.PL: Require the correct minimum version of "parent" [1aa33af2f954] * Makefile.PL, t/coretests.pm: Eliminate "use base" usage [ffee69e907be] 2013-03-06 John Peacock * .hgtags: Tagging version '0.9902' using shipit. [5c6574976e24] * lib/version.pm: Make sure to create &version::new alias with all Perls [9fc95f57161a] [0.9902] 2013-03-05 John Peacock * README: Ready for release to CPAN [e8829f2f8800] 2013-03-03 John Peacock * vperl/vpp.pm: Pure Perl version::new() should also croak if called as function. Resolves: https://rt.cpan.org/Ticket/Display.html?id=81085 [823994482617] * lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, t/05sigdie.t, t/06noop.t, t/07locale.t, t/coretests.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm: Cope with hashkey ordering changes. Resolves: https://rt.cpan.org/Public/Bug/Display.html?id=81708 [3c49b0c9c7d6] * Makefile.PL: Implement PERL_ONLY environment variable. Resolves: https://rt.cpan.org/Public/Bug/Display.html?id=83509 [be18a6913e9d] * .hgignore, vutil/vutil.c, vutil/vxs.xs: Don't create object structure until after prescanning, resolves: https://rt.cpan.org/Public/Bug/Display.html?id=81086 [50e4af5e81ce] 2012-11-15 John Peacock * t/01base.t, vutil/vxs.xs: Resolve https://rt.cpan.org/Ticket/Display.html?id=81085 [38f2fe7b96fd] 2012-09-10 John Peacock * .hgtags: Tagging version '0.9901' using shipit. [4ede6195fa54] 2012-09-09 John Peacock * lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, t/05sigdie.t, t/06noop.t, t/07locale.t, t/coretests.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/vutil.c: Fix problem with short floating point alpha versions (e.g. 0.52_0). Resolves: https://rt.cpan.org/Ticket/Display.html?id=79259 [d0e1d933089b] [0.9901] 2012-04-26 John Peacock * .hgtags: Tagging version '0.99' using shipit. [5b92453596f4] * README, lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, t/05sigdie.t, t/06noop.t, t/07locale.t, t/coretests.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm: Missed a patch from bleadperl. [47af644a41f0] [0.99] 2012-04-25 John Peacock * .hgtags: Tagging version '0.98' using shipit. [f2b560650d71] * README, lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, t/05sigdie.t, t/06noop.t, t/07locale.t, vperl/vpp.pm, vutil/lib/version/vxs.pm: Final prep for release to CPAN [9b2b10192e6d] [0.98] * t/coretests.pm: And apply test for overflowing versions... [428561b08acb] * vutil/vutil.c: Apply changes from Perl core to prevent buffer overflow with ludicrous version objects. [dda581b33ebb] 2012-03-26 John Peacock * .hgtags: Tagging version '0.97' using shipit. [b92630594a52] 2012-02-28 John Peacock * README, lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, t/05sigdie.t, t/06noop.t, t/07locale.t, vperl/vpp.pm, vutil/lib/version/vxs.pm: Prep for 0.97 release to CPAN [40481a8c9961] [0.97] 2012-02-27 John Peacock * t/07locale.t: Need to actually check to make sure we have a comma locale. [01831906b0fc] 2012-02-06 John Peacock * .hgtags: Tagging version '0.96' using shipit. [869515de8517] * lib/version.pod, vutil/vutil.c: Final merge from bleadperl plus whitespace cleanup [6cfe8a913105] [0.96] 2012-02-05 John Peacock * t/07locale.t: Wrong skip count and extra whitespace [eec6bacab6ae] * MANIFEST, lib/version.pm, t/07locale.t, t/comma_locale.pl, vperl/vpp.pm: Eliminate comma_locale helper script after all, since we don't really need it with only one locale test file. [b8f4bc01a4cb] 2012-02-04 John Peacock * lib/version/typemap, vutil/vutil.c, vutil/vxs.xs: Sync with Perl core, especially not leaking scalars during boolean. [5849413db03c] 2012-02-02 John Peacock * lib/version.pm, t/comma_locale.pl, t/coretests.pm: Figured out what I was missing on Perl > 5.9 tests. [02cc6870927d] 2011-12-26 John Peacock * MANIFEST, t/coretests.pm: For some reason, the pure Perl test fails otherwise. [957517cbd08f] * t/08locale-105784.t: Turns out this isn't a bug in version but in Perl, so we cannot test it here. [4e1e1ce197b9] 2011-12-20 John Peacock * MANIFEST, lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, t/05sigdie.t, t/06noop.t, t/07locale.t, t/08locale-105784.t, t/comma_locale.pl, t/coretests.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/vutil.c, vutil/vutil.h, vutil/vxs.xs: Merge changes from bleadperl. Split out locale testing to two files. Prep for releasing 0.96 to CPAN. [c1267228d702] 2011-12-01 John Peacock * lib/version.pod: No longer recommend 0.77 in the use line. [cbc5615a685d] 2011-11-12 John Peacock * .hgtags: Tagging version '0.95' using shipit. [f76612f96814] * README, t/coretests.pm, vutil/vxs.xs: Turns out the XS code didn't prevent the math ops from working after all. Add a test to make sure we catch that and update README for release. [9f4e1ff7704c] [0.95] * t/06noop.t: Forgot to add test file for math noop methods [ca0bc8526ea5] * MANIFEST, vperl/vpp.pm: Restore 5.14.x behavior of UNIVERSAL::VERSION to pure Perl code [1dd0281f09b8] * t/coretests.pm, vutil/vutil.c, vutil/vutil.h, vutil/vxs.xs: Fix segfault with versions that start with 'v', especially 'version'. [868edaf0223b] 2011-10-30 John Peacock * lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, t/05sigdie.t, t/coretests.pm, vutil/lib/version/vxs.pm: Bump $VERSION in preparation for eventual release. [3bcfd3008cbc] * vutil/vxs.xs: Revert change to UNIVERSAL::VERSION replacement, pending ruling from the bench. [d5c1282dfe13] * vperl/vpp.pm: For some reason, nomethod doesn't work in pure Perl code, so be explicit about ops that are not allowed. [5cad9cde035e] 2011-08-21 John Peacock * .hgtags: Tagging version '0.94' using shipit. [743538f58cb7] * Makefile.PL, lib/version.pod, lib/version/Internals.pod: Tweak POD and add LICENSE to Makefile.PL. Resolves: https://rt.cpan.org/Public/Bug/Display.html?id=70120 [3a4fae29c763] [0.94] * MANIFEST, t/05sigdie.t: Add test to confirm that the $SIG{__DIE__} handling is correct. [4a421bba05c9] * lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, vperl/vpp.pm, vutil/lib/version/vxs.pm: Prevent DIE handlers in user code from tripping up loading version. Don't know how this hasn't shown up until now. Resolves: https://rt.cpan.org/Ticket/Display.html?id=70260 [754fd86858af] 2011-07-27 John Peacock * .hgtags: Tagging version '0.93' using shipit. [1fb9bb0676db] * t/coretests.pm: Reorder tests and include both positive and negative test for exception. [758140b17786] [0.93] * README, lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, t/coretests.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/vxs.xs: Fix problem with UNIVERSAL::VERSION spotted by Father Chrysostomos. [2a7768a85f8b] 2011-07-26 John Peacock * .hgtags: Tagging version '0.92' using shipit. [8dc71db60aaa] * README: Remember to update README for a change [23c8ac5df1db] [0.92] * lib/version.pm: Forgot to update the logic for the pure Perl version [6b616b3cf67d] * t/coretests.pm: Plus Tests for UNIVERSAL::VERSION! [bdcc02a495da] * vperl/vpp.pm: Forbid negative version in pure Perl and update UNIVERSAL::VERSION replacement. Plus Tests! [3e6273e898c4] * vutil/vxs.xs: In UNIVERSAL::VERSION, don't convert the package $VERSION into a version object unless you need to actually compare it; return the original $VERSION scalar in any case. [573e3dacc865] * vutil/vxs.xs: Eliminate tab characters [b81f8f7ddc53] * lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, t/coretests.pm, vutil/lib/version/vxs.pm, vutil/vutil.c, vutil/vutil.h, vutil/vxs.xs: Rewrite overriding logic to just bulk replace the core code after the point where version.pm was assimilated. Also correct handling of negative versions (and add tests), to mirror what was done in core. [b1774b895712] 2011-06-06 John Peacock * .hgtags: Tagging version '0.91' using shipit. [d9305ef3630f] * .hgtags: Removed tag 0.91 [089ab8b080ba] [0.91] * .hgtags: Tagging version '0.91' using shipit. [749088e4a014] 2011-06-05 John Peacock * README, lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/vutil.c: Protect the Perl core functions introduced in 5.11.4, which only apparently causes problems with Strawberry Perl. Bump $VERSION everwhere and even remember to update README. [b65d7a359ae6] 2011-06-01 John Peacock * .hgtags: Tagging version '0.90' using shipit. [30cea8f2eac2] * README: Remember to edit README this time [137df6eaa22c] [0.90] * lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, vperl/vpp.pm, vutil/lib/version/vxs.pm: Sloppy release for 0.89; I forgot to bump all of the release tests. Do this now and resolve: https://rt.cpan.org/Ticket/Display.html?id=68588 [e7b1d5a01256] 2011-05-31 John Peacock * .hgtags: Tagging version '0.89' using shipit. [5cf121b754b6] * vperl/vpp.pm: Act like vxs version and always use version->new method for qv/declare, then rebless into inherited class [1eb73dd9059b] [0.89] * t/02derived.t, t/coretests.pm: Failing test case with version::vpp only [7dedb7cb50d0] * t/03require.t: More bumping [131ed8486036] * lib/version.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm: Bump $VERSION prior to testing new changes. [d38b0fc42650] * README: Remove discussion of Build.PL (no longer supported) Resolves https://rt.cpan.org/Ticket/Display.html?id=66206 [4a16bc27cffa] 2010-12-20 John Peacock * .hgtags: Tagging version '0.88' using shipit. [a1d7151ace67] 2010-12-19 John Peacock * Makefile.PL, README, lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, vperl/vpp.pm, vutil/lib/version/vxs.pm: Tweak Makefile.PL to make Strawberry Perl happy. [36b62c0768b4] [0.88] 2010-12-09 John Peacock * .hgtags: Tagging version '0.87' using shipit. [f8caa8f3a657] * Build.PL, MANIFEST, Makefile.PL, README, lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, vperl/vpp.pm, vutil/lib/version/vxs.pm: Remove support for Build.PL to keep from introducing circular dependencies. [1d290fc3106c] [0.87] 2010-11-27 John Peacock * lib/version.pod: Apply misc POD cleanup. Resolves: https://rt.cpan.org/Ticket/Display.html?id=57950 https://rt.cpan.org/Ticket/Display.html?id=56737 [afc2d76243df] 2010-11-26 John Peacock * .hgtags: Tagging version '0.86' using shipit. [7c17b9c1c275] * MANIFEST, README, lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, t/04strict_lax.t, vperl/vpp.pm, vutil/lib/version/vxs.pm: Fix export of is_strict/is_lax and add strict/lax tests from core [db0bb33d2774] [0.86] 2010-10-25 John Peacock * .hgtags: Tagging version '0.85' using shipit. [b1a798a38d69] * MANIFEST, MANIFEST.SKIP, README, lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, vperl/vpp.pm, vutil/lib/version/vxs.pm: Don't ship MYMETA.yml file in distro. [bb855abc0625] [0.85] 2010-10-24 John Peacock * .hgtags: Tagging version '0.84' using shipit. [b8782eba0763] * lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, vperl/vpp.pm, vutil/lib/version/vxs.pm: Restore public API broken by 0.83 [a475d9c09d66] [0.84] 2010-10-17 John Peacock * .hgtags: Tagging version '0.83' using shipit. [e25cf06d69ff] * MANIFEST: Checking in changes prior to tagging of version 0.83. Changelog diff is: [383db44a8de3] [0.83] 2010-10-12 John Peacock * vperl/vpp.pm: Fixup support for non-magical v-strings in 5.6.2-5.8.0 [e5860248010f] * vutil/ppport.h, vutil/vutil.c, vutil/vutil.h: XS code finally passes on all support Perl releases! [7f8a96283d17] 2010-10-10 John Peacock * t/coretests.pm, vperl/vpp.pm, vutil/vutil.c, vutil/vutil.h: Change vverify API (David Golden) and simplify usage. [ba0f930f83c4] 2010-09-28 John Peacock * lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, vutil/lib/version/vxs.pm, vutil/vxs.xs: First pass at merging in changes from bleadperl. [b2b70ee7b7c6] 2010-05-02 John Peacock * lib/version.pm, vutil/vutil.c, vutil/vutil.h: Apply patch from Zefram to build correctly with Perl dev releases in the 5.9.{3..5} and 5.11.{0..4} ranges. [7384ae8a7947] * Build.PL, Makefile.PL: Apply patch from Todd Rinaldo (modified) to install dual-lifed modules into the correct post-@INC reordering location (basically site instead of core). Only applies to Perl >= 5.9.1 and < 5.11.0. [7de0686270a3] 2010-04-19 John Peacock * .hgtags: Tagging version '0.82' using shipit. [76eac991d1ab] * README, lib/version.pm, lib/version.pod, lib/version/Internals.pod, t/01base.t, t/02derived.t, t/03require.t, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/ppport.h, vutil/vutil.c, vutil/vutil.h: Merge all changes from 5.12.0 into the CPAN release. Fix up compilation so the CPAN release works with 5.12.0 too. Tests work from 5.005_04 to 5.12.0 [8648e6e4d9d4] [0.82] 2010-02-01 John Peacock * .hgtags: Tagging version '0.81' using shipit. [3bd3e49d505b] * lib/version.pm, lib/version.pod, lib/version/Internals.pod: Merge in documentation and whitespace changes from bleadperl [3e764e7fdd39] [0.81] * lib/version.pm: More consistent formatting and program flow. Now 5.10.1 passes with pure Perl version too. [d2869cfa8443] * lib/version.pm: Restore compatibility with Perl v5.10.1 [f5fb5ff1fe50] 2010-01-31 John Peacock * vperl/vpp.pm, vutil/vutil.c: Check for empty before testing residual text. Tests fail with 5.10.1 [8f97e44fb308] * vperl/vpp.pm, vutil/vutil.c: Better heuristics for guessing v-strings. [d504b73d828a] * vperl/vpp.pm: DTRT for boolean operation (which only freaks on 5.6.2). [efeb8205d6de] 2010-01-30 John Peacock * vperl/vpp.pm: Need to have two independent constant calls to make 5.005_04 happy. [871d9d322f6a] * vperl/vpp.pm: All tests pass with pure Perl version! [e8e8f781ffd7] 2010-01-29 John Peacock * vperl/vpp.pm: Closer and closer to functionality. [b54b50a597c8] 2010-01-28 John Peacock * vperl/vpp.pm: Much cleanup so that it actually compiles and mostly works. Not getting the correct original string (probably because of overloading confusion). [4d4e91a0c198] * vperl/vpp.pm: Remove duplicated code from new() and rename helper class [f44107a742bd] 2010-01-27 John Peacock * lib/version.pm, vperl/vpp.pm: This almost certainly doesn't work, but commit it now before cleaning up [7ea2e86e2eb9] 2010-01-21 John Peacock * released to CPAN so close [d718924a70dd] * lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/vutil.h: Merge in the changes from version-0.80 feature branch [6c7bf1b4df86] * vutil/vxs.xs: Missed these changes when merging from bleadperl. [25c41c1c4fff] * .hgtags: Tagging version '0.80' using shipit. [895ef02e8ccc] * .hgignore: No, really, ignore existing tarballs [144c85b7c4ec] [0.80] * .hgignore: Ignore previous tarballs [50e19235090e] * README, vutil/vutil.h: Release to CPAN with just the assertion fix for older compilers. [e50ae7f5c829] * lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, vperl/vpp.pm, vutil/lib/version/vxs.pm: Bump $VERSION in all files in preparation for quick CPAN release [c3e609936451] * lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, t/coretests.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/vutil.c: Currently failed attempt to merge with bleadperl [b973a2052a49] 2010-01-12 John Peacock * lib/version.pm: Revise grouped regex again for better clarity. [c9c0417e00a2] * lib/version.pm: Anchor all regexes and bump $VERSION [ecd8c9c85418] * lib/version.pm, vutil/vutil.c, vutil/vutil.h: Merge back changes from bleadperl enhancements. [353cd4fe59e1] 2010-01-10 John Peacock * .hgtags: Tagging version '0.79' using shipit. [ec386b00d27a] * .hgtags: Removed tag 0.79 [824035a0f02a] [0.79] * vutil/vutil.c, vutil/vutil.h: Take the easy road to restore compatibility with Perl v5.10.1 [4ce98cb6eba3] 2010-01-09 John Peacock * .hgtags: Tagging version '0.79' using shipit. [87475097cea8] * .hgignore: tweaks to make mercurial happy [7c5fd8f32175] * .shipit, Build.PL: Fixup to make shipit happy [3dbce4937c28] * .hgtags: Rename all of the tags to be consistent [2c38a17bfdec] 2010-01-06 John Peacock * .shipit, Build.PL, MANIFEST, MANIFEST.SKIP, README, lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, t/04lax.t, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/ppport.h: Restore compatibility with Perl 5.00505 (finally). Bump all VERSION references. [05d5b8b44166] 2009-12-27 John Peacock * vutil/ppport.h, vutil/vutil.c, vutil/vutil.h: Merge in changes from bleadperl. Tests do not pass with 5.005. [0b19155e8e21] 2009-12-22 John Peacock * vutil/ppport.h: Resolves https://rt.cpan.org/Ticket/Display.html?id=52439 [c7fc26126a1d] 2009-12-20 John Peacock * t/coretests.pm, vutil/vutil.c, vutil/vutil.h: All tests passing except the VERSION_MAX ones. [912515d937e8] * lib/version.pm, vutil/vutil.c, vutil/vutil.h: Almost completely transfer the code from scan_version to prescan_version. Still failing some tests. [ecd415561454] 2009-12-19 John Peacock * t/04lax.t, vutil/vutil.c: Now handles decimal versions, too [a1138d18495e] * vutil/vutil.c, vutil/vutil.h: isVERSION handles dotted-decimal version format [8d994d73689b] * MANIFEST, lib/version.pm, t/04lax.t: New regexes that define the legal version strings under both $LAX, (current code) and $STRICT (new feature for Perl 5.12.0). [46076dadb3fb] 2010-01-02 John Peacock * .hgtags: Removed tag trunk [b0d50d9f1a11] 2010-01-03 convert-repo * .hgtags: update tags [f173c486b889] 2009-10-23 John Peacock * README: Forgot to edit the README [2d4a0ce8a432] [0.78] 2009-10-16 John Peacock * Build.PL: Make sure we override the system version.pm in the core for perl5.10.x [b14a586bc973] * README, lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, vperl/vpp.pm, vutil/lib/version/vxs.pm: Bump $VERSION in all files and add README text [3769cd2104e4] * t/coretests.pm, vperl/vpp.pm, vutil/vutil.c: Smarter handling of non-magic v-strings. Resolves https://rt.cpan.org/Ticket/Display.html?id=50347 [eef6bc4dfe66] 2009-09-07 John Peacock * Build.PL, MANIFEST.SKIP, Makefile.PL, README, lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, t/coretests.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/vutil.c: Tighten up un_vstring code to limit the number of false positives. Bump $VERSION in anticipation of release to CPAN. [99a5b00b1322] [0.7702] * vutil/vxs.xs: Stop leaking SV's. Thanks to Goro Fuji for patch [b7971e698393] 2009-07-29 John Peacock * lib/version.pm: Little jog to make sure META.yml does't contain UNIVERSAL [d8be3ffd4f0e] [0.7701] * t/01base.t, t/02derived.t, t/03require.t, t/coretests.pm: Only replace use_ok() if running with Test::More < 0.48 [abbb0f538f09] * t/01base.t, t/02derived.t, t/03require.t, t/coretests.pm: Provide replacement use_ok to make the 02derived.t tests pass. [b68f7b3b45a3] * README, lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, vperl/vpp.pm, vutil/lib/version/vxs.pm: Fix for https://rt.cpan.org/Ticket/Display.html?id=48268 [2451e01d2bb0] 2009-07-26 John Peacock * MANIFEST.SKIP, t/test-all: Script to run through all of the Perl releases in one go [2f70ab72fce5] [0.77] * lib/version.pm, lib/version.pod, t/03require.t, t/coretests.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/vutil.c: Release 0.77 to CPAN without the warning change, for release with 5.10.1 [2dd1f289b9d6] 2009-07-25 John Peacock * lib/version.pm, lib/version.pod, lib/version/Internals.pod, t/03require.t, t/coretests.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/vutil.c: Finally complete the POD rewrite. Change the behavior to throw a warning if you try and use a v-string without a leading 'v' in a version object declaration (this may get pulled) and rewrite the POD to follow the New World Order. [a1d00623599f] [0.76_06] 2009-07-24 John Peacock * vutil/vxs.xs: Resolves https://rt.cpan.org/Public/Bug/Display.html?id=48135 [c6faa44298a4] 2009-07-23 John Peacock * t/03require.t: Forgot to bump this. Always run tests before committing! [9c337e8cb52b] [0.76_05] * lib/version.pm, lib/version/Internals.pod, vperl/vpp.pm, vutil/lib/version/vxs.pm: Revised version::Internals POD; bump $VERSION for potential last CPAN release. [7b670b5d6ea9] 2009-07-22 John Peacock * lib/version/Internals.pod: WIP for version::Internals [8297110f2601] 2009-07-21 John Peacock * vperl/vpp.pm: Don't need to load the class in order to check whether it contains package or assignments. [06243347218c] 2009-07-18 John Peacock * lib/version/Internals.pod: Rename Extended to Dotted-Decimal [dc359eae7e2a] * lib/version/Internals.pod: Rename "Numeric" to "Decimal" [b6b50a5daa42] * t/01base.t, vperl/vpp.pm: Fix for RT#47980. Don't check $@ if you haven't actually done the eval(). [acb920d7cef0] 2009-07-16 John Peacock * lib/version.pod: Apply David Golden's suggested changes with some minor massaging. [e9512a15a222] 2009-07-15 John Peacock * lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, vperl/vpp.pm, vutil/lib/version/vxs.pm: Another CPAN alpha release. [e26574a18138] * lib/version/Internals.pod: Start reworking the Internals documentation into something useful. [8e9ab213ca71] 2009-07-14 John Peacock * lib/version.pod: Tweakage of POD [f4b255271dea] 2009-07-10 John Peacock * Neglected to delete this directory from the repo [c15753ca26a4] 2009-06-29 John Peacock * lib/version.pm: Allow the pure Perl version module to be installed on Perl 5.10.0, and trump the core code. [66b7fe42bb1c] * vutil/vxs.xs: Better heuristic for deciding when to rebless [b1047051f49d] 2009-06-28 John Peacock * MANIFEST: Remove old file from MANIFEST [fef46a79d99e] * t/02derived.t: Convert this test to make its own Empty class [512119966626] * t/01base.t, t/02derived.t: Missed a couple more MAGIC NUMBERS in the tests. [de9b1f70035c] [0.76_03] * t/03require.t, vutil/ppport.h, vutil/vxs.xs: Tests all pass now in 5.005_04 in XS mode too! Need to adapt the pure Perl release to work with 5.10.0 as well. [d87810010af2] 2009-06-27 John Peacock * vutil/vutil.c: Whitespace differences from blead [11d9d5aa14e5] * lib/version.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/ppport.h, vutil/vutil.c, vutil/vutil.h, vutil/vxs.xs: Sync changes from bleadperl to vutil.c [06a791415f60] 2009-06-26 John Peacock * lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/vutil.c, vutil/vutil.h, vutil/vxs.xs: Finally have all tests passing in 5.10.0! [12e2c2734df2] [0.76_02] 2009-06-23 John Peacock * lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, t/coretests.pm, vutil/vutil.c, vutil/vutil.h, vutil/vxs.xs: Disable all tests for 5.10.0 for the moment, so we can release as an alpha and not falsely claim success or failure. [117cf7bc318c] [0.76_01] 2009-06-13 John Peacock * MANIFEST, lib/version.pm, lib/version.pod, t/coretests.pm, t/survey_locales, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/vutil.c: Fix RT#46921 - locale and eval action at a distance. All tests pass except on 5.10.0 (because the core code is broken). [62418faea5c1] * vperl/vpp.pm: Fix mistaken regex to convert large exponential numbers to non- exponential form before scanning. Resolves: https://rt.cpan.org/Ticket/Display.html?id=45241 [5715905cff8e] 2009-05-27 John Peacock * lib/version.pod: More fiddling with the revised POD. [21ade06134cf] 2009-05-21 John Peacock * t/coretests.pm, vperl/vpp.pm: Resolve some more misleading warnings from vpp.pm in 5.005 and 5.6 [ed2fef63bcd5] * lib/version.pod, vutil/vxs.xs: Misplaced #endif caused 5.005_04 and 5.6.x to fail tests. Add documentation for is_qv. [ff49d875d4db] 2009-05-18 John Peacock * Build.PL, MANIFEST, Makefile.PL, lib/version.pm, t/02derived.t, t/coretests.pm, vperl/vpp.pm, vutil/vxs.xs: Make all test pm files use File::Temp. Change qv() to be both method and function. All tests pass using Build.PL from perl 5.6.x forward, but a couple of test failures using Makefile.PL in 5.6.x and 5.005_04. [ed43ca29ece0] 2009-05-16 John Peacock * lib/version.pm, lib/version.pod, lib/version/Internals.pod, t/01base.t, t/02derived.t, t/coretests.pm: Tests pass but POD is incomplete [11254dcab7d9] 2009-05-10 John Peacock * lib/version.pm, t/01base.t, t/coretests.pm, vperl/vpp.pm, vutil/vxs.xs: All tests pass in all Perl's and in XS and pure Perl. Perl 5.005_04 still throws lots of stupid warnings in pure Perl; can't help it apparently. [9a918d58dade] * lib/version.pm: Now tests all pass on 5.005 as well (two warnings I can't prevent) [5a39adbf0540] * lib/version.pm, t/02derived.t, t/coretests.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm: Now all three test files are 100% for 5.8.x and 5.10.x, but 01 and 02 fail with 5.6.x and 5.005 [a4752ce2b56f] 2009-05-09 John Peacock * lib/version.pm, t/01base.t, t/02derived.t, t/03require.t, t/coretests.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/ppport.h, vutil/vxs.xs: Begin massive reorg/redesign. Tests 01 and 03 are 100%; 02 needs work. [a3753d1d5cce] 2008-07-19 John Peacock * Build.PL, README, t/coretests.pm, vperl/vpp.pm, vutil/vutil.c: Fix segfault with core version stringification of serialized version objects without an 'original' entry. See http://rt.perl.org/rt3/Public/Bug/Display.html?id=56606 [16daa88f2678] [0.76] 2008-07-09 John Peacock * lib/version.pm, vperl/vpp.pm, vutil/vutil.c, vutil/vutil.h, vutil/vxs.xs: Only need to rev the underlying vstringify2() function. [23e9f4481634] * Build.PL, Makefile.PL, lib/version.pm, t/01base.t, t/coretests.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/vutil.c, vutil/vutil.h, vutil/vxs.xs: Commit working implementation to handle badly formed version objects thanks to Data::Dumper. :( [6050e0da2b4c] 2008-06-15 John Peacock * Build.PL, Makefile.PL, README, lib/version.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm: Interim release to correctly install under Perl v5.10.0. [c4aa055ccd98] [0.7501] 2008-06-07 John Peacock * lib/version.pm: Forgot to bump the $VERSION. Go figure. [dbbecb65c4d0] [0.75] * README, lib/version.pod: Improve POD to clarify usage and prevent confusion. [eee5ab6de8f5] 2008-04-02 John Peacock * README, vperl/vpp.pm, vutil/lib/version/vxs.pm: Optionally use the more efficient XSLoader instead of DynaLoader. Resolves http://rt.cpan.org//Ticket/Display.html?id=34590 [a5523907ee11] 2007-10-25 John Peacock * lib/version.pm, t/coretests.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/vutil.c: Data::Dumper is sometimes too clever for its (and our) own good. When copying an existing version object, directly set newSViv instead of using &PL_sv_yes, since the latter has a PV slot which looks shared to D::D's jaundiced eye. Resolves: http://rt.cpan.org/Public/Bug/Display.html?id=30004 [5aca82860f43] [0.74] 2007-09-21 John Peacock * Makefile.PL, README, lib/version.pm, t/coretests.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/vutil.c: New code to handle versions too large to fit into an IV slot. Both the pure Perl and XS code are now safe to use with ~0 Test new functionality. [f4568009efad] [0.73] 2007-04-18 John Peacock * README, lib/version.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm: Neglected to delete or comment out a $DB::single (again). [2d253bf649ea] [0.7203] * vutil/vutil.c: One last place that needed a leading 'v' (for non-magic v-strings). [a04ee2c3f3c7] [0.7202] * lib/version.pod, t/coretests.pm, vperl/vpp.pm, vutil/vutil.c: v-string created version objects always stringify with a leading 'v' for consistency's sake, since we have no way of knowing whether one was present for 5.6.0 <= Perl < 5.8.1 (non-magic v-strings). [0a54f4c303f8] 2007-04-17 John Peacock * README, lib/version.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/vutil.c: When copying an existing version object, forgot to copy the original string representation. [c31baa71e540] 2007-04-15 John Peacock * README, lib/version.pm, lib/version.pod, t/coretests.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/vutil.c, vutil/vxs.xs: Return original string value for all stringification cases except for qv(1.2) which returns 'v1.2' for roundtrip purposes. [1db9ee5c5e4d] [0.7201] 2007-04-13 John Peacock * README, lib/version.pm, lib/version.pod, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/vutil.c, vutil/vutil.h: Output the original string form for numeric versions for XS code now. Ready to release to CPAN. [b27f4db6e569] [0.72] * t/coretests.pm, vperl/vpp.pm: It will be less surprising to overload string comparisons (now that the default stringification is identical to the initializer) than it would be to not overload them. [54757ab1ca1e] 2007-04-12 John Peacock * vperl/vpp.pm: Better way to handle the undef initialization case. [0e12a1371bc4] * t/02derived.t, t/coretests.pm, vperl/vpp.pm: Disallow string comparisons with version objects. Tests adjusted to use numeric comparisons only. [5b139b397196] 2007-04-11 John Peacock * t/coretests.pm, vperl/vpp.pm: Cache the original string used to initialize the version object and return that when stringifying. Only works with pure Perl class for the moment. [dd91c0a7f5a5] 2007-03-18 John Peacock * README: Add more text to README on v-string support. [82012647bf75] [0.71] * README, t/coretests.pm, vutil/vutil.c, vutil/vutil.h, vutil/vxs.xs: Now supports non-magical v-strings (Perl 5.6.0-5.8.0)! Polymorphic error messages from 5.6.0 onwards. [793bfbb79168] 2007-03-10 John Peacock * lib/version.pm, t/coretests.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/vxs.xs: Polymorphic error messages work everywhere except XS under 5.6.2. :( [c2c671acf8cb] * lib/version.pm, t/coretests.pm, vperl/vpp.pm: Polymorphic error messages now working (and tested) in pure Perl module. [2c6a018178a6] 2007-02-14 John Peacock * Makefile.PL, t/coretests.pm: Don't need to explicitely specify the MAN3POD stuff, since EU::MM will now do that automatically (since the POD is mentioned in PM). Actually, magic v-strings came in at 5.8.1, not 5.8.0 (spotted in the bleadperl variant). [9b1a9191d7e9] 2007-02-13 John Peacock * README, lib/version.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm: Final 0.70 release to CPAN. [fb8101f7bc22] [0.70] 2007-02-09 John Peacock * README, lib/version.pm, t/coretests.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/vutil.c: Error out on malformed input 1._1 (Andy Armstrong ). [ceb5da0ea0ad] [0.69_06] 2007-02-08 John Peacock * vutil/vutil.c: Backport bleadperl changes. [496fa7a3c79a] * README, lib/version.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm: Prepare for another alpha release to CPAN [c936864d4dbf] [0.69_05] * lib/version/typemap, vutil/ppport.h, vutil/vxs.xs: Apply more const'ifying and code cleanup from bleadperl. [c04919f382ed] * README, lib/version.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm: Better regex to handle weird exponential notation under 5.6.x on OSX. [cd765f85311a] [0.69_04] 2007-02-05 John Peacock * Build.PL, Makefile.PL, README, lib/version.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm: Suppress installation (but test anyways) in bleadperl or better. [052939a746ec] [0.69_03] 2007-01-31 John Peacock * README, lib/version.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm: Bump $VERSION's and update README for another dev release [0.69_02] [43bf88ffe737] [0.69_02] * vutil/vxs.xs: XS UNIVERSAL::VERSION code now emits error messages just like the release of Perl it is compiled against. [e7d638fe99e4] * t/coretests.pm: Need to limit the effects of the WARN handler. Stop testing v-strings in Perl 5.6.x until XS code is up to snuff. [15b8fc47ffb8] * t/coretests.pm, vperl/vpp.pm: Complete rewrite of tests to confirm that version::vpp mirrors the different Perl releases' error messages. [32f086418c9a] * vperl/vpp.pm: Carefully replicate [almost] all error messages exactly as different Perl releases would otherwise report. Resolves RT#24675 (once the tests are adjusted). [d277c7a45f69] 2007-01-27 John Peacock * lib/version.pod: Improve documentation of v-strings as version initializers. [49d42e51c0d4] * vperl/vpp.pm: Testing with Module::Build revealed problems with the boolean overload. [87ddff040b7d] * Makefile.PL, lib/version.pm, t/coretests.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm: Fix Makefile.PL to work correctly with 5.6.x and 5.005x. Tests with bare v-strings can now handle 5.6.x releases. Pure Perl release now includes same overloading as XS. [f7289e57f4b4] 2007-01-10 John Peacock * Makefile.PL: Rewrite Makefile.PL again before releasing 0.69 to CPAN. [4fb1f8249790] [0.68] * Makefile.PL: Before releasing to CPAN, make sure to remove stale Makefile.* remnants from previous runs (in case someone tries to rebuild with the pure Perl release after building the XS release). [a7fbbf5a21ef] 2007-01-09 John Peacock * lib/version.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm: Release 0.69 to CPAN [3681a7ecc575] * Makefile.PL, vperl/vpp.pm, vutil/ppport.h, vutil/vxs.xs: Try to make the Makefile.PL more forgiving about evil compilers (RT#24283). Eliminate Scalar::Util from pure Perl version (for Jos ). Latest ppport.h (newer is better, right?). Resolve RT#24239 and 24244, related to PERL_DONT_CREATE_GVSV. [5db624a53702] 2006-11-23 John Peacock * lib/version.pm, t/coretests.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm: Replace checks with Test::More with a custom module (so the tests won't break when Test::More gets updated). [d2082e19d1c3] 2006-10-29 John Peacock * README, lib/version.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm: Release 0.68 to CPAN with locale tests. [b4bf1792d63b] 2006-10-08 John Peacock * vperl/vpp.pm: I was wrong. Apparently all releases of Perl require you to force the PV to be regenerated after changing the locale. [2e99ac0ef2b6] * Makefile.PL, README, lib/version.pm, t/01base.t, t/02derived.t, t/coretests.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm, vutil/vutil.c, vutil/vxs.xs: Lots of changes. Problems noted in bleadperl because of locales which use commas for the decimal point. Both XS and Perl code updated to handle this, which was tricky for the latter because locale handling was so bad prior to 5.8.0. Harmless warning during testing caused by bad interaction between POSIX and Test::More's AUTOLOAD (no idea how to fix it). Also bumped up required versions in tests and updated Makefile.PL to correctly install the POD file. [162884e9f3f2] 2006-08-16 John Peacock * Build.PL, README, lib/version.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm: Use default subclass name in Build.PL, since M::B nukes the version:: namespace during its own initialization. [1a3b365bb27a] 2006-08-08 John Peacock * vperl/vpp.pm: Revert accidental whitespace change [fe39cc294c91] [0.67] * MANIFEST.SKIP: One more regex to prevent patch files being added to MANIFEST [73ed61789941] * Makefile.PL: Dependency on changelog not in correct order with dist [85b15a2ec4fe] * Makefile.PL: Yet another way to structure Makefile.PL so that it autogenerates Changes. [a46bb6a79d8d] * README, lib/version.pm, t/coretests.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm: Once again, fix very small version handling in pure Perl release (globally this time). [b46a5eea2055] 2006-07-31 John Peacock * t/02derived.t, t/coretests.pm: Property change (don't need these to be executable). [2b0ab71d3483] [0.662] * MANIFEST, MANIFEST.SKIP, Makefile.PL, vutil/Makefile.PLz: Add MANIFEST.SKIP so Module::Release will be happy. Hide vutil/Makefile.PL inside top level Makefile.PL (__DATA__). [285f5a279300] 2006-07-30 John Peacock * Makefile.PL, README, lib/version.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm: Force MSVC to only compile, not link, by default. Generate manified PODs in Makefile.PL. Autogenerate 'Changes' from Makefile.PL. [694aaacf2694] 2006-07-26 John Peacock * README, lib/version.pm, t/coretests.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm: Pure Perl UNIVERSAL::VERSION was throwing undef warnings when called without a req, e.g. MODULE->VERSION. [6f91dc9d0eac] [0.661] * Build.PL, Makefile.PL, README, lib/version.pm, vperl/vpp.pm, vutil/lib/version/vxs.pm: More compatibility for inclusion in Module::Build. Remove dependency to Scalar::Util (just guess if it is a v-string). [7421baeeb766] [0.66] 2006-07-19 John Peacock * Makefile.PL, README, lib/version.pm, vperl/vpp.pm, vutil/Makefile.PLz, vutil/lib/version/vxs.pm: More Makefile tweakage. Can't use warnings in Perl < v5.6.0 and need to protect Build.PL from being run by Makefile.PL being a little too helpful. [35592dc8515b] [0.652] 2006-07-17 John Peacock * Makefile.PL, README, lib/version.pm, lib/version.pod, vperl/vpp.pm, vutil/lib/version/vxs.pm: Custom Makefile.PL left debris around if ExtUtils::CBuilder, confusing the Makefile into trying to compile/link something that wasn't there. Also, take out the "0+" numification, which didn't work in vpp.pm, and which I don't want to support with this module anyway. [21e44a14b00e] [0.651] * Build.PL, MANIFEST, Makefile.PL, README, lib/version.pm, vperl/vpp.pm, vutil/Makefile.PLz, vutil/lib/version/vxs.pm, vutil/vxs.pm: Reorganize structure and provide a fully EU::MM compatible Makefile.PL for, among other cases, bootstrap installing of Module::Build (which now depends on version.pm). No new tests, no change to core code. Resolves RT#20493. [50aa186f745f] [0.65] 2006-06-08 John Peacock * README, lib/version.pm, vperl/vpp.pm, vutil/vxs.pm: Bump version in preparation for release to CPAN as 0.64. [e7655fa68ea5] [0.64] 2006-05-30 John Peacock * lib/version.pm, lib/version.pod, t/02derived.t, t/coretests.pm: As it turns out, the import() method *can* be inherited and DTRT. POD adjusted to reflect the current reality. [dba2e3756277] * lib/version.pm, lib/version.pod, t/02derived.t, vperl/vpp.pm, vutil/vxs.pm: Based on a suggestion by David Wheeler, test for already exported qv() in a more inheritance friendly fashion. Create a way to call the base import() from a subclass and have it DTRT and provide documentation for doing so. Ready to release to CPAN as 0.63_01. [73c89d155c52] 2006-05-27 John Peacock * lib/version.pm: Release to CPAN as 0.63 (no really!). [80bdf3fed41a] [0.63] * README, t/coretests.pm, vperl/vpp.pm, vutil/vxs.pm, vutil/vxs.xs: Prevent XS from issuing warnings when initializing with undef or no parameter at all. Release to CPAN as 0.63. [55bb2211d808] * README, lib/version.pm, t/coretests.pm, vperl/vpp.pm, vutil/vutil.c, vutil/vxs.pm: Fix RT 19517 - need to handle 'undef' as a string. Release to CPAN as 0.62. TODO - leaking undef warnings from the XS code [d9f011d31242] [0.62] 2006-05-23 John Peacock * lib/version.pm, vperl/vpp.pm, vutil/ppport.h, vutil/vxs.pm: Use even newer ppport.h, per Marcus Holland-Moritz. Bump $VERSION for release to CPAN as 0.61. [575ef1b58332] [0.61] 2006-05-22 John Peacock * lib/version.pm, t/01base.t, t/coretests.pm: In my haste to jettison Exporter, I neglected to consider that someone might try and load version.pm twice. Fixed (and tested). [9ad5578e76e3] 2006-05-20 John Peacock * README, lib/version.pm, vperl/vpp.pm, vutil/ppport.h, vutil/vutil.c, vutil/vutil.h, vutil/vxs.pm, vutil/vxs.xs: Replace ppport.h with much improved version. Strip out my pathetic compatibility code (see above). Add dependency to ppport.h to each file with appropriate #define's. Release to CPAN as 0.60. [c0d805c8ba0e] [0.60] 2006-05-18 John Peacock * README, lib/version.pm, vperl/vpp.pm, vutil/vxs.pm: Prep for another beta to CPAN [b45cdced4e56] [0.59_05] * t/coretests.pm, vperl/vpp.pm, vutil/ppport.h, vutil/vutil.c, vutil/vutil.h: Integrate upstream bleadperl changes. Add compatibility code to vutil.h until ppport.h catches up. Fix (and test for) the case where class->VERSION is called [09ff96d23972] 2006-05-16 John Peacock * MANIFEST, README, lib/version.pm, t/03require.t, t/coretests.pm, vperl/vpp.pm, vutil/vxs.pm: Now works with 'require version' and not just 'use version' (with tests). Pure Perl UNIVERSAL::VERSION now operates correctly when used as a fallback inherited class method, e.g. class->VERSION or $obj->VERSION. [9151f4544773] [0.59_04] 2006-05-14 John Peacock * README, lib/version.pm, t/coretests.pm, vperl/vpp.pm, vutil/vxs.pm: Fix reported failures with UNIVERSAL::VERSION as fallback method in vpp.pm. Augment new() to try and spot non-magic v-strings for v5.6.2 - v5.8.1. [aae55a10164e] [0.59_03] 2006-05-05 John Peacock * Build.PL, README, lib/version.pm, lib/version.pod, t/coretests.pm, vperl/vpp.pm, vutil/vxs.pm: Prep beta release to CPAN. Improve POD on using modules that use version.pm. New tests. Require pure Perl module for 5.005_03 (for now). [ff2d6e8e71c5] [0.59_02] * vutil/ppport.h, vutil/vxs.xs: Tweak ppport.h #define's to support 5.0005_04 [9ab000d902a6] * README, lib/version.pm, t/02derived.t, t/coretests.pm, vperl/vpp.pm, vutil/vutil.c, vutil/vxs.pm, vutil/vxs.xs: Rewrite to remove dependency on Exporter. Fix RT#19017 - problems related to very small version numbers. [87e5e51a0271] 2006-04-07 John Peacock * lib/version.pm, t/coretests.pm: Not sure if this works on 5.005_03 after all [4ace64ebdc62] 2006-03-28 John Peacock * Build.PL, README, lib/version.pm, lib/version/typemap, t/01base.t, t/02derived.t, t/coretests.pm, vperl/vpp.pm, vutil/vutil.c, vutil/vxs.pm: Complete compatibility with Perl 5.005_0x as well as 5.6.2. Remove the compatibility warnings.pm (since it was a bad idea). Release to CPAN. [ba2b5ed61bca] [0.59] 2006-03-27 John Peacock * Build.PL, README, vperl/vpp.pm: Fix the pure Perl release for 5.005_0x (thanks to Nick Ing-Simmons). Ready for release to CPAN. [7f31577fa67f] [0.58] * Build.PL, README, lib/version.pm, t/01base.t, t/02derived.t, t/coretests.pm, vperl/vpp.pm, vutil/ppport.h, vutil/vutil.h, vutil/vxs.pm: Restore compatibility with Perl 5.6.x (though not with 5.005_x yet). [f39cec03cf70] 2006-03-09 John Peacock * lib/version.pod, t/01base.t, t/02derived.t, t/coretests.pm: * lib/version.pod Minor POD fixup (revealed by pod2html). * t/coretests.pm t/01base.t t/02derived.t Suppress status messages except when --verbose is used. [d56f87b98787] 2006-02-26 John Peacock * Build.PL, README, lib/version.pm, vperl/vpp.pm, vutil/vxs.pm: Release 0.57 to CPAN. Only bumps $VERSION and slightly improve Build.PL. [f6b6c84402f2] [0.57] 2006-02-20 John Peacock * Build.PL, README, lib/version.pm, vperl/vpp.pm, vutil/vxs.pm: Next beta release to CPAN. * Build.PL Subclass Module::Build and override have_c_compiler() with one that fails without die'ing. * README lib/version.pm vperl/vpp.pm vutil/vxs.pm $VERSION++. [c3f3788e4619] [0.56_03] * README, lib/version.pm, t/coretests.pm, vperl/vpp.pm, vutil/vxs.pm: Beta release to CPAN. * README lib/version.pm Bump $VERSION for new release. * vperl/vpp.pm Fully implemented UNIVERSAL::VERSION in the pure Perl module. Set explicit $VERSION so that correct module gets loaded during testing. * vutil/vxs.pm Set explicit $VERSION so that correct module gets loaded during testing. * t/coretests.pm Additional tests (based on bleadperl t/op/use.t). [d6427d31c3fc] [0.56_02] 2006-02-19 John Peacock * Build.PL, README, lib/version.pm: Another workaround for incomplete testing [bc127e964dda] [0.56] 2006-02-18 John Peacock * Build.PL, lib/version.pm: Emergency release to fix up M::B 0.2611 problem [94917cf31263] [0.55] 2006-02-17 John Peacock * Build.PL: Neglected to clean up after XS code (since we are playing games). [c255e7db0d3b] [0.54] * README: No, really, the final changes before releasing to CPAN. :( [e4f63e8cc148] * lib/version.pm, vperl/vpp.pm, vutil/vxs.pm, vutil/vxs.xs: Final updates for 0.54 release to CPAN. [4ada50af160d] 2006-02-15 John Peacock * Build.PL, MANIFEST, README, lib/version.pm, lib/version.pod, lib/version/vxs.pm, lib/version/vxs.xs, t/coretests.pm, vperl/vpp.pm: Merge from version-combined branch. Equivalent to RELEASE_0_53_03. [12eebfc27a98] 2006-02-12 John Peacock * Build.PL, README, lib/version.pm, lib/version.pod, vperl/vpp.pm, vutil/vxs.pm: Ready for CPAN release as beta module. * vutil/vxs.pm vperl/vpp.pm lib/version.pm Backrev to a beta release. * README lib/version.pod Document changes in interface of $obj->new(). * Build.PL Make Scalar::Util requirement optional based both on Perl version and on whether vpp.pm is being installed. [dc5177e9c787] [0.53_03] * t/coretests.pm, vperl/vpp.pm, vutil/vxs.xs: Working pure Perl version objects (but relies on Scalar::Util). Change behavior of XS model too (see below). All tests pass. * vutil/vxs.xs $v2 = $v1->new() shouldn't clone original value. * t/coretests.pm Make sure obj->new() doesn't clone value. * vperl/vpp.pm Implement CVS-style (evil) initialization. Add _verify() sub to make sure derived classes don't break things. Add test for vstring (uses Scalar::Util) and DTRT. [e52565977ef4] * lib/version.pm, vperl/vpp.pm, vutil/vxs.pm: Nearly working pure Perl version objects. A couple of tests still fail. * lib/version.pm Bump version. Re-enable vpp.pm support * vperl/vpp.pm Bump version. Completely rewrite new() to exactly mirror what the XS code does. Support swapped comparisons. Correct $v->normal() code for short decimal versions. * vutil/vxs.pm Bump version. [b17e3fd4647e] 2006-02-09 John Peacock * Build.PL, MANIFEST, t/01base.t, t/01base.t.PL: Complete merge with version/trunk (all tests pass). [3d0b79179484] * Build.PL, README, lib/version.pm, lib/version.pod, t/02derived.t, t/coretests.pm, vutil/vutil.c, vutil/vxs.pm: Merge from version/trunk [b361d26556a3] * Build.PL, lib/version.pod, vutil/vutil.c: Commit changes prior to push to implement pure Perl alternative. * Build.PL Need to exclude building on all 5.9.x bleadperl releases. * lib/version.pod Forgot a quote in one of the example code fragments. * vutil/vutil.c Sync with bleadperl. Only warn if 'use warnings' is set. [3edcd94d655e] 2006-01-10 John Peacock * README, lib/version.pm, lib/version/vxs.pm, t/coretests.pm, vutil/vutil.c: Release 0.53 to CPAN. * vutil/vutil.c warn() when initialization string contains trailing characters (rather than silently ignoring them). Suggested by David Wheeler. * t/coretests.pm Test the above change. * README Document the above. * lib/version.pm lib/version/vxs.pm Bump $VERSION. [6c80dfddbbae] [0.53] 2006-01-06 John Peacock * README, lib/version.pm, lib/version/vxs.pm, t/01base.t, t/02derived.t, t/coretests.pm, vutil/vutil.c: New version to deal with malformed input data that came up in bleadperl: sprintf of version objects * README lib/version/vxs.pm lib/version.pm Bump version. * vutil/vutil.c Die if input value has underscore but no decimal. * t/01base.t t/02derived.t Use no_plan so I don't need to increment tests any more. * t/coretests.pm Check for malformed input. [befad918782c] [0.52] * README, lib/version.pm, lib/version/vxs.pm, vutil/vutil.c: Ready for new release to CPAN with minor changes. * README Describe minor changes * lib/version/vxs.pm lib/version.pm Bump $VERSION. * vutil/vutil.c Eliminate code I'm never going to use. [5d451682eb1e] [0.51] * lib/version.pm: this still does not work [f2bf12c6b92b] 2005-12-13 John Peacock * lib/version.pm: this doesn't work either [86c7d3977d59] 2005-12-09 John Peacock * lib/version.pm: Thist doesn't actually work, but let's save it for later, just in case. [317bd847d6bb] * t/coretests.pm: use the correct path to perl, not that it matters [fd702b4928f5] * a new start [e854d5f1583e] 2005-12-03 John Peacock * lib/version.pod: * lib/version.pod PAUSE does so support version objects. Elaborate on support for Module::Build and lack thereof for ExtUtils::MakeMaker. [a1ef1dd2300d] 2005-12-02 John Peacock * lib/version/vxs.pm: * version/vxs.pm Forgot to bump this. When am I going to have inherited props? [1c6d537e5f5f] [0.50] * Build.PL, README, lib/version.pm, lib/version.pod: * Build.PL Explicit minimum version of Module::Build. Fixes * README Whoo-hoo! Remember to update this the first time. * lib/version.pm Make sure that there is no possible way that Perl will try to include the non-existant pure Perl vpp.pm * lib/version.pod Complete rewrite that is hopefully easier to understand. [77e2dc4f6adc] 2005-11-01 John Peacock * t/02derived.t, vutil/vutil.c: * vutil/vutil.c Use trinary operator to choose power of 10, rather than pow(), which caused some problem with AIX 5.1. Resolves: * t/02derived.t Suppress unnecessary warning when overriding qv() sub. [aa151d606d89] 2005-10-10 John Peacock * README: * version/README Remember to update this for 0.49 release. [77a3618909be] 2005-10-09 John Peacock * Build.PL: Fix Build.PL so Win32 will compile properly [a843b743c6ac] 2005-10-06 John Peacock * Build.PL, lib/version.pm, lib/version.pod, lib/version/vxs.pm, t/01base.t, t/02derived.t, t/coretests.pm, vutil/vutil.c: * version/Build.PL Explicit call to dist_name to help Windows DTRT. Resolves ticket: * lib/version/vxs.pm lib/version.pm lib/version.pod t/01base.t t/02derived.t t/coretests.pm vutil/vutil.c Change implementation to return version objects instead of version::vxs object. Document that qv() isn't inherited and give work around. Update tests to no longer test version::vxs class directly (since it doesn't work). Resolves ticket: [d1d72857d535] 2005-09-27 John Peacock * Build.PL, MANIFEST, lib/version.pm, lib/version/vxs.pm, lib/version/vxs.xs, t/01base.t, t/01base.t.PL, t/02derived.t, vperl/vpp.pm, vutil/vxs.pm, vutil/vxs.xs: Check in work so far on combined XS and PP version [3edcf7671ee6] * Branch to develop the combined XS and PP version [2153e5a1c98c] 2005-09-26 John Peacock * lib/version.pod: Start POD rewrite. [faf73bec8ed5] 2005-09-14 John Peacock * MANIFEST, README, lib/typemap, lib/version.pm, lib/version.pod, lib/version.xs, lib/version/typemap, lib/version/vxs.pm, lib/version/vxs.xs, t/01base.t, t/02derived.t, t/coretests.pm, vutil/vutil.c: Significant archectectural change (object hash has to contain reference to array not the array itself); see for details. Initial changes to support pure Perl variant (not included yet), see for more details. All POD moved to seperate file. Tests abstracted out for reuse by different classes. [32b1c7454fd2] * README: Final changes to README before merging back [f0e5937b6b0f] * MANIFEST, lib/version.pm, lib/version.pod: Extract POD into seperate file and re-add version.pm [178da6ad8799] * Build.PL, MANIFEST, lib/typemap, lib/version/typemap, lib/version/vxs.pm, lib/version/vxs.xs, lib/vxs.pm, lib/vxs.xs, t/01base.t, t/02derived.t, t/coretests.pm: Fully working xs base class and derived class [6a5eb5274261] * MANIFEST, lib/typemap, lib/vxs.pm, lib/vxs.xs, t/01base.t, t/02derived.t, vutil/vutil.c: Intermediate commit before rename [3802a826abea] * MANIFEST, lib/vxs.pm, t/01base.t: First working wrapper class [0da6c1445e0f] * lib/version.pm, lib/version_xs.xs, lib/vxs.pm, lib/vxs.xs: Working again as new classname [e332d1afbe87] * Build.PL, MANIFEST, lib/typemap, lib/version.pm, lib/version_xs.xs, t/01base.t, vutil/vutil.c: Interim commit prior to renames [269637fd55a2] * lib/version.xs, lib/version_xs.xs: Another commit but it still doesn't work [234bc2a6cc79] * MANIFEST, lib/version.pm, lib/version.xs: Intermediate commit before renaming file [ef5daf9123d1] 2005-09-10 John Peacock * Branch to begin to split the module to load either XS or pure Perl [4dd58d14600b] 2005-09-07 John Peacock * t/01base.t, vutil/vutil.c: "version" element of hash must be a reference, see: for details. Also, function name changes backported from bleadperl version. [2daa05af0f6a] 2005-08-23 John Peacock * README, lib/version.pm, t/01base.t, vutil/vutil.c, vutil/vutil.h: Badly written subclasses could SEGV (reported by Andreas Koenig). Now all version objects are validated before use. Add vverify() function to validate version objects and include it before each use of a version object. Add tests for poorly written subclass that tickle the above function. Apply const'ifying from bleadperl and reformat calls to sv_[cat|set]pvf to be consistent with bleadperl source. [b0bd46134f4d] 2005-08-22 John Peacock * Build.PL, README, lib/version.pm, t/01base.t, vutil/vutil.c: Leading whitespace or lack of leading zero caused the the object to be initialized incorrectly (reported by Andreas Koenig). Added POD for subclassing. Removed cruft from README file. [ad5d2eed81e1] 2005-08-03 John Peacock * README, lib/version.pm, t/01base.t, vutil/vutil.c: Don't strip trailing zeros unneccesarily [70ae75ded6a9] 2005-08-02 John Peacock * lib/version.pm: Spelling fixes from "Piotr Fusik" [7c3c5e9eb831] 2005-07-24 John Peacock * Build.PL, MANIFEST, README, lib/version.pm, lib/version.xs, util/ppport.h, util/vutil.c, util/vutil.h, vutil/ppport.h, vutil/vutil.c, vutil/vutil.h: Complete rename of files to prevent GCC 4.0 bug [6900db644e53] * util/util.c, util/util.h, util/vutil.c, util/vutil.h: Preliminary commit for rename of util.[ch] [e9e93bc9ae25] 2005-06-06 John Peacock * README, lib/version.pm, t/01base.t, util/util.c, util/util.h: Final changes to release 0.43 to CPAN * README, lib/version.pm Bump $VERSION number * t/01base.t Test that single term version expands to triplet for $v->normal. Eliminate "Exporter" from derived class. * util/util.c Various const'ifying to match Perl's own changes. Handle short and really short array outputs in vnormal(). * util/util.h const'ify Perl_scan_version(). [e024e3970f74] 2005-05-23 John Peacock * lib/version.pm, t/01base.t, util/util.c: Complete rewrite of parser to handle CPAN-style (two significant decimal) versions, as well as finish documenting the changes. * util/util.c Simplify parser to just count digits when parsing numeric versions. * lib/version.pm Rewrite documentation on Numeric Alpha Versions and make all examples consistent. * t/01base.t Add additional tests for CPAN-style alphas as well as object->new(). [c26b2ad4d80f] 2005-05-20 John Peacock * lib/version.pm, lib/version.xs: * lib/version.pm Revised POD to correspond to new behavior with regards to both Quoted Versions and Alpha Versions. * lib/version.xs Extend new() to be callable as an object method. Copy existing object if called as object method with no parameter. [37ccec7cf023] 2005-05-17 John Peacock * Build.PL, README, lib/version.pm, t/01base.t, util/util.c: Working towards a release to CPAN. * README lib/version.pm First pass at documenting the external changes. * t/01base.t Since vcmp() is working again, can restore the minimum to the use line. * util/util.c Finish up handling for vcmp to deal with alpha versions. [0e18349632ef] * lib/version.xs, util/util.c: Almost completely working; only the comparison tests with non- objects is still failing. * lib/version.xs Simplify is_alpha() now that it is just as hash flag. * util/util.c Manually create and copy the hash elements when creating new object from old object. Forgot to make sure to display all subversion from short numeric versions. [5b742513620e] 2005-05-15 John Peacock * MANIFEST, lib/typemap, lib/version.xs, ppport.h, typemap, util.c, util.h, util/ppport.h, util/util.c, util/util.h, version.xs: Completed (?) to move to Module::Build * lib/typemap lib/version.xs Move XS and support files to lib/ * util/ppport.h util/util.c util/util.h Move utility functions in their own directory (c_source) * MANIFEST Updated to reflect new file locations Add additional files that were originally left out of file Alphabetize this listing (for compulsiveness) [d3f75de8d860] * Build.PL, Makefile.PL, t/01base.t, util.c, version.xs: Intermediate commit to facilitate move to Module::Build as well as work on new hash-based object (all tests do not suceed) * Makefile.PL Replace ExtUtils::MakeMaker with Module::Build wrapper * Build.PL New M::B file * version.xs Try and deal with case where no parameter was passed to new() * util.c Changes to access hash-based object (vcmp still busted) * t/01base.t Changed to prevent core dump (temporarily) [47aeafff343b] 2005-05-09 John Peacock * util.c: Implement alpha versions using secret array zero slot to differentiate between two place alphas (1.02_03) and three place alphas (1.002_03) so that versions which only use two significant places normally will still sort correctly with their alpha versions. * util.c (Perl_scan_version): Somehow manage to both simplify and complicate the code at the same time. (Perl_vnumify): use the new zero'th array element to distinguish between 2 and 3 significant decimal places for printing. [ef0f99d37a37] 2005-04-22 John Peacock * t/01base.t, util.c: * util.c Handle two digit alpha versions Once a v-style or FP, always a v-style or FP * t/01base.t Altered tests to match new expectations [c6b16a7f9cfe] 2005-02-07 John Peacock * Makefile.PL, README, lib/version.pm, t/01base.t, util.c, version.xs: * Makefile.PL Windows doesn't understand the braces for shell expansion * README, lib/version.pm Change $VERSION string * t/01base.t Correctly compare to numified version (instead of stringified) * util.c Use same code as bleadperl AvReal_on required to fix problems under threaded Perl Slight rewrite of loop code to fix compiler bug on OS X Display alpha versions properly * version.xs new() returns void since it actual returns on the stack [ae634dc379af] [0.42] 2004-07-13 John Peacock * README, lib/version.pm, t/01base.t, util.c: * util.c Fix infinite loop for CVS-style versions of more than 3 decimal places. Thanks to Richard Evans * t/01base.t Test to make sure above doesn't happen again. * lib/version.pm Increment the $VERSION again. * README Remember to update this before releasing (for a change). [1b7ab2af9364] [0.41] 2004-07-11 John Peacock * lib/version.pm, version.xs: * lib/version.pm Increment $VERSION number; have to quote to get the tgz file named correctly (isn't that what this module is supposed to fix?) * version.xs:UNIVERSAL_VERSION() Check for null sv before attempting sv_derived_from() Thanks to Marcus Holland-Moritz for finding this. [beaac28edd99] [0.40] 2004-04-14 John Peacock * MANIFEST, README, lib/version.pm, lib/version/AlphaBeta.pm, ppport.h, t/01base.t, t/02AlphaBeta.t, util.c, util.h, version.xs: Merge changes from version-0.39 back to trunk [9ffe6daf8ff0] 2004-01-07 John Peacock * MANIFEST, Makefile.PL, lib/version.pm, t/01base.t, t/02AlphaBeta.t, util.c: * t/02AlphaBeta.t * t/01base.t Update tests to require newer version. Change test for CPAN-Style version behavior. * MANIFEST Delete 'Changes' from repository since it will now be autogenerated. * lib/version.pm Clean up POD to reflect actual behavior of code. * Makefile.PL Add new target to automatically generate the 'Changes' file. * util.c (Perl_scan_version): rewrite code to use AV * instead of SV * for internal representation; trigger CPAN-style only for second term. [1c588fb86973] 2004-01-04 John Peacock * Ignore MakeMaker-generated files in svn status [506090c733c8] * Ignore MakeMaker-generated files in svn status [bbd9ed305fd9] * Ignore MakeMaker-generated files in svn status [e0ea9551cd7b] 2004-01-02 John Peacock * lib/version.pm, util.c: * lib/version.pm (POD): Initial documentation of CPAN-Style versions. * util.c (Perl_scan_version): Try and handle CPAN versions (two decimal places) differently from Perl-style (three or more decimal places). [f8f05480690b] 2003-12-29 John Peacock * README, lib/version.pm, typemap, util.c, version.xs: * typemap Stop automatically dereferencing input variable * lib/version.pm Update $VERSION for a change * README Include warning on memory leaks * util.c (new_version): use upg_version exclusively (upg_version): move code from new_version here * version.xs Stop dereferencing input variables Stop assuming that the PV has a value [df739f393e0a] [0.34] * t/01base.t, util.c, version.xs: * t/01base.t Replace postfix increment with prefix increment to prevent erroneous "Attempt to free..." errors Add test of CVS $Revision: $ style versions * util.c Rewrite new_version to free temporary string variable * version.xs Rewrite version->new() to eliminate temp string for CVS $Revision: $ Rewrite version->qv() to use scan_version instead of new_version [5cc05e7606a8] 2003-12-21 John Peacock * lib/version.pm, version.xs: M version.xs Go through code to ensure that there are no leaking scalars Sadly, there are still leaks from version::VERSION of unknown origins [24b98fd1a0a8] [0.33] * lib/version/AlphaBeta.pm, t/02AlphaBeta.t: M t/02AlphaBeta.t M lib/version/AlphaBeta.pm Implement an alternate object representation Overload stringify() with custom function [19b66371282f] 2003-10-26 John Peacock * t/01base.t, t/02AlphaBeta.t: M t/02AlphaBeta.t Add empty derived class and modify tests to run M t/01base.t Work around bug with postfix increment under all Perl < bleadperl [473e143b1e01] 2003-09-10 John Peacock * MANIFEST, lib/version.pm, t/01base.t, util.c, util.h, version.xs: Fix for Ticket #3764 - need to strip final term before chop() Implement qv() function and document/test [788e7b71b497] [0.32] * Changes: Remove the changes file from the repository. Generate it before release: svn log file:///var/svn/modules/version/trunk and eventually by 'release.pl --changes' [0eb3a94ffca5] [0.31] * ppport.h, t/01base.t, util.h: Finish backporting bleadperl changes Special case test for 5.005_03 Patch ppport.h to support IVSIZE for 5.005_03 [6febfec130a2] * MANIFEST, lib/version.pm: No, really delete the lines from MANIFEST Last bit of clean up in the POD [1a4f9ba9d385] * MANIFEST, lib/version.pm, lib/version/Empty.pm, ppport.h, t/01base.t, util.c: Delete version::Empty module and include in t/01base.t instead Correct MANIFEST (delete missing files and add ppport.h) Make version::stringify() return at least three subversions [9ecd20ec017c] 2003-09-09 John Peacock * lib/version/Empty.pm, t/01base.t, t/03emptyclass.t, t/basetests.inc, util.c, util.h, version.xs: Integrate changes from bleadperl Combine emptyclass.t test into 01base.t Use ppport.h instead of homebrewed #define's [a58c0d99ded0] 2003-09-07 John Peacock * MANIFEST, lib/version.pm, lib/version/Empty.pm, t/01base.t, t/03emptyclass.t, t/basetests.inc, version.xs: Extend version::new() to handle derived classes Abstract t/01base.t into external file Create and test empty derived class FIX: "attempt to free unreferenced scalar" during testing [de022ab51681] 2003-08-08 John Peacock * MANIFEST, Makefile.PL, lib/version.pm, lib/version/overloaded.pm, overloaded.xs, t/01base.t, typemap, util.c, version.xs: Change the overloaded class to version::overload Add the code (but don't implement yet) for version::tied Change the test to use version::overloaded (though it will be changed back) [35bb2adf4ba9] 2003-07-09 John Peacock * Copy off a branch to work on Damian-inspired lunacy [7053382ad592] * Start working on version objects with math ops [7b6882da276f] * Changes, MANIFEST, lib/version/AlphaBeta.pm, t/01base.t, t/02AlphaBeta.t, t/1.t, t/2.t: Merge changes made accidently on branch back to head [e7c224441166] 2003-06-14 John Peacock * Changes: Forgot to commit this before releasing. [ba53302707ce] 2003-06-13 John Peacock * lib/version.pm: Correct the example code (again) to correct for CVS update problems [e2cb0b698fa6] [0.29] * lib/version.pm: Reformatted POD's from [84c56b8d9713] * README, lib/version.pm, t/1.t, util.c, version.xs: Change reference from "beta" to "alpha" to follow PAUSE convention Add new function ->is_alpha() to test for alpha versions Add docs for all logical operations on version objects Fix example to have matching versions (old CVS issue) [c0af15499271] * MANIFEST, Makefile.PL, README, lib/version.pm, lib/version/AlphaBeta.pm, t/2.t: Implement version::AlphaBeta module Copy repository history from CVS into subversion [935e2da3f52a] * lib/version.pm, t/1.t, t/version.t, version.pm: To prepare to load /home/jpeacock/tmp/version-0.28 into version/trunk, perform 2 renames. * version/trunk/t/1.t: Renamed from version/trunk/t/version.t. * version/trunk/lib/version.pm: Renamed from version/trunk/version.pm. [cdc4742b8b90] 2003-01-05 John Peacock * Changes: Extract most recent log messages for main file [0fbc1dba9567] * version.pm: Rewrite POD to call a v-string a v-string Reformat POD to look nicer [a014fed09b37] * util.c: Make vnumify return an actual NV (instead of an SV which looks like one) [0a2fed058c27] * README: Make warnings even more dire [bf993fd59ec4] * t/version.t: change comment message to more accurately reflect the test [9a5815cece40] 2002-12-27 John Peacock * README, util.c, version.pm, version.xs: Rewrite to support new model of "Numeric Versions" and "String Versions" [000c8b44ac4b] 2002-12-18 John Peacock * Changes, t/version.t, util.c, util.h, version.pm, version.xs: New version to cope with GSAR's vision of bare number versions [82b1817d713a] 2002-12-05 John Peacock * t/version.t: Make -w clean tests [aae69baccb71] * util.c: Bring into sync with perl-current [bb2a04ec56eb] 2002-11-18 John Peacock * Changes: Bring current with repository version [5cfee41009bd] * version.pm: Fix compile errors under threaded Perl's Supress {Unquoted string version} warnings [8bd93dd3c0ee] * version.xs: Fix compile errors under threaded Perls [d377ef35118a] * typemap, util.c, util.h, version.xs: Fix compile errors under threaded Perl's Supress {Unquoted string "version"} warnings [3d4f35748f92] 2002-10-15 John Peacock * typemap, util.c, version.pm, version.xs: Fix typos Fix handling of null versions [39105137e896] 2002-10-11 John Peacock * util.c: use Perl_croak from C code [ebc39c798544] 2002-10-09 John Peacock * t/version.t: Recover gracefully to null versions (rather than core) [7980b02f30ee] * Changes, util.c, version.pm: Recover gracefully to null versions (rather than core) [b6245e0abb31] 2002-10-05 John Peacock * version.pm: Document extended decimal version parsing [1717167152b9] * t/version.t, version.pm, version.xs: Force all files to next major revision (so the version works) [9c8c77f45216] * t/version.t: Add tests for 1.002003 => 1.2.3 [54ebc42d651a] * util.c: Add support for 1.002003 => 1.2.3 [ceea5218722f] * version.pm: Remove dependency on Exporter.pm [f513eb72eb51] 2002-09-29 John Peacock * t/version.t: Update with version from perl-current [cf58a334294b] * util.c, util.h, version.pm, version.xs: Change vstringify and vnumify Reword main POD slightly [292739d73b7b] 2002-09-28 John Peacock * t/version.t, util.c, util.h, version.xs: Final changes to release to CPAN Merged code into perl-current [7c2f94f078c4] * README: Ready to release to CPAN [0fafa807f6d4] * version.pm: POD changes [78e52ec26d01] * version.xs: Cannot use SvPV_nolen in 5.005_03 [fc0f47b36657] 2002-09-23 John Peacock * version.pm: Document the UNIVERSAL::VERSION replacement [6caf25d88244] * util.c, version.xs: Successfully create and test my own UNIVERSAL::VERSION replacement [5dbcd61397a3] 2002-09-16 John Peacock * util.c: Improve the testing of beta versions [0e7738ce7237] * version.pm: More POD changes [e9041204d8ea] * version.pm: Add additional testing Add POD [f9ef01c0f23e] * t/version.t, util.c, util.h, version.pm: Finally works in 5.005_03, 5.6.1, and 5.8.0 [ead841f2b5e4] 2002-09-15 John Peacock * Makefile.PL, util.c, util.h, version.xs: Doesn't work any more? [d96b34598ae6] 2002-09-14 John Peacock * version.pm: working AV objects in 5.6.x only [50a0bab92cb6] * MANIFEST, Makefile.PL, util.c, util.h, version.xs: *** empty log message *** [9b189b4d19a5] * util.c, util.h, version.xs: Finished for the night [57988a3ce962] * util.c, version.pm, version.xs: almost working AV style version objects [9bb8a3441bf7] * Changes, MANIFEST, Makefile.PL, README, t/version.t, typemap, util.c, util.h, version.pm, version.xs: Initial revision [2be9f1b1e843] version-0.9907/README0000644000175000017500000002470712265360001014314 0ustar jpeacockjpeacockversion 0.9907 ================================== Full version object support, with patch for bug in Perl 5.10.0 core version support. YOU SHOULD INSTALL THIS RELEASE WHEN USING VERSION OBJECTS IN PERL 5.10.0. There was a bug caused by objects serialized by YAML that will cause Perl 5.10.0 to segfault. As long as some module calls 'use version', then the replacement code will take effect and Perl will not crash. Major Changes in 0.9907 - 2014-01-12 ===================================== Lots of optimizations of XS and C code courtesy of Daniel Dragan (bulk88@hotmail.com). Lots of minor tweaks as well. Resolves: https://rt.cpan.org/Ticket/Display.html?id=91892 https://rt.cpan.org/Ticket/Display.html?id=91867 https://rt.cpan.org/Ticket/Display.html?id=91987 https://rt.cpan.org/Ticket/Display.html?id=92051 IMPORTANT CHANGE - 0.9906 is the last release that fully supports Perl releases prior to 5.6.2. It is just too much trouble to continue to fight to maintain full backward compatibility. Major Changes in 0.9906 - 2014-01-04 ===================================== Applied C89 compatibility fix from Karl Williamson to vxs.inc. Added back support for $version::LAX and $version::STRICT to resolve: https://rt.cpan.org/Ticket/Display.html?id=88458 https://rt.cpan.org/Ticket/Display.html?id=91858 https://rt.cpan.org/Ticket/Display.html?id=91868 Major Changes in 0.9905 - 2014-01-04 ===================================== Major rewrite of XS code to permit easier inclusion in core Perl (mostly written by Father Chrysostomos ). XS code is no longer supported for any Perl < v5.10, although the pure Perl code still works going back to 5.005_04. In addition, the version::vpp class is now completely independent and can be use'd exactly like the base version class. It is still better to use the base class for compatibility purposes. Major Changes in 0.9904 - 2013-08-20 ===================================== Final upstream changes from bleadperl. Resolves RT tickets: https://rt.cpan.org/Ticket/Display.html?id=87513 https://rt.cpan.org/Ticket/Display.html?id=87983 Major Changes in 0.9903 - 2013-08-18 ===================================== Upstream test changes from bleadperl. Include version::vpp even when installing XS version. Subtle locale test changes. Major Changes in 0.9902 - 2013-03-05 ===================================== Upstream test changess from bleadperl. Support env PERL_ONLY=1 as well as --perl-only. version::new with no arguments reads past the end of the stack. Major Changes in 0.9901 - 2012-04-26 ===================================== Fix problem with short floating point alpha versions (e.g. 0.52_0). Major Changes in 0.99 - 2012-04-26 ===================================== Apply missing patch from core Perl to prevent overflow with ludicrous versions. Major Changes in 0.98 - 2012-04-25 ===================================== Apply patch from core Perl to prevent overflow with ludicrous versions. Major Changes in 0.97 - 2012-02-28 ===================================== Minor tweak to locale test to skip if no locales are installed at all. Major Changes in 0.96 - 2012-02-06 ===================================== Merge in upstream changes from bleadperl. Improved locale tests. Major Changes in 0.95 - 2011-11-12 ===================================== Restore compatibility in replacement UNIVERSAL::VERSION with the behavior of Perl 5.14.x, essentially by reverting the changes in https://rt.perl.org/rt3/Ticket/Display.html?id=95544 Fix segfault error with strings that begin with 'v', especially the string 'version'. Resolves: https://rt.cpan.org/Ticket/Display.html?id=72365 Forbid all math operations on version objects in base class (this was already the case for XS code but the pure Perl was lacking). Resolves: https://rt.cpan.org/Public/Bug/Display.html?id=70950 Major Changes in 0.94 - 2011-08-21 ===================================== Clarify documentation on advisability of using leading 'v' (it isn't mandatory, but it is much more likely to DTRT). Resolves: https://rt.cpan.org/Public/Bug/Display.html?id=70120 Use a localized DIE handler when attempting to load the XS code, in case the caller has its own DIE handler. Resolves: https://rt.cpan.org/Public/Bug/Display.html?id=70260 Major Changes in 0.93 - 2011-07-27 ===================================== Fix problem with UNIVERSAL::VERSION noted by Father Chrysostomos. Major Changes in 0.92 - 2011-07-26 ===================================== Forbid negative versions. Make replacement UNIVERSAL::VERSION return the original $VERSION scalar if called without a requested version. Resolves https://rt.perl.org/rt3/Ticket/Display.html?id=95544 Rewrite code so that we just override all subs for Perl >= 5.9.0 (when version.pm was added to the core). Major Changes in 0.91 - 2011-06-05 ===================================== Fix compilation/linking on Strawberry Perl, resolves https://rt.cpan.org/Ticket/Display.html?id=68611 Major Changes in 0.90 - 2011-06-01 ===================================== Make all tests pass even with older Test::More releases. Resolves https://rt.cpan.org/Ticket/Display.html?id=68588 Major Changes in 0.89 - 2011-05-31 ===================================== Change behavior of pure Perl qv/declare to match the core/XS behavior; do not use parent's new() class for derived classes. This breaks encapsulation but I can justify it because qv/declare is a very specific thing that shouldn't be casually overridden (unless you do it directly in the subclass). Major Changes in 0.88 - 2010-12-19 ===================================== Fix Makefile.PL to make Strawberry Perl happy. Resolves: https://rt.cpan.org/Public/Bug/Display.html?id=63991 Major Changes in 0.87 - 2010-12-09 ===================================== Remove Build.PL since there are modules in the Module::Build tool chain that require version.pm, leading to circular dependencies. This also allows Module::Build itself to depend on version.pm. Major Changes in 0.86 - 2010-11-26 ===================================== is_strict/is_lax were not exported correctly (which no one noticed). Also pull in strict/lax tests from core. Major Changes in 0.85 - 2010-10-25 ===================================== Don't include MYMETA.yml file in distro Major Changes in 0.84 - 2010-10-24 ===================================== Restore public API vcmp() broken in 0.83 Major Changes in 0.83 - 2010-10-17 ===================================== Changed vverify API (David Golden). Improved heuristic for non-magical v-strings (Perl 5.6.0-5.8.0). Install in proper patch post-@INC reordering. Major Changes in 0.82 - 2010-04-13 ===================================== Still more changes to sync with Perl 5.12.0-as-released. Rewritten POD thanks to many hands, but mostly David Golden. Vastly improved Regex definitions from Zephram. Major Changes in 0.81 - 2010-02-01 ===================================== Merge in changes from bleadperl that will be part of Perl 5.12.0. Completely rewrite pure Perl code to operate exactly like the XS code, through the creation of a character-array class called charstar. Now the pure Perl code and XS code can be more easily be synchronized. Major Changes in 0.80 - 2010-01-21 ===================================== No outwardly visible changes. This release is to fix an assertion error with certain picky/older compilers. NOTE: this is not the version object code that will be part of Perl 5.12.0, which will be released shortly as 0.81. Major Changes in 0.79 - 2010-01-03 ===================================== No outwardly visible changes. This release is to match the code that will part of Perl 5.12.0, but which doesn't affect the external API of the CPAN release. Major Changes in 0.78 - 2009-10-12 ===================================== More changes to improve the non-magic v-string heuristics, this time affecting both the pure Perl and XS backends. NOTE: these fixes only matter if you are running Perl 5.6.x to 5.8.0 (inclusive). Beginning with Perl 5.8.1, v-strings are now magical and version.pm no longer has to guess. Resolves: https://rt.cpan.org/Ticket/Display.html?id=50347 Also resolve the issue where attempting to install CPAN releases on top of core releases (e.g. 5.10.0 and 5.10.1) would not DTRT. Resolves: https://rt.cpan.org/Ticket/Display.html?id=49667 Major Changes in 0.7702 - 2009-09-07 ===================================== Add additional contraints to the code which tries to guess whether something is a v-string or not for Perl 5.6.0 through 5.8.0 (inclusive). Resolves: https://rt.cpan.org/Ticket/Display.html?id=49348 Major Changes in 0.7701 - 2009-07-28 ===================================== Special RHEL4.x/Fedora4.x Are Too Stupid to Live Release. Those distros have never updated beyond Perl 5.8.5/5.8.6 respectively. Consequently, they contain a complete broken Test::More::use_ok which doesn't load the package into the correct namespace: https://rt.cpan.org/Ticket/Display.html?id=48268 thus causing mysterious test failures. No version.pm code was changed at all. :( Major Changes in 0.77 - 2009-07-26 =================================== Complete POD rewrite to document common usage in version.pod and put all of the implementation details into version::Internals. Resolve a number of RT tickets: RT#48135 - Compilation failure using MS VC++ 7.0. RT#47980 - Remove need for runtime class loading in pure Perl code RT#46921 - locale and eval action at a distance. RT#45241 - mistaken regex to convert large exponential numbers to non-exponential form before scanning. Please read the POD documentation for usage/details. See the CHANGES file for full details of all changes to the module behavior. INSTALLATION To install this module type the following: $ perl Makefile.PL $ make $ make test # make install This release includes an optional pure Perl implementation (in case you don't have a C-compiler or if some reason you want your code to be much slower). You can test it by replacing the first line above with: $ perl Makefile.PL --perl_only and it will install the Perl only version. DEPENDENCIES The same C compiler used to build Perl (or not). Module::Build 0.2611 or better. Module::Build installs fine under 5.005_03 or better, though the optional dependency Archive::Tar doesn't. If you install Module::Build without any of the optional dependencies, you can safely install version.pm. COPYRIGHT AND LICENCE This module can be distributed under the same terms as Perl. Copyright (C) 2004-2010 John Peacock version-0.9907/MANIFEST.SKIP0000644000175000017500000000021211461315154015321 0ustar jpeacockjpeacock\.lwpcookies \.releaserc .+\.diff .+\.bak .+~ .+\.orig .hg .shipit Makefile$ MYMETA.yml version-.+\.tar\.gz vutil/Makefile\.PL t/test-all version-0.9907/lib/0000755000175000017500000000000012265475472014213 5ustar jpeacockjpeacockversion-0.9907/lib/version.pm0000644000175000017500000000555312265475453016245 0ustar jpeacockjpeacock#!perl -w package version; use 5.006002; use strict; use vars qw(@ISA $VERSION $CLASS $STRICT $LAX *declare *qv); $VERSION = 0.9907; $CLASS = 'version'; # !!!!Delete this next block completely when adding to Perl core!!!! { local $SIG{'__DIE__'}; eval "use version::vxs $VERSION"; if ( $@ ) { # don't have the XS version installed eval "use version::vpp $VERSION"; # don't tempt fate die "$@" if ( $@ ); push @ISA, "version::vpp"; local $^W; *version::qv = \&version::vpp::qv; *version::declare = \&version::vpp::declare; *version::_VERSION = \&version::vpp::_VERSION; *version::vcmp = \&version::vpp::vcmp; *version::new = \&version::vpp::new; if ($] >= 5.009000) { no strict 'refs'; *version::stringify = \&version::vpp::stringify; *{'version::(""'} = \&version::vpp::stringify; *{'version::(<=>'} = \&version::vpp::vcmp; *version::parse = \&version::vpp::parse; } } else { # use XS module push @ISA, "version::vxs"; local $^W; *version::declare = \&version::vxs::declare; *version::qv = \&version::vxs::qv; *version::_VERSION = \&version::vxs::_VERSION; *version::vcmp = \&version::vxs::VCMP; *version::new = \&version::vxs::new; if ($] >= 5.009000) { no strict 'refs'; *version::stringify = \&version::vxs::stringify; *{'version::(""'} = \&version::vxs::stringify; *{'version::(<=>'} = \&version::vxs::VCMP; *version::parse = \&version::vxs::parse; } } } # avoid using Exporter require version::regex; *version::is_lax = \&version::regex::is_lax; *version::is_strict = \&version::regex::is_strict; *LAX = \$version::regex::LAX; *STRICT = \$version::regex::STRICT; sub import { no strict 'refs'; my ($class) = shift; # Set up any derived class unless ($class eq $CLASS) { local $^W; *{$class.'::declare'} = \&{$CLASS.'::declare'}; *{$class.'::qv'} = \&{$CLASS.'::qv'}; } my %args; if (@_) { # any remaining terms are arguments map { $args{$_} = 1 } @_ } else { # no parameters at all on use line %args = ( qv => 1, 'UNIVERSAL::VERSION' => 1, ); } my $callpkg = caller(); if (exists($args{declare})) { *{$callpkg.'::declare'} = sub {return $class->declare(shift) } unless defined(&{$callpkg.'::declare'}); } if (exists($args{qv})) { *{$callpkg.'::qv'} = sub {return $class->qv(shift) } unless defined(&{$callpkg.'::qv'}); } if (exists($args{'UNIVERSAL::VERSION'})) { local $^W; *UNIVERSAL::VERSION = \&{$CLASS.'::_VERSION'}; } if (exists($args{'VERSION'})) { *{$callpkg.'::VERSION'} = \&{$CLASS.'::_VERSION'}; } if (exists($args{'is_strict'})) { *{$callpkg.'::is_strict'} = \&{$CLASS.'::is_strict'} unless defined(&{$callpkg.'::is_strict'}); } if (exists($args{'is_lax'})) { *{$callpkg.'::is_lax'} = \&{$CLASS.'::is_lax'} unless defined(&{$callpkg.'::is_lax'}); } } 1; version-0.9907/lib/version/0000755000175000017500000000000012265475472015700 5ustar jpeacockjpeacockversion-0.9907/lib/version/Internals.pod0000644000175000017500000006070212265357400020336 0ustar jpeacockjpeacock=head1 NAME version::Internals - Perl extension for Version Objects =head1 DESCRIPTION Overloaded version objects for all modern versions of Perl. This documents the internal data representation and underlying code for version.pm. See F for daily usage. This document is only useful for users interested in the gory details. =head1 WHAT IS A VERSION? For the purposes of this module, a version "number" is a sequence of positive integer values separated by one or more decimal points and optionally a single underscore. This corresponds to what Perl itself uses for a version, as well as extending the "version as number" that is discussed in the various editions of the Camel book. There are actually two distinct kinds of version objects: =over 4 =item Decimal Versions Any version which "looks like a number", see L. This also includes versions with a single decimal point and a single embedded underscore, see L, even though these must be quoted to preserve the underscore formatting. =item Dotted-Decimal Versions Also referred to as "Dotted-Integer", these contains more than one decimal point and may have an optional embedded underscore, see L. This is what is commonly used in most open source software as the "external" version (the one used as part of the tag or tarfile name). A leading 'v' character is now required and will warn if it missing. =back Both of these methods will produce similar version objects, in that the default stringification will yield the version L only if required: $v = version->new(1.002); # 1.002, but compares like 1.2.0 $v = version->new(1.002003); # 1.002003 $v2 = version->new("v1.2.3"); # v1.2.3 In specific, version numbers initialized as L will stringify as they were originally created (i.e. the same string that was passed to C. Version numbers initialized as L will be stringified as L. =head2 Decimal Versions These correspond to historical versions of Perl itself prior to 5.6.0, as well as all other modules which follow the Camel rules for the $VERSION scalar. A Decimal version is initialized with what looks like a floating point number. Leading zeros B significant and trailing zeros are implied so that a minimum of three places is maintained between subversions. What this means is that any subversion (digits to the right of the decimal place) that contains less than three digits will have trailing zeros added to make up the difference, but only for purposes of comparison with other version objects. For example: # Prints Equivalent to $v = version->new( 1.2); # 1.2 v1.200.0 $v = version->new( 1.02); # 1.02 v1.20.0 $v = version->new( 1.002); # 1.002 v1.2.0 $v = version->new( 1.0023); # 1.0023 v1.2.300 $v = version->new( 1.00203); # 1.00203 v1.2.30 $v = version->new( 1.002003); # 1.002003 v1.2.3 All of the preceding examples are true whether or not the input value is quoted. The important feature is that the input value contains only a single decimal. See also L. IMPORTANT NOTE: As shown above, if your Decimal version contains more than 3 significant digits after the decimal place, it will be split on each multiple of 3, so 1.0003 is equivalent to v1.0.300, due to the need to remain compatible with Perl's own 5.005_03 == 5.5.30 interpretation. Any trailing zeros are ignored for mathematical comparison purposes. =head2 Dotted-Decimal Versions These are the newest form of versions, and correspond to Perl's own version style beginning with 5.6.0. Starting with Perl 5.10.0, and most likely Perl 6, this is likely to be the preferred form. This method normally requires that the input parameter be quoted, although Perl's after 5.8.1 can use v-strings as a special form of quoting, but this is highly discouraged. Unlike L, Dotted-Decimal Versions have more than a single decimal point, e.g.: # Prints $v = version->new( "v1.200"); # v1.200.0 $v = version->new("v1.20.0"); # v1.20.0 $v = qv("v1.2.3"); # v1.2.3 $v = qv("1.2.3"); # v1.2.3 $v = qv("1.20"); # v1.20.0 In general, Dotted-Decimal Versions permit the greatest amount of freedom to specify a version, whereas Decimal Versions enforce a certain uniformity. Just like L, Dotted-Decimal Versions can be used as L. =head2 Alpha Versions For module authors using CPAN, the convention has been to note unstable releases with an underscore in the version string. (See L.) version.pm follows this convention and alpha releases will test as being newer than the more recent stable release, and less than the next stable release. Only the last element may be separated by an underscore: # Declaring use version 0.77; our $VERSION = version->declare("v1.2_3"); # Parsing $v1 = version->parse("v1.2_3"); $v1 = version->parse("1.002_003"); Note that you B quote the version when writing an alpha Decimal version. The stringified form of Decimal versions will always be the same string that was used to initialize the version object. =head2 Regular Expressions for Version Parsing A formalized definition of the legal forms for version strings is included in the C class. Primitives are included for common elements, although they are scoped to the file so they are useful for reference purposes only. There are two publicly accessible scalars that can be used in other code (not exported): =over 4 =item C<$version::LAX> This regexp covers all of the legal forms allowed under the current version string parser. This is not to say that all of these forms are recommended, and some of them can only be used when quoted. For dotted decimals: v1.2 1.2345.6 v1.23_4 The leading 'v' is optional if two or more decimals appear. If only a single decimal is included, then the leading 'v' is required to trigger the dotted-decimal parsing. A leading zero is permitted, though not recommended except when quoted, because of the risk that Perl will treat the number as octal. A trailing underscore plus one or more digits denotes an alpha or development release (and must be quoted to be parsed properly). For decimal versions: 1 1.2345 1.2345_01 an integer portion, an optional decimal point, and optionally one or more digits to the right of the decimal are all required. A trailing underscore is permitted and a leading zero is permitted. Just like the lax dotted-decimal version, quoting the values is required for alpha/development forms to be parsed correctly. =item C<$version::STRICT> This regexp covers a much more limited set of formats and constitutes the best practices for initializing version objects. Whether you choose to employ decimal or dotted-decimal for is a personal preference however. =over 4 =item v1.234.5 For dotted-decimal versions, a leading 'v' is required, with three or more sub-versions of no more than three digits. A leading 0 (zero) before the first sub-version (in the above example, '1') is also prohibited. =item 2.3456 For decimal versions, an integer portion (no leading 0), a decimal point, and one or more digits to the right of the decimal are all required. =back =back Both of the provided scalars are already compiled as regular expressions and do not contain either anchors or implicit groupings, so they can be included in your own regular expressions freely. For example, consider the following code: ($pkg, $ver) =~ / ^[ \t]* use [ \t]+($PKGNAME) (?:[ \t]+($version::STRICT))? [ \t]*; /x; This would match a line of the form: use Foo::Bar::Baz v1.2.3; # legal only in Perl 5.8.1+ where C<$PKGNAME> is another regular expression that defines the legal forms for package names. =head1 IMPLEMENTATION DETAILS =head2 Equivalence between Decimal and Dotted-Decimal Versions When Perl 5.6.0 was released, the decision was made to provide a transformation between the old-style decimal versions and new-style dotted-decimal versions: 5.6.0 == 5.006000 5.005_04 == 5.5.40 The floating point number is taken and split first on the single decimal place, then each group of three digits to the right of the decimal makes up the next digit, and so on until the number of significant digits is exhausted, B enough trailing zeros to reach the next multiple of three. This was the method that version.pm adopted as well. Some examples may be helpful: equivalent decimal zero-padded dotted-decimal ------- ----------- -------------- 1.2 1.200 v1.200.0 1.02 1.020 v1.20.0 1.002 1.002 v1.2.0 1.0023 1.002300 v1.2.300 1.00203 1.002030 v1.2.30 1.002003 1.002003 v1.2.3 =head2 Quoting Rules Because of the nature of the Perl parsing and tokenizing routines, certain initialization values B be quoted in order to correctly parse as the intended version, especially when using the C or L methods. While you do not have to quote decimal numbers when creating version objects, it is always safe to quote B initial values when using version.pm methods, as this will ensure that what you type is what is used. Additionally, if you quote your initializer, then the quoted value that goes B will be exactly what comes B when your $VERSION is printed (stringified). If you do not quote your value, Perl's normal numeric handling comes into play and you may not get back what you were expecting. If you use a mathematic formula that resolves to a floating point number, you are dependent on Perl's conversion routines to yield the version you expect. You are pretty safe by dividing by a power of 10, for example, but other operations are not likely to be what you intend. For example: $VERSION = version->new((qw$Revision: 1.4)[1]/10); print $VERSION; # yields 0.14 $V2 = version->new(100/9); # Integer overflow in decimal number print $V2; # yields something like 11.111.111.100 Perl 5.8.1 and beyond are able to automatically quote v-strings but that is not possible in earlier versions of Perl. In other words: $version = version->new("v2.5.4"); # legal in all versions of Perl $newvers = version->new(v2.5.4); # legal only in Perl >= 5.8.1 =head2 What about v-strings? There are two ways to enter v-strings: a bare number with two or more decimal points, or a bare number with one or more decimal points and a leading 'v' character (also bare). For example: $vs1 = 1.2.3; # encoded as \1\2\3 $vs2 = v1.2; # encoded as \1\2 However, the use of bare v-strings to initialize version objects is B discouraged in all circumstances. Also, bare v-strings are not completely supported in any version of Perl prior to 5.8.1. If you insist on using bare v-strings with Perl > 5.6.0, be aware of the following limitations: 1) For Perl releases 5.6.0 through 5.8.0, the v-string code merely guesses, based on some characteristics of v-strings. You B use a three part version, e.g. 1.2.3 or v1.2.3 in order for this heuristic to be successful. 2) For Perl releases 5.8.1 and later, v-strings have changed in the Perl core to be magical, which means that the version.pm code can automatically determine whether the v-string encoding was used. 3) In all cases, a version created using v-strings will have a stringified form that has a leading 'v' character, for the simple reason that sometimes it is impossible to tell whether one was present initially. =head2 Version Object Internals version.pm provides an overloaded version object that is designed to both encapsulate the author's intended $VERSION assignment as well as make it completely natural to use those objects as if they were numbers (e.g. for comparisons). To do this, a version object contains both the original representation as typed by the author, as well as a parsed representation to ease comparisons. Version objects employ L methods to simplify code that needs to compare, print, etc the objects. The internal structure of version objects is a blessed hash with several components: bless( { 'original' => 'v1.2.3_4', 'alpha' => 1, 'qv' => 1, 'version' => [ 1, 2, 3, 4 ] }, 'version' ); =over 4 =item original A faithful representation of the value used to initialize this version object. The only time this will not be precisely the same characters that exist in the source file is if a short dotted-decimal version like v1.2 was used (in which case it will contain 'v1.2'). This form is B discouraged, in that it will confuse you and your users. =item qv A boolean that denotes whether this is a decimal or dotted-decimal version. See L. =item alpha A boolean that denotes whether this is an alpha version. NOTE: that the underscore can only appear in the last position. See L. =item version An array of non-negative integers that is used for comparison purposes with other version objects. =back =head2 Replacement UNIVERSAL::VERSION In addition to the version objects, this modules also replaces the core UNIVERSAL::VERSION function with one that uses version objects for its comparisons. The return from this operator is always the stringified form as a simple scalar (i.e. not an object), but the warning message generated includes either the stringified form or the normal form, depending on how it was called. For example: package Foo; $VERSION = 1.2; package Bar; $VERSION = "v1.3.5"; # works with all Perl's (since it is quoted) package main; use version; print $Foo::VERSION; # prints 1.2 print $Bar::VERSION; # prints 1.003005 eval "use foo 10"; print $@; # prints "foo version 10 required..." eval "use foo 1.3.5; # work in Perl 5.6.1 or better print $@; # prints "foo version 1.3.5 required..." eval "use bar 1.3.6"; print $@; # prints "bar version 1.3.6 required..." eval "use bar 1.004"; # note Decimal version print $@; # prints "bar version 1.004 required..." IMPORTANT NOTE: This may mean that code which searches for a specific string (to determine whether a given module is available) may need to be changed. It is always better to use the built-in comparison implicit in C or C, rather than manually poking at C<< class->VERSION >> and then doing a comparison yourself. The replacement UNIVERSAL::VERSION, when used as a function, like this: print $module->VERSION; will also exclusively return the stringified form. See L for more details. =head1 USAGE DETAILS =head2 Using modules that use version.pm As much as possible, the version.pm module remains compatible with all current code. However, if your module is using a module that has defined C<$VERSION> using the version class, there are a couple of things to be aware of. For purposes of discussion, we will assume that we have the following module installed: package Example; use version; $VERSION = qv('1.2.2'); ...module code here... 1; =over 4 =item Decimal versions always work Code of the form: use Example 1.002003; will always work correctly. The C will perform an automatic C<$VERSION> comparison using the floating point number given as the first term after the module name (e.g. above 1.002.003). In this case, the installed module is too old for the requested line, so you would see an error like: Example version 1.002003 (v1.2.3) required--this is only version 1.002002 (v1.2.2)... =item Dotted-Decimal version work sometimes With Perl >= 5.6.2, you can also use a line like this: use Example 1.2.3; and it will again work (i.e. give the error message as above), even with releases of Perl which do not normally support v-strings (see L above). This has to do with that fact that C only checks to see if the second term I and passes that to the replacement L. This is not true in Perl 5.005_04, however, so you are B to always use a Decimal version in your code, even for those versions of Perl which support the Dotted-Decimal version. =back =head2 Object Methods =over 4 =item new() Like many OO interfaces, the new() method is used to initialize version objects. If two arguments are passed to C, the B one will be used as if it were prefixed with "v". This is to support historical use of the C operator with the CVS variable $Revision, which is automatically incremented by CVS every time the file is committed to the repository. In order to facilitate this feature, the following code can be employed: $VERSION = version->new(qw$Revision: 2.7 $); and the version object will be created as if the following code were used: $VERSION = version->new("v2.7"); In other words, the version will be automatically parsed out of the string, and it will be quoted to preserve the meaning CVS normally carries for versions. The CVS $Revision$ increments differently from Decimal versions (i.e. 1.10 follows 1.9), so it must be handled as if it were a Dotted-Decimal Version. A new version object can be created as a copy of an existing version object, either as a class method: $v1 = version->new(12.3); $v2 = version->new($v1); or as an object method: $v1 = version->new(12.3); $v2 = $v1->new(12.3); and in each case, $v1 and $v2 will be identical. NOTE: if you create a new object using an existing object like this: $v2 = $v1->new(); the new object B be a clone of the existing object. In the example case, $v2 will be an empty object of the same type as $v1. =back =over 4 =item qv() An alternate way to create a new version object is through the exported qv() sub. This is not strictly like other q? operators (like qq, qw), in that the only delimiters supported are parentheses (or spaces). It is the best way to initialize a short version without triggering the floating point interpretation. For example: $v1 = qv(1.2); # v1.2.0 $v2 = qv("1.2"); # also v1.2.0 As you can see, either a bare number or a quoted string can usually be used interchangeably, except in the case of a trailing zero, which must be quoted to be converted properly. For this reason, it is strongly recommended that all initializers to qv() be quoted strings instead of bare numbers. To prevent the C function from being exported to the caller's namespace, either use version with a null parameter: use version (); or just require version, like this: require version; Both methods will prevent the import() method from firing and exporting the C sub. =back For the subsequent examples, the following three objects will be used: $ver = version->new("1.2.3.4"); # see "Quoting Rules" $alpha = version->new("1.2.3_4"); # see "Alpha Versions" $nver = version->new(1.002); # see "Decimal Versions" =over 4 =item Normal Form For any version object which is initialized with multiple decimal places (either quoted or if possible v-string), or initialized using the L operator, the stringified representation is returned in a normalized or reduced form (no extraneous zeros), and with a leading 'v': print $ver->normal; # prints as v1.2.3.4 print $ver->stringify; # ditto print $ver; # ditto print $nver->normal; # prints as v1.2.0 print $nver->stringify; # prints as 1.002, # see "Stringification" In order to preserve the meaning of the processed version, the normalized representation will always contain at least three sub terms. In other words, the following is guaranteed to always be true: my $newver = version->new($ver->stringify); if ($newver eq $ver ) # always true {...} =back =over 4 =item Numification Although all mathematical operations on version objects are forbidden by default, it is possible to retrieve a number which corresponds to the version object through the use of the $obj->numify method. For formatting purposes, when displaying a number which corresponds a version object, all sub versions are assumed to have three decimal places. So for example: print $ver->numify; # prints 1.002003004 print $nver->numify; # prints 1.002 Unlike the stringification operator, there is never any need to append trailing zeros to preserve the correct version value. =back =over 4 =item Stringification The default stringification for version objects returns exactly the same string as was used to create it, whether you used C or C, with one exception. The sole exception is if the object was created using C and the initializer did not have two decimal places or a leading 'v' (both optional), then the stringified form will have a leading 'v' prepended, in order to support round-trip processing. For example: Initialized as Stringifies to ============== ============== version->new("1.2") 1.2 version->new("v1.2") v1.2 qv("1.2.3") 1.2.3 qv("v1.3.5") v1.3.5 qv("1.2") v1.2 ### exceptional case See also L, as this also returns the stringified form when used as a class method. IMPORTANT NOTE: There is one exceptional cases shown in the above table where the "initializer" is not stringwise equivalent to the stringified representation. If you use the C() operator on a version without a leading 'v' B with only a single decimal place, the stringified output will have a leading 'v', to preserve the sense. See the L operator for more details. IMPORTANT NOTE 2: Attempting to bypass the normal stringification rules by manually applying L and L will sometimes yield surprising results: print version->new(version->new("v1.0")->numify)->normal; # v1.0.0 The reason for this is that the L operator will turn "v1.0" into the equivalent string "1.000000". Forcing the outer version object to L form will display the mathematically equivalent "v1.0.0". As the example in L shows, you can always create a copy of an existing version object with the same value by the very compact: $v2 = $v1->new($v1); and be assured that both C<$v1> and C<$v2> will be completely equivalent, down to the same internal representation as well as stringification. =back =over 4 =item Comparison operators Both C and C=E> operators perform the same comparison between terms (upgrading to a version object automatically). Perl automatically generates all of the other comparison operators based on those two. In addition to the obvious equalities listed below, appending a single trailing 0 term does not change the value of a version for comparison purposes. In other words "v1.2" and "1.2.0" will compare as identical. For example, the following relations hold: As Number As String Truth Value ------------- ---------------- ----------- $ver > 1.0 $ver gt "1.0" true $ver < 2.5 $ver lt true $ver != 1.3 $ver ne "1.3" true $ver == 1.2 $ver eq "1.2" false $ver == 1.2.3.4 $ver eq "1.2.3.4" see discussion below It is probably best to chose either the Decimal notation or the string notation and stick with it, to reduce confusion. Perl6 version objects B only support Decimal comparisons. See also L. WARNING: Comparing version with unequal numbers of decimal points (whether explicitly or implicitly initialized), may yield unexpected results at first glance. For example, the following inequalities hold: version->new(0.96) > version->new(0.95); # 0.960.0 > 0.950.0 version->new("0.96.1") < version->new(0.95); # 0.096.1 < 0.950.0 For this reason, it is best to use either exclusively L or L with multiple decimal points. =back =over 4 =item Logical Operators If you need to test whether a version object has been initialized, you can simply test it directly: $vobj = version->new($something); if ( $vobj ) # true only if $something was non-blank You can also test whether a version object is an alpha version, for example to prevent the use of some feature not present in the main release: $vobj = version->new("1.2_3"); # MUST QUOTE ...later... if ( $vobj->is_alpha ) # True =back =head1 AUTHOR John Peacock Ejpeacock@cpan.orgE =head1 SEE ALSO L. =cut version-0.9907/lib/version/regex.pm0000644000175000017500000001000412264530030017320 0ustar jpeacockjpeacockpackage version::regex; use strict; use vars qw($VERSION $CLASS $STRICT $LAX); $VERSION = 0.9907; #--------------------------------------------------------------------------# # Version regexp components #--------------------------------------------------------------------------# # Fraction part of a decimal version number. This is a common part of # both strict and lax decimal versions my $FRACTION_PART = qr/\.[0-9]+/; # First part of either decimal or dotted-decimal strict version number. # Unsigned integer with no leading zeroes (except for zero itself) to # avoid confusion with octal. my $STRICT_INTEGER_PART = qr/0|[1-9][0-9]*/; # First part of either decimal or dotted-decimal lax version number. # Unsigned integer, but allowing leading zeros. Always interpreted # as decimal. However, some forms of the resulting syntax give odd # results if used as ordinary Perl expressions, due to how perl treats # octals. E.g. # version->new("010" ) == 10 # version->new( 010 ) == 8 # version->new( 010.2) == 82 # "8" . "2" my $LAX_INTEGER_PART = qr/[0-9]+/; # Second and subsequent part of a strict dotted-decimal version number. # Leading zeroes are permitted, and the number is always decimal. # Limited to three digits to avoid overflow when converting to decimal # form and also avoid problematic style with excessive leading zeroes. my $STRICT_DOTTED_DECIMAL_PART = qr/\.[0-9]{1,3}/; # Second and subsequent part of a lax dotted-decimal version number. # Leading zeroes are permitted, and the number is always decimal. No # limit on the numerical value or number of digits, so there is the # possibility of overflow when converting to decimal form. my $LAX_DOTTED_DECIMAL_PART = qr/\.[0-9]+/; # Alpha suffix part of lax version number syntax. Acts like a # dotted-decimal part. my $LAX_ALPHA_PART = qr/_[0-9]+/; #--------------------------------------------------------------------------# # Strict version regexp definitions #--------------------------------------------------------------------------# # Strict decimal version number. my $STRICT_DECIMAL_VERSION = qr/ $STRICT_INTEGER_PART $FRACTION_PART? /x; # Strict dotted-decimal version number. Must have both leading "v" and # at least three parts, to avoid confusion with decimal syntax. my $STRICT_DOTTED_DECIMAL_VERSION = qr/ v $STRICT_INTEGER_PART $STRICT_DOTTED_DECIMAL_PART{2,} /x; # Complete strict version number syntax -- should generally be used # anchored: qr/ \A $STRICT \z /x $STRICT = qr/ $STRICT_DECIMAL_VERSION | $STRICT_DOTTED_DECIMAL_VERSION /x; #--------------------------------------------------------------------------# # Lax version regexp definitions #--------------------------------------------------------------------------# # Lax decimal version number. Just like the strict one except for # allowing an alpha suffix or allowing a leading or trailing # decimal-point my $LAX_DECIMAL_VERSION = qr/ $LAX_INTEGER_PART (?: \. | $FRACTION_PART $LAX_ALPHA_PART? )? | $FRACTION_PART $LAX_ALPHA_PART? /x; # Lax dotted-decimal version number. Distinguished by having either # leading "v" or at least three non-alpha parts. Alpha part is only # permitted if there are at least two non-alpha parts. Strangely # enough, without the leading "v", Perl takes .1.2 to mean v0.1.2, # so when there is no "v", the leading part is optional my $LAX_DOTTED_DECIMAL_VERSION = qr/ v $LAX_INTEGER_PART (?: $LAX_DOTTED_DECIMAL_PART+ $LAX_ALPHA_PART? )? | $LAX_INTEGER_PART? $LAX_DOTTED_DECIMAL_PART{2,} $LAX_ALPHA_PART? /x; # Complete lax version number syntax -- should generally be used # anchored: qr/ \A $LAX \z /x # # The string 'undef' is a special case to make for easier handling # of return values from ExtUtils::MM->parse_version $LAX = qr/ undef | $LAX_DECIMAL_VERSION | $LAX_DOTTED_DECIMAL_VERSION /x; #--------------------------------------------------------------------------# # Preloaded methods go here. sub is_strict { defined $_[0] && $_[0] =~ qr/ \A $STRICT \z /x } sub is_lax { defined $_[0] && $_[0] =~ qr/ \A $LAX \z /x } 1; version-0.9907/lib/version.pod0000644000175000017500000002317412203420507016370 0ustar jpeacockjpeacock=head1 NAME version - Perl extension for Version Objects =head1 SYNOPSIS # Parsing version strings (decimal or dotted-decimal) use version 0.77; # get latest bug-fixes and API $ver = version->parse($string) # Declaring a dotted-decimal $VERSION (keep on one line!) use version; our $VERSION = version->declare("v1.2.3"); # formal use version; our $VERSION = qv("v1.2.3"); # shorthand use version; our $VERSION = qv("v1.2_3"); # alpha # Declaring an old-style decimal $VERSION (use quotes!) our $VERSION = "1.0203"; # recommended use version; our $VERSION = version->parse("1.0203"); # formal use version; our $VERSION = version->parse("1.02_03"); # alpha # Comparing mixed version styles (decimals, dotted-decimals, objects) if ( version->parse($v1) == version->parse($v2) ) { # do stuff } # Sorting mixed version styles @ordered = sort { version->parse($a) <=> version->parse($b) } @list; =head1 DESCRIPTION Version objects were added to Perl in 5.10. This module implements version objects for older version of Perl and provides the version object API for all versions of Perl. All previous releases before 0.74 are deprecated and should not be used due to incompatible API changes. Version 0.77 introduces the new 'parse' and 'declare' methods to standardize usage. You are strongly urged to set 0.77 as a minimum in your code, e.g. use version 0.77; # even for Perl v.5.10.0 =head1 TYPES OF VERSION OBJECTS There are two different types of version objects, corresponding to the two different styles of versions in use: =over 2 =item Decimal Versions The classic floating-point number $VERSION. The advantage to this style is that you don't need to do anything special, just type a number into your source file. Quoting is recommended, as it ensures that trailing zeroes ("1.50") are preserved in any warnings or other output. =item Dotted Decimal Versions The more modern form of version assignment, with 3 (or potentially more) integers separated by decimal points (e.g. v1.2.3). This is the form that Perl itself has used since 5.6.0 was released. The leading 'v' is now strongly recommended for clarity, and will throw a warning in a future release if omitted. A leading 'v' character is required to pass the L test. =back =head1 DECLARING VERSIONS If you have a module that uses a decimal $VERSION (floating point), and you do not intend to ever change that, this module is not for you. There is nothing that version.pm gains you over a simple $VERSION assignment: our $VERSION = "1.02"; Since Perl v5.10.0 includes the version.pm comparison logic anyways, you don't need to do anything at all. =head2 How to convert a module from decimal to dotted-decimal If you have used a decimal $VERSION in the past and wish to switch to a dotted-decimal $VERSION, then you need to make a one-time conversion to the new format. B: you must ensure that your new $VERSION is numerically greater than your current decimal $VERSION; this is not always obvious. First, convert your old decimal version (e.g. 1.02) to a normalized dotted-decimal form: $ perl -Mversion -e 'print version->parse("1.02")->normal' v1.20.0 Then increment any of the dotted-decimal components (v1.20.1 or v1.21.0). =head2 How to C a dotted-decimal version use version; our $VERSION = version->declare("v1.2.3"); The C method always creates dotted-decimal version objects. When used in a module, you B put it on the same line as "use version" to ensure that $VERSION is read correctly by PAUSE and installer tools. You should also add 'version' to the 'configure_requires' section of your module metadata file. See instructions in L or L for details. B: Even if you pass in what looks like a decimal number ("1.2"), a dotted-decimal will be created ("v1.200.0"). To avoid confusion or unintentional errors on older Perls, follow these guidelines: =over 2 =item * Always use a dotted-decimal with (at least) three components =item * Always use a leading-v =item * Always quote the version =back If you really insist on using version.pm with an ordinary decimal version, use C instead of declare. See the L for details. See also L for more on version number conversion, quoting, calculated version numbers and declaring developer or "alpha" version numbers. =head1 PARSING AND COMPARING VERSIONS If you need to compare version numbers, but can't be sure whether they are expressed as numbers, strings, v-strings or version objects, then you should use version.pm to parse them all into objects for comparison. =head2 How to C a version The C method takes in anything that might be a version and returns a corresponding version object, doing any necessary conversion along the way. =over 2 =item * Dotted-decimal: bare v-strings (v1.2.3) and strings with more than one decimal point and a leading 'v' ("v1.2.3"); NOTE you can technically use a v-string or strings with a leading-v and only one decimal point (v1.2 or "v1.2"), but you will confuse both yourself and others. =item * Decimal: regular decimal numbers (literal or in a string) =back Some examples: $variable version->parse($variable) --------- ------------------------- 1.23 v1.230.0 "1.23" v1.230.0 v1.23 v1.23.0 "v1.23" v1.23.0 "1.2.3" v1.2.3 "v1.2.3" v1.2.3 See L for more on version number conversion. =head2 How to check for a legal version string If you do not want to actually create a full blown version object, but would still like to verify that a given string meets the criteria to be parsed as a version, there are two helper functions that can be employed directly: =over 4 =item C The lax criteria corresponds to what is currently allowed by the version parser. All of the following formats are acceptable for dotted-decimal formats strings: v1.2 1.2345.6 v1.23_4 1.2345 1.2345_01 =item C If you want to limit yourself to a much more narrow definition of what a version string constitutes, C is limited to version strings like the following list: v1.234.5 2.3456 =back See L for details of the regular expressions that define the legal version string forms, as well as how to use those regular expressions in your own code if C and C are not sufficient for your needs. =head2 How to compare version objects Version objects overload the C and C<< <=> >> operators. Perl automatically generates all of the other comparison operators based on those two so all the normal logical comparisons will work. if ( version->parse($v1) == version->parse($v2) ) { # do stuff } If a version object is compared against a non-version object, the non-object term will be converted to a version object using C. This may give surprising results: $v1 = version->parse("v0.95.0"); $bool = $v1 < 0.96; # FALSE since 0.96 is v0.960.0 Always comparing to a version object will help avoid surprises: $bool = $v1 < version->parse("v0.96.0"); # TRUE Note that "alpha" version objects (where the version string contains a trailing underscore segment) compare as less than the equivalent version without an underscore: $bool = version->parse("1.23_45") < version->parse("1.2345"); # TRUE See L for more details on "alpha" versions. =head1 OBJECT METHODS =head2 is_alpha() True if and only if the version object was created with a underscore, e.g. version->parse('1.002_03')->is_alpha; # TRUE version->declare('1.2.3_4')->is_alpha; # TRUE =head2 is_qv() True only if the version object is a dotted-decimal version, e.g. version->parse('v1.2.0')->is_qv; # TRUE version->declare('v1.2')->is_qv; # TRUE qv('1.2')->is_qv; # TRUE version->parse('1.2')->is_qv; # FALSE =head2 normal() Returns a string with a standard 'normalized' dotted-decimal form with a leading-v and at least 3 components. version->declare('v1.2')->normal; # v1.2.0 version->parse('1.2')->normal; # v1.200.0 =head2 numify() Returns a value representing the object in a pure decimal form without trailing zeroes. version->declare('v1.2')->numify; # 1.002 version->parse('1.2')->numify; # 1.2 =head2 stringify() Returns a string that is as close to the original representation as possible. If the original representation was a numeric literal, it will be returned the way perl would normally represent it in a string. This method is used whenever a version object is interpolated into a string. version->declare('v1.2')->stringify; # v1.2 version->parse('1.200')->stringify; # 1.200 version->parse(1.02_30)->stringify; # 1.023 =head1 EXPORTED FUNCTIONS =head2 qv() This function is no longer recommended for use, but is maintained for compatibility with existing code. If you do not want to have it exported to your namespace, use this form: use version 0.77 (); =head2 is_lax() (Not exported by default) This function takes a scalar argument and returns a boolean value indicating whether the argument meets the "lax" rules for a version number. Leading and trailing spaces are not allowed. =head2 is_strict() (Not exported by default) This function takes a scalar argument and returns a boolean value indicating whether the argument meets the "strict" rules for a version number. Leading and trailing spaces are not allowed. =head1 AUTHOR John Peacock Ejpeacock@cpan.orgE =head1 SEE ALSO L. L. =cut version-0.9907/META.yml0000644000175000017500000000103212265475472014712 0ustar jpeacockjpeacock--- abstract: 'Structured version objects' author: - 'John Peacock ' build_requires: ExtUtils::MakeMaker: 0 configure_requires: ExtUtils::MakeMaker: 0 dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 6.84, CPAN::Meta::Converter version 2.120351' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: version no_index: directory: - t - inc requires: File::Temp: 0.13 Test::More: 0.45 parent: 0.221 perl: 5.006002 version: 0.9907 version-0.9907/vperl/0000755000175000017500000000000012265475472014575 5ustar jpeacockjpeacockversion-0.9907/vperl/vpp.pm0000644000175000017500000005351512265357245015746 0ustar jpeacockjpeacockpackage charstar; # a little helper class to emulate C char* semantics in Perl # so that prescan_version can use the same code as in C use overload ( '""' => \&thischar, '0+' => \&thischar, '++' => \&increment, '--' => \&decrement, '+' => \&plus, '-' => \&minus, '*' => \&multiply, 'cmp' => \&cmp, '<=>' => \&spaceship, 'bool' => \&thischar, '=' => \&clone, ); sub new { my ($self, $string) = @_; my $class = ref($self) || $self; my $obj = { string => [split(//,$string)], current => 0, }; return bless $obj, $class; } sub thischar { my ($self) = @_; my $last = $#{$self->{string}}; my $curr = $self->{current}; if ($curr >= 0 && $curr <= $last) { return $self->{string}->[$curr]; } else { return ''; } } sub increment { my ($self) = @_; $self->{current}++; } sub decrement { my ($self) = @_; $self->{current}--; } sub plus { my ($self, $offset) = @_; my $rself = $self->clone; $rself->{current} += $offset; return $rself; } sub minus { my ($self, $offset) = @_; my $rself = $self->clone; $rself->{current} -= $offset; return $rself; } sub multiply { my ($left, $right, $swapped) = @_; my $char = $left->thischar(); return $char * $right; } sub spaceship { my ($left, $right, $swapped) = @_; unless (ref($right)) { # not an object already $right = $left->new($right); } return $left->{current} <=> $right->{current}; } sub cmp { my ($left, $right, $swapped) = @_; unless (ref($right)) { # not an object already if (length($right) == 1) { # comparing single character only return $left->thischar cmp $right; } $right = $left->new($right); } return $left->currstr cmp $right->currstr; } sub bool { my ($self) = @_; my $char = $self->thischar; return ($char ne ''); } sub clone { my ($left, $right, $swapped) = @_; $right = { string => [@{$left->{string}}], current => $left->{current}, }; return bless $right, ref($left); } sub currstr { my ($self, $s) = @_; my $curr = $self->{current}; my $last = $#{$self->{string}}; if (defined($s) && $s->{current} < $last) { $last = $s->{current}; } my $string = join('', @{$self->{string}}[$curr..$last]); return $string; } package version::vpp; use 5.006002; use strict; use Config; use vars qw($VERSION $CLASS @ISA $LAX $STRICT); $VERSION = 0.9907; $CLASS = 'version::vpp'; require version::regex; *version::vpp::is_strict = \&version::regex::is_strict; *version::vpp::is_lax = \&version::regex::is_lax; *LAX = \$version::regex::LAX; *STRICT = \$version::regex::STRICT; use overload ( '""' => \&stringify, '0+' => \&numify, 'cmp' => \&vcmp, '<=>' => \&vcmp, 'bool' => \&vbool, '+' => \&vnoop, '-' => \&vnoop, '*' => \&vnoop, '/' => \&vnoop, '+=' => \&vnoop, '-=' => \&vnoop, '*=' => \&vnoop, '/=' => \&vnoop, 'abs' => \&vnoop, ); eval "use warnings"; if ($@) { eval ' package warnings; sub enabled {return $^W;} 1; '; } sub import { no strict 'refs'; my ($class) = shift; # Set up any derived class unless ($class eq $CLASS) { local $^W; *{$class.'::declare'} = \&{$CLASS.'::declare'}; *{$class.'::qv'} = \&{$CLASS.'::qv'}; } my %args; if (@_) { # any remaining terms are arguments map { $args{$_} = 1 } @_ } else { # no parameters at all on use line %args = ( qv => 1, 'UNIVERSAL::VERSION' => 1, ); } my $callpkg = caller(); if (exists($args{declare})) { *{$callpkg.'::declare'} = sub {return $class->declare(shift) } unless defined(&{$callpkg.'::declare'}); } if (exists($args{qv})) { *{$callpkg.'::qv'} = sub {return $class->qv(shift) } unless defined(&{$callpkg.'::qv'}); } if (exists($args{'UNIVERSAL::VERSION'})) { local $^W; *UNIVERSAL::VERSION = \&{$CLASS.'::_VERSION'}; } if (exists($args{'VERSION'})) { *{$callpkg.'::VERSION'} = \&{$CLASS.'::_VERSION'}; } if (exists($args{'is_strict'})) { *{$callpkg.'::is_strict'} = \&{$CLASS.'::is_strict'} unless defined(&{$callpkg.'::is_strict'}); } if (exists($args{'is_lax'})) { *{$callpkg.'::is_lax'} = \&{$CLASS.'::is_lax'} unless defined(&{$callpkg.'::is_lax'}); } } my $VERSION_MAX = 0x7FFFFFFF; # implement prescan_version as closely to the C version as possible use constant TRUE => 1; use constant FALSE => 0; sub isDIGIT { my ($char) = shift->thischar(); return ($char =~ /\d/); } sub isALPHA { my ($char) = shift->thischar(); return ($char =~ /[a-zA-Z]/); } sub isSPACE { my ($char) = shift->thischar(); return ($char =~ /\s/); } sub BADVERSION { my ($s, $errstr, $error) = @_; if ($errstr) { $$errstr = $error; } return $s; } sub prescan_version { my ($s, $strict, $errstr, $sqv, $ssaw_decimal, $swidth, $salpha) = @_; my $qv = defined $sqv ? $$sqv : FALSE; my $saw_decimal = defined $ssaw_decimal ? $$ssaw_decimal : 0; my $width = defined $swidth ? $$swidth : 3; my $alpha = defined $salpha ? $$salpha : FALSE; my $d = $s; if ($qv && isDIGIT($d)) { goto dotted_decimal_version; } if ($d eq 'v') { # explicit v-string $d++; if (isDIGIT($d)) { $qv = TRUE; } else { # degenerate v-string # requires v1.2.3 return BADVERSION($s,$errstr,"Invalid version format (dotted-decimal versions require at least three parts)"); } dotted_decimal_version: if ($strict && $d eq '0' && isDIGIT($d+1)) { # no leading zeros allowed return BADVERSION($s,$errstr,"Invalid version format (no leading zeros)"); } while (isDIGIT($d)) { # integer part $d++; } if ($d eq '.') { $saw_decimal++; $d++; # decimal point } else { if ($strict) { # require v1.2.3 return BADVERSION($s,$errstr,"Invalid version format (dotted-decimal versions require at least three parts)"); } else { goto version_prescan_finish; } } { my $i = 0; my $j = 0; while (isDIGIT($d)) { # just keep reading $i++; while (isDIGIT($d)) { $d++; $j++; # maximum 3 digits between decimal if ($strict && $j > 3) { return BADVERSION($s,$errstr,"Invalid version format (maximum 3 digits between decimals)"); } } if ($d eq '_') { if ($strict) { return BADVERSION($s,$errstr,"Invalid version format (no underscores)"); } if ( $alpha ) { return BADVERSION($s,$errstr,"Invalid version format (multiple underscores)"); } $d++; $alpha = TRUE; } elsif ($d eq '.') { if ($alpha) { return BADVERSION($s,$errstr,"Invalid version format (underscores before decimal)"); } $saw_decimal++; $d++; } elsif (!isDIGIT($d)) { last; } $j = 0; } if ($strict && $i < 2) { # requires v1.2.3 return BADVERSION($s,$errstr,"Invalid version format (dotted-decimal versions require at least three parts)"); } } } # end if dotted-decimal else { # decimal versions my $j = 0; # special $strict case for leading '.' or '0' if ($strict) { if ($d eq '.') { return BADVERSION($s,$errstr,"Invalid version format (0 before decimal required)"); } if ($d eq '0' && isDIGIT($d+1)) { return BADVERSION($s,$errstr,"Invalid version format (no leading zeros)"); } } # and we never support negative version numbers if ($d eq '-') { return BADVERSION($s,$errstr,"Invalid version format (negative version number)"); } # consume all of the integer part while (isDIGIT($d)) { $d++; } # look for a fractional part if ($d eq '.') { # we found it, so consume it $saw_decimal++; $d++; } elsif (!$d || $d eq ';' || isSPACE($d) || $d eq '}') { if ( $d == $s ) { # found nothing return BADVERSION($s,$errstr,"Invalid version format (version required)"); } # found just an integer goto version_prescan_finish; } elsif ( $d == $s ) { # didn't find either integer or period return BADVERSION($s,$errstr,"Invalid version format (non-numeric data)"); } elsif ($d eq '_') { # underscore can't come after integer part if ($strict) { return BADVERSION($s,$errstr,"Invalid version format (no underscores)"); } elsif (isDIGIT($d+1)) { return BADVERSION($s,$errstr,"Invalid version format (alpha without decimal)"); } else { return BADVERSION($s,$errstr,"Invalid version format (misplaced underscore)"); } } elsif ($d) { # anything else after integer part is just invalid data return BADVERSION($s,$errstr,"Invalid version format (non-numeric data)"); } # scan the fractional part after the decimal point if ($d && !isDIGIT($d) && ($strict || ! ($d eq ';' || isSPACE($d) || $d eq '}') )) { # $strict or lax-but-not-the-end return BADVERSION($s,$errstr,"Invalid version format (fractional part required)"); } while (isDIGIT($d)) { $d++; $j++; if ($d eq '.' && isDIGIT($d-1)) { if ($alpha) { return BADVERSION($s,$errstr,"Invalid version format (underscores before decimal)"); } if ($strict) { return BADVERSION($s,$errstr,"Invalid version format (dotted-decimal versions must begin with 'v')"); } $d = $s; # start all over again $qv = TRUE; goto dotted_decimal_version; } if ($d eq '_') { if ($strict) { return BADVERSION($s,$errstr,"Invalid version format (no underscores)"); } if ( $alpha ) { return BADVERSION($s,$errstr,"Invalid version format (multiple underscores)"); } if ( ! isDIGIT($d+1) ) { return BADVERSION($s,$errstr,"Invalid version format (misplaced underscore)"); } $width = $j; $d++; $alpha = TRUE; } } } version_prescan_finish: while (isSPACE($d)) { $d++; } if ($d && !isDIGIT($d) && (! ($d eq ';' || $d eq '}') )) { # trailing non-numeric data return BADVERSION($s,$errstr,"Invalid version format (non-numeric data)"); } if (defined $sqv) { $$sqv = $qv; } if (defined $swidth) { $$swidth = $width; } if (defined $ssaw_decimal) { $$ssaw_decimal = $saw_decimal; } if (defined $salpha) { $$salpha = $alpha; } return $d; } sub scan_version { my ($s, $rv, $qv) = @_; my $start; my $pos; my $last; my $errstr; my $saw_decimal = 0; my $width = 3; my $alpha = FALSE; my $vinf = FALSE; my @av; $s = new charstar $s; while (isSPACE($s)) { # leading whitespace is OK $s++; } $last = prescan_version($s, FALSE, \$errstr, \$qv, \$saw_decimal, \$width, \$alpha); if ($errstr) { # 'undef' is a special case and not an error if ( $s ne 'undef') { require Carp; Carp::croak($errstr); } } $start = $s; if ($s eq 'v') { $s++; } $pos = $s; if ( $qv ) { $$rv->{qv} = $qv; } if ( $alpha ) { $$rv->{alpha} = $alpha; } if ( !$qv && $width < 3 ) { $$rv->{width} = $width; } while (isDIGIT($pos)) { $pos++; } if (!isALPHA($pos)) { my $rev; for (;;) { $rev = 0; { # this is atoi() that delimits on underscores my $end = $pos; my $mult = 1; my $orev; # the following if() will only be true after the decimal # point of a version originally created with a bare # floating point number, i.e. not quoted in any way # if ( !$qv && $s > $start && $saw_decimal == 1 ) { $mult *= 100; while ( $s < $end ) { $orev = $rev; $rev += $s * $mult; $mult /= 10; if ( (abs($orev) > abs($rev)) || (abs($rev) > $VERSION_MAX )) { warn("Integer overflow in version %d", $VERSION_MAX); $s = $end - 1; $rev = $VERSION_MAX; $vinf = 1; } $s++; if ( $s eq '_' ) { $s++; } } } else { while (--$end >= $s) { $orev = $rev; $rev += $end * $mult; $mult *= 10; if ( (abs($orev) > abs($rev)) || (abs($rev) > $VERSION_MAX )) { warn("Integer overflow in version"); $end = $s - 1; $rev = $VERSION_MAX; $vinf = 1; } } } } # Append revision push @av, $rev; if ( $vinf ) { $s = $last; last; } elsif ( $pos eq '.' ) { $s = ++$pos; } elsif ( $pos eq '_' && isDIGIT($pos+1) ) { $s = ++$pos; } elsif ( $pos eq ',' && isDIGIT($pos+1) ) { $s = ++$pos; } elsif ( isDIGIT($pos) ) { $s = $pos; } else { $s = $pos; last; } if ( $qv ) { while ( isDIGIT($pos) ) { $pos++; } } else { my $digits = 0; while ( ( isDIGIT($pos) || $pos eq '_' ) && $digits < 3 ) { if ( $pos ne '_' ) { $digits++; } $pos++; } } } } if ( $qv ) { # quoted versions always get at least three terms my $len = $#av; # This for loop appears to trigger a compiler bug on OS X, as it # loops infinitely. Yes, len is negative. No, it makes no sense. # Compiler in question is: # gcc version 3.3 20030304 (Apple Computer, Inc. build 1640) # for ( len = 2 - len; len > 0; len-- ) # av_push(MUTABLE_AV(sv), newSViv(0)); # $len = 2 - $len; while ($len-- > 0) { push @av, 0; } } # need to save off the current version string for later if ( $vinf ) { $$rv->{original} = "v.Inf"; $$rv->{vinf} = 1; } elsif ( $s > $start ) { $$rv->{original} = $start->currstr($s); if ( $qv && $saw_decimal == 1 && $start ne 'v' ) { # need to insert a v to be consistent $$rv->{original} = 'v' . $$rv->{original}; } } else { $$rv->{original} = '0'; push(@av, 0); } # And finally, store the AV in the hash $$rv->{version} = \@av; # fix RT#19517 - special case 'undef' as string if ($s eq 'undef') { $s += 5; } return $s; } sub new { my ($class, $value) = @_; unless (defined $class) { require Carp; Carp::croak('Usage: version::new(class, version)'); } my $self = bless ({}, ref ($class) || $class); my $qv = FALSE; if ( ref($value) && eval('$value->isa("version")') ) { # Can copy the elements directly $self->{version} = [ @{$value->{version} } ]; $self->{qv} = 1 if $value->{qv}; $self->{alpha} = 1 if $value->{alpha}; $self->{original} = ''.$value->{original}; return $self; } if ($Config{d_setlocale}) { use POSIX qw/locale_h/; use if $Config{d_setlocale}, 'locale'; my $currlocale = setlocale(LC_ALL); # if the current locale uses commas for decimal points, we # just replace commas with decimal places, rather than changing # locales if ( localeconv()->{decimal_point} eq ',' ) { $value =~ tr/,/./; } } if ( not defined $value or $value =~ /^undef$/ ) { # RT #19517 - special case for undef comparison # or someone forgot to pass a value push @{$self->{version}}, 0; $self->{original} = "0"; return ($self); } if ( $#_ == 2 ) { # must be CVS-style $value = $_[2]; $qv = TRUE; } if (ref($value) =~ m/ARRAY|HASH/) { require Carp; Carp::croak("Invalid version format (non-numeric data)"); } $value = _un_vstring($value); # exponential notation if ( $value =~ /\d+.?\d*e[-+]?\d+/ ) { $value = sprintf("%.9f",$value); $value =~ s/(0+)$//; # trim trailing zeros } my $s = scan_version($value, \$self, $qv); if ($s) { # must be something left over warn("Version string '%s' contains invalid data; " ."ignoring: '%s'", $value, $s); } return ($self); } *parse = \&new; sub numify { my ($self) = @_; unless (_verify($self)) { require Carp; Carp::croak("Invalid version object"); } my $width = $self->{width} || 3; my $alpha = $self->{alpha} || ""; my $len = $#{$self->{version}}; my $digit = $self->{version}[0]; my $string = sprintf("%d.", $digit ); for ( my $i = 1 ; $i < $len ; $i++ ) { $digit = $self->{version}[$i]; if ( $width < 3 ) { my $denom = 10**(3-$width); my $quot = int($digit/$denom); my $rem = $digit - ($quot * $denom); $string .= sprintf("%0".$width."d_%d", $quot, $rem); } else { $string .= sprintf("%03d", $digit); } } if ( $len > 0 ) { $digit = $self->{version}[$len]; if ( $alpha && $width == 3 ) { $string .= "_"; } $string .= sprintf("%0".$width."d", $digit); } else # $len = 0 { $string .= sprintf("000"); } return $string; } sub normal { my ($self) = @_; unless (_verify($self)) { require Carp; Carp::croak("Invalid version object"); } my $alpha = $self->{alpha} || ""; my $len = $#{$self->{version}}; my $digit = $self->{version}[0]; my $string = sprintf("v%d", $digit ); for ( my $i = 1 ; $i < $len ; $i++ ) { $digit = $self->{version}[$i]; $string .= sprintf(".%d", $digit); } if ( $len > 0 ) { $digit = $self->{version}[$len]; if ( $alpha ) { $string .= sprintf("_%0d", $digit); } else { $string .= sprintf(".%0d", $digit); } } if ( $len <= 2 ) { for ( $len = 2 - $len; $len != 0; $len-- ) { $string .= sprintf(".%0d", 0); } } return $string; } sub stringify { my ($self) = @_; unless (_verify($self)) { require Carp; Carp::croak("Invalid version object"); } return exists $self->{original} ? $self->{original} : exists $self->{qv} ? $self->normal : $self->numify; } sub vcmp { require UNIVERSAL; my ($left,$right,$swap) = @_; my $class = ref($left); unless ( UNIVERSAL::isa($right, $class) ) { $right = $class->new($right); } if ( $swap ) { ($left, $right) = ($right, $left); } unless (_verify($left)) { require Carp; Carp::croak("Invalid version object"); } unless (_verify($right)) { require Carp; Carp::croak("Invalid version format"); } my $l = $#{$left->{version}}; my $r = $#{$right->{version}}; my $m = $l < $r ? $l : $r; my $lalpha = $left->is_alpha; my $ralpha = $right->is_alpha; my $retval = 0; my $i = 0; while ( $i <= $m && $retval == 0 ) { $retval = $left->{version}[$i] <=> $right->{version}[$i]; $i++; } # tiebreaker for alpha with identical terms if ( $retval == 0 && $l == $r && $left->{version}[$m] == $right->{version}[$m] && ( $lalpha || $ralpha ) ) { if ( $lalpha && !$ralpha ) { $retval = -1; } elsif ( $ralpha && !$lalpha) { $retval = +1; } } # possible match except for trailing 0's if ( $retval == 0 && $l != $r ) { if ( $l < $r ) { while ( $i <= $r && $retval == 0 ) { if ( $right->{version}[$i] != 0 ) { $retval = -1; # not a match after all } $i++; } } else { while ( $i <= $l && $retval == 0 ) { if ( $left->{version}[$i] != 0 ) { $retval = +1; # not a match after all } $i++; } } } return $retval; } sub vbool { my ($self) = @_; return vcmp($self,$self->new("0"),1); } sub vnoop { require Carp; Carp::croak("operation not supported with version object"); } sub is_alpha { my ($self) = @_; return (exists $self->{alpha}); } sub qv { my $value = shift; my $class = $CLASS; if (@_) { $class = ref($value) || $value; $value = shift; } $value = _un_vstring($value); $value = 'v'.$value unless $value =~ /(^v|\d+\.\d+\.\d)/; my $obj = $CLASS->new($value); return bless $obj, $class; } *declare = \&qv; sub is_qv { my ($self) = @_; return (exists $self->{qv}); } sub _verify { my ($self) = @_; if ( ref($self) && eval { exists $self->{version} } && ref($self->{version}) eq 'ARRAY' ) { return 1; } else { return 0; } } sub _is_non_alphanumeric { my $s = shift; $s = new charstar $s; while ($s) { return 0 if isSPACE($s); # early out return 1 unless (isALPHA($s) || isDIGIT($s) || $s =~ /[.-]/); $s++; } return 0; } sub _un_vstring { my $value = shift; # may be a v-string if ( length($value) >= 3 && $value !~ /[._]/ && _is_non_alphanumeric($value)) { my $tvalue; if ( $] ge 5.008_001 ) { $tvalue = _find_magic_vstring($value); $value = $tvalue if length $tvalue; } elsif ( $] ge 5.006_000 ) { $tvalue = sprintf("v%vd",$value); if ( $tvalue =~ /^v\d+(\.\d+){2,}$/ ) { # must be a v-string $value = $tvalue; } } } return $value; } sub _find_magic_vstring { my $value = shift; my $tvalue = ''; require B; my $sv = B::svref_2object(\$value); my $magic = ref($sv) eq 'B::PVMG' ? $sv->MAGIC : undef; while ( $magic ) { if ( $magic->TYPE eq 'V' ) { $tvalue = $magic->PTR; $tvalue =~ s/^v?(.+)$/v$1/; last; } else { $magic = $magic->MOREMAGIC; } } return $tvalue; } sub _VERSION { my ($obj, $req) = @_; my $class = ref($obj) || $obj; no strict 'refs'; if ( exists $INC{"$class.pm"} and not %{"$class\::"} and $] >= 5.008) { # file but no package require Carp; Carp::croak( "$class defines neither package nor VERSION" ."--version check failed"); } my $version = eval "\$$class\::VERSION"; if ( defined $version ) { local $^W if $] <= 5.008; $version = version::vpp->new($version); } if ( defined $req ) { unless ( defined $version ) { require Carp; my $msg = $] < 5.006 ? "$class version $req required--this is only version " : "$class does not define \$$class\::VERSION" ."--version check failed"; if ( $ENV{VERSION_DEBUG} ) { Carp::confess($msg); } else { Carp::croak($msg); } } $req = version::vpp->new($req); if ( $req > $version ) { require Carp; if ( $req->is_qv ) { Carp::croak( sprintf ("%s version %s required--". "this is only version %s", $class, $req->normal, $version->normal) ); } else { Carp::croak( sprintf ("%s version %s required--". "this is only version %s", $class, $req->stringify, $version->stringify) ); } } } return defined $version ? $version->stringify : undef; } 1; #this line is important and will help the module return a true value version-0.9907/t/0000755000175000017500000000000012265475472013710 5ustar jpeacockjpeacockversion-0.9907/t/02derived.t0000644000175000017500000000564312264530030015646 0ustar jpeacockjpeacock#! /usr/local/perl -w # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' ######################### use Test::More qw/no_plan/; use File::Temp qw/tempfile/; BEGIN { (my $coretests = $0) =~ s'[^/]+\.t'coretests.pm'; require $coretests; use_ok("version", 0.9907); # If we made it this far, we are ok. } use lib qw/./; package version::Bad; use parent 'version'; sub new { my($self,$n)=@_; bless \$n, $self } # Bad subclass for SemVer failures seen with pure Perl version.pm only package version::Bad2; use parent 'version'; sub new { my ($class, $val) = @_; die 'Invalid version string format' unless version::is_strict($val); my $self = $class->SUPER::new($val); return $self; } sub declare { my ($class, $val) = @_; my $self = $class->SUPER::declare($val); return $self; } package main; my $warning; local $SIG{__WARN__} = sub { $warning = $_[0] }; # dummy up a legal module for testing RT#19017 my ($fh, $filename) = tempfile('tXXXXXXX', SUFFIX => '.pm', UNLINK => 1); (my $package = basename($filename)) =~ s/\.pm$//; print $fh <<"EOF"; # This is an empty subclass package $package; use parent 'version'; use vars '\$VERSION'; \$VERSION=0.001; EOF close $fh; sub main_reset { delete $main::INC{'$package'}; undef &qv; undef *::qv; # avoid 'used once' warning undef &declare; undef *::declare; # avoid 'used once' warning } use_ok($package, 0.001); my $testobj = $package->new(1.002_003); isa_ok( $testobj, $package ); ok( $testobj->numify == 1.002003, "Numified correctly" ); ok( $testobj->stringify eq "1.002003", "Stringified correctly" ); ok( $testobj->normal eq "v1.2.3", "Normalified correctly" ); my $verobj = version::->new("1.2.4"); ok( $verobj > $testobj, "Comparison vs parent class" ); BaseTests($package, "new", "qv"); main_reset; use_ok($package, 0.001, "declare"); BaseTests($package, "new", "declare"); main_reset; use_ok($package, 0.001); BaseTests($package, "parse", "qv"); main_reset; use_ok($package, 0.001, "declare"); BaseTests($package, "parse", "declare"); $testobj = version::Bad->new(1.002_003); isa_ok( $testobj, "version::Bad" ); eval { my $string = $testobj->numify }; like($@, qr/Invalid version object/, "Bad subclass numify"); eval { my $string = $testobj->normal }; like($@, qr/Invalid version object/, "Bad subclass normal"); eval { my $string = $testobj->stringify }; like($@, qr/Invalid version object/, "Bad subclass stringify"); eval { my $test = ($testobj > 1.0) }; like($@, qr/Invalid version object/, "Bad subclass vcmp"); # Bad subclassing for SemVer with pure Perl version.pm only eval { my $test = version::Bad2->new("01.1.2") }; like($@, qr/Invalid version string format/, "Correctly found invalid version"); eval { my $test = version::Bad2->declare("01.1.2") }; unlike($@, qr/Invalid version string format/, "Correctly ignored invalid version"); version-0.9907/t/07locale.t0000644000175000017500000000724012264745575015511 0ustar jpeacockjpeacock#! /usr/local/perl -w # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' ######################### use File::Basename; use File::Temp qw/tempfile/; use POSIX qw/locale_h/; use Test::More tests => 7; use Config; BEGIN { use_ok('version', 0.9907); } SKIP: { skip 'No locale testing for Perl < 5.6.0', 6 if $] < 5.006; skip 'No locale testing without d_setlocale', 6 if(!$Config{d_setlocale}); # test locale handling my $warning; local $SIG{__WARN__} = sub { $warning = $_[0] }; my $ver = 1.23; # has to be floating point number my $loc; my $orig_loc = setlocale(LC_NUMERIC); ok ($ver eq "1.23", 'Not using locale yet'); # Don't use is(), # because have to # evaluate in current # scope use if $^O !~ /android/, 'locale'; while () { chomp; $loc = setlocale( LC_ALL, $_); last if $loc && localeconv()->{decimal_point} eq ','; } skip 'Cannot test locale handling without a comma locale', 5 unless $loc and localeconv()->{decimal_point} eq ','; setlocale(LC_NUMERIC, $loc); $ver = 1.23; # has to be floating point number ok ($ver eq "1,23", "Using locale: $loc"); $v = version->new($ver); unlike($warning, qr/Version string '1,23' contains invalid data/, "Process locale-dependent floating point"); ok ($v eq "1.23", "Locale doesn't apply to version objects"); ok ($v == $ver, "Comparison to locale floating point"); setlocale( LC_ALL, $orig_loc); # reset this before possible skip skip 'Cannot test RT#46921 with Perl < 5.008', 1 if ($] < 5.008); skip 'Cannot test RT#46921 with pure Perl module', 1 if exists $INC{'version/vpp.pm'}; my ($fh, $filename) = tempfile('tXXXXXXX', SUFFIX => '.pm', UNLINK => 1); (my $package = basename($filename)) =~ s/\.pm$//; print $fh <<"EOF"; package $package; use locale; use POSIX qw(locale_h); \$^W = 1; use version; setlocale (LC_ALL, '$loc'); use version ; eval "use Socket 1.7"; setlocale( LC_ALL, '$orig_loc'); 1; EOF close $fh; eval "use lib '.'; use $package;"; unlike($warning, qr"Version string '1,7' contains invalid data", 'Handle locale action-at-a-distance'); } __DATA__ af_ZA af_ZA.utf8 an_ES an_ES.utf8 az_AZ.utf8 be_BY be_BY.utf8 bg_BG bg_BG.utf8 br_FR br_FR@euro br_FR.utf8 bs_BA bs_BA.utf8 ca_ES ca_ES@euro ca_ES.utf8 cs_CZ cs_CZ.utf8 da_DK da_DK.utf8 de_AT de_AT@euro de_AT.utf8 de_BE de_BE@euro de_BE.utf8 de_DE de_DE@euro de_DE.utf8 de_LU de_LU@euro de_LU.utf8 el_GR el_GR.utf8 en_DK en_DK.utf8 es_AR es_AR.utf8 es_BO es_BO.utf8 es_CL es_CL.utf8 es_CO es_CO.utf8 es_EC es_EC.utf8 es_ES es_ES@euro es_ES.utf8 es_PY es_PY.utf8 es_UY es_UY.utf8 es_VE es_VE.utf8 et_EE et_EE.iso885915 et_EE.utf8 eu_ES eu_ES@euro eu_ES.utf8 fi_FI fi_FI@euro fi_FI.utf8 fo_FO fo_FO.utf8 fr_BE fr_BE@euro fr_BE.utf8 fr_CA fr_CA.utf8 fr_CH fr_CH.utf8 fr_FR fr_FR@euro fr_FR.utf8 fr_LU fr_LU@euro fr_LU.utf8 gl_ES gl_ES@euro gl_ES.utf8 hr_HR hr_HR.utf8 hu_HU hu_HU.utf8 id_ID id_ID.utf8 is_IS is_IS.utf8 it_CH it_CH.utf8 it_IT it_IT@euro it_IT.utf8 ka_GE ka_GE.utf8 kk_KZ kk_KZ.utf8 kl_GL kl_GL.utf8 lt_LT lt_LT.utf8 lv_LV lv_LV.utf8 mk_MK mk_MK.utf8 mn_MN mn_MN.utf8 nb_NO nb_NO.utf8 nl_BE nl_BE@euro nl_BE.utf8 nl_NL nl_NL@euro nl_NL.utf8 nn_NO nn_NO.utf8 no_NO no_NO.utf8 oc_FR oc_FR.utf8 pl_PL pl_PL.utf8 pt_BR pt_BR.utf8 pt_PT pt_PT@euro pt_PT.utf8 ro_RO ro_RO.utf8 ru_RU ru_RU.koi8r ru_RU.utf8 ru_UA ru_UA.utf8 se_NO se_NO.utf8 sh_YU sh_YU.utf8 sk_SK sk_SK.utf8 sl_SI sl_SI.utf8 sq_AL sq_AL.utf8 sr_CS sr_CS.utf8 sv_FI sv_FI@euro sv_FI.utf8 sv_SE sv_SE.iso885915 sv_SE.utf8 tg_TJ tg_TJ.utf8 tr_TR tr_TR.utf8 tt_RU.utf8 uk_UA uk_UA.utf8 vi_VN vi_VN.tcvn wa_BE wa_BE@euro wa_BE.utf8 version-0.9907/t/00impl-pp.t0000644000175000017500000000100212264530030015561 0ustar jpeacockjpeacock#! /usr/local/perl -w # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' ######################### use Test::More qw/no_plan/; BEGIN { (my $coretests = $0) =~ s'[^/]+\.t'coretests.pm'; require $coretests; use_ok('version::vpp', 0.9907); } BaseTests("version::vpp","new","qv"); BaseTests("version::vpp","new","declare"); BaseTests("version::vpp","parse", "qv"); BaseTests("version::vpp","parse", "declare"); version-0.9907/t/05sigdie.t0000644000175000017500000000066712264530030015474 0ustar jpeacockjpeacock#! /usr/local/perl -w # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' ######################### use Test::More tests => 1; BEGIN { $SIG{__DIE__} = sub { warn @_; BAIL_OUT( q[Couldn't use module; can't continue.] ); }; } BEGIN { use version 0.9907; } pass "Didn't get caught by the wrong DIE handler, which is a good thing"; version-0.9907/t/03require.t0000644000175000017500000000135712264530030015677 0ustar jpeacockjpeacock#! /usr/local/perl -w # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' ######################### use Test::More qw/no_plan/; BEGIN { (my $coretests = $0) =~ s'[^/]+\.t'coretests.pm'; require $coretests; } # Don't want to use, because we need to make sure that the import doesn't # fire just yet (some code does this to avoid importing qv() and delare()). require_ok("version"); is $version::VERSION, 0.9907, "Make sure we have the correct class"; ok(!"main"->can("qv"), "We don't have the imported qv()"); ok(!"main"->can("declare"), "We don't have the imported declare()"); BaseTests("version","new",undef); BaseTests("version","parse",undef); version-0.9907/t/01base.t0000644000175000017500000000266112264530030015132 0ustar jpeacockjpeacock#! /usr/local/perl -w # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' ######################### use Test::More qw/no_plan/; BEGIN { (my $coretests = $0) =~ s'[^/]+\.t'coretests.pm'; require $coretests; use_ok('version', 0.9907); } BaseTests("version","new","qv"); BaseTests("version","new","declare"); BaseTests("version","parse", "qv"); BaseTests("version","parse", "declare"); # dummy up a redundant call to satify David Wheeler local $SIG{__WARN__} = sub { die $_[0] }; eval 'use version;'; unlike ($@, qr/^Subroutine main::declare redefined/, "Only export declare once per package (to prevent redefined warnings)."); # https://rt.cpan.org/Ticket/Display.html?id=47980 my $v = eval { require IO::Handle; $@ = qq(Can't locate some/completely/fictitious/module.pm); return IO::Handle->VERSION; }; ok defined($v), 'Fix for RT #47980'; { # https://rt.cpan.org/Ticket/Display.html?id=81085 eval { version::new() }; like $@, qr'Usage: version::new\(class, version\)', 'No bus err when called as function'; eval { $x = 1; print version::new }; like $@, qr'Usage: version::new\(class, version\)', 'No implicit object creation when called as function'; eval { $x = "version"; print version::new }; like $@, qr'Usage: version::new\(class, version\)', 'No implicit object creation when called as function'; } version-0.9907/t/survey_locales0000755000175000017500000000057211635465070016672 0ustar jpeacockjpeacock#!/usr/bin/perl -w use POSIX qw/locale_h/; my $orig_loc = setlocale( LC_ALL ); my $loc; open my $LOCALES, '-|', 'locale -a'; local $\ = "\n"; print "The following locales use comma as decimal point"; while (<$LOCALES>) { chomp; $loc = setlocale( LC_ALL, $_); print $_ if localeconv()->{decimal_point} eq ','; } close $LOCALES; $loc = setlocale( LC_ALL, $orig_loc); version-0.9907/t/06noop.t0000644000175000017500000000244712264530030015202 0ustar jpeacockjpeacock#! /usr/local/perl -w # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' ######################### use Test::More qw/no_plan/; BEGIN { use_ok('version', 0.9907); } my $v1 = version->new('1.2'); eval {$v1 = $v1 + 1}; like $@, qr/operation not supported with version object/, 'No math ops with version objects'; eval {$v1 = $v1 - 1}; like $@, qr/operation not supported with version object/, 'No math ops with version objects'; eval {$v1 = $v1 / 1}; like $@, qr/operation not supported with version object/, 'No math ops with version objects'; eval {$v1 = $v1 * 1}; like $@, qr/operation not supported with version object/, 'No math ops with version objects'; eval {$v1 = abs($v1)}; like $@, qr/operation not supported with version object/, 'No math ops with version objects'; eval {$v1 += 1}; like $@, qr/operation not supported with version object/, 'No math ops with version objects'; eval {$v1 -= 1}; like $@, qr/operation not supported with version object/, 'No math ops with version objects'; eval {$v1 /= 1}; like $@, qr/operation not supported with version object/, 'No math ops with version objects'; eval {$v1 *= 1}; like $@, qr/operation not supported with version object/, 'No math ops with version objects'; version-0.9907/t/coretests.pm0000644000175000017500000005334212264301334016250 0ustar jpeacockjpeacock#! /usr/local/perl -w package main; require Test::Harness; use Data::Dumper; use File::Temp qw/tempfile/; use File::Basename; if ($Test::More::VERSION < 0.48) { # Fix for RT#48268 local $^W; *main::use_ok = sub ($;@) { my ($pkg, $req, @args) = @_; eval "use $pkg $req ".join(' ',@args); is ${"$pkg\::VERSION"}, $req, 'Had to manually use version'; # If we made it this far, we are ok. }; } sub BaseTests { my ($CLASS, $method, $qv_declare) = @_; my $warning; local $SIG{__WARN__} = sub { $warning = $_[0] }; # Insert your test code below, the Test module is use()ed here so read # its man page ( perldoc Test ) for help writing this test script. # Test bare number processing $version = $CLASS->$method(5.005_03); is ( "$version" , "5.00503" , '5.005_03 eq 5.00503' ); $version = $CLASS->$method(1.23); is ( "$version" , "1.23" , '1.23 eq "1.23"' ); # Test explicit integer $version = $CLASS->$method(23); is ( "$version" , 23 , '23 eq "23"' ); # Test quoted number processing $version = $CLASS->$method("5.005_03"); is ( "$version" , "5.005_03" , '"5.005_03" eq "5.005_03"' ); $version = $CLASS->$method("v1.23"); is ( "$version" , "v1.23" , '"v1.23" eq "v1.23"' ); # Test stringify operator $version = $CLASS->$method("5.005"); is ( "$version" , "5.005" , '5.005 eq "5.005"' ); $version = $CLASS->$method("5.006.001"); is ( "$version" , "5.006.001" , '5.006.001 eq v5.6.1' ); unlike ($warning, qr/v-string without leading 'v' deprecated/, 'No leading v'); $version = $CLASS->$method("v1.2.3_4"); is ( "$version" , "v1.2.3_4" , 'alpha version 1.2.3_4 eq v1.2.3_4' ); # test illegal formats eval {my $version = $CLASS->$method("1.2_3_4")}; like($@, qr/multiple underscores/, "Invalid version format (multiple underscores)"); eval {my $version = $CLASS->$method("1.2_3.4")}; like($@, qr/underscores before decimal/, "Invalid version format (underscores before decimal)"); eval {my $version = $CLASS->$method("1_2")}; like($@, qr/alpha without decimal/, "Invalid version format (alpha without decimal)"); eval { $version = $CLASS->$method("1.2b3")}; like($@, qr/non-numeric data/, "Invalid version format (non-numeric data)"); eval { $version = $CLASS->$method("-1.23")}; like($@, qr/negative version number/, "Invalid version format (negative version number)"); # from here on out capture the warning and test independently { eval{$version = $CLASS->$method("99 and 44/100 pure")}; like($@, qr/non-numeric data/, "Invalid version format (non-numeric data)"); eval{$version = $CLASS->$method("something")}; like($@, qr/non-numeric data/, "Invalid version format (non-numeric data)"); # reset the test object to something reasonable $version = $CLASS->$method("1.2.3"); # Test boolean operator ok ($version, 'boolean'); # Test class membership isa_ok ( $version, $CLASS ); # Test comparison operators with self is ( $version <=> $version, 0, '$version <=> $version == 0' ); ok ( $version == $version, '$version == $version' ); # Test Numeric Comparison operators # test first with non-object $version = $CLASS->$method("5.006.001"); $new_version = "5.8.0"; ok ( $version == $version, '$version == $version' ); ok ( $version < $new_version, '$version < $new_version' ); ok ( $new_version > $version, '$new_version > $version' ); ok ( $version != $new_version, '$version != $new_version' ); # now test with existing object $new_version = $CLASS->$method($new_version); ok ( $version < $new_version, '$version < $new_version' ); ok ( $new_version > $version, '$new_version > $version' ); ok ( $version != $new_version, '$version != $new_version' ); # now test with actual numbers ok ( $version->numify() == 5.006001, '$version->numify() == 5.006001' ); ok ( $version->numify() <= 5.006001, '$version->numify() <= 5.006001' ); ok ( $version->numify() < 5.008, '$version->numify() < 5.008' ); #ok ( $version->numify() > v5.005_02, '$version->numify() > 5.005_02' ); # test with long decimals $version = $CLASS->$method(1.002003); ok ( $version == "1.2.3", '$version == "1.2.3"'); ok ( $version->numify == 1.002003, '$version->numify == 1.002003'); $version = $CLASS->$method("2002.09.30.1"); ok ( $version == "2002.9.30.1",'$version == 2002.9.30.1'); ok ( $version->numify == 2002.009030001, '$version->numify == 2002.009030001'); # now test with alpha version form with string $version = $CLASS->$method("1.2.3"); $new_version = "1.2.3_4"; ok ( $version < $new_version, '$version < $new_version' ); ok ( $new_version > $version, '$new_version > $version' ); ok ( $version != $new_version, '$version != $new_version' ); $version = $CLASS->$method("1.2.4"); ok ( $version > $new_version, '$version > $new_version' ); ok ( $new_version < $version, '$new_version < $version' ); ok ( $version != $new_version, '$version != $new_version' ); # now test with alpha version form with object $version = $CLASS->$method("1.2.3"); $new_version = $CLASS->$method("1.2.3_4"); ok ( $version < $new_version, '$version < $new_version' ); ok ( $new_version > $version, '$new_version > $version' ); ok ( $version != $new_version, '$version != $new_version' ); ok ( !$version->is_alpha, '!$version->is_alpha'); ok ( $new_version->is_alpha, '$new_version->is_alpha'); $version = $CLASS->$method("1.2.4"); ok ( $version > $new_version, '$version > $new_version' ); ok ( $new_version < $version, '$new_version < $version' ); ok ( $version != $new_version, '$version != $new_version' ); $version = $CLASS->$method("1.2.3.4"); $new_version = $CLASS->$method("1.2.3_4"); ok ( $version > $new_version, '$version > $new_version' ); ok ( $new_version < $version, '$new_version < $version' ); ok ( $version != $new_version, '$version != $new_version' ); $version = $CLASS->$method("v1.2.3"); $new_version = $CLASS->$method("1.2.3.0"); ok ( $version == $new_version, '$version == $new_version' ); $new_version = $CLASS->$method("1.2.3_0"); ok ( $version == $new_version, '$version == $new_version' ); $new_version = $CLASS->$method("1.2.3.1"); ok ( $version < $new_version, '$version < $new_version' ); $new_version = $CLASS->$method("1.2.3_1"); ok ( $version < $new_version, '$version < $new_version' ); $new_version = $CLASS->$method("1.1.999"); ok ( $version > $new_version, '$version > $new_version' ); $version = $CLASS->$method("v1.2.3"); eval { () = $version < 'version' }; # this test, and only this test, I have to do this or else $@ gets # "reset" before like() has a chance to evaluate it. Quite maddening!!! my $err = $@; like $err, qr/^Invalid version format/, "error with $version < 'version'"; # that which is not expressly permitted is forbidden ok ( !eval { ++$version }, "noop ++" ); ok ( !eval { --$version }, "noop --" ); ok ( !eval { $version/1 }, "noop /" ); ok ( !eval { $version*3 }, "noop *" ); ok ( !eval { abs($version) }, "noop abs" ); SKIP: { skip "version require'd instead of use'd, cannot test $qv_declare", 3 unless defined $qv_declare; # test the $qv_declare() sub $version = $CLASS->$qv_declare("1.2"); is ( "$version", "v1.2", $qv_declare.'("1.2") == "1.2.0"' ); $version = $CLASS->$qv_declare(1.2); is ( "$version", "v1.2", $qv_declare.'(1.2) == "1.2.0"' ); isa_ok( $CLASS->$qv_declare('5.008'), $CLASS ); } # test creation from existing version object ok (eval {$new_version = $CLASS->$method($version)}, "new from existing object"); ok ($new_version == $version, "class->$method($version) identical"); $new_version = $version->$method(0); isa_ok ($new_version, $CLASS ); is ($new_version, "0", "version->$method() doesn't clone"); $new_version = $version->$method("1.2.3"); is ($new_version, "1.2.3" , '$version->$method("1.2.3") works too'); # test the CVS revision mode $version = new $CLASS qw$Revision: 1.2$; ok ( $version == "1.2.0", 'qw$Revision: 1.2$ == 1.2.0' ); $version = new $CLASS qw$Revision: 1.2.3.4$; ok ( $version == "1.2.3.4", 'qw$Revision: 1.2.3.4$ == 1.2.3.4' ); # test the CPAN style reduced significant digit form $version = $CLASS->$method("1.23_01"); is ( "$version" , "1.23_01", "CPAN-style alpha version" ); ok ( $version > 1.23, "1.23_01 > 1.23"); ok ( $version < 1.24, "1.23_01 < 1.24"); # test reformed UNIVERSAL::VERSION my $error_regex = $] < 5.006 ? 'version \d required' : 'does not define \$t.{7}::VERSION'; { my ($fh, $filename) = tempfile('tXXXXXXX', SUFFIX => '.pm', UNLINK => 1); (my $package = basename($filename)) =~ s/\.pm$//; print $fh "package $package;\n\$$package\::VERSION=0.58;\n1;\n"; close $fh; $version = 0.58; eval "use lib '.'; use $package $version"; unlike($@, qr/$package version $version/, 'Replacement eval works with exact version'); # test as class method $new_version = $package->VERSION; cmp_ok($new_version,'==',$version, "Called as class method"); eval "print Completely::Unknown::Module->VERSION"; if ( $] < 5.008 ) { unlike($@, qr/$error_regex/, "Don't freak if the module doesn't even exist"); } else { unlike($@, qr/defines neither package nor VERSION/, "Don't freak if the module doesn't even exist"); } # this should fail even with old UNIVERSAL::VERSION $version += 0.01; eval "use lib '.'; use $package $version"; like($@, qr/$package version $version/, 'Replacement eval works with incremented version'); $version =~ s/0+$//; #convert to string and remove trailing 0's chop($version); # shorten by 1 digit, should still succeed eval "use lib '.'; use $package $version"; unlike($@, qr/$package version $version/, 'Replacement eval works with single digit'); # this would fail with old UNIVERSAL::VERSION $version += 0.1; eval "use lib '.'; use $package $version"; like($@, qr/$package version $version/, 'Replacement eval works with incremented digit'); unlink $filename; } { # dummy up some variously broken modules for testing my ($fh, $filename) = tempfile('tXXXXXXX', SUFFIX => '.pm', UNLINK => 1); (my $package = basename($filename)) =~ s/\.pm$//; print $fh "1;\n"; close $fh; eval "use lib '.'; use $package 3;"; if ( $] < 5.008 ) { like($@, qr/$error_regex/, 'Replacement handles modules without package or VERSION'); } else { like($@, qr/defines neither package nor VERSION/, 'Replacement handles modules without package or VERSION'); } eval "use lib '.'; use $package; \$version = $package->VERSION"; unlike ($@, qr/$error_regex/, 'Replacement handles modules without package or VERSION'); ok (!defined($version), "Called as class method"); unlink $filename; } { # dummy up some variously broken modules for testing my ($fh, $filename) = tempfile('tXXXXXXX', SUFFIX => '.pm', UNLINK => 1); (my $package = basename($filename)) =~ s/\.pm$//; print $fh "package $package;\n#look ma no VERSION\n1;\n"; close $fh; eval "use lib '.'; use $package 3;"; like ($@, qr/$error_regex/, 'Replacement handles modules without VERSION'); eval "use lib '.'; use $package; print $package->VERSION"; unlike ($@, qr/$error_regex/, 'Replacement handles modules without VERSION'); unlink $filename; } { # dummy up some variously broken modules for testing my ($fh, $filename) = tempfile('tXXXXXXX', SUFFIX => '.pm', UNLINK => 1); (my $package = basename($filename)) =~ s/\.pm$//; print $fh "package $package;\n\@VERSION = ();\n1;\n"; close $fh; eval "use lib '.'; use $package 3;"; like ($@, qr/$error_regex/, 'Replacement handles modules without VERSION'); eval "use lib '.'; use $package; print $package->VERSION"; unlike ($@, qr/$error_regex/, 'Replacement handles modules without VERSION'); unlink $filename; } SKIP: { # https://rt.perl.org/rt3/Ticket/Display.html?id=95544 skip "version require'd instead of use'd, cannot test UNIVERSAL::VERSION", 2 unless defined $qv_declare; my ($fh, $filename) = tempfile('tXXXXXXX', SUFFIX => '.pm', UNLINK => 1); (my $package = basename($filename)) =~ s/\.pm$//; print $fh "package $package;\n\$VERSION = '3alpha';\n1;\n"; close $fh; eval "use lib '.'; use $package; print $package->VERSION"; like ($@, qr/Invalid version format \(non-numeric data\)/, 'Warn about bad \$VERSION'); eval "use lib '.'; use $package 1;"; like ($@, qr/Invalid version format \(non-numeric data\)/, 'Warn about bad $VERSION'); } SKIP: { skip 'Cannot test bare v-strings with Perl < 5.6.0', 4 if $] < 5.006_000; $version = $CLASS->$method(1.2.3); ok("$version" eq "v1.2.3", '"$version" eq 1.2.3'); $version = $CLASS->$method(1.0.0); $new_version = $CLASS->$method(1); ok($version == $new_version, '$version == $new_version'); skip "version require'd instead of use'd, cannot test declare", 1 unless defined $qv_declare; $version = &$qv_declare(1.2.3); ok("$version" eq "v1.2.3", 'v-string initialized $qv_declare()'); } SKIP: { skip 'Cannot test bare alpha v-strings with Perl < 5.8.1', 2 if $] lt 5.008_001; $version = $CLASS->$method(v1.2.3_4); is($version, "v1.2.3_4", '"$version" eq "v1.2.3_4"'); $version = $CLASS->$method(eval "v1.2.3_4"); is($version, "v1.2.3_4", '"$version" eq "v1.2.3_4" (from eval)'); } # trailing zero testing (reported by Andreas Koenig). $version = $CLASS->$method("1"); ok($version->numify eq "1.000", "trailing zeros preserved"); $version = $CLASS->$method("1.0"); ok($version->numify eq "1.000", "trailing zeros preserved"); $version = $CLASS->$method("1.0.0"); ok($version->numify eq "1.000000", "trailing zeros preserved"); $version = $CLASS->$method("1.0.0.0"); ok($version->numify eq "1.000000000", "trailing zeros preserved"); # leading zero testing (reported by Andreas Koenig). $version = $CLASS->$method(".7"); ok($version->numify eq "0.700", "leading zero inferred"); # leading space testing (reported by Andreas Koenig). $version = $CLASS->$method(" 1.7"); ok($version->numify eq "1.700", "leading space ignored"); # RT 19517 - deal with undef and 'undef' initialization ok("$version" ne 'undef', "Undef version comparison #1"); ok("$version" ne undef, "Undef version comparison #2"); $version = $CLASS->$method('undef'); unlike($warning, qr/^Version string 'undef' contains invalid data/, "Version string 'undef'"); $version = $CLASS->$method(undef); like($warning, qr/^Use of uninitialized value/, "Version string 'undef'"); ok($version == 'undef', "Undef version comparison #3"); ok($version == undef, "Undef version comparison #4"); eval "\$version = \$CLASS->$method()"; # no parameter at all unlike($@, qr/^Bizarre copy of CODE/, "No initializer at all"); ok($version == 'undef', "Undef version comparison #5"); ok($version == undef, "Undef version comparison #6"); $version = $CLASS->$method(0.000001); unlike($warning, qr/^Version string '1e-06' contains invalid data/, "Very small version objects"); } SKIP: { my $warning; local $SIG{__WARN__} = sub { $warning = $_[0] }; # dummy up a legal module for testing RT#19017 my ($fh, $filename) = tempfile('tXXXXXXX', SUFFIX => '.pm', UNLINK => 1); (my $package = basename($filename)) =~ s/\.pm$//; print $fh <<"EOF"; package $package; use $CLASS; \$VERSION = ${CLASS}->new('0.0.4'); 1; EOF close $fh; eval "use lib '.'; use $package 0.000008;"; like ($@, qr/^$package version 0.000008 required/, "Make sure very small versions don't freak"); eval "use lib '.'; use $package 1;"; like ($@, qr/^$package version 1 required/, "Comparing vs. version with no decimal"); eval "use lib '.'; use $package 1.;"; like ($@, qr/^$package version 1 required/, "Comparing vs. version with decimal only"); if ( $] < 5.006_000 ) { skip 'Cannot "use" extended versions with Perl < 5.6.0', 3; } eval "use lib '.'; use $package v0.0.8;"; my $regex = "^$package version v0.0.8 required"; like ($@, qr/$regex/, "Make sure very small versions don't freak"); $regex =~ s/8/4/; # set for second test eval "use lib '.'; use $package v0.0.4;"; unlike($@, qr/$regex/, 'Succeed - required == VERSION'); cmp_ok ( $package->VERSION, 'eq', '0.0.4', 'No undef warnings' ); unlink $filename; } SKIP: { skip "Cannot test \"use parent $CLASS\" when require is used", 3 unless defined $qv_declare; my ($fh, $filename) = tempfile('tXXXXXXX', SUFFIX => '.pm', UNLINK => 1); (my $package = basename($filename)) =~ s/\.pm$//; print $fh <<"EOF"; package $package; use parent $CLASS; 1; EOF close $fh; # need to eliminate any other $qv_declare()'s undef *{"main\::$qv_declare"}; ok(!defined(&{"main\::$qv_declare"}), "make sure we cleared $qv_declare() properly"); eval "use lib '.'; use $package qw/declare qv/;"; ok(defined(&{"main\::$qv_declare"}), "make sure we exported $qv_declare() properly"); isa_ok( &$qv_declare(1.2), $package); unlink $filename; } SKIP: { if ( $] < 5.006_000 ) { skip 'Cannot "use" extended versions with Perl < 5.6.0', 3; } my ($fh, $filename) = tempfile('tXXXXXXX', SUFFIX => '.pm', UNLINK => 1); (my $package = basename($filename)) =~ s/\.pm$//; print $fh <<"EOF"; package $package; \$VERSION = 1.0; 1; EOF close $fh; eval "use lib '.'; use $package 1.001;"; like ($@, qr/^$package version 1.001 required/, "User typed numeric so we error with numeric"); eval "use lib '.'; use $package v1.1.0;"; like ($@, qr/^$package version v1.1.0 required/, "User typed extended so we error with extended"); unlink $filename; } eval 'my $v = $CLASS->$method("1._1");'; unlike($@, qr/^Invalid version format \(alpha with zero width\)/, "Invalid version format 1._1"); { my $warning; local $SIG{__WARN__} = sub { $warning = $_[0] }; eval 'my $v = $CLASS->$method(~0);'; unlike($@, qr/Integer overflow in version/, "Too large version"); like($warning, qr/Integer overflow in version/, "Too large version"); } { local $Data::Dumper::Sortkeys= 1; # http://rt.cpan.org/Public/Bug/Display.html?id=30004 my $v1 = $CLASS->$method("v0.1_1"); (my $alpha1 = Dumper($v1)) =~ s/.+'alpha' => ([^,]+),.+/$1/ms; my $v2 = $CLASS->$method($v1); (my $alpha2 = Dumper($v2)) =~ s/.+'alpha' => ([^,]+),.+/$1/ms; is $alpha2, $alpha1, "Don't fall for Data::Dumper's tricks"; } { # http://rt.perl.org/rt3/Ticket/Display.html?id=56606 my $badv = bless { version => [1,2,3] }, $CLASS; is $badv, '1.002003', "Deal with badly serialized versions from YAML"; my $badv2 = bless { qv => 1, version => [1,2,3] }, $CLASS; is $badv2, 'v1.2.3', "Deal with badly serialized versions from YAML "; } { # https://rt.cpan.org/Public/Bug/Display.html?id=70950 # test indirect usage of version objects my $sum = 0; eval '$sum += $CLASS->$method("v2.0.0")'; like $@, qr/operation not supported with version object/, 'No math operations with version objects'; # test direct usage of version objects my $v = $CLASS->$method("v2.0.0"); eval '$v += 1'; like $@, qr/operation not supported with version object/, 'No math operations with version objects'; } { # https://rt.cpan.org/Ticket/Display.html?id=72365 # https://rt.perl.org/rt3/Ticket/Display.html?id=102586 # https://rt.cpan.org/Ticket/Display.html?id=78328 eval 'my $v = $CLASS->$method("version")'; like $@, qr/Invalid version format/, "The string 'version' is not a version for $method"; eval 'my $v = $CLASS->$method("ver510n")'; like $@, qr/Invalid version format/, 'All strings starting with "v" are not versions'; } SKIP: { if ( $] < 5.006_000 ) { skip 'No v-string support at all < 5.6.0', 2; } # https://rt.cpan.org/Ticket/Display.html?id=49348 my $v = $CLASS->$method("420"); is "$v", "420", 'Correctly guesses this is not a v-string'; $v = $CLASS->$method(4.2.0); is "$v", 'v4.2.0', 'Correctly guess that this is a v-string'; } SKIP: { if ( $] < 5.006_000 ) { skip 'No v-string support at all < 5.6.0', 4; } # https://rt.cpan.org/Ticket/Display.html?id=50347 # Check that the qv() implementation does not change ok $CLASS->$method(1.2.3) < $CLASS->$method(1.2.3.1), 'Compare 3 and 4 digit v-strings' ; ok $CLASS->$method(v1.2.3) < $CLASS->$method(v1.2.3.1), 'Compare 3 and 4 digit v-strings, leaving v'; ok $CLASS->$method("1.2.3") < $CLASS->$method("1.2.3.1"), 'Compare 3 and 4 digit v-strings, quoted'; ok $CLASS->$method("v1.2.3") < $CLASS->$method("v1.2.3.1"), 'Compare 3 and 4 digit v-strings, quoted leading v'; } { eval '$CLASS->$method("version")'; pass("no crash with ${CLASS}->${method}('version')"); { package _102586; sub TIESCALAR { bless [] } sub FETCH { "version" } sub STORE { } my $v; tie $v, __PACKAGE__; $v = $CLASS->$method(1); eval '$CLASS->$method($v)'; } pass('no crash with version->new($tied) where $tied returns "version"'); } { # [perl #112478] $_112478::VERSION = 9e99; ok eval { _112478->VERSION(9e99); 1 }, '->VERSION(9e99) succeeds' or diag $@; $_112478::VERSION = 1; eval { _112478->VERSION(9e99) }; unlike $@, qr/panic/, '->VERSION(9e99) does not panic'; } { # https://rt.cpan.org/Ticket/Display.html?id=79259 my $v = $CLASS->new("0.52_0"); ok $v->is_alpha, 'Just checking'; is $v->numify, '0.520', 'Correctly nummified'; } { # https://rt.cpan.org/Ticket/Display.html?id=88495 @ver::ISA = $CLASS; is ref(ver->new), 'ver', 'ver can inherit from version'; is ref(ver->qv("1.2.3")), 'ver', 'ver can inherit from version'; } { # discovered while integrating with bleadperl eval {my $v = $CLASS->new([1,2,3]) }; like $@, qr/Invalid version format/, 'Do not crash for garbage'; eval {my $v = $CLASS->new({1 => 2}) }; like $@, qr/Invalid version format/, 'Do not crash for garbage'; } } 1; version-0.9907/t/09_list_util.t0000644000175000017500000000147312264530030016377 0ustar jpeacockjpeacock# Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' ######################### use strict; use_ok("version", 0.9907); use Test::More; BEGIN { eval "use List::Util qw(reduce)"; if ($@) { plan skip_all => "No List::Util::reduce() available"; } else { plan tests => 3; } } # do strict lax tests in a sub to isolate a package to test importing # use again to get the import() use List::Util qw(reduce); { my $fail = 0; my $ret = reduce { version->parse($a); $fail++ unless defined $a; 1 } "0.039", "0.035"; is $fail, 0, 'reduce() with parse'; } { my $fail = 0; my $ret = reduce { version->qv($a); $fail++ unless defined $a; 1 } "0.039", "0.035"; is $fail, 0, 'reduce() with qv'; } version-0.9907/t/08_corelist.t0000644000175000017500000000127412264530030016211 0ustar jpeacockjpeacock#! /usr/local/perl -w # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' ######################### use Test::More tests => 3; use_ok("version", 0.9907); # do strict lax tests in a sub to isolate a package to test importing SKIP: { eval "use Module::CoreList 2.76"; skip 'No tied hash in Modules::CoreList in Perl', 2 if $@; my $foo = version->parse($Module::CoreList::version{5.008_000}{base}); is $foo, 1.03, 'Correctly handle tied hash'; $foo = version->qv($Module::CoreList::version{5.008_000}{Unicode}); is $foo, '3.2.0', 'Correctly handle tied hash with dotted decimal'; } version-0.9907/t/04strict_lax.t0000644000175000017500000000375212264301334016404 0ustar jpeacockjpeacock#! /usr/local/perl -w # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' ######################### use Test::More qw/no_plan/; # do strict lax tests in a sub to isolate a package to test importing SKIP: { skip 'No extended regexes Perl < 5.006', 174 if $] < 5.006_000; strict_lax_tests(); is ref($version::LAX), 'Regexp', 'Can see $version::LAX '.$version::LAX ; is ref($version::STRICT), 'Regexp', 'Can see $version::STRICT '.$version::STRICT; } sub strict_lax_tests { package temp12345; # copied from perl core test t/op/packagev.t # format: STRING STRICT_OK LAX_OK my $strict_lax_data = << 'CASE_DATA'; 1.00 pass pass 1.00001 pass pass 0.123 pass pass 12.345 pass pass 42 pass pass 0 pass pass 0.0 pass pass v1.2.3 pass pass v1.2.3.4 pass pass v0.1.2 pass pass v0.0.0 pass pass 01 fail pass 01.0203 fail pass v01 fail pass v01.02.03 fail pass .1 fail pass .1.2 fail pass 1. fail pass 1.a fail fail 1._ fail fail 1.02_03 fail pass v1.2_3 fail pass v1.02_03 fail pass v1.2_3_4 fail fail v1.2_3.4 fail fail 1.2_3.4 fail fail 0_ fail fail 1_ fail fail 1_. fail fail 1.1_ fail fail 1.02_03_04 fail fail 1.2.3 fail pass v1.2 fail pass v0 fail pass v1 fail pass v.1.2.3 fail fail v fail fail v1.2345.6 fail pass undef fail pass 1a fail fail 1.2a3 fail fail bar fail fail _ fail fail CASE_DATA require version; version->import( qw/is_strict is_lax/ ); for my $case ( split qr/\n/, $strict_lax_data ) { my ($v, $strict, $lax) = split qr/\t+/, $case; main::ok( $strict eq 'pass' ? is_strict($v) : ! is_strict($v), "is_strict($v) [$strict]" ); main::ok( $strict eq 'pass' ? version::is_strict($v) : ! version::is_strict($v), "version::is_strict($v) [$strict]" ); main::ok( $lax eq 'pass' ? is_lax($v) : ! is_lax($v), "is_lax($v) [$lax]" ); main::ok( $lax eq 'pass' ? version::is_lax($v) : ! version::is_lax($v), "version::is_lax($v) [$lax]" ); } } version-0.9907/Makefile.PL0000644000175000017500000001076412265365057015424 0ustar jpeacockjpeacock# This Makefile.PL stolen from Params::Validate # # The perl/C checking voodoo is stolen from Graham Barr's # Scalar-List-Utils distribution. use strict; use ExtUtils::MakeMaker; use Config qw(%Config); use File::Spec; use File::Copy; if ($] < 5.006002) { die <<'EOL' Perl 5.006002 required. Please install version-0.9906 if you need to support an earlier Perl release. EOL } use vars qw ($no_xs $force_xs); unlink 'pm_to_blib'; # belts and braces if ($ENV{PERL_ONLY}) { $no_xs = 1; } for (@ARGV) { /^--perl_only/ and $no_xs = 1; /^--perl-only/ and $no_xs = 1; /^--xs/ and $no_xs = 0; } if ($] < 5.010) { # support pure Perl only $no_xs = 1; } map { unlink $_ if -f $_ } ; unless (defined $no_xs) { check_for_compiler() or no_cc(); } write_makefile(); sub write_makefile { my %prereq = ( 'Test::More' => 0.45, 'File::Temp' => 0.13, 'parent' => 0.221, ); WriteMakefile( VERSION_FROM => 'lib/version.pm', NAME => 'version', LICENSE => 'perl', MIN_PERL_VERSION=> 5.006002, PREREQ_PM => \%prereq, CONFIGURE => \&init, ( $] >= 5.005 ? ( ABSTRACT => 'Structured version objects', AUTHOR => 'John Peacock ') : () ), ( $] >= 5.009001 && $] < 5.011000 ? ( INSTALLDIRS => 'perl' ) : () ), ( ($] < 5.012 && ! $ENV{PERL_NO_HIGHLANDER} && ! ( $ENV{PERL_MM_OPT} && $ENV{PERL_MM_OPT} =~ /(?:INSTALL_BASE|PREFIX)/ ) && ! grep { /INSTALL_BASE/ || /PREFIX/ } @ARGV ) ? ( UNINST => 1 ) : () ), PM => {'lib/version.pm' => '$(INST_LIBDIR)/version.pm', 'lib/version.pod' => '$(INST_LIBDIR)/version.pod', 'lib/version/regex.pm' => '$(INST_LIBDIR)/version/regex.pm', 'lib/version/Internals.pod' => '$(INST_LIBDIR)/version/Internals.pod', 'vperl/vpp.pm' => '$(INST_LIBDIR)/version/vpp.pm', }, PL_FILES => {}, C => [], clean => { FILES => 'vutil/Makefile.PL' }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', PREOP => ( 'hg log --style changelog > Changes' ), }, ); } sub init { my $hash = $_[1]; # include this always unless ($no_xs) { open MAKEFILE, '>vutil/Makefile.PL'; while () { print MAKEFILE $_; } close MAKEFILE; sleep(1); @{ $hash }{ 'DIR' } = ['vutil']; } return $hash; } sub no_cc { $no_xs = 1; print <<'EOF'; I cannot determine if you have a C compiler so I will install a perl-only implementation You can force installation of the XS version with perl Makefile.PL --xs EOF } sub check_for_compiler { print "Testing if you have a C compiler\n"; eval { require ExtUtils::CBuilder }; if ($@) { return _check_for_compiler_manually(); } else { return _check_for_compiler_with_cbuilder(); } } sub _check_for_compiler_with_cbuilder { my $cb = ExtUtils::CBuilder->new( quiet => 1 ); return $cb->have_compiler; } sub _check_for_compiler_manually { unless ( open F, ">test.c" ) { warn "Cannot write test.c, skipping test compilation and installing pure Perl version.\n"; return 0; } print F <<'EOF'; int main() { return 0; } EOF close F or return 0; my $cc = $Config{cc}; my $retval = system( "$cc -c -o test$Config{obj_ext} test.c" ); map { unlink $_ if -f $_ } ('test.c',"test$Config{obj_ext}"); return not($retval); # system returns -1 } __DATA__ #!/usr/bin/perl -w use strict; use ExtUtils::MakeMaker; WriteMakefile( NAME => 'version::vxs', AUTHOR => 'John Peacock ', VERSION_FROM => 'lib/version/vxs.pm', OBJECT => q/$(O_FILES)/, depend => { qw< vxs.c vxs.inc > }, ); version-0.9907/META.json0000644000175000017500000000171612265475472015073 0ustar jpeacockjpeacock{ "abstract" : "Structured version objects", "author" : [ "John Peacock " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 6.84, CPAN::Meta::Converter version 2.120351", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "version", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "requires" : { "File::Temp" : "0.13", "Test::More" : "0.45", "parent" : "0.221", "perl" : "5.006002" } } }, "release_status" : "stable", "version" : "0.9907" } version-0.9907/MANIFEST0000644000175000017500000000076512265475472014606 0ustar jpeacockjpeacockChanges lib/version.pm lib/version.pod lib/version/regex.pm lib/version/Internals.pod Makefile.PL MANIFEST MANIFEST.SKIP META.yml README t/00impl-pp.t t/01base.t t/02derived.t t/03require.t t/04strict_lax.t t/05sigdie.t t/06noop.t t/07locale.t t/08_corelist.t t/09_list_util.t t/coretests.pm t/survey_locales vperl/vpp.pm vutil/lib/version/vxs.pm vutil/ppport.h vutil/vutil.c vutil/vutil.h vutil/vxs.inc vutil/vxs.xs META.json Module JSON meta-data (added by MakeMaker)