if (PL_minus_c) {
#ifdef MACOS_TRADITIONAL
- PerlIO_printf(PerlIO_stderr(), "# %s syntax OK\n", MPWFileName(PL_origfilename));
+ PerlIO_printf(PerlIO_stderr(), "%s syntax OK\n", MPWFileName(PL_origfilename));
#else
PerlIO_printf(Perl_error_log, "%s syntax OK\n", PL_origfilename);
#endif
#endif
/*
+ * Some operating systems are stingy with stack allocation,
+ * so perl may have to guard against stack overflow.
+ */
+#ifndef PERL_STACK_OVERFLOW_CHECK
+#define PERL_STACK_OVERFLOW_CHECK() 0
+#endif
+
+/*
+ * Some nonpreemptive operating systems find it convenient to
+ * check for asynchronous conditions after each op execution.
+ * Keep this check simple, or it may slow down execution
+ * massively.
+ */
+#ifndef PERL_ASYNC_CHECK
+#define PERL_ASYNC_CHECK() 0
+#endif
+
+/*
+ * On some operating systems, a memory allocation may succeed,
+ * but put the process too close to the system's comfort limit.
+ * In this case, PERL_ALLOC_CHECK frees the pointer and sets
+ * it to NULL.
+ */
+#ifndef PERL_ALLOC_CHECK
+#define PERL_ALLOC_CHECK(p) 0
+#endif
+
+/*
* nice_chunk and nice_chunk size need to be set
* and queried under the protection of sv_mutex
*/
if (CvDEPTH(cv) < 2)
(void)SvREFCNT_inc(cv);
else { /* save temporaries on recursion? */
-#ifdef MACOS_TRADITIONAL
- MacStackAttack();
-#endif
+ PERL_STACK_OVERFLOW_CHECK();
if (CvDEPTH(cv) == 100 && ckWARN(WARN_RECURSION))
sub_crush_depth(cv);
if (CvDEPTH(cv) > AvFILLp(padlist)) {
if (CvDEPTH(cv) < 2)
(void)SvREFCNT_inc(cv);
else { /* save temporaries on recursion? */
-#ifdef MACOS_TRADITIONAL
- MacStackAttack();
-#endif
+ PERL_STACK_OVERFLOW_CHECK();
if (CvDEPTH(cv) > AvFILLp(padlist)) {
AV *av;
AV *newpad = newAV();
dTHR;
while ( PL_op = CALL_FPTR(PL_op->op_ppaddr)(aTHX) ) {
-#ifdef MACOS_TRADITIONAL
- MACPERL_DO_ASYNC_TASKS();
-#endif
+ PERL_ASYNC_CHECK();
}
TAINT_NOT;
}
do {
-#ifdef MACOS_TRADITIONAL
- MACPERL_DO_ASYNC_TASKS();
-#endif
+ PERL_ASYNC_CHECK();
if (PL_debug) {
if (PL_watchaddr != 0 && *PL_watchaddr != PL_watchok)
PerlIO_printf(Perl_debug_log,
eptr = va_arg(*args, char*);
if (eptr)
#ifdef MACOS_TRADITIONAL
+ /* On MacOS, %#s format is used for Pascal strings */
if (alt)
elen = *eptr++;
else
}
sub msgcmp( $ $ ) {
- ## filter out platform-dependent aspects of error messages
my ($line1, $line2) = @_;
- for ($line1, $line2) {
- if ( /^#*\s*(\S.*?)\s+(?:has \d+\s*)?pod syntax (?:error|OK)/ ) {
- my $fname = $1;
- s/^#*\s*// if ($^O eq 'MacOS');
- s/^\s*\Q$fname\E/stripname($fname)/e;
- }
- elsif ( /^#*\s*\*+\s*(?:ERROR|Unterminated)/ ) {
- s/^#*\s*// if ($^O eq 'MacOS');
- s/of file\s+(\S.*?)\s*$/"of file ".stripname($1)/e;
- s/at\s+(\S.*?)\s+line/"at ".stripname($1)." line"/e;
- }
- }
return $line1 ne $line2;
}
char ch;
int sawline = 0;
-#ifdef MACOS_TRADITIONAL
- MACPERL_DO_ASYNC_TASKS();
-#endif
+ PERL_ASYNC_CHECK();
PL_curcop->cop_line++;
if (*s++ != '#')
return;
#endif
case ' ': case '\t': case '\f': case 013:
#ifdef MACOS_TRADITIONAL
- case '\312':
+ case '\312': /* Them nonbreaking spaces again */
#endif
s++;
goto retry;
Perl_sv_catpvf(aTHX_ where_sv, "\\%03o", yychar & 255);
where = SvPVX(where_sv);
}
-#ifdef MACOS_TRADITIONAL
- msg = sv_2mortal(newSVpv("# ", 0));
- sv_catpvf(msg, "%s, ", s);
-#else
msg = sv_2mortal(newSVpv(s, 0));
Perl_sv_catpvf(aTHX_ msg, " at %_ line %"IVdf", ",
GvSV(PL_curcop->cop_filegv), (IV)PL_curcop->cop_line);
-#endif
if (context)
Perl_sv_catpvf(aTHX_ msg, "near \"%.*s\"\n", contlen, context);
else
Perl_sv_catpvf(aTHX_ msg, "%s\n", where);
if (PL_multi_start < PL_multi_end &&
(U32)(PL_curcop->cop_line - PL_multi_end) <= 1) {
-#ifdef MACOS_TRADITIONAL
- Perl_sv_catpvf(aTHX_ msg,
- "# (Might be a runaway multi-line %c%c string starting on line %"IVdf")\n",
- (int)PL_multi_open,(int)PL_multi_close,(IV)PL_multi_start);
-#else
Perl_sv_catpvf(aTHX_ msg,
" (Might be a runaway multi-line %c%c string starting on line %"IVdf")\n",
(int)PL_multi_open,(int)PL_multi_close,(IV)PL_multi_start);
-#endif
PL_multi_end = 0;
}
-#ifdef MACOS_TRADITIONAL
- MacPosIndication(msg, SvPVX(GvSV(PL_curcop->cop_filegv)), PL_curcop->cop_line);
- sv_catpvn(msg, "\n", 1);
-#endif
if (PL_in_eval & EVAL_WARNONLY)
Perl_warn(aTHX_ "%_", msg);
else
* XXX This advice seems to be widely ignored :-( --AD August 1996.
*/
-#ifdef MACOS_TRADITIONAL
-extern void * gSacrificialGoat;
-#define MAC_CHECK_GOAT(p) if (!gSacrificialGoat && p) { PerlMem_free(p); p = NULL; } else
-#endif
-
Malloc_t
Perl_safesysmalloc(MEM_SIZE size)
{
Perl_croak_nocontext("panic: malloc");
#endif
ptr = PerlMem_malloc(size?size:1); /* malloc(0) is NASTY on our system */
-#ifdef MACOS_TRADITIONAL
- MAC_CHECK_GOAT(ptr);
-#endif
+ PERL_ALLOC_CHECK(ptr);
DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%"UVxf": (%05d) malloc %ld bytes\n",PTR2UV(ptr),PL_an++,(long)size));
if (ptr != Nullch)
return ptr;
Perl_croak_nocontext("panic: realloc");
#endif
ptr = PerlMem_realloc(where,size);
-
-#ifdef MACOS_TRADITIONAL
- MAC_CHECK_GOAT(ptr);
-#endif
+ PERL_ALLOC_CHECK(ptr);
DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%"UVxf": (%05d) rfree\n",PTR2UV(where),PL_an++));
DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%"UVxf": (%05d) realloc %ld bytes\n",PTR2UV(ptr),PL_an++,(long)size));
#endif
size *= count;
ptr = PerlMem_malloc(size?size:1); /* malloc(0) is NASTY on our system */
-#ifdef MACOS_TRADITIONAL
- MAC_CHECK_GOAT(ptr);
-#endif
+ PERL_ALLOC_CHECK(ptr);
DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%"UVxf": (%05d) calloc %ld x %ld bytes\n",PTR2UV(ptr),PL_an++,(long)count,(long)size));
if (ptr != Nullch) {
memset((void*)ptr, 0, size);
SV *sv = mess_alloc();
static char dgd[] = " during global destruction.\n";
-#ifdef MACOS_TRADITIONAL
- sv_setpv(sv, "# ");
- sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*));
- if (SvPVX(sv)[2] == '#')
- sv_insert(sv, 0, 2, "", 0);
-#else
sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*));
-#endif
if (!SvCUR(sv) || *(SvEND(sv) - 1) != '\n') {
dTHR;
if (PL_curcop->cop_line)
Perl_sv_catpvf(aTHX_ sv, " thread %ld", thr->tid);
#endif
sv_catpv(sv, PL_dirty ? dgd : ".\n");
-#ifdef MACOS_TRADITIONAL
- if (PL_curcop->cop_line) {
- MPWPosIndication(sv, SvPVX(GvSV(PL_curcop->cop_filegv)), PL_curcop->cop_line);
- sv_catpv(sv, "\n");
- }
-#endif
}
return sv;
}
errno = e;
#endif
}
-#ifdef MACOS_TRADITIONAL
- MacPosCommit();
-#endif
my_failure_exit();
}