📄 perl.h
字号:
# define STMT_END )# else /* Now which other defined()s do we need here ??? */# if (VOIDFLAGS) && (defined(sun) || defined(__sun__)) && !defined(__GNUC__)# define STMT_START if (1)# define STMT_END else (void)0# else# define STMT_START do# define STMT_END while (0)# endif# endif#endif#define WITH_THX(s) STMT_START { dTHX; s; } STMT_END#define WITH_THR(s) WITH_THX(s)#ifndef BYTEORDER /* Should never happen -- byteorder is in config.h */# define BYTEORDER 0x1234#endif/* Overall memory policy? */#ifndef CONSERVATIVE# define LIBERAL 1#endif#if 'A' == 65 && 'I' == 73 && 'J' == 74 && 'Z' == 90#define ASCIIish#else#undef ASCIIish#endif/* * The following contortions are brought to you on behalf of all the * standards, semi-standards, de facto standards, not-so-de-facto standards * of the world, as well as all the other botches anyone ever thought of. * The basic theory is that if we work hard enough here, the rest of the * code can be a lot prettier. Well, so much for theory. Sorry, Henry... *//* define this once if either system, instead of cluttering up the src */#if defined(MSDOS) || defined(atarist) || defined(WIN32) || defined(NETWARE)#define DOSISH 1#endif#if defined(__STDC__) || defined(_AIX) || defined(__stdc__) || defined(__cplusplus) || defined(EPOC) || defined(NETWARE) || defined(__SYMBIAN32__)# define STANDARD_C 1#endif#if defined(__cplusplus) || defined(WIN32) || defined(__sgi) || defined(__EMX__) || defined(__DGUX) || defined(EPOC) || defined(__QNX__) || defined(NETWARE) || defined(PERL_MICRO)# define DONT_DECLARE_STD 1#endif#if defined(HASVOLATILE) || defined(STANDARD_C)# ifdef __cplusplus# define VOL /* to temporarily suppress warnings */# else# define VOL volatile# endif#else# define VOL#endif#define TAINT (PL_tainted = TRUE)#define TAINT_NOT (PL_tainted = FALSE)#define TAINT_IF(c) if (c) { PL_tainted = TRUE; }#define TAINT_ENV() if (PL_tainting) { taint_env(); }#define TAINT_PROPER(s) if (PL_tainting) { taint_proper(NULL, s); }/* XXX All process group stuff is handled in pp_sys.c. Should these defines move there? If so, I could simplify this a lot. --AD 9/96.*//* Process group stuff changed from traditional BSD to POSIX. perlfunc.pod documents the traditional BSD-style syntax, so we'll try to preserve that, if possible.*/#ifdef HAS_SETPGID# define BSD_SETPGRP(pid, pgrp) setpgid((pid), (pgrp))#else# if defined(HAS_SETPGRP) && defined(USE_BSD_SETPGRP)# define BSD_SETPGRP(pid, pgrp) setpgrp((pid), (pgrp))# else# ifdef HAS_SETPGRP2 /* DG/UX */# define BSD_SETPGRP(pid, pgrp) setpgrp2((pid), (pgrp))# endif# endif#endif#if defined(BSD_SETPGRP) && !defined(HAS_SETPGRP)# define HAS_SETPGRP /* Well, effectively it does . . . */#endif/* getpgid isn't POSIX, but at least Solaris and Linux have it, and it makes our life easier :-) so we'll try it.*/#ifdef HAS_GETPGID# define BSD_GETPGRP(pid) getpgid((pid))#else# if defined(HAS_GETPGRP) && defined(USE_BSD_GETPGRP)# define BSD_GETPGRP(pid) getpgrp((pid))# else# ifdef HAS_GETPGRP2 /* DG/UX */# define BSD_GETPGRP(pid) getpgrp2((pid))# endif# endif#endif#if defined(BSD_GETPGRP) && !defined(HAS_GETPGRP)# define HAS_GETPGRP /* Well, effectively it does . . . */#endif/* These are not exact synonyms, since setpgrp() and getpgrp() may have different behaviors, but perl.h used to define USE_BSDPGRP (prior to 5.003_05) so some extension might depend on it.*/#if defined(USE_BSD_SETPGRP) || defined(USE_BSD_GETPGRP)# ifndef USE_BSDPGRP# define USE_BSDPGRP# endif#endif/* HP-UX 10.X CMA (Common Multithreaded Architecure) insists that pthread.h must be included before all other header files.*/#if defined(USE_ITHREADS) && defined(PTHREAD_H_FIRST) && defined(I_PTHREAD)# include <pthread.h>#endif#ifndef _TYPES_ /* If types.h defines this it's easy. */# ifndef major /* Does everyone's types.h define this? */# include <sys/types.h># endif#endif#ifdef __cplusplus# ifndef I_STDARG# define I_STDARG 1# endif#endif#ifdef I_STDARG# include <stdarg.h>#else# ifdef I_VARARGS# include <varargs.h># endif#endif#ifdef USE_NEXT_CTYPE#if NX_CURRENT_COMPILER_RELEASE >= 500# include <bsd/ctypes.h>#else# if NX_CURRENT_COMPILER_RELEASE >= 400# include <objc/NXCType.h># else /* NX_CURRENT_COMPILER_RELEASE < 400 */# include <appkit/NXCType.h># endif /* NX_CURRENT_COMPILER_RELEASE >= 400 */#endif /* NX_CURRENT_COMPILER_RELEASE >= 500 */#else /* !USE_NEXT_CTYPE */#include <ctype.h>#endif /* USE_NEXT_CTYPE */#ifdef METHOD /* Defined by OSF/1 v3.0 by ctype.h */#undef METHOD#endif#ifdef PERL_MICRO# define NO_LOCALE#endif#ifdef I_LOCALE# include <locale.h>#endif#if !defined(NO_LOCALE) && defined(HAS_SETLOCALE)# define USE_LOCALE# if !defined(NO_LOCALE_COLLATE) && defined(LC_COLLATE) \ && defined(HAS_STRXFRM)# define USE_LOCALE_COLLATE# endif# if !defined(NO_LOCALE_CTYPE) && defined(LC_CTYPE)# define USE_LOCALE_CTYPE# endif# if !defined(NO_LOCALE_NUMERIC) && defined(LC_NUMERIC)# define USE_LOCALE_NUMERIC# endif#endif /* !NO_LOCALE && HAS_SETLOCALE */#include <setjmp.h>#ifdef I_SYS_PARAM# ifdef PARAM_NEEDS_TYPES# include <sys/types.h># endif# include <sys/param.h>#endif/* Use all the "standard" definitions? */#if defined(STANDARD_C) && defined(I_STDLIB)# include <stdlib.h>#endif/* If this causes problems, set i_unistd=undef in the hint file. */#ifdef I_UNISTD# include <unistd.h>#endif#ifdef __SYMBIAN32__# undef _SC_ARG_MAX /* Symbian has _SC_ARG_MAX but no sysconf() */#endif#if defined(HAS_SYSCALL) && !defined(HAS_SYSCALL_PROTO) && !defined(PERL_MICRO)EXTERN_C int syscall(int, ...);#endif#if defined(HAS_USLEEP) && !defined(HAS_USLEEP_PROTO) && !defined(PERL_MICRO)EXTERN_C int usleep(unsigned int);#endif/* Funky places that do not have socket stuff. */#if defined(__LIBCATAMOUNT__)# define MYSWAP#endif#ifdef PERL_MICRO /* Last chance to export Perl_my_swap */# define MYSWAP#endif#ifdef PERL_CORE/* macros for correct constant construction */# if INTSIZE >= 2# define U16_CONST(x) ((U16)x##U)# else# define U16_CONST(x) ((U16)x##UL)# endif# if INTSIZE >= 4# define U32_CONST(x) ((U32)x##U)# else# define U32_CONST(x) ((U32)x##UL)# endif# ifdef HAS_QUAD# if INTSIZE >= 8# define U64_CONST(x) ((U64)x##U)# elif LONGSIZE >= 8# define U64_CONST(x) ((U64)x##UL)# elif QUADKIND == QUAD_IS_LONG_LONG# define U64_CONST(x) ((U64)x##ULL)# else /* best guess we can make */# define U64_CONST(x) ((U64)x##UL)# endif# endif/* byte-swapping functions for big-/little-endian conversion */# define _swab_16_(x) ((U16)( \ (((U16)(x) & U16_CONST(0x00ff)) << 8) | \ (((U16)(x) & U16_CONST(0xff00)) >> 8) ))# define _swab_32_(x) ((U32)( \ (((U32)(x) & U32_CONST(0x000000ff)) << 24) | \ (((U32)(x) & U32_CONST(0x0000ff00)) << 8) | \ (((U32)(x) & U32_CONST(0x00ff0000)) >> 8) | \ (((U32)(x) & U32_CONST(0xff000000)) >> 24) ))# ifdef HAS_QUAD# define _swab_64_(x) ((U64)( \ (((U64)(x) & U64_CONST(0x00000000000000ff)) << 56) | \ (((U64)(x) & U64_CONST(0x000000000000ff00)) << 40) | \ (((U64)(x) & U64_CONST(0x0000000000ff0000)) << 24) | \ (((U64)(x) & U64_CONST(0x00000000ff000000)) << 8) | \ (((U64)(x) & U64_CONST(0x000000ff00000000)) >> 8) | \ (((U64)(x) & U64_CONST(0x0000ff0000000000)) >> 24) | \ (((U64)(x) & U64_CONST(0x00ff000000000000)) >> 40) | \ (((U64)(x) & U64_CONST(0xff00000000000000)) >> 56) ))# endif/*----------------------------------------------------------------------------*/# if BYTEORDER == 0x1234 || BYTEORDER == 0x12345678 /* little-endian *//*----------------------------------------------------------------------------*/# define my_htole16(x) (x)# define my_letoh16(x) (x)# define my_htole32(x) (x)# define my_letoh32(x) (x)# define my_htobe16(x) _swab_16_(x)# define my_betoh16(x) _swab_16_(x)# define my_htobe32(x) _swab_32_(x)# define my_betoh32(x) _swab_32_(x)# ifdef HAS_QUAD# define my_htole64(x) (x)# define my_letoh64(x) (x)# define my_htobe64(x) _swab_64_(x)# define my_betoh64(x) _swab_64_(x)# endif# define my_htoles(x) (x)# define my_letohs(x) (x)# define my_htolei(x) (x)# define my_letohi(x) (x)# define my_htolel(x) (x)# define my_letohl(x) (x)# if SHORTSIZE == 1# define my_htobes(x) (x)# define my_betohs(x) (x)# elif SHORTSIZE == 2# define my_htobes(x) _swab_16_(x)# define my_betohs(x) _swab_16_(x)# elif SHORTSIZE == 4# define my_htobes(x) _swab_32_(x)# define my_betohs(x) _swab_32_(x)# elif SHORTSIZE == 8# define my_htobes(x) _swab_64_(x)# define my_betohs(x) _swab_64_(x)# else# define PERL_NEED_MY_HTOBES# define PERL_NEED_MY_BETOHS# endif# if INTSIZE == 1# define my_htobei(x) (x)# define my_betohi(x) (x)# elif INTSIZE == 2# define my_htobei(x) _swab_16_(x)# define my_betohi(x) _swab_16_(x)# elif INTSIZE == 4# define my_htobei(x) _swab_32_(x)# define my_betohi(x) _swab_32_(x)# elif INTSIZE == 8# define my_htobei(x) _swab_64_(x)# define my_betohi(x) _swab_64_(x)# else# define PERL_NEED_MY_HTOBEI# define PERL_NEED_MY_BETOHI# endif# if LONGSIZE == 1# define my_htobel(x) (x)# define my_betohl(x) (x)# elif LONGSIZE == 2# define my_htobel(x) _swab_16_(x)# define my_betohl(x) _swab_16_(x)# elif LONGSIZE == 4# define my_htobel(x) _swab_32_(x)# define my_betohl(x) _swab_32_(x)# elif LONGSIZE == 8# define my_htobel(x) _swab_64_(x)# define my_betohl(x) _swab_64_(x)# else# define PERL_NEED_MY_HTOBEL# define PERL_NEED_MY_BETOHL# endif# define my_htolen(p,n) NOOP# define my_letohn(p,n) NOOP# define my_htoben(p,n) my_swabn(p,n)# define my_betohn(p,n) my_swabn(p,n)/*----------------------------------------------------------------------------*/# elif BYTEORDER == 0x4321 || BYTEORDER == 0x87654321 /* big-endian *//*----------------------------------------------------------------------------*/# define my_htobe16(x) (x)# define my_betoh16(x) (x)# define my_htobe32(x) (x)# define my_betoh32(x) (x)# define my_htole16(x) _swab_16_(x)# define my_letoh16(x) _swab_16_(x)# define my_htole32(x) _swab_32_(x)# define my_letoh32(x) _swab_32_(x)# ifdef HAS_QUAD# define my_htobe64(x) (x)# define my_betoh64(x) (x)# define my_htole64(x) _swab_64_(x)# define my_letoh64(x) _swab_64_(x)# endif# define my_htobes(x) (x)# define my_betohs(x) (x)# define my_htobei(x) (x)# define my_betohi(x) (x)# define my_htobel(x) (x)# define my_betohl(x) (x)# if SHORTSIZE == 1# define my_htoles(x) (x)# define my_letohs(x) (x)# elif SHORTSIZE == 2# define my_htoles(x) _swab_16_(x)# define my_letohs(x) _swab_16_(x)# elif SHORTSIZE == 4# define my_htoles(x) _swab_32_(x)# define my_letohs(x) _swab_32_(x)# elif SHORTSIZE == 8# define my_htoles(x) _swab_64_(x)# define my_letohs(x) _swab_64_(x)# else# define PERL_NEED_MY_HTOLES# define PERL_NEED_MY_LETOHS# endif# if INTSIZE == 1# define my_htolei(x) (x)# define my_letohi(x) (x)# elif INTSIZE == 2# define my_htolei(x) _swab_16_(x)# define my_letohi(x) _swab_16_(x)# elif INTSIZE == 4# define my_htolei(x) _swab_32_(x)# define my_letohi(x) _swab_32_(x)# elif INTSIZE == 8# define my_htolei(x) _swab_64_(x)# define my_letohi(x) _swab_64_(x)# else# define PERL_NEED_MY_HTOLEI# define PERL_NEED_MY_LETOHI# endif# if LONGSIZE == 1# define my_htolel(x) (x)# define my_letohl(x) (x)# elif LONGSIZE == 2# define my_htolel(x) _swab_16_(x)# define my_letohl(x) _swab_16_(x)# elif LONGSIZE == 4# define my_htolel(x) _swab_32_(x)# define my_letohl(x) _swab_32_(x)# elif LONGSIZE == 8# define my_htolel(x) _swab_64_(x)# define my_letohl(x) _swab_64_(x)# else# define PERL_NEED_MY_HTOLEL# define PERL_NEED_MY_LETOHL# endif# define my_htolen(p,n) my_swabn(p,n)# define my_letohn(p,n) my_swabn(p,n)# define my_htoben(p,n) NOOP# define my_betohn(p,n) NOOP/*----------------------------------------------------------------------------*/# else /* all other byte-orders *//*----------------------------------------------------------------------------*/# define PERL_NEED_MY_HTOLE16# define PERL_NEED_MY_LETOH16# define PERL_NEED_MY_HTOBE16# define PERL_NEED_MY_BETOH16# define PERL_NEED_MY_HTOLE32# define PERL_NEED_MY_LETOH32# define PERL_NEED_MY_HTOBE32# define PERL_NEED_MY_BETOH32# ifdef HAS_QUAD# define PERL_NEED_MY_HTOLE64# define PERL_NEED_MY_LETOH64# define PERL_NEED_MY_HTOBE64# define PERL_NEED_MY_BETOH64# endif# define PERL_NEED_MY_HTOLES# define PERL_NEED_MY_LETOHS# define PERL_NEED_MY_HTOBES# define PERL_NEED_MY_BETOHS# define PERL_NEED_MY_HTOLEI# define PERL_NEED_MY_LETOHI# define PERL_NEED_MY_HTOBEI# define PERL_NEED_MY_BETOHI# define PERL_NEED_MY_HTOLEL# define PERL_NEED_MY_LETOHL# define PERL_NEED_MY_HTOBEL# define PERL_NEED_MY_BETOHL/*----------------------------------------------------------------------------*/# endif /* end of byte-order macros *//*----------------------------------------------------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -