return 0;
}
+int
+Perl_magic_regdatum_set(pTHX_ SV *sv, MAGIC *mg)
+{
+ dTHR;
+ Perl_croak(aTHX_ PL_no_modify);
+ /* NOT REACHED */
+ return 0;
+}
+
U32
Perl_magic_len(pTHX_ SV *sv, MAGIC *mg)
{
register I32 paren;
register I32 i;
register REGEXP *rx;
+ I32 s1, t1;
switch (*mg->mg_ptr) {
case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9': case '&':
if (PL_curpm && (rx = PL_curpm->op_pmregexp)) {
- I32 s1, t1;
paren = atoi(mg->mg_ptr);
getparen:
(t1 = rx->endp[paren]) != -1)
{
i = t1 - s1;
+ getlen:
+ if (i > 0 && (PL_curpm->op_pmdynflags & PMdf_UTF8) && !IN_BYTE) {
+ char *s = rx->subbeg + s1;
+ char *send = rx->subbeg + t1;
+ i = 0;
+ while (s < send) {
+ s += UTF8SKIP(s);
+ i++;
+ }
+ }
if (i >= 0)
return i;
}
if (PL_curpm && (rx = PL_curpm->op_pmregexp)) {
if (rx->startp[0] != -1) {
i = rx->startp[0];
- if (i >= 0)
- return i;
+ if (i > 0) {
+ s1 = 0;
+ t1 = i;
+ goto getlen;
+ }
}
}
return 0;
if (PL_curpm && (rx = PL_curpm->op_pmregexp)) {
if (rx->endp[0] != -1) {
i = rx->sublen - rx->endp[0];
- if (i >= 0)
- return i;
+ if (i > 0) {
+ s1 = rx->endp[0];
+ t1 = rx->sublen;
+ goto getlen;
+ }
}
}
return 0;
{
char msg[256];
- sv_setnv(sv,(double)gLastMacOSErr);
- sv_setpv(sv, gLastMacOSErr ? GetSysErrText(gLastMacOSErr, msg) : "");
+ sv_setnv(sv,(double)gMacPerl_OSErr);
+ sv_setpv(sv, gMacPerl_OSErr ? GetSysErrText(gMacPerl_OSErr, msg) : "");
}
#else
#ifdef VMS
if (*(mg->mg_ptr+1) == '\0')
sv_setiv(sv, (IV)((PL_dowarn & G_WARN_ON) ? TRUE : FALSE));
else if (strEQ(mg->mg_ptr, "\027ARNING_BITS")) {
- if (PL_compiling.cop_warnings == WARN_NONE ||
- PL_compiling.cop_warnings == WARN_STD)
+ if (PL_compiling.cop_warnings == pWARN_NONE ||
+ PL_compiling.cop_warnings == pWARN_STD)
{
sv_setpvn(sv, WARN_NONEstring, WARNsize) ;
}
- else if (PL_compiling.cop_warnings == WARN_ALL) {
+ else if (PL_compiling.cop_warnings == pWARN_ALL) {
sv_setpvn(sv, WARN_ALLstring, WARNsize) ;
}
else {
sv_setsv(sv, PL_compiling.cop_warnings);
}
+ SvPOK_only(sv);
}
else if (strEQ(mg->mg_ptr, "\027IDE_SYSTEM_CALLS"))
sv_setiv(sv, (IV)PL_widesyscalls);
{
i = t1 - s1;
s = rx->subbeg + s1;
+ if (!rx->subbeg)
+ break;
+
getrx:
if (i >= 0) {
bool was_tainted;
return 0;
}
+#ifndef PERL_MICRO
int
Perl_magic_getsig(pTHX_ SV *sv, MAGIC *mg)
{
}
return 0;
}
+#endif /* !PERL_MICRO */
int
Perl_magic_setisa(pTHX_ SV *sv, MAGIC *mg)
atoi(MgPV(mg,n_a)), FALSE);
if (svp && SvIOKp(*svp) && (o = INT2PTR(OP*,SvIVX(*svp))))
o->op_private = i;
- else if (ckWARN_d(WARN_INTERNAL))
- Perl_warner(aTHX_ WARN_INTERNAL, "Can't break at that line\n");
return 0;
}
break;
case '\005': /* ^E */
#ifdef MACOS_TRADITIONAL
- gLastMacOSErr = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
+ gMacPerl_OSErr = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
#else
# ifdef VMS
set_vaxc_errno(SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv));
if ( ! (PL_dowarn & G_WARN_ALL_MASK)) {
if (!SvPOK(sv) && PL_localizing) {
sv_setpvn(sv, WARN_NONEstring, WARNsize);
- PL_compiling.cop_warnings = WARN_NONE;
+ PL_compiling.cop_warnings = pWARN_NONE;
break;
}
- if (memEQ(SvPVX(sv), WARN_ALLstring, WARNsize)) {
- PL_compiling.cop_warnings = WARN_ALL;
+ if (isWARN_on(sv, WARN_ALL) && !isWARNf_on(sv, WARN_ALL)) {
+ PL_compiling.cop_warnings = pWARN_ALL;
PL_dowarn |= G_WARN_ONCE ;
}
- else if (memEQ(SvPVX(sv), WARN_NONEstring, WARNsize))
- PL_compiling.cop_warnings = WARN_NONE;
- else {
- if (specialWARN(PL_compiling.cop_warnings))
- PL_compiling.cop_warnings = newSVsv(sv) ;
- else
- sv_setsv(PL_compiling.cop_warnings, sv);
- if (isWARN_on(PL_compiling.cop_warnings, WARN_ONCE))
- PL_dowarn |= G_WARN_ONCE ;
- }
+ else {
+ STRLEN len, i;
+ int accumulate = 0 ;
+ char * ptr = (char*)SvPV(sv, len) ;
+ for (i = 0 ; i < len ; ++i)
+ accumulate += ptr[i] ;
+ if (!accumulate)
+ PL_compiling.cop_warnings = pWARN_NONE;
+ else {
+ if (specialWARN(PL_compiling.cop_warnings))
+ PL_compiling.cop_warnings = newSVsv(sv) ;
+ else
+ sv_setsv(PL_compiling.cop_warnings, sv);
+ if (isWARN_on(PL_compiling.cop_warnings, WARN_ONCE))
+ PL_dowarn |= G_WARN_ONCE ;
+ }
+ }
}
}
else if (strEQ(mg->mg_ptr, "\027IDE_SYSTEM_CALLS"))
break;
#ifndef MACOS_TRADITIONAL
case '0':
+#ifdef HAS_SETPROCTITLE
+ /* The BSDs don't show the argv[] in ps(1) output, they
+ * show a string from the process struct and provide
+ * the setproctitle() routine to manipulate that. */
+ {
+ s = SvPV(sv, len);
+# if __FreeBSD_version >= 410001
+ /* The leading "-" removes the "perl: " prefix,
+ * but not the "(perl) suffix from the ps(1)
+ * output, because that's what ps(1) shows if the
+ * argv[] is modified. */
+ setproctitle("-%s", s, len + 1);
+# else /* old FreeBSDs, NetBSD, OpenBSD, anyBSD */
+ /* This doesn't really work if you assume that
+ * $0 = 'foobar'; will wipe out 'perl' from the $0
+ * because in ps(1) output the result will be like
+ * sprintf("perl: %s (perl)", s)
+ * I guess this is a security feature:
+ * one (a user process) cannot get rid of the original name.
+ * --jhi */
+ setproctitle("%s", s);
+# endif
+ }
+#endif
if (!PL_origalen) {
s = PL_origargv[0];
s += strlen(s);
Signal_t
Perl_sighandler(int sig)
{
+#if defined(WIN32) && defined(PERL_IMPLICIT_CONTEXT)
+ dTHXoa(PL_curinterp); /* fake TLS, because signals don't do TLS */
+#else
dTHX;
+#endif
dSP;
GV *gv = Nullgv;
HV *st;
U32 flags = 0;
I32 o_save_i = PL_savestack_ix;
XPV *tXpv = PL_Xpv;
+
+#if defined(WIN32) && defined(PERL_IMPLICIT_CONTEXT)
+ PERL_SET_THX(aTHXo); /* fake TLS, see above */
+#endif
if (PL_savestack_ix + 15 <= PL_savestack_max)
flags |= 1;