This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to Devel::PPPort 3.06.
[perl5.git] / ext / Devel / PPPort / PPPort.xs
CommitLineData
adfe19db
MHM
1/*******************************************************************************
2*
3* !!!!! Do NOT edit this file directly! -- Edit PPPort_xs.PL instead. !!!!!
4*
5********************************************************************************
6*
7* Perl/Pollution/Portability
8*
9********************************************************************************
10*
9132e1a3 11* $Revision: 8 $
adfe19db 12* $Author: mhx $
9132e1a3 13* $Date: 2005/01/31 08:10:55 +0100 $
adfe19db
MHM
14*
15********************************************************************************
16*
9132e1a3 17* Version 3.x, Copyright (C) 2004-2005, Marcus Holland-Moritz.
adfe19db
MHM
18* Version 2.x, Copyright (C) 2001, Paul Marquess.
19* Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
20*
21* This program is free software; you can redistribute it and/or
22* modify it under the same terms as Perl itself.
23*
24*******************************************************************************/
25
26/* ========== BEGIN XSHEAD ================================================== */
27
28
29
30/* =========== END XSHEAD =================================================== */
0a7c7f4f
JH
31
32#include "EXTERN.h"
33#include "perl.h"
34#include "XSUB.h"
35
adfe19db
MHM
36/* ========== BEGIN XSINIT ================================================== */
37
38/* ---- from parts/inc/call ---- */
39#define NEED_eval_pv
40
41/* ---- from parts/inc/grok ---- */
42#define NEED_grok_number
43#define NEED_grok_numeric_radix
44#define NEED_grok_bin
45#define NEED_grok_hex
46#define NEED_grok_oct
47
48/* ---- from parts/inc/newCONSTSUB ---- */
0a7c7f4f 49#define NEED_newCONSTSUB
adfe19db
MHM
50
51/* ---- from parts/inc/newRV ---- */
52#define NEED_newRV_noinc
53
96ad942f
MHM
54/* ---- from parts/inc/sv_xpvf ---- */
55#define NEED_vnewSVpvf
56#define NEED_sv_catpvf_mg
57#define NEED_sv_catpvf_mg_nocontext
58#define NEED_sv_setpvf_mg
59#define NEED_sv_setpvf_mg_nocontext
60
adfe19db
MHM
61/* ---- from parts/inc/SvPV ---- */
62#define NEED_sv_2pv_nolen
63#define NEED_sv_2pvbyte
64
65/* =========== END XSINIT =================================================== */
66
0a7c7f4f
JH
67#include "ppport.h"
68
adfe19db
MHM
69/* ========== BEGIN XSMISC ================================================== */
70
9132e1a3 71/* ---- from parts/inc/exception ---- */
2dd69576
MHM
72/* defined in module3.c */
73int exception(int throw_e);
9132e1a3
MHM
74
75/* ---- from parts/inc/misc ---- */
76XS(XS_Devel__PPPort_dXSTARG); /* prototype */
77XS(XS_Devel__PPPort_dXSTARG)
78{
79 dXSARGS;
80 dXSTARG;
f8952f9c 81 IV iv;
9132e1a3 82 SP -= items;
f8952f9c 83 iv = SvIV(ST(0)) + 1;
9132e1a3
MHM
84 PUSHi(iv);
85 XSRETURN(1);
86}
87
adfe19db 88/* ---- from parts/inc/MY_CXT ---- */
44284200 89#define MY_CXT_KEY "Devel::PPPort::_guts" XS_VERSION
0a7c7f4f
JH
90
91typedef struct {
adfe19db
MHM
92 /* Put Global Data in here */
93 int dummy;
0a7c7f4f
JH
94} my_cxt_t;
95
96START_MY_CXT
97
adfe19db
MHM
98/* ---- from parts/inc/newCONSTSUB ---- */
99void call_newCONSTSUB_1(void)
0a7c7f4f 100{
adfe19db
MHM
101#ifdef PERL_NO_GET_CONTEXT
102 dTHX;
103#endif
44284200 104 newCONSTSUB(gv_stashpv("Devel::PPPort", FALSE), "test_value_1", newSViv(1));
0a7c7f4f
JH
105}
106
adfe19db
MHM
107extern void call_newCONSTSUB_2(void);
108extern void call_newCONSTSUB_3(void);
109
96ad942f
MHM
110/* ---- from parts/inc/sv_xpvf ---- */
111static SV * test_vnewSVpvf(pTHX_ const char *pat, ...)
112{
113 SV *sv;
114 va_list args;
115 va_start(args, pat);
116#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0)))
117 sv = vnewSVpvf(pat, &args);
118#else
119 sv = newSVpv(pat, 0);
120#endif
121 va_end(args);
122 return sv;
123}
124
125static void test_sv_vcatpvf(pTHX_ SV *sv, const char *pat, ...)
126{
127 va_list args;
128 va_start(args, pat);
129#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0)))
130 sv_vcatpvf(sv, pat, &args);
131#else
132 sv_catpv(sv, pat);
133#endif
134 va_end(args);
135}
136
137static void test_sv_vsetpvf(pTHX_ SV *sv, const char *pat, ...)
138{
139 va_list args;
140 va_start(args, pat);
141#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0)))
142 sv_vsetpvf(sv, pat, &args);
143#else
144 sv_setpv(sv, pat);
145#endif
146 va_end(args);
147}
148
adfe19db 149/* =========== END XSMISC =================================================== */
0a7c7f4f 150
44284200 151MODULE = Devel::PPPort PACKAGE = Devel::PPPort
0a7c7f4f
JH
152
153BOOT:
9132e1a3
MHM
154 /* ---- from parts/inc/misc ---- */
155 newXS("Devel::PPPort::dXSTARG", XS_Devel__PPPort_dXSTARG, file);
156
adfe19db
MHM
157 /* ---- from parts/inc/MY_CXT ---- */
158 {
159 MY_CXT_INIT;
160 /* If any of the fields in the my_cxt_t struct need
161 * to be initialised, do it here.
162 */
163 MY_CXT.dummy = 42;
164 }
165
166
167##----------------------------------------------------------------------
168## XSUBs from parts/inc/call
169##----------------------------------------------------------------------
170
171I32
172G_SCALAR()
173 CODE:
174 RETVAL = G_SCALAR;
175 OUTPUT:
176 RETVAL
177
178I32
179G_ARRAY()
180 CODE:
181 RETVAL = G_ARRAY;
182 OUTPUT:
183 RETVAL
184
185I32
186G_DISCARD()
187 CODE:
188 RETVAL = G_DISCARD;
189 OUTPUT:
190 RETVAL
191
192void
193eval_sv(sv, flags)
194 SV* sv
195 I32 flags
196 PREINIT:
197 I32 i;
198 PPCODE:
199 PUTBACK;
200 i = eval_sv(sv, flags);
201 SPAGAIN;
202 EXTEND(SP, 1);
203 PUSHs(sv_2mortal(newSViv(i)));
204
205void
206eval_pv(p, croak_on_error)
207 char* p
208 I32 croak_on_error
209 PPCODE:
210 PUTBACK;
211 EXTEND(SP, 1);
212 PUSHs(eval_pv(p, croak_on_error));
213
214void
215call_sv(sv, flags, ...)
216 SV* sv
217 I32 flags
218 PREINIT:
219 I32 i;
220 PPCODE:
221 for (i=0; i<items-2; i++)
222 ST(i) = ST(i+2); /* pop first two args */
223 PUSHMARK(SP);
224 SP += items - 2;
225 PUTBACK;
226 i = call_sv(sv, flags);
227 SPAGAIN;
228 EXTEND(SP, 1);
229 PUSHs(sv_2mortal(newSViv(i)));
230
0a7c7f4f 231void
adfe19db
MHM
232call_pv(subname, flags, ...)
233 char* subname
234 I32 flags
235 PREINIT:
236 I32 i;
237 PPCODE:
238 for (i=0; i<items-2; i++)
239 ST(i) = ST(i+2); /* pop first two args */
240 PUSHMARK(SP);
241 SP += items - 2;
242 PUTBACK;
243 i = call_pv(subname, flags);
244 SPAGAIN;
245 EXTEND(SP, 1);
246 PUSHs(sv_2mortal(newSViv(i)));
0a7c7f4f
JH
247
248void
adfe19db
MHM
249call_argv(subname, flags, ...)
250 char* subname
251 I32 flags
252 PREINIT:
253 I32 i;
254 char *args[8];
255 PPCODE:
256 if (items > 8) /* play safe */
257 XSRETURN_UNDEF;
258 for (i=2; i<items; i++)
259 args[i-2] = SvPV_nolen(ST(i));
260 args[items-2] = NULL;
261 PUTBACK;
262 i = call_argv(subname, flags, args);
263 SPAGAIN;
264 EXTEND(SP, 1);
265 PUSHs(sv_2mortal(newSViv(i)));
0a7c7f4f
JH
266
267void
adfe19db
MHM
268call_method(methname, flags, ...)
269 char* methname
270 I32 flags
271 PREINIT:
272 I32 i;
273 PPCODE:
274 for (i=0; i<items-2; i++)
275 ST(i) = ST(i+2); /* pop first two args */
276 PUSHMARK(SP);
277 SP += items - 2;
278 PUTBACK;
279 i = call_method(methname, flags);
280 SPAGAIN;
281 EXTEND(SP, 1);
282 PUSHs(sv_2mortal(newSViv(i)));
283
284##----------------------------------------------------------------------
285## XSUBs from parts/inc/cop
286##----------------------------------------------------------------------
287
288char *
289CopSTASHPV()
290 CODE:
291 RETVAL = CopSTASHPV(PL_curcop);
292 OUTPUT:
293 RETVAL
294
295char *
296CopFILE()
297 CODE:
298 RETVAL = CopFILE(PL_curcop);
299 OUTPUT:
300 RETVAL
301
302##----------------------------------------------------------------------
9132e1a3
MHM
303## XSUBs from parts/inc/exception
304##----------------------------------------------------------------------
305
306int
307exception(throw_e)
308 int throw_e
309 OUTPUT:
310 RETVAL
311
312##----------------------------------------------------------------------
adfe19db
MHM
313## XSUBs from parts/inc/grok
314##----------------------------------------------------------------------
315
316UV
317grok_number(string)
318 SV *string
319 PREINIT:
320 const char *pv;
321 STRLEN len;
322 CODE:
323 pv = SvPV(string, len);
324 if (!grok_number(pv, len, &RETVAL))
325 XSRETURN_UNDEF;
326 OUTPUT:
327 RETVAL
328
329UV
330grok_bin(string)
331 SV *string
332 PREINIT:
333 char *pv;
334 I32 flags;
335 STRLEN len;
336 CODE:
337 pv = SvPV(string, len);
338 RETVAL = grok_bin(pv, &len, &flags, NULL);
339 OUTPUT:
340 RETVAL
341
342UV
343grok_hex(string)
344 SV *string
345 PREINIT:
346 char *pv;
347 I32 flags;
348 STRLEN len;
349 CODE:
350 pv = SvPV(string, len);
351 RETVAL = grok_hex(pv, &len, &flags, NULL);
352 OUTPUT:
353 RETVAL
354
355UV
356grok_oct(string)
357 SV *string
358 PREINIT:
359 char *pv;
360 I32 flags;
361 STRLEN len;
362 CODE:
363 pv = SvPV(string, len);
364 RETVAL = grok_oct(pv, &len, &flags, NULL);
365 OUTPUT:
366 RETVAL
367
368UV
369Perl_grok_number(string)
370 SV *string
371 PREINIT:
372 const char *pv;
373 STRLEN len;
374 CODE:
375 pv = SvPV(string, len);
376 if (!Perl_grok_number(aTHX_ pv, len, &RETVAL))
377 XSRETURN_UNDEF;
378 OUTPUT:
379 RETVAL
380
381UV
382Perl_grok_bin(string)
383 SV *string
384 PREINIT:
385 char *pv;
386 I32 flags;
387 STRLEN len;
388 CODE:
389 pv = SvPV(string, len);
390 RETVAL = Perl_grok_bin(aTHX_ pv, &len, &flags, NULL);
391 OUTPUT:
392 RETVAL
393
394UV
395Perl_grok_hex(string)
396 SV *string
397 PREINIT:
398 char *pv;
399 I32 flags;
400 STRLEN len;
401 CODE:
402 pv = SvPV(string, len);
403 RETVAL = Perl_grok_hex(aTHX_ pv, &len, &flags, NULL);
404 OUTPUT:
405 RETVAL
406
407UV
408Perl_grok_oct(string)
409 SV *string
410 PREINIT:
411 char *pv;
412 I32 flags;
413 STRLEN len;
414 CODE:
415 pv = SvPV(string, len);
416 RETVAL = Perl_grok_oct(aTHX_ pv, &len, &flags, NULL);
417 OUTPUT:
418 RETVAL
419
420##----------------------------------------------------------------------
421## XSUBs from parts/inc/limits
422##----------------------------------------------------------------------
423
424IV
425iv_size()
426 CODE:
427 RETVAL = IVSIZE == sizeof(IV);
428 OUTPUT:
429 RETVAL
430
431IV
432uv_size()
433 CODE:
434 RETVAL = UVSIZE == sizeof(UV);
435 OUTPUT:
436 RETVAL
437
438IV
439iv_type()
440 CODE:
441 RETVAL = sizeof(IVTYPE) == sizeof(IV);
442 OUTPUT:
443 RETVAL
444
445IV
446uv_type()
447 CODE:
448 RETVAL = sizeof(UVTYPE) == sizeof(UV);
449 OUTPUT:
450 RETVAL
451
452##----------------------------------------------------------------------
453## XSUBs from parts/inc/magic
454##----------------------------------------------------------------------
455
456void
457sv_catpv_mg(sv, string)
458 SV *sv;
459 char *string;
460 CODE:
461 sv_catpv_mg(sv, string);
462
463void
464sv_catpvn_mg(sv, sv2)
465 SV *sv;
466 SV *sv2;
467 PREINIT:
468 char *str;
469 STRLEN len;
470 CODE:
471 str = SvPV(sv2, len);
472 sv_catpvn_mg(sv, str, len);
473
474void
475sv_catsv_mg(sv, sv2)
476 SV *sv;
477 SV *sv2;
478 CODE:
479 sv_catsv_mg(sv, sv2);
480
481void
482sv_setiv_mg(sv, iv)
483 SV *sv;
484 IV iv;
485 CODE:
486 sv_setiv_mg(sv, iv);
487
488void
489sv_setnv_mg(sv, nv)
490 SV *sv;
491 NV nv;
492 CODE:
493 sv_setnv_mg(sv, nv);
494
495void
496sv_setpv_mg(sv, pv)
497 SV *sv;
498 char *pv;
499 CODE:
500 sv_setpv_mg(sv, pv);
501
502void
503sv_setpvn_mg(sv, sv2)
504 SV *sv;
505 SV *sv2;
506 PREINIT:
507 char *str;
508 STRLEN len;
509 CODE:
510 str = SvPV(sv2, len);
511 sv_setpvn_mg(sv, str, len);
512
513void
514sv_setsv_mg(sv, sv2)
515 SV *sv;
516 SV *sv2;
517 CODE:
518 sv_setsv_mg(sv, sv2);
519
520void
521sv_setuv_mg(sv, uv)
522 SV *sv;
523 UV uv;
524 CODE:
525 sv_setuv_mg(sv, uv);
526
527void
528sv_usepvn_mg(sv, sv2)
529 SV *sv;
530 SV *sv2;
531 PREINIT:
532 char *str, *copy;
533 STRLEN len;
534 CODE:
535 str = SvPV(sv2, len);
536 New(42, copy, len+1, char);
537 Copy(str, copy, len+1, char);
538 sv_usepvn_mg(sv, copy, len);
539
540##----------------------------------------------------------------------
541## XSUBs from parts/inc/misc
542##----------------------------------------------------------------------
0a7c7f4f
JH
543
544int
adfe19db
MHM
545gv_stashpvn(name, create)
546 char *name
547 I32 create
0a7c7f4f 548 CODE:
adfe19db 549 RETVAL = gv_stashpvn(name, strlen(name), create) != NULL;
0a7c7f4f 550 OUTPUT:
adfe19db 551 RETVAL
0a7c7f4f
JH
552
553int
adfe19db
MHM
554get_sv(name, create)
555 char *name
556 I32 create
0a7c7f4f 557 CODE:
adfe19db
MHM
558 RETVAL = get_sv(name, create) != NULL;
559 OUTPUT:
560 RETVAL
561
562int
563get_av(name, create)
564 char *name
565 I32 create
566 CODE:
567 RETVAL = get_av(name, create) != NULL;
568 OUTPUT:
569 RETVAL
570
571int
572get_hv(name, create)
573 char *name
574 I32 create
575 CODE:
576 RETVAL = get_hv(name, create) != NULL;
577 OUTPUT:
578 RETVAL
579
580int
581get_cv(name, create)
582 char *name
583 I32 create
584 CODE:
585 RETVAL = get_cv(name, create) != NULL;
0a7c7f4f 586 OUTPUT:
adfe19db
MHM
587 RETVAL
588
589void
590newSVpvn()
591 PPCODE:
592 XPUSHs(newSVpvn("test", 4));
593 XPUSHs(newSVpvn("test", 2));
594 XPUSHs(newSVpvn("test", 0));
595 XPUSHs(newSVpvn(NULL, 2));
596 XPUSHs(newSVpvn(NULL, 0));
597 XSRETURN(5);
0a7c7f4f
JH
598
599SV *
adfe19db 600PL_sv_undef()
0a7c7f4f 601 CODE:
adfe19db 602 RETVAL = newSVsv(&PL_sv_undef);
0a7c7f4f 603 OUTPUT:
adfe19db 604 RETVAL
0a7c7f4f
JH
605
606SV *
adfe19db 607PL_sv_yes()
0a7c7f4f 608 CODE:
adfe19db 609 RETVAL = newSVsv(&PL_sv_yes);
0a7c7f4f 610 OUTPUT:
adfe19db 611 RETVAL
0a7c7f4f
JH
612
613SV *
adfe19db 614PL_sv_no()
0a7c7f4f 615 CODE:
adfe19db 616 RETVAL = newSVsv(&PL_sv_no);
0a7c7f4f 617 OUTPUT:
adfe19db 618 RETVAL
0a7c7f4f
JH
619
620int
adfe19db
MHM
621PL_na(string)
622 char *string
0a7c7f4f 623 CODE:
0a7c7f4f
JH
624 PL_na = strlen(string);
625 RETVAL = PL_na;
0a7c7f4f 626 OUTPUT:
adfe19db 627 RETVAL
0a7c7f4f
JH
628
629SV*
adfe19db 630boolSV(value)
0a7c7f4f
JH
631 int value
632 CODE:
adfe19db 633 RETVAL = newSVsv(boolSV(value));
0a7c7f4f 634 OUTPUT:
adfe19db 635 RETVAL
0a7c7f4f
JH
636
637SV*
adfe19db 638DEFSV()
0a7c7f4f 639 CODE:
0a7c7f4f 640 RETVAL = newSVsv(DEFSV);
0a7c7f4f 641 OUTPUT:
adfe19db 642 RETVAL
0a7c7f4f
JH
643
644int
adfe19db 645ERRSV()
0a7c7f4f 646 CODE:
0a7c7f4f 647 RETVAL = SvTRUE(ERRSV);
0a7c7f4f 648 OUTPUT:
adfe19db
MHM
649 RETVAL
650
651SV*
652UNDERBAR()
653 CODE:
654 {
655 dUNDERBAR;
656 RETVAL = newSVsv(UNDERBAR);
657 }
658 OUTPUT:
659 RETVAL
660
661##----------------------------------------------------------------------
662## XSUBs from parts/inc/mPUSH
663##----------------------------------------------------------------------
664
665void
666mPUSHp()
667 PPCODE:
668 EXTEND(SP, 3);
669 mPUSHp("one", 3);
670 mPUSHp("two", 3);
671 mPUSHp("three", 5);
672 XSRETURN(3);
673
674void
675mPUSHn()
676 PPCODE:
677 EXTEND(SP, 3);
678 mPUSHn(0.5);
679 mPUSHn(-0.25);
680 mPUSHn(0.125);
681 XSRETURN(3);
682
683void
684mPUSHi()
685 PPCODE:
686 EXTEND(SP, 3);
687 mPUSHi(-1);
688 mPUSHi(2);
689 mPUSHi(-3);
690 XSRETURN(3);
691
692void
693mPUSHu()
694 PPCODE:
695 EXTEND(SP, 3);
696 mPUSHu(1);
697 mPUSHu(2);
698 mPUSHu(3);
699 XSRETURN(3);
700
701void
702mXPUSHp()
703 PPCODE:
704 mXPUSHp("one", 3);
705 mXPUSHp("two", 3);
706 mXPUSHp("three", 5);
707 XSRETURN(3);
708
709void
710mXPUSHn()
711 PPCODE:
712 mXPUSHn(0.5);
713 mXPUSHn(-0.25);
714 mXPUSHn(0.125);
715 XSRETURN(3);
716
717void
718mXPUSHi()
719 PPCODE:
720 mXPUSHi(-1);
721 mXPUSHi(2);
722 mXPUSHi(-3);
723 XSRETURN(3);
724
725void
726mXPUSHu()
727 PPCODE:
728 mXPUSHu(1);
729 mXPUSHu(2);
730 mXPUSHu(3);
731 XSRETURN(3);
732
733##----------------------------------------------------------------------
734## XSUBs from parts/inc/MY_CXT
735##----------------------------------------------------------------------
0a7c7f4f
JH
736
737int
adfe19db 738MY_CXT_1()
0a7c7f4f 739 CODE:
0a7c7f4f 740 dMY_CXT;
adfe19db
MHM
741 RETVAL = MY_CXT.dummy == 42;
742 ++MY_CXT.dummy;
0a7c7f4f 743 OUTPUT:
adfe19db 744 RETVAL
0a7c7f4f
JH
745
746int
adfe19db 747MY_CXT_2()
0a7c7f4f 748 CODE:
0a7c7f4f 749 dMY_CXT;
adfe19db
MHM
750 RETVAL = MY_CXT.dummy == 43;
751 OUTPUT:
752 RETVAL
753
e4c28a9f
MHM
754int
755MY_CXT_CLONE()
756 CODE:
757 MY_CXT_CLONE;
758 RETVAL = 42;
759 OUTPUT:
760 RETVAL
761
adfe19db
MHM
762##----------------------------------------------------------------------
763## XSUBs from parts/inc/newCONSTSUB
764##----------------------------------------------------------------------
765
766void
767call_newCONSTSUB_1()
768
769void
770call_newCONSTSUB_2()
771
772void
773call_newCONSTSUB_3()
774
775##----------------------------------------------------------------------
776## XSUBs from parts/inc/newRV
777##----------------------------------------------------------------------
778
779U32
780newRV_inc_REFCNT()
781 PREINIT:
782 SV *sv, *rv;
783 CODE:
784 sv = newSViv(42);
785 rv = newRV_inc(sv);
786 SvREFCNT_dec(sv);
787 RETVAL = SvREFCNT(sv);
788 sv_2mortal(rv);
0a7c7f4f 789 OUTPUT:
adfe19db 790 RETVAL
0a7c7f4f 791
adfe19db
MHM
792U32
793newRV_noinc_REFCNT()
794 PREINIT:
795 SV *sv, *rv;
796 CODE:
797 sv = newSViv(42);
798 rv = newRV_noinc(sv);
799 RETVAL = SvREFCNT(sv);
800 sv_2mortal(rv);
801 OUTPUT:
802 RETVAL
803
804##----------------------------------------------------------------------
96ad942f
MHM
805## XSUBs from parts/inc/sv_xpvf
806##----------------------------------------------------------------------
807
808SV *
809vnewSVpvf()
810 CODE:
811 RETVAL = test_vnewSVpvf(aTHX_ "%s-%d", "Perl", 42);
812 OUTPUT:
813 RETVAL
814
815SV *
816sv_vcatpvf(sv)
817 SV *sv
818 CODE:
819 RETVAL = newSVsv(sv);
820 test_sv_vcatpvf(aTHX_ RETVAL, "%s-%d", "Perl", 42);
821 OUTPUT:
822 RETVAL
823
824SV *
825sv_vsetpvf(sv)
826 SV *sv
827 CODE:
828 RETVAL = newSVsv(sv);
829 test_sv_vsetpvf(aTHX_ RETVAL, "%s-%d", "Perl", 42);
830 OUTPUT:
831 RETVAL
832
833void
834sv_catpvf_mg(sv)
835 SV *sv
836 CODE:
837#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0)))
838 sv_catpvf_mg(sv, "%s-%d", "Perl", 42);
839#endif
840
841void
842Perl_sv_catpvf_mg(sv)
843 SV *sv
844 CODE:
845#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0)))
846 Perl_sv_catpvf_mg(aTHX_ sv, "%s-%d", "-Perl", 43);
847#endif
848
849void
850sv_catpvf_mg_nocontext(sv)
851 SV *sv
852 CODE:
853#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0)))
854#ifdef PERL_IMPLICIT_CONTEXT
855 sv_catpvf_mg_nocontext(sv, "%s-%d", "-Perl", 44);
856#else
857 sv_catpvf_mg(sv, "%s-%d", "-Perl", 44);
858#endif
859#endif
860
861void
862sv_setpvf_mg(sv)
863 SV *sv
864 CODE:
865#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0)))
866 sv_setpvf_mg(sv, "%s-%d", "mhx", 42);
867#endif
868
869void
870Perl_sv_setpvf_mg(sv)
871 SV *sv
872 CODE:
873#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0)))
874 Perl_sv_setpvf_mg(aTHX_ sv, "%s-%d", "foo", 43);
875#endif
876
877void
878sv_setpvf_mg_nocontext(sv)
879 SV *sv
880 CODE:
881#if ((PERL_VERSION > 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION >= 0)))
882#ifdef PERL_IMPLICIT_CONTEXT
883 sv_setpvf_mg_nocontext(sv, "%s-%d", "bar", 44);
884#else
885 sv_setpvf_mg(sv, "%s-%d", "bar", 44);
886#endif
887#endif
888
889##----------------------------------------------------------------------
adfe19db
MHM
890## XSUBs from parts/inc/SvPV
891##----------------------------------------------------------------------
892
893IV
894SvPVbyte(sv)
895 SV *sv
896 PREINIT:
897 STRLEN len;
898 const char *str;
899 CODE:
900 str = SvPVbyte(sv, len);
901 RETVAL = strEQ(str, "mhx") ? len : -1;
902 OUTPUT:
903 RETVAL
904
905IV
906SvPV_nolen(sv)
907 SV *sv
908 PREINIT:
909 const char *str;
910 CODE:
911 str = SvPV_nolen(sv);
9132e1a3 912 RETVAL = strEQ(str, "mhx") ? 42 : 0;
adfe19db
MHM
913 OUTPUT:
914 RETVAL
915
916##----------------------------------------------------------------------
917## XSUBs from parts/inc/threads
918##----------------------------------------------------------------------
919
920IV
921no_THX_arg(sv)
922 SV *sv
923 CODE:
924 RETVAL = 1 + sv_2iv(sv);
925 OUTPUT:
926 RETVAL
927
928void
929with_THX_arg(error)
930 char *error
931 PPCODE:
932 Perl_croak(aTHX_ "%s", error);
933
934##----------------------------------------------------------------------
935## XSUBs from parts/inc/uv
936##----------------------------------------------------------------------
937
938SV *
939sv_setuv(uv)
940 UV uv
941 CODE:
942 RETVAL = newSViv(1);
943 sv_setuv(RETVAL, uv);
944 OUTPUT:
945 RETVAL
946
947SV *
948newSVuv(uv)
949 UV uv
950 CODE:
951 RETVAL = newSVuv(uv);
952 OUTPUT:
953 RETVAL
954
955UV
956sv_2uv(sv)
957 SV *sv
958 CODE:
959 RETVAL = sv_2uv(sv);
960 OUTPUT:
961 RETVAL
962
963UV
964SvUVx(sv)
965 SV *sv
966 CODE:
967 sv--;
968 RETVAL = SvUVx(++sv);
969 OUTPUT:
970 RETVAL
971
972void
973XSRETURN_UV()
974 PPCODE:
975 XSRETURN_UV(42);
96ad942f
MHM
976
977void
978PUSHu()
979 PREINIT:
980 dTARG;
981 PPCODE:
982 TARG = sv_newmortal();
983 EXTEND(SP, 1);
984 PUSHu(42);
985 XSRETURN(1);
986
987void
988XPUSHu()
989 PREINIT:
990 dTARG;
991 PPCODE:
992 TARG = sv_newmortal();
993 XPUSHu(43);
994 XSRETURN(1);