Down with C++ reserved names
[p5sagit/p5-mst-13.2.git] / perl.h
diff --git a/perl.h b/perl.h
index ba7e3dc..fe62755 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -1,7 +1,7 @@
 /*    perl.h
  *
  *    Copyright (C) 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.
 #define CALLREG_INTUIT_STRING CALL_FPTR(PL_regint_string)
 #define CALLREGFREE CALL_FPTR(PL_regfree)
 
-#ifdef PERL_FLEXIBLE_EXCEPTIONS
-#  define CALLPROTECT CALL_FPTR(PL_protect)
-#endif
-
 #ifdef HASATTRIBUTE
 #  if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER)
 #    define PERL_UNUSED_DECL
@@ -208,7 +204,9 @@ register struct op *Perl_op asm(stringify(OP_IN_REGISTER));
 #endif
 
 #if defined(__STRICT_ANSI__) && defined(PERL_GCC_PEDANTIC)
-#   define PERL_GCC_BRACE_GROUPS_FORBIDDEN
+#  if !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
+#    define PERL_GCC_BRACE_GROUPS_FORBIDDEN
+#  endif
 #endif
 
 /*
@@ -751,7 +749,7 @@ int usleep(unsigned int);
 #  define MALLOC_CHECK_TAINT(argc,argv,env)
 #endif /* MYMALLOC */
 
-#define TOO_LATE_FOR_(ch,s)    Perl_croak(aTHX_ "Too late for \"-%c\" option%s", (char)(ch), s)
+#define TOO_LATE_FOR_(ch,s)    Perl_croak(aTHX_ "\"-%c\" is on the #! line, it must also be used on the command line%s", (char)(ch), s)
 #define TOO_LATE_FOR(ch)       TOO_LATE_FOR_(ch, "")
 #define MALLOC_TOO_LATE_FOR(ch)        TOO_LATE_FOR_(ch, " with $ENV{PERL_MALLOC_OPT}")
 #define MALLOC_CHECK_TAINT2(argc,argv) MALLOC_CHECK_TAINT(argc,argv,NULL)
@@ -2392,40 +2390,37 @@ typedef pthread_key_t   perl_key;
 
 #ifndef SVf
 #  ifdef CHECK_FORMAT
-#    define SVf "p"
-#    ifndef SVf256
-#      define SVf256 SVf
-#    endif
+#    define SVf "-p"
 #  else
 #    define SVf "_"
 #  endif
 #endif
 
-#ifndef SVf256
-#  define SVf256 ".256"SVf
-#endif
-
-#ifndef UVf
+#ifndef SVf_precision
 #  ifdef CHECK_FORMAT
-#    define UVf UVuf
+#    define SVf_precision(n) "-" n "p"
 #  else
-#    define UVf "Vu"
+#    define SVf_precision(n) "." n "_"
 #  endif
 #endif
 
-#ifndef VDf
-#  ifdef CHECK_FORMAT
-#    define VDf "p"
-#  else
-#    define VDf "vd"
-#  endif
+#ifndef SVf32
+#  define SVf32 SVf_precision("32")
+#endif
+
+#ifndef SVf256
+#  define SVf256 SVf_precision("256")
+#endif
+#ifndef UVf
+#  define UVf UVuf
 #endif
 
-#ifndef Nullformat
+#ifndef DieNull
 #  ifdef CHECK_FORMAT
-#    define Nullformat "%s",""
+#    define DieNull Perl_vdie(aTHX_ Nullch, Null(va_list *))
 #  else
-#    define Nullformat Nullch
+#    define DieNull Perl_die(aTHX_ Nullch)
 #  endif
 #endif
 
@@ -2966,21 +2961,12 @@ Gid_t getegid (void);
 
 
 #ifndef assert  /* <assert.h> might have been included somehow */
