This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add two deprecation warnings:
[perl5.git] / perl.h
diff --git a/perl.h b/perl.h
index 14e76d8..bd77507 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, 2005, 2006, by Larry Wall and others
+ *    2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 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 CALLREGFREE_PVT(prog) \
     if(prog) CALL_FPTR((prog)->engine->free)(aTHX_ (prog))
 
+#define CALLREG_NUMBUF(rx,paren,usesv) \
+    CALL_FPTR((rx)->engine->numbered_buff_get)(aTHX_ (rx),(paren),(usesv))
+
+#define CALLREG_NAMEDBUF(rx,name,flags) \
+    CALL_FPTR((rx)->engine->named_buff_get)(aTHX_ (rx),(name),(flags))
+
+
 #if defined(USE_ITHREADS)         
 #define CALLREGDUPE(prog,param) \
     Perl_re_dup(aTHX_ (prog),(param))
           : (REGEXP *)NULL) 
 #endif
 
+
+
+
+
 /*
  * Because of backward compatibility reasons the PERL_UNUSED_DECL
  * cannot be changed from postfix to PERL_UNUSED_DECL(x).  Sigh.
@@ -1728,12 +1739,6 @@ typedef UVTYPE UV;
 #define DBL_DIG        15   /* A guess that works lots of places */
 #endif
 #endif
-#ifdef I_FLOAT
-#include <float.h>
-#endif
-#ifndef HAS_DBL_DIG
-#define DBL_DIG        15   /* A guess that works lots of places */
-#endif
 
 #ifdef OVR_LDBL_DIG
 /* Use an overridden LDBL_DIG */
@@ -2066,12 +2071,6 @@ int isnan(double d);
 #   endif
 #endif
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1300) && (_MSC_VER < 1400) && (WINVER < 0x0500)
-/* VC7 or 7.1, building with pre-VC7 runtime libraries. */
-long _ftol( double ); /* Defined by VC6 C libs. */
-long _ftol2( double dblSource ) { return _ftol( dblSource ); }
-#endif
-
 /* The default is to use Perl's own atof() implementation (in numeric.c).
  * Usually that is the one to use but for some platforms (e.g. UNICOS)
  * it is however best to use the native implementation of atof.
@@ -3053,6 +3052,8 @@ typedef pthread_key_t     perl_key;
 #  define SVf256 SVf_(256)
 #endif
 
+#define SVfARG(p) ((void*)(p))
+
 #ifndef vdNUMBER
 #  define vdNUMBER 1
 #endif
@@ -3064,10 +3065,14 @@ typedef pthread_key_t   perl_key;
 #    define VDf "vd"
 #  endif
 #endif
+
+#ifdef PERL_CORE
 /* not used; but needed for backward compatibilty with XS code? - RMB */ 
-#ifndef UVf
-#  define UVf UVuf
+#  ifndef UVf
+#    define UVf UVuf
+#  endif
+#else
+#  undef UVf
 #endif
 
 #ifdef HASATTRIBUTE_FORMAT
