X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl.h;h=9c4a4b9d02f558ca259498f539a379e4d776d48d;hb=f792fa1bf9e775e687dc2fc467422b5e26ad7713;hp=442935fca64f7a4735c5b0179fb8f6aa3987ee89;hpb=3da75212d6473762ab0ea93846197f4c22b03729;p=p5sagit%2Fp5-mst-13.2.git diff --git a/perl.h b/perl.h index 442935f..9c4a4b9 100644 --- a/perl.h +++ b/perl.h @@ -25,7 +25,11 @@ #include #endif +#ifdef VOIDUSED +# undef VOIDUSED +#endif #define VOIDUSED 1 + #ifdef PERL_MICRO # include "uconfig.h" #else @@ -77,6 +81,12 @@ # endif #endif +/* undef WIN32 when building on Cygwin (for libwin32) - gph */ +#ifdef __CYGWIN__ +# undef WIN32 +# undef _WIN32 +#endif + /* Use the reentrant APIs like localtime_r and getpwent_r */ /* Win32 has naturally threadsafe libraries, no need to use any _r variants. */ #if defined(USE_ITHREADS) && !defined(USE_REENTRANT_API) && !defined(NETWARE) && !defined(WIN32) && !defined(__APPLE__) @@ -485,12 +495,14 @@ int usleep(unsigned int); # else # define EMBEDMYMALLOC /* for compatibility */ # endif +START_EXTERN_C 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); /* 'mfree' rather than 'free', since there is already a 'perl_free' * that causes clashes with case-insensitive linkers */ Free_t Perl_mfree (Malloc_t where); +END_EXTERN_C typedef struct perl_mstats perl_mstats_t; @@ -1426,8 +1438,30 @@ int isnan(double d); # endif #endif -#define Perl_atof(s) Perl_my_atof(s) -#define Perl_atof2(s, np) Perl_my_atof2(s, np) +/* The default is to use Perl's own atof() implementation (in numeric.c). + * Usually that is the one to use but for some platforms (e.g. UNICOS) + * it is however best to use the native implementation of atof. + * You can experiment with using your native one by -DUSE_PERL_ATOF=0. + * Some good tests to try out with either setting are t/base/num.t, + * t/op/numconvert.t, and t/op/pack.t. */ + +#ifndef USE_PERL_ATOF +# ifndef _UNICOS +# define USE_PERL_ATOF +# endif +#else +# if USE_PERL_ATOF == 0 +# undef USE_PERL_ATOF +# endif +#endif + +#ifdef USE_PERL_ATOF +# define Perl_atof(s) Perl_my_atof(s) +# define Perl_atof2(s, n) Perl_my_atof2(aTHX_ (s), &(n)) +#else +# define Perl_atof(s) (NV)atof(s) +# define Perl_atof2(s, n) ((n) = atof(s)) +#endif /* Previously these definitions used hardcoded figures. * It is hoped these formula are more portable, although @@ -2146,6 +2180,22 @@ typedef I32 (*filter_t) (pTHX_ int, SV *, int); #define FILTER_DATA(idx) (AvARRAY(PL_rsfp_filters)[idx]) #define FILTER_ISREADER(idx) (idx >= AvFILLp(PL_rsfp_filters)) +#if defined(_AIX) && !defined(_AIX43) +#if defined(USE_REENTRANT) || defined(_REENTRANT) || defined(_THREAD_SAFE) +/* We cannot include to get the struct crypt_data + * because of setkey prototype problems when threading */ +typedef struct crypt_data { /* straight from /usr/include/crypt.h */ + /* From OSF, Not needed in AIX + char C[28], D[28]; + */ + char E[48]; + char KS[16][48]; + char block[66]; + char iobuf[16]; +} CRYPTD; +#endif /* threading */ +#endif /* AIX */ + #if !defined(OS2) && !defined(MACOS_TRADITIONAL) # include "iperlsys.h" #endif @@ -2263,6 +2313,12 @@ struct ptr_tbl { # define htovs(x) vtohs(x) # endif /* otherwise default to functions in util.c */ +#ifndef htovs +short htovs(short n); +short vtohs(short n); +long htovl(long n); +long vtohl(long n); +#endif #endif /* *MAX Plus 1. A floating point value. @@ -2797,6 +2853,7 @@ typedef Sighandler_t Sigsave_t; typedef int (CPERLscope(*runops_proc_t)) (pTHX); typedef void (CPERLscope(*share_proc_t)) (pTHX_ SV *sv); +typedef int (CPERLscope(*thrhook_proc_t)) (pTHX); typedef OP* (CPERLscope(*PPADDR_t)[]) (pTHX); /* _ (for $_) must be first in the following list (DEFSV requires it) */ @@ -3588,14 +3645,14 @@ EXTCONST char * PL_AMG_names[NofAMmeth]; END_EXTERN_C struct am_table { - long was_ok_sub; + U32 was_ok_sub; long was_ok_am; U32 flags; CV* table[NofAMmeth]; long fallback; }; struct am_table_short { - long was_ok_sub; + U32 was_ok_sub; long was_ok_am; U32 flags; }; @@ -3716,7 +3773,7 @@ typedef struct am_table_short AMTS; #define STORE_NUMERIC_STANDARD_SET_LOCAL() /**/ #define RESTORE_NUMERIC_LOCAL() /**/ #define RESTORE_NUMERIC_STANDARD() /**/ -#define Atof Perl_atof +#define Atof my_atof #define IN_LOCALE_RUNTIME 0 #endif /* !USE_LOCALE_NUMERIC */ @@ -3725,6 +3782,9 @@ typedef struct am_table_short AMTS; # ifdef __hpux # define strtoll __strtoll /* secret handshake */ # endif +# ifdef WIN64 +# define strtoll _strtoi64 /* secret handshake */ +# endif # if !defined(Strtol) && defined(HAS_STRTOLL) # define Strtol strtoll # endif @@ -3741,6 +3801,9 @@ typedef struct am_table_short AMTS; * (as is done for Atoul(), see below) but for backward compatibility * we just assume atol(). */ # if defined(USE_64_BIT_INT) && defined(IV_IS_QUAD) && QUADKIND == QUAD_IS_LONG_LONG && defined(HAS_ATOLL) +# ifdef WIN64 +# define atoll _atoi64 /* secret handshake */ +# endif # define Atol atoll # else # define Atol atol @@ -3751,6 +3814,9 @@ typedef struct am_table_short AMTS; # ifdef __hpux # define strtoull __strtoull /* secret handshake */ # endif +# ifdef WIN64 +# define strtoull _strtoui64 /* secret handshake */ +# endif # if !defined(Strtoul) && defined(HAS_STRTOULL) # define Strtoul strtoull # endif @@ -3766,9 +3832,8 @@ typedef struct am_table_short AMTS; # define Atoul(s) Strtoul(s, (char **)NULL, 10) #endif -#if !defined(PERLIO_IS_STDIO) && defined(HASATTRIBUTE) +#if !defined(PERLIO_IS_STDIO) /* - * Now we have __attribute__ out of the way * Remap printf */ #undef printf @@ -3893,10 +3958,11 @@ typedef struct am_table_short AMTS; * Boilerplate macros for initializing and accessing interpreter-local * data from C. All statics in extensions should be reworked to use * this, if you want to make the extension thread-safe. See ext/re/re.xs - * for an example of the use of these macros. + * for an example of the use of these macros, and perlxs.pod for more. * * Code that uses these macros is responsible for the following: - * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts" + * 1. #define MY_CXT_KEY to a unique string, e.g. + * "DynaLoader::_guts" XS_VERSION * 2. Declare a typedef named my_cxt_t that is a structure that contains * all the data that needs to be interpreter-local. * 3. Use the START_MY_CXT macro after the declaration of my_cxt_t.