⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 perl.h

📁 MSYS在windows下模拟了一个类unix的终端
💻 H
📖 第 1 页 / 共 5 页
字号:
/*    perl.h * *    Copyright (c) 1987-2001, Larry Wall * *    You may distribute under the terms of either the GNU General Public *    License or the Artistic License, as specified in the README file. * */#ifndef H_PERL#define H_PERL 1#ifdef PERL_FOR_X2P/* * This file is being used for x2p stuff.  * Above symbol is defined via -D in 'x2p/Makefile.SH' * Decouple x2p stuff from some of perls more extreme eccentricities.  */#undef MULTIPLICITY#undef USE_STDIO#define USE_STDIO#endif /* PERL_FOR_X2P */#define VOIDUSED 1#include "config.h"#if defined(USE_ITHREADS) && defined(USE_5005THREADS)#  include "error: USE_ITHREADS and USE_5005THREADS are incompatible"#endif/* XXX This next guard can disappear if the sources are revised   to use USE_5005THREADS throughout. -- A.D  1/6/2000*/#if defined(USE_ITHREADS) && defined(USE_THREADS)#  include "error: USE_ITHREADS and USE_THREADS are incompatible"#endif/* See L<perlguts/"The Perl API"> for detailed notes on * PERL_IMPLICIT_CONTEXT and PERL_IMPLICIT_SYS */#ifdef USE_ITHREADS#  if !defined(MULTIPLICITY) && !defined(PERL_OBJECT)#    define MULTIPLICITY#  endif#endif#ifdef USE_THREADS#  ifndef PERL_IMPLICIT_CONTEXT#    define PERL_IMPLICIT_CONTEXT#  endif#endif#if defined(MULTIPLICITY)#  ifndef PERL_IMPLICIT_CONTEXT#    define PERL_IMPLICIT_CONTEXT#  endif#endif#ifdef PERL_CAPI#  undef PERL_OBJECT#  ifndef MULTIPLICITY#    define MULTIPLICITY#  endif#  ifndef PERL_IMPLICIT_CONTEXT#    define PERL_IMPLICIT_CONTEXT#  endif#  ifndef PERL_IMPLICIT_SYS#    define PERL_IMPLICIT_SYS#  endif#endif#ifdef PERL_OBJECT#  ifndef PERL_IMPLICIT_CONTEXT#    define PERL_IMPLICIT_CONTEXT#  endif#  ifndef PERL_IMPLICIT_SYS#    define PERL_IMPLICIT_SYS#  endif#endif#ifdef PERL_OBJECT/* PERL_OBJECT explained  - DickH and DougL @ ActiveState.comDefining PERL_OBJECT turns on creation of a C++ object thatcontains all writable core perl global variables and functions.Stated another way, all necessary global variables and functionsare members of a big C++ object. This object's class is CPerlObj.This allows a Perl Host to have multiple, independent perlinterpreters in the same process space. This is very important onWin32 systems as the overhead of process creation is quite high --this could be even higher than the script compile and execute timefor small scripts.The perl executable implementation on Win32 is composed of perl.exe(the Perl Host) and perlX.dll. (the Perl Core). This allows thesame Perl Core to easily be embedded in other applications that usethe perl interpreter.+-----------+| Perl Host |+-----------+      ^      |      v+-----------+   +-----------+| Perl Core |<->| Extension |+-----------+   +-----------+ ...Defining PERL_OBJECT has the following effects:PERL CORE1. CPerlObj is defined (this is the PERL_OBJECT)2. all static functions that needed to access either globalvariables or functions needed are made member functions3. all writable static variables are made member variables4. all global variables and functions are defined as:	#define var CPerlObj::PL_var	#define func CPerlObj::Perl_func	* these are in embed.hThis necessitated renaming some local variables and functions thathad the same name as a global variable or function. This wasprobably a _good_ thing anyway.EXTENSIONS1. Access to global variables and perl functions is through apointer to the PERL_OBJECT. This pointer type is CPerlObj*. This ismade transparent to extension developers by the following macros:	#define var pPerl->PL_var	#define func pPerl->Perl_func	* these are done in objXSUB.hThis requires that the extension be compiled as C++, which meansthat the code must be ANSI C and not K&R C. For K&R extensions,please see the C API notes located in Win32/GenCAPI.pl. This scriptcreates a perlCAPI.lib that provides a K & R compatible C interfaceto the PERL_OBJECT.2. Local variables and functions cannot have the same name as perl'svariables or functions since the macros will redefine these. Look forthis if you get some strange error message and it does not look likethe code that you had written. This often happens with variables thatare local to a function.PERL HOST1. The perl host is linked with perlX.lib to get perl_alloc. Thisfunction will return a pointer to CPerlObj (the PERL_OBJECT). Ittakes pointers to the various PerlXXX_YYY interfaces (see iperlsys.hfor more information on this).2. The perl host calls the same functions as normally would becalled in setting up and running a perl script, except that thefunctions are now member functions of the PERL_OBJECT.*/class CPerlObj;#define STATIC#define CPERLscope(x)		CPerlObj::x#define CALL_FPTR(fptr)		(aTHXo->*fptr)#define pTHXo			CPerlObj *pPerl#define pTHXo_			pTHXo,#define aTHXo			this#define aTHXo_			this,#define PERL_OBJECT_THIS	aTHXo#define PERL_OBJECT_THIS_	aTHXo_#define dTHXoa(a)		pTHXo = (CPerlObj*)a#define dTHXo			pTHXo = PERL_GET_THX#define pTHXx		void#define pTHXx_#define aTHXx#define aTHXx_#else /* !PERL_OBJECT */#ifdef PERL_IMPLICIT_CONTEXT#  ifdef USE_THREADSstruct perl_thread;#    define pTHX	register struct perl_thread *thr#    define aTHX	thr#    define dTHR	dNOOP /* only backward compatibility */#    define dTHXa(a)	pTHX = (struct perl_thread*)a#  else#    ifndef MULTIPLICITY#      define MULTIPLICITY#    endif#    define pTHX	register PerlInterpreter *my_perl#    define aTHX	my_perl#    define dTHXa(a)	pTHX = (PerlInterpreter*)a#  endif#  define dTHX		pTHX = PERL_GET_THX#  define pTHX_		pTHX,#  define aTHX_		aTHX,#  define pTHX_1	2	#  define pTHX_2	3#  define pTHX_3	4#  define pTHX_4	5#endif#define STATIC static#define CPERLscope(x) x#define CPERLarg void#define CPERLarg_#define _CPERLarg#define PERL_OBJECT_THIS#define _PERL_OBJECT_THIS#define PERL_OBJECT_THIS_#define CALL_FPTR(fptr) (*fptr)#endif /* PERL_OBJECT */#define CALLRUNOPS  CALL_FPTR(PL_runops)#define CALLREGCOMP CALL_FPTR(PL_regcompp)#define CALLREGEXEC CALL_FPTR(PL_regexecp)#define CALLREG_INTUIT_START CALL_FPTR(PL_regint_start)#define CALLREG_INTUIT_STRING CALL_FPTR(PL_regint_string)#define CALLREGFREE CALL_FPTR(PL_regfree)#ifdef PERL_FLEXIBLE_EXCEPTIONS#  define CALLPROTECT CALL_FPTR(PL_protect)#endif#define NOOP (void)0#define dNOOP extern int Perl___notused#ifndef pTHX#  define pTHX		void#  define pTHX_#  define aTHX#  define aTHX_#  define dTHXa(a)	dNOOP#  define dTHX		dNOOP#  define pTHX_1	1	#  define pTHX_2	2#  define pTHX_3	3#  define pTHX_4	4#endif#ifndef pTHXo#  define pTHXo		pTHX#  define pTHXo_	pTHX_#  define aTHXo		aTHX#  define aTHXo_	aTHX_#  define dTHXo		dTHX#  define dTHXoa(x)	dTHXa(x)#endif#ifndef pTHXx#  define pTHXx		register PerlInterpreter *my_perl#  define pTHXx_	pTHXx,#  define aTHXx		my_perl#  define aTHXx_	aTHXx,#  define dTHXx		dTHX#endif#undef START_EXTERN_C#undef END_EXTERN_C#undef EXTERN_C#ifdef __cplusplus#  define START_EXTERN_C extern "C" {#  define END_EXTERN_C }#  define EXTERN_C extern "C"#else#  define START_EXTERN_C #  define END_EXTERN_C #  define EXTERN_C extern#endif#ifdef OP_IN_REGISTER#  ifdef __GNUC__#    define stringify_immed(s) #s#    define stringify(s) stringify_immed(s)register struct op *Perl_op asm(stringify(OP_IN_REGISTER));#  endif#endif/* * STMT_START { statements; } STMT_END; * can be used as a single statement, as in * if (x) STMT_START { ... } STMT_END; else ... * * Trying to select a version that gives no warnings... */#if !(defined(STMT_START) && defined(STMT_END))# if defined(__GNUC__) && !defined(__STRICT_ANSI__) && !defined(__cplusplus)#   define STMT_START	(void)(	/* gcc supports ``({ STATEMENTS; })'' */#   define STMT_END	)# else   /* Now which other defined()s do we need here ??? */#  if (VOIDFLAGS) && (defined(sun) || defined(__sun__))#   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)/* * SOFT_CAST can be used for args to prototyped functions to retain some * type checking; it only casts if the compiler does not know prototypes. */#if defined(CAN_PROTOTYPE) && defined(DEBUGGING_COMPILE)#define SOFT_CAST(type)	#else#define SOFT_CAST(type)	(type)#endif#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)#define DOSISH 1#endif#if defined(__STDC__) || defined(vax11c) || defined(_AIX) || defined(__stdc__) || defined(__cplusplus) || defined( EPOC)# define STANDARD_C 1#endif#if defined(__cplusplus) || defined(WIN32) || defined(__sgi) || defined(OS2) || defined(__DGUX) || defined( EPOC) || defined(__QNX__)# 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(Nullch, 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_THREADS) || 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 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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -