Replace do_aexec() with a macro to call do_aexec5() with the two extra
[p5sagit/p5-mst-13.2.git] / mathoms.c
index c70d63d..8a42e63 100644 (file)
--- a/mathoms.c
+++ b/mathoms.c
@@ -97,6 +97,54 @@ Perl_sv_2pv(pTHX_ register SV *sv, STRLEN *lp)
 }
 
 /*
+=for apidoc sv_2pv_nolen
+
+Like C<sv_2pv()>, but doesn't return the length too. You should usually
+use the macro wrapper C<SvPV_nolen(sv)> instead.
+=cut
+*/
+
+char *
+Perl_sv_2pv_nolen(pTHX_ register SV *sv)
+{
+    return sv_2pv(sv, 0);
+}
+
+/*
+=for apidoc sv_2pvbyte_nolen
+
+Return a pointer to the byte-encoded representation of the SV.
+May cause the SV to be downgraded from UTF-8 as a side-effect.
+
+Usually accessed via the C<SvPVbyte_nolen> macro.
+
+=cut
+*/
+
+char *
+Perl_sv_2pvbyte_nolen(pTHX_ register SV *sv)
+{
+    return sv_2pvbyte(sv, 0);
+}
+
+/*
+=for apidoc sv_2pvutf8_nolen
+
+Return a pointer to the UTF-8-encoded representation of the SV.
+May cause the SV to be upgraded to UTF-8 as a side-effect.
+
+Usually accessed via the C<SvPVutf8_nolen> macro.
+
+=cut
+*/
+
+char *
+Perl_sv_2pvutf8_nolen(pTHX_ register SV *sv)
+{
+    return sv_2pvutf8(sv, 0);
+}
+
+/*
 =for apidoc sv_force_normal
 
 Undo various types of fakery on an SV: if the PV is a shared string, make
@@ -132,6 +180,20 @@ Perl_sv_catpvn(pTHX_ SV *dsv, const char* sstr, STRLEN slen)
     sv_catpvn_flags(dsv, sstr, slen, SV_GMAGIC);
 }
 
+/*
+=for apidoc sv_catpvn_mg
+
+Like C<sv_catpvn>, but also handles 'set' magic.
+
+=cut
+*/
+
+void
+Perl_sv_catpvn_mg(pTHX_ register SV *sv, register const char *ptr, register STRLEN len)
+{
+    sv_catpvn_flags(sv,ptr,len,SV_GMAGIC|SV_SMAGIC);
+}
+
 /* sv_catsv() is now a macro using Perl_sv_catsv_flags();
  * this function provided for binary compatibility only
  */
@@ -142,6 +204,111 @@ Perl_sv_catsv(pTHX_ SV *dstr, register SV *sstr)
     sv_catsv_flags(dstr, sstr, SV_GMAGIC);
 }
 
+/*
+=for apidoc sv_catsv_mg
+
+Like C<sv_catsv>, but also handles 'set' magic.
+
+=cut
+*/
+
+void
+Perl_sv_catsv_mg(pTHX_ SV *dsv, register SV *ssv)
+{
+    sv_catsv_flags(dsv,ssv,SV_GMAGIC|SV_SMAGIC);
+}
+
+/*
+=for apidoc sv_iv
+
+A private implementation of the C<SvIVx> macro for compilers which can't
+cope with complex macro expressions. Always use the macro instead.
+
+=cut
+*/
+
+IV
+Perl_sv_iv(pTHX_ register SV *sv)
+{
+    if (SvIOK(sv)) {
+       if (SvIsUV(sv))
+           return (IV)SvUVX(sv);
+       return SvIVX(sv);
+    }
+    return sv_2iv(sv);
+}
+
+/*
+=for apidoc sv_uv
+
+A private implementation of the C<SvUVx> macro for compilers which can't
+cope with complex macro expressions. Always use the macro instead.
+
+=cut
+*/
+
+UV
+Perl_sv_uv(pTHX_ register SV *sv)
+{
+    if (SvIOK(sv)) {
+       if (SvIsUV(sv))
+           return SvUVX(sv);
+       return (UV)SvIVX(sv);
+    }
+    return sv_2uv(sv);
+}
+
+/*
+=for apidoc sv_nv
+
+A private implementation of the C<SvNVx> macro for compilers which can't
+cope with complex macro expressions. Always use the macro instead.
+
+=cut
+*/
+
+NV
+Perl_sv_nv(pTHX_ register SV *sv)
+{
+    if (SvNOK(sv))
+       return SvNVX(sv);
+    return sv_2nv(sv);
+}
+
+/*
+=for apidoc sv_pv
+
+Use the C<SvPV_nolen> macro instead
+
+=for apidoc sv_pvn
+
+A private implementation of the C<SvPV> macro for compilers which can't
+cope with complex macro expressions. Always use the macro instead.
+
+=cut
+*/
+
+char *
+Perl_sv_pvn(pTHX_ SV *sv, STRLEN *lp)
+{
+    if (SvPOK(sv)) {
+       *lp = SvCUR(sv);
+       return SvPVX(sv);
+    }
+    return sv_2pv(sv, lp);
+}
+
+
+char *
+Perl_sv_pvn_nomg(pTHX_ register SV *sv, STRLEN *lp)
+{
+    if (SvPOK(sv)) {
+       *lp = SvCUR(sv);
+       return SvPVX(sv);
+    }
+    return sv_2pv_flags(sv, lp, 0);
+}
+
 /* sv_pv() is now a macro using SvPV_nolen();
  * this function provided for binary compatibility only
  */
