📄 perl.h
字号:
# define DIR void# endif#endif#ifdef FPUTS_BOTCH/* work around botch in SunOS 4.0.1 and 4.0.2 */# ifndef fputs# define fputs(sv,fp) fprintf(fp,"%s",sv)# endif#endif/* * The following gobbledygook brought to you on behalf of __STDC__. * (I could just use #ifndef __STDC__, but this is more bulletproof * in the face of half-implementations.) */#if defined(I_SYSMODE) && !defined(PERL_MICRO)#include <sys/mode.h>#endif#ifndef S_IFMT# ifdef _S_IFMT# define S_IFMT _S_IFMT# else# define S_IFMT 0170000# endif#endif#ifndef S_ISDIR# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)#endif#ifndef S_ISCHR# define S_ISCHR(m) ((m & S_IFMT) == S_IFCHR)#endif#ifndef S_ISBLK# ifdef S_IFBLK# define S_ISBLK(m) ((m & S_IFMT) == S_IFBLK)# else# define S_ISBLK(m) (0)# endif#endif#ifndef S_ISREG# define S_ISREG(m) ((m & S_IFMT) == S_IFREG)#endif#ifndef S_ISFIFO# ifdef S_IFIFO# define S_ISFIFO(m) ((m & S_IFMT) == S_IFIFO)# else# define S_ISFIFO(m) (0)# endif#endif#ifndef S_ISLNK# ifdef _S_ISLNK# define S_ISLNK(m) _S_ISLNK(m)# else# ifdef _S_IFLNK# define S_ISLNK(m) ((m & S_IFMT) == _S_IFLNK)# else# ifdef S_IFLNK# define S_ISLNK(m) ((m & S_IFMT) == S_IFLNK)# else# define S_ISLNK(m) (0)# endif# endif# endif#endif#ifndef S_ISSOCK# ifdef _S_ISSOCK# define S_ISSOCK(m) _S_ISSOCK(m)# else# ifdef _S_IFSOCK# define S_ISSOCK(m) ((m & S_IFMT) == _S_IFSOCK)# else# ifdef S_IFSOCK# define S_ISSOCK(m) ((m & S_IFMT) == S_IFSOCK)# else# define S_ISSOCK(m) (0)# endif# endif# endif#endif#ifndef S_IRUSR# ifdef S_IREAD# define S_IRUSR S_IREAD# define S_IWUSR S_IWRITE# define S_IXUSR S_IEXEC# else# define S_IRUSR 0400# define S_IWUSR 0200# define S_IXUSR 0100# endif#endif#ifndef S_IRGRP# ifdef S_IRUSR# define S_IRGRP (S_IRUSR>>3)# define S_IWGRP (S_IWUSR>>3)# define S_IXGRP (S_IXUSR>>3)# else# define S_IRGRP 0040# define S_IWGRP 0020# define S_IXGRP 0010# endif#endif#ifndef S_IROTH# ifdef S_IRUSR# define S_IROTH (S_IRUSR>>6)# define S_IWOTH (S_IWUSR>>6)# define S_IXOTH (S_IXUSR>>6)# else# define S_IROTH 0040# define S_IWOTH 0020# define S_IXOTH 0010# endif#endif#ifndef S_ISUID# define S_ISUID 04000#endif#ifndef S_ISGID# define S_ISGID 02000#endif#ifndef S_IRWXU# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)#endif#ifndef S_IRWXG# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)#endif#ifndef S_IRWXO# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)#endif/* BeOS 5.0 seems to define S_IREAD and S_IWRITE in <posix/fcntl.h> * which would get included through <sys/file.h >, but that is 3000 * lines in the future. --jhi */#if !defined(S_IREAD) && !defined(__BEOS__)# define S_IREAD S_IRUSR#endif#if !defined(S_IWRITE) && !defined(__BEOS__)# define S_IWRITE S_IWUSR#endif#ifndef S_IEXEC# define S_IEXEC S_IXUSR#endif#ifdef ff_next# undef ff_next#endif#if defined(cray) || defined(gould) || defined(i860) || defined(pyr)# define SLOPPYDIVIDE#endif#ifdef UV#undef UV#endif#ifdef SPRINTF_E_BUG# define sprintf UTS_sprintf_wrap#endif/* For the times when you want the return value of sprintf, and you want it to be the length. Can't have a thread variable passed in, because C89 has no varargs macros.*/#ifdef SPRINTF_RETURNS_STRLEN# define my_sprintf sprintf#else# define my_sprintf Perl_my_sprintf#endif/* * If we have v?snprintf() and the C99 variadic macros, we can just * use just the v?snprintf(). It is nice to try to trap the buffer * overflow, however, so if we are DEBUGGING, and we cannot use the * gcc statement expressions, then use the function wrappers which try * to trap the overflow. If we can use the gcc statement expressions, * we can try that even with the version that uses the C99 variadic * macros. *//* Note that we do not check against snprintf()/vsnprintf() returning * negative values because that is non-standard behaviour and we use * snprintf/vsnprintf only iff HAS_VSNPRINTF has been defined, and * that should be true only if the snprintf()/vsnprintf() are true * to the standard. */#if defined(HAS_SNPRINTF) && defined(HAS_C99_VARIADIC_MACROS) && !(defined(DEBUGGING) && !defined(PERL_USE_GCC_BRACE_GROUPS)) && !defined(PERL_GCC_PEDANTIC)# ifdef PERL_USE_GCC_BRACE_GROUPS# define my_snprintf(buffer, len, ...) ({ int __len__ = snprintf(buffer, len, __VA_ARGS__); if ((len) > 0 && (Size_t)__len__ >= (len)) Perl_croak_nocontext("panic: snprintf buffer overflow"); __len__; })# define PERL_MY_SNPRINTF_GUARDED# else# define my_snprintf(buffer, len, ...) snprintf(buffer, len, __VA_ARGS__)# endif#else# define my_snprintf Perl_my_snprintf# define PERL_MY_SNPRINTF_GUARDED#endif#if defined(HAS_VSNPRINTF) && defined(HAS_C99_VARIADIC_MACROS) && !(defined(DEBUGGING) && !defined(PERL_USE_GCC_BRACE_GROUPS)) && !defined(PERL_GCC_PEDANTIC)# ifdef PERL_USE_GCC_BRACE_GROUPS# define my_vsnprintf(buffer, len, ...) ({ int __len__ = vsnprintf(buffer, len, __VA_ARGS__); if ((len) > 0 && (Size_t)__len__ >= (len)) Perl_croak_nocontext("panic: vsnprintf buffer overflow"); __len__; })# define PERL_MY_VSNPRINTF_GUARDED# else# define my_vsnprintf(buffer, len, ...) vsnprintf(buffer, len, __VA_ARGS__)# endif#else# define my_vsnprintf Perl_my_vsnprintf# define PERL_MY_VSNPRINTF_GUARDED#endif#ifdef HAS_STRLCAT# define my_strlcat strlcat#else# define my_strlcat Perl_my_strlcat#endif#ifdef HAS_STRLCPY# define my_strlcpy strlcpy#else# define my_strlcpy Perl_my_strlcpy#endif/* Configure gets this right but the UTS compiler gets it wrong. -- Hal Morris <hom00@utsglobal.com> */#ifdef UTS# undef UVTYPE# define UVTYPE unsigned#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#ifndef HAS_QUAD# undef PERL_NEED_MY_HTOLE64# undef PERL_NEED_MY_LETOH64# undef PERL_NEED_MY_HTOBE64# undef PERL_NEED_MY_BETOH64#endif#if defined(uts) || defined(UTS)# undef UV_MAX# define UV_MAX (4294967295u)#endif#define IV_DIG (BIT_DIGITS(IVSIZE * 8))#define UV_DIG (BIT_DIGITS(UVSIZE * 8))#ifndef NO_PERL_PRESERVE_IVUV#define PERL_PRESERVE_IVUV /* We like our integers to stay integers. */#endif/* * 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# 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)#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 * two ways around this. One (used below) is to do two casts, * first the other pointer to an (unsigned) integer, and then * the integer to the other pointer. The other way would be * to use unions to "overlay" the pointers. For an example of * the latter technique, see union dirpu in struct xpvio in sv.h. * The only feasible use is probably temporarily storing * function pointers in a data pointer (such as a void 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 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). (It also has other uses, such as figuring out if a given precision of printing can be done with a double instead of a long double - Allen).*/#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 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#endif/* * This is for making sure we have a good DBL_MAX value, if possible, * either for usage as NV_MAX or for usage in figuring out if we can * fit a given long double into a double, if bug-fixing makes it * necessary to do so. - Allen <allens@cpan.org> */#ifdef I_LIMITS# include <limits.h>#endif#ifdef I_VALUES# if !(defined(DBL_MIN) && defined(DBL_MAX) && defined(I_LIMITS))# include <values.h># if defined(MAXDOUBLE) && !defined(DBL_MAX)# define DBL_MAX MAXDOUBLE# endif# if defined(MINDOUBLE) && !defined(DBL_MIN)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -