Make Power MachTen use vfork and perl's malloc
[p5sagit/p5-mst-13.2.git] / perl.h
diff --git a/perl.h b/perl.h
index 34f68b2..7f3fd63 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -90,8 +90,8 @@ are local to a function.
 PERL HOST
 1. The perl host is linked with perlX.lib to get perl_alloc. This
 function will return a pointer to CPerlObj (the PERL_OBJECT). It
-takes pointers to the various PerlXXX_YYY interfaces (see ipdir.h for
-information on this).
+takes pointers to the various PerlXXX_YYY interfaces (see iperlsys.h
+for more information on this).
 2. The perl host calls the same functions as normally would be
 called in setting up and running a perl script, except that the
 functions are now member functions of the PERL_OBJECT.
@@ -108,9 +108,9 @@ class CPerlObj;
 #define CPERLarg CPerlObj *pPerl
 #define CPERLarg_ CPERLarg,
 #define _CPERLarg ,CPERLarg
-#define THIS this
-#define _THIS ,this
-#define THIS_ this,
+#define PERL_OBJECT_THIS this
+#define _PERL_OBJECT_THIS ,this
+#define PERL_OBJECT_THIS_ this,
 #define CALLRUNOPS (this->*runops)
 
 #else /* !PERL_OBJECT */
@@ -122,9 +122,9 @@ class CPerlObj;
 #define CPERLarg void
 #define CPERLarg_
 #define _CPERLarg
-#define THIS
-#define _THIS
-#define THIS_
+#define PERL_OBJECT_THIS
+#define _PERL_OBJECT_THIS
+#define PERL_OBJECT_THIS_
 #define CALLRUNOPS runops
 
 #endif /* PERL_OBJECT */
@@ -312,13 +312,7 @@ register struct op *op asm(stringify(OP_IN_REGISTER));
 #  endif
 #endif
 
-#include "perlio.h"
-#include "perlmem.h"
-#include "perllio.h"
-#include "perlsock.h"
-#include "perlproc.h"
-#include "perlenv.h"
-#include "perldir.h"
+#include "iperlsys.h"
 
 #ifdef USE_NEXT_CTYPE
 
@@ -379,7 +373,7 @@ register struct op *op asm(stringify(OP_IN_REGISTER));
 #   ifdef HIDEMYMALLOC
 #      define malloc  Mymalloc
 #      define calloc  Mycalloc
-#      define realloc Myremalloc
+#      define realloc Myrealloc
 #      define free    Myfree
 Malloc_t Mymalloc _((MEM_SIZE nbytes));
 Malloc_t Mycalloc _((MEM_SIZE elements, MEM_SIZE size));
@@ -390,11 +384,21 @@ Free_t   Myfree _((Malloc_t where));
 #      define malloc  Perl_malloc
 #      define calloc  Perl_calloc
 #      define realloc Perl_realloc
+/* VMS' external symbols are case-insensitive, and there's already a */
+/* perl_free in perl.h */
+#ifdef VMS
+#      define free    Perl_myfree
+#else
 #      define free    Perl_free
+#endif
 Malloc_t Perl_malloc _((MEM_SIZE nbytes));
 Malloc_t Perl_calloc _((MEM_SIZE elements, MEM_SIZE size));
 Malloc_t Perl_realloc _((Malloc_t where, MEM_SIZE nbytes));
+#ifdef VMS
+Free_t   Perl_myfree _((Malloc_t where));
+#else
 Free_t   Perl_free _((Malloc_t where));
+#endif
 #   endif
 
 #   undef safemalloc
@@ -559,12 +563,6 @@ Free_t   Perl_free _((Malloc_t where));
 #   undef HAS_STRERROR
 #endif
 
-#ifndef HAS_MKFIFO
-#  ifndef mkfifo
-#    define mkfifo(path, mode) (mknod((path), (mode) | S_IFIFO, 0))
-#  endif
-#endif /* !HAS_MKFIFO */
-
 #include <errno.h>
 #ifdef HAS_SOCKET
 #   ifdef I_NET_ERRNO
@@ -1117,6 +1115,10 @@ typedef I32 (*filter_t) _((int, SV *, int));
  */
 
 #ifdef USE_THREADS
+   /* pending resolution of licensing issues, we avoid the erstwhile
+    * atomic.h everywhere */
+#  define EMULATE_ATOMIC_REFCOUNTS
+
 #  ifdef FAKE_THREADS
 #    include "fakethr.h"
 #  else
