X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl.h;h=9c4a4b9d02f558ca259498f539a379e4d776d48d;hb=739c8b3a364622b7992851a224b3e6424e7e3b03;hp=5b7af5490f28ed6e2c53489d74f4cef3ec237244;hpb=eb160463266f58ba83ae9bb9ae8bbdc8f0c3027b;p=p5sagit%2Fp5-mst-13.2.git diff --git a/perl.h b/perl.h index 5b7af54..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 @@ -3798,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 @@ -3925,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.