This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate:
[perl5.git] / mathoms.c
CommitLineData
e3064a43
NC
1/* mathoms.c
2 *
ae53e38e 3 * Copyright (C) 2005, 2006, by Larry Wall and others
e3064a43
NC
4 *
5 * You may distribute under the terms of either the GNU General Public
6 * License or the Artistic License, as specified in the README file.
7 *
8 */
9
10/*
11 * "Anything that Hobbits had no immediate use for, but were unwilling to
12 * throw away, they called a mathom. Their dwellings were apt to become
13 * rather crowded with mathoms, and many of the presents that passed from
14 * hand to hand were of that sort."
15 */
16
4fbce521
NC
17#ifndef NO_MATHOMS
18
e3064a43
NC
19/*
20 * This file contains mathoms, various binary artifacts from previous
05b233af
NC
21 * versions of Perl. For binary or source compatibility reasons, though,
22 * we cannot completely remove them from the core code.
e3064a43
NC
23 *
24 * SMP - Oct. 24, 2005
25 *
26 */
27
28#include "EXTERN.h"
29#define PERL_IN_MATHOMS_C
30#include "perl.h"
31
0bfdb59a
NC
32PERL_CALLCONV OP * Perl_ref(pTHX_ OP *o, I32 type);
33PERL_CALLCONV void Perl_sv_unref(pTHX_ SV *sv);
34PERL_CALLCONV void Perl_sv_taint(pTHX_ SV *sv);
35PERL_CALLCONV IV Perl_sv_2iv(pTHX_ register SV *sv);
36PERL_CALLCONV UV Perl_sv_2uv(pTHX_ register SV *sv);
37PERL_CALLCONV char * Perl_sv_2pv(pTHX_ register SV *sv, STRLEN *lp);
38PERL_CALLCONV char * Perl_sv_2pv_nolen(pTHX_ register SV *sv);
39PERL_CALLCONV char * Perl_sv_2pvbyte_nolen(pTHX_ register SV *sv);
40PERL_CALLCONV char * Perl_sv_2pvutf8_nolen(pTHX_ register SV *sv);
41PERL_CALLCONV void Perl_sv_force_normal(pTHX_ register SV *sv);
42PERL_CALLCONV void Perl_sv_setsv(pTHX_ SV *dstr, register SV *sstr);
43PERL_CALLCONV void Perl_sv_catpvn(pTHX_ SV *dsv, const char* sstr, STRLEN slen);
44PERL_CALLCONV void Perl_sv_catpvn_mg(pTHX_ register SV *sv, register const char *ptr, register STRLEN len);
45PERL_CALLCONV void Perl_sv_catsv(pTHX_ SV *dstr, register SV *sstr);
46PERL_CALLCONV void Perl_sv_catsv_mg(pTHX_ SV *dsv, register SV *ssv);
47PERL_CALLCONV char * Perl_sv_pv(pTHX_ SV *sv);
48PERL_CALLCONV char * Perl_sv_pvn_force(pTHX_ SV *sv, STRLEN *lp);
49PERL_CALLCONV char * Perl_sv_pvbyte(pTHX_ SV *sv);
50PERL_CALLCONV char * Perl_sv_pvutf8(pTHX_ SV *sv);
51PERL_CALLCONV STRLEN Perl_sv_utf8_upgrade(pTHX_ register SV *sv);
52PERL_CALLCONV NV Perl_huge(void);
53PERL_CALLCONV void Perl_gv_fullname3(pTHX_ SV *sv, GV *gv, const char *prefix);
54PERL_CALLCONV void Perl_gv_efullname3(pTHX_ SV *sv, GV *gv, const char *prefix);
55PERL_CALLCONV GV * Perl_gv_fetchmethod(pTHX_ HV *stash, const char *name);
56PERL_CALLCONV HE * Perl_hv_iternext(pTHX_ HV *hv);
57PERL_CALLCONV void Perl_hv_magic(pTHX_ HV *hv, GV *gv, int how);
58PERL_CALLCONV bool Perl_do_open(pTHX_ GV *gv, register char *name, I32 len, int as_raw, int rawmode, int rawperm, PerlIO *supplied_fp);
59PERL_CALLCONV bool Perl_do_aexec(pTHX_ SV *really, register SV **mark, register SV **sp);
60PERL_CALLCONV bool Perl_do_exec(pTHX_ char *cmd);
61PERL_CALLCONV U8 * Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv);
62PERL_CALLCONV bool Perl_is_utf8_string_loc(pTHX_ U8 *s, STRLEN len, U8 **ep);
63PERL_CALLCONV void Perl_sv_nolocking(pTHX_ SV *sv);
64PERL_CALLCONV void Perl_sv_usepvn_mg(pTHX_ SV *sv, char *ptr, STRLEN len);
65PERL_CALLCONV void Perl_sv_usepvn(pTHX_ SV *sv, char *ptr, STRLEN len);
66PERL_CALLCONV int Perl_fprintf_nocontext(PerlIO *stream, const char *format, ...);
67PERL_CALLCONV int Perl_printf_nocontext(const char *format, ...);
5336c895
AL
68
69
150a15f2 70#if 0
e3064a43
NC
71/* ref() is now a macro using Perl_doref;
72 * this version provided for binary compatibility only.
73 */
74OP *
75Perl_ref(pTHX_ OP *o, I32 type)
76{
77 return doref(o, type, TRUE);
78}
150a15f2 79#endif
e3064a43 80
05b233af
NC
81/*
82=for apidoc sv_unref
83
84Unsets the RV status of the SV, and decrements the reference count of
85whatever was being referenced by the RV. This can almost be thought of
86as a reversal of C<newSVrv>. This is C<sv_unref_flags> with the C<flag>
87being zero. See C<SvROK_off>.
88
89=cut
90*/
91
92void
93Perl_sv_unref(pTHX_ SV *sv)
94{
95 sv_unref_flags(sv, 0);
96}
97
98/*
99=for apidoc sv_taint
100
101Taint an SV. Use C<SvTAINTED_on> instead.
102=cut
103*/
104
105void
106Perl_sv_taint(pTHX_ SV *sv)
107{
0e2d6244 108 sv_magic((sv), NULL, PERL_MAGIC_taint, NULL, 0);
05b233af
NC
109}
110
e3064a43
NC
111/* sv_2iv() is now a macro using Perl_sv_2iv_flags();
112 * this function provided for binary compatibility only
113 */
114
115IV
116Perl_sv_2iv(pTHX_ register SV *sv)
117{
118 return sv_2iv_flags(sv, SV_GMAGIC);
119}
120
121/* sv_2uv() is now a macro using Perl_sv_2uv_flags();
122 * this function provided for binary compatibility only
123 */
124
125UV
126Perl_sv_2uv(pTHX_ register SV *sv)
127{
128 return sv_2uv_flags(sv, SV_GMAGIC);
129}
130
131/* sv_2pv() is now a macro using Perl_sv_2pv_flags();
132 * this function provided for binary compatibility only
133 */
134
135char *
136Perl_sv_2pv(pTHX_ register SV *sv, STRLEN *lp)
137{
138 return sv_2pv_flags(sv, lp, SV_GMAGIC);
139}
140
05b233af 141/*
66067514
NC
142=for apidoc sv_2pv_nolen
143
144Like C<sv_2pv()>, but doesn't return the length too. You should usually
145use the macro wrapper C<SvPV_nolen(sv)> instead.
146=cut
147*/
148
149char *
150Perl_sv_2pv_nolen(pTHX_ register SV *sv)
151{
5336c895 152 return sv_2pv(sv, NULL);
66067514
NC
153}
154
155/*
156=for apidoc sv_2pvbyte_nolen
157
158Return a pointer to the byte-encoded representation of the SV.
159May cause the SV to be downgraded from UTF-8 as a side-effect.
160
161Usually accessed via the C<SvPVbyte_nolen> macro.
162
163=cut
164*/
165
166char *
167Perl_sv_2pvbyte_nolen(pTHX_ register SV *sv)
168{
5336c895 169 return sv_2pvbyte(sv, NULL);
66067514
NC
170}
171
172/*
173=for apidoc sv_2pvutf8_nolen
174
175Return a pointer to the UTF-8-encoded representation of the SV.
176May cause the SV to be upgraded to UTF-8 as a side-effect.
177
178Usually accessed via the C<SvPVutf8_nolen> macro.
179
180=cut
181*/
182
183char *
184Perl_sv_2pvutf8_nolen(pTHX_ register SV *sv)
185{
5336c895 186 return sv_2pvutf8(sv, NULL);
66067514
NC
187}
188
189/*
05b233af
NC
190=for apidoc sv_force_normal
191
192Undo various types of fakery on an SV: if the PV is a shared string, make
193a private copy; if we're a ref, stop refing; if we're a glob, downgrade to
194an xpvmg. See also C<sv_force_normal_flags>.
195
196=cut
197*/
198
199void
200Perl_sv_force_normal(pTHX_ register SV *sv)
201{
202 sv_force_normal_flags(sv, 0);
203}
e3064a43
NC
204
205/* sv_setsv() is now a macro using Perl_sv_setsv_flags();
206 * this function provided for binary compatibility only
207 */
208
209void
210Perl_sv_setsv(pTHX_ SV *dstr, register SV *sstr)
211{
212 sv_setsv_flags(dstr, sstr, SV_GMAGIC);
213}
214
215/* sv_catpvn() is now a macro using Perl_sv_catpvn_flags();
216 * this function provided for binary compatibility only
217 */
218
219void
220Perl_sv_catpvn(pTHX_ SV *dsv, const char* sstr, STRLEN slen)
221{
222 sv_catpvn_flags(dsv, sstr, slen, SV_GMAGIC);
223}
224
66067514
NC
225/*
226=for apidoc sv_catpvn_mg
227
228Like C<sv_catpvn>, but also handles 'set' magic.
229
230=cut
231*/
232
233void
234Perl_sv_catpvn_mg(pTHX_ register SV *sv, register const char *ptr, register STRLEN len)
235{
236 sv_catpvn_flags(sv,ptr,len,SV_GMAGIC|SV_SMAGIC);
237}
238
e3064a43
NC
239/* sv_catsv() is now a macro using Perl_sv_catsv_flags();
240 * this function provided for binary compatibility only
241 */
242
243void
244Perl_sv_catsv(pTHX_ SV *dstr, register SV *sstr)
245{
246 sv_catsv_flags(dstr, sstr, SV_GMAGIC);
247}
248
05b233af 249/*
66067514
NC
250=for apidoc sv_catsv_mg
251
252Like C<sv_catsv>, but also handles 'set' magic.
253
254=cut
255*/
256
257void
258Perl_sv_catsv_mg(pTHX_ SV *dsv, register SV *ssv)
259{
260 sv_catsv_flags(dsv,ssv,SV_GMAGIC|SV_SMAGIC);
261}
262
263/*
05b233af
NC
264=for apidoc sv_iv
265
266A private implementation of the C<SvIVx> macro for compilers which can't
267cope with complex macro expressions. Always use the macro instead.
268
269=cut
270*/
271
272IV
273Perl_sv_iv(pTHX_ register SV *sv)
274{
275 if (SvIOK(sv)) {
276 if (SvIsUV(sv))
277 return (IV)SvUVX(sv);
278 return SvIVX(sv);
279 }
280 return sv_2iv(sv);
281}
282
283/*
284=for apidoc sv_uv
285
286A private implementation of the C<SvUVx> macro for compilers which can't
287cope with complex macro expressions. Always use the macro instead.
288
289=cut
290*/
291
292UV
293Perl_sv_uv(pTHX_ register SV *sv)
294{
295 if (SvIOK(sv)) {
296 if (SvIsUV(sv))
297 return SvUVX(sv);
298 return (UV)SvIVX(sv);
299 }
300 return sv_2uv(sv);
301}
302
303/*
304=for apidoc sv_nv
305
306A private implementation of the C<SvNVx> macro for compilers which can't
307cope with complex macro expressions. Always use the macro instead.
308
309=cut
310*/
311
312NV
313Perl_sv_nv(pTHX_ register SV *sv)
314{
315 if (SvNOK(sv))
316 return SvNVX(sv);
317 return sv_2nv(sv);
318}
319
320/*
321=for apidoc sv_pv
322
323Use the C<SvPV_nolen> macro instead
324
325=for apidoc sv_pvn
326
327A private implementation of the C<SvPV> macro for compilers which can't
328cope with complex macro expressions. Always use the macro instead.
329
330=cut
331*/
332
333char *
334Perl_sv_pvn(pTHX_ SV *sv, STRLEN *lp)
335{
336 if (SvPOK(sv)) {
337 *lp = SvCUR(sv);
338 return SvPVX(sv);
339 }
340 return sv_2pv(sv, lp);
341}
342
343
344char *
345Perl_sv_pvn_nomg(pTHX_ register SV *sv, STRLEN *lp)
346{
347 if (SvPOK(sv)) {
348 *lp = SvCUR(sv);
349 return SvPVX(sv);
350 }
351 return sv_2pv_flags(sv, lp, 0);
352}
353
e3064a43
NC
354/* sv_pv() is now a macro using SvPV_nolen();
355 * this function provided for binary compatibility only
356 */
357
358char *
359Perl_sv_pv(pTHX_ SV *sv)
360{
361 if (SvPOK(sv))
362 return SvPVX(sv);
363
5336c895 364 return sv_2pv(sv, NULL);
e3064a43
NC
365}
366
367/* sv_pvn_force() is now a macro using Perl_sv_pvn_force_flags();
368 * this function provided for binary compatibility only
369 */
370
371char *
372Perl_sv_pvn_force(pTHX_ SV *sv, STRLEN *lp)
373{
374 return sv_pvn_force_flags(sv, lp, SV_GMAGIC);
375}
376
377/* sv_pvbyte () is now a macro using Perl_sv_2pv_flags();
378 * this function provided for binary compatibility only
379 */
380
381char *
382Perl_sv_pvbyte(pTHX_ SV *sv)
383{
5336c895 384 sv_utf8_downgrade(sv, FALSE);
e3064a43
NC
385 return sv_pv(sv);
386}
387
05b233af
NC
388/*
389=for apidoc sv_pvbyte
390
391Use C<SvPVbyte_nolen> instead.
392
393=for apidoc sv_pvbyten
394
395A private implementation of the C<SvPVbyte> macro for compilers
396which can't cope with complex macro expressions. Always use the macro
397instead.
398
399=cut
400*/
401
402char *
403Perl_sv_pvbyten(pTHX_ SV *sv, STRLEN *lp)
404{
5336c895 405 sv_utf8_downgrade(sv, FALSE);
05b233af
NC
406 return sv_pvn(sv,lp);
407}
408
e3064a43
NC
409/* sv_pvutf8 () is now a macro using Perl_sv_2pv_flags();
410 * this function provided for binary compatibility only
411 */
412
413char *
414Perl_sv_pvutf8(pTHX_ SV *sv)
415{
416 sv_utf8_upgrade(sv);
417 return sv_pv(sv);
418}
419
420/*
05b233af
NC
421=for apidoc sv_pvutf8
422
423Use the C<SvPVutf8_nolen> macro instead
424
425=for apidoc sv_pvutf8n
426
427A private implementation of the C<SvPVutf8> macro for compilers
428which can't cope with complex macro expressions. Always use the macro
429instead.
430
431=cut
432*/
433
434char *
435Perl_sv_pvutf8n(pTHX_ SV *sv, STRLEN *lp)
436{
437 sv_utf8_upgrade(sv);
438 return sv_pvn(sv,lp);
439}
440
441/* sv_utf8_upgrade() is now a macro using sv_utf8_upgrade_flags();
442 * this function provided for binary compatibility only
443 */
444
445STRLEN
446Perl_sv_utf8_upgrade(pTHX_ register SV *sv)
447{
448 return sv_utf8_upgrade_flags(sv, SV_GMAGIC);
449}
450
e3064a43
NC
451int
452Perl_fprintf_nocontext(PerlIO *stream, const char *format, ...)
453{
454 dTHXs;
455 va_list(arglist);
456 va_start(arglist, format);
457 return PerlIO_vprintf(stream, format, arglist);
458}
459
460int
461Perl_printf_nocontext(const char *format, ...)
462{
463 dTHX;
464 va_list(arglist);
465 va_start(arglist, format);
466 return PerlIO_vprintf(PerlIO_stdout(), format, arglist);
467}
468
469#if defined(HUGE_VAL) || (defined(USE_LONG_DOUBLE) && defined(HUGE_VALL))
470/*
471 * This hack is to force load of "huge" support from libm.a
472 * So it is in perl for (say) POSIX to use.
473 * Needed for SunOS with Sun's 'acc' for example.
474 */
475NV
476Perl_huge(void)
477{
c01caf97 478# if defined(USE_LONG_DOUBLE) && defined(HUGE_VALL)
e3064a43 479 return HUGE_VALL;
c01caf97 480# else
e3064a43 481 return HUGE_VAL;
c01caf97 482# endif
e3064a43
NC
483}
484#endif
485
05b233af
NC
486/* compatibility with versions <= 5.003. */
487void
488Perl_gv_fullname(pTHX_ SV *sv, GV *gv)
489{
490 gv_fullname3(sv, gv, sv == (const SV*)gv ? "*" : "");
491}
492
493/* compatibility with versions <= 5.003. */
494void
495Perl_gv_efullname(pTHX_ SV *sv, GV *gv)
496{
497 gv_efullname3(sv, gv, sv == (const SV*)gv ? "*" : "");
498}
499
500void
501Perl_gv_fullname3(pTHX_ SV *sv, GV *gv, const char *prefix)
502{
503 gv_fullname4(sv, gv, prefix, TRUE);
504}
505
506void
507Perl_gv_efullname3(pTHX_ SV *sv, GV *gv, const char *prefix)
508{
509 gv_efullname4(sv, gv, prefix, TRUE);
510}
511
5082993f
NC
512/*
513=for apidoc gv_fetchmethod
514
515See L<gv_fetchmethod_autoload>.
516
517=cut
518*/
519
520GV *
521Perl_gv_fetchmethod(pTHX_ HV *stash, const char *name)
522{
523 return gv_fetchmethod_autoload(stash, name, TRUE);
524}
525
526HE *
527Perl_hv_iternext(pTHX_ HV *hv)
528{
529 return hv_iternext_flags(hv, 0);
530}
531
532void
533Perl_hv_magic(pTHX_ HV *hv, GV *gv, int how)
534{
0e2d6244 535 sv_magic((SV*)hv, (SV*)gv, how, NULL, 0);
5082993f
NC
536}
537
538#if 0 /* use the macro from hv.h instead */
539
540char*
541Perl_sharepvn(pTHX_ const char *sv, I32 len, U32 hash)
542{
543 return HEK_KEY(share_hek(sv, len, hash));
544}
545
546#endif
547
05b233af
NC
548AV *
549Perl_av_fake(pTHX_ register I32 size, register SV **strp)
550{
551 register SV** ary;
133cdda0 552 register AV * const av = (AV*)newSV(0);
05b233af
NC
553
554 sv_upgrade((SV *)av, SVt_PVAV);
555 Newx(ary,size+1,SV*);
556 AvALLOC(av) = ary;
557 Copy(strp,ary,size,SV*);
558 AvFLAGS(av) = AVf_REIFY;
559 SvPV_set(av, (char*)ary);
560 AvFILLp(av) = size - 1;
561 AvMAX(av) = size - 1;
562 while (size--) {
563 assert (*strp);
564 SvTEMP_off(*strp);
565 strp++;
566 }
567 return av;
568}
569
570bool
66067514
NC
571Perl_do_open(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
572 int rawmode, int rawperm, PerlIO *supplied_fp)
573{
574 return do_openn(gv, name, len, as_raw, rawmode, rawperm,
575 supplied_fp, (SV **) NULL, 0);
576}
577
578bool
05b233af
NC
579Perl_do_open9(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
580 int rawmode, int rawperm, PerlIO *supplied_fp, SV *svs,
581 I32 num_svs)
582{
583 PERL_UNUSED_ARG(num_svs);
584 return do_openn(gv, name, len, as_raw, rawmode, rawperm,
585 supplied_fp, &svs, 1);
586}
587
588int
589Perl_do_binmode(pTHX_ PerlIO *fp, int iotype, int mode)
590{
591 /* The old body of this is now in non-LAYER part of perlio.c
592 * This is a stub for any XS code which might have been calling it.
593 */
594 const char *name = ":raw";
595#ifdef PERLIO_USING_CRLF
596 if (!(mode & O_BINARY))
597 name = ":crlf";
598#endif
599 return PerlIO_binmode(aTHX_ fp, iotype, mode, name);
600}
601
66067514
NC
602#ifndef OS2
603bool
604Perl_do_aexec(pTHX_ SV *really, register SV **mark, register SV **sp)
605{
606 return do_aexec5(really, mark, sp, 0, 0);
607}
608#endif
609
610#ifdef PERL_DEFAULT_DO_EXEC3_IMPLEMENTATION
611bool
612Perl_do_exec(pTHX_ char *cmd)
613{
614 return do_exec3(cmd,0,0);
615}
616#endif
617
618#ifdef HAS_PIPE
619void
620Perl_do_pipe(pTHX_ SV *sv, GV *rgv, GV *wgv)
621{
622 register IO *rstio;
623 register IO *wstio;
624 int fd[2];
625
626 if (!rgv)
627 goto badexit;
628 if (!wgv)
629 goto badexit;
630
631 rstio = GvIOn(rgv);
632 wstio = GvIOn(wgv);
633
634 if (IoIFP(rstio))
635 do_close(rgv,FALSE);
636 if (IoIFP(wstio))
637 do_close(wgv,FALSE);
638
639 if (PerlProc_pipe(fd) < 0)
640 goto badexit;
641 IoIFP(rstio) = PerlIO_fdopen(fd[0], "r"PIPE_OPEN_MODE);
642 IoOFP(wstio) = PerlIO_fdopen(fd[1], "w"PIPE_OPEN_MODE);
643 IoOFP(rstio) = IoIFP(rstio);
644 IoIFP(wstio) = IoOFP(wstio);
645 IoTYPE(rstio) = IoTYPE_RDONLY;
646 IoTYPE(wstio) = IoTYPE_WRONLY;
647 if (!IoIFP(rstio) || !IoOFP(wstio)) {
648 if (IoIFP(rstio)) PerlIO_close(IoIFP(rstio));
649 else PerlLIO_close(fd[0]);
650 if (IoOFP(wstio)) PerlIO_close(IoOFP(wstio));
651 else PerlLIO_close(fd[1]);
652 goto badexit;
653 }
654
655 sv_setsv(sv,&PL_sv_yes);
656 return;
657
658badexit:
659 sv_setsv(sv,&PL_sv_undef);
660 return;
661}
662#endif
663
5082993f
NC
664/* Backwards compatibility. */
665int
666Perl_init_i18nl14n(pTHX_ int printwarn)
667{
668 return init_i18nl10n(printwarn);
669}
670
671/* XXX kept for BINCOMPAT only */
672void
673Perl_save_hints(pTHX)
674{
675 Perl_croak(aTHX_ "internal error: obsolete function save_hints() called");
676}
677
678#if 0
679OP *
680Perl_ck_retarget(pTHX_ OP *o)
681{
682 Perl_croak(aTHX_ "NOT IMPL LINE %d",__LINE__);
683 /* STUB */
684 return o;
685}
686#endif
687
688OP *
689Perl_oopsCV(pTHX_ OP *o)
690{
691 Perl_croak(aTHX_ "NOT IMPL LINE %d",__LINE__);
692 /* STUB */
693 PERL_UNUSED_ARG(o);
694 NORETURN_FUNCTION_END;
695}
696
697PP(pp_padany)
698{
699 DIE(aTHX_ "NOT IMPL LINE %d",__LINE__);
700}
701
702PP(pp_threadsv)
703{
704#ifdef USE_5005THREADS
705 dSP;
706 EXTEND(SP, 1);
707 if (PL_op->op_private & OPpLVAL_INTRO)
708 PUSHs(*save_threadsv(PL_op->op_targ));
709 else
710 PUSHs(THREADSV(PL_op->op_targ));
711 RETURN;
712#else
713 DIE(aTHX_ "tried to access per-thread data in non-threaded perl");
714#endif /* USE_5005THREADS */
715}
716
717PP(pp_mapstart)
718{
719 DIE(aTHX_ "panic: mapstart"); /* uses grepstart */
720}
721
4f922d08
AL
722/* These ops all have the same body as pp_null. */
723PP(pp_scalar)
5082993f 724{
4f922d08
AL
725 return NORMAL;
726}
727
728PP(pp_regcmaybe)
729{
730 return NORMAL;
731}
732
733PP(pp_lineseq)
734{
735 return NORMAL;
736}
737
738PP(pp_scope)
739{
740 return NORMAL;
741}
742
743/* Ops that are calls to do_kv. */
744PP(pp_values)
745{
746 return do_kv();
747}
748
749PP(pp_keys)
750{
751 return do_kv();
752}
753
754/* Ops that are simply calls to other ops. */
755PP(pp_dump)
756{
757 return pp_goto();
758 /*NOTREACHED*/
759}
760
761PP(pp_dofile)
762{
763 return pp_require();
764}
765
766PP(pp_dbmclose)
767{
768 return pp_untie();
769}
770
771PP(pp_read)
772{
773 return pp_sysread();
774}
775
776PP(pp_recv)
777{
778 return pp_sysread();
779}
780
781PP(pp_seek)
782{
783 return pp_sysseek();
784}
785
786PP(pp_fcntl)
787{
788 return pp_ioctl();
789}
790
791PP(pp_gsockopt)
792{
793 return pp_ssockopt();
794}
795
796PP(pp_getsockname)
797{
798 return pp_getpeername();
799}
800
801PP(pp_lstat)
802{
803 return pp_stat();
804}
805
806PP(pp_fteowned)
807{
808 return pp_ftrowned();
809}
810
811PP(pp_ftbinary)
812{
813 return pp_fttext();
814}
815
816PP(pp_localtime)
817{
818 return pp_gmtime();
819}
820
821PP(pp_shmget)
822{
823 return pp_semget();
824}
825
826PP(pp_shmctl)
827{
828 return pp_semctl();
829}
830
831PP(pp_shmread)
832{
833 return pp_shmwrite();
834}
835
836PP(pp_msgget)
837{
838 return pp_semget();
839}
840
841PP(pp_msgctl)
842{
843 return pp_semctl();
844}
845
846PP(pp_ghbyname)
847{
848 return pp_ghostent();
849}
850
851PP(pp_ghbyaddr)
852{
853 return pp_ghostent();
854}
855
856PP(pp_gnbyname)
857{
858 return pp_gnetent();
859}
860
861PP(pp_gnbyaddr)
862{
863 return pp_gnetent();
864}
865
866PP(pp_gpbyname)
867{
868 return pp_gprotoent();
869}
870
871PP(pp_gpbynumber)
872{
873 return pp_gprotoent();
874}
875
876PP(pp_gsbyname)
877{
878 return pp_gservent();
879}
880
881PP(pp_gsbyport)
882{
883 return pp_gservent();
884}
885
886PP(pp_gpwnam)
887{
888 return pp_gpwent();
889}
890
891PP(pp_gpwuid)
892{
893 return pp_gpwent();
894}
895
896PP(pp_ggrnam)
897{
898 return pp_ggrent();
899}
900
901PP(pp_ggrgid)
902{
903 return pp_ggrent();
904}
905
906PP(pp_ftsize)
907{
908 return pp_ftis();
909}
910
911PP(pp_ftmtime)
912{
913 return pp_ftis();
914}
915
916PP(pp_ftatime)
917{
918 return pp_ftis();
919}
920
921PP(pp_ftctime)
922{
923 return pp_ftis();
924}
925
926PP(pp_ftzero)
927{
928 return pp_ftrowned();
929}
930
931PP(pp_ftsock)
932{
933 return pp_ftrowned();
934}
935
936PP(pp_ftchr)
937{
938 return pp_ftrowned();
939}
940
941PP(pp_ftblk)
942{
943 return pp_ftrowned();
944}
945
946PP(pp_ftfile)
947{
948 return pp_ftrowned();
949}
950
951PP(pp_ftdir)
952{
953 return pp_ftrowned();
954}
955
956PP(pp_ftpipe)
957{
958 return pp_ftrowned();
959}
960
961PP(pp_ftsuid)
962{
963 return pp_ftrowned();
964}
965
966PP(pp_ftsgid)
967{
968 return pp_ftrowned();
969}
970
971PP(pp_ftsvtx)
972{
973 return pp_ftrowned();
974}
975
976PP(pp_unlink)
977{
978 return pp_chown();
979}
980
981PP(pp_chmod)
982{
983 return pp_chown();
984}
985
986PP(pp_utime)
987{
988 return pp_chown();
989}
990
991PP(pp_kill)
992{
993 return pp_chown();
994}
995
996PP(pp_symlink)
997{
998 return pp_link();
5082993f
NC
999}
1000
4fbce521
NC
1001PP(pp_ftrwrite)
1002{
1003 return pp_ftrread();
1004}
1005
1006PP(pp_ftrexec)
1007{
1008 return pp_ftrread();
1009}
1010
1011PP(pp_fteread)
1012{
1013 return pp_ftrread();
1014}
1015
1016PP(pp_ftewrite)
1017{
1018 return pp_ftrread();
1019}
1020
1021PP(pp_fteexec)
1022{
1023 return pp_ftrread();
1024}
1025
1026PP(pp_msgsnd)
1027{
1028 return pp_shmwrite();
1029}
1030
1031PP(pp_msgrcv)
1032{
1033 return pp_shmwrite();
1034}
1035
1036PP(pp_syswrite)
1037{
1038 return pp_send();
1039}
1040
1041PP(pp_semop)
1042{
1043 return pp_shmwrite();
1044}
1045
35273943
AL
1046PP(pp_andassign)
1047{
1048 return pp_and();
1049}
1050
1051PP(pp_orassign)
1052{
1053 return pp_or();
1054}
1055
1056PP(pp_lcfirst)
1057{
1058 return pp_ucfirst();
1059}
1060
c01caf97
NC
1061PP(pp_slt)
1062{
1063 return pp_sle();
1064}
1065
1066PP(pp_sgt)
1067{
1068 return pp_sle();
1069}
1070
1071PP(pp_sge)
1072{
1073 return pp_sle();
1074}
1075
1076PP(pp_rindex)
1077{
1078 return pp_index();
1079}
1080
1081PP(pp_hex)
1082{
1083 return pp_oct();
1084}
1085
1086PP(pp_pop)
1087{
1088 return pp_shift();
1089}
1090
1091PP(pp_cos)
1092{
1093 return pp_sin();
1094}
1095
1096PP(pp_exp)
1097{
1098 return pp_sin();
1099}
1100
1101PP(pp_log)
1102{
1103 return pp_sin();
1104}
1105
1106PP(pp_sqrt)
1107{
1108 return pp_sin();
1109}
1110
b21e3693
NC
1111PP(pp_bit_xor)
1112{
1113 return pp_bit_or();
1114}
1115
8a4903e5
NC
1116PP(pp_rv2hv)
1117{
1118 return Perl_pp_rv2av(aTHX);
1119}
1120
5082993f
NC
1121U8 *
1122Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv)
1123{
1124 return Perl_uvuni_to_utf8_flags(aTHX_ d, uv, 0);
1125}
1126
4f922d08
AL
1127bool
1128Perl_is_utf8_string_loc(pTHX_ U8 *s, STRLEN len, U8 **ep)
1129{
1130 return is_utf8_string_loclen(s, len, (const U8 **)ep, 0);
1131}
1132
5082993f
NC
1133/*
1134=for apidoc sv_nolocking
1135
1136Dummy routine which "locks" an SV when there is no locking module present.
1137Exists to avoid test for a NULL function pointer and because it could
1138potentially warn under some level of strict-ness.
1139
1140"Superseded" by sv_nosharing().
1141
1142=cut
1143*/
1144
1145void
1146Perl_sv_nolocking(pTHX_ SV *sv)
1147{
1e7ed80e 1148 PERL_UNUSED_CONTEXT;
5082993f
NC
1149 PERL_UNUSED_ARG(sv);
1150}
1151
1152
1153/*
1154=for apidoc sv_nounlocking
1155
1156Dummy routine which "unlocks" an SV when there is no locking module present.
1157Exists to avoid test for a NULL function pointer and because it could
1158potentially warn under some level of strict-ness.
1159
1160"Superseded" by sv_nosharing().
1161
1162=cut
1163*/
1164
1165void
1166Perl_sv_nounlocking(pTHX_ SV *sv)
1167{
1e7ed80e 1168 PERL_UNUSED_CONTEXT;
5082993f
NC
1169 PERL_UNUSED_ARG(sv);
1170}
1171
c01caf97
NC
1172void
1173Perl_save_long(pTHX_ long int *longp)
1174{
1175 SSCHECK(3);
1176 SSPUSHLONG(*longp);
1177 SSPUSHPTR(longp);
1178 SSPUSHINT(SAVEt_LONG);
1179}
1180
1181void
1182Perl_save_I16(pTHX_ I16 *intp)
1183{
1184 SSCHECK(3);
1185 SSPUSHINT(*intp);
1186 SSPUSHPTR(intp);
1187 SSPUSHINT(SAVEt_I16);
1188}
1189
1190void
c01caf97
NC
1191Perl_save_iv(pTHX_ IV *ivp)
1192{
1193 SSCHECK(3);
1194 SSPUSHIV(*ivp);
1195 SSPUSHPTR(ivp);
1196 SSPUSHINT(SAVEt_IV);
1197}
1198
1199void
1200Perl_save_nogv(pTHX_ GV *gv)
1201{
1202 SSCHECK(2);
1203 SSPUSHPTR(gv);
1204 SSPUSHINT(SAVEt_NSTAB);
1205}
1206
1207void
1208Perl_save_list(pTHX_ register SV **sarg, I32 maxsarg)
1209{
1210 register I32 i;
1211
1212 for (i = 1; i <= maxsarg; i++) {
1213 register SV * const sv = newSV(0);
1214 sv_setsv(sv,sarg[i]);
1215 SSCHECK(3);
1216 SSPUSHPTR(sarg[i]); /* remember the pointer */
1217 SSPUSHPTR(sv); /* remember the value */
1218 SSPUSHINT(SAVEt_ITEM);
1219 }
1220}
1221
820b8518 1222/*
26623adb
NC
1223=for apidoc sv_usepvn_mg
1224
1225Like C<sv_usepvn>, but also handles 'set' magic.
1226
1227=cut
1228*/
1229
1230void
1231Perl_sv_usepvn_mg(pTHX_ SV *sv, char *ptr, STRLEN len)
1232{
1233 sv_usepvn_flags(sv,ptr,len, SV_SMAGIC);
1234}
1235
1236/*
1237=for apidoc sv_usepvn
1238
1239Tells an SV to use C<ptr> to find its string value. Implemented by
1240calling C<sv_usepvn_flags> with C<flags> of 0, hence does not handle 'set'
1241magic. See C<sv_usepvn_flags>.
1242
1243=cut
1244*/
1245
1246void
1247Perl_sv_usepvn(pTHX_ SV *sv, char *ptr, STRLEN len)
1248{
1249 sv_usepvn_flags(sv,ptr,len, 0);
1250}
1251
34a11f14
NC
1252void
1253Perl_cv_ckproto(pTHX_ CV *cv, GV *gv, char *p)
1254{
1255 cv_ckproto_len(cv, gv, p, p ? strlen(p) : 0);
1256}
1257
26623adb 1258/*
820b8518
NC
1259=for apidoc unpack_str
1260
1261The engine implementing unpack() Perl function. Note: parameters strbeg, new_s
1262and ocnt are not used. This call should not be used, use unpackstring instead.
1263
1264=cut */
1265
1266I32
970ba7cf
NC
1267Perl_unpack_str(pTHX_ char *pat, char *patend, char *s, char *strbeg,
1268 char *strend, char **new_s, I32 ocnt, U32 flags)
820b8518
NC
1269{
1270 PERL_UNUSED_ARG(strbeg);
1271 PERL_UNUSED_ARG(new_s);
1272 PERL_UNUSED_ARG(ocnt);
1273
1274 return unpackstring(pat, patend, s, strend, flags);
1275}
145ab0cc 1276
85f565a8
NC
1277/*
1278=for apidoc pack_cat
1279
1280The engine implementing pack() Perl function. Note: parameters next_in_list and
1281flags are not used. This call should not be used; use packlist instead.
1282
1283=cut
1284*/
1285
1286void
1287Perl_pack_cat(pTHX_ SV *cat, char *pat, char *patend, register SV **beglist, SV **endlist, SV ***next_in_list, U32 flags)
1288{
1289 PERL_UNUSED_ARG(next_in_list);
1290 PERL_UNUSED_ARG(flags);
1291
1292 packlist(cat, pat, patend, beglist, endlist);
1293}
1294
6c3d4c35 1295bool
145ab0cc
NC
1296/* Whilst this should really be STATIC, it was not in 5.8.7, hence something
1297 may have linked against it. */
145ab0cc
NC
1298S_vdie_common(pTHX_ const char *message, STRLEN msglen, I32 utf8)
1299{
6c3d4c35 1300 return FALSE;
145ab0cc 1301}
4fbce521
NC
1302#endif /* NO_MATHOMS */
1303
e3064a43
NC
1304/*
1305 * Local variables:
1306 * c-indentation-style: bsd
1307 * c-basic-offset: 4
1308 * indent-tabs-mode: t
1309 * End:
1310 *
1311 * ex: set ts=8 sts=4 sw=4 noet:
1312 */