📄 perl.h
字号:
/* The old value was hard coded at 1008. (4096-16) seems to be a bit faster, at least on FreeBSD. YMMV, so experiment. */#ifndef PERL_ARENA_SIZE#define PERL_ARENA_SIZE 4080#endif#endif /* PERL_CORE *//* We no longer default to creating a new SV for GvSV. Do this before embed. */#ifndef PERL_CREATE_GVSV# ifndef PERL_DONT_CREATE_GVSV# define PERL_DONT_CREATE_GVSV# endif#endif#if !defined(HAS_WAITPID) && !defined(HAS_WAIT4) || defined(HAS_WAITPID_RUNTIME)#define PERL_USES_PL_PIDSTATUS#endif#if !defined(OS2) && !defined(WIN32) && !defined(DJGPP) && !defined(EPOC) && !defined(__SYMBIAN32__) && !defined(MACOS_TRADITIONAL)#define PERL_DEFAULT_DO_EXEC3_IMPLEMENTATION#endif/* Cannot include embed.h here on Win32 as win32.h has not yet been included and defines some config variables e.g. HAVE_INTERP_INTERN */#if !defined(PERL_FOR_X2P) && !(defined(WIN32)||defined(VMS))# include "embed.h"# ifndef PERL_MAD# undef op_getmad# define op_getmad(arg,pegop,slot) NOOP# endif#endif#define MEM_SIZE Size_t/* Round all values passed to malloc up, by default to a multiple of sizeof(size_t)*/#ifndef PERL_STRLEN_ROUNDUP_QUANTUM#define PERL_STRLEN_ROUNDUP_QUANTUM Size_t_size#endif#if defined(STANDARD_C) && defined(I_STDDEF)# include <stddef.h># define STRUCT_OFFSET(s,m) offsetof(s,m)#else# define STRUCT_OFFSET(s,m) (Size_t)(&(((s *)0)->m))#endif#ifndef __SYMBIAN32__# if defined(I_STRING) || defined(__cplusplus)# include <string.h># else# include <strings.h># endif#endif/* This comes after <stdlib.h> so we don't try to change the standard * library prototypes; we'll use our own in proto.h instead. */#ifdef MYMALLOC# ifdef PERL_POLLUTE_MALLOC# ifndef PERL_EXTMALLOC_DEF# define Perl_malloc malloc# define Perl_calloc calloc# define Perl_realloc realloc# define Perl_mfree free# endif# else# define EMBEDMYMALLOC /* for compatibility */# endif# define safemalloc Perl_malloc# define safecalloc Perl_calloc# define saferealloc Perl_realloc# define safefree Perl_mfree# define CHECK_MALLOC_TOO_LATE_FOR_(code) STMT_START { \ if (!PL_tainting && MallocCfg_ptr[MallocCfg_cfg_env_read]) \ code; \ } STMT_END# define CHECK_MALLOC_TOO_LATE_FOR(ch) \ CHECK_MALLOC_TOO_LATE_FOR_(MALLOC_TOO_LATE_FOR(ch))# define panic_write2(s) write(2, s, strlen(s))# define CHECK_MALLOC_TAINT(newval) \ CHECK_MALLOC_TOO_LATE_FOR_( \ if (newval) { \ panic_write2("panic: tainting with $ENV{PERL_MALLOC_OPT}\n");\ exit(1); })# define MALLOC_CHECK_TAINT(argc,argv,env) STMT_START { \ if (doing_taint(argc,argv,env)) { \ MallocCfg_ptr[MallocCfg_skip_cfg_env] = 1; \ }} STMT_END;#else /* MYMALLOC */# define safemalloc safesysmalloc# define safecalloc safesyscalloc# define saferealloc safesysrealloc# define safefree safesysfree# define CHECK_MALLOC_TOO_LATE_FOR(ch) ((void)0)# define CHECK_MALLOC_TAINT(newval) ((void)0)# define MALLOC_CHECK_TAINT(argc,argv,env)#endif /* MYMALLOC */#define TOO_LATE_FOR_(ch,what) Perl_croak(aTHX_ "\"-%c\" is on the #! line, it must also be used on the command line%s", (char)(ch), what)#define TOO_LATE_FOR(ch) TOO_LATE_FOR_(ch, "")#define MALLOC_TOO_LATE_FOR(ch) TOO_LATE_FOR_(ch, " with $ENV{PERL_MALLOC_OPT}")#define MALLOC_CHECK_TAINT2(argc,argv) MALLOC_CHECK_TAINT(argc,argv,NULL)#if !defined(HAS_STRCHR) && defined(HAS_INDEX) && !defined(strchr)#define strchr index#define strrchr rindex#endif#ifdef I_MEMORY# include <memory.h>#endif#ifdef HAS_MEMCPY# if !defined(STANDARD_C) && !defined(I_STRING) && !defined(I_MEMORY)# ifndef memcpy extern char * memcpy (char*, char*, int);# endif# endif#else# ifndef memcpy# ifdef HAS_BCOPY# define memcpy(d,s,l) bcopy(s,d,l)# else# define memcpy(d,s,l) my_bcopy(s,d,l)# endif# endif#endif /* HAS_MEMCPY */#ifdef HAS_MEMSET# if !defined(STANDARD_C) && !defined(I_STRING) && !defined(I_MEMORY)# ifndef memset extern char *memset (char*, int, int);# endif# endif#else# undef memset# define memset(d,c,l) my_memset(d,c,l)#endif /* HAS_MEMSET */#if !defined(HAS_MEMMOVE) && !defined(memmove)# if defined(HAS_BCOPY) && defined(HAS_SAFE_BCOPY)# define memmove(d,s,l) bcopy(s,d,l)# else# if defined(HAS_MEMCPY) && defined(HAS_SAFE_MEMCPY)# define memmove(d,s,l) memcpy(d,s,l)# else# define memmove(d,s,l) my_bcopy(s,d,l)# endif# endif#endif#if defined(mips) && defined(ultrix) && !defined(__STDC__)# undef HAS_MEMCMP#endif#if defined(HAS_MEMCMP) && defined(HAS_SANE_MEMCMP)# if !defined(STANDARD_C) && !defined(I_STRING) && !defined(I_MEMORY)# ifndef memcmp extern int memcmp (char*, char*, int);# endif# endif# ifdef BUGGY_MSC# pragma function(memcmp)# endif#else# ifndef memcmp# define memcmp my_memcmp# endif#endif /* HAS_MEMCMP && HAS_SANE_MEMCMP */#ifndef memzero# ifdef HAS_MEMSET# define memzero(d,l) memset(d,0,l)# else# ifdef HAS_BZERO# define memzero(d,l) bzero(d,l)# else# define memzero(d,l) my_bzero(d,l)# endif# endif#endif#ifndef PERL_MICRO#ifndef memchr# ifndef HAS_MEMCHR# define memchr(s,c,n) ninstr((char*)(s), ((char*)(s)) + n, &(c), &(c) + 1)# endif#endif#endif#ifndef HAS_BCMP# ifndef bcmp# define bcmp(s1,s2,l) memcmp(s1,s2,l)# endif#endif /* !HAS_BCMP */#ifdef I_NETINET_IN# include <netinet/in.h>#endif#ifdef I_ARPA_INET# include <arpa/inet.h>#endif#if defined(SF_APPEND) && defined(USE_SFIO) && defined(I_SFIO)/* <sfio.h> defines SF_APPEND and <sys/stat.h> might define SF_APPEND * (the neo-BSD seem to do this). */# undef SF_APPEND#endif#ifdef I_SYS_STAT# include <sys/stat.h>#endif/* The stat macros for Amdahl UTS, Unisoft System V/88 (and derivatives like UTekV) are broken, sometimes giving false positives. Undefine them here and let the code below set them to proper values. The ghs macro stands for GreenHills Software C-1.8.5 which is the C compiler for sysV88 and the various derivatives. This header file bug is corrected in gcc-2.5.8 and later versions. --Kaveh Ghazi (ghazi@noc.rutgers.edu) 10/3/94. */#if defined(uts) || (defined(m88k) && defined(ghs))# undef S_ISDIR# undef S_ISCHR# undef S_ISBLK# undef S_ISREG# undef S_ISFIFO# undef S_ISLNK#endif#ifdef I_TIME# include <time.h>#endif#ifdef I_SYS_TIME# ifdef I_SYS_TIME_KERNEL# define KERNEL# endif# include <sys/time.h># ifdef I_SYS_TIME_KERNEL# undef KERNEL# endif#endif#if defined(HAS_TIMES) && defined(I_SYS_TIMES)# include <sys/times.h>#endif#if defined(HAS_STRERROR) && (!defined(HAS_MKDIR) || !defined(HAS_RMDIR))# undef HAS_STRERROR#endif#include <errno.h>#if defined(WIN32) && defined(PERL_IMPLICIT_SYS)# define WIN32SCK_IS_STDSCK /* don't pull in custom wsock layer */#endif/* In Tru64 use the 4.4BSD struct msghdr, not the 4.3 one. * This is important for using IPv6. * For OSF/1 3.2, however, defining _SOCKADDR_LEN would be * a bad idea since it breaks send() and recv(). */#if defined(__osf__) && defined(__alpha) && !defined(_SOCKADDR_LEN) && !defined(DEC_OSF1_3_X)# define _SOCKADDR_LEN#endif#if defined(HAS_SOCKET) && !defined(VMS) && !defined(WIN32) /* VMS/WIN32 handle sockets via vmsish.h/win32.h */# include <sys/socket.h># if defined(USE_SOCKS) && defined(I_SOCKS)# if !defined(INCLUDE_PROTOTYPES)# define INCLUDE_PROTOTYPES /* for <socks.h> */# define PERL_SOCKS_NEED_PROTOTYPES# endif# include <socks.h># ifdef PERL_SOCKS_NEED_PROTOTYPES /* keep cpp space clean */# undef INCLUDE_PROTOTYPES# undef PERL_SOCKS_NEED_PROTOTYPES# endif# endif# ifdef I_NETDB# ifdef NETWARE# include<stdio.h># endif# include <netdb.h># endif# ifndef ENOTSOCK# ifdef I_NET_ERRNO# include <net/errno.h># endif# endif#endif/* sockatmark() is so new (2001) that many places might have it hidden * behind some -D_BLAH_BLAH_SOURCE guard. The __THROW magic is required * e.g. in Gentoo, see http://bugs.gentoo.org/show_bug.cgi?id=12605 */#if defined(HAS_SOCKATMARK) && !defined(HAS_SOCKATMARK_PROTO)# if defined(__THROW) && defined(__GLIBC__)int sockatmark(int) __THROW;# elseint sockatmark(int);# endif#endif#if defined(__osf__) && defined(__cplusplus) && !defined(_XOPEN_SOURCE_EXTENDED) /* Tru64 "cxx" (C++), see hints/dec_osf.sh for why the _XOPEN_SOURCE_EXTENDED cannot be defined. */EXTERN_C int fchdir(int);EXTERN_C int flock(int, int);EXTERN_C int fseeko(FILE *, off_t, int);EXTERN_C off_t ftello(FILE *);#endif#if defined(__SUNPRO_CC) /* SUNWspro CC (C++) */EXTERN_C char *crypt(const char *, const char *);EXTERN_C char **environ;#endif#if defined(__cplusplus)# if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)EXTERN_C char **environ;# elif defined(__CYGWIN__)EXTERN_C char *crypt(const char *, const char *);#endif#endif#ifdef SETERRNO# undef SETERRNO /* SOCKS might have defined this */#endif#ifdef VMS# define SETERRNO(errcode,vmserrcode) \ STMT_START { \ set_errno(errcode); \ set_vaxc_errno(vmserrcode); \ } STMT_END# define LIB_INVARG LIB$_INVARG# define RMS_DIR RMS$_DIR# define RMS_FAC RMS$_FAC# define RMS_FEX RMS$_FEX# define RMS_FNF RMS$_FNF# define RMS_IFI RMS$_IFI# define RMS_ISI RMS$_ISI# define RMS_PRV RMS$_PRV# define SS_ACCVIO SS$_ACCVIO# define SS_DEVOFFLINE SS$_DEVOFFLINE# define SS_IVCHAN SS$_IVCHAN# define SS_NORMAL SS$_NORMAL#else# define SETERRNO(errcode,vmserrcode) (errno = (errcode))# define LIB_INVARG 0# define RMS_DIR 0# define RMS_FAC 0# define RMS_FEX 0# define RMS_FNF 0# define RMS_IFI 0# define RMS_ISI 0# define RMS_PRV 0# define SS_ACCVIO 0# define SS_DEVOFFLINE 0# define SS_IVCHAN 0# define SS_NORMAL 0#endif#define ERRSV GvSV(PL_errgv)/* FIXME? Change the assignments to PL_defgv to instantiate GvSV? */#define DEFSV GvSVn(PL_defgv)#define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv))#define ERRHV GvHV(PL_errgv) /* XXX unused, here for compatibility */#ifndef errno extern int errno; /* ANSI allows errno to be an lvalue expr. * For example in multithreaded environments * something like this might happen: * extern int *_errno(void); * #define errno (*_errno()) */#endif#ifdef HAS_STRERROR# ifdef VMS char *strerror (int,...);# else#ifndef DONT_DECLARE_STD char *strerror (int);#endif# endif# ifndef Strerror# define Strerror strerror# endif#else# ifdef HAS_SYS_ERRLIST extern int sys_nerr; extern char *sys_errlist[];# ifndef Strerror# define Strerror(e) \ ((e) < 0 || (e) >= sys_nerr ? "(unknown)" : sys_errlist[e])# endif# endif#endif#ifdef I_SYS_IOCTL# ifndef _IOCTL_# include <sys/ioctl.h># endif#endif#if defined(mc300) || defined(mc500) || defined(mc700) || defined(mc6000)# ifdef HAS_SOCKETPAIR# undef HAS_SOCKETPAIR# endif# ifdef I_NDBM# undef I_NDBM# endif#endif#ifndef HAS_SOCKETPAIR# ifdef HAS_SOCKET# define socketpair Perl_my_socketpair# endif#endif#if INTSIZE == 2# define htoni htons# define ntohi ntohs#else# define htoni htonl# define ntohi ntohl#endif/* Configure already sets Direntry_t */#if defined(I_DIRENT)# include <dirent.h> /* NeXT needs dirent + sys/dir.h */# if defined(I_SYS_DIR) && (defined(NeXT) || defined(__NeXT__))# include <sys/dir.h># endif#else# ifdef I_SYS_NDIR# include <sys/ndir.h># else# ifdef I_SYS_DIR# ifdef hp9000s500# include <ndir.h> /* may be wrong in the future */# else# include <sys/dir.h># endif# endif# endif#endif#ifdef PERL_MICRO# ifndef DIR
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -