Commit | Line | Data |
7ee2227d |
1 | /* mathoms.c |
2 | * |
1129b882 |
3 | * Copyright (C) 2005, 2006, 2007, 2008 by Larry Wall and others |
7ee2227d |
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 | /* |
4ac71550 |
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 | * [p.5 of _The Lord of the Rings_: "Prologue"] |
7ee2227d |
17 | */ |
18 | |
359d40ba |
19 | |
20fac488 |
20 | |
7ee2227d |
21 | /* |
22 | * This file contains mathoms, various binary artifacts from previous |
f2f0f092 |
23 | * versions of Perl. For binary or source compatibility reasons, though, |
24 | * we cannot completely remove them from the core code. |
7ee2227d |
25 | * |
26 | * SMP - Oct. 24, 2005 |
27 | * |
28 | */ |
29 | |
30 | #include "EXTERN.h" |
31 | #define PERL_IN_MATHOMS_C |
32 | #include "perl.h" |
33 | |
359d40ba |
34 | #ifdef NO_MATHOMS |
35 | /* ..." warning: ISO C forbids an empty source file" |
36 | So make sure we have something in here by processing the headers anyway. |
37 | */ |
38 | #else |
39 | |
a0c21aa1 |
40 | PERL_CALLCONV OP * Perl_ref(pTHX_ OP *o, I32 type); |
41 | PERL_CALLCONV void Perl_sv_unref(pTHX_ SV *sv); |
42 | PERL_CALLCONV void Perl_sv_taint(pTHX_ SV *sv); |
43 | PERL_CALLCONV IV Perl_sv_2iv(pTHX_ register SV *sv); |
44 | PERL_CALLCONV UV Perl_sv_2uv(pTHX_ register SV *sv); |
45 | PERL_CALLCONV char * Perl_sv_2pv(pTHX_ register SV *sv, STRLEN *lp); |
46 | PERL_CALLCONV char * Perl_sv_2pv_nolen(pTHX_ register SV *sv); |
47 | PERL_CALLCONV char * Perl_sv_2pvbyte_nolen(pTHX_ register SV *sv); |
48 | PERL_CALLCONV char * Perl_sv_2pvutf8_nolen(pTHX_ register SV *sv); |
49 | PERL_CALLCONV void Perl_sv_force_normal(pTHX_ register SV *sv); |
50 | PERL_CALLCONV void Perl_sv_setsv(pTHX_ SV *dstr, register SV *sstr); |
51 | PERL_CALLCONV void Perl_sv_catpvn(pTHX_ SV *dsv, const char* sstr, STRLEN slen); |
52 | PERL_CALLCONV void Perl_sv_catpvn_mg(pTHX_ register SV *sv, register const char *ptr, register STRLEN len); |
53 | PERL_CALLCONV void Perl_sv_catsv(pTHX_ SV *dstr, register SV *sstr); |
54 | PERL_CALLCONV void Perl_sv_catsv_mg(pTHX_ SV *dsv, register SV *ssv); |
55 | PERL_CALLCONV char * Perl_sv_pv(pTHX_ SV *sv); |
56 | PERL_CALLCONV char * Perl_sv_pvn_force(pTHX_ SV *sv, STRLEN *lp); |
57 | PERL_CALLCONV char * Perl_sv_pvbyte(pTHX_ SV *sv); |
58 | PERL_CALLCONV char * Perl_sv_pvutf8(pTHX_ SV *sv); |
59 | PERL_CALLCONV STRLEN Perl_sv_utf8_upgrade(pTHX_ register SV *sv); |
60 | PERL_CALLCONV NV Perl_huge(void); |
61 | PERL_CALLCONV void Perl_gv_fullname3(pTHX_ SV *sv, const GV *gv, const char *prefix); |
62 | PERL_CALLCONV void Perl_gv_efullname3(pTHX_ SV *sv, const GV *gv, const char *prefix); |
63 | PERL_CALLCONV GV * Perl_gv_fetchmethod(pTHX_ HV *stash, const char *name); |
64 | PERL_CALLCONV HE * Perl_hv_iternext(pTHX_ HV *hv); |
65 | PERL_CALLCONV void Perl_hv_magic(pTHX_ HV *hv, GV *gv, int how); |
66 | PERL_CALLCONV bool Perl_do_open(pTHX_ GV *gv, register const char *name, I32 len, int as_raw, int rawmode, int rawperm, PerlIO *supplied_fp); |
67 | PERL_CALLCONV bool Perl_do_aexec(pTHX_ SV *really, register SV **mark, register SV **sp); |
68 | PERL_CALLCONV bool Perl_do_exec(pTHX_ const char *cmd); |
69 | PERL_CALLCONV U8 * Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv); |
70 | PERL_CALLCONV bool Perl_is_utf8_string_loc(pTHX_ const U8 *s, STRLEN len, const U8 **ep); |
71 | PERL_CALLCONV void Perl_sv_nolocking(pTHX_ SV *sv); |
72 | PERL_CALLCONV void Perl_sv_usepvn_mg(pTHX_ SV *sv, char *ptr, STRLEN len); |
73 | PERL_CALLCONV void Perl_sv_usepvn(pTHX_ SV *sv, char *ptr, STRLEN len); |
74 | PERL_CALLCONV int Perl_fprintf_nocontext(PerlIO *stream, const char *format, ...); |
75 | PERL_CALLCONV int Perl_printf_nocontext(const char *format, ...); |
56d7a086 |
76 | PERL_CALLCONV int Perl_magic_setglob(pTHX_ SV* sv, MAGIC* mg); |
ac572bf4 |
77 | PERL_CALLCONV AV * Perl_newAV(pTHX); |
78ac7dd9 |
78 | PERL_CALLCONV HV * Perl_newHV(pTHX); |
85dca89a |
79 | PERL_CALLCONV IO * Perl_newIO(pTHX); |
b5445a23 |
80 | |
7ee2227d |
81 | /* ref() is now a macro using Perl_doref; |
82 | * this version provided for binary compatibility only. |
83 | */ |
84 | OP * |
85 | Perl_ref(pTHX_ OP *o, I32 type) |
86 | { |
87 | return doref(o, type, TRUE); |
88 | } |
89 | |
aae9cea0 |
90 | /* |
174c73e3 |
91 | =for apidoc sv_unref |
92 | |
93 | Unsets the RV status of the SV, and decrements the reference count of |
94 | whatever was being referenced by the RV. This can almost be thought of |
95 | as a reversal of C<newSVrv>. This is C<sv_unref_flags> with the C<flag> |
96 | being zero. See C<SvROK_off>. |
97 | |
98 | =cut |
99 | */ |
100 | |
101 | void |
102 | Perl_sv_unref(pTHX_ SV *sv) |
103 | { |
7918f24d |
104 | PERL_ARGS_ASSERT_SV_UNREF; |
105 | |
174c73e3 |
106 | sv_unref_flags(sv, 0); |
107 | } |
108 | |
109 | /* |
aae9cea0 |
110 | =for apidoc sv_taint |
111 | |
112 | Taint an SV. Use C<SvTAINTED_on> instead. |
113 | =cut |
114 | */ |
115 | |
116 | void |
117 | Perl_sv_taint(pTHX_ SV *sv) |
118 | { |
7918f24d |
119 | PERL_ARGS_ASSERT_SV_TAINT; |
120 | |
a0714e2c |
121 | sv_magic((sv), NULL, PERL_MAGIC_taint, NULL, 0); |
aae9cea0 |
122 | } |
123 | |
7ee2227d |
124 | /* sv_2iv() is now a macro using Perl_sv_2iv_flags(); |
125 | * this function provided for binary compatibility only |
126 | */ |
127 | |
128 | IV |
129 | Perl_sv_2iv(pTHX_ register SV *sv) |
130 | { |
131 | return sv_2iv_flags(sv, SV_GMAGIC); |
132 | } |
133 | |
134 | /* sv_2uv() is now a macro using Perl_sv_2uv_flags(); |
135 | * this function provided for binary compatibility only |
136 | */ |
137 | |
138 | UV |
139 | Perl_sv_2uv(pTHX_ register SV *sv) |
140 | { |
141 | return sv_2uv_flags(sv, SV_GMAGIC); |
142 | } |
143 | |
144 | /* sv_2pv() is now a macro using Perl_sv_2pv_flags(); |
145 | * this function provided for binary compatibility only |
146 | */ |
147 | |
148 | char * |
149 | Perl_sv_2pv(pTHX_ register SV *sv, STRLEN *lp) |
150 | { |
151 | return sv_2pv_flags(sv, lp, SV_GMAGIC); |
152 | } |
153 | |
5abc721d |
154 | /* |
cb2f1b7b |
155 | =for apidoc sv_2pv_nolen |
156 | |
157 | Like C<sv_2pv()>, but doesn't return the length too. You should usually |
158 | use the macro wrapper C<SvPV_nolen(sv)> instead. |
159 | =cut |
160 | */ |
161 | |
162 | char * |
163 | Perl_sv_2pv_nolen(pTHX_ register SV *sv) |
164 | { |
b5445a23 |
165 | return sv_2pv(sv, NULL); |
cb2f1b7b |
166 | } |
167 | |
168 | /* |
169 | =for apidoc sv_2pvbyte_nolen |
170 | |
171 | Return a pointer to the byte-encoded representation of the SV. |
172 | May cause the SV to be downgraded from UTF-8 as a side-effect. |
173 | |
174 | Usually accessed via the C<SvPVbyte_nolen> macro. |
175 | |
176 | =cut |
177 | */ |
178 | |
179 | char * |
180 | Perl_sv_2pvbyte_nolen(pTHX_ register SV *sv) |
181 | { |
7918f24d |
182 | PERL_ARGS_ASSERT_SV_2PVBYTE_NOLEN; |
183 | |
b5445a23 |
184 | return sv_2pvbyte(sv, NULL); |
cb2f1b7b |
185 | } |
186 | |
187 | /* |
188 | =for apidoc sv_2pvutf8_nolen |
189 | |
190 | Return a pointer to the UTF-8-encoded representation of the SV. |
191 | May cause the SV to be upgraded to UTF-8 as a side-effect. |
192 | |
193 | Usually accessed via the C<SvPVutf8_nolen> macro. |
194 | |
195 | =cut |
196 | */ |
197 | |
198 | char * |
199 | Perl_sv_2pvutf8_nolen(pTHX_ register SV *sv) |
200 | { |
7918f24d |
201 | PERL_ARGS_ASSERT_SV_2PVUTF8_NOLEN; |
202 | |
b5445a23 |
203 | return sv_2pvutf8(sv, NULL); |
cb2f1b7b |
204 | } |
205 | |
206 | /* |
5abc721d |
207 | =for apidoc sv_force_normal |
208 | |
209 | Undo various types of fakery on an SV: if the PV is a shared string, make |
210 | a private copy; if we're a ref, stop refing; if we're a glob, downgrade to |
211 | an xpvmg. See also C<sv_force_normal_flags>. |
212 | |
213 | =cut |
214 | */ |
215 | |
216 | void |
217 | Perl_sv_force_normal(pTHX_ register SV *sv) |
218 | { |
7918f24d |
219 | PERL_ARGS_ASSERT_SV_FORCE_NORMAL; |
220 | |
5abc721d |
221 | sv_force_normal_flags(sv, 0); |
222 | } |
7ee2227d |
223 | |
224 | /* sv_setsv() is now a macro using Perl_sv_setsv_flags(); |
225 | * this function provided for binary compatibility only |
226 | */ |
227 | |
228 | void |
229 | Perl_sv_setsv(pTHX_ SV *dstr, register SV *sstr) |
230 | { |
7918f24d |
231 | PERL_ARGS_ASSERT_SV_SETSV; |
232 | |
7ee2227d |
233 | sv_setsv_flags(dstr, sstr, SV_GMAGIC); |
234 | } |
235 | |
236 | /* sv_catpvn() is now a macro using Perl_sv_catpvn_flags(); |
237 | * this function provided for binary compatibility only |
238 | */ |
239 | |
240 | void |
241 | Perl_sv_catpvn(pTHX_ SV *dsv, const char* sstr, STRLEN slen) |
242 | { |
7918f24d |
243 | PERL_ARGS_ASSERT_SV_CATPVN; |
244 | |
7ee2227d |
245 | sv_catpvn_flags(dsv, sstr, slen, SV_GMAGIC); |
246 | } |
247 | |
b347df82 |
248 | /* |
249 | =for apidoc sv_catpvn_mg |
250 | |
251 | Like C<sv_catpvn>, but also handles 'set' magic. |
252 | |
253 | =cut |
254 | */ |
255 | |
256 | void |
257 | Perl_sv_catpvn_mg(pTHX_ register SV *sv, register const char *ptr, register STRLEN len) |
258 | { |
7918f24d |
259 | PERL_ARGS_ASSERT_SV_CATPVN_MG; |
260 | |
b347df82 |
261 | sv_catpvn_flags(sv,ptr,len,SV_GMAGIC|SV_SMAGIC); |
262 | } |
263 | |
7ee2227d |
264 | /* sv_catsv() is now a macro using Perl_sv_catsv_flags(); |
265 | * this function provided for binary compatibility only |
266 | */ |
267 | |
268 | void |
269 | Perl_sv_catsv(pTHX_ SV *dstr, register SV *sstr) |
270 | { |
7918f24d |
271 | PERL_ARGS_ASSERT_SV_CATSV; |
272 | |
7ee2227d |
273 | sv_catsv_flags(dstr, sstr, SV_GMAGIC); |
274 | } |
275 | |
0feed65a |
276 | /* |
b347df82 |
277 | =for apidoc sv_catsv_mg |
278 | |
279 | Like C<sv_catsv>, but also handles 'set' magic. |
280 | |
281 | =cut |
282 | */ |
283 | |
284 | void |
285 | Perl_sv_catsv_mg(pTHX_ SV *dsv, register SV *ssv) |
286 | { |
7918f24d |
287 | PERL_ARGS_ASSERT_SV_CATSV_MG; |
288 | |
b347df82 |
289 | sv_catsv_flags(dsv,ssv,SV_GMAGIC|SV_SMAGIC); |
290 | } |
291 | |
292 | /* |
0feed65a |
293 | =for apidoc sv_iv |
294 | |
295 | A private implementation of the C<SvIVx> macro for compilers which can't |
296 | cope with complex macro expressions. Always use the macro instead. |
297 | |
298 | =cut |
299 | */ |
300 | |
301 | IV |
302 | Perl_sv_iv(pTHX_ register SV *sv) |
303 | { |
7918f24d |
304 | PERL_ARGS_ASSERT_SV_IV; |
305 | |
0feed65a |
306 | if (SvIOK(sv)) { |
307 | if (SvIsUV(sv)) |
308 | return (IV)SvUVX(sv); |
309 | return SvIVX(sv); |
310 | } |
311 | return sv_2iv(sv); |
312 | } |
313 | |
314 | /* |
315 | =for apidoc sv_uv |
316 | |
317 | A private implementation of the C<SvUVx> macro for compilers which can't |
318 | cope with complex macro expressions. Always use the macro instead. |
319 | |
320 | =cut |
321 | */ |
322 | |
323 | UV |
324 | Perl_sv_uv(pTHX_ register SV *sv) |
325 | { |
7918f24d |
326 | PERL_ARGS_ASSERT_SV_UV; |
327 | |
0feed65a |
328 | if (SvIOK(sv)) { |
329 | if (SvIsUV(sv)) |
330 | return SvUVX(sv); |
331 | return (UV)SvIVX(sv); |
332 | } |
333 | return sv_2uv(sv); |
334 | } |
335 | |
336 | /* |
337 | =for apidoc sv_nv |
338 | |
339 | A private implementation of the C<SvNVx> macro for compilers which can't |
340 | cope with complex macro expressions. Always use the macro instead. |
341 | |
342 | =cut |
343 | */ |
344 | |
345 | NV |
346 | Perl_sv_nv(pTHX_ register SV *sv) |
347 | { |
7918f24d |
348 | PERL_ARGS_ASSERT_SV_NV; |
349 | |
0feed65a |
350 | if (SvNOK(sv)) |
351 | return SvNVX(sv); |
352 | return sv_2nv(sv); |
353 | } |
354 | |
355 | /* |
356 | =for apidoc sv_pv |
357 | |
358 | Use the C<SvPV_nolen> macro instead |
359 | |
360 | =for apidoc sv_pvn |
361 | |
362 | A private implementation of the C<SvPV> macro for compilers which can't |
363 | cope with complex macro expressions. Always use the macro instead. |
364 | |
365 | =cut |
366 | */ |
367 | |
368 | char * |
369 | Perl_sv_pvn(pTHX_ SV *sv, STRLEN *lp) |
370 | { |
7918f24d |
371 | PERL_ARGS_ASSERT_SV_PVN; |
372 | |
0feed65a |
373 | if (SvPOK(sv)) { |
374 | *lp = SvCUR(sv); |
375 | return SvPVX(sv); |
376 | } |
377 | return sv_2pv(sv, lp); |
378 | } |
379 | |
380 | |
381 | char * |
382 | Perl_sv_pvn_nomg(pTHX_ register SV *sv, STRLEN *lp) |
383 | { |
7918f24d |
384 | PERL_ARGS_ASSERT_SV_PVN_NOMG; |
385 | |
0feed65a |
386 | if (SvPOK(sv)) { |
387 | *lp = SvCUR(sv); |
388 | return SvPVX(sv); |
389 | } |
390 | return sv_2pv_flags(sv, lp, 0); |
391 | } |
392 | |
7ee2227d |
393 | /* sv_pv() is now a macro using SvPV_nolen(); |
394 | * this function provided for binary compatibility only |
395 | */ |
396 | |
397 | char * |
398 | Perl_sv_pv(pTHX_ SV *sv) |
399 | { |
7918f24d |
400 | PERL_ARGS_ASSERT_SV_PV; |
401 | |
7ee2227d |
402 | if (SvPOK(sv)) |
403 | return SvPVX(sv); |
404 | |
b5445a23 |
405 | return sv_2pv(sv, NULL); |
7ee2227d |
406 | } |
407 | |
408 | /* sv_pvn_force() is now a macro using Perl_sv_pvn_force_flags(); |
409 | * this function provided for binary compatibility only |
410 | */ |
411 | |
412 | char * |
413 | Perl_sv_pvn_force(pTHX_ SV *sv, STRLEN *lp) |
414 | { |
7918f24d |
415 | PERL_ARGS_ASSERT_SV_PVN_FORCE; |
416 | |
7ee2227d |
417 | return sv_pvn_force_flags(sv, lp, SV_GMAGIC); |
418 | } |
419 | |
420 | /* sv_pvbyte () is now a macro using Perl_sv_2pv_flags(); |
421 | * this function provided for binary compatibility only |
422 | */ |
423 | |
424 | char * |
425 | Perl_sv_pvbyte(pTHX_ SV *sv) |
426 | { |
7918f24d |
427 | PERL_ARGS_ASSERT_SV_PVBYTE; |
428 | |
b5445a23 |
429 | sv_utf8_downgrade(sv, FALSE); |
7ee2227d |
430 | return sv_pv(sv); |
431 | } |
432 | |
0feed65a |
433 | /* |
434 | =for apidoc sv_pvbyte |
435 | |
436 | Use C<SvPVbyte_nolen> instead. |
437 | |
438 | =for apidoc sv_pvbyten |
439 | |
440 | A private implementation of the C<SvPVbyte> macro for compilers |
441 | which can't cope with complex macro expressions. Always use the macro |
442 | instead. |
443 | |
444 | =cut |
445 | */ |
446 | |
447 | char * |
448 | Perl_sv_pvbyten(pTHX_ SV *sv, STRLEN *lp) |
449 | { |
7918f24d |
450 | PERL_ARGS_ASSERT_SV_PVBYTEN; |
451 | |
b5445a23 |
452 | sv_utf8_downgrade(sv, FALSE); |
0feed65a |
453 | return sv_pvn(sv,lp); |
454 | } |
455 | |
7ee2227d |
456 | /* sv_pvutf8 () is now a macro using Perl_sv_2pv_flags(); |
457 | * this function provided for binary compatibility only |
458 | */ |
459 | |
460 | char * |
461 | Perl_sv_pvutf8(pTHX_ SV *sv) |
462 | { |
7918f24d |
463 | PERL_ARGS_ASSERT_SV_PVUTF8; |
464 | |
7ee2227d |
465 | sv_utf8_upgrade(sv); |
466 | return sv_pv(sv); |
467 | } |
468 | |
0feed65a |
469 | /* |
470 | =for apidoc sv_pvutf8 |
471 | |
472 | Use the C<SvPVutf8_nolen> macro instead |
473 | |
474 | =for apidoc sv_pvutf8n |
475 | |
476 | A private implementation of the C<SvPVutf8> macro for compilers |
477 | which can't cope with complex macro expressions. Always use the macro |
478 | instead. |
479 | |
480 | =cut |
481 | */ |
482 | |
483 | char * |
484 | Perl_sv_pvutf8n(pTHX_ SV *sv, STRLEN *lp) |
485 | { |
7918f24d |
486 | PERL_ARGS_ASSERT_SV_PVUTF8N; |
487 | |
0feed65a |
488 | sv_utf8_upgrade(sv); |
489 | return sv_pvn(sv,lp); |
490 | } |
491 | |
205c02c2 |
492 | /* sv_utf8_upgrade() is now a macro using sv_utf8_upgrade_flags(); |
493 | * this function provided for binary compatibility only |
494 | */ |
495 | |
496 | STRLEN |
497 | Perl_sv_utf8_upgrade(pTHX_ register SV *sv) |
498 | { |
7918f24d |
499 | PERL_ARGS_ASSERT_SV_UTF8_UPGRADE; |
500 | |
205c02c2 |
501 | return sv_utf8_upgrade_flags(sv, SV_GMAGIC); |
502 | } |
503 | |
7ee2227d |
504 | int |
505 | Perl_fprintf_nocontext(PerlIO *stream, const char *format, ...) |
506 | { |
507 | dTHXs; |
508 | va_list(arglist); |
7918f24d |
509 | |
510 | /* Easier to special case this here than in embed.pl. (Look at what it |
511 | generates for proto.h) */ |
512 | #ifdef PERL_IMPLICIT_CONTEXT |
513 | PERL_ARGS_ASSERT_FPRINTF_NOCONTEXT; |
514 | #endif |
515 | |
7ee2227d |
516 | va_start(arglist, format); |
517 | return PerlIO_vprintf(stream, format, arglist); |
518 | } |
519 | |
520 | int |
521 | Perl_printf_nocontext(const char *format, ...) |
522 | { |
523 | dTHX; |
524 | va_list(arglist); |
7918f24d |
525 | |
526 | #ifdef PERL_IMPLICIT_CONTEXT |
527 | PERL_ARGS_ASSERT_PRINTF_NOCONTEXT; |
528 | #endif |
529 | |
7ee2227d |
530 | va_start(arglist, format); |
531 | return PerlIO_vprintf(PerlIO_stdout(), format, arglist); |
532 | } |
533 | |
534 | #if defined(HUGE_VAL) || (defined(USE_LONG_DOUBLE) && defined(HUGE_VALL)) |
535 | /* |
536 | * This hack is to force load of "huge" support from libm.a |
537 | * So it is in perl for (say) POSIX to use. |
538 | * Needed for SunOS with Sun's 'acc' for example. |
539 | */ |
540 | NV |
541 | Perl_huge(void) |
542 | { |
c773ee7a |
543 | # if defined(USE_LONG_DOUBLE) && defined(HUGE_VALL) |
7ee2227d |
544 | return HUGE_VALL; |
c773ee7a |
545 | # else |
7ee2227d |
546 | return HUGE_VAL; |
c773ee7a |
547 | # endif |
7ee2227d |
548 | } |
549 | #endif |
550 | |
f2f0f092 |
551 | /* compatibility with versions <= 5.003. */ |
552 | void |
553 | Perl_gv_fullname(pTHX_ SV *sv, const GV *gv) |
554 | { |
7918f24d |
555 | PERL_ARGS_ASSERT_GV_FULLNAME; |
556 | |
666ea192 |
557 | gv_fullname3(sv, gv, sv == (const SV*)gv ? "*" : ""); |
f2f0f092 |
558 | } |
559 | |
560 | /* compatibility with versions <= 5.003. */ |
561 | void |
562 | Perl_gv_efullname(pTHX_ SV *sv, const GV *gv) |
563 | { |
7918f24d |
564 | PERL_ARGS_ASSERT_GV_EFULLNAME; |
565 | |
666ea192 |
566 | gv_efullname3(sv, gv, sv == (const SV*)gv ? "*" : ""); |
f2f0f092 |
567 | } |
568 | |
2674aeec |
569 | void |
570 | Perl_gv_fullname3(pTHX_ SV *sv, const GV *gv, const char *prefix) |
571 | { |
7918f24d |
572 | PERL_ARGS_ASSERT_GV_FULLNAME3; |
573 | |
2674aeec |
574 | gv_fullname4(sv, gv, prefix, TRUE); |
575 | } |
576 | |
577 | void |
578 | Perl_gv_efullname3(pTHX_ SV *sv, const GV *gv, const char *prefix) |
579 | { |
7918f24d |
580 | PERL_ARGS_ASSERT_GV_EFULLNAME3; |
581 | |
2674aeec |
582 | gv_efullname4(sv, gv, prefix, TRUE); |
583 | } |
584 | |
887986eb |
585 | /* |
586 | =for apidoc gv_fetchmethod |
587 | |
588 | See L<gv_fetchmethod_autoload>. |
589 | |
590 | =cut |
591 | */ |
592 | |
593 | GV * |
594 | Perl_gv_fetchmethod(pTHX_ HV *stash, const char *name) |
595 | { |
7918f24d |
596 | PERL_ARGS_ASSERT_GV_FETCHMETHOD; |
597 | |
887986eb |
598 | return gv_fetchmethod_autoload(stash, name, TRUE); |
599 | } |
600 | |
7a7b9979 |
601 | HE * |
602 | Perl_hv_iternext(pTHX_ HV *hv) |
603 | { |
7918f24d |
604 | PERL_ARGS_ASSERT_HV_ITERNEXT; |
605 | |
7a7b9979 |
606 | return hv_iternext_flags(hv, 0); |
607 | } |
608 | |
bc5cdc23 |
609 | void |
610 | Perl_hv_magic(pTHX_ HV *hv, GV *gv, int how) |
611 | { |
7918f24d |
612 | PERL_ARGS_ASSERT_HV_MAGIC; |
613 | |
ad64d0ec |
614 | sv_magic(MUTABLE_SV(hv), MUTABLE_SV(gv), how, NULL, 0); |
bc5cdc23 |
615 | } |
616 | |
34d367cd |
617 | bool |
e4dba786 |
618 | Perl_do_open(pTHX_ GV *gv, register const char *name, I32 len, int as_raw, |
619 | int rawmode, int rawperm, PerlIO *supplied_fp) |
620 | { |
7918f24d |
621 | PERL_ARGS_ASSERT_DO_OPEN; |
622 | |
e4dba786 |
623 | return do_openn(gv, name, len, as_raw, rawmode, rawperm, |
624 | supplied_fp, (SV **) NULL, 0); |
625 | } |
626 | |
627 | bool |
34d367cd |
628 | Perl_do_open9(pTHX_ GV *gv, register const char *name, I32 len, int |
629 | as_raw, |
630 | int rawmode, int rawperm, PerlIO *supplied_fp, SV *svs, |
631 | I32 num_svs) |
632 | { |
7918f24d |
633 | PERL_ARGS_ASSERT_DO_OPEN9; |
634 | |
34d367cd |
635 | PERL_UNUSED_ARG(num_svs); |
636 | return do_openn(gv, name, len, as_raw, rawmode, rawperm, |
637 | supplied_fp, &svs, 1); |
638 | } |
639 | |
640 | int |
641 | Perl_do_binmode(pTHX_ PerlIO *fp, int iotype, int mode) |
642 | { |
643 | /* The old body of this is now in non-LAYER part of perlio.c |
644 | * This is a stub for any XS code which might have been calling it. |
645 | */ |
646 | const char *name = ":raw"; |
7918f24d |
647 | |
648 | PERL_ARGS_ASSERT_DO_BINMODE; |
649 | |
34d367cd |
650 | #ifdef PERLIO_USING_CRLF |
651 | if (!(mode & O_BINARY)) |
652 | name = ":crlf"; |
653 | #endif |
654 | return PerlIO_binmode(aTHX_ fp, iotype, mode, name); |
655 | } |
656 | |
a9f96b3f |
657 | #ifndef OS2 |
658 | bool |
659 | Perl_do_aexec(pTHX_ SV *really, register SV **mark, register SV **sp) |
660 | { |
7918f24d |
661 | PERL_ARGS_ASSERT_DO_AEXEC; |
662 | |
a9f96b3f |
663 | return do_aexec5(really, mark, sp, 0, 0); |
664 | } |
665 | #endif |
666 | |
9555a685 |
667 | #ifdef PERL_DEFAULT_DO_EXEC3_IMPLEMENTATION |
668 | bool |
669 | Perl_do_exec(pTHX_ const char *cmd) |
670 | { |
7918f24d |
671 | PERL_ARGS_ASSERT_DO_EXEC; |
672 | |
9555a685 |
673 | return do_exec3(cmd,0,0); |
674 | } |
675 | #endif |
676 | |
89552e80 |
677 | /* Backwards compatibility. */ |
678 | int |
679 | Perl_init_i18nl14n(pTHX_ int printwarn) |
680 | { |
681 | return init_i18nl10n(printwarn); |
682 | } |
683 | |
c78ff979 |
684 | PP(pp_padany) |
685 | { |
686 | DIE(aTHX_ "NOT IMPL LINE %d",__LINE__); |
bb4c52e0 |
687 | return NORMAL; |
c78ff979 |
688 | } |
689 | |
690 | PP(pp_mapstart) |
691 | { |
692 | DIE(aTHX_ "panic: mapstart"); /* uses grepstart */ |
bb4c52e0 |
693 | return NORMAL; |
c78ff979 |
694 | } |
695 | |
0b612f93 |
696 | /* These ops all have the same body as pp_null. */ |
697 | PP(pp_scalar) |
698 | { |
97aff369 |
699 | dVAR; |
0b612f93 |
700 | return NORMAL; |
701 | } |
702 | |
703 | PP(pp_regcmaybe) |
704 | { |
97aff369 |
705 | dVAR; |
0b612f93 |
706 | return NORMAL; |
707 | } |
708 | |
709 | PP(pp_lineseq) |
710 | { |
97aff369 |
711 | dVAR; |
0b612f93 |
712 | return NORMAL; |
713 | } |
714 | |
715 | PP(pp_scope) |
716 | { |
97aff369 |
717 | dVAR; |
0b612f93 |
718 | return NORMAL; |
719 | } |
720 | |
721 | /* Ops that are calls to do_kv. */ |
722 | PP(pp_values) |
723 | { |
724 | return do_kv(); |
725 | } |
726 | |
727 | PP(pp_keys) |
728 | { |
729 | return do_kv(); |
730 | } |
731 | |
732 | /* Ops that are simply calls to other ops. */ |
733 | PP(pp_dump) |
734 | { |
735 | return pp_goto(); |
736 | /*NOTREACHED*/ |
737 | } |
738 | |
739 | PP(pp_dofile) |
740 | { |
741 | return pp_require(); |
742 | } |
743 | |
744 | PP(pp_dbmclose) |
745 | { |
746 | return pp_untie(); |
747 | } |
748 | |
749 | PP(pp_read) |
750 | { |
751 | return pp_sysread(); |
752 | } |
753 | |
754 | PP(pp_recv) |
755 | { |
756 | return pp_sysread(); |
757 | } |
758 | |
759 | PP(pp_seek) |
760 | { |
761 | return pp_sysseek(); |
762 | } |
763 | |
764 | PP(pp_fcntl) |
765 | { |
766 | return pp_ioctl(); |
767 | } |
768 | |
769 | PP(pp_gsockopt) |
770 | { |
771 | return pp_ssockopt(); |
772 | } |
773 | |
774 | PP(pp_getsockname) |
775 | { |
776 | return pp_getpeername(); |
777 | } |
778 | |
779 | PP(pp_lstat) |
780 | { |
781 | return pp_stat(); |
782 | } |
783 | |
784 | PP(pp_fteowned) |
785 | { |
786 | return pp_ftrowned(); |
787 | } |
788 | |
789 | PP(pp_ftbinary) |
790 | { |
791 | return pp_fttext(); |
792 | } |
793 | |
794 | PP(pp_localtime) |
795 | { |
796 | return pp_gmtime(); |
797 | } |
798 | |
799 | PP(pp_shmget) |
800 | { |
801 | return pp_semget(); |
802 | } |
803 | |
804 | PP(pp_shmctl) |
805 | { |
806 | return pp_semctl(); |
807 | } |
808 | |
809 | PP(pp_shmread) |
810 | { |
811 | return pp_shmwrite(); |
812 | } |
813 | |
814 | PP(pp_msgget) |
815 | { |
816 | return pp_semget(); |
817 | } |
818 | |
819 | PP(pp_msgctl) |
820 | { |
821 | return pp_semctl(); |
822 | } |
823 | |
824 | PP(pp_ghbyname) |
825 | { |
826 | return pp_ghostent(); |
827 | } |
828 | |
829 | PP(pp_ghbyaddr) |
830 | { |
831 | return pp_ghostent(); |
832 | } |
833 | |
834 | PP(pp_gnbyname) |
835 | { |
836 | return pp_gnetent(); |
837 | } |
838 | |
839 | PP(pp_gnbyaddr) |
840 | { |
841 | return pp_gnetent(); |
842 | } |
843 | |
844 | PP(pp_gpbyname) |
845 | { |
846 | return pp_gprotoent(); |
847 | } |
848 | |
849 | PP(pp_gpbynumber) |
850 | { |
851 | return pp_gprotoent(); |
852 | } |
853 | |
854 | PP(pp_gsbyname) |
855 | { |
856 | return pp_gservent(); |
857 | } |
858 | |
859 | PP(pp_gsbyport) |
860 | { |
861 | return pp_gservent(); |
862 | } |
863 | |
864 | PP(pp_gpwnam) |
865 | { |
866 | return pp_gpwent(); |
867 | } |
868 | |
869 | PP(pp_gpwuid) |
870 | { |
871 | return pp_gpwent(); |
872 | } |
873 | |
874 | PP(pp_ggrnam) |
875 | { |
876 | return pp_ggrent(); |
877 | } |
878 | |
879 | PP(pp_ggrgid) |
880 | { |
881 | return pp_ggrent(); |
882 | } |
883 | |
957b0e1d |
884 | PP(pp_ftsize) |
885 | { |
4992681b |
886 | return pp_ftis(); |
957b0e1d |
887 | } |
888 | |
889 | PP(pp_ftmtime) |
890 | { |
4992681b |
891 | return pp_ftis(); |
957b0e1d |
892 | } |
893 | |
894 | PP(pp_ftatime) |
895 | { |
4992681b |
896 | return pp_ftis(); |
957b0e1d |
897 | } |
898 | |
899 | PP(pp_ftctime) |
900 | { |
4992681b |
901 | return pp_ftis(); |
957b0e1d |
902 | } |
903 | |
f1cb2d48 |
904 | PP(pp_ftzero) |
905 | { |
906 | return pp_ftrowned(); |
907 | } |
908 | |
909 | PP(pp_ftsock) |
910 | { |
911 | return pp_ftrowned(); |
912 | } |
913 | |
914 | PP(pp_ftchr) |
915 | { |
916 | return pp_ftrowned(); |
917 | } |
918 | |
919 | PP(pp_ftblk) |
920 | { |
921 | return pp_ftrowned(); |
922 | } |
923 | |
924 | PP(pp_ftfile) |
925 | { |
926 | return pp_ftrowned(); |
927 | } |
928 | |
929 | PP(pp_ftdir) |
930 | { |
931 | return pp_ftrowned(); |
932 | } |
933 | |
934 | PP(pp_ftpipe) |
935 | { |
936 | return pp_ftrowned(); |
937 | } |
938 | |
17ad201a |
939 | PP(pp_ftsuid) |
940 | { |
941 | return pp_ftrowned(); |
942 | } |
943 | |
944 | PP(pp_ftsgid) |
945 | { |
946 | return pp_ftrowned(); |
947 | } |
948 | |
949 | PP(pp_ftsvtx) |
950 | { |
951 | return pp_ftrowned(); |
952 | } |
953 | |
605b9385 |
954 | PP(pp_unlink) |
955 | { |
956 | return pp_chown(); |
957 | } |
958 | |
959 | PP(pp_chmod) |
960 | { |
961 | return pp_chown(); |
962 | } |
963 | |
964 | PP(pp_utime) |
965 | { |
966 | return pp_chown(); |
967 | } |
968 | |
969 | PP(pp_kill) |
970 | { |
971 | return pp_chown(); |
972 | } |
973 | |
ce6987d0 |
974 | PP(pp_symlink) |
975 | { |
976 | return pp_link(); |
977 | } |
978 | |
af9e49b4 |
979 | PP(pp_ftrwrite) |
980 | { |
981 | return pp_ftrread(); |
982 | } |
983 | |
984 | PP(pp_ftrexec) |
985 | { |
986 | return pp_ftrread(); |
987 | } |
988 | |
989 | PP(pp_fteread) |
990 | { |
991 | return pp_ftrread(); |
992 | } |
993 | |
994 | PP(pp_ftewrite) |
995 | { |
996 | return pp_ftrread(); |
997 | } |
998 | |
999 | PP(pp_fteexec) |
1000 | { |
1001 | return pp_ftrread(); |
1002 | } |
1003 | |
c9f7ac20 |
1004 | PP(pp_msgsnd) |
1005 | { |
1006 | return pp_shmwrite(); |
1007 | } |
1008 | |
1009 | PP(pp_msgrcv) |
1010 | { |
1011 | return pp_shmwrite(); |
1012 | } |
1013 | |
64a1bc8e |
1014 | PP(pp_syswrite) |
1015 | { |
1016 | return pp_send(); |
1017 | } |
1018 | |
ca563b4e |
1019 | PP(pp_semop) |
1020 | { |
1021 | return pp_shmwrite(); |
1022 | } |
1023 | |
25a55bd7 |
1024 | PP(pp_dor) |
1025 | { |
f6a64177 |
1026 | return pp_defined(); |
25a55bd7 |
1027 | } |
1028 | |
c960fc3b |
1029 | PP(pp_andassign) |
1030 | { |
1031 | return pp_and(); |
1032 | } |
1033 | |
1034 | PP(pp_orassign) |
1035 | { |
1036 | return pp_or(); |
1037 | } |
1038 | |
1039 | PP(pp_dorassign) |
1040 | { |
1041 | return pp_defined(); |
1042 | } |
1043 | |
12e9c124 |
1044 | PP(pp_lcfirst) |
1045 | { |
1046 | return pp_ucfirst(); |
1047 | } |
1048 | |
afd9910b |
1049 | PP(pp_slt) |
1050 | { |
1051 | return pp_sle(); |
1052 | } |
1053 | |
1054 | PP(pp_sgt) |
1055 | { |
1056 | return pp_sle(); |
1057 | } |
1058 | |
1059 | PP(pp_sge) |
1060 | { |
1061 | return pp_sle(); |
1062 | } |
1063 | |
2723d216 |
1064 | PP(pp_rindex) |
1065 | { |
1066 | return pp_index(); |
1067 | } |
1068 | |
daa2adfd |
1069 | PP(pp_hex) |
1070 | { |
1071 | return pp_oct(); |
1072 | } |
1073 | |
789b4bc9 |
1074 | PP(pp_pop) |
1075 | { |
1076 | return pp_shift(); |
1077 | } |
1078 | |
71302fe3 |
1079 | PP(pp_cos) |
1080 | { |
1081 | return pp_sin(); |
1082 | } |
1083 | |
1084 | PP(pp_exp) |
1085 | { |
1086 | return pp_sin(); |
1087 | } |
1088 | |
1089 | PP(pp_log) |
1090 | { |
1091 | return pp_sin(); |
1092 | } |
1093 | |
1094 | PP(pp_sqrt) |
1095 | { |
1096 | return pp_sin(); |
1097 | } |
1098 | |
3658c1f1 |
1099 | PP(pp_bit_xor) |
1100 | { |
1101 | return pp_bit_or(); |
1102 | } |
1103 | |
17ab7946 |
1104 | PP(pp_rv2hv) |
1105 | { |
1106 | return Perl_pp_rv2av(aTHX); |
1107 | } |
1108 | |
038e8d3c |
1109 | U8 * |
1110 | Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv) |
1111 | { |
7918f24d |
1112 | PERL_ARGS_ASSERT_UVUNI_TO_UTF8; |
1113 | |
038e8d3c |
1114 | return Perl_uvuni_to_utf8_flags(aTHX_ d, uv, 0); |
1115 | } |
1116 | |
814fafa7 |
1117 | bool |
1118 | Perl_is_utf8_string_loc(pTHX_ const U8 *s, STRLEN len, const U8 **ep) |
1119 | { |
7918f24d |
1120 | PERL_ARGS_ASSERT_IS_UTF8_STRING_LOC; |
1121 | |
814fafa7 |
1122 | return is_utf8_string_loclen(s, len, ep, 0); |
1123 | } |
1124 | |
7ee2227d |
1125 | /* |
d5b2b27b |
1126 | =for apidoc sv_nolocking |
1127 | |
1128 | Dummy routine which "locks" an SV when there is no locking module present. |
1129 | Exists to avoid test for a NULL function pointer and because it could |
1130 | potentially warn under some level of strict-ness. |
1131 | |
1132 | "Superseded" by sv_nosharing(). |
1133 | |
1134 | =cut |
1135 | */ |
1136 | |
1137 | void |
1138 | Perl_sv_nolocking(pTHX_ SV *sv) |
1139 | { |
96a5add6 |
1140 | PERL_UNUSED_CONTEXT; |
d5b2b27b |
1141 | PERL_UNUSED_ARG(sv); |
1142 | } |
1143 | |
1144 | |
1145 | /* |
1146 | =for apidoc sv_nounlocking |
1147 | |
1148 | Dummy routine which "unlocks" an SV when there is no locking module present. |
1149 | Exists to avoid test for a NULL function pointer and because it could |
1150 | potentially warn under some level of strict-ness. |
1151 | |
1152 | "Superseded" by sv_nosharing(). |
1153 | |
1154 | =cut |
1155 | */ |
1156 | |
1157 | void |
1158 | Perl_sv_nounlocking(pTHX_ SV *sv) |
1159 | { |
96a5add6 |
1160 | PERL_UNUSED_CONTEXT; |
d5b2b27b |
1161 | PERL_UNUSED_ARG(sv); |
1162 | } |
1163 | |
2053acbf |
1164 | void |
1165 | Perl_save_long(pTHX_ long int *longp) |
1166 | { |
1167 | dVAR; |
7918f24d |
1168 | |
1169 | PERL_ARGS_ASSERT_SAVE_LONG; |
1170 | |
2053acbf |
1171 | SSCHECK(3); |
1172 | SSPUSHLONG(*longp); |
1173 | SSPUSHPTR(longp); |
1174 | SSPUSHINT(SAVEt_LONG); |
1175 | } |
1176 | |
1177 | void |
2053acbf |
1178 | Perl_save_iv(pTHX_ IV *ivp) |
1179 | { |
1180 | dVAR; |
7918f24d |
1181 | |
1182 | PERL_ARGS_ASSERT_SAVE_IV; |
1183 | |
2053acbf |
1184 | SSCHECK(3); |
1185 | SSPUSHIV(*ivp); |
1186 | SSPUSHPTR(ivp); |
1187 | SSPUSHINT(SAVEt_IV); |
1188 | } |
1189 | |
1190 | void |
1191 | Perl_save_nogv(pTHX_ GV *gv) |
1192 | { |
1193 | dVAR; |
7918f24d |
1194 | |
1195 | PERL_ARGS_ASSERT_SAVE_NOGV; |
1196 | |
2053acbf |
1197 | SSCHECK(2); |
1198 | SSPUSHPTR(gv); |
1199 | SSPUSHINT(SAVEt_NSTAB); |
1200 | } |
1201 | |
1202 | void |
1203 | Perl_save_list(pTHX_ register SV **sarg, I32 maxsarg) |
1204 | { |
1205 | dVAR; |
1206 | register I32 i; |
1207 | |
7918f24d |
1208 | PERL_ARGS_ASSERT_SAVE_LIST; |
1209 | |
2053acbf |
1210 | for (i = 1; i <= maxsarg; i++) { |
1211 | register SV * const sv = newSV(0); |
1212 | sv_setsv(sv,sarg[i]); |
1213 | SSCHECK(3); |
1214 | SSPUSHPTR(sarg[i]); /* remember the pointer */ |
1215 | SSPUSHPTR(sv); /* remember the value */ |
1216 | SSPUSHINT(SAVEt_ITEM); |
1217 | } |
1218 | } |
1219 | |
47518d95 |
1220 | /* |
1221 | =for apidoc sv_usepvn_mg |
1222 | |
1223 | Like C<sv_usepvn>, but also handles 'set' magic. |
1224 | |
1225 | =cut |
1226 | */ |
1227 | |
1228 | void |
1229 | Perl_sv_usepvn_mg(pTHX_ SV *sv, char *ptr, STRLEN len) |
1230 | { |
7918f24d |
1231 | PERL_ARGS_ASSERT_SV_USEPVN_MG; |
1232 | |
47518d95 |
1233 | sv_usepvn_flags(sv,ptr,len, SV_SMAGIC); |
1234 | } |
1235 | |
1236 | /* |
1237 | =for apidoc sv_usepvn |
1238 | |
1239 | Tells an SV to use C<ptr> to find its string value. Implemented by |
1240 | calling C<sv_usepvn_flags> with C<flags> of 0, hence does not handle 'set' |
1241 | magic. See C<sv_usepvn_flags>. |
1242 | |
1243 | =cut |
1244 | */ |
1245 | |
1246 | void |
1247 | Perl_sv_usepvn(pTHX_ SV *sv, char *ptr, STRLEN len) |
1248 | { |
7918f24d |
1249 | PERL_ARGS_ASSERT_SV_USEPVN; |
1250 | |
47518d95 |
1251 | sv_usepvn_flags(sv,ptr,len, 0); |
1252 | } |
1253 | |
c03e83bf |
1254 | /* |
1255 | =for apidoc unpack_str |
1256 | |
1257 | The engine implementing unpack() Perl function. Note: parameters strbeg, new_s |
1258 | and ocnt are not used. This call should not be used, use unpackstring instead. |
1259 | |
1260 | =cut */ |
1261 | |
1262 | I32 |
1263 | Perl_unpack_str(pTHX_ const char *pat, const char *patend, const char *s, |
1264 | const char *strbeg, const char *strend, char **new_s, I32 ocnt, |
1265 | U32 flags) |
1266 | { |
7918f24d |
1267 | PERL_ARGS_ASSERT_UNPACK_STR; |
1268 | |
c03e83bf |
1269 | PERL_UNUSED_ARG(strbeg); |
1270 | PERL_UNUSED_ARG(new_s); |
1271 | PERL_UNUSED_ARG(ocnt); |
1272 | |
1273 | return unpackstring(pat, patend, s, strend, flags); |
1274 | } |
b47163a2 |
1275 | |
1276 | /* |
1277 | =for apidoc pack_cat |
1278 | |
1279 | The engine implementing pack() Perl function. Note: parameters next_in_list and |
1280 | flags are not used. This call should not be used; use packlist instead. |
1281 | |
1282 | =cut |
1283 | */ |
1284 | |
1285 | void |
1286 | Perl_pack_cat(pTHX_ SV *cat, const char *pat, const char *patend, register SV **beglist, SV **endlist, SV ***next_in_list, U32 flags) |
1287 | { |
7918f24d |
1288 | PERL_ARGS_ASSERT_PACK_CAT; |
1289 | |
b47163a2 |
1290 | PERL_UNUSED_ARG(next_in_list); |
1291 | PERL_UNUSED_ARG(flags); |
1292 | |
1293 | packlist(cat, pat, patend, beglist, endlist); |
1294 | } |
4c2df08c |
1295 | |
1296 | HE * |
1297 | Perl_hv_store_ent(pTHX_ HV *hv, SV *keysv, SV *val, U32 hash) |
1298 | { |
59af68cc |
1299 | return (HE *)hv_common(hv, keysv, NULL, 0, 0, HV_FETCH_ISSTORE, val, hash); |
4c2df08c |
1300 | } |
1301 | |
1302 | bool |
1303 | Perl_hv_exists_ent(pTHX_ HV *hv, SV *keysv, U32 hash) |
1304 | { |
7918f24d |
1305 | PERL_ARGS_ASSERT_HV_EXISTS_ENT; |
1306 | |
4c2df08c |
1307 | return hv_common(hv, keysv, NULL, 0, 0, HV_FETCH_ISEXISTS, 0, hash) |
1308 | ? TRUE : FALSE; |
1309 | } |
1310 | |
1311 | HE * |
1312 | Perl_hv_fetch_ent(pTHX_ HV *hv, SV *keysv, I32 lval, U32 hash) |
1313 | { |
7918f24d |
1314 | PERL_ARGS_ASSERT_HV_FETCH_ENT; |
1315 | |
59af68cc |
1316 | return (HE *)hv_common(hv, keysv, NULL, 0, 0, |
4c2df08c |
1317 | (lval ? HV_FETCH_LVALUE : 0), NULL, hash); |
1318 | } |
1319 | |
1320 | SV * |
1321 | Perl_hv_delete_ent(pTHX_ HV *hv, SV *keysv, I32 flags, U32 hash) |
1322 | { |
7918f24d |
1323 | PERL_ARGS_ASSERT_HV_DELETE_ENT; |
1324 | |
ad64d0ec |
1325 | return MUTABLE_SV(hv_common(hv, keysv, NULL, 0, 0, flags | HV_DELETE, NULL, |
1326 | hash)); |
4c2df08c |
1327 | } |
1328 | |
a038e571 |
1329 | SV** |
1330 | Perl_hv_store_flags(pTHX_ HV *hv, const char *key, I32 klen, SV *val, U32 hash, |
1331 | int flags) |
1332 | { |
1333 | return (SV**) hv_common(hv, NULL, key, klen, flags, |
1334 | (HV_FETCH_ISSTORE|HV_FETCH_JUST_SV), val, hash); |
1335 | } |
1336 | |
1337 | SV** |
1338 | Perl_hv_store(pTHX_ HV *hv, const char *key, I32 klen_i32, SV *val, U32 hash) |
1339 | { |
1340 | STRLEN klen; |
1341 | int flags; |
1342 | |
1343 | if (klen_i32 < 0) { |
1344 | klen = -klen_i32; |
1345 | flags = HVhek_UTF8; |
1346 | } else { |
1347 | klen = klen_i32; |
1348 | flags = 0; |
1349 | } |
1350 | return (SV **) hv_common(hv, NULL, key, klen, flags, |
1351 | (HV_FETCH_ISSTORE|HV_FETCH_JUST_SV), val, hash); |
1352 | } |
1353 | |
1354 | bool |
1355 | Perl_hv_exists(pTHX_ HV *hv, const char *key, I32 klen_i32) |
1356 | { |
1357 | STRLEN klen; |
1358 | int flags; |
1359 | |
7918f24d |
1360 | PERL_ARGS_ASSERT_HV_EXISTS; |
1361 | |
a038e571 |
1362 | if (klen_i32 < 0) { |
1363 | klen = -klen_i32; |
1364 | flags = HVhek_UTF8; |
1365 | } else { |
1366 | klen = klen_i32; |
1367 | flags = 0; |
1368 | } |
1369 | return hv_common(hv, NULL, key, klen, flags, HV_FETCH_ISEXISTS, 0, 0) |
1370 | ? TRUE : FALSE; |
1371 | } |
1372 | |
1373 | SV** |
1374 | Perl_hv_fetch(pTHX_ HV *hv, const char *key, I32 klen_i32, I32 lval) |
1375 | { |
1376 | STRLEN klen; |
1377 | int flags; |
1378 | |
7918f24d |
1379 | PERL_ARGS_ASSERT_HV_FETCH; |
1380 | |
a038e571 |
1381 | if (klen_i32 < 0) { |
1382 | klen = -klen_i32; |
1383 | flags = HVhek_UTF8; |
1384 | } else { |
1385 | klen = klen_i32; |
1386 | flags = 0; |
1387 | } |
1388 | return (SV **) hv_common(hv, NULL, key, klen, flags, |
1389 | lval ? (HV_FETCH_JUST_SV | HV_FETCH_LVALUE) |
1390 | : HV_FETCH_JUST_SV, NULL, 0); |
1391 | } |
1392 | |
1393 | SV * |
1394 | Perl_hv_delete(pTHX_ HV *hv, const char *key, I32 klen_i32, I32 flags) |
1395 | { |
1396 | STRLEN klen; |
1397 | int k_flags; |
1398 | |
7918f24d |
1399 | PERL_ARGS_ASSERT_HV_DELETE; |
1400 | |
a038e571 |
1401 | if (klen_i32 < 0) { |
1402 | klen = -klen_i32; |
1403 | k_flags = HVhek_UTF8; |
1404 | } else { |
1405 | klen = klen_i32; |
1406 | k_flags = 0; |
1407 | } |
ad64d0ec |
1408 | return MUTABLE_SV(hv_common(hv, NULL, key, klen, k_flags, flags | HV_DELETE, |
1409 | NULL, 0)); |
a038e571 |
1410 | } |
1411 | |
56d7a086 |
1412 | /* Functions after here were made mathoms post 5.10.0 but pre 5.8.9 */ |
56d7a086 |
1413 | |
ac572bf4 |
1414 | AV * |
1415 | Perl_newAV(pTHX) |
1416 | { |
502c6561 |
1417 | return MUTABLE_AV(newSV_type(SVt_PVAV)); |
ac572bf4 |
1418 | /* sv_upgrade does AvREAL_only(): |
1419 | AvALLOC(av) = 0; |
1420 | AvARRAY(av) = NULL; |
1421 | AvMAX(av) = AvFILLp(av) = -1; */ |
1422 | } |
1423 | |
78ac7dd9 |
1424 | HV * |
1425 | Perl_newHV(pTHX) |
1426 | { |
85fbaab2 |
1427 | HV * const hv = MUTABLE_HV(newSV_type(SVt_PVHV)); |
78ac7dd9 |
1428 | assert(!SvOK(hv)); |
1429 | |
1430 | return hv; |
1431 | } |
1432 | |
84335ee9 |
1433 | void |
1434 | Perl_sv_insert(pTHX_ SV *const bigstr, const STRLEN offset, const STRLEN len, |
1435 | const char *const little, const STRLEN littlelen) |
1436 | { |
1437 | PERL_ARGS_ASSERT_SV_INSERT; |
1438 | sv_insert_flags(bigstr, offset, len, little, littlelen, SV_GMAGIC); |
1439 | } |
1440 | |
2fd8beea |
1441 | void |
1442 | Perl_save_freesv(pTHX_ SV *sv) |
1443 | { |
1444 | dVAR; |
1445 | save_freesv(sv); |
1446 | } |
1447 | |
1448 | void |
1449 | Perl_save_mortalizesv(pTHX_ SV *sv) |
1450 | { |
1451 | dVAR; |
1452 | |
1453 | PERL_ARGS_ASSERT_SAVE_MORTALIZESV; |
1454 | |
1455 | save_mortalizesv(sv); |
1456 | } |
1457 | |
1458 | void |
1459 | Perl_save_freeop(pTHX_ OP *o) |
1460 | { |
1461 | dVAR; |
1462 | save_freeop(o); |
1463 | } |
1464 | |
1465 | void |
1466 | Perl_save_freepv(pTHX_ char *pv) |
1467 | { |
1468 | dVAR; |
1469 | save_freepv(pv); |
1470 | } |
1471 | |
1472 | void |
1473 | Perl_save_op(pTHX) |
1474 | { |
1475 | dVAR; |
1476 | save_op(); |
1477 | } |
1478 | |
d5713896 |
1479 | #ifdef PERL_DONT_CREATE_GVSV |
1480 | GV * |
1481 | Perl_gv_SVadd(pTHX_ GV *gv) |
1482 | { |
d5713896 |
1483 | return gv_SVadd(gv); |
1484 | } |
1485 | #endif |
1486 | |
1487 | GV * |
1488 | Perl_gv_AVadd(pTHX_ GV *gv) |
1489 | { |
d5713896 |
1490 | return gv_AVadd(gv); |
1491 | } |
1492 | |
1493 | GV * |
1494 | Perl_gv_HVadd(pTHX_ register GV *gv) |
1495 | { |
d5713896 |
1496 | return gv_HVadd(gv); |
1497 | } |
1498 | |
bb85b28a |
1499 | GV * |
1500 | Perl_gv_IOadd(pTHX_ register GV *gv) |
1501 | { |
1502 | return gv_IOadd(gv); |
1503 | } |
1504 | |
85dca89a |
1505 | IO * |
1506 | Perl_newIO(pTHX) |
1507 | { |
1508 | return MUTABLE_IO(newSV_type(SVt_PVIO)); |
1509 | } |
1510 | |
20fac488 |
1511 | #endif /* NO_MATHOMS */ |
1512 | |
d5b2b27b |
1513 | /* |
7ee2227d |
1514 | * Local variables: |
1515 | * c-indentation-style: bsd |
1516 | * c-basic-offset: 4 |
1517 | * indent-tabs-mode: t |
1518 | * End: |
1519 | * |
1520 | * ex: set ts=8 sts=4 sw=4 noet: |
1521 | */ |