@@ -1207,17 +1209,17 @@ typedef pthread_key_t perl_key;
 #   endif
 #endif
 
+#ifdef UNION_ANY_DEFINITION
+UNION_ANY_DEFINITION;
+#else
 union any {
     void*      any_ptr;
     I32                any_i32;
     IV         any_iv;
     long       any_long;
     void       (CPERLscope(*any_dptr)) _((void*));
-#if defined(WIN32) && !defined(PERL_OBJECT)
-       /* Visual C thinks that a pointer to a member variable is 16 bytes in size. */
-       char    handle_VC_problem[16];
-#endif
 };
+#endif
 
 #ifdef USE_THREADS
 #define ARGSproto struct perl_thread *thr
@@ -1814,16 +1816,36 @@ typedef enum {
 #define HINT_STRICT_VARS       0x00000400
 #define HINT_LOCALE            0x00000800
 
+#define HINT_NEW_INTEGER       0x00001000
+#define HINT_NEW_FLOAT         0x00002000
+#define HINT_NEW_BINARY                0x00004000
+#define HINT_NEW_STRING                0x00008000
+#define HINT_NEW_RE            0x00010000
+#define HINT_LOCALIZE_HH       0x00020000 /* %^H needs to be copied */
+
+#define HINT_RE_TAINT          0x00100000
+
 /* Various states of an input record separator SV (rs, nrs) */
 #define RsSNARF(sv)   (! SvOK(sv))
 #define RsSIMPLE(sv)  (SvOK(sv) && SvCUR(sv))
 #define RsPARA(sv)    (SvOK(sv) && ! SvCUR(sv))
+#define RsRECORD(sv)  (SvROK(sv) && (SvIV(SvRV(sv)) > 0))
 
 /* Set up PERLVAR macros for populating structs */
 #define PERLVAR(var,type) type var;
 #define PERLVARI(var,type,init) type var;
 #define PERLVARIC(var,type,init) type var;
 
+/* Interpreter exitlist entry */
+typedef struct exitlistentry {
+#ifdef PERL_OBJECT
+    void (*fn) _((CPerlObj*, void*));
+#else
+    void (*fn) _((void*));
+#endif
+    void *ptr;
+} PerlExitListEntry;
+
 #ifdef PERL_OBJECT
 extern "C" CPerlObj* perl_alloc _((IPerlMem*, IPerlEnv*, IPerlStdIO*, IPerlLIO*, IPerlDir*, IPerlSock*, IPerlProc*));
 
@@ -1842,16 +1864,6 @@ public:
        void* operator new(size_t nSize, IPerlMem *pvtbl);
 #endif /* PERL_OBJECT */
 
-/* Interpreter exitlist entry */
-typedef struct exitlistentry {
-#ifdef PERL_OBJECT
-    void (*fn) _((CPerlObj*, void*));
-#else
-    void (*fn) _((void*));
-#endif
-    void *ptr;
-} PerlExitListEntry;
-
 #ifdef PERL_GLOBAL_STRUCT
 struct perl_vars {
 #include "perlvars.h"
@@ -1941,11 +1953,11 @@ typedef void *Thread;
 
 #ifndef MULTIPLICITY
 
-#ifndef USE_THREADS
-#include "thrdvar.h"
-#endif
+#  include "intrpvar.h"
+#  ifndef USE_THREADS
+#    include "thrdvar.h"
+#  endif
 
-#include "intrpvar.h"
 #endif
 
 #ifdef PERL_OBJECT
@@ -2295,6 +2307,26 @@ enum {
        UNLOCK_SV_MUTEX;                                \
     } while (0)
 
+#ifdef HAS_SEM
+#   include <sys/ipc.h>
+#   include <sys/sem.h>
+#   ifndef HAS_UNION_SEMUN     /* Provide the union semun. */
+    union semun {
+       int val;
+       struct semid_ds *buf;
+       unsigned short *array;
+    };
+#   endif
+#   ifdef USE_SEMCTL_SEMUN
+#       define Semctl(id, num, cmd, semun) semctl(id, num, cmd, semun)
+#   else
+#       ifdef USE_SEMCTL_SEMID_DS
+#           define Semctl(id, num, cmd, semun) semctl(id, num, cmd, semun.buf)
+#       endif
+#   endif
+#   ifndef Semctl      /* Place our bets on the semun horse. */
+#       define Semctl(id, num, cmd, semun) semctl(id, num, cmd, semun)
+#   endif
+#endif
 
 #endif /* Include guard */
-