#else
# if PTRSIZE == LONGSIZE
# define PTRV unsigned long
+# define PTR2ul(p) (unsigned long)(p)
# else
# define PTRV unsigned
# endif
+#endif
+
+#ifndef INT2PTR
# define INT2PTR(any,d) (any)(PTRV)(d)
#endif
+
+#ifndef PTR2ul
+# define PTR2ul(p) INT2PTR(unsigned long,p)
+#endif
+
#define NUM2PTR(any,d) (any)(PTRV)(d)
#define PTR2IV(p) INT2PTR(IV,p)
#define PTR2UV(p) INT2PTR(UV,p)
#define PTR2NV(p) NUM2PTR(NV,p)
-#if PTRSIZE == LONGSIZE
-# define PTR2ul(p) (unsigned long)(p)
-#else
-# define PTR2ul(p) INT2PTR(unsigned long,p)
-#endif
+#define PTR2nat(p) (PTRV)(p) /* pointer to integer of PTRSIZE */
/* According to strict ANSI C89 one cannot freely cast between
* data pointers and function (code) pointers. There are at least
* The only feasible use is probably temporarily storing
* function pointers in a data pointer (such as a void pointer). */
-#define DPTR2FPTR(t,p) ((t)(PTRV)(p)) /* data pointer to function pointer */
-#define FPTR2DPTR(t,p) ((t)(PTRV)(p)) /* function pointer to data pointer */
+#define DPTR2FPTR(t,p) ((t)PTR2nat(p)) /* data pointer to function pointer */
+#define FPTR2DPTR(t,p) ((t)PTR2nat(p)) /* function pointer to data pointer */
#ifdef USE_LONG_DOUBLE
# if defined(HAS_LONG_DOUBLE) && LONG_DOUBLESIZE == DOUBLESIZE
# define STATUS_NATIVE PL_statusvalue_vms
# define STATUS_NATIVE_EXPORT \
(((I32)PL_statusvalue_vms == -1 ? 44 : PL_statusvalue_vms) | (VMSISH_HUSHED ? 0x10000000 : 0))
-# define STATUS_NATIVE_SET(n) \
+# define STATUS_NATIVE_SET(n) STATUS_NATIVE_SET_PORC(n, 0)
+# define STATUS_NATIVE_CHILD_SET(n) STATUS_NATIVE_SET_PORC(n, 1)
+# define STATUS_NATIVE_SET_PORC(n, _x) \
STMT_START { \
- PL_statusvalue_vms = (n); \
- if ((I32)PL_statusvalue_vms == -1) \
+ I32 evalue = (I32)n; \
+ if (evalue == EVMSERR) { \
+ PL_statusvalue_vms = vaxc$errno; \
+ PL_statusvalue = evalue; \
+ } \
+ else { \
+ PL_statusvalue_vms = evalue; \
+ if ((I32)PL_statusvalue_vms == -1) \
PL_statusvalue = -1; \
- else if (PL_statusvalue_vms & STS$M_SUCCESS) \
- PL_statusvalue = 0; \
- else if ((PL_statusvalue_vms & STS$M_SEVERITY) == 0) \
- PL_statusvalue = 1 << 8; \
- else \
- PL_statusvalue = (PL_statusvalue_vms & STS$M_SEVERITY) << 8; \
+ else \
+ PL_statusvalue = vms_status_to_unix(evalue); \
+ set_vaxc_errno(evalue); \
+ set_errno(PL_statusvalue); \
+ if (_x) PL_statusvalue = PL_statusvalue << 8; \
+ } \
} STMT_END
# ifdef VMSISH_STATUS
# define STATUS_CURRENT (VMSISH_STATUS ? STATUS_NATIVE : STATUS_UNIX)
STMT_START { \
PL_statusvalue = (n); \
if (PL_statusvalue != -1) { \
- PL_statusvalue &= 0xFFFF; \
- PL_statusvalue_vms = PL_statusvalue ? 44 : 1; \
+ if (PL_statusvalue != EVMSERR) { \
+ PL_statusvalue &= 0xFFFF; \
+ PL_statusvalue_vms = PL_statusvalue ? 44 : 1; \
+ } \
+ else { \
+ PL_statusvalue_vms = vaxc$errno; \
+ } \
} \
else PL_statusvalue_vms = -1; \
} STMT_END
# define STATUS_NATIVE PL_statusvalue_posix
# define STATUS_NATIVE_EXPORT STATUS_NATIVE
# if defined(WCOREDUMP)
+# define STATUS_NATIVE_CHILD_SET(n) STATUS_NATIVE_SET(n)
# define STATUS_NATIVE_SET(n) \
STMT_START { \
PL_statusvalue_posix = (n); \
} \
} STMT_END
# elif defined(WIFEXITED)
+# define STATUS_NATIVE_CHILD_SET(n) STATUS_NATIVE_SET(n)
# define STATUS_NATIVE_SET(n) \
STMT_START { \
PL_statusvalue_posix = (n); \
} \
} STMT_END
# else
+# define STATUS_NATIVE_CHILD_SET(n) STATUS_NATIVE_SET(n)
# define STATUS_NATIVE_SET(n) \
STMT_START { \
PL_statusvalue_posix = (n); \
*/
#ifndef SVf_
-# define SVf_(n) "-" #n "p"
+# define SVf_(n) "-" STRINGIFY(n) "p"
#endif
#ifndef SVf
#ifndef VDf
# if vdNUMBER
-# define vdFORMAT(n) #n "p"
-# define VDf_(n) vdFORMAT(n)
-# define VDf VDf_(vdNUMBER)
+# define VDf STRINGIFY(vdNUMBER) "p"
# else
# define VDf "vd"
# endif
# define UVf UVuf
#endif
-#ifndef DieNull
-# define DieNull Perl_vdie(aTHX_ Nullch, Null(va_list *))
-#endif
-
#ifdef HASATTRIBUTE_FORMAT
# define __attribute__format__(x,y,z) __attribute__((format(x,y,z)))
#endif
#ifdef UNLINK_ALL_VERSIONS /* Currently only makes sense for VMS */
#define UNLINK unlnk
-I32 unlnk (char*);
+I32 unlnk (const char*);
#else
#define UNLINK PerlLIO_unlink
#endif