This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
sv_utf8_upgrade declares itself to be a mathom, so off it goes.
[perl5.git] / mathoms.c
index a9fad36..4f35282 100644 (file)
--- a/mathoms.c
+++ b/mathoms.c
@@ -36,6 +36,36 @@ Perl_ref(pTHX_ OP *o, I32 type)
     return doref(o, type, TRUE);
 }
 
+/*
+=for apidoc sv_unref
+
+Unsets the RV status of the SV, and decrements the reference count of
+whatever was being referenced by the RV.  This can almost be thought of
+as a reversal of C<newSVrv>.  This is C<sv_unref_flags> with the C<flag>
+being zero.  See C<SvROK_off>.
+
+=cut
+*/
+
+void
+Perl_sv_unref(pTHX_ SV *sv)
+{
+    sv_unref_flags(sv, 0);
+}
+
+/*
+=for apidoc sv_taint
+
+Taint an SV. Use C<SvTAINTED_on> instead.
+=cut
+*/
+
+void
+Perl_sv_taint(pTHX_ SV *sv)
+{
+    sv_magic((sv), Nullsv, PERL_MAGIC_taint, Nullch, 0);
+}
+
 /* sv_2iv() is now a macro using Perl_sv_2iv_flags();
  * this function provided for binary compatibility only
  */
@@ -66,6 +96,21 @@ Perl_sv_2pv(pTHX_ register SV *sv, STRLEN *lp)
     return sv_2pv_flags(sv, lp, SV_GMAGIC);
 }
 
+/*
+=for apidoc sv_force_normal
+
+Undo various types of fakery on an SV: if the PV is a shared string, make
+a private copy; if we're a ref, stop refing; if we're a glob, downgrade to
+an xpvmg. See also C<sv_force_normal_flags>.
+
+=cut
+*/
+
+void
+Perl_sv_force_normal(pTHX_ register SV *sv)
+{
+    sv_force_normal_flags(sv, 0);
+}
 
 /* sv_setsv() is now a macro using Perl_sv_setsv_flags();
  * this function provided for binary compatibility only
@@ -142,6 +187,16 @@ Perl_sv_pvutf8(pTHX_ SV *sv)
     return sv_pv(sv);
 }
 
+/* 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
 
@@ -305,6 +360,66 @@ Perl_gv_efullname(pTHX_ SV *sv, const GV *gv)
     gv_efullname3(sv, gv, sv == (const SV*)gv ? "*" : "");
 }
 
+void
+Perl_gv_fullname3(pTHX_ SV *sv, const GV *gv, const char *prefix)
+{
+    gv_fullname4(sv, gv, prefix, TRUE);
+}
+
+void
+Perl_gv_efullname3(pTHX_ SV *sv, const GV *gv, const char *prefix)
+{
+    gv_efullname4(sv, gv, prefix, TRUE);
+}
+
+AV *
+Perl_av_fake(pTHX_ register I32 size, register SV **strp)
+{
+    register SV** ary;
+    register AV * const av = (AV*)NEWSV(9,0);
+
+    sv_upgrade((SV *)av, SVt_PVAV);
+    Newx(ary,size+1,SV*);
+    AvALLOC(av) = ary;
+    Copy(strp,ary,size,SV*);
+    AvREIFY_only(av);
+    SvPV_set(av, (char*)ary);
+    AvFILLp(av) = size - 1;
+    AvMAX(av) = size - 1;
+    while (size--) {
+        assert (*strp);
+        SvTEMP_off(*strp);
+        strp++;
+    }
+    return av;
+}
+
+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,
+              I32 num_svs)
+{
+    PERL_UNUSED_ARG(num_svs);
+    return do_openn(gv, name, len, as_raw, rawmode, rawperm,
+                    supplied_fp, &svs, 1);
+}
+
+int
+Perl_do_binmode(pTHX_ PerlIO *fp, int iotype, int mode)
+{
+ /* The old body of this is now in non-LAYER part of perlio.c
+  * This is a stub for any XS code which might have been calling it.
+  */
+ const char *name = ":raw";
+#ifdef PERLIO_USING_CRLF
+ if (!(mode & O_BINARY))
+     name = ":crlf";
+#endif
+ return PerlIO_binmode(aTHX_ fp, iotype, mode, name);
+}
+
+
 /*
  * Local variables:
  * c-indentation-style: bsd