@@ -176,6 +343,27 @@ Perl_sv_pvbyte(pTHX_ SV *sv)
     return sv_pv(sv);
 }
 
+/*
+=for apidoc sv_pvbyte
+
+Use C<SvPVbyte_nolen> instead.
+
+=for apidoc sv_pvbyten
+
+A private implementation of the C<SvPVbyte> macro for compilers
+which can't cope with complex macro expressions. Always use the macro
+instead.
+
+=cut
+*/
+
+char *
+Perl_sv_pvbyten(pTHX_ SV *sv, STRLEN *lp)
+{
+    sv_utf8_downgrade(sv,0);
+    return sv_pvn(sv,lp);
+}
+
 /* sv_pvutf8 () is now a macro using Perl_sv_2pv_flags();
  * this function provided for binary compatibility only
  */
@@ -188,6 +376,37 @@ Perl_sv_pvutf8(pTHX_ SV *sv)
 }
 
 /*
+=for apidoc sv_pvutf8
+
+Use the C<SvPVutf8_nolen> macro instead
+
+=for apidoc sv_pvutf8n
+
+A private implementation of the C<SvPVutf8> macro for compilers
+which can't cope with complex macro expressions. Always use the macro
+instead.
+
+=cut
+*/
+
+char *
+Perl_sv_pvutf8n(pTHX_ SV *sv, STRLEN *lp)
+{
+    sv_utf8_upgrade(sv);
+    return sv_pvn(sv,lp);
+}
+
+/* sv_utf8_upgrade() is now a macro using sv_utf8_upgrade_flags();
+ * this function provided for binary compatibility only
+ */
+
+STRLEN
+Perl_sv_utf8_upgrade(pTHX_ register SV *sv)
+{
+    return sv_utf8_upgrade_flags(sv, SV_GMAGIC);
+}
+
+/*
 =for apidoc A|U8 *|uvchr_to_utf8|U8 *d|UV uv
 
 Adds the UTF-8 representation of the Native codepoint C<uv> to the end
@@ -385,6 +604,14 @@ Perl_av_fake(pTHX_ register I32 size, register SV **strp)
 }
 
 bool
+Perl_do_open(pTHX_ GV *gv, register const char *name, I32 len, int as_raw,
+            int rawmode, int rawperm, PerlIO *supplied_fp)
+{
+    return do_openn(gv, name, len, as_raw, rawmode, rawperm,
+                   supplied_fp, (SV **) NULL, 0);
+}
+
+bool
 Perl_do_open9(pTHX_ GV *gv, register const char *name, I32 len, int 
 as_raw,
               int rawmode, int rawperm, PerlIO *supplied_fp, SV *svs,
@@ -409,6 +636,21 @@ Perl_do_binmode(pTHX_ PerlIO *fp, int iotype, int mode)
  return PerlIO_binmode(aTHX_ fp, iotype, mode, name);
 }
 
+#ifndef OS2
+bool
+Perl_do_aexec(pTHX_ SV *really, register SV **mark, register SV **sp)
+{
+    return do_aexec5(really, mark, sp, 0, 0);
+}
+#endif
+
+#ifdef PERL_DEFAULT_DO_EXEC3_IMPLEMENTATION
+bool
+Perl_do_exec(pTHX_ const char *cmd)
+{
+    return do_exec3(cmd,0,0);
+}
+#endif
 
 /*
  * Local variables: