integrate cfgperl contents (op.[ch] needed manual resolve)
[p5sagit/p5-mst-13.2.git] / perl.h
diff --git a/perl.h b/perl.h
index c6eb7c9..f00566f 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -470,7 +470,7 @@ register struct op *Perl_op asm(stringify(OP_IN_REGISTER));
 #   include <stdlib.h>
 #endif
 
-#if !defined(PERL_FOR_X2P) && !defined(PERL_OBJECT)
+#if !defined(PERL_FOR_X2P) && !defined(WIN32)
 #  include "embed.h"
 #endif
 
@@ -891,20 +891,17 @@ Free_t   Perl_mfree (Malloc_t where);
 #undef UV
 #endif
 
-#ifdef I_INTTYPES
-#include <inttypes.h>
-#endif
-
 /*
     The IV type is supposed to be long enough to hold any integral
     value or a pointer.
     --Andy Dougherty   August 1996
 */
 
-#if defined(USE_64_BITS) && defined(Quad_t)
-   typedef Quad_t  IV;
-   typedef Uquad_t UV;
-#  if QUADCASE == 4 && defined(INT64_MAX) /* quad is int64_t */
+typedef IVTYPE IV;
+typedef UVTYPE UV;
+
+#if defined(USE_64_BITS) && defined(HAS_QUAD)
+#  if QUADKIND == QUAD_IS_INT64_T && defined(INT64_MAX)
 #    define IV_MAX INT64_MAX
 #    define IV_MIN INT64_MIN
 #    define UV_MAX UINT64_MAX
@@ -918,14 +915,10 @@ Free_t   Perl_mfree (Malloc_t where);
 #    define UV_MAX PERL_UQUAD_MAX
 #    define UV_MIN PERL_UQUAD_MIN
 #  endif
-#  define IVSIZE 8
-#  define UVSIZE 8
 #  define IV_IS_QUAD
 #  define UV_IS_QUAD
 #else
-   typedef long          IV;
-   typedef unsigned long UV;
-#  if defined(INT32_MAX) && LONGSIZE == 4
+#  if defined(INT32_MAX) && IVSIZE == 4
 #    define IV_MAX INT32_MAX
 #    define IV_MIN INT32_MIN
 #    ifndef UINT32_MAX_BROKEN /* e.g. HP-UX with gcc messes this up */
@@ -943,15 +936,17 @@ Free_t   Perl_mfree (Malloc_t where);
 #    define UV_MAX PERL_ULONG_MAX
 #    define UV_MIN PERL_ULONG_MIN
 #  endif
-#  if LONGSIZE == 8
+#  if IVSIZE == 8
 #    define IV_IS_QUAD
 #    define UV_IS_QUAD
+#    ifndef HAS_QUAD
+#      define HAS_QUAD
+#    endif
 #  else
 #    undef IV_IS_QUAD
 #    undef UV_IS_QUAD
+#    undef HAS_QUAD
 #  endif
-#  define UVSIZE LONGSIZE
-#  define IVSIZE LONGSIZE
 #endif
 
 #define IV_DIG (BIT_DIGITS(IVSIZE * 8))
@@ -1053,9 +1048,9 @@ Free_t   Perl_mfree (Malloc_t where);
 # endif
 #endif
 
+typedef NVTYPE NV;
+
 #ifdef USE_LONG_DOUBLE
-    typedef long double NV;
-#   define NVSIZE LONG_DOUBLESIZE
 #   define NV_DIG LDBL_DIG
 #   ifdef HAS_SQRTL
 #       define Perl_modf modfl
@@ -1071,8 +1066,6 @@ Free_t   Perl_mfree (Malloc_t where);
 #       define Perl_fmod fmodl
 #   endif
 #else
-    typedef double NV;
-#   define NVSIZE DOUBLESIZE
 #   define NV_DIG DBL_DIG
 #   define Perl_modf modf
 #   define Perl_frexp frexp
@@ -1300,7 +1293,6 @@ typedef struct padop PADOP;
 typedef struct pvop PVOP;
 typedef struct loop LOOP;
 
-typedef struct Outrec Outrec;
 typedef struct interpreter PerlInterpreter;
 typedef struct sv SV;
 typedef struct av AV;
@@ -1330,19 +1322,39 @@ typedef struct xpvfm XPVFM;
 typedef struct xpvio XPVIO;
 typedef struct mgvtbl MGVTBL;
 typedef union any ANY;
+typedef struct svtblent SVTBLENT;
+typedef struct svtbl SVTBL;
 
 #include "handy.h"
 
-#if defined(USE_LARGE_FILES)
-#   define USE_64_BIT_RAWIO /* Explicit */
-#   define USE_64_BIT_STDIO
+#ifndef NO_LARGE_FILES
+#   define USE_LARGE_FILES     /* If available. */
 #endif
 
-#if LSEEKSIZE == 8 && !defined(USE_64_BIT_RAWIO)
-#   define USE_64_BIT_RAWIO /* Implicit */
+#if defined(USE_LARGE_FILES) && !defined(NO_64_BIT_RAWIO)
+#   define USE_64_BIT_RAWIO    /* explicit */
+#   if LSEEKSIZE == 8 && !defined(USE_64_BIT_RAWIO)
+#       define USE_64_BIT_RAWIO        /* implicit */
+#   endif
 #endif
 
