[win32] set up PUSHSTACK for __DIE__ and __WARN__ hooks also
Gurusamy Sarathy [Sat, 4 Apr 1998 23:11:52 +0000 (23:11 +0000)]
p4raw-id: //depot/win32/perl@881

cop.h
util.c

diff --git a/cop.h b/cop.h
index 4b2e04f..5eebaba 100644 (file)
--- a/cop.h
+++ b/cop.h
@@ -297,10 +297,8 @@ struct context {
 #define SI_SIGNAL      4
 #define SI_OVERLOAD    5
 #define SI_DESTROY     6
-/* XXX todo
 #define SI_WARNHOOK    7
 #define SI_DIEHOOK     8
-*/
 
 struct stackinfo {
     AV *               si_stack;       /* stack for current runlevel */
diff --git a/util.c b/util.c
index c996081..ac51f13 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1304,11 +1304,12 @@ die(pat, va_alist)
            SvREADONLY_on(msg);
            SAVEFREESV(msg);
 
+           PUSHSTACK(SI_DIEHOOK);
            PUSHMARK(SP);
            XPUSHs(msg);
            PUTBACK;
            perl_call_sv((SV*)cv, G_DISCARD);
-
+           POPSTACK();
            LEAVE;
        }
     }
@@ -1369,11 +1370,12 @@ croak(pat, va_alist)
            SvREADONLY_on(msg);
            SAVEFREESV(msg);
 
+           PUSHSTACK(SI_DIEHOOK);
            PUSHMARK(SP);
            XPUSHs(msg);
            PUTBACK;
            perl_call_sv((SV*)cv, G_DISCARD);
-
+           POPSTACK();
            LEAVE;
        }
     }
@@ -1428,11 +1430,12 @@ warn(pat,va_alist)
            SvREADONLY_on(msg);
            SAVEFREESV(msg);
 
+           PUSHSTACK(SI_WARNHOOK);
            PUSHMARK(SP);
            XPUSHs(msg);
            PUTBACK;
            perl_call_sv((SV*)cv, G_DISCARD);
-
+           POPSTACK();
            LEAVE;
            return;
        }