applied patch, tweaked doc, and regen regnodes.h
[p5sagit/p5-mst-13.2.git] / perl.h
diff --git a/perl.h b/perl.h
index 4513a07..3d20cf6 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,8 +108,9 @@ class CPerlObj;
 #define CPERLarg CPerlObj *pPerl
 #define CPERLarg_ CPERLarg,
 #define _CPERLarg ,CPERLarg
-#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 */
@@ -121,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 */
@@ -311,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
 
@@ -378,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));
@@ -389,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
@@ -558,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
@@ -1076,7 +1075,12 @@ typedef union any ANY;
 
 #include "handy.h"
 
+#ifdef PERL_OBJECT
+typedef I32 (*filter_t) _((CPerlObj*, int, SV *, int));
+#else
 typedef I32 (*filter_t) _((int, SV *, int));
+#endif
+
 #define FILTER_READ(idx, sv, len)  filter_read(idx, sv, len)
 #define FILTER_DATA(idx)          (AvARRAY(rsfp_filters)[idx])
 #define FILTER_ISREADER(idx)      (idx >= AvFILLp(rsfp_filters))
@@ -1111,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
@@ -1201,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
@@ -1812,12 +1820,23 @@ typedef enum {
 #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*));
 
@@ -1836,12 +1855,6 @@ public:
        void* operator new(size_t nSize, IPerlMem *pvtbl);
 #endif /* PERL_OBJECT */
 
-/* Interpreter exitlist entry */
-typedef struct exitlistentry {
-    void (*fn) _((void*));
-    void *ptr;
-} PerlExitListEntry;
-
 #ifdef PERL_GLOBAL_STRUCT
 struct perl_vars {
 #include "perlvars.h"
@@ -1931,11 +1944,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
@@ -2285,6 +2298,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 */
-