-/* Do we need FSEEKSIZE? */
+/* Notice the use of HAS_FSEEKO: now we are obligated to always use
+ * fseeko/ftello if possible.  Don't go #defining ftell to ftello yourself,
+ * however, because operating systems like to do that themself. */
+#ifndef FSEEKSIZE
+#   ifdef HAS_FSEEKO
+#       define FSEEKSIZE LSEEKSIZE
+#   else
+#       define FSEEKSIZE LONGSIZE
+#   endif  
+#endif
+
+#if defined(USE_LARGE_FILES) && !defined(NO_64_BIT_STDIO)
+#   define USE_64_BIT_STDIO    /* explicit */
+#   if FSEEKSIZE == 8 && !defined(USE_64_BIT_STDIO)
+#       define USE_64_BIT_STDIO /* implicit */
+#   endif
+#endif
 
 /* I couldn't find any -Ddefine or -flags in IRIX 6.5 that would
  * have done the necessary symbol renaming using cpp. --jhi */
@@ -1371,9 +1383,10 @@ typedef union any ANY;
 #   endif
 #   if defined(USE_LSEEK64)
 #       define lseek lseek64
-#   endif
-#   if defined(USE_LLSEEK)
-#       define lseek llseek
+#   else
+#       if defined(USE_LLSEEK)
+#           define lseek llseek
+#       endif
 #   endif
 #   if defined(USE_STAT64)
 #       define stat stat64
@@ -1413,10 +1426,10 @@ typedef union any ANY;
 #       define fopen fopen64
 #   endif
 #   if defined(USE_FSEEK64)
-#       define fseek fseek64
+#       define fseek fseek64 /* don't do fseeko here, see perlio.c */
 #   endif
 #   if defined(USE_FTELL64)
-#       define ftell ftell64
+#       define ftell ftell64 /* don't do ftello here, see perlio.c */
 #   endif
 #   if defined(USE_FSETPOS64)
 #       define fsetpos fsetpos64
@@ -1462,7 +1475,11 @@ typedef union any ANY;
 #         if defined(EPOC)
 #           include "epocish.h"
 #         else
-#           include "unixish.h"
+#           if defined(MACOS_TRADITIONAL)
+#             include "macos/macish.h"
+#           else
+#             include "unixish.h"
+#           endif
 #         endif
 #       endif
 #     endif
@@ -1749,6 +1766,18 @@ struct scan_data_t;              /* Used in S_* functions in regcomp.c */
 
 typedef I32 CHECKPOINT;
 
+struct svtblent {
+    struct svtblent*   next;
+    SV*                        oldval;
+    SV*                        newval;
+};
+
+struct svtbl {
+    struct svtblent**  tbl_ary;
+    UV                 tbl_max;
+    UV                 tbl_items;
+};
+
 #if defined(iAPX286) || defined(M_I286) || defined(I80286)
 #   define I286
 #endif
@@ -1831,6 +1860,7 @@ typedef I32 CHECKPOINT;
 #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)
 
+/* The correct way: a Configure test where (UV)~0 is cast to NV and back. */
 /* Believe. */
 #define IV_FITS_IN_NV
 /* Doubt. */
@@ -1851,134 +1881,15 @@ typedef I32 CHECKPOINT;
 #   endif
 #endif
 
