/* scope.c
*
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- * 2000, 2001, 2002, 2003, 2004, by Larry Wall and others
+ * 2000, 2001, 2002, 2003, 2004, 2005, by Larry Wall and others
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
* levels..."
*/
+/* This file contains functions to manipulate several of Perl's stacks;
+ * in particular it contains code to push various types of things onto
+ * the savestack, then to pop them off and perform the correct restorative
+ * action for each one. This corresponds to the cleanup Perl does at
+ * each scope exit.
+ */
+
#include "EXTERN.h"
#define PERL_IN_SCOPE_C
#include "perl.h"
-#if defined(PERL_FLEXIBLE_EXCEPTIONS)
-void *
-Perl_default_protect(pTHX_ volatile JMPENV *pcur_env, int *excpt,
- protect_body_t body, ...)
-{
- void *ret;
- va_list args;
- va_start(args, body);
- ret = vdefault_protect(pcur_env, excpt, body, &args);
- va_end(args);
- return ret;
-}
-
-void *
-Perl_vdefault_protect(pTHX_ volatile JMPENV *pcur_env, int *excpt,
- protect_body_t body, va_list *args)
-{
- int ex;
- void *ret;
-
- JMPENV_PUSH(ex);
- if (ex)
- ret = NULL;
- else
- ret = CALL_FPTR(body)(aTHX_ *args);
- *excpt = ex;
- JMPENV_POP;
- return ret;
-}
-#endif
-
SV**
Perl_stack_grow(pTHX_ SV **sp, SV **p, int n)
{
void
Perl_save_item(pTHX_ register SV *item)
{
- register SV *sv = NEWSV(0,0);
+ register SV *sv = newSVsv(item);
- sv_setsv(sv,item);
SSCHECK(3);
SSPUSHPTR(item); /* remember the pointer */
SSPUSHPTR(sv); /* remember the value */
break;
case SVt_PVCV:
Perl_croak(aTHX_ "panic: leave_scope pad code");
- case SVt_RV:
- case SVt_IV:
- case SVt_NV:
- (void)SvOK_off(sv);
- break;
default:
- (void)SvOK_off(sv);
- (void)SvOOK_off(sv);
+ SvOK_off(sv);
break;
}
SvPADSTALE_on(sv); /* mark as no longer live */
}
#endif /* DEBUGGING */
}
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vim: shiftwidth=4:
+*/