📄 perl.h
字号:
#ifdef ff_next# undef ff_next#endif#if defined(cray) || defined(gould) || defined(i860) || defined(pyr)# define SLOPPYDIVIDE#endif#ifdef UV#undef UV#endif/* The IV type is supposed to be long enough to hold any integral value or a pointer. --Andy Dougherty August 1996*/typedef IVTYPE IV;typedef UVTYPE UV;#if defined(USE_64_BIT_INT) && defined(HAS_QUAD)# if QUADKIND == QUAD_IS_INT64_T && defined(INT64_MAX)# define IV_MAX INT64_MAX# define IV_MIN INT64_MIN# define UV_MAX UINT64_MAX# ifndef UINT64_MIN# define UINT64_MIN 0# endif# define UV_MIN UINT64_MIN# else# define IV_MAX PERL_QUAD_MAX# define IV_MIN PERL_QUAD_MIN# define UV_MAX PERL_UQUAD_MAX# define UV_MIN PERL_UQUAD_MIN# endif# define IV_IS_QUAD# define UV_IS_QUAD#else# if defined(INT32_MAX) && IVSIZE == 4# define IV_MAX INT32_MAX# define IV_MIN INT32_MIN# ifndef UINT32_MAX_BROKEN /* e.g. HP-UX with gcc messes this up */# define UV_MAX UINT32_MAX# else# define UV_MAX 4294967295U# endif# ifndef UINT32_MIN# define UINT32_MIN 0# endif# define UV_MIN UINT32_MIN# else# define IV_MAX PERL_LONG_MAX# define IV_MIN PERL_LONG_MIN# define UV_MAX PERL_ULONG_MAX# define UV_MIN PERL_ULONG_MIN# endif# if IVSIZE == 8# define IV_IS_QUAD# define UV_IS_QUAD# ifndef HAS_QUAD# define HAS_QUAD# endif# else# undef IV_IS_QUAD# undef UV_IS_QUAD# undef HAS_QUAD# endif#endif#define IV_DIG (BIT_DIGITS(IVSIZE * 8))#define UV_DIG (BIT_DIGITS(UVSIZE * 8))/* * The macros INT2PTR and NUM2PTR are (despite their names) * bi-directional: they will convert int/float to or from pointers. * However the conversion to int/float are named explicitly: * PTR2IV, PTR2UV, PTR2NV. * * For int conversions we do not need two casts if pointers are * the same size as IV and UV. Otherwise we need an explicit * cast (PTRV) to avoid compiler warnings. */#if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)# define PTRV UV# define INT2PTR(any,d) (any)(d)#else# if PTRSIZE == LONGSIZE # define PTRV unsigned long# else# define PTRV unsigned# endif# define INT2PTR(any,d) (any)(PTRV)(d)#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 #ifdef USE_LONG_DOUBLE# if defined(HAS_LONG_DOUBLE) && LONG_DOUBLESIZE == DOUBLESIZE# define LONG_DOUBLE_EQUALS_DOUBLE# endif# if !(defined(HAS_LONG_DOUBLE) && (LONG_DOUBLESIZE > DOUBLESIZE))# undef USE_LONG_DOUBLE /* Ouch! */# endif#endif#ifdef OVR_DBL_DIG/* Use an overridden DBL_DIG */# ifdef DBL_DIG# undef DBL_DIG# endif# define DBL_DIG OVR_DBL_DIG#else/* The following is all to get DBL_DIG, in order to pick a nice default value for printing floating point numbers in Gconvert. (see config.h)*/#ifdef I_LIMITS#include <limits.h>#endif#ifdef I_FLOAT#include <float.h>#endif#ifndef HAS_DBL_DIG#define DBL_DIG 15 /* A guess that works lots of places */#endif#endif#ifdef I_FLOAT#include <float.h>#endif#ifndef HAS_DBL_DIG#define DBL_DIG 15 /* A guess that works lots of places */#endif#ifdef OVR_LDBL_DIG/* Use an overridden LDBL_DIG */# ifdef LDBL_DIG# undef LDBL_DIG# endif# define LDBL_DIG OVR_LDBL_DIG#else/* The following is all to get LDBL_DIG, in order to pick a nice default value for printing floating point numbers in Gconvert. (see config.h)*/# ifdef I_LIMITS# include <limits.h># endif# ifdef I_FLOAT# include <float.h># endif# ifndef HAS_LDBL_DIG# if LONG_DOUBLESIZE == 10# define LDBL_DIG 18 /* assume IEEE */# else# if LONG_DOUBLESIZE == 12# define LDBL_DIG 18 /* gcc? */# else# if LONG_DOUBLESIZE == 16# define LDBL_DIG 33 /* assume IEEE */# else# if LONG_DOUBLESIZE == DOUBLESIZE# define LDBL_DIG DBL_DIG /* bummer */# endif# endif# endif# endif# endif#endiftypedef NVTYPE NV;#ifdef I_IEEEFP# include <ieeefp.h>#endif#ifdef USE_LONG_DOUBLE# ifdef I_SUNMATH# include <sunmath.h># endif# define NV_DIG LDBL_DIG# ifdef LDBL_MANT_DIG# define NV_MANT_DIG LDBL_MANT_DIG# endif# ifdef LDBL_MAX# define NV_MAX LDBL_MAX# define NV_MIN LDBL_MIN# else# ifdef HUGE_VALL# define NV_MAX HUGE_VALL# else# ifdef HUGE_VAL# define NV_MAX ((NV)HUGE_VAL)# endif# endif# endif# ifdef HAS_SQRTL# define Perl_cos cosl# define Perl_sin sinl# define Perl_sqrt sqrtl# define Perl_exp expl# define Perl_log logl# define Perl_atan2 atan2l# define Perl_pow powl# define Perl_floor floorl# define Perl_fmod fmodl# endif/* e.g. libsunmath doesn't have modfl and frexpl as of mid-March 2000 */# ifdef HAS_MODFL# define Perl_modf(x,y) modfl(x,y)# else# define Perl_modf(x,y) ((long double)modf((double)(x),(double*)(y)))# endif# ifdef HAS_FREXPL# define Perl_frexp(x,y) frexpl(x,y)# else# define Perl_frexp(x,y) ((long double)frexp((double)(x),y))# endif# ifdef HAS_ISNANL# define Perl_isnan(x) isnanl(x)# else# ifdef HAS_ISNAN# define Perl_isnan(x) isnan((double)(x))# else# define Perl_isnan(x) ((x)!=(x))# endif# endif#else# define NV_DIG DBL_DIG# ifdef DBL_MANT_DIG# define NV_MANT_DIG DBL_MANT_DIG# endif# ifdef DBL_MAX# define NV_MAX DBL_MAX# define NV_MIN DBL_MIN# else# ifdef HUGE_VAL# define NV_MAX HUGE_VAL# endif# endif# define Perl_cos cos# define Perl_sin sin# define Perl_sqrt sqrt# define Perl_exp exp# define Perl_log log# define Perl_atan2 atan2# define Perl_pow pow# define Perl_floor floor# define Perl_fmod fmod# define Perl_modf(x,y) modf(x,y)# define Perl_frexp(x,y) frexp(x,y)# ifdef HAS_ISNAN# define Perl_isnan(x) isnan(x)# else# define Perl_isnan(x) ((x)!=(x))# endif#endif#if !defined(Perl_atof) && defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)# if !defined(Perl_atof) && defined(HAS_STRTOLD) # define Perl_atof(s) (NV)strtold(s, (char**)NULL)# endif# if !defined(Perl_atof) && defined(HAS_ATOLF)# define Perl_atof (NV)atolf# endif# if !defined(Perl_atof) && defined(PERL_SCNfldbl)# define Perl_atof PERL_SCNfldbl# define Perl_atof2(s,f) sscanf((s), "%"PERL_SCNfldbl, &(f))# endif#endif#if !defined(Perl_atof)# define Perl_atof atof /* we assume atof being available anywhere */#endif#if !defined(Perl_atof2)# define Perl_atof2(s,f) ((f) = (NV)Perl_atof(s))#endif/* Previously these definitions used hardcoded figures. * It is hoped these formula are more portable, although * no data one way or another is presently known to me. * The "PERL_" names are used because these calculated constants * do not meet the ANSI requirements for LONG_MAX, etc., which * need to be constants acceptable to #if - kja * define PERL_LONG_MAX 2147483647L * define PERL_LONG_MIN (-LONG_MAX - 1) * define PERL ULONG_MAX 4294967295L */#ifdef I_LIMITS /* Needed for cast_xxx() functions below. */# include <limits.h>#else#ifdef I_VALUES# include <values.h>#endif#endif/* * Try to figure out max and min values for the integral types. THE CORRECT * SOLUTION TO THIS MESS: ADAPT enquire.c FROM GCC INTO CONFIGURE. The * following hacks are used if neither limits.h or values.h provide them: * U<TYPE>_MAX: for types >= int: ~(unsigned TYPE)0 * for types < int: (unsigned TYPE)~(unsigned)0 * The argument to ~ must be unsigned so that later signed->unsigned * conversion can't modify the value's bit pattern (e.g. -0 -> +0), * and it must not be smaller than int because ~ does integral promotion. * <type>_MAX: (<type>) (U<type>_MAX >> 1) * <type>_MIN: -<type>_MAX - <is_twos_complement_architecture: (3 & -1) == 3>. * The latter is a hack which happens to work on some machines but * does *not* catch any random system, or things like integer types * with NaN if that is possible. * * All of the types are explicitly cast to prevent accidental loss of * numeric range, and in the hope that they will be less likely to confuse * over-eager optimizers. * */#define PERL_UCHAR_MIN ((unsigned char)0)#ifdef UCHAR_MAX# define PERL_UCHAR_MAX ((unsigned char)UCHAR_MAX)#else# ifdef MAXUCHAR# define PERL_UCHAR_MAX ((unsigned char)MAXUCHAR)# else# define PERL_UCHAR_MAX ((unsigned char)~(unsigned)0)# endif#endif /* * CHAR_MIN and CHAR_MAX are not included here, as the (char) type may be * ambiguous. It may be equivalent to (signed char) or (unsigned char) * depending on local options. Until Configure detects this (or at least * detects whether the "signed" keyword is available) the CHAR ranges * will not be included. UCHAR functions normally. * - kja */#define PERL_USHORT_MIN ((unsigned short)0)#ifdef USHORT_MAX# define PERL_USHORT_MAX ((unsigned short)USHORT_MAX)#else# ifdef MAXUSHORT# define PERL_USHORT_MAX ((unsigned short)MAXUSHORT)# else# ifdef USHRT_MAX# define PERL_USHORT_MAX ((unsigned short)USHRT_MAX)# else# define PERL_USHORT_MAX ((unsigned short)~(unsigned)0)# endif# endif#endif#ifdef SHORT_MAX# define PERL_SHORT_MAX ((short)SHORT_MAX)#else# ifdef MAXSHORT /* Often used in <values.h> */# define PERL_SHORT_MAX ((short)MAXSHORT)# else# ifdef SHRT_MAX# define PERL_SHORT_MAX ((short)SHRT_MAX)# else# define PERL_SHORT_MAX ((short) (PERL_USHORT_MAX >> 1))# endif# endif#endif#ifdef SHORT_MIN# define PERL_SHORT_MIN ((short)SHORT_MIN)#else# ifdef MINSHORT# define PERL_SHORT_MIN ((short)MINSHORT)# else# ifdef SHRT_MIN# define PERL_SHORT_MIN ((short)SHRT_MIN)# else# define PERL_SHORT_MIN (-PERL_SHORT_MAX - ((3 & -1) == 3))# endif# endif#endif#ifdef UINT_MAX# define PERL_UINT_MAX ((unsigned int)UINT_MAX)#else# ifdef MAXUINT# define PERL_UINT_MAX ((unsigned int)MAXUINT)# else# define PERL_UINT_MAX (~(unsigned int)0)# endif#endif#define PERL_UINT_MIN ((unsigned int)0)#ifdef INT_MAX# define PERL_INT_MAX ((int)INT_MAX)#else# ifdef MAXINT /* Often used in <values.h> */# define PERL_INT_MAX ((int)MAXINT)# else# define PERL_INT_MAX ((int)(PERL_UINT_MAX >> 1))# endif#endif#ifdef INT_MIN# define PERL_INT_MIN ((int)INT_MIN)#else# ifdef MININT# define PERL_INT_MIN ((int)MININT)# else# define PERL_INT_MIN (-PERL_INT_MAX - ((3 & -1) == 3))# endif#endif#ifdef ULONG_MAX# define PERL_ULONG_MAX ((unsigned long)ULONG_MAX)#else# ifdef MAXULONG# define PERL_ULONG_MAX ((unsigned long)MAXULONG)# else# define PERL_ULONG_MAX (~(unsigned long)0)# endif#endif#define PERL_ULONG_MIN ((unsigned long)0L)#ifdef LONG_MAX# define PERL_LONG_MAX ((long)LONG_MAX)#else# ifdef MAXLONG /* Often used in <values.h> */# define PERL_LONG_MAX ((long)MAXLONG)# else# define PERL_LONG_MAX ((long) (PERL_ULONG_MAX >> 1))# endif#endif#ifdef LONG_MIN# define PERL_LONG_MIN ((long)LONG_MIN)#else# ifdef MINLONG# define PERL_LONG_MIN ((long)MINLONG)# else# define PERL_LONG_MIN (-PERL_LONG_MAX - ((3 & -1) == 3))# endif#endif#ifdef UV_IS_QUAD# define PERL_UQUAD_MAX (~(UV)0)# define PERL_UQUAD_MIN ((UV)0)# define PERL_QUAD_MAX ((IV) (PERL_UQUAD_MAX >> 1))# define PERL_QUAD_MIN (-PERL_QUAD_MAX - ((3 & -1) == 3))#endifstruct perl_mstats { UV *nfree; UV *ntotal; IV topbucket, topbucket_ev, topbucket_odd, totfree, total, total_chain; IV total_sbrk, sbrks, sbrk_good, sbrk_slack, start_slack, sbrked_remains; IV minbucket; /* Level 1 info */ UV *bucket_mem_size; UV *bucket_available_size; UV nbuckets;};typedef MEM_SIZE STRLEN;typedef struct op OP;typedef struct cop COP;typedef struct unop UNOP;typedef struct binop BINOP;typedef struct listop LISTOP;typedef struct logop LOGOP;typedef struct pmop PMOP;typedef struct svop SVOP;typedef struct padop PADOP;typedef struct pvop PVOP;typedef struct loop LOOP;typedef struct interpreter PerlInterpreter;#ifdef UTS# define STRUCT_SV perl_sv /* Amdahl's <ksync.h> has struct sv */#else# define STRUCT_SV sv#endiftypedef struct STRUCT_SV SV;typedef struct av AV;typedef struct hv HV;typedef struct cv CV;typedef struct regexp REGEXP;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -