This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add tests for NATIVE_TO_LATIN1, vice-versa
[perl5.git] / dist / Devel-PPPort / parts / inc / misc
CommitLineData
adfe19db
MHM
1################################################################################
2##
b2049988 3## Version 3.x, Copyright (C) 2004-2013, Marcus Holland-Moritz.
adfe19db
MHM
4## Version 2.x, Copyright (C) 2001, Paul Marquess.
5## Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
6##
7## This program is free software; you can redistribute it and/or
8## modify it under the same terms as Perl itself.
9##
10################################################################################
11
12=provides
13
14__UNDEFINED__
f2615e36
KW
15END_EXTERN_C
16EXTERN_C
f2615e36
KW
17INT2PTR
18MUTABLE_PTR
f2615e36 19NVTYPE
f2615e36
KW
20PERLIO_FUNCS_CAST
21PERLIO_FUNCS_DECL
f2ab5a41 22PERL_UNUSED_ARG
f2ab5a41 23PERL_UNUSED_CONTEXT
f2615e36 24PERL_UNUSED_DECL
94e22bd6 25PERL_UNUSED_RESULT
f2615e36 26PERL_UNUSED_VAR
c07deaaf 27PERL_USE_GCC_BRACE_GROUPS
adfe19db 28PTR2ul
f2615e36 29PTRV
a745474a 30START_EXTERN_C
a745474a 31STMT_END
f2615e36
KW
32STMT_START
33SvRX
b2049988 34WIDEST_UTYPE
0d0f8426 35XSRETURN
adfe19db
MHM
36
37=implementation
38
94e22bd6
MH
39__UNDEFINED__ cBOOL(cbool) ((cbool) ? (bool)1 : (bool)0)
40__UNDEFINED__ OpHAS_SIBLING(o) (cBOOL((o)->op_sibling))
41__UNDEFINED__ OpSIBLING(o) (0 + (o)->op_sibling)
42__UNDEFINED__ OpMORESIB_set(o, sib) ((o)->op_sibling = (sib))
43__UNDEFINED__ OpLASTSIB_set(o, parent) ((o)->op_sibling = NULL)
44__UNDEFINED__ OpMAYBESIB_set(o, sib, parent) ((o)->op_sibling = (sib))
58329f0d 45__UNDEFINED__ HEf_SVKEY -2
94e22bd6 46
6a6bfa62
KW
47#if defined(DEBUGGING) && !defined(__COVERITY__)
48__UNDEFINED__ __ASSERT_(statement) assert(statement),
49#else
50__UNDEFINED__ __ASSERT_(statement)
51#endif
52
a1d467bc
KW
53/* These could become provided when they become part of the public API */
54__UNDEF_NOT_PROVIDED__ withinCOUNT(c, l, n) \
55 (((WIDEST_UTYPE) (((c)) - ((l) | 0))) <= (((WIDEST_UTYPE) ((n) | 0))))
56__UNDEF_NOT_PROVIDED__ inRANGE(c, l, u) \
57 ( (sizeof(c) == sizeof(U8)) ? withinCOUNT(((U8) (c)), (l), ((u) - (l))) \
58 : (sizeof(c) == sizeof(U16)) ? withinCOUNT(((U16) (c)), (l), ((u) - (l))) \
59 : (sizeof(c) == sizeof(U32)) ? withinCOUNT(((U32) (c)), (l), ((u) - (l))) \
60 : (withinCOUNT(((WIDEST_UTYPE) (c)), (l), ((u) - (l)))))
61
e2e74bab 62__UNDEFINED__ SvRX(rv) (SvROK((rv)) ? (SvMAGICAL(SvRV((rv))) ? (mg_find(SvRV((rv)), PERL_MAGIC_qr) ? mg_find(SvRV((rv)), PERL_MAGIC_qr)->mg_obj : NULL) : NULL) : NULL)
94e22bd6
MH
63__UNDEFINED__ SvRXOK(sv) (!!SvRX(sv))
64
62093c1c
NC
65#ifndef PERL_UNUSED_DECL
66# ifdef HASATTRIBUTE
67# if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER)
68# define PERL_UNUSED_DECL
69# else
70# define PERL_UNUSED_DECL __attribute__((unused))
71# endif
adfe19db 72# else
62093c1c 73# define PERL_UNUSED_DECL
adfe19db 74# endif
adfe19db
MHM
75#endif
76
f2ab5a41
MHM
77#ifndef PERL_UNUSED_ARG
78# if defined(lint) && defined(S_SPLINT_S) /* www.splint.org */
79# include <note.h>
80# define PERL_UNUSED_ARG(x) NOTE(ARGUNUSED(x))
81# else
82# define PERL_UNUSED_ARG(x) ((void)x)
83# endif
84#endif
85
86#ifndef PERL_UNUSED_VAR
87# define PERL_UNUSED_VAR(x) ((void)x)
88#endif
89
90#ifndef PERL_UNUSED_CONTEXT
91# ifdef USE_ITHREADS
92# define PERL_UNUSED_CONTEXT PERL_UNUSED_ARG(my_perl)
93# else
94# define PERL_UNUSED_CONTEXT
95# endif
96#endif
97
94e22bd6
MH
98#ifndef PERL_UNUSED_RESULT
99# if defined(__GNUC__) && defined(HASATTRIBUTE_WARN_UNUSED_RESULT)
100# define PERL_UNUSED_RESULT(v) STMT_START { __typeof__(v) z = (v); (void)sizeof(z); } STMT_END
101# else
102# define PERL_UNUSED_RESULT(v) ((void)(v))
103# endif
104#endif
105
f2ab5a41
MHM
106__UNDEFINED__ NOOP /*EMPTY*/(void)0
107__UNDEFINED__ dNOOP extern int /*@unused@*/ Perl___notused PERL_UNUSED_DECL
adfe19db
MHM
108
109#ifndef NVTYPE
110# if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
111# define NVTYPE long double
112# else
113# define NVTYPE double
114# endif
115typedef NVTYPE NV;
116#endif
117
118#ifndef INT2PTR
adfe19db
MHM
119# if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
120# define PTRV UV
121# define INT2PTR(any,d) (any)(d)
122# else
123# if PTRSIZE == LONGSIZE
124# define PTRV unsigned long
125# else
126# define PTRV unsigned
127# endif
128# define INT2PTR(any,d) (any)(PTRV)(d)
129# endif
7bb03b24 130#endif
adfe19db 131
7bb03b24 132#ifndef PTR2ul
adfe19db
MHM
133# if PTRSIZE == LONGSIZE
134# define PTR2ul(p) (unsigned long)(p)
135# else
4a582685 136# define PTR2ul(p) INT2PTR(unsigned long,p)
adfe19db 137# endif
7bb03b24 138#endif
adfe19db 139
7bb03b24
MHM
140__UNDEFINED__ PTR2nat(p) (PTRV)(p)
141__UNDEFINED__ NUM2PTR(any,d) (any)PTR2nat(d)
142__UNDEFINED__ PTR2IV(p) INT2PTR(IV,p)
143__UNDEFINED__ PTR2UV(p) INT2PTR(UV,p)
144__UNDEFINED__ PTR2NV(p) NUM2PTR(NV,p)
adfe19db 145
a745474a
MHM
146#undef START_EXTERN_C
147#undef END_EXTERN_C
148#undef EXTERN_C
149#ifdef __cplusplus
150# define START_EXTERN_C extern "C" {
151# define END_EXTERN_C }
152# define EXTERN_C extern "C"
153#else
154# define START_EXTERN_C
155# define END_EXTERN_C
156# define EXTERN_C extern
157#endif
158
0915d96d 159#if { VERSION < 5.004 } || defined(PERL_GCC_PEDANTIC)
c07deaaf 160# ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN
12b46422 161__UNDEF_NOT_PROVIDED__ PERL_GCC_BRACE_GROUPS_FORBIDDEN
a745474a
MHM
162# endif
163#endif
164
c07deaaf
MHM
165#if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) && !defined(__cplusplus)
166# ifndef PERL_USE_GCC_BRACE_GROUPS
167# define PERL_USE_GCC_BRACE_GROUPS
168# endif
169#endif
170
a745474a
MHM
171#undef STMT_START
172#undef STMT_END
c07deaaf 173#ifdef PERL_USE_GCC_BRACE_GROUPS
b2049988
MHM
174# define STMT_START (void)( /* gcc supports ``({ STATEMENTS; })'' */
175# define STMT_END )
a745474a
MHM
176#else
177# if defined(VOIDFLAGS) && (VOIDFLAGS) && (defined(sun) || defined(__sun__)) && !defined(__GNUC__)
b2049988
MHM
178# define STMT_START if (1)
179# define STMT_END else (void)0
a745474a 180# else
b2049988
MHM
181# define STMT_START do
182# define STMT_END while (0)
a745474a
MHM
183# endif
184#endif
185
adfe19db
MHM
186__UNDEFINED__ boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no)
187
188/* DEFSV appears first in 5.004_56 */
b2049988 189__UNDEFINED__ DEFSV GvSV(PL_defgv)
adfe19db 190__UNDEFINED__ SAVE_DEFSV SAVESPTR(GvSV(PL_defgv))
ac2e3cea 191__UNDEFINED__ DEFSV_set(sv) (DEFSV = (sv))
adfe19db
MHM
192
193/* Older perls (<=5.003) lack AvFILLp */
194__UNDEFINED__ AvFILLp AvFILL
195
1eff2a3b
KW
196__UNDEFINED__ av_tindex AvFILL
197__UNDEFINED__ av_top_index AvFILL
198
adfe19db
MHM
199__UNDEFINED__ ERRSV get_sv("@",FALSE)
200
adfe19db
MHM
201/* Hint: gv_stashpvn
202 * This function's backport doesn't support the length parameter, but
203 * rather ignores it. Portability can only be ensured if the length
204 * parameter is used for speed reasons, but the length can always be
205 * correctly computed from the string argument.
206 */
207
208__UNDEFINED__ gv_stashpvn(str,len,create) gv_stashpv(str,create)
209
210/* Replace: 1 */
211__UNDEFINED__ get_cv perl_get_cv
212__UNDEFINED__ get_sv perl_get_sv
213__UNDEFINED__ get_av perl_get_av
214__UNDEFINED__ get_hv perl_get_hv
215/* Replace: 0 */
216
adfe19db
MHM
217__UNDEFINED__ dUNDERBAR dNOOP
218__UNDEFINED__ UNDERBAR DEFSV
219
220__UNDEFINED__ dAX I32 ax = MARK - PL_stack_base + 1
221__UNDEFINED__ dITEMS I32 items = SP - MARK
222
9132e1a3
MHM
223__UNDEFINED__ dXSTARG SV * targ = sv_newmortal()
224
0d0f8426
MHM
225__UNDEFINED__ dAXMARK I32 ax = POPMARK; \
226 register SV ** const mark = PL_stack_base + ax++
227
228
229__UNDEFINED__ XSprePUSH (sp = PL_stack_base + ax - 1)
230
231#if { VERSION < 5.005 }
232# undef XSRETURN
233# define XSRETURN(off) \
234 STMT_START { \
235 PL_stack_sp = PL_stack_base + ax + ((off) - 1); \
236 return; \
237 } STMT_END
238#endif
239
8565c31a
MHM
240__UNDEFINED__ XSPROTO(name) void name(pTHX_ CV* cv)
241__UNDEFINED__ SVfARG(p) ((void*)(p))
242
f2ab5a41
MHM
243__UNDEFINED__ PERL_ABS(x) ((x) < 0 ? -(x) : (x))
244
245__UNDEFINED__ dVAR dNOOP
246
247__UNDEFINED__ SVf "_"
248
fd7af155
MHM
249__UNDEFINED__ CPERLscope(x) x
250
c83e6f19 251__UNDEFINED__ PERL_HASH(hash,str,len) \
b2049988
MHM
252 STMT_START { \
253 const char *s_PeRlHaSh = str; \
254 I32 i_PeRlHaSh = len; \
255 U32 hash_PeRlHaSh = 0; \
256 while (i_PeRlHaSh--) \
257 hash_PeRlHaSh = hash_PeRlHaSh * 33 + *s_PeRlHaSh++; \
258 (hash) = hash_PeRlHaSh; \
c83e6f19 259 } STMT_END
679ad62d 260
9c0a17a0
MHM
261#ifndef PERLIO_FUNCS_DECL
262# ifdef PERLIO_FUNCS_CONST
263# define PERLIO_FUNCS_DECL(funcs) const PerlIO_funcs funcs
264# define PERLIO_FUNCS_CAST(funcs) (PerlIO_funcs*)(funcs)
265# else
266# define PERLIO_FUNCS_DECL(funcs) PerlIO_funcs funcs
267# define PERLIO_FUNCS_CAST(funcs) (funcs)
268# endif
269#endif
270
fd7af155
MHM
271/* provide these typedefs for older perls */
272#if { VERSION < 5.9.3 }
273
274# ifdef ARGSproto
275typedef OP* (CPERLscope(*Perl_ppaddr_t))(ARGSproto);
276# else
277typedef OP* (CPERLscope(*Perl_ppaddr_t))(pTHX);
278# endif
279
280typedef OP* (CPERLscope(*Perl_check_t)) (pTHX_ OP*);
281
282#endif
283
111bb900
CB
284#ifndef WIDEST_UTYPE
285# ifdef QUADKIND
286# ifdef U64TYPE
287# define WIDEST_UTYPE U64TYPE
288# else
289# define WIDEST_UTYPE Quad_t
290# endif
744ef08f 291# else
111bb900 292# define WIDEST_UTYPE U32
744ef08f 293# endif
b2049988
MHM
294#endif
295
2375c233
KW
296/* On versions without NATIVE_TO_ASCII, only ASCII is supported */
297#if defined(EBCDIC) && defined(NATIVE_TO_ASCI)
150ac7cc 298__UNDEFINED__ NATIVE_TO_LATIN1(c) NATIVE_TO_ASCII(c)
150ac7cc 299__UNDEFINED__ LATIN1_TO_NATIVE(c) ASCII_TO_NATIVE(c)
2375c233
KW
300__UNDEFINED__ NATIVE_TO_UNI(c) ((c) > 255 ? (c) : NATIVE_TO_LATIN1(c))
301__UNDEFINED__ UNI_TO_NATIVE(c) ((c) > 255 ? (c) : LATIN1_TO_NATIVE(c))
150ac7cc 302#else
2375c233 303__UNDEFINED__ NATIVE_TO_LATIN1(c) (c)
150ac7cc 304__UNDEFINED__ LATIN1_TO_NATIVE(c) (c)
2375c233
KW
305__UNDEFINED__ NATIVE_TO_UNI(c) (c)
306__UNDEFINED__ UNI_TO_NATIVE(c) (c)
150ac7cc
KW
307#endif
308
2375c233 309/* Warning: LATIN1_TO_NATIVE, NATIVE_TO_LATIN1 NATIVE_TO_UNI UNI_TO_NATIVE
150ac7cc
KW
310 EBCDIC is not supported on versions earlier than 5.7.1
311 */
312
9dc2cc38
KW
313#ifdef EBCDIC
314
e17f6823
KW
315/* This is the first version where these macros are fully correct on EBCDIC
316 * platforms. Relying on * the C library functions, as earlier releases did,
317 * causes problems with * locales */
9dc2cc38
KW
318# if { VERSION < 5.22.0 }
319# undef isALNUM
320# undef isALNUM_A
876aded1 321# undef isALNUM_L1
9dc2cc38
KW
322# undef isALNUMC
323# undef isALNUMC_A
876aded1 324# undef isALNUMC_L1
9dc2cc38
KW
325# undef isALPHA
326# undef isALPHA_A
876aded1 327# undef isALPHA_L1
9dc2cc38
KW
328# undef isALPHANUMERIC
329# undef isALPHANUMERIC_A
876aded1 330# undef isALPHANUMERIC_L1
9dc2cc38
KW
331# undef isASCII
332# undef isASCII_A
876aded1 333# undef isASCII_L1
9dc2cc38
KW
334# undef isBLANK
335# undef isBLANK_A
876aded1 336# undef isBLANK_L1
9dc2cc38
KW
337# undef isCNTRL
338# undef isCNTRL_A
876aded1 339# undef isCNTRL_L1
9dc2cc38
KW
340# undef isDIGIT
341# undef isDIGIT_A
876aded1 342# undef isDIGIT_L1
9dc2cc38
KW
343# undef isGRAPH
344# undef isGRAPH_A
876aded1 345# undef isGRAPH_L1
9dc2cc38
KW
346# undef isIDCONT
347# undef isIDCONT_A
876aded1 348# undef isIDCONT_L1
9dc2cc38
KW
349# undef isIDFIRST
350# undef isIDFIRST_A
876aded1 351# undef isIDFIRST_L1
9dc2cc38
KW
352# undef isLOWER
353# undef isLOWER_A
876aded1 354# undef isLOWER_L1
9dc2cc38
KW
355# undef isOCTAL
356# undef isOCTAL_A
876aded1 357# undef isOCTAL_L1
9dc2cc38
KW
358# undef isPRINT
359# undef isPRINT_A
876aded1 360# undef isPRINT_L1
9dc2cc38
KW
361# undef isPSXSPC
362# undef isPSXSPC_A
876aded1 363# undef isPSXSPC_L1
9dc2cc38
KW
364# undef isPUNCT
365# undef isPUNCT_A
876aded1 366# undef isPUNCT_L1
9dc2cc38
KW
367# undef isSPACE
368# undef isSPACE_A
876aded1 369# undef isSPACE_L1
9dc2cc38
KW
370# undef isUPPER
371# undef isUPPER_A
876aded1 372# undef isUPPER_L1
9dc2cc38
KW
373# undef isWORDCHAR
374# undef isWORDCHAR_A
876aded1 375# undef isWORDCHAR_L1
9dc2cc38
KW
376# undef isXDIGIT
377# undef isXDIGIT_A
876aded1 378# undef isXDIGIT_L1
9dc2cc38
KW
379# endif
380
381__UNDEFINED__ isASCII(c) (isCNTRL(c) || isPRINT(c))
382
383 /* The below is accurate for all EBCDIC code pages supported by
384 * all the versions of Perl overridden by this */
385__UNDEFINED__ isCNTRL(c) ( (c) == '\0' || (c) == '\a' || (c) == '\b' \
386 || (c) == '\f' || (c) == '\n' || (c) == '\r' \
387 || (c) == '\t' || (c) == '\v' \
388 || ((c) <= 3 && (c) >= 1) /* SOH, STX, ETX */ \
389 || (c) == 7 /* U+7F DEL */ \
390 || ((c) <= 0x13 && (c) >= 0x0E) /* SO, SI */ \
391 /* DLE, DC[1-3] */ \
392 || (c) == 0x18 /* U+18 CAN */ \
393 || (c) == 0x19 /* U+19 EOM */ \
394 || ((c) <= 0x1F && (c) >= 0x1C) /* [FGRU]S */ \
395 || (c) == 0x26 /* U+17 ETB */ \
396 || (c) == 0x27 /* U+1B ESC */ \
397 || (c) == 0x2D /* U+05 ENQ */ \
398 || (c) == 0x2E /* U+06 ACK */ \
399 || (c) == 0x32 /* U+16 SYN */ \
400 || (c) == 0x37 /* U+04 EOT */ \
401 || (c) == 0x3C /* U+14 DC4 */ \
402 || (c) == 0x3D /* U+15 NAK */ \
403 || (c) == 0x3F /* U+1A SUB */ \
404 )
876aded1
KW
405
406#if '^' == 106 /* EBCDIC POSIX-BC */
407# define D_PPP_OUTLIER_CONTROL 0x5F
408#else /* EBCDIC 1047 037 */
409# define D_PPP_OUTLIER_CONTROL 0xFF
410#endif
411
412/* The controls are everything below blank, plus one outlier */
413__UNDEFINED__ isCNTRL_L1(c) ((WIDEST_UTYPE) (c) < ' ' \
414 || (WIDEST_UTYPE) (c) == D_PPP_OUTLIER_CONTROL)
9dc2cc38
KW
415/* The ordering of the tests in this and isUPPER are to exclude most characters
416 * early */
417__UNDEFINED__ isLOWER(c) ( (c) >= 'a' && (c) <= 'z' \
418 && ( (c) <= 'i' \
419 || ((c) >= 'j' && (c) <= 'r') \
420 || (c) >= 's'))
421__UNDEFINED__ isUPPER(c) ( (c) >= 'A' && (c) <= 'Z' \
422 && ( (c) <= 'I' \
423 || ((c) >= 'J' && (c) <= 'R') \
424 || (c) >= 'S'))
425
426#else /* Above is EBCDIC; below is ASCII */
427
428# if { VERSION < 5.4.0 }
429/* The implementation of these in older perl versions can give wrong results if
430 * the C program locale is set to other than the C locale */
431# undef isALNUM
432# undef isALNUM_A
433# undef isALPHA
434# undef isALPHA_A
435# undef isDIGIT
436# undef isDIGIT_A
437# undef isIDFIRST
438# undef isIDFIRST_A
439# undef isLOWER
440# undef isLOWER_A
441# undef isUPPER
442# undef isUPPER_A
443# endif
444
d7412c0a 445# if { VERSION < 5.8.0 } /* earlier perls omitted DEL */
9dc2cc38
KW
446# undef isCNTRL
447# endif
448
449# if { VERSION < 5.10.0 }
d7412c0a
KW
450/* earlier perls included all of the isSPACE() characters, which is wrong. The
451 * version provided by Devel::PPPort always overrides an existing buggy
452 * version. */
9dc2cc38
KW
453# undef isPRINT
454# undef isPRINT_A
455# endif
456
457# if { VERSION < 5.14.0 }
d7412c0a 458/* earlier perls always returned true if the parameter was a signed char */
9dc2cc38
KW
459# undef isASCII
460# undef isASCII_A
461# endif
462
876aded1
KW
463# if { VERSION < 5.17.8 } /* earlier perls didn't include PILCROW, SECTION SIGN */
464# undef isPUNCT_L1
465# endif
466
467# if { VERSION < 5.13.7 } /* khw didn't investigate why this failed */
468# undef isALNUMC_L1
469#endif
470
d7412c0a 471# if { VERSION < 5.20.0 } /* earlier perls didn't include \v */
9dc2cc38
KW
472# undef isSPACE
473# undef isSPACE_A
876aded1 474# undef isSPACE_L1
e17f6823 475
9dc2cc38
KW
476# endif
477
b2049988
MHM
478__UNDEFINED__ isASCII(c) ((WIDEST_UTYPE) (c) <= 127)
479__UNDEFINED__ isCNTRL(c) ((WIDEST_UTYPE) (c) < ' ' || (c) == 127)
876aded1
KW
480__UNDEFINED__ isCNTRL_L1(c) (isCNTRL(c) || ( (WIDEST_UTYPE) (c) <= 0x9F \
481 && (WIDEST_UTYPE) (c) >= 0x80))
9dc2cc38
KW
482__UNDEFINED__ isLOWER(c) ((c) >= 'a' && (c) <= 'z')
483__UNDEFINED__ isUPPER(c) ((c) <= 'Z' && (c) >= 'A')
e17f6823 484
9dc2cc38
KW
485#endif /* Below are definitions common to EBCDIC and ASCII */
486
876aded1 487__UNDEFINED__ isASCII_L1(c) isASCII(c)
9dc2cc38
KW
488__UNDEFINED__ isALNUM(c) isWORDCHAR(c)
489__UNDEFINED__ isALNUMC(c) isALPHANUMERIC(c)
876aded1 490__UNDEFINED__ isALNUMC_L1(c) isALPHANUMERIC_L1(c)
9dc2cc38 491__UNDEFINED__ isALPHA(c) (isUPPER(c) || isLOWER(c))
876aded1 492__UNDEFINED__ isALPHA_L1(c) (isUPPER_L1(c) || isLOWER_L1(c))
9dc2cc38 493__UNDEFINED__ isALPHANUMERIC(c) (isALPHA(c) || isDIGIT(c))
876aded1 494__UNDEFINED__ isALPHANUMERIC_L1(c) (isALPHA_L1(c) || isDIGIT(c))
9dc2cc38 495__UNDEFINED__ isBLANK(c) ((c) == ' ' || (c) == '\t')
876aded1
KW
496__UNDEFINED__ isBLANK_L1(c) ( isBLANK(c) \
497 || ( (WIDEST_UTYPE) (c) < 256 \
498 && NATIVE_TO_LATIN1((U8) c) == 0xA0))
9dc2cc38 499__UNDEFINED__ isDIGIT(c) ((c) <= '9' && (c) >= '0')
876aded1 500__UNDEFINED__ isDIGIT_L1(c) isDIGIT(c)
9dc2cc38 501__UNDEFINED__ isGRAPH(c) (isWORDCHAR(c) || isPUNCT(c))
3e5aa72a
KW
502__UNDEFINED__ isGRAPH_L1(c) ( isPRINT_L1(c) \
503 && (c) != ' ' \
504 && NATIVE_TO_LATIN1((U8) c) != 0xA0)
9dc2cc38 505__UNDEFINED__ isIDCONT(c) isWORDCHAR(c)
876aded1 506__UNDEFINED__ isIDCONT_L1(c) isWORDCHAR_L1(c)
9dc2cc38 507__UNDEFINED__ isIDFIRST(c) (isALPHA(c) || (c) == '_')
876aded1
KW
508__UNDEFINED__ isIDFIRST_L1(c) (isALPHA_L1(c) || NATIVE_TO_LATIN1(c) == '_')
509__UNDEFINED__ isLOWER_L1(c) ( isLOWER(c) \
510 || ( (WIDEST_UTYPE) (c) < 256 \
511 && ( ( NATIVE_TO_LATIN1((U8) c) >= 0xDF \
512 && NATIVE_TO_LATIN1((U8) c) != 0xF7) \
513 || NATIVE_TO_LATIN1((U8) c) == 0xAA \
514 || NATIVE_TO_LATIN1((U8) c) == 0xBA \
515 || NATIVE_TO_LATIN1((U8) c) == 0xB5)))
9dc2cc38 516__UNDEFINED__ isOCTAL(c) (((WIDEST_UTYPE)((c)) & ~7) == '0')
876aded1 517__UNDEFINED__ isOCTAL_L1(c) isOCTAL(c)
9dc2cc38 518__UNDEFINED__ isPRINT(c) (isGRAPH(c) || (c) == ' ')
876aded1 519__UNDEFINED__ isPRINT_L1(c) ((WIDEST_UTYPE) (c) < 256 && ! isCNTRL_L1(c))
9dc2cc38 520__UNDEFINED__ isPSXSPC(c) isSPACE(c)
876aded1 521__UNDEFINED__ isPSXSPC_L1(c) isSPACE_L1(c)
e17f6823
KW
522__UNDEFINED__ isPUNCT(c) ( (c) == '-' || (c) == '!' || (c) == '"' \
523 || (c) == '#' || (c) == '$' || (c) == '%' \
524 || (c) == '&' || (c) == '\'' || (c) == '(' \
525 || (c) == ')' || (c) == '*' || (c) == '+' \
526 || (c) == ',' || (c) == '.' || (c) == '/' \
527 || (c) == ':' || (c) == ';' || (c) == '<' \
528 || (c) == '=' || (c) == '>' || (c) == '?' \
529 || (c) == '@' || (c) == '[' || (c) == '\\' \
530 || (c) == ']' || (c) == '^' || (c) == '_' \
531 || (c) == '`' || (c) == '{' || (c) == '|' \
9dc2cc38 532 || (c) == '}' || (c) == '~')
876aded1
KW
533__UNDEFINED__ isPUNCT_L1(c) ( isPUNCT(c) \
534 || ( (WIDEST_UTYPE) (c) < 256 \
535 && ( NATIVE_TO_LATIN1((U8) c) == 0xA1 \
536 || NATIVE_TO_LATIN1((U8) c) == 0xA7 \
537 || NATIVE_TO_LATIN1((U8) c) == 0xAB \
538 || NATIVE_TO_LATIN1((U8) c) == 0xB6 \
539 || NATIVE_TO_LATIN1((U8) c) == 0xB7 \
540 || NATIVE_TO_LATIN1((U8) c) == 0xBB \
541 || NATIVE_TO_LATIN1((U8) c) == 0xBF)))
e17f6823 542__UNDEFINED__ isSPACE(c) ( isBLANK(c) || (c) == '\n' || (c) == '\r' \
9dc2cc38 543 || (c) == '\v' || (c) == '\f')
876aded1
KW
544__UNDEFINED__ isSPACE_L1(c) ( isSPACE(c) \
545 || ( (WIDEST_UTYPE) (c) < 256 \
546 && ( NATIVE_TO_LATIN1((U8) c) == 0x85 \
547 || NATIVE_TO_LATIN1((U8) c) == 0xA0)))
548__UNDEFINED__ isUPPER_L1(c) ( isUPPER(c) \
549 || ( (WIDEST_UTYPE) (c) < 256 \
550 && ( NATIVE_TO_LATIN1((U8) c) >= 0xC0 \
551 && NATIVE_TO_LATIN1((U8) c) <= 0xDE \
552 && NATIVE_TO_LATIN1((U8) c) != 0xD7)))
9dc2cc38 553__UNDEFINED__ isWORDCHAR(c) (isALPHANUMERIC(c) || (c) == '_')
876aded1 554__UNDEFINED__ isWORDCHAR_L1(c) (isIDFIRST_L1(c) || isDIGIT(c))
e17f6823
KW
555__UNDEFINED__ isXDIGIT(c) ( isDIGIT(c) \
556 || ((c) >= 'a' && (c) <= 'f') \
9dc2cc38 557 || ((c) >= 'A' && (c) <= 'F'))
876aded1 558__UNDEFINED__ isXDIGIT_L1(c) isXDIGIT(c)
9dc2cc38 559
ef89c4f1
KW
560__UNDEFINED__ isALNUM_A(c) isALNUM(c)
561__UNDEFINED__ isALNUMC_A(c) isALNUMC(c)
562__UNDEFINED__ isALPHA_A(c) isALPHA(c)
563__UNDEFINED__ isALPHANUMERIC_A(c) isALPHANUMERIC(c)
564__UNDEFINED__ isASCII_A(c) isASCII(c)
565__UNDEFINED__ isBLANK_A(c) isBLANK(c)
566__UNDEFINED__ isCNTRL_A(c) isCNTRL(c)
567__UNDEFINED__ isDIGIT_A(c) isDIGIT(c)
568__UNDEFINED__ isGRAPH_A(c) isGRAPH(c)
569__UNDEFINED__ isIDCONT_A(c) isIDCONT(c)
570__UNDEFINED__ isIDFIRST_A(c) isIDFIRST(c)
571__UNDEFINED__ isLOWER_A(c) isLOWER(c)
572__UNDEFINED__ isOCTAL_A(c) isOCTAL(c)
573__UNDEFINED__ isPRINT_A(c) isPRINT(c)
574__UNDEFINED__ isPSXSPC_A(c) isPSXSPC(c)
575__UNDEFINED__ isPUNCT_A(c) isPUNCT(c)
576__UNDEFINED__ isSPACE_A(c) isSPACE(c)
577__UNDEFINED__ isUPPER_A(c) isUPPER(c)
578__UNDEFINED__ isWORDCHAR_A(c) isWORDCHAR(c)
579__UNDEFINED__ isXDIGIT_A(c) isXDIGIT(c)
db42c902 580
ea4b7f32
JH
581/* Until we figure out how to support this in older perls... */
582#if { VERSION >= 5.8.0 }
583
584__UNDEFINED__ HeUTF8(he) ((HeKLEN(he) == HEf_SVKEY) ? \
585 SvUTF8(HeKEY_sv(he)) : \
586 (U32)HeKUTF8(he))
587
588#endif
589
94e22bd6
MH
590__UNDEFINED__ C_ARRAY_LENGTH(a) (sizeof(a)/sizeof((a)[0]))
591__UNDEFINED__ C_ARRAY_END(a) ((a) + C_ARRAY_LENGTH(a))
592
72ec356a
KW
593__UNDEFINED__ LIKELY(x) (x)
594__UNDEFINED__ UNLIKELY(x) (x)
595
58329f0d
S
596#ifndef MUTABLE_PTR
597#if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
598# define MUTABLE_PTR(p) ({ void *_p = (p); _p; })
599#else
600# define MUTABLE_PTR(p) ((void *) (p))
601#endif
602#endif
603
604__UNDEFINED__ MUTABLE_SV(p) ((SV *)MUTABLE_PTR(p))
605
9132e1a3
MHM
606=xsmisc
607
8565c31a
MHM
608typedef XSPROTO(XSPROTO_test_t);
609typedef XSPROTO_test_t *XSPROTO_test_t_ptr;
610
9132e1a3
MHM
611XS(XS_Devel__PPPort_dXSTARG); /* prototype */
612XS(XS_Devel__PPPort_dXSTARG)
613{
614 dXSARGS;
615 dXSTARG;
2dd69576 616 IV iv;
e7368224
MH
617
618 PERL_UNUSED_VAR(cv);
9132e1a3 619 SP -= items;
2dd69576 620 iv = SvIV(ST(0)) + 1;
9132e1a3
MHM
621 PUSHi(iv);
622 XSRETURN(1);
623}
624
0d0f8426
MHM
625XS(XS_Devel__PPPort_dAXMARK); /* prototype */
626XS(XS_Devel__PPPort_dAXMARK)
627{
628 dSP;
629 dAXMARK;
630 dITEMS;
631 IV iv;
e7368224
MH
632
633 PERL_UNUSED_VAR(cv);
0d0f8426
MHM
634 SP -= items;
635 iv = SvIV(ST(0)) - 1;
c1a049cb 636 mPUSHi(iv);
0d0f8426
MHM
637 XSRETURN(1);
638}
639
9132e1a3
MHM
640=xsboot
641
8565c31a
MHM
642{
643 XSPROTO_test_t_ptr p = &XS_Devel__PPPort_dXSTARG;
644 newXS("Devel::PPPort::dXSTARG", *p, file);
645}
0d0f8426 646newXS("Devel::PPPort::dAXMARK", XS_Devel__PPPort_dAXMARK, file);
9132e1a3 647
adfe19db
MHM
648=xsubs
649
650int
94e22bd6
MH
651OpSIBLING_tests()
652 PREINIT:
653 OP *x;
654 OP *kid;
65d1a6da 655 OP *middlekid;
94e22bd6
MH
656 OP *lastkid;
657 int count = 0;
658 int failures = 0;
659 int i;
660 CODE:
661 x = newOP(OP_PUSHMARK, 0);
662
663 /* No siblings yet! */
664 if (OpHAS_SIBLING(x) || OpSIBLING(x)) {
665 failures++; warn("Op should not have had a sib");
666 }
667
668
669 /* Add 2 siblings */
670 kid = x;
671
672 for (i = 0; i < 2; i++) {
673 OP *newsib = newOP(OP_PUSHMARK, 0);
674 OpMORESIB_set(kid, newsib);
675
676 kid = OpSIBLING(kid);
677 lastkid = kid;
678 }
65d1a6da 679 middlekid = OpSIBLING(x);
94e22bd6
MH
680
681 /* Should now have a sibling */
682 if (! OpHAS_SIBLING(x) || ! OpSIBLING(x) ) {
683 failures++; warn("Op should have had a sib after moresib_set");
684 }
685
686 /* Count the siblings */
687 for (kid = OpSIBLING(x); kid; kid = OpSIBLING(kid)) {
688 count++;
689 }
690
691 if (count != 2) {
692 failures++; warn("Kid had %d sibs, expected 2", count);
693 }
694
695 if (OpHAS_SIBLING(lastkid) || OpSIBLING(lastkid)) {
696 failures++; warn("Last kid should not have a sib");
697 }
698
699 /* Really sets the parent, and says 'no more siblings' */
700 OpLASTSIB_set(x, lastkid);
701
702 if (OpHAS_SIBLING(x) || OpSIBLING(x)) {
703 failures++; warn("OpLASTSIB_set failed?");
704 }
705
706 /* Restore the kid */
707 OpMORESIB_set(x, lastkid);
708
709 /* Try to remove it again */
710 OpLASTSIB_set(x, NULL);
711
712 if (OpHAS_SIBLING(x) || OpSIBLING(x)) {
713 failures++; warn("OpLASTSIB_set with NULL failed?");
714 }
715
716 /* Try to restore with maybesib_set */
717 OpMAYBESIB_set(x, lastkid, NULL);
718
719 if (! OpHAS_SIBLING(x) || ! OpSIBLING(x) ) {
720 failures++; warn("Op should have had a sib after maybesibset");
721 }
722
65d1a6da
DM
723 op_free(lastkid);
724 op_free(middlekid);
725 op_free(x);
94e22bd6
MH
726 RETVAL = failures;
727 OUTPUT:
728 RETVAL
729
730int
731SvRXOK(sv)
732 SV *sv
733 CODE:
734 RETVAL = SvRXOK(sv);
735 OUTPUT:
736 RETVAL
737
738int
7bb03b24 739ptrtests()
b2049988
MHM
740 PREINIT:
741 int var, *p = &var;
7bb03b24 742
b2049988
MHM
743 CODE:
744 RETVAL = 0;
745 RETVAL += PTR2nat(p) != 0 ? 1 : 0;
746 RETVAL += PTR2ul(p) != 0UL ? 2 : 0;
747 RETVAL += PTR2UV(p) != (UV) 0 ? 4 : 0;
748 RETVAL += PTR2IV(p) != (IV) 0 ? 8 : 0;
749 RETVAL += PTR2NV(p) != (NV) 0 ? 16 : 0;
750 RETVAL += p > NUM2PTR(int *, 0) ? 32 : 0;
7bb03b24 751
b2049988
MHM
752 OUTPUT:
753 RETVAL
7bb03b24
MHM
754
755int
adfe19db 756gv_stashpvn(name, create)
b2049988
MHM
757 char *name
758 I32 create
759 CODE:
760 RETVAL = gv_stashpvn(name, strlen(name), create) != NULL;
761 OUTPUT:
762 RETVAL
adfe19db
MHM
763
764int
765get_sv(name, create)
b2049988
MHM
766 char *name
767 I32 create
768 CODE:
769 RETVAL = get_sv(name, create) != NULL;
770 OUTPUT:
771 RETVAL
adfe19db
MHM
772
773int
774get_av(name, create)
b2049988
MHM
775 char *name
776 I32 create
777 CODE:
778 RETVAL = get_av(name, create) != NULL;
779 OUTPUT:
780 RETVAL
adfe19db
MHM
781
782int
783get_hv(name, create)
b2049988
MHM
784 char *name
785 I32 create
786 CODE:
787 RETVAL = get_hv(name, create) != NULL;
788 OUTPUT:
789 RETVAL
adfe19db
MHM
790
791int
792get_cv(name, create)
b2049988
MHM
793 char *name
794 I32 create
795 CODE:
796 RETVAL = get_cv(name, create) != NULL;
797 OUTPUT:
798 RETVAL
adfe19db
MHM
799
800void
0d0f8426 801xsreturn(two)
b2049988
MHM
802 int two
803 PPCODE:
804 mXPUSHp("test1", 5);
805 if (two)
806 mXPUSHp("test2", 5);
807 if (two)
808 XSRETURN(2);
809 else
810 XSRETURN(1);
0d0f8426 811
adfe19db
MHM
812SV*
813boolSV(value)
b2049988
MHM
814 int value
815 CODE:
816 RETVAL = newSVsv(boolSV(value));
817 OUTPUT:
818 RETVAL
adfe19db
MHM
819
820SV*
821DEFSV()
b2049988
MHM
822 CODE:
823 RETVAL = newSVsv(DEFSV);
824 OUTPUT:
825 RETVAL
adfe19db 826
51d6c659
MHM
827void
828DEFSV_modify()
b2049988
MHM
829 PPCODE:
830 XPUSHs(sv_mortalcopy(DEFSV));
831 ENTER;
832 SAVE_DEFSV;
833 DEFSV_set(newSVpvs("DEFSV"));
834 XPUSHs(sv_mortalcopy(DEFSV));
835 /* Yes, this leaks the above scalar; 5.005 with threads for some reason */
836 /* frees it upon LEAVE, thus mortalizing it causes "attempt to free..." */
837 /* sv_2mortal(DEFSV); */
838 LEAVE;
839 XPUSHs(sv_mortalcopy(DEFSV));
840 XSRETURN(3);
51d6c659 841
adfe19db
MHM
842int
843ERRSV()
b2049988 844 CODE:
f1305528 845 RETVAL = SvTRUEx(ERRSV);
b2049988
MHM
846 OUTPUT:
847 RETVAL
adfe19db
MHM
848
849SV*
850UNDERBAR()
b2049988
MHM
851 CODE:
852 {
853 dUNDERBAR;
854 RETVAL = newSVsv(UNDERBAR);
855 }
856 OUTPUT:
857 RETVAL
adfe19db 858
0d0f8426
MHM
859void
860prepush()
b2049988
MHM
861 CODE:
862 {
863 dXSTARG;
864 XSprePUSH;
865 PUSHi(42);
866 XSRETURN(1);
867 }
0d0f8426 868
f2ab5a41
MHM
869int
870PERL_ABS(a)
b2049988 871 int a
f2ab5a41
MHM
872
873void
874SVf(x)
b2049988
MHM
875 SV *x
876 PPCODE:
f2ab5a41 877#if { VERSION >= 5.004 }
71d5fd3c 878 x = sv_2mortal(newSVpvf("[%" SVf "]", SVfARG(x)));
f2ab5a41 879#endif
b2049988
MHM
880 XPUSHs(x);
881 XSRETURN(1);
f2ab5a41 882
fd7af155
MHM
883void
884Perl_ppaddr_t(string)
b2049988
MHM
885 char *string
886 PREINIT:
887 Perl_ppaddr_t lower;
888 PPCODE:
889 lower = PL_ppaddr[OP_LC];
890 mXPUSHs(newSVpv(string, 0));
891 PUTBACK;
892 ENTER;
893 (void)*(lower)(aTHXR);
894 SPAGAIN;
895 LEAVE;
896 XSRETURN(1);
fd7af155 897
ea4b7f32
JH
898#if { VERSION >= 5.8.0 }
899
900void
901check_HeUTF8(utf8_key)
902 SV *utf8_key;
903 PREINIT:
904 HV *hash;
905 HE *ent;
906 STRLEN klen;
907 char *key;
908 PPCODE:
909 hash = newHV();
910
911 key = SvPV(utf8_key, klen);
912 if (SvUTF8(utf8_key)) klen *= -1;
913 hv_store(hash, key, klen, newSVpvs("string"), 0);
914 hv_iterinit(hash);
915 ent = hv_iternext(hash);
94e22bd6
MH
916 assert(ent);
917 mXPUSHp((HeUTF8(ent) == 0 ? "norm" : "utf8"), 4);
ea4b7f32
JH
918 hv_undef(hash);
919
920
921#endif
922
94e22bd6
MH
923void
924check_c_array()
925 PREINIT:
926 int x[] = { 10, 11, 12, 13 };
927 PPCODE:
928 mXPUSHi(C_ARRAY_LENGTH(x)); /* 4 */
929 mXPUSHi(*(C_ARRAY_END(x)-1)); /* 13 */
930
9dc2cc38 931bool
db834d60 932isBLANK(ord)
9aa6a863 933 UV ord
9dc2cc38
KW
934 CODE:
935 RETVAL = isBLANK(ord);
936 OUTPUT:
937 RETVAL
938
939bool
db834d60 940isBLANK_A(ord)
9aa6a863 941 UV ord
9dc2cc38
KW
942 CODE:
943 RETVAL = isBLANK_A(ord);
944 OUTPUT:
945 RETVAL
946
947bool
876aded1
KW
948isBLANK_L1(ord)
949 UV ord
950 CODE:
951 RETVAL = isBLANK_L1(ord);
952 OUTPUT:
953 RETVAL
954
955bool
db834d60 956isUPPER(ord)
9aa6a863 957 UV ord
9dc2cc38
KW
958 CODE:
959 RETVAL = isUPPER(ord);
960 OUTPUT:
961 RETVAL
962
963bool
db834d60 964isUPPER_A(ord)
9aa6a863 965 UV ord
9dc2cc38
KW
966 CODE:
967 RETVAL = isUPPER_A(ord);
968 OUTPUT:
969 RETVAL
970
971bool
876aded1
KW
972isUPPER_L1(ord)
973 UV ord
974 CODE:
975 RETVAL = isUPPER_L1(ord);
976 OUTPUT:
977 RETVAL
978
979bool
db834d60 980isLOWER(ord)
9aa6a863 981 UV ord
9dc2cc38
KW
982 CODE:
983 RETVAL = isLOWER(ord);
984 OUTPUT:
985 RETVAL
986
987bool
db834d60 988isLOWER_A(ord)
9aa6a863 989 UV ord
9dc2cc38
KW
990 CODE:
991 RETVAL = isLOWER_A(ord);
992 OUTPUT:
993 RETVAL
994
995bool
876aded1
KW
996isLOWER_L1(ord)
997 UV ord
998 CODE:
999 RETVAL = isLOWER_L1(ord);
1000 OUTPUT:
1001 RETVAL
1002
1003bool
db834d60 1004isALPHA(ord)
9aa6a863 1005 UV ord
9dc2cc38
KW
1006 CODE:
1007 RETVAL = isALPHA(ord);
1008 OUTPUT:
1009 RETVAL
1010
1011bool
db834d60 1012isALPHA_A(ord)
9aa6a863 1013 UV ord
9dc2cc38
KW
1014 CODE:
1015 RETVAL = isALPHA_A(ord);
1016 OUTPUT:
1017 RETVAL
1018
1019bool
876aded1
KW
1020isALPHA_L1(ord)
1021 UV ord
1022 CODE:
1023 RETVAL = isALPHA_L1(ord);
1024 OUTPUT:
1025 RETVAL
1026
1027bool
db834d60 1028isWORDCHAR(ord)
9aa6a863 1029 UV ord
9dc2cc38
KW
1030 CODE:
1031 RETVAL = isWORDCHAR(ord);
1032 OUTPUT:
1033 RETVAL
1034
1035bool
db834d60 1036isWORDCHAR_A(ord)
9aa6a863 1037 UV ord
9dc2cc38
KW
1038 CODE:
1039 RETVAL = isWORDCHAR_A(ord);
1040 OUTPUT:
1041 RETVAL
1042
1043bool
876aded1
KW
1044isWORDCHAR_L1(ord)
1045 UV ord
1046 CODE:
1047 RETVAL = isWORDCHAR_L1(ord);
1048 OUTPUT:
1049 RETVAL
1050
1051bool
db834d60 1052isALPHANUMERIC(ord)
9aa6a863 1053 UV ord
9dc2cc38
KW
1054 CODE:
1055 RETVAL = isALPHANUMERIC(ord);
1056 OUTPUT:
1057 RETVAL
1058
1059bool
db834d60 1060isALPHANUMERIC_A(ord)
9aa6a863 1061 UV ord
9dc2cc38
KW
1062 CODE:
1063 RETVAL = isALPHANUMERIC_A(ord);
1064 OUTPUT:
1065 RETVAL
1066
1067bool
db834d60 1068isALNUM(ord)
9aa6a863 1069 UV ord
9dc2cc38
KW
1070 CODE:
1071 RETVAL = isALNUM(ord);
1072 OUTPUT:
1073 RETVAL
1074
1075bool
db834d60 1076isALNUM_A(ord)
9aa6a863 1077 UV ord
9dc2cc38
KW
1078 CODE:
1079 RETVAL = isALNUM_A(ord);
1080 OUTPUT:
1081 RETVAL
1082
1083bool
db834d60 1084isDIGIT(ord)
9aa6a863 1085 UV ord
9dc2cc38
KW
1086 CODE:
1087 RETVAL = isDIGIT(ord);
1088 OUTPUT:
1089 RETVAL
1090
1091bool
db834d60 1092isDIGIT_A(ord)
9aa6a863 1093 UV ord
9dc2cc38
KW
1094 CODE:
1095 RETVAL = isDIGIT_A(ord);
1096 OUTPUT:
1097 RETVAL
1098
1099bool
db834d60 1100isOCTAL(ord)
9aa6a863 1101 UV ord
9dc2cc38
KW
1102 CODE:
1103 RETVAL = isOCTAL(ord);
1104 OUTPUT:
1105 RETVAL
1106
1107bool
db834d60 1108isOCTAL_A(ord)
9aa6a863 1109 UV ord
9dc2cc38
KW
1110 CODE:
1111 RETVAL = isOCTAL_A(ord);
1112 OUTPUT:
1113 RETVAL
1114
1115bool
db834d60 1116isIDFIRST(ord)
9aa6a863 1117 UV ord
9dc2cc38
KW
1118 CODE:
1119 RETVAL = isIDFIRST(ord);
1120 OUTPUT:
1121 RETVAL
1122
1123bool
db834d60 1124isIDFIRST_A(ord)
9aa6a863 1125 UV ord
9dc2cc38
KW
1126 CODE:
1127 RETVAL = isIDFIRST_A(ord);
1128 OUTPUT:
1129 RETVAL
1130
1131bool
db834d60 1132isIDCONT(ord)
9aa6a863 1133 UV ord
9dc2cc38
KW
1134 CODE:
1135 RETVAL = isIDCONT(ord);
1136 OUTPUT:
1137 RETVAL
1138
1139bool
db834d60 1140isIDCONT_A(ord)
9aa6a863 1141 UV ord
9dc2cc38
KW
1142 CODE:
1143 RETVAL = isIDCONT_A(ord);
1144 OUTPUT:
1145 RETVAL
1146
1147bool
db834d60 1148isSPACE(ord)
9aa6a863 1149 UV ord
9dc2cc38
KW
1150 CODE:
1151 RETVAL = isSPACE(ord);
1152 OUTPUT:
1153 RETVAL
1154
1155bool
db834d60 1156isSPACE_A(ord)
9aa6a863 1157 UV ord
9dc2cc38
KW
1158 CODE:
1159 RETVAL = isSPACE_A(ord);
1160 OUTPUT:
1161 RETVAL
1162
1163bool
db834d60 1164isASCII(ord)
9aa6a863 1165 UV ord
9dc2cc38
KW
1166 CODE:
1167 RETVAL = isASCII(ord);
1168 OUTPUT:
1169 RETVAL
1170
1171bool
db834d60 1172isASCII_A(ord)
9aa6a863 1173 UV ord
9dc2cc38
KW
1174 CODE:
1175 RETVAL = isASCII_A(ord);
1176 OUTPUT:
1177 RETVAL
1178
1179bool
db834d60 1180isCNTRL(ord)
9aa6a863 1181 UV ord
9dc2cc38
KW
1182 CODE:
1183 RETVAL = isCNTRL(ord);
1184 OUTPUT:
1185 RETVAL
1186
1187bool
db834d60 1188isCNTRL_A(ord)
9aa6a863 1189 UV ord
9dc2cc38
KW
1190 CODE:
1191 RETVAL = isCNTRL_A(ord);
1192 OUTPUT:
1193 RETVAL
1194
1195bool
db834d60 1196isPRINT(ord)
9aa6a863 1197 UV ord
9dc2cc38
KW
1198 CODE:
1199 RETVAL = isPRINT(ord);
1200 OUTPUT:
1201 RETVAL
1202
1203bool
db834d60 1204isPRINT_A(ord)
9aa6a863 1205 UV ord
9dc2cc38
KW
1206 CODE:
1207 RETVAL = isPRINT_A(ord);
1208 OUTPUT:
1209 RETVAL
1210
1211bool
db834d60 1212isGRAPH(ord)
9aa6a863 1213 UV ord
9dc2cc38
KW
1214 CODE:
1215 RETVAL = isGRAPH(ord);
1216 OUTPUT:
1217 RETVAL
1218
1219bool
db834d60 1220isGRAPH_A(ord)
9aa6a863 1221 UV ord
9dc2cc38
KW
1222 CODE:
1223 RETVAL = isGRAPH_A(ord);
1224 OUTPUT:
1225 RETVAL
1226
1227bool
db834d60 1228isPUNCT(ord)
9aa6a863 1229 UV ord
9dc2cc38
KW
1230 CODE:
1231 RETVAL = isPUNCT(ord);
1232 OUTPUT:
1233 RETVAL
1234
1235bool
db834d60 1236isPUNCT_A(ord)
9aa6a863 1237 UV ord
9dc2cc38
KW
1238 CODE:
1239 RETVAL = isPUNCT_A(ord);
1240 OUTPUT:
1241 RETVAL
1242
1243bool
db834d60 1244isXDIGIT(ord)
9aa6a863 1245 UV ord
9dc2cc38
KW
1246 CODE:
1247 RETVAL = isXDIGIT(ord);
1248 OUTPUT:
1249 RETVAL
1250
1251bool
db834d60 1252isXDIGIT_A(ord)
9aa6a863 1253 UV ord
9dc2cc38
KW
1254 CODE:
1255 RETVAL = isXDIGIT_A(ord);
1256 OUTPUT:
1257 RETVAL
1258
1259bool
db834d60 1260isPSXSPC(ord)
9aa6a863 1261 UV ord
9dc2cc38
KW
1262 CODE:
1263 RETVAL = isPSXSPC(ord);
1264 OUTPUT:
1265 RETVAL
1266
1267bool
db834d60 1268isPSXSPC_A(ord)
9aa6a863 1269 UV ord
9dc2cc38
KW
1270 CODE:
1271 RETVAL = isPSXSPC_A(ord);
1272 OUTPUT:
1273 RETVAL
1274
876aded1
KW
1275bool
1276isALPHANUMERIC_L1(ord)
1277 UV ord
1278 CODE:
1279 RETVAL = isALPHANUMERIC_L1(ord);
1280 OUTPUT:
1281 RETVAL
1282
1283bool
1284isALNUMC_L1(ord)
1285 UV ord
1286 CODE:
1287 RETVAL = isALNUMC_L1(ord);
1288 OUTPUT:
1289 RETVAL
1290
1291bool
1292isDIGIT_L1(ord)
1293 UV ord
1294 CODE:
1295 RETVAL = isDIGIT_L1(ord);
1296 OUTPUT:
1297 RETVAL
1298
1299bool
1300isOCTAL_L1(ord)
1301 UV ord
1302 CODE:
1303 RETVAL = isOCTAL_L1(ord);
1304 OUTPUT:
1305 RETVAL
1306
1307bool
1308isIDFIRST_L1(ord)
1309 UV ord
1310 CODE:
1311 RETVAL = isIDFIRST_L1(ord);
1312 OUTPUT:
1313 RETVAL
1314
1315bool
1316isIDCONT_L1(ord)
1317 UV ord
1318 CODE:
1319 RETVAL = isIDCONT_L1(ord);
1320 OUTPUT:
1321 RETVAL
1322
1323bool
1324isSPACE_L1(ord)
1325 UV ord
1326 CODE:
1327 RETVAL = isSPACE_L1(ord);
1328 OUTPUT:
1329 RETVAL
1330
1331bool
1332isASCII_L1(ord)
1333 UV ord
1334 CODE:
1335 RETVAL = isASCII_L1(ord);
1336 OUTPUT:
1337 RETVAL
1338
1339bool
1340isCNTRL_L1(ord)
1341 UV ord
1342 CODE:
1343 RETVAL = isCNTRL_L1(ord);
1344 OUTPUT:
1345 RETVAL
1346
1347bool
1348isPRINT_L1(ord)
1349 UV ord
1350 CODE:
1351 RETVAL = isPRINT_L1(ord);
1352 OUTPUT:
1353 RETVAL
1354
1355bool
1356isGRAPH_L1(ord)
1357 UV ord
1358 CODE:
1359 RETVAL = isGRAPH_L1(ord);
1360 OUTPUT:
1361 RETVAL
1362
1363bool
1364isPUNCT_L1(ord)
1365 UV ord
1366 CODE:
1367 RETVAL = isPUNCT_L1(ord);
1368 OUTPUT:
1369 RETVAL
1370
1371bool
1372isXDIGIT_L1(ord)
1373 UV ord
1374 CODE:
1375 RETVAL = isXDIGIT_L1(ord);
1376 OUTPUT:
1377 RETVAL
1378
1379bool
1380isPSXSPC_L1(ord)
1381 UV ord
1382 CODE:
1383 RETVAL = isPSXSPC_L1(ord);
1384 OUTPUT:
1385 RETVAL
1386
92c5e9fa
KW
1387UV
1388LATIN1_TO_NATIVE(cp)
1389 UV cp
1390 CODE:
1391 if (cp > 255) RETVAL= cp;
1392 else RETVAL= LATIN1_TO_NATIVE(cp);
1393 OUTPUT:
1394 RETVAL
1395
1396UV
1397NATIVE_TO_LATIN1(cp)
1398 UV cp
1399 CODE:
1400 RETVAL= NATIVE_TO_LATIN1(cp);
1401 OUTPUT:
1402 RETVAL
1403
1eff2a3b
KW
1404STRLEN
1405av_tindex(av)
9aa6a863 1406 SV *av
1eff2a3b 1407 CODE:
9aa6a863 1408 RETVAL = av_tindex((AV*)SvRV(av));
1eff2a3b
KW
1409 OUTPUT:
1410 RETVAL
1411
1412STRLEN
1413av_top_index(av)
9aa6a863 1414 SV *av
1eff2a3b 1415 CODE:
9aa6a863 1416 RETVAL = av_top_index((AV*)SvRV(av));
1eff2a3b
KW
1417 OUTPUT:
1418 RETVAL
1419
92c5e9fa 1420=tests plan => 183
adfe19db
MHM
1421
1422use vars qw($my_sv @my_av %my_hv);
1423
adfe19db
MHM
1424ok(&Devel::PPPort::boolSV(1));
1425ok(!&Devel::PPPort::boolSV(0));
1426
1427$_ = "Fred";
1428ok(&Devel::PPPort::DEFSV(), "Fred");
1429ok(&Devel::PPPort::UNDERBAR(), "Fred");
1430
f551177d 1431if ("$]" >= 5.009002 && "$]" < 5.023 && "$]" < 5.023004) {
0d0f8426 1432 eval q{
b2049988 1433 no warnings "deprecated";
e5b2cbd0 1434 no if $^V > v5.17.9, warnings => "experimental::lexical_topic";
0d0f8426
MHM
1435 my $_ = "Tony";
1436 ok(&Devel::PPPort::DEFSV(), "Fred");
1437 ok(&Devel::PPPort::UNDERBAR(), "Tony");
1438 };
1439}
1440else {
1441 ok(1);
1442 ok(1);
1443}
1444
51d6c659
MHM
1445my @r = &Devel::PPPort::DEFSV_modify();
1446
1447ok(@r == 3);
1448ok($r[0], 'Fred');
1449ok($r[1], 'DEFSV');
1450ok($r[2], 'Fred');
1451
1452ok(&Devel::PPPort::DEFSV(), "Fred");
1453
adfe19db
MHM
1454eval { 1 };
1455ok(!&Devel::PPPort::ERRSV());
1456eval { cannot_call_this_one() };
1457ok(&Devel::PPPort::ERRSV());
1458
1459ok(&Devel::PPPort::gv_stashpvn('Devel::PPPort', 0));
1460ok(!&Devel::PPPort::gv_stashpvn('does::not::exist', 0));
1461ok(&Devel::PPPort::gv_stashpvn('does::not::exist', 1));
1462
1463$my_sv = 1;
1464ok(&Devel::PPPort::get_sv('my_sv', 0));
1465ok(!&Devel::PPPort::get_sv('not_my_sv', 0));
1466ok(&Devel::PPPort::get_sv('not_my_sv', 1));
1467
1468@my_av = (1);
1469ok(&Devel::PPPort::get_av('my_av', 0));
1470ok(!&Devel::PPPort::get_av('not_my_av', 0));
1471ok(&Devel::PPPort::get_av('not_my_av', 1));
1472
1473%my_hv = (a=>1);
1474ok(&Devel::PPPort::get_hv('my_hv', 0));
1475ok(!&Devel::PPPort::get_hv('not_my_hv', 0));
1476ok(&Devel::PPPort::get_hv('not_my_hv', 1));
1477
1478sub my_cv { 1 };
1479ok(&Devel::PPPort::get_cv('my_cv', 0));
1480ok(!&Devel::PPPort::get_cv('not_my_cv', 0));
1481ok(&Devel::PPPort::get_cv('not_my_cv', 1));
1482
9132e1a3 1483ok(Devel::PPPort::dXSTARG(42), 43);
0d0f8426
MHM
1484ok(Devel::PPPort::dAXMARK(4711), 4710);
1485
1486ok(Devel::PPPort::prepush(), 42);
9132e1a3 1487
0d0f8426
MHM
1488ok(join(':', Devel::PPPort::xsreturn(0)), 'test1');
1489ok(join(':', Devel::PPPort::xsreturn(1)), 'test1:test2');
f2ab5a41
MHM
1490
1491ok(Devel::PPPort::PERL_ABS(42), 42);
1492ok(Devel::PPPort::PERL_ABS(-13), 13);
1493
f551177d
S
1494ok(Devel::PPPort::SVf(42), "$]" >= 5.004 ? '[42]' : '42');
1495ok(Devel::PPPort::SVf('abc'), "$]" >= 5.004 ? '[abc]' : 'abc');
f2ab5a41 1496
fd7af155
MHM
1497ok(&Devel::PPPort::Perl_ppaddr_t("FOO"), "foo");
1498
7bb03b24 1499ok(&Devel::PPPort::ptrtests(), 63);
ea4b7f32 1500
94e22bd6
MH
1501ok(&Devel::PPPort::OpSIBLING_tests(), 0);
1502
f551177d 1503if ("$]" >= 5.009000) {
ea4b7f32
JH
1504 eval q{
1505 ok(&Devel::PPPort::check_HeUTF8("hello"), "norm");
1506 ok(&Devel::PPPort::check_HeUTF8("\N{U+263a}"), "utf8");
1507 };
1508} else {
1509 ok(1, 1);
1510 ok(1, 1);
1511}
94e22bd6
MH
1512
1513@r = &Devel::PPPort::check_c_array();
1514ok($r[0], 4);
1515ok($r[1], "13");
1516
1517ok(!Devel::PPPort::SvRXOK(""));
1518ok(!Devel::PPPort::SvRXOK(bless [], "Regexp"));
1519
f551177d 1520if ("$]" < 5.005) {
94e22bd6
MH
1521 skip 'no qr// objects in this perl', 0;
1522 skip 'no qr// objects in this perl', 0;
1523} else {
1524 my $qr = eval 'qr/./';
1525 ok(Devel::PPPort::SvRXOK($qr));
1526 ok(Devel::PPPort::SvRXOK(bless $qr, "Surprise"));
1527}
9dc2cc38 1528
db834d60
KW
1529ok( Devel::PPPort::isBLANK(ord(" ")));
1530ok(! Devel::PPPort::isBLANK(ord("\n")));
9dc2cc38 1531
db834d60
KW
1532ok( Devel::PPPort::isBLANK_A(ord("\t")));
1533ok(! Devel::PPPort::isBLANK_A(ord("\r")));
9dc2cc38 1534
876aded1
KW
1535ok( Devel::PPPort::isBLANK_L1(ord("\t")));
1536ok(! Devel::PPPort::isBLANK_L1(ord("\r")));
1537
db834d60
KW
1538ok( Devel::PPPort::isUPPER(ord("A")));
1539ok(! Devel::PPPort::isUPPER(ord("a")));
9dc2cc38 1540
db834d60 1541ok( Devel::PPPort::isUPPER_A(ord("Z")));
9dc2cc38
KW
1542
1543# One of these two is uppercase in EBCDIC; the other in Latin1, but neither are
1544# ASCII uppercase.
ffafe9b2
KW
1545ok(! Devel::PPPort::isUPPER_A(0xDC));
1546ok(! Devel::PPPort::isUPPER_A(0xFC));
9dc2cc38 1547
876aded1
KW
1548ok(Devel::PPPort::isUPPER_L1(0xDC) || Devel::PPPort::isUPPER_L1(0xFC));
1549ok(! (Devel::PPPort::isUPPER_L1(0xDC) && Devel::PPPort::isUPPER_L1(0xFC)));
1550
db834d60
KW
1551ok( Devel::PPPort::isLOWER(ord("b")));
1552ok(! Devel::PPPort::isLOWER(ord("B")));
9dc2cc38 1553
db834d60 1554ok( Devel::PPPort::isLOWER_A(ord("y")));
9dc2cc38
KW
1555
1556# One of these two is lowercase in EBCDIC; the other in Latin1, but neither are
1557# ASCII lowercase.
ffafe9b2
KW
1558ok(! Devel::PPPort::isLOWER_A(0xDC));
1559ok(! Devel::PPPort::isLOWER_A(0xFC));
9dc2cc38 1560
876aded1
KW
1561ok(Devel::PPPort::isLOWER_L1(0xDC) || Devel::PPPort::isLOWER_L1(0xFC));
1562ok(! Devel::PPPort::isLOWER_L1(0xDC) && Devel::PPPort::isLOWER_L1(0xFC));
1563
db834d60
KW
1564ok( Devel::PPPort::isALPHA(ord("C")));
1565ok(! Devel::PPPort::isALPHA(ord("1")));
9dc2cc38 1566
db834d60
KW
1567ok( Devel::PPPort::isALPHA_A(ord("x")));
1568ok(! Devel::PPPort::isALPHA_A(0xDC));
9dc2cc38 1569
876aded1
KW
1570ok( Devel::PPPort::isALPHA_L1(ord("y")));
1571ok( Devel::PPPort::isALPHA_L1(0xDC));
1572ok(! Devel::PPPort::isALPHA_L1(0xB6));
1573
db834d60
KW
1574ok( Devel::PPPort::isWORDCHAR(ord("_")));
1575ok(! Devel::PPPort::isWORDCHAR(ord("@")));
9dc2cc38 1576
db834d60
KW
1577ok( Devel::PPPort::isWORDCHAR_A(ord("2")));
1578ok(! Devel::PPPort::isWORDCHAR_A(0xFC));
9dc2cc38 1579
876aded1
KW
1580ok( Devel::PPPort::isWORDCHAR_L1(ord("2")));
1581ok( Devel::PPPort::isWORDCHAR_L1(0xFC));
1582ok(! Devel::PPPort::isWORDCHAR_L1(0xB6));
1583
db834d60
KW
1584ok( Devel::PPPort::isALPHANUMERIC(ord("4")));
1585ok(! Devel::PPPort::isALPHANUMERIC(ord("_")));
9dc2cc38 1586
92c5e9fa
KW
1587ok( Devel::PPPort::NATIVE_TO_LATIN1(0xB6) == 0xB6);
1588ok( Devel::PPPort::NATIVE_TO_LATIN1(0x1) == 0x1);
1589ok( Devel::PPPort::NATIVE_TO_LATIN1(ord("A")) == 0x41);
1590ok( Devel::PPPort::NATIVE_TO_LATIN1(ord("0")) == 0x30);
1591
db834d60
KW
1592ok( Devel::PPPort::isALPHANUMERIC_A(ord("l")));
1593ok(! Devel::PPPort::isALPHANUMERIC_A(0xDC));
9dc2cc38 1594
876aded1
KW
1595ok( Devel::PPPort::isALPHANUMERIC_L1(ord("l")));
1596ok( Devel::PPPort::isALPHANUMERIC_L1(0xDC));
1597ok(! Devel::PPPort::isALPHANUMERIC_L1(0xB6));
1598
db834d60
KW
1599ok( Devel::PPPort::isALNUM(ord("c")));
1600ok(! Devel::PPPort::isALNUM(ord("}")));
9dc2cc38 1601
db834d60
KW
1602ok( Devel::PPPort::isALNUM_A(ord("5")));
1603ok(! Devel::PPPort::isALNUM_A(0xFC));
9dc2cc38 1604
92c5e9fa
KW
1605ok( Devel::PPPort::LATIN1_TO_NATIVE(0xB6) == 0xB6);
1606if (ord("A") == 65) {
1607 ok( Devel::PPPort::LATIN1_TO_NATIVE(0x41) == 0x41);
1608 ok( Devel::PPPort::LATIN1_TO_NATIVE(0x30) == 0x30);
1609}
1610else {
1611 ok( Devel::PPPort::LATIN1_TO_NATIVE(0x41) == 0xC1);
1612 ok( Devel::PPPort::LATIN1_TO_NATIVE(0x30) == 0xF0);
1613}
1614
876aded1
KW
1615ok( Devel::PPPort::isALNUMC_L1(ord("5")));
1616ok( Devel::PPPort::isALNUMC_L1(0xFC));
1617ok(! Devel::PPPort::isALNUMC_L1(0xB6));
1618
db834d60
KW
1619ok( Devel::PPPort::isDIGIT(ord("6")));
1620ok(! Devel::PPPort::isDIGIT(ord("_")));
9dc2cc38 1621
db834d60
KW
1622ok( Devel::PPPort::isDIGIT_A(ord("7")));
1623ok(! Devel::PPPort::isDIGIT_A(0xDC));
9dc2cc38 1624
876aded1
KW
1625ok( Devel::PPPort::isDIGIT_L1(ord("5")));
1626ok(! Devel::PPPort::isDIGIT_L1(0xDC));
1627
db834d60
KW
1628ok( Devel::PPPort::isOCTAL(ord("7")));
1629ok(! Devel::PPPort::isOCTAL(ord("8")));
9dc2cc38 1630
db834d60
KW
1631ok( Devel::PPPort::isOCTAL_A(ord("0")));
1632ok(! Devel::PPPort::isOCTAL_A(ord("9")));
9dc2cc38 1633
876aded1
KW
1634ok( Devel::PPPort::isOCTAL_L1(ord("2")));
1635ok(! Devel::PPPort::isOCTAL_L1(ord("8")));
1636
db834d60
KW
1637ok( Devel::PPPort::isIDFIRST(ord("D")));
1638ok(! Devel::PPPort::isIDFIRST(ord("1")));
9dc2cc38 1639
db834d60
KW
1640ok( Devel::PPPort::isIDFIRST_A(ord("_")));
1641ok(! Devel::PPPort::isIDFIRST_A(0xFC));
9dc2cc38 1642
876aded1
KW
1643ok( Devel::PPPort::isIDFIRST_L1(ord("_")));
1644ok( Devel::PPPort::isIDFIRST_L1(0xFC));
1645ok(! Devel::PPPort::isIDFIRST_L1(0xB6));
1646
db834d60
KW
1647ok( Devel::PPPort::isIDCONT(ord("e")));
1648ok(! Devel::PPPort::isIDCONT(ord("@")));
9dc2cc38 1649
db834d60
KW
1650ok( Devel::PPPort::isIDCONT_A(ord("2")));
1651ok(! Devel::PPPort::isIDCONT_A(0xDC));
9dc2cc38 1652
876aded1
KW
1653ok( Devel::PPPort::isIDCONT_L1(ord("4")));
1654ok( Devel::PPPort::isIDCONT_L1(0xDC));
1655ok(! Devel::PPPort::isIDCONT_L1(0xB6));
1656
db834d60
KW
1657ok( Devel::PPPort::isSPACE(ord(" ")));
1658ok(! Devel::PPPort::isSPACE(ord("_")));
9dc2cc38 1659
db834d60
KW
1660ok( Devel::PPPort::isSPACE_A(ord("\cK")));
1661ok(! Devel::PPPort::isSPACE_A(ord("F")));
9dc2cc38 1662
876aded1
KW
1663ok( Devel::PPPort::isSPACE_L1(ord("\cK")));
1664ok(! Devel::PPPort::isSPACE_L1(ord("g")));
1665
9dc2cc38
KW
1666# This stresses the edge for ASCII machines, but happens to work on EBCDIC as
1667# well
db834d60
KW
1668ok( Devel::PPPort::isASCII(0x7F));
1669ok(! Devel::PPPort::isASCII(0x80));
9dc2cc38 1670
db834d60 1671ok( Devel::PPPort::isASCII_A(ord("9")));
876aded1 1672ok( Devel::PPPort::isASCII_L1(ord("9")));
9dc2cc38
KW
1673
1674# B6 is the PARAGRAPH SIGN in ASCII and EBCDIC
db834d60 1675ok(! Devel::PPPort::isASCII_A(0xB6));
876aded1 1676ok(! Devel::PPPort::isASCII_L1(0xB6));
9dc2cc38 1677
db834d60
KW
1678ok( Devel::PPPort::isCNTRL(ord("\e")));
1679ok(! Devel::PPPort::isCNTRL(ord(" ")));
9dc2cc38 1680
db834d60
KW
1681ok( Devel::PPPort::isCNTRL_A(ord("\a")));
1682ok(! Devel::PPPort::isCNTRL_A(0xB6));
9dc2cc38 1683
876aded1
KW
1684ok( Devel::PPPort::isCNTRL_L1(ord("\a")));
1685ok( Devel::PPPort::isCNTRL_L1(ord(" ") - 1));
1686ok(! Devel::PPPort::isCNTRL_L1(0xB6));
1687if (ord('A') == 65) {
1688 ok(Devel::PPPort::isCNTRL_L1(0x80));
1689}
1690elsif (ord('^') == 106) {
1691 ok(Devel::PPPort::isCNTRL_L1(0x5F));
1692}
1693else {
1694 ok(Devel::PPPort::isCNTRL_L1(0xFF));
1695}
1696
db834d60
KW
1697ok( Devel::PPPort::isPRINT(ord(" ")));
1698ok(! Devel::PPPort::isPRINT(ord("\n")));
9dc2cc38 1699
db834d60
KW
1700ok( Devel::PPPort::isPRINT_A(ord("G")));
1701ok(! Devel::PPPort::isPRINT_A(0xB6));
9dc2cc38 1702
876aded1
KW
1703ok( Devel::PPPort::isPRINT_L1(ord("~")));
1704ok( Devel::PPPort::isPRINT_L1(0xB6));
1705ok(! Devel::PPPort::isPRINT_L1(ord("\r")));
1706
db834d60
KW
1707ok( Devel::PPPort::isGRAPH(ord("h")));
1708ok(! Devel::PPPort::isGRAPH(ord(" ")));
9dc2cc38 1709
db834d60
KW
1710ok( Devel::PPPort::isGRAPH_A(ord("i")));
1711ok(! Devel::PPPort::isGRAPH_A(0xB6));
9dc2cc38 1712
876aded1
KW
1713ok( Devel::PPPort::isGRAPH_L1(ord("j")));
1714ok( Devel::PPPort::isGRAPH_L1(0xB6));
1715ok(! Devel::PPPort::isGRAPH_L1(4));
1716
db834d60
KW
1717ok( Devel::PPPort::isPUNCT(ord("#")));
1718ok(! Devel::PPPort::isPUNCT(ord(" ")));
9dc2cc38 1719
db834d60
KW
1720ok( Devel::PPPort::isPUNCT_A(ord("*")));
1721ok(! Devel::PPPort::isPUNCT_A(0xB6));
9dc2cc38 1722
876aded1
KW
1723ok( Devel::PPPort::isPUNCT_L1(ord("+")));
1724ok( Devel::PPPort::isPUNCT_L1(0xB6));
1725
db834d60
KW
1726ok( Devel::PPPort::isXDIGIT(ord("A")));
1727ok(! Devel::PPPort::isXDIGIT(ord("_")));
9dc2cc38 1728
db834d60
KW
1729ok( Devel::PPPort::isXDIGIT_A(ord("9")));
1730ok(! Devel::PPPort::isXDIGIT_A(0xDC));
9dc2cc38 1731
876aded1
KW
1732ok( Devel::PPPort::isXDIGIT_L1(ord("9")));
1733ok(! Devel::PPPort::isXDIGIT_L1(0xFF));
1734
db834d60
KW
1735ok( Devel::PPPort::isPSXSPC(ord(" ")));
1736ok(! Devel::PPPort::isPSXSPC(ord("k")));
9dc2cc38 1737
db834d60
KW
1738ok( Devel::PPPort::isPSXSPC_A(ord("\cK")));
1739ok(! Devel::PPPort::isPSXSPC_A(0xFC));
1eff2a3b 1740
876aded1
KW
1741ok( Devel::PPPort::isPSXSPC_L1(ord("\cK")));
1742ok(! Devel::PPPort::isPSXSPC_L1(0xFC));
1743
1eff2a3b
KW
1744ok(&Devel::PPPort::av_top_index([1,2,3]), 2);
1745ok(&Devel::PPPort::av_tindex([1,2,3,4]), 3);