This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update the hash documentation to reflect the changes between 5.8.1 and
[perl5.git] / mathoms.c
CommitLineData
7ee2227d
SP
1/* mathoms.c
2 *
663f364b 3 * Copyright (C) 2005, 2006, 2007, 2007, by Larry Wall and others
7ee2227d
SP
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
20fac488
GA
17#ifndef NO_MATHOMS
18
7ee2227d
SP
19/*
20 * This file contains mathoms, various binary artifacts from previous
f2f0f092
NC
21 * versions of Perl. For binary or source compatibility reasons, though,
22 * we cannot completely remove them from the core code.
7ee2227d
SP
23 *
24 * SMP - Oct. 24, 2005
25 *
26 */
27
28#include "EXTERN.h"
29#define PERL_IN_MATHOMS_C
30#include "perl.h"
31
a0c21aa1
JH
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, const GV *gv, const char *prefix);
54PERL_CALLCONV void Perl_gv_efullname3(pTHX_ SV *sv, const 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 const 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_ const char *cmd);
61PERL_CALLCONV U8 * Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv);
62PERL_CALLCONV bool Perl_is_utf8_string_loc(pTHX_ const U8 *s, STRLEN len, const 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, ...);
56d7a086 68PERL_CALLCONV int Perl_magic_setglob(pTHX_ SV* sv, MAGIC* mg);
ac572bf4 69PERL_CALLCONV AV * Perl_newAV(pTHX);
78ac7dd9 70PERL_CALLCONV HV * Perl_newHV(pTHX);
b5445a23 71
7ee2227d
SP
72/* ref() is now a macro using Perl_doref;
73 * this version provided for binary compatibility only.
74 */
75OP *
76Perl_ref(pTHX_ OP *o, I32 type)
77{
78 return doref(o, type, TRUE);
79}
80
aae9cea0 81/*
174c73e3
NC
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/*
aae9cea0
NC
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{
a0714e2c 108 sv_magic((sv), NULL, PERL_MAGIC_taint, NULL, 0);
aae9cea0
NC
109}
110
7ee2227d
SP
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
5abc721d 141/*
cb2f1b7b
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{
b5445a23 152 return sv_2pv(sv, NULL);
cb2f1b7b
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{
b5445a23 169 return sv_2pvbyte(sv, NULL);
cb2f1b7b
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{
b5445a23 186 return sv_2pvutf8(sv, NULL);
cb2f1b7b
NC
187}
188
189/*
5abc721d
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}
7ee2227d
SP
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
b347df82
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
7ee2227d
SP
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
0feed65a 249/*
b347df82
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/*
0feed65a
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
7ee2227d
SP
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
b5445a23 364 return sv_2pv(sv, NULL);
7ee2227d
SP
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{
b5445a23 384 sv_utf8_downgrade(sv, FALSE);
7ee2227d
SP
385 return sv_pv(sv);
386}
387
0feed65a
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{
b5445a23 405 sv_utf8_downgrade(sv, FALSE);
0feed65a
NC
406 return sv_pvn(sv,lp);
407}
408
7ee2227d
SP
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
0feed65a
NC
420/*
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
205c02c2
NC
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
7ee2227d
SP
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{
c773ee7a 478# if defined(USE_LONG_DOUBLE) && defined(HUGE_VALL)
7ee2227d 479 return HUGE_VALL;
c773ee7a 480# else
7ee2227d 481 return HUGE_VAL;
c773ee7a 482# endif
7ee2227d
SP
483}
484#endif
485
f2f0f092
NC
486/* compatibility with versions <= 5.003. */
487void
488Perl_gv_fullname(pTHX_ SV *sv, const GV *gv)
489{
666ea192 490 gv_fullname3(sv, gv, sv == (const SV*)gv ? "*" : "");
f2f0f092
NC
491}
492
493/* compatibility with versions <= 5.003. */
494void
495Perl_gv_efullname(pTHX_ SV *sv, const GV *gv)
496{
666ea192 497 gv_efullname3(sv, gv, sv == (const SV*)gv ? "*" : "");
f2f0f092
NC
498}
499
2674aeec
NC
500void
501Perl_gv_fullname3(pTHX_ SV *sv, const GV *gv, const char *prefix)
502{
503 gv_fullname4(sv, gv, prefix, TRUE);
504}
505
506void
507Perl_gv_efullname3(pTHX_ SV *sv, const GV *gv, const char *prefix)
508{
509 gv_efullname4(sv, gv, prefix, TRUE);
510}
511
887986eb
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
7a7b9979
NC
526HE *
527Perl_hv_iternext(pTHX_ HV *hv)
528{
529 return hv_iternext_flags(hv, 0);
530}
531
bc5cdc23
NC
532void
533Perl_hv_magic(pTHX_ HV *hv, GV *gv, int how)
534{
bd61b366 535 sv_magic((SV*)hv, (SV*)gv, how, NULL, 0);
bc5cdc23
NC
536}
537
b966a812
SP
538AV *
539Perl_av_fake(pTHX_ register I32 size, register SV **strp)
540{
541 register SV** ary;
b9f83d2f 542 register AV * const av = (AV*)newSV_type(SVt_PVAV);
b966a812
SP
543 Newx(ary,size+1,SV*);
544 AvALLOC(av) = ary;
545 Copy(strp,ary,size,SV*);
546 AvREIFY_only(av);
9c6bc640 547 AvARRAY(av) = ary;
b966a812
SP
548 AvFILLp(av) = size - 1;
549 AvMAX(av) = size - 1;
550 while (size--) {
551 assert (*strp);
552 SvTEMP_off(*strp);
553 strp++;
554 }
555 return av;
556}
557
34d367cd 558bool
e4dba786
NC
559Perl_do_open(pTHX_ GV *gv, register const char *name, I32 len, int as_raw,
560 int rawmode, int rawperm, PerlIO *supplied_fp)
561{
562 return do_openn(gv, name, len, as_raw, rawmode, rawperm,
563 supplied_fp, (SV **) NULL, 0);
564}
565
566bool
34d367cd
SP
567Perl_do_open9(pTHX_ GV *gv, register const char *name, I32 len, int
568as_raw,
569 int rawmode, int rawperm, PerlIO *supplied_fp, SV *svs,
570 I32 num_svs)
571{
572 PERL_UNUSED_ARG(num_svs);
573 return do_openn(gv, name, len, as_raw, rawmode, rawperm,
574 supplied_fp, &svs, 1);
575}
576
577int
578Perl_do_binmode(pTHX_ PerlIO *fp, int iotype, int mode)
579{
580 /* The old body of this is now in non-LAYER part of perlio.c
581 * This is a stub for any XS code which might have been calling it.
582 */
583 const char *name = ":raw";
584#ifdef PERLIO_USING_CRLF
585 if (!(mode & O_BINARY))
586 name = ":crlf";
587#endif
588 return PerlIO_binmode(aTHX_ fp, iotype, mode, name);
589}
590
a9f96b3f
NC
591#ifndef OS2
592bool
593Perl_do_aexec(pTHX_ SV *really, register SV **mark, register SV **sp)
594{
595 return do_aexec5(really, mark, sp, 0, 0);
596}
597#endif
598
9555a685
NC
599#ifdef PERL_DEFAULT_DO_EXEC3_IMPLEMENTATION
600bool
601Perl_do_exec(pTHX_ const char *cmd)
602{
603 return do_exec3(cmd,0,0);
604}
605#endif
606
89552e80
NC
607/* Backwards compatibility. */
608int
609Perl_init_i18nl14n(pTHX_ int printwarn)
610{
611 return init_i18nl10n(printwarn);
612}
613
c78ff979
NC
614OP *
615Perl_oopsCV(pTHX_ OP *o)
616{
617 Perl_croak(aTHX_ "NOT IMPL LINE %d",__LINE__);
618 /* STUB */
619 PERL_UNUSED_ARG(o);
620 NORETURN_FUNCTION_END;
621}
622
623PP(pp_padany)
624{
625 DIE(aTHX_ "NOT IMPL LINE %d",__LINE__);
c78ff979
NC
626}
627
628PP(pp_mapstart)
629{
630 DIE(aTHX_ "panic: mapstart"); /* uses grepstart */
631}
632
0b612f93
NC
633/* These ops all have the same body as pp_null. */
634PP(pp_scalar)
635{
97aff369 636 dVAR;
0b612f93
NC
637 return NORMAL;
638}
639
640PP(pp_regcmaybe)
641{
97aff369 642 dVAR;
0b612f93
NC
643 return NORMAL;
644}
645
646PP(pp_lineseq)
647{
97aff369 648 dVAR;
0b612f93
NC
649 return NORMAL;
650}
651
652PP(pp_scope)
653{
97aff369 654 dVAR;
0b612f93
NC
655 return NORMAL;
656}
657
658/* Ops that are calls to do_kv. */
659PP(pp_values)
660{
661 return do_kv();
662}
663
664PP(pp_keys)
665{
666 return do_kv();
667}
668
669/* Ops that are simply calls to other ops. */
670PP(pp_dump)
671{
672 return pp_goto();
673 /*NOTREACHED*/
674}
675
676PP(pp_dofile)
677{
678 return pp_require();
679}
680
681PP(pp_dbmclose)
682{
683 return pp_untie();
684}
685
686PP(pp_read)
687{
688 return pp_sysread();
689}
690
691PP(pp_recv)
692{
693 return pp_sysread();
694}
695
696PP(pp_seek)
697{
698 return pp_sysseek();
699}
700
701PP(pp_fcntl)
702{
703 return pp_ioctl();
704}
705
706PP(pp_gsockopt)
707{
708 return pp_ssockopt();
709}
710
711PP(pp_getsockname)
712{
713 return pp_getpeername();
714}
715
716PP(pp_lstat)
717{
718 return pp_stat();
719}
720
721PP(pp_fteowned)
722{
723 return pp_ftrowned();
724}
725
726PP(pp_ftbinary)
727{
728 return pp_fttext();
729}
730
731PP(pp_localtime)
732{
733 return pp_gmtime();
734}
735
736PP(pp_shmget)
737{
738 return pp_semget();
739}
740
741PP(pp_shmctl)
742{
743 return pp_semctl();
744}
745
746PP(pp_shmread)
747{
748 return pp_shmwrite();
749}
750
751PP(pp_msgget)
752{
753 return pp_semget();
754}
755
756PP(pp_msgctl)
757{
758 return pp_semctl();
759}
760
761PP(pp_ghbyname)
762{
763 return pp_ghostent();
764}
765
766PP(pp_ghbyaddr)
767{
768 return pp_ghostent();
769}
770
771PP(pp_gnbyname)
772{
773 return pp_gnetent();
774}
775
776PP(pp_gnbyaddr)
777{
778 return pp_gnetent();
779}
780
781PP(pp_gpbyname)
782{
783 return pp_gprotoent();
784}
785
786PP(pp_gpbynumber)
787{
788 return pp_gprotoent();
789}
790
791PP(pp_gsbyname)
792{
793 return pp_gservent();
794}
795
796PP(pp_gsbyport)
797{
798 return pp_gservent();
799}
800
801PP(pp_gpwnam)
802{
803 return pp_gpwent();
804}
805
806PP(pp_gpwuid)
807{
808 return pp_gpwent();
809}
810
811PP(pp_ggrnam)
812{
813 return pp_ggrent();
814}
815
816PP(pp_ggrgid)
817{
818 return pp_ggrent();
819}
820
957b0e1d
NC
821PP(pp_ftsize)
822{
4992681b 823 return pp_ftis();
957b0e1d
NC
824}
825
826PP(pp_ftmtime)
827{
4992681b 828 return pp_ftis();
957b0e1d
NC
829}
830
831PP(pp_ftatime)
832{
4992681b 833 return pp_ftis();
957b0e1d
NC
834}
835
836PP(pp_ftctime)
837{
4992681b 838 return pp_ftis();
957b0e1d
NC
839}
840
f1cb2d48
NC
841PP(pp_ftzero)
842{
843 return pp_ftrowned();
844}
845
846PP(pp_ftsock)
847{
848 return pp_ftrowned();
849}
850
851PP(pp_ftchr)
852{
853 return pp_ftrowned();
854}
855
856PP(pp_ftblk)
857{
858 return pp_ftrowned();
859}
860
861PP(pp_ftfile)
862{
863 return pp_ftrowned();
864}
865
866PP(pp_ftdir)
867{
868 return pp_ftrowned();
869}
870
871PP(pp_ftpipe)
872{
873 return pp_ftrowned();
874}
875
17ad201a
NC
876PP(pp_ftsuid)
877{
878 return pp_ftrowned();
879}
880
881PP(pp_ftsgid)
882{
883 return pp_ftrowned();
884}
885
886PP(pp_ftsvtx)
887{
888 return pp_ftrowned();
889}
890
605b9385
NC
891PP(pp_unlink)
892{
893 return pp_chown();
894}
895
896PP(pp_chmod)
897{
898 return pp_chown();
899}
900
901PP(pp_utime)
902{
903 return pp_chown();
904}
905
906PP(pp_kill)
907{
908 return pp_chown();
909}
910
ce6987d0
NC
911PP(pp_symlink)
912{
913 return pp_link();
914}
915
af9e49b4
NC
916PP(pp_ftrwrite)
917{
918 return pp_ftrread();
919}
920
921PP(pp_ftrexec)
922{
923 return pp_ftrread();
924}
925
926PP(pp_fteread)
927{
928 return pp_ftrread();
929}
930
931PP(pp_ftewrite)
932{
933 return pp_ftrread();
934}
935
936PP(pp_fteexec)
937{
938 return pp_ftrread();
939}
940
c9f7ac20
NC
941PP(pp_msgsnd)
942{
943 return pp_shmwrite();
944}
945
946PP(pp_msgrcv)
947{
948 return pp_shmwrite();
949}
950
64a1bc8e
NC
951PP(pp_syswrite)
952{
953 return pp_send();
954}
955
ca563b4e
NC
956PP(pp_semop)
957{
958 return pp_shmwrite();
959}
960
25a55bd7
SP
961PP(pp_dor)
962{
f6a64177 963 return pp_defined();
25a55bd7
SP
964}
965
c960fc3b
SP
966PP(pp_andassign)
967{
968 return pp_and();
969}
970
971PP(pp_orassign)
972{
973 return pp_or();
974}
975
976PP(pp_dorassign)
977{
978 return pp_defined();
979}
980
12e9c124
NC
981PP(pp_lcfirst)
982{
983 return pp_ucfirst();
984}
985
afd9910b
NC
986PP(pp_slt)
987{
988 return pp_sle();
989}
990
991PP(pp_sgt)
992{
993 return pp_sle();
994}
995
996PP(pp_sge)
997{
998 return pp_sle();
999}
1000
2723d216
NC
1001PP(pp_rindex)
1002{
1003 return pp_index();
1004}
1005
daa2adfd
NC
1006PP(pp_hex)
1007{
1008 return pp_oct();
1009}
1010
789b4bc9
NC
1011PP(pp_pop)
1012{
1013 return pp_shift();
1014}
1015
71302fe3
NC
1016PP(pp_cos)
1017{
1018 return pp_sin();
1019}
1020
1021PP(pp_exp)
1022{
1023 return pp_sin();
1024}
1025
1026PP(pp_log)
1027{
1028 return pp_sin();
1029}
1030
1031PP(pp_sqrt)
1032{
1033 return pp_sin();
1034}
1035
3658c1f1
NC
1036PP(pp_bit_xor)
1037{
1038 return pp_bit_or();
1039}
1040
17ab7946
NC
1041PP(pp_rv2hv)
1042{
1043 return Perl_pp_rv2av(aTHX);
1044}
1045
038e8d3c
NC
1046U8 *
1047Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv)
1048{
1049 return Perl_uvuni_to_utf8_flags(aTHX_ d, uv, 0);
1050}
1051
814fafa7
NC
1052bool
1053Perl_is_utf8_string_loc(pTHX_ const U8 *s, STRLEN len, const U8 **ep)
1054{
1055 return is_utf8_string_loclen(s, len, ep, 0);
1056}
1057
7ee2227d 1058/*
d5b2b27b
NC
1059=for apidoc sv_nolocking
1060
1061Dummy routine which "locks" an SV when there is no locking module present.
1062Exists to avoid test for a NULL function pointer and because it could
1063potentially warn under some level of strict-ness.
1064
1065"Superseded" by sv_nosharing().
1066
1067=cut
1068*/
1069
1070void
1071Perl_sv_nolocking(pTHX_ SV *sv)
1072{
96a5add6 1073 PERL_UNUSED_CONTEXT;
d5b2b27b
NC
1074 PERL_UNUSED_ARG(sv);
1075}
1076
1077
1078/*
1079=for apidoc sv_nounlocking
1080
1081Dummy routine which "unlocks" an SV when there is no locking module present.
1082Exists to avoid test for a NULL function pointer and because it could
1083potentially warn under some level of strict-ness.
1084
1085"Superseded" by sv_nosharing().
1086
1087=cut
1088*/
1089
1090void
1091Perl_sv_nounlocking(pTHX_ SV *sv)
1092{
96a5add6 1093 PERL_UNUSED_CONTEXT;
d5b2b27b
NC
1094 PERL_UNUSED_ARG(sv);
1095}
1096
2053acbf
NC
1097void
1098Perl_save_long(pTHX_ long int *longp)
1099{
1100 dVAR;
1101 SSCHECK(3);
1102 SSPUSHLONG(*longp);
1103 SSPUSHPTR(longp);
1104 SSPUSHINT(SAVEt_LONG);
1105}
1106
1107void
2053acbf
NC
1108Perl_save_iv(pTHX_ IV *ivp)
1109{
1110 dVAR;
1111 SSCHECK(3);
1112 SSPUSHIV(*ivp);
1113 SSPUSHPTR(ivp);
1114 SSPUSHINT(SAVEt_IV);
1115}
1116
1117void
1118Perl_save_nogv(pTHX_ GV *gv)
1119{
1120 dVAR;
1121 SSCHECK(2);
1122 SSPUSHPTR(gv);
1123 SSPUSHINT(SAVEt_NSTAB);
1124}
1125
1126void
1127Perl_save_list(pTHX_ register SV **sarg, I32 maxsarg)
1128{
1129 dVAR;
1130 register I32 i;
1131
1132 for (i = 1; i <= maxsarg; i++) {
1133 register SV * const sv = newSV(0);
1134 sv_setsv(sv,sarg[i]);
1135 SSCHECK(3);
1136 SSPUSHPTR(sarg[i]); /* remember the pointer */
1137 SSPUSHPTR(sv); /* remember the value */
1138 SSPUSHINT(SAVEt_ITEM);
1139 }
1140}
1141
47518d95
NC
1142/*
1143=for apidoc sv_usepvn_mg
1144
1145Like C<sv_usepvn>, but also handles 'set' magic.
1146
1147=cut
1148*/
1149
1150void
1151Perl_sv_usepvn_mg(pTHX_ SV *sv, char *ptr, STRLEN len)
1152{
1153 sv_usepvn_flags(sv,ptr,len, SV_SMAGIC);
1154}
1155
1156/*
1157=for apidoc sv_usepvn
1158
1159Tells an SV to use C<ptr> to find its string value. Implemented by
1160calling C<sv_usepvn_flags> with C<flags> of 0, hence does not handle 'set'
1161magic. See C<sv_usepvn_flags>.
1162
1163=cut
1164*/
1165
1166void
1167Perl_sv_usepvn(pTHX_ SV *sv, char *ptr, STRLEN len)
1168{
1169 sv_usepvn_flags(sv,ptr,len, 0);
1170}
1171
cbf82dd0
NC
1172void
1173Perl_cv_ckproto(pTHX_ const CV *cv, const GV *gv, const char *p)
1174{
1175 cv_ckproto_len(cv, gv, p, p ? strlen(p) : 0);
1176}
c03e83bf
NC
1177
1178/*
1179=for apidoc unpack_str
1180
1181The engine implementing unpack() Perl function. Note: parameters strbeg, new_s
1182and ocnt are not used. This call should not be used, use unpackstring instead.
1183
1184=cut */
1185
1186I32
1187Perl_unpack_str(pTHX_ const char *pat, const char *patend, const char *s,
1188 const char *strbeg, const char *strend, char **new_s, I32 ocnt,
1189 U32 flags)
1190{
1191 PERL_UNUSED_ARG(strbeg);
1192 PERL_UNUSED_ARG(new_s);
1193 PERL_UNUSED_ARG(ocnt);
1194
1195 return unpackstring(pat, patend, s, strend, flags);
1196}
b47163a2
NC
1197
1198/*
1199=for apidoc pack_cat
1200
1201The engine implementing pack() Perl function. Note: parameters next_in_list and
1202flags are not used. This call should not be used; use packlist instead.
1203
1204=cut
1205*/
1206
1207void
1208Perl_pack_cat(pTHX_ SV *cat, const char *pat, const char *patend, register SV **beglist, SV **endlist, SV ***next_in_list, U32 flags)
1209{
1210 PERL_UNUSED_ARG(next_in_list);
1211 PERL_UNUSED_ARG(flags);
1212
1213 packlist(cat, pat, patend, beglist, endlist);
1214}
4c2df08c
NC
1215
1216HE *
1217Perl_hv_store_ent(pTHX_ HV *hv, SV *keysv, SV *val, U32 hash)
1218{
59af68cc 1219 return (HE *)hv_common(hv, keysv, NULL, 0, 0, HV_FETCH_ISSTORE, val, hash);
4c2df08c
NC
1220}
1221
1222bool
1223Perl_hv_exists_ent(pTHX_ HV *hv, SV *keysv, U32 hash)
1224{
1225 return hv_common(hv, keysv, NULL, 0, 0, HV_FETCH_ISEXISTS, 0, hash)
1226 ? TRUE : FALSE;
1227}
1228
1229HE *
1230Perl_hv_fetch_ent(pTHX_ HV *hv, SV *keysv, I32 lval, U32 hash)
1231{
59af68cc 1232 return (HE *)hv_common(hv, keysv, NULL, 0, 0,
4c2df08c
NC
1233 (lval ? HV_FETCH_LVALUE : 0), NULL, hash);
1234}
1235
1236SV *
1237Perl_hv_delete_ent(pTHX_ HV *hv, SV *keysv, I32 flags, U32 hash)
1238{
1239 return (SV *) hv_common(hv, keysv, NULL, 0, 0, flags | HV_DELETE, NULL,
1240 hash);
1241}
1242
a038e571
NC
1243SV**
1244Perl_hv_store_flags(pTHX_ HV *hv, const char *key, I32 klen, SV *val, U32 hash,
1245 int flags)
1246{
1247 return (SV**) hv_common(hv, NULL, key, klen, flags,
1248 (HV_FETCH_ISSTORE|HV_FETCH_JUST_SV), val, hash);
1249}
1250
1251SV**
1252Perl_hv_store(pTHX_ HV *hv, const char *key, I32 klen_i32, SV *val, U32 hash)
1253{
1254 STRLEN klen;
1255 int flags;
1256
1257 if (klen_i32 < 0) {
1258 klen = -klen_i32;
1259 flags = HVhek_UTF8;
1260 } else {
1261 klen = klen_i32;
1262 flags = 0;
1263 }
1264 return (SV **) hv_common(hv, NULL, key, klen, flags,
1265 (HV_FETCH_ISSTORE|HV_FETCH_JUST_SV), val, hash);
1266}
1267
1268bool
1269Perl_hv_exists(pTHX_ HV *hv, const char *key, I32 klen_i32)
1270{
1271 STRLEN klen;
1272 int flags;
1273
1274 if (klen_i32 < 0) {
1275 klen = -klen_i32;
1276 flags = HVhek_UTF8;
1277 } else {
1278 klen = klen_i32;
1279 flags = 0;
1280 }
1281 return hv_common(hv, NULL, key, klen, flags, HV_FETCH_ISEXISTS, 0, 0)
1282 ? TRUE : FALSE;
1283}
1284
1285SV**
1286Perl_hv_fetch(pTHX_ HV *hv, const char *key, I32 klen_i32, I32 lval)
1287{
1288 STRLEN klen;
1289 int flags;
1290
1291 if (klen_i32 < 0) {
1292 klen = -klen_i32;
1293 flags = HVhek_UTF8;
1294 } else {
1295 klen = klen_i32;
1296 flags = 0;
1297 }
1298 return (SV **) hv_common(hv, NULL, key, klen, flags,
1299 lval ? (HV_FETCH_JUST_SV | HV_FETCH_LVALUE)
1300 : HV_FETCH_JUST_SV, NULL, 0);
1301}
1302
1303SV *
1304Perl_hv_delete(pTHX_ HV *hv, const char *key, I32 klen_i32, I32 flags)
1305{
1306 STRLEN klen;
1307 int k_flags;
1308
1309 if (klen_i32 < 0) {
1310 klen = -klen_i32;
1311 k_flags = HVhek_UTF8;
1312 } else {
1313 klen = klen_i32;
1314 k_flags = 0;
1315 }
1316 return (SV *) hv_common(hv, NULL, key, klen, k_flags, flags | HV_DELETE,
1317 NULL, 0);
1318}
1319
56d7a086 1320/* Functions after here were made mathoms post 5.10.0 but pre 5.8.9 */
56d7a086 1321
ac572bf4
NC
1322AV *
1323Perl_newAV(pTHX)
1324{
1325 return (AV*)newSV_type(SVt_PVAV);
1326 /* sv_upgrade does AvREAL_only():
1327 AvALLOC(av) = 0;
1328 AvARRAY(av) = NULL;
1329 AvMAX(av) = AvFILLp(av) = -1; */
1330}
1331
78ac7dd9
NC
1332HV *
1333Perl_newHV(pTHX)
1334{
1335 HV * const hv = (HV*)newSV_type(SVt_PVHV);
1336 assert(!SvOK(hv));
1337
1338 return hv;
1339}
1340
20fac488
GA
1341#endif /* NO_MATHOMS */
1342
d5b2b27b 1343/*
7ee2227d
SP
1344 * Local variables:
1345 * c-indentation-style: bsd
1346 * c-basic-offset: 4
1347 * indent-tabs-mode: t
1348 * End:
1349 *
1350 * ex: set ts=8 sts=4 sw=4 noet:
1351 */