-#ifdef IV_IS_QUAD
-#  define UVuf PERL_PRIu64
-#  define IVdf PERL_PRId64
-#  define UVof PERL_PRIo64
-#  define UVxf PERL_PRIx64
-#else
-#   if IVSIZE == LONGSIZE
-#       define UVuf "lu"
-#       define IVdf "ld"
-#       define UVof "lo"
-#       define UVxf "lx"
-#   else
-#       if IVSIZE == INTSIZE
-#           define UVuf "u"
-#           define IVdf "d"
-#           define UVof "o"
-#           define UVxf "x"
-#       else
-#           if IVSIZE == SHORTSIZE /* weird */
-#               define UVuf "hu"
-#               define IVdf "hd"
-#               define UVof "ho"
-#               define UVxf "hx"
-#           else
-               /* well, any good ideas? */
-#           endif
-#       endif
-#   endif
-#endif
-
-/* The Uid_t_f and Gid_t_f definitely look like a job for metaconfig,
- * as do the UVuf, IVdf, UVof, and UVxf above. */
-
-#if Uid_t_SIGN == -1
-#   if Uid_t_SIZE == IVSIZE
-#       define Uid_t_f IVdf
-#   else
-#       if Uid_t_SIZE == LONGSIZE
-#           define Uid_t_f "ld"
-#       else
-#           if Uid_t_SIZE == INTSIZE
-#               define Uid_t_f "d"
-#           else
-#               if Uid_t_SIZE == SHORTSIZE
-#                   define Uid_t_f "hd"
-#               else
-                   /* You tell me. */
-#               endif
-#           endif
-#       endif
-#   endif
-#else
-#   if Uid_t_SIZE == UVSIZE
-#       define Uid_t_f UVuf
-#   else
-#       if Uid_t_SIZE == LONGSIZE
-#           define Uid_t_f "lu"
-#       else
-#           if Uid_t_SIZE == INTSIZE
-#               define Uid_t_f "u"
-#           else
-#               if Uid_t_SIZE == SHORTSIZE
-#                   define Uid_t_f "hu"
-#               else
-                   /* You tell me. */
-#               endif
-#           endif
-#       endif
-#   endif
-#endif
-
-#if Gid_t_SIGN == -1
-#   if Gid_t_SIZE == IVSIZE
-#       define Gid_t_f IVdf
-#   else
-#       if Gid_t_SIZE == LONGSIZE
-#           define Gid_t_f "ld"
-#       else
-#           if Gid_t_SIZE == INTSIZE
-#               define Gid_t_f "d"
-#           else
-#               if Gid_t_SIZE == SHORTSIZE
-#                   define Gid_t_f "hd"
-#               else
-                   /* You tell me. */
-#               endif
-#           endif
-#       endif
-#   endif
-#else
-#   if Gid_t_SIZE == UVSIZE
-#       define Gid_t_f UVuf
-#   else
-#       if Gid_t_SIZE == LONGSIZE
-#           define Gid_t_f "lu"
-#       else
-#           if Gid_t_SIZE == INTSIZE
-#               define Gid_t_f "u"
-#           else
-#               if Gid_t_SIZE == SHORTSIZE
-#                   define Gid_t_f "hu"
-#               else
-                   /* You tell me. */
-#               endif
-#           endif
-#       endif
-#   endif
-#endif
-
 /* Used with UV/IV arguments: */
                                        /* XXXX: need to speed it up */
 #define CLUMP_2UV(iv)  ((iv) < 0 ? 0 : (UV)(iv))
 #define CLUMP_2IV(uv)  ((uv) > (UV)IV_MAX ? IV_MAX : (IV)(uv))
 
-struct Outrec {
-    I32                o_lines;
-    char       *o_str;
-    U32                o_len;
-};
-
 #ifndef MAXSYSFD
 #   define MAXSYSFD 2
 #endif
 
-#ifndef TMPPATH
-#  define TMPPATH "/tmp/perl-eXXXXXX"
-#endif
-
 #ifndef __cplusplus
 Uid_t getuid (void);
 Uid_t geteuid (void);
@@ -2695,13 +2606,6 @@ typedef void *Thread;
 #  define PERL_CALLCONV
 #endif 
 
-#ifdef PERL_OBJECT
-#  define VIRTUAL virtual PERL_CALLCONV
-#else
-#  define VIRTUAL PERL_CALLCONV
-/*START_EXTERN_C*/
-#endif
-
 #ifndef NEXT30_NO_ATTRIBUTE
 #  ifndef HASATTRIBUTE       /* disable GNU-cc attribute checking? */
 #    ifdef  __attribute__      /* Avoid possible redefinition errors */
@@ -2729,10 +2633,8 @@ public:
 #include "pp_proto.h"
 
 #ifdef PERL_OBJECT
-VIRTUAL int CPerlObj::do_aspawn (void *vreally, void **vmark, void **vsp);
+int CPerlObj::do_aspawn (void *vreally, void **vmark, void **vsp);
 #undef PERL_DECL_PROT
-#else
-/*END_EXTERN_C*/
 #endif
 
 #ifndef PERL_OBJECT
@@ -2789,6 +2691,10 @@ PERLVARA(object_compatibility,30,        char)
 /* this has structure inits, so it cannot be included before here */
 #  include "opcode.h"
 
+#else
+#  if defined(WIN32)
+#    include "embed.h"
+#  endif
 #endif  /* PERL_OBJECT */
 
 #ifndef PERL_GLOBAL_STRUCT
@@ -3147,6 +3053,34 @@ typedef struct am_table_short AMTS;
 #endif
 
 /*
+ * Some operating systems are stingy with stack allocation,
+ * so perl may have to guard against stack overflow.
+ */
+#ifndef PERL_STACK_OVERFLOW_CHECK
+#define PERL_STACK_OVERFLOW_CHECK()  NOOP
+#endif
+
+/*
+ * Some nonpreemptive operating systems find it convenient to
+ * check for asynchronous conditions after each op execution.
+ * Keep this check simple, or it may slow down execution
+ * massively.
+ */
+#ifndef PERL_ASYNC_CHECK
+#define PERL_ASYNC_CHECK()  NOOP
+#endif
+
+/*
+ * On some operating systems, a memory allocation may succeed,
+ * but put the process too close to the system's comfort limit.
+ * In this case, PERL_ALLOC_CHECK frees the pointer and sets
+ * it to NULL.
+ */
+#ifndef PERL_ALLOC_CHECK
+#define PERL_ALLOC_CHECK(p)  NOOP
+#endif
+
+/*
  * nice_chunk and nice_chunk size need to be set
  * and queried under the protection of sv_mutex
  */