📄 perl.h
字号:
struct ptr_tbl { struct ptr_tbl_ent** tbl_ary; UV tbl_max; UV tbl_items;};#if defined(iAPX286) || defined(M_I286) || defined(I80286)# define I286#endif#if defined(htonl) && !defined(HAS_HTONL)#define HAS_HTONL#endif#if defined(htons) && !defined(HAS_HTONS)#define HAS_HTONS#endif#if defined(ntohl) && !defined(HAS_NTOHL)#define HAS_NTOHL#endif#if defined(ntohs) && !defined(HAS_NTOHS)#define HAS_NTOHS#endif#ifndef HAS_HTONL#if (BYTEORDER & 0xffff) != 0x4321#define HAS_HTONS#define HAS_HTONL#define HAS_NTOHS#define HAS_NTOHL#define MYSWAP#define htons my_swap#define htonl my_htonl#define ntohs my_swap#define ntohl my_ntohl#endif#else#if (BYTEORDER & 0xffff) == 0x4321#undef HAS_HTONS#undef HAS_HTONL#undef HAS_NTOHS#undef HAS_NTOHL#endif#endif/* * Little-endian byte order functions - 'v' for 'VAX', or 'reVerse'. * -DWS */#if BYTEORDER != 0x1234# define HAS_VTOHL# define HAS_VTOHS# define HAS_HTOVL# define HAS_HTOVS# if BYTEORDER == 0x4321 || BYTEORDER == 0x87654321# define vtohl(x) ((((x)&0xFF)<<24) \ +(((x)>>24)&0xFF) \ +(((x)&0x0000FF00)<<8) \ +(((x)&0x00FF0000)>>8) )# define vtohs(x) ((((x)&0xFF)<<8) + (((x)>>8)&0xFF))# define htovl(x) vtohl(x)# define htovs(x) vtohs(x)# endif /* otherwise default to functions in util.c */#endif#ifdef CASTNEGFLOAT#define U_S(what) ((U16)(what))#define U_I(what) ((unsigned int)(what))#define U_L(what) ((U32)(what))#else#define U_S(what) ((U16)cast_ulong((NV)(what)))#define U_I(what) ((unsigned int)cast_ulong((NV)(what)))#define U_L(what) (cast_ulong((NV)(what)))#endif#ifdef CASTI32#define I_32(what) ((I32)(what))#define I_V(what) ((IV)(what))#define U_V(what) ((UV)(what))#else#define I_32(what) (cast_i32((NV)(what)))#define I_V(what) (cast_iv((NV)(what)))#define U_V(what) (cast_uv((NV)(what)))#endif/* These do not care about the fractional part, only about the range. */#define NV_WITHIN_IV(nv) (I_V(nv) >= IV_MIN && I_V(nv) <= IV_MAX)#define NV_WITHIN_UV(nv) ((nv)>=0.0 && U_V(nv) >= UV_MIN && U_V(nv) <= UV_MAX)/* Used with UV/IV arguments: */ /* XXXX: need to speed it up */#define CLUMP_2UV(iv) ((iv) < 0 ? 0 : (UV)(iv))#define CLUMP_2IV(uv) ((uv) > (UV)IV_MAX ? IV_MAX : (IV)(uv))#ifndef MAXSYSFD# define MAXSYSFD 2#endif#ifndef __cplusplusUid_t getuid (void);Uid_t geteuid (void);Gid_t getgid (void);Gid_t getegid (void);#endif#ifndef Perl_debug_log# define Perl_debug_log PerlIO_stderr()#endif#ifndef Perl_error_log# define Perl_error_log (PL_stderrgv \ && GvIOp(PL_stderrgv) \ && IoOFP(GvIOp(PL_stderrgv)) \ ? IoOFP(GvIOp(PL_stderrgv)) \ : PerlIO_stderr())#endif#ifdef DEBUGGING#undef YYDEBUG#define YYDEBUG 1#define DEB(a) a#define DEBUG(a) if (PL_debug) a#define DEBUG_p(a) if (PL_debug & 1) a#define DEBUG_s(a) if (PL_debug & 2) a#define DEBUG_l(a) if (PL_debug & 4) a#define DEBUG_t(a) if (PL_debug & 8) a#define DEBUG_o(a) if (PL_debug & 16) a#define DEBUG_c(a) if (PL_debug & 32) a#define DEBUG_P(a) if (PL_debug & 64) a# if defined(PERL_OBJECT)# define DEBUG_m(a) if (PL_debug & 128) a# else /* Temporarily turn off memory debugging in case the a * does memory allocation, either directly or indirectly. */# define DEBUG_m(a) \ STMT_START { \ if (PERL_GET_INTERP) { dTHX; if (PL_debug & 128) {PL_debug&=~128; a; PL_debug|=128;} } \ } STMT_END# endif#define DEBUG_f(a) if (PL_debug & 256) a#define DEBUG_r(a) if (PL_debug & 512) a#define DEBUG_x(a) if (PL_debug & 1024) a#define DEBUG_u(a) if (PL_debug & 2048) a#define DEBUG_L(a) if (PL_debug & 4096) a#define DEBUG_H(a) if (PL_debug & 8192) a#define DEBUG_X(a) if (PL_debug & 16384) a#define DEBUG_D(a) if (PL_debug & 32768) a# ifdef USE_THREADS# define DEBUG_S(a) if (PL_debug & (1<<16)) a# else# define DEBUG_S(a)# endif#define DEBUG_T(a) if (PL_debug & (1<<17)) a#else#define DEB(a)#define DEBUG(a)#define DEBUG_p(a)#define DEBUG_s(a)#define DEBUG_l(a)#define DEBUG_t(a)#define DEBUG_o(a)#define DEBUG_c(a)#define DEBUG_P(a)#define DEBUG_m(a)#define DEBUG_f(a)#define DEBUG_r(a)#define DEBUG_x(a)#define DEBUG_u(a)#define DEBUG_S(a)#define DEBUG_H(a)#define DEBUG_X(a)#define DEBUG_D(a)#define DEBUG_S(a)#define DEBUG_T(a)#endif#define YYMAXDEPTH 300#ifndef assert /* <assert.h> might have been included somehow */#define assert(what) DEB( { \ if (!(what)) { \ Perl_croak(aTHX_ "Assertion failed: file \"%s\", line %d", \ __FILE__, __LINE__); \ PerlProc_exit(1); \ }})#endifstruct ufuncs { I32 (*uf_val)(IV, SV*); I32 (*uf_set)(IV, SV*); IV uf_index;};/* Fix these up for __STDC__ */#ifndef DONT_DECLARE_STDchar *mktemp (char*);#ifndef atofdouble atof (const char*);#endif#endif#ifndef STANDARD_C/* All of these are in stdlib.h or time.h for ANSI C */Time_t time();struct tm *gmtime(), *localtime();#if defined(OEMVS) || defined(__OPEN_VM)char *(strchr)(), *(strrchr)();char *(strcpy)(), *(strcat)();#elsechar *strchr(), *strrchr();char *strcpy(), *strcat();#endif#endif /* ! STANDARD_C */#ifdef I_MATH# include <math.h>#elseSTART_EXTERN_C 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); double atan2 (double,double); double pow (double,double);END_EXTERN_C#endif#ifndef __cplusplus# if defined(NeXT) || defined(__NeXT__) /* or whatever catches all NeXTs */char *crypt (); /* Maybe more hosts will need the unprototyped version */# else# if !defined(WIN32)char *crypt (const char*, const char*);# endif /* !WIN32 */# endif /* !NeXT && !__NeXT__ */# ifndef DONT_DECLARE_STD# ifndef getenvchar *getenv (const char*);# endif /* !getenv */# if !defined(HAS_LSEEK_PROTO) && !defined(EPOC) && !defined(__hpux)# ifdef _FILE_OFFSET_BITS# if _FILE_OFFSET_BITS == 64Off_t lseek (int,Off_t,int);# endif# endif# endif# endif /* !DONT_DECLARE_STD */char *getlogin (void);#endif /* !__cplusplus */#ifdef UNLINK_ALL_VERSIONS /* Currently only makes sense for VMS */#define UNLINK unlnkI32 unlnk (char*);#else#define UNLINK PerlLIO_unlink#endif#ifndef HAS_SETREUID# ifdef HAS_SETRESUID# define setreuid(r,e) setresuid(r,e,(Uid_t)-1)# define HAS_SETREUID# endif#endif#ifndef HAS_SETREGID# ifdef HAS_SETRESGID# define setregid(r,e) setresgid(r,e,(Gid_t)-1)# define HAS_SETREGID# endif#endif/* Sighandler_t defined in iperlsys.h */#ifdef HAS_SIGACTIONtypedef struct sigaction Sigsave_t;#elsetypedef Sighandler_t Sigsave_t;#endif#define SCAN_DEF 0#define SCAN_TR 1#define SCAN_REPL 2#ifdef DEBUGGING# ifndef register# define register# endif# define PAD_SV(po) pad_sv(po)# define RUNOPS_DEFAULT Perl_runops_debug#else# define PAD_SV(po) PL_curpad[po]# define RUNOPS_DEFAULT Perl_runops_standard#endif#ifdef MYMALLOC# ifdef MUTEX_INIT_CALLS_MALLOC# define MALLOC_INIT \ STMT_START { \ PL_malloc_mutex = NULL; \ MUTEX_INIT(&PL_malloc_mutex); \ } STMT_END# define MALLOC_TERM \ STMT_START { \ perl_mutex tmp = PL_malloc_mutex; \ PL_malloc_mutex = NULL; \ MUTEX_DESTROY(&tmp); \ } STMT_END# else# define MALLOC_INIT MUTEX_INIT(&PL_malloc_mutex)# define MALLOC_TERM MUTEX_DESTROY(&PL_malloc_mutex)# endif#else# define MALLOC_INIT# define MALLOC_TERM#endiftypedef int (CPERLscope(*runops_proc_t)) (pTHX);typedef OP* (CPERLscope(*PPADDR_t)[]) (pTHX);/* _ (for $_) must be first in the following list (DEFSV requires it) */#define THREADSV_NAMES "_123456789&`'+/.,\\\";^-%=|~:\001\005!@"/* NeXT has problems with crt0.o globals */#if defined(__DYNAMIC__) && \ (defined(NeXT) || defined(__NeXT__) || defined(__APPLE__))# if defined(NeXT) || defined(__NeXT)# include <mach-o/dyld.h># define environ (*environ_pointer)EXT char *** environ_pointer;# else# if defined(__APPLE__) && defined(PERL_CORE)# include <crt_externs.h> /* for the env array */# define environ (*_NSGetEnviron())# endif# endif#else /* VMS and some other platforms don't use the environ array */# ifdef USE_ENVIRON_ARRAY# if !defined(DONT_DECLARE_STD) || \ (defined(__svr4__) && defined(__GNUC__) && defined(sun)) || \ defined(__sgi) || \ defined(__DGUX) extern char ** environ; /* environment variables supplied via exec */# endif# endif#endifSTART_EXTERN_C/* handy constants */EXTCONST char PL_warn_uninit[] INIT("Use of uninitialized value%s%s");EXTCONST char PL_warn_nosemi[] INIT("Semicolon seems to be missing");EXTCONST char PL_warn_reserved[] INIT("Unquoted string \"%s\" may clash with future reserved word");EXTCONST char PL_warn_nl[] INIT("Unsuccessful %s on filename containing newline");EXTCONST char PL_no_wrongref[] INIT("Can't use %s ref as %s ref");EXTCONST char PL_no_symref[] INIT("Can't use string (\"%.32s\") as %s ref while \"strict refs\" in use");EXTCONST char PL_no_usym[] INIT("Can't use an undefined value as %s reference");EXTCONST char PL_no_aelem[] INIT("Modification of non-creatable array value attempted, subscript %d");EXTCONST char PL_no_helem[] INIT("Modification of non-creatable hash value attempted, subscript \"%s\"");EXTCONST char PL_no_modify[] INIT("Modification of a read-only value attempted");EXTCONST char PL_no_mem[] INIT("Out of memory!\n");EXTCONST char PL_no_security[] INIT("Insecure dependency in %s%s");EXTCONST char PL_no_sock_func[] INIT("Unsupported socket function \"%s\" called");EXTCONST char PL_no_dir_func[] INIT("Unsupported directory function \"%s\" called");EXTCONST char PL_no_func[] INIT("The %s function is unimplemented");EXTCONST char PL_no_myglob[] INIT("\"my\" variable %s can't be in a package");EXTCONST char PL_uuemap[65] INIT("`!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_");#ifdef DOINITEXT char *PL_sig_name[] = { SIG_NAME };EXT int PL_sig_num[] = { SIG_NUM };#elseEXT char *PL_sig_name[];EXT int PL_sig_num[];#endif/* fast case folding tables */#ifdef DOINIT#ifdef EBCDICEXT unsigned char PL_fold[] = { /* fast EBCDIC case folding table */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 138, 139, 140, 141, 142, 143, 144, 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 154, 155, 156, 157, 158, 159, 160, 161, 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 202, 203, 204, 205, 206, 207, 208, 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 218, 219, 220, 221, 222, 223, 224, 225, 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255};#else /* ascii rather than ebcdic */EXTCONST unsigned char PL_fold[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 91, 92, 93, 94, 95, 96, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255};#endif /* !EBCDIC */#elseEXTCONST unsigned char PL_fold[];#endif#ifdef DOINITEXT unsigned char PL_fold_locale[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 91, 92, 93, 94, 95, 96, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -