X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl.h;h=77ffb538418a7af5a9d8b8f3148f0d1d0f12314b;hb=a9581ec21a2686ca09657757555fcd66435bb205;hp=f91179a669b73b2b02284959b514360a917b094b;hpb=f86702ccfcc3646d7aa30b09ce4f4413be9f99d1;p=p5sagit%2Fp5-mst-13.2.git diff --git a/perl.h b/perl.h index f91179a..77ffb53 100644 --- a/perl.h +++ b/perl.h @@ -1,6 +1,6 @@ /* perl.h * - * Copyright (c) 1987-1994, Larry Wall + * Copyright (c) 1987-1997, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -37,7 +37,7 @@ * Trying to select a version that gives no warnings... */ #if !(defined(STMT_START) && defined(STMT_END)) -# if defined(__GNUC__) && !defined(__STRICT_ANSI__) +# if defined(__GNUC__) && !defined(__STRICT_ANSI__) && !defined(__cplusplus) # define STMT_START (void)( /* gcc supports ``({ STATEMENTS; })'' */ # define STMT_END ) # else @@ -80,7 +80,7 @@ */ /* define this once if either system, instead of cluttering up the src */ -#if defined(MSDOS) || defined(atarist) +#if defined(MSDOS) || defined(atarist) || defined(WIN32) #define DOSISH 1 #endif @@ -88,6 +88,10 @@ # define STANDARD_C 1 #endif +#if defined(__cplusplus) || defined(WIN32) +# define DONT_DECLARE_STD 1 +#endif + #if defined(HASVOLATILE) || defined(STANDARD_C) # ifdef __cplusplus # define VOL // to temporarily suppress warnings @@ -300,15 +304,8 @@ extern char *memset _((char*, int, int)); # endif # endif -# define memzero(d,l) memset(d,0,l) #else -# ifndef memzero -# ifdef HAS_BZERO -# define memzero(d,l) bzero(d,l) -# else -# define memzero(d,l) my_bzero(d,l) -# endif -# endif +# define memset(d,c,l) my_memset(d,c,l) #endif /* HAS_MEMSET */ #if !defined(HAS_MEMMOVE) && !defined(memmove) @@ -342,6 +339,18 @@ # endif #endif /* HAS_MEMCMP && HAS_SANE_MEMCMP */ +#ifndef memzero +# ifdef HAS_MEMSET +# define memzero(d,l) memset(d,0,l) +# else +# ifdef HAS_BZERO +# define memzero(d,l) bzero(d,l) +# else +# define memzero(d,l) my_bzero(d,l) +# endif +# endif +#endif + #ifndef HAS_BCMP # ifndef bcmp # define bcmp(s1,s2,l) memcmp(s1,s2,l) @@ -427,7 +436,9 @@ # ifdef VMS char *strerror _((int,...)); # else +#ifndef DONT_DECLARE_STD char *strerror _((int)); +#endif # endif # ifndef Strerror # define Strerror strerror @@ -443,35 +454,6 @@ # endif #endif -#define STATUS_POSIX statusvalue -#define STATUS_POSIX_SET(n) (statusvalue = (n)) - -#ifdef VMS -# define STATUS_NATIVE statusvalue_vms -# define STATUS_NATIVE_EXPORT \ - ((I32)statusvalue_vms == -1 ? 4 : statusvalue_vms) -# define STATUS_NATIVE_SET(n) \ - STMT_START { \ - statusvalue_vms = (n); \ - if ((I32)statusvalue_vms == -1) \ - statusvalue = -1; \ - else if (statusvalue_vms & STS$M_SUCCESS) \ - statusvalue = 0; \ - else if ((statusvalue_vms & STS$M_SEVERITY) == 0) \ - statusvalue = 1 << 8; \ - else \ - statusvalue = (statusvalue_vms & STS$M_SEVERITY) << 8; \ - } STMT_END -# define STATUS_ALL_SUCCESS (statusvalue = 0, statusvalue_vms = 1) -# define STATUS_ALL_FAILURE (statusvalue = 1, statusvalue_vms = 4) -#else -# define STATUS_NATIVE STATUS_POSIX -# define STATUS_NATIVE_EXPORT STATUS_POSIX -# define STATUS_NATIVE_SET STATUS_POSIX_SET -# define STATUS_ALL_SUCCESS STATUS_POSIX_SET(0) -# define STATUS_ALL_FAILURE STATUS_POSIX_SET(1) -#endif - #ifdef I_SYS_IOCTL # ifndef _IOCTL_ # include @@ -653,12 +635,8 @@ # ifdef convex # define Quad_t long long # else -# if defined(VMS) && defined(__ALPHA) -# define Quad_t __int64 -# else -# if BYTEORDER > 0xFFFF -# define Quad_t long -# endif +# if BYTEORDER > 0xFFFF +# define Quad_t long # endif # endif #endif @@ -933,6 +911,55 @@ typedef I32 (*filter_t) _((int, SV *, int)); # endif #endif +#ifdef VMS +# define STATUS_NATIVE statusvalue_vms +# define STATUS_NATIVE_EXPORT \ + ((I32)statusvalue_vms == -1 ? 44 : statusvalue_vms) +# define STATUS_NATIVE_SET(n) \ + STMT_START { \ + statusvalue_vms = (n); \ + if ((I32)statusvalue_vms == -1) \ + statusvalue = -1; \ + else if (statusvalue_vms & STS$M_SUCCESS) \ + statusvalue = 0; \ + else if ((statusvalue_vms & STS$M_SEVERITY) == 0) \ + statusvalue = 1 << 8; \ + else \ + statusvalue = (statusvalue_vms & STS$M_SEVERITY) << 8; \ + } STMT_END +# define STATUS_POSIX statusvalue +# ifdef VMSISH_STATUS +# define STATUS_CURRENT (VMSISH_STATUS ? STATUS_NATIVE : STATUS_POSIX) +# else +# define STATUS_CURRENT STATUS_POSIX +# endif +# define STATUS_POSIX_SET(n) \ + STMT_START { \ + statusvalue = (n); \ + if (statusvalue != -1) { \ + statusvalue &= 0xFFFF; \ + statusvalue_vms = statusvalue ? 44 : 1; \ + } \ + else statusvalue_vms = -1; \ + } STMT_END +# define STATUS_ALL_SUCCESS (statusvalue = 0, statusvalue_vms = 1) +# define STATUS_ALL_FAILURE (statusvalue = 1, statusvalue_vms = 44) +#else +# define STATUS_NATIVE STATUS_POSIX +# define STATUS_NATIVE_EXPORT STATUS_POSIX +# define STATUS_NATIVE_SET STATUS_POSIX_SET +# define STATUS_POSIX statusvalue +# define STATUS_POSIX_SET(n) \ + STMT_START { \ + statusvalue = (n); \ + if (statusvalue != -1) \ + statusvalue &= 0xFFFF; \ + } STMT_END +# define STATUS_CURRENT STATUS_POSIX +# define STATUS_ALL_SUCCESS (statusvalue = 0) +# define STATUS_ALL_FAILURE (statusvalue = 1) +#endif + /* Some unistd.h's give a prototype for pause() even though HAS_PAUSE ends up undefined. This causes the #define below to be rejected by the compmiler. Sigh. @@ -961,6 +988,11 @@ union any { void (*any_dptr) _((void*)); }; +/* Work around some cygwin32 problems with importing global symbols */ +#if defined(CYGWIN32) && defined(DLLIMPORT) +# include "cw32imp.h" +#endif + #include "regexp.h" #include "sv.h" #include "util.h" @@ -1156,7 +1188,7 @@ struct ufuncs { }; /* Fix these up for __STDC__ */ -#ifndef __cplusplus +#ifndef DONT_DECLARE_STD char *mktemp _((char*)); double atof _((const char*)); #endif @@ -1178,7 +1210,10 @@ char *strcpy(), *strcat(); # endif double exp _((double)); double log _((double)); + double log10 _((double)); double sqrt _((double)); + double frexp _((double,int*)); + double ldexp _((double,int)); double modf _((double,double*)); double sin _((double)); double cos _((double)); @@ -1195,8 +1230,12 @@ char *crypt (); /* Maybe more hosts will need the unprototyped version */ #else char *crypt _((const char*, const char*)); #endif +#ifndef DONT_DECLARE_STD +#ifndef getenv char *getenv _((const char*)); +#endif Off_t lseek _((int,Off_t,int)); +#endif char *getlogin _((void)); #endif @@ -1254,7 +1293,9 @@ typedef Sighandler_t Sigsave_t; EXT PerlInterpreter * curinterp; /* currently running interpreter */ /* VMS doesn't use environ array and NeXT has problems with crt0.o globals */ #if !defined(VMS) && !(defined(NeXT) && defined(__DYNAMIC__)) +#ifndef DONT_DECLARE_STD extern char ** environ; /* environment variables supplied via exec */ +#endif #else # if defined(NeXT) && defined(__DYNAMIC__) @@ -1321,7 +1362,6 @@ EXT SV ** curpad; /* temp space */ EXT SV * Sv; EXT XPV * Xpv; -EXT char buf[2048]; /* should be longer than PATH_MAX */ EXT char tokenbuf[256]; EXT struct stat statbuf; #ifdef HAS_TIMES @@ -1712,9 +1752,9 @@ IEXT STRLEN Iorslen; IEXT char * Iofmt; /* $# */ IEXT I32 Imaxsysfd IINIT(MAXSYSFD); /* top fd to pass to subprocesses */ IEXT int Imultiline; /* $*--do strings hold >1 line? */ -IEXT U32 Istatusvalue; /* $? */ +IEXT I32 Istatusvalue; /* $? */ #ifdef VMS -IEXT U32 Istatusvalue_vms; /* $^S */ +IEXT U32 Istatusvalue_vms; #endif IEXT struct stat Istatcache; /* _ */ @@ -1809,7 +1849,8 @@ IEXT line_t Icopline IINIT(NOLINE); IEXT CONTEXT * Icxstack; IEXT I32 Icxstack_ix IINIT(-1); IEXT I32 Icxstack_max IINIT(128); -IEXT Sigjmp_buf Itop_env; +IEXT JMPENV Istart_env; /* empty startup sigjmp() environment */ +IEXT JMPENV * Itop_env; /* ptr. to current sigjmp() environment */ IEXT I32 Irunlevel; /* stack stuff */ @@ -1845,6 +1886,7 @@ IEXT bool Ipreambled; IEXT AV * Ipreambleav; IEXT int Ilaststatval IINIT(-1); IEXT I32 Ilaststype IINIT(OP_STAT); +IEXT SV * Imess_sv; #undef IEXT #undef IINIT @@ -1932,8 +1974,8 @@ EXT MGVTBL vtbl_fm = {0, magic_setfm, EXT MGVTBL vtbl_uvar = {magic_getuvar, magic_setuvar, 0, 0, 0}; -EXT MGVTBL vtbl_itervar = {magic_getitervar,magic_setitervar, - 0, 0, magic_freeitervar}; +EXT MGVTBL vtbl_defelem = {magic_getdefelem,magic_setdefelem, + 0, 0, magic_freedefelem}; #ifdef USE_LOCALE_COLLATE EXT MGVTBL vtbl_collxfrm = {0, @@ -1971,7 +2013,7 @@ EXT MGVTBL vtbl_pos; EXT MGVTBL vtbl_bm; EXT MGVTBL vtbl_fm; EXT MGVTBL vtbl_uvar; -EXT MGVTBL vtbl_itervar; +EXT MGVTBL vtbl_defelem; #ifdef USE_LOCALE_COLLATE EXT MGVTBL vtbl_collxfrm;