-#ifdef DEBUGGING
-#define assert(what)   PERL_DEB( {                                     \
-       if (!(what)) {                                                  \
-           Perl_croak(aTHX_ "Assertion " STRINGIFY(what) " failed: file \"%s\", line %d",      \
-               __FILE__, __LINE__);                                    \
-           PerlProc_exit(1);                                           \
-       }})
-#else
-#define assert(what)   PERL_DEB( {                                     \
-       if (!(what)) {                                                  \
-           Perl_croak(aTHX_ "Assertion failed: file \"%s\", line %d",  \
-               __FILE__, __LINE__);                                    \
-           PerlProc_exit(1);                                           \
-       }})
-#endif
+#define assert(what)   PERL_DEB(                                       \
+       ((what) ? ((void) 0) :                                          \
+           (Perl_croak(aTHX_ "Assertion " STRINGIFY(what) " failed: file \"%s\", line %d",     \
+               __FILE__, __LINE__),                                    \
+           PerlProc_exit(1),                                           \
+           (void) 0)))
 #endif
 
 struct ufuncs {
@@ -3248,6 +3234,8 @@ EXTCONST char PL_no_wrongref[]
   INIT("Can't use %s ref as %s ref");
 EXTCONST char PL_no_symref[]
   INIT("Can't use string (\"%.32s\") as %s ref while \"strict refs\" in use");
+EXTCONST char PL_no_symref_sv[]
+  INIT("Can't use string (\"%" SVf32 "\") as %s ref while \"strict refs\" in use");
 EXTCONST char PL_no_usym[]
   INIT("Can't use an undefined value as %s reference");
 EXTCONST char PL_no_aelem[]
@@ -3280,10 +3268,10 @@ EXTCONST char PL_uuemap[65]
 
 
 #ifdef DOINIT
-EXT char *PL_sig_name[] = { SIG_NAME };
+EXT const char *PL_sig_name[] = { SIG_NAME };
 EXT int   PL_sig_num[]  = { SIG_NUM };
 #else
-EXT char *PL_sig_name[];
+EXT const char *PL_sig_name[];
 EXT int   PL_sig_num[];
 #endif
 
@@ -3714,7 +3702,7 @@ typedef enum {
   e_star        /* asterisk   */
 } howlen_t;
 
-typedef struct {
+typedef struct tempsym {
   char*    patptr;   /* current template char */
   char*    patend;   /* one after last char   */
   char*    grpbeg;   /* 1st char of ()-group  */
@@ -3725,6 +3713,8 @@ typedef struct {
   int      level;    /* () nesting level      */
   U32      flags;    /* /=4, comma=2, pack=1  */
                      /*   and group modifiers */
+  STRLEN   strbeg;   /* offset of group start */
+  struct tempsym *previous; /* previous group */
 } tempsym_t;
 
 #include "thread.h"
@@ -3973,7 +3963,7 @@ enum {
 };
 
 #define NofAMmeth max_amg_code
-#define AMG_id2name(id) ((char*)PL_AMG_names[id]+1)
+#define AMG_id2name(id) (PL_AMG_names[id]+1)
 
 #ifdef DOINIT
 EXTCONST char * PL_AMG_names[NofAMmeth] = {
@@ -4371,6 +4361,13 @@ typedef struct am_table_short AMTS;
        Zero(my_cxtp, 1, my_cxt_t);                                     \
        sv_setuv(my_cxt_sv, PTR2UV(my_cxtp))
 
+/* Clones the per-interpreter data. */
+#define MY_CXT_CLONE \
+       dMY_CXT_SV;                                                     \
+       my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\
+       Copy(INT2PTR(my_cxt_t*, SvUV(my_cxt_sv)), my_cxtp, 1, my_cxt_t);\
+       sv_setuv(my_cxt_sv, PTR2UV(my_cxtp))
+
 /* This macro must be used to access members of the my_cxt_t structure.
  * e.g. MYCXT.some_data */
 #define MY_CXT         (*my_cxtp)
@@ -4390,6 +4387,7 @@ typedef struct am_table_short AMTS;
 #define dMY_CXT_SV     dNOOP
 #define dMY_CXT                dNOOP
 #define MY_CXT_INIT    NOOP
+#define MY_CXT_CLONE   NOOP
 #define MY_CXT         my_cxt
 
 #define pMY_CXT                void