@@ -3242,7 +3247,6 @@ typedef        struct crypt_data {     /* straight from /usr/include/crypt.h */
 #  define YYTOKENTYPE
 #endif
 #include "perly.h"
-#include "parser.h"
 
 #ifdef PERL_MAD
 struct nexttoken {
@@ -3279,6 +3283,8 @@ struct _sublex_info {
     char *super_bufend;        /* PL_bufend that was */
 };
 
+#include "parser.h"
+
 typedef struct magic_state MGS;        /* struct magic_state defined in mg.c */
 
 struct scan_data_t;            /* Used in S_* functions in regcomp.c */
@@ -3410,6 +3416,10 @@ long vtohl(long n);
 #define U_I(what) ((unsigned int)U_32(what))
 #define U_L(what) U_32(what)
 
+#ifdef HAS_SIGNBIT
+#  define Perl_signbit signbit
+#endif
+
 /* These do not care about the fractional part, only about the range. */
 #define NV_WITHIN_IV(nv) (I_V(nv) >= IV_MIN && I_V(nv) <= IV_MAX)
 #define NV_WITHIN_UV(nv) ((nv)>=0.0 && U_V(nv) >= UV_MIN && U_V(nv) <= UV_MAX)
@@ -3653,8 +3663,6 @@ Gid_t getegid (void);
 #define PERL_MAGIC_overload_elem  'a' /* %OVERLOAD hash element */
 #define PERL_MAGIC_overload_table 'c' /* Holds overload table (AMT) on stash */
 #define PERL_MAGIC_bm            'B' /* Boyer-Moore (fast string search) */
-#define PERL_MAGIC_regdata_names  '+' /* Regex named capture buffer hash 
-                                       (%+ support) */
 #define PERL_MAGIC_regdata       'D' /* Regex match position data
                                        (@+ and @- vars) */
 #define PERL_MAGIC_regdatum      'd' /* Regex match position data element */
@@ -4361,7 +4369,8 @@ enum {            /* pass one of these to get_vtbl */
 #define HINT_NEW_STRING                0x00008000
 #define HINT_NEW_RE            0x00010000
 #define HINT_LOCALIZE_HH       0x00020000 /* %^H needs to be copied */
-#define HINT_LEXICAL_IO                0x00040000 /* ${^OPEN} is set */
+#define HINT_LEXICAL_IO_IN     0x00040000 /* ${^OPEN} is set for input */
+#define HINT_LEXICAL_IO_OUT    0x00080000 /* ${^OPEN} is set for output */
 
 #define HINT_RE_TAINT          0x00100000 /* re pragma */
 #define HINT_RE_EVAL           0x00200000 /* re pragma */
@@ -4478,11 +4487,6 @@ struct perl_vars *PL_VarsPtr;
 struct interpreter {
 #  include "thrdvar.h"
 #  include "intrpvar.h"
-/*
- * The following is a buffer where new variables must
- * be defined to maintain binary compatibility with previous versions
- */
-PERLVARA(object_compatibility,30,      char)
 };
 
 #else
@@ -4595,66 +4599,71 @@ START_EXTERN_C
 #  define MGVTBL_SET_CONST_MAGIC_GET(var,a,b,c,d,e,f,g,h) EXT_MGVTBL var
 #endif
 
+/* These all need to be 0, not NULL, as NULL can be (void*)0, which is a
+ * pointer to data, whereas we're assigning pointers to functions, which are
+ * not the same beast. ANSI doesn't allow the assignment from one to the other.
+ * (although most, but not all, compilers are prepared to do it)
+ */
 MGVTBL_SET(
     PL_vtbl_sv,
     MEMBER_TO_FPTR(Perl_magic_get),
     MEMBER_TO_FPTR(Perl_magic_set),
     MEMBER_TO_FPTR(Perl_magic_len),
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_env,
-    NULL,
+    0,
     MEMBER_TO_FPTR(Perl_magic_set_all_env),
-    NULL,
+    0,
     MEMBER_TO_FPTR(Perl_magic_clear_all_env),
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_envelem,
-    NULL,
+    0,
     MEMBER_TO_FPTR(Perl_magic_setenv),
-    NULL,
+    0,
     MEMBER_TO_FPTR(Perl_magic_clearenv),
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0
 );
 
-/* For now, hints magic will also use vtbl_sig, because it is all NULL  */
+/* For now, hints magic will also use vtbl_sig, because it is all 0  */
 MGVTBL_SET(
     PL_vtbl_sig,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0
 );
 
 #ifdef PERL_MICRO
 MGVTBL_SET(
     PL_vtbl_sigelem,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0
 );
 
 #else
@@ -4662,350 +4671,338 @@ MGVTBL_SET(
     PL_vtbl_sigelem,
     MEMBER_TO_FPTR(Perl_magic_getsig),
     MEMBER_TO_FPTR(Perl_magic_setsig),
-    NULL,
+    0,
     MEMBER_TO_FPTR(Perl_magic_clearsig),
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0
 );
 #endif
 
 MGVTBL_SET(
     PL_vtbl_pack,
-    NULL,
-    NULL,
+    0,
+    0,
     MEMBER_TO_FPTR(Perl_magic_sizepack),
     MEMBER_TO_FPTR(Perl_magic_wipepack),
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_packelem,
     MEMBER_TO_FPTR(Perl_magic_getpack),
     MEMBER_TO_FPTR(Perl_magic_setpack),
-    NULL,
+    0,
     MEMBER_TO_FPTR(Perl_magic_clearpack),
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_dbline,
-    NULL,
+    0,
     MEMBER_TO_FPTR(Perl_magic_setdbline),
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_isa,
-    NULL,
+    0,
     MEMBER_TO_FPTR(Perl_magic_setisa),
-    NULL,
+    0,
     MEMBER_TO_FPTR(Perl_magic_setisa),
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_isaelem,
-    NULL,
+    0,
     MEMBER_TO_FPTR(Perl_magic_setisa),
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET_CONST_MAGIC_GET(
     PL_vtbl_arylen,
     MEMBER_TO_FPTR(Perl_magic_getarylen),
     MEMBER_TO_FPTR(Perl_magic_setarylen),
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_arylen_p,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
+    0,
+    0,
+    0,
+    0,
     MEMBER_TO_FPTR(Perl_magic_freearylen_p),
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_mglob,
-    NULL,
+    0,
     MEMBER_TO_FPTR(Perl_magic_setmglob),
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_nkeys,
     MEMBER_TO_FPTR(Perl_magic_getnkeys),
     MEMBER_TO_FPTR(Perl_magic_setnkeys),
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_taint,
     MEMBER_TO_FPTR(Perl_magic_gettaint),
     MEMBER_TO_FPTR(Perl_magic_settaint),
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_substr,
     MEMBER_TO_FPTR(Perl_magic_getsubstr),
     MEMBER_TO_FPTR(Perl_magic_setsubstr),
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_vec,
     MEMBER_TO_FPTR(Perl_magic_getvec),
     MEMBER_TO_FPTR(Perl_magic_setvec),
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_pos,
     MEMBER_TO_FPTR(Perl_magic_getpos),
     MEMBER_TO_FPTR(Perl_magic_setpos),
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_bm,
-    NULL,
+    0,
     MEMBER_TO_FPTR(Perl_magic_setbm),
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_fm,
-    NULL,
+    0,
     MEMBER_TO_FPTR(Perl_magic_setfm),
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_uvar,
     MEMBER_TO_FPTR(Perl_magic_getuvar),
     MEMBER_TO_FPTR(Perl_magic_setuvar),
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_defelem,
     MEMBER_TO_FPTR(Perl_magic_getdefelem),
     MEMBER_TO_FPTR(Perl_magic_setdefelem),
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_regexp,
-    NULL,
+    0,
     MEMBER_TO_FPTR(Perl_magic_setregexp),
-    NULL,
-    NULL,
+    0,
+    0,
     MEMBER_TO_FPTR(Perl_magic_freeregexp),
-    NULL,
-    NULL,
-    NULL
-);
-
-MGVTBL_SET(
-    PL_vtbl_regdata_names,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_regdata,
-    NULL,
-    NULL,
+    0,
+    0,
     MEMBER_TO_FPTR(Perl_magic_regdata_cnt),
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_regdatum,
     MEMBER_TO_FPTR(Perl_magic_regdatum_get),
     MEMBER_TO_FPTR(Perl_magic_regdatum_set),
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_amagic,
-    NULL,
+    0,
     MEMBER_TO_FPTR(Perl_magic_setamagic),
-    NULL,
-    NULL,
+    0,
+    0,
     MEMBER_TO_FPTR(Perl_magic_setamagic),
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_amagicelem,
-    NULL,
+    0,
     MEMBER_TO_FPTR(Perl_magic_setamagic),
-    NULL,
-    NULL,
+    0,
+    0,
     MEMBER_TO_FPTR(Perl_magic_setamagic),
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_backref,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
+    0,
+    0,
+    0,
+    0,
     MEMBER_TO_FPTR(Perl_magic_killbackrefs),
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_ovrld,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
+    0,
+    0,
+    0,
+    0,
     MEMBER_TO_FPTR(Perl_magic_freeovrld),
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0
 );
 
 MGVTBL_SET(
     PL_vtbl_utf8,
-    NULL,
+    0,
     MEMBER_TO_FPTR(Perl_magic_setutf8),
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0,
+    0,
+    0
 );
 #ifdef USE_LOCALE_COLLATE
 MGVTBL_SET(
     PL_vtbl_collxfrm,
-    NULL,
+    0,
     MEMBER_TO_FPTR(Perl_magic_setcollxfrm),
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0,
+    0,
+    0
 );
 #endif
 
 MGVTBL_SET(
     PL_vtbl_hintselem,
-    NULL,
+    0,
     MEMBER_TO_FPTR(Perl_magic_sethint),
-    NULL,
+    0,
     MEMBER_TO_FPTR(Perl_magic_clearhint),
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    0,
+    0,
+    0,
+    0
 );
 
 #include "overload.h"
@@ -5710,10 +5707,11 @@ extern void moncontrol(int);
 #define PERL_PV_ESCAPE_ALL         0x1000
 #define PERL_PV_ESCAPE_NOBACKSLASH  0x2000
 #define PERL_PV_ESCAPE_NOCLEAR      0x4000
+#define PERL_PV_ESCAPE_RE           0x8000
 
 /* used by pv_display in dump.c*/
 #define PERL_PV_PRETTY_DUMP  PERL_PV_PRETTY_ELIPSES|PERL_PV_PRETTY_QUOTE
-#define PERL_PV_PRETTY_REGPROP PERL_PV_PRETTY_ELIPSES|PERL_PV_PRETTY_LTGT
+#define PERL_PV_PRETTY_REGPROP PERL_PV_PRETTY_ELIPSES|PERL_PV_PRETTY_LTGT|PERL_PV_ESCAPE_RE
 
 /*