1 ################################################################################
3 ## Version 3.x, Copyright (C) 2004-2013, Marcus Holland-Moritz.
4 ## Version 2.x, Copyright (C) 2001, Paul Marquess.
5 ## Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
7 ## This program is free software; you can redistribute it and/or
8 ## modify it under the same terms as Perl itself.
10 ################################################################################
20 PERL_GCC_BRACE_GROUPS_FORBIDDEN
21 PERL_USE_GCC_BRACE_GROUPS
57 __UNDEFINED__ cBOOL(cbool) ((cbool) ? (bool)1 : (bool)0)
58 __UNDEFINED__ OpHAS_SIBLING(o) (cBOOL((o)->op_sibling))
59 __UNDEFINED__ OpSIBLING(o) (0 + (o)->op_sibling)
60 __UNDEFINED__ OpMORESIB_set(o, sib) ((o)->op_sibling = (sib))
61 __UNDEFINED__ OpLASTSIB_set(o, parent) ((o)->op_sibling = NULL)
62 __UNDEFINED__ OpMAYBESIB_set(o, sib, parent) ((o)->op_sibling = (sib))
63 __UNDEFINED__ HEf_SVKEY -2
74 MAGIC *mg = mg_find(sv, PERL_MAGIC_qr);
75 if (mg && mg->mg_obj) {
85 __UNDEFINED__ SvRXOK(sv) (!!SvRX(sv))
87 #ifndef PERL_UNUSED_DECL
89 # if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER)
90 # define PERL_UNUSED_DECL
92 # define PERL_UNUSED_DECL __attribute__((unused))
95 # define PERL_UNUSED_DECL
99 #ifndef PERL_UNUSED_ARG
100 # if defined(lint) && defined(S_SPLINT_S) /* www.splint.org */
102 # define PERL_UNUSED_ARG(x) NOTE(ARGUNUSED(x))
104 # define PERL_UNUSED_ARG(x) ((void)x)
108 #ifndef PERL_UNUSED_VAR
109 # define PERL_UNUSED_VAR(x) ((void)x)
112 #ifndef PERL_UNUSED_CONTEXT
114 # define PERL_UNUSED_CONTEXT PERL_UNUSED_ARG(my_perl)
116 # define PERL_UNUSED_CONTEXT
120 #ifndef PERL_UNUSED_RESULT
121 # if defined(__GNUC__) && defined(HASATTRIBUTE_WARN_UNUSED_RESULT)
122 # define PERL_UNUSED_RESULT(v) STMT_START { __typeof__(v) z = (v); (void)sizeof(z); } STMT_END
124 # define PERL_UNUSED_RESULT(v) ((void)(v))
128 __UNDEFINED__ NOOP /*EMPTY*/(void)0
129 __UNDEFINED__ dNOOP extern int /*@unused@*/ Perl___notused PERL_UNUSED_DECL
132 # if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
133 # define NVTYPE long double
135 # define NVTYPE double
141 # if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
143 # define INT2PTR(any,d) (any)(d)
145 # if PTRSIZE == LONGSIZE
146 # define PTRV unsigned long
148 # define PTRV unsigned
150 # define INT2PTR(any,d) (any)(PTRV)(d)
155 # if PTRSIZE == LONGSIZE
156 # define PTR2ul(p) (unsigned long)(p)
158 # define PTR2ul(p) INT2PTR(unsigned long,p)
162 __UNDEFINED__ PTR2nat(p) (PTRV)(p)
163 __UNDEFINED__ NUM2PTR(any,d) (any)PTR2nat(d)
164 __UNDEFINED__ PTR2IV(p) INT2PTR(IV,p)
165 __UNDEFINED__ PTR2UV(p) INT2PTR(UV,p)
166 __UNDEFINED__ PTR2NV(p) NUM2PTR(NV,p)
168 #undef START_EXTERN_C
172 # define START_EXTERN_C extern "C" {
173 # define END_EXTERN_C }
174 # define EXTERN_C extern "C"
176 # define START_EXTERN_C
177 # define END_EXTERN_C
178 # define EXTERN_C extern
181 #if defined(PERL_GCC_PEDANTIC)
182 # ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN
183 # define PERL_GCC_BRACE_GROUPS_FORBIDDEN
187 #if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) && !defined(__cplusplus)
188 # ifndef PERL_USE_GCC_BRACE_GROUPS
189 # define PERL_USE_GCC_BRACE_GROUPS
195 #ifdef PERL_USE_GCC_BRACE_GROUPS
196 # define STMT_START (void)( /* gcc supports ``({ STATEMENTS; })'' */
199 # if defined(VOIDFLAGS) && (VOIDFLAGS) && (defined(sun) || defined(__sun__)) && !defined(__GNUC__)
200 # define STMT_START if (1)
201 # define STMT_END else (void)0
203 # define STMT_START do
204 # define STMT_END while (0)
208 __UNDEFINED__ boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no)
210 /* DEFSV appears first in 5.004_56 */
211 __UNDEFINED__ DEFSV GvSV(PL_defgv)
212 __UNDEFINED__ SAVE_DEFSV SAVESPTR(GvSV(PL_defgv))
213 __UNDEFINED__ DEFSV_set(sv) (DEFSV = (sv))
215 /* Older perls (<=5.003) lack AvFILLp */
216 __UNDEFINED__ AvFILLp AvFILL
218 __UNDEFINED__ ERRSV get_sv("@",FALSE)
221 * This function's backport doesn't support the length parameter, but
222 * rather ignores it. Portability can only be ensured if the length
223 * parameter is used for speed reasons, but the length can always be
224 * correctly computed from the string argument.
227 __UNDEFINED__ gv_stashpvn(str,len,create) gv_stashpv(str,create)
230 __UNDEFINED__ get_cv perl_get_cv
231 __UNDEFINED__ get_sv perl_get_sv
232 __UNDEFINED__ get_av perl_get_av
233 __UNDEFINED__ get_hv perl_get_hv
236 __UNDEFINED__ dUNDERBAR dNOOP
237 __UNDEFINED__ UNDERBAR DEFSV
239 __UNDEFINED__ dAX I32 ax = MARK - PL_stack_base + 1
240 __UNDEFINED__ dITEMS I32 items = SP - MARK
242 __UNDEFINED__ dXSTARG SV * targ = sv_newmortal()
244 __UNDEFINED__ dAXMARK I32 ax = POPMARK; \
245 register SV ** const mark = PL_stack_base + ax++
248 __UNDEFINED__ XSprePUSH (sp = PL_stack_base + ax - 1)
250 #if { VERSION < 5.005 }
252 # define XSRETURN(off) \
254 PL_stack_sp = PL_stack_base + ax + ((off) - 1); \
259 __UNDEFINED__ XSPROTO(name) void name(pTHX_ CV* cv)
260 __UNDEFINED__ SVfARG(p) ((void*)(p))
262 __UNDEFINED__ PERL_ABS(x) ((x) < 0 ? -(x) : (x))
264 __UNDEFINED__ dVAR dNOOP
266 __UNDEFINED__ SVf "_"
268 __UNDEFINED__ UTF8_MAXBYTES UTF8_MAXLEN
270 __UNDEFINED__ CPERLscope(x) x
272 __UNDEFINED__ PERL_HASH(hash,str,len) \
274 const char *s_PeRlHaSh = str; \
275 I32 i_PeRlHaSh = len; \
276 U32 hash_PeRlHaSh = 0; \
277 while (i_PeRlHaSh--) \
278 hash_PeRlHaSh = hash_PeRlHaSh * 33 + *s_PeRlHaSh++; \
279 (hash) = hash_PeRlHaSh; \
282 #ifndef PERLIO_FUNCS_DECL
283 # ifdef PERLIO_FUNCS_CONST
284 # define PERLIO_FUNCS_DECL(funcs) const PerlIO_funcs funcs
285 # define PERLIO_FUNCS_CAST(funcs) (PerlIO_funcs*)(funcs)
287 # define PERLIO_FUNCS_DECL(funcs) PerlIO_funcs funcs
288 # define PERLIO_FUNCS_CAST(funcs) (funcs)
292 /* provide these typedefs for older perls */
293 #if { VERSION < 5.9.3 }
296 typedef OP* (CPERLscope(*Perl_ppaddr_t))(ARGSproto);
298 typedef OP* (CPERLscope(*Perl_ppaddr_t))(pTHX);
301 typedef OP* (CPERLscope(*Perl_check_t)) (pTHX_ OP*);
308 # define WIDEST_UTYPE U64TYPE
310 # define WIDEST_UTYPE Quad_t
313 # define WIDEST_UTYPE U32
319 /* This is the first version where these macros are fully correct. Relying on
320 * the C library functions, as earlier releases did, causes problems with
322 # if { VERSION < 5.22.0 }
329 # undef isALPHANUMERIC
330 # undef isALPHANUMERIC_A
365 __UNDEFINED__ isASCII(c) (isCNTRL(c) || isPRINT(c))
367 /* The below is accurate for all EBCDIC code pages supported by
368 * all the versions of Perl overridden by this */
369 __UNDEFINED__ isCNTRL(c) ( (c) == '\0' || (c) == '\a' || (c) == '\b' \
370 || (c) == '\f' || (c) == '\n' || (c) == '\r' \
371 || (c) == '\t' || (c) == '\v' \
372 || ((c) <= 3 && (c) >= 1) /* SOH, STX, ETX */ \
373 || (c) == 7 /* U+7F DEL */ \
374 || ((c) <= 0x13 && (c) >= 0x0E) /* SO, SI */ \
376 || (c) == 0x18 /* U+18 CAN */ \
377 || (c) == 0x19 /* U+19 EOM */ \
378 || ((c) <= 0x1F && (c) >= 0x1C) /* [FGRU]S */ \
379 || (c) == 0x26 /* U+17 ETB */ \
380 || (c) == 0x27 /* U+1B ESC */ \
381 || (c) == 0x2D /* U+05 ENQ */ \
382 || (c) == 0x2E /* U+06 ACK */ \
383 || (c) == 0x32 /* U+16 SYN */ \
384 || (c) == 0x37 /* U+04 EOT */ \
385 || (c) == 0x3C /* U+14 DC4 */ \
386 || (c) == 0x3D /* U+15 NAK */ \
387 || (c) == 0x3F /* U+1A SUB */ \
389 /* The ordering of the tests in this and isUPPER are to exclude most characters
391 __UNDEFINED__ isLOWER(c) ( (c) >= 'a' && (c) <= 'z' \
393 || ((c) >= 'j' && (c) <= 'r') \
395 __UNDEFINED__ isUPPER(c) ( (c) >= 'A' && (c) <= 'Z' \
397 || ((c) >= 'J' && (c) <= 'R') \
400 #else /* Above is EBCDIC; below is ASCII */
402 # if { VERSION < 5.4.0 }
403 /* The implementation of these in older perl versions can give wrong results if
404 * the C program locale is set to other than the C locale */
419 # if { VERSION < 5.8.0 }
421 * Earlier perls omitted DEL */
425 # if { VERSION < 5.10.0 }
427 * The implementation in older perl versions includes all of the
428 * isSPACE() characters, which is wrong. The version provided by
429 * Devel::PPPort always overrides a present buggy version.
435 # if { VERSION < 5.14.0 }
437 * The implementation in older perl versions always returned true if the
438 * parameter was a signed char
444 # if { VERSION < 5.20.0 }
446 * The implementation in older perl versions didn't include \v */
451 __UNDEFINED__ isASCII(c) ((WIDEST_UTYPE) (c) <= 127)
452 __UNDEFINED__ isCNTRL(c) ((WIDEST_UTYPE) (c) < ' ' || (c) == 127)
453 __UNDEFINED__ isLOWER(c) ((c) >= 'a' && (c) <= 'z')
454 __UNDEFINED__ isUPPER(c) ((c) <= 'Z' && (c) >= 'A')
455 #endif /* Below are definitions common to EBCDIC and ASCII */
457 __UNDEFINED__ isALNUM(c) isWORDCHAR(c)
458 __UNDEFINED__ isALNUMC(c) isALPHANUMERIC(c)
459 __UNDEFINED__ isALPHA(c) (isUPPER(c) || isLOWER(c))
460 __UNDEFINED__ isALPHANUMERIC(c) (isALPHA(c) || isDIGIT(c))
461 __UNDEFINED__ isBLANK(c) ((c) == ' ' || (c) == '\t')
462 __UNDEFINED__ isDIGIT(c) ((c) <= '9' && (c) >= '0')
463 __UNDEFINED__ isGRAPH(c) (isWORDCHAR(c) || isPUNCT(c))
464 __UNDEFINED__ isIDCONT(c) isWORDCHAR(c)
465 __UNDEFINED__ isIDFIRST(c) (isALPHA(c) || (c) == '_')
466 __UNDEFINED__ isOCTAL(c) (((WIDEST_UTYPE)((c)) & ~7) == '0')
467 __UNDEFINED__ isPRINT(c) (isGRAPH(c) || (c) == ' ')
468 __UNDEFINED__ isPSXSPC(c) isSPACE(c)
469 __UNDEFINED__ isPUNCT(c) ( (c) == '-' || (c) == '!' || (c) == '"' \
470 || (c) == '#' || (c) == '$' || (c) == '%' \
471 || (c) == '&' || (c) == '\'' || (c) == '(' \
472 || (c) == ')' || (c) == '*' || (c) == '+' \
473 || (c) == ',' || (c) == '.' || (c) == '/' \
474 || (c) == ':' || (c) == ';' || (c) == '<' \
475 || (c) == '=' || (c) == '>' || (c) == '?' \
476 || (c) == '@' || (c) == '[' || (c) == '\\' \
477 || (c) == ']' || (c) == '^' || (c) == '_' \
478 || (c) == '`' || (c) == '{' || (c) == '|' \
479 || (c) == '}' || (c) == '~')
480 __UNDEFINED__ isSPACE(c) ( isBLANK(c) || (c) == '\n' || (c) == '\r' \
481 || (c) == '\v' || (c) == '\f')
482 __UNDEFINED__ isWORDCHAR(c) (isALPHANUMERIC(c) || (c) == '_')
483 __UNDEFINED__ isXDIGIT(c) ( isDIGIT(c) \
484 || ((c) >= 'a' && (c) <= 'f') \
485 || ((c) >= 'A' && (c) <= 'F'))
487 __UNDEFINED__ isALNUM_A isALNUM
488 __UNDEFINED__ isALNUMC_A isALNUMC
489 __UNDEFINED__ isALPHA_A isALPHA
490 __UNDEFINED__ isALPHANUMERIC_A isALPHANUMERIC
491 __UNDEFINED__ isASCII_A isASCII
492 __UNDEFINED__ isBLANK_A isBLANK
493 __UNDEFINED__ isCNTRL_A isCNTRL
494 __UNDEFINED__ isDIGIT_A isDIGIT
495 __UNDEFINED__ isGRAPH_A isGRAPH
496 __UNDEFINED__ isIDCONT_A isIDCONT
497 __UNDEFINED__ isIDFIRST_A isIDFIRST
498 __UNDEFINED__ isLOWER_A isLOWER
499 __UNDEFINED__ isOCTAL_A isOCTAL
500 __UNDEFINED__ isPRINT_A isPRINT
501 __UNDEFINED__ isPSXSPC_A isPSXSPC
502 __UNDEFINED__ isPUNCT_A isPUNCT
503 __UNDEFINED__ isSPACE_A isSPACE
504 __UNDEFINED__ isUPPER_A isUPPER
505 __UNDEFINED__ isWORDCHAR_A isWORDCHAR
506 __UNDEFINED__ isXDIGIT_A isXDIGIT
508 /* Until we figure out how to support this in older perls... */
509 #if { VERSION >= 5.8.0 }
511 __UNDEFINED__ HeUTF8(he) ((HeKLEN(he) == HEf_SVKEY) ? \
512 SvUTF8(HeKEY_sv(he)) : \
517 __UNDEFINED__ C_ARRAY_LENGTH(a) (sizeof(a)/sizeof((a)[0]))
518 __UNDEFINED__ C_ARRAY_END(a) ((a) + C_ARRAY_LENGTH(a))
521 #if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
522 # define MUTABLE_PTR(p) ({ void *_p = (p); _p; })
524 # define MUTABLE_PTR(p) ((void *) (p))
528 __UNDEFINED__ MUTABLE_SV(p) ((SV *)MUTABLE_PTR(p))
532 typedef XSPROTO(XSPROTO_test_t);
533 typedef XSPROTO_test_t *XSPROTO_test_t_ptr;
535 XS(XS_Devel__PPPort_dXSTARG); /* prototype */
536 XS(XS_Devel__PPPort_dXSTARG)
544 iv = SvIV(ST(0)) + 1;
549 XS(XS_Devel__PPPort_dAXMARK); /* prototype */
550 XS(XS_Devel__PPPort_dAXMARK)
559 iv = SvIV(ST(0)) - 1;
571 XSPROTO_test_t_ptr p = &XS_Devel__PPPort_dXSTARG;
572 newXS("Devel::PPPort::dXSTARG", *p, file);
574 newXS("Devel::PPPort::dAXMARK", XS_Devel__PPPort_dAXMARK, file);
589 x = newOP(OP_PUSHMARK, 0);
591 /* No siblings yet! */
592 if (OpHAS_SIBLING(x) || OpSIBLING(x)) {
593 failures++; warn("Op should not have had a sib");
600 for (i = 0; i < 2; i++) {
601 OP *newsib = newOP(OP_PUSHMARK, 0);
602 OpMORESIB_set(kid, newsib);
604 kid = OpSIBLING(kid);
607 middlekid = OpSIBLING(x);
609 /* Should now have a sibling */
610 if (! OpHAS_SIBLING(x) || ! OpSIBLING(x) ) {
611 failures++; warn("Op should have had a sib after moresib_set");
614 /* Count the siblings */
615 for (kid = OpSIBLING(x); kid; kid = OpSIBLING(kid)) {
620 failures++; warn("Kid had %d sibs, expected 2", count);
623 if (OpHAS_SIBLING(lastkid) || OpSIBLING(lastkid)) {
624 failures++; warn("Last kid should not have a sib");
627 /* Really sets the parent, and says 'no more siblings' */
628 OpLASTSIB_set(x, lastkid);
630 if (OpHAS_SIBLING(x) || OpSIBLING(x)) {
631 failures++; warn("OpLASTSIB_set failed?");
634 /* Restore the kid */
635 OpMORESIB_set(x, lastkid);
637 /* Try to remove it again */
638 OpLASTSIB_set(x, NULL);
640 if (OpHAS_SIBLING(x) || OpSIBLING(x)) {
641 failures++; warn("OpLASTSIB_set with NULL failed?");
644 /* Try to restore with maybesib_set */
645 OpMAYBESIB_set(x, lastkid, NULL);
647 if (! OpHAS_SIBLING(x) || ! OpSIBLING(x) ) {
648 failures++; warn("Op should have had a sib after maybesibset");
673 RETVAL += PTR2nat(p) != 0 ? 1 : 0;
674 RETVAL += PTR2ul(p) != 0UL ? 2 : 0;
675 RETVAL += PTR2UV(p) != (UV) 0 ? 4 : 0;
676 RETVAL += PTR2IV(p) != (IV) 0 ? 8 : 0;
677 RETVAL += PTR2NV(p) != (NV) 0 ? 16 : 0;
678 RETVAL += p > NUM2PTR(int *, 0) ? 32 : 0;
684 gv_stashpvn(name, create)
688 RETVAL = gv_stashpvn(name, strlen(name), create) != NULL;
697 RETVAL = get_sv(name, create) != NULL;
706 RETVAL = get_av(name, create) != NULL;
715 RETVAL = get_hv(name, create) != NULL;
724 RETVAL = get_cv(name, create) != NULL;
744 RETVAL = newSVsv(boolSV(value));
751 RETVAL = newSVsv(DEFSV);
758 XPUSHs(sv_mortalcopy(DEFSV));
761 DEFSV_set(newSVpvs("DEFSV"));
762 XPUSHs(sv_mortalcopy(DEFSV));
763 /* Yes, this leaks the above scalar; 5.005 with threads for some reason */
764 /* frees it upon LEAVE, thus mortalizing it causes "attempt to free..." */
765 /* sv_2mortal(DEFSV); */
767 XPUSHs(sv_mortalcopy(DEFSV));
773 RETVAL = SvTRUE(ERRSV);
782 RETVAL = newSVsv(UNDERBAR);
805 #if { VERSION >= 5.004 }
806 x = sv_2mortal(newSVpvf("[%" SVf "]", SVfARG(x)));
812 Perl_ppaddr_t(string)
817 lower = PL_ppaddr[OP_LC];
818 mXPUSHs(newSVpv(string, 0));
821 (void)*(lower)(aTHXR);
826 #if { VERSION >= 5.8.0 }
829 check_HeUTF8(utf8_key)
839 key = SvPV(utf8_key, klen);
840 if (SvUTF8(utf8_key)) klen *= -1;
841 hv_store(hash, key, klen, newSVpvs("string"), 0);
843 ent = hv_iternext(hash);
845 mXPUSHp((HeUTF8(ent) == 0 ? "norm" : "utf8"), 4);
854 int x[] = { 10, 11, 12, 13 };
856 mXPUSHi(C_ARRAY_LENGTH(x)); /* 4 */
857 mXPUSHi(*(C_ARRAY_END(x)-1)); /* 13 */
862 RETVAL = isBLANK(ord);
867 test_isBLANK_A(UV ord)
869 RETVAL = isBLANK_A(ord);
876 RETVAL = isUPPER(ord);
881 test_isUPPER_A(UV ord)
883 RETVAL = isUPPER_A(ord);
890 RETVAL = isLOWER(ord);
895 test_isLOWER_A(UV ord)
897 RETVAL = isLOWER_A(ord);
904 RETVAL = isALPHA(ord);
909 test_isALPHA_A(UV ord)
911 RETVAL = isALPHA_A(ord);
916 test_isWORDCHAR(UV ord)
918 RETVAL = isWORDCHAR(ord);
923 test_isWORDCHAR_A(UV ord)
925 RETVAL = isWORDCHAR_A(ord);
930 test_isALPHANUMERIC(UV ord)
932 RETVAL = isALPHANUMERIC(ord);
937 test_isALPHANUMERIC_A(UV ord)
939 RETVAL = isALPHANUMERIC_A(ord);
946 RETVAL = isALNUM(ord);
951 test_isALNUM_A(UV ord)
953 RETVAL = isALNUM_A(ord);
960 RETVAL = isDIGIT(ord);
965 test_isDIGIT_A(UV ord)
967 RETVAL = isDIGIT_A(ord);
974 RETVAL = isOCTAL(ord);
979 test_isOCTAL_A(UV ord)
981 RETVAL = isOCTAL_A(ord);
986 test_isIDFIRST(UV ord)
988 RETVAL = isIDFIRST(ord);
993 test_isIDFIRST_A(UV ord)
995 RETVAL = isIDFIRST_A(ord);
1000 test_isIDCONT(UV ord)
1002 RETVAL = isIDCONT(ord);
1007 test_isIDCONT_A(UV ord)
1009 RETVAL = isIDCONT_A(ord);
1014 test_isSPACE(UV ord)
1016 RETVAL = isSPACE(ord);
1021 test_isSPACE_A(UV ord)
1023 RETVAL = isSPACE_A(ord);
1028 test_isASCII(UV ord)
1030 RETVAL = isASCII(ord);
1035 test_isASCII_A(UV ord)
1037 RETVAL = isASCII_A(ord);
1042 test_isCNTRL(UV ord)
1044 RETVAL = isCNTRL(ord);
1049 test_isCNTRL_A(UV ord)
1051 RETVAL = isCNTRL_A(ord);
1056 test_isPRINT(UV ord)
1058 RETVAL = isPRINT(ord);
1063 test_isPRINT_A(UV ord)
1065 RETVAL = isPRINT_A(ord);
1070 test_isGRAPH(UV ord)
1072 RETVAL = isGRAPH(ord);
1077 test_isGRAPH_A(UV ord)
1079 RETVAL = isGRAPH_A(ord);
1084 test_isPUNCT(UV ord)
1086 RETVAL = isPUNCT(ord);
1091 test_isPUNCT_A(UV ord)
1093 RETVAL = isPUNCT_A(ord);
1098 test_isXDIGIT(UV ord)
1100 RETVAL = isXDIGIT(ord);
1105 test_isXDIGIT_A(UV ord)
1107 RETVAL = isXDIGIT_A(ord);
1112 test_isPSXSPC(UV ord)
1114 RETVAL = isPSXSPC(ord);
1119 test_isPSXSPC_A(UV ord)
1121 RETVAL = isPSXSPC_A(ord);
1127 use vars qw($my_sv @my_av %my_hv);
1129 ok(&Devel::PPPort::boolSV(1));
1130 ok(!&Devel::PPPort::boolSV(0));
1133 ok(&Devel::PPPort::DEFSV(), "Fred");
1134 ok(&Devel::PPPort::UNDERBAR(), "Fred");
1136 if ("$]" >= 5.009002 && "$]" < 5.023 && "$]" < 5.023004) {
1138 no warnings "deprecated";
1139 no if $^V > v5.17.9, warnings => "experimental::lexical_topic";
1141 ok(&Devel::PPPort::DEFSV(), "Fred");
1142 ok(&Devel::PPPort::UNDERBAR(), "Tony");
1150 my @r = &Devel::PPPort::DEFSV_modify();
1157 ok(&Devel::PPPort::DEFSV(), "Fred");
1160 ok(!&Devel::PPPort::ERRSV());
1161 eval { cannot_call_this_one() };
1162 ok(&Devel::PPPort::ERRSV());
1164 ok(&Devel::PPPort::gv_stashpvn('Devel::PPPort', 0));
1165 ok(!&Devel::PPPort::gv_stashpvn('does::not::exist', 0));
1166 ok(&Devel::PPPort::gv_stashpvn('does::not::exist', 1));
1169 ok(&Devel::PPPort::get_sv('my_sv', 0));
1170 ok(!&Devel::PPPort::get_sv('not_my_sv', 0));
1171 ok(&Devel::PPPort::get_sv('not_my_sv', 1));
1174 ok(&Devel::PPPort::get_av('my_av', 0));
1175 ok(!&Devel::PPPort::get_av('not_my_av', 0));
1176 ok(&Devel::PPPort::get_av('not_my_av', 1));
1179 ok(&Devel::PPPort::get_hv('my_hv', 0));
1180 ok(!&Devel::PPPort::get_hv('not_my_hv', 0));
1181 ok(&Devel::PPPort::get_hv('not_my_hv', 1));
1184 ok(&Devel::PPPort::get_cv('my_cv', 0));
1185 ok(!&Devel::PPPort::get_cv('not_my_cv', 0));
1186 ok(&Devel::PPPort::get_cv('not_my_cv', 1));
1188 ok(Devel::PPPort::dXSTARG(42), 43);
1189 ok(Devel::PPPort::dAXMARK(4711), 4710);
1191 ok(Devel::PPPort::prepush(), 42);
1193 ok(join(':', Devel::PPPort::xsreturn(0)), 'test1');
1194 ok(join(':', Devel::PPPort::xsreturn(1)), 'test1:test2');
1196 ok(Devel::PPPort::PERL_ABS(42), 42);
1197 ok(Devel::PPPort::PERL_ABS(-13), 13);
1199 ok(Devel::PPPort::SVf(42), "$]" >= 5.004 ? '[42]' : '42');
1200 ok(Devel::PPPort::SVf('abc'), "$]" >= 5.004 ? '[abc]' : 'abc');
1202 ok(&Devel::PPPort::Perl_ppaddr_t("FOO"), "foo");
1204 ok(&Devel::PPPort::ptrtests(), 63);
1206 ok(&Devel::PPPort::OpSIBLING_tests(), 0);
1208 if ("$]" >= 5.009000) {
1210 ok(&Devel::PPPort::check_HeUTF8("hello"), "norm");
1211 ok(&Devel::PPPort::check_HeUTF8("\N{U+263a}"), "utf8");
1218 @r = &Devel::PPPort::check_c_array();
1222 ok(!Devel::PPPort::SvRXOK(""));
1223 ok(!Devel::PPPort::SvRXOK(bless [], "Regexp"));
1226 skip 'no qr// objects in this perl', 0;
1227 skip 'no qr// objects in this perl', 0;
1229 my $qr = eval 'qr/./';
1230 ok(Devel::PPPort::SvRXOK($qr));
1231 ok(Devel::PPPort::SvRXOK(bless $qr, "Surprise"));
1234 ok( Devel::PPPort::test_isBLANK(ord(" ")));
1235 ok(! Devel::PPPort::test_isBLANK(ord("\n")));
1237 ok( Devel::PPPort::test_isBLANK_A(ord("\t")));
1238 ok(! Devel::PPPort::test_isBLANK_A(ord("\r")));
1240 ok( Devel::PPPort::test_isUPPER(ord("A")));
1241 ok(! Devel::PPPort::test_isUPPER(ord("a")));
1243 ok( Devel::PPPort::test_isUPPER_A(ord("Z")));
1245 # One of these two is uppercase in EBCDIC; the other in Latin1, but neither are
1247 ok(! Devel::PPPort::test_isUPPER_A(ord(0xDC)));
1248 ok(! Devel::PPPort::test_isUPPER_A(ord(0xFC)));
1250 ok( Devel::PPPort::test_isLOWER(ord("b")));
1251 ok(! Devel::PPPort::test_isLOWER(ord("B")));
1253 ok( Devel::PPPort::test_isLOWER_A(ord("y")));
1255 # One of these two is lowercase in EBCDIC; the other in Latin1, but neither are
1257 ok(! Devel::PPPort::test_isLOWER_A(ord(0xDC)));
1258 ok(! Devel::PPPort::test_isLOWER_A(ord(0xFC)));
1260 ok( Devel::PPPort::test_isALPHA(ord("C")));
1261 ok(! Devel::PPPort::test_isALPHA(ord("1")));
1263 ok( Devel::PPPort::test_isALPHA_A(ord("x")));
1264 ok(! Devel::PPPort::test_isALPHA_A(0xDC));
1266 ok( Devel::PPPort::test_isWORDCHAR(ord("_")));
1267 ok(! Devel::PPPort::test_isWORDCHAR(ord("@")));
1269 ok( Devel::PPPort::test_isWORDCHAR_A(ord("2")));
1270 ok(! Devel::PPPort::test_isWORDCHAR_A(0xFC));
1272 ok( Devel::PPPort::test_isALPHANUMERIC(ord("4")));
1273 ok(! Devel::PPPort::test_isALPHANUMERIC(ord("_")));
1275 ok( Devel::PPPort::test_isALPHANUMERIC_A(ord("l")));
1276 ok(! Devel::PPPort::test_isALPHANUMERIC_A(0xDC));
1278 ok( Devel::PPPort::test_isALNUM(ord("c")));
1279 ok(! Devel::PPPort::test_isALNUM(ord("}")));
1281 ok( Devel::PPPort::test_isALNUM_A(ord("5")));
1282 ok(! Devel::PPPort::test_isALNUM_A(0xFC));
1284 ok( Devel::PPPort::test_isDIGIT(ord("6")));
1285 ok(! Devel::PPPort::test_isDIGIT(ord("_")));
1287 ok( Devel::PPPort::test_isDIGIT_A(ord("7")));
1288 ok(! Devel::PPPort::test_isDIGIT_A(0xDC));
1290 ok( Devel::PPPort::test_isOCTAL(ord("7")));
1291 ok(! Devel::PPPort::test_isOCTAL(ord("8")));
1293 ok( Devel::PPPort::test_isOCTAL_A(ord("0")));
1294 ok(! Devel::PPPort::test_isOCTAL_A(ord("9")));
1296 ok( Devel::PPPort::test_isIDFIRST(ord("D")));
1297 ok(! Devel::PPPort::test_isIDFIRST(ord("1")));
1299 ok( Devel::PPPort::test_isIDFIRST_A(ord("_")));
1300 ok(! Devel::PPPort::test_isIDFIRST_A(0xFC));
1302 ok( Devel::PPPort::test_isIDCONT(ord("e")));
1303 ok(! Devel::PPPort::test_isIDCONT(ord("@")));
1305 ok( Devel::PPPort::test_isIDCONT_A(ord("2")));
1306 ok(! Devel::PPPort::test_isIDCONT_A(0xDC));
1308 ok( Devel::PPPort::test_isSPACE(ord(" ")));
1309 ok(! Devel::PPPort::test_isSPACE(ord("_")));
1311 ok( Devel::PPPort::test_isSPACE_A(ord("\cK")));
1312 ok(! Devel::PPPort::test_isSPACE_A(ord("F")));
1314 # This stresses the edge for ASCII machines, but happens to work on EBCDIC as
1316 ok( Devel::PPPort::test_isASCII(0x7F));
1317 ok(! Devel::PPPort::test_isASCII(0x80));
1319 ok( Devel::PPPort::test_isASCII_A(ord("9")));
1321 # B6 is the PARAGRAPH SIGN in ASCII and EBCDIC
1322 ok(! Devel::PPPort::test_isASCII_A(0xB6));
1324 ok( Devel::PPPort::test_isCNTRL(ord("\e")));
1325 ok(! Devel::PPPort::test_isCNTRL(ord(" ")));
1327 ok( Devel::PPPort::test_isCNTRL_A(ord("\a")));
1328 ok(! Devel::PPPort::test_isCNTRL_A(0xB6));
1330 ok( Devel::PPPort::test_isPRINT(ord(" ")));
1331 ok(! Devel::PPPort::test_isPRINT(ord("\n")));
1333 ok( Devel::PPPort::test_isPRINT_A(ord("G")));
1334 ok(! Devel::PPPort::test_isPRINT_A(0xB6));
1336 ok( Devel::PPPort::test_isGRAPH(ord("h")));
1337 ok(! Devel::PPPort::test_isGRAPH(ord(" ")));
1339 ok( Devel::PPPort::test_isGRAPH_A(ord("i")));
1340 ok(! Devel::PPPort::test_isGRAPH_A(0xB6));
1342 ok( Devel::PPPort::test_isPUNCT(ord("#")));
1343 ok(! Devel::PPPort::test_isPUNCT(ord(" ")));
1345 ok( Devel::PPPort::test_isPUNCT_A(ord("*")));
1346 ok(! Devel::PPPort::test_isPUNCT_A(0xB6));
1348 ok( Devel::PPPort::test_isXDIGIT(ord("A")));
1349 ok(! Devel::PPPort::test_isXDIGIT(ord("_")));
1351 ok( Devel::PPPort::test_isXDIGIT_A(ord("9")));
1352 ok(! Devel::PPPort::test_isXDIGIT_A(0xDC));
1354 ok( Devel::PPPort::test_isPSXSPC(ord(" ")));
1355 ok(! Devel::PPPort::test_isPSXSPC(ord("k")));
1357 ok( Devel::PPPort::test_isPSXSPC_A(ord("\cK")));
1358 ok(! Devel::PPPort::test_isPSXSPC_A(0xFC));