This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Bodge to make Tk work - like the UTF8 flag, the READONLY flag has too
[perl5.git] / scope.h
diff --git a/scope.h b/scope.h
index e2150e8..f86039d 100644 (file)
--- a/scope.h
+++ b/scope.h
@@ -1,7 +1,7 @@
 /*    scope.h
  *
  *    Copyright (C) 1993, 1994, 1996, 1997, 1998, 1999,
- *    2000, 2001, 2002, by Larry Wall and others
+ *    2000, 2001, 2002, 2004, 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.
@@ -47,6 +47,8 @@
 #define SAVEt_MORTALIZESV      36
 #define SAVEt_SHARED_PVREF     37
 #define SAVEt_BOOL             38
+#define SAVEt_SET_SVFLAGS      39
+#define SAVEt_SAVESWITCHSTACK  40
 
 #ifndef SCOPE_SAVES_SIGNAL_MASK
 #define SCOPE_SAVES_SIGNAL_MASK 0
@@ -96,13 +98,11 @@ Closing bracket on a callback.  See C<ENTER> and L<perlcall>.
 #define ENTER                                                  \
     STMT_START {                                               \
        push_scope();                                           \
-       DEBUG_l(WITH_THR(Perl_deb(aTHX_ "ENTER scope %ld at %s:%d\n",   \
-                   PL_scopestack_ix, __FILE__, __LINE__)));    \
+       DEBUG_SCOPE("ENTER")                                    \
     } STMT_END
 #define LEAVE                                                  \
     STMT_START {                                               \
-       DEBUG_l(WITH_THR(Perl_deb(aTHX_ "LEAVE scope %ld at %s:%d\n",   \
-                   PL_scopestack_ix, __FILE__, __LINE__)));    \
+       DEBUG_SCOPE("LEAVE")                                    \
        pop_scope();                                            \
     } STMT_END
 #else
@@ -134,6 +134,7 @@ Closing bracket on a callback.  See C<ENTER> and L<perlcall>.
 #define SAVEGENERICSV(s)       save_generic_svref((SV**)&(s))
 #define SAVEGENERICPV(s)       save_generic_pvref((char**)&(s))
 #define SAVESHAREDPV(s)                save_shared_pvref((char**)&(s))
+#define SAVESETSVFLAGS(sv,mask,val)    save_set_svflags(sv,mask,val)
 #define SAVEDELETE(h,k,l) \
          save_delete(SOFT_CAST(HV*)(h), SOFT_CAST(char*)(k), (I32)(l))
 #define SAVEDESTRUCTOR(f,p) \
@@ -152,14 +153,14 @@ Closing bracket on a callback.  See C<ENTER> and L<perlcall>.
 #define SAVEOP()       save_op()
 
 #define SAVEHINTS() \
-    STMT_START {                               \
-       if (PL_hints & HINT_LOCALIZE_HH)        \
-           save_hints();                       \
-       else {                                  \
-           SSCHECK(2);                         \
-           SSPUSHINT(PL_hints);                \
-           SSPUSHINT(SAVEt_HINTS);             \
-       }                                       \
+    STMT_START {                                       \
+       SSCHECK(3);                                     \
+       if (PL_hints & HINT_LOCALIZE_HH) {              \
+           SSPUSHPTR(GvHV(PL_hintgv));                 \
+           GvHV(PL_hintgv) = newHVhv(GvHV(PL_hintgv)); \
+       }                                               \
+       SSPUSHINT(PL_hints);                            \
+       SSPUSHINT(SAVEt_HINTS);                         \
     } STMT_END
 
 #define SAVECOMPPAD() \
@@ -169,6 +170,16 @@ Closing bracket on a callback.  See C<ENTER> and L<perlcall>.
        SSPUSHINT(SAVEt_COMPPAD);                               \
     } STMT_END
 
+#define SAVESWITCHSTACK(f,t) \
+    STMT_START {                                       \
+       SSCHECK(3);                                     \
+       SSPUSHPTR((SV*)(f));                            \
+       SSPUSHPTR((SV*)(t));                            \
+       SSPUSHINT(SAVEt_SAVESWITCHSTACK);               \
+       SWITCHSTACK((f),(t));                           \
+       PL_curstackinfo->si_stack = (t);                \
+    } STMT_END
+
 #ifdef USE_ITHREADS
 #  define SAVECOPSTASH(c)      SAVEPPTR(CopSTASHPV(c))
 #  define SAVECOPSTASH_FREE(c) SAVESHAREDPV(CopSTASHPV(c))
@@ -181,7 +192,7 @@ Closing bracket on a callback.  See C<ENTER> and L<perlcall>.
 #  define SAVECOPFILE_FREE(c)  SAVEGENERICSV(CopFILEGV(c))
 #endif
 
-#define SAVECOPLINE(c)         SAVEI16(CopLINE(c))
+#define SAVECOPLINE(c)         SAVEI32(CopLINE(c))
 
 /* SSNEW() temporarily allocates a specified number of bytes of data on the
  * savestack.  It returns an integer index into the savestack, because a