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