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

📄 ppport.h

📁 PostgreSQL 8.1.4的源码 适用于Linux下的开源数据库系统
💻 H
📖 第 1 页 / 共 2 页
字号:
/* ppport.h -- Perl/Pollution/Portability Version 2.011 * * Automatically Created by Devel::PPPort on Sun Jul  4 09:11:52 2004 * * Do NOT edit this file directly! -- Edit PPPort.pm instead. * * Version 2.x, Copyright (C) 2001, Paul Marquess. * Version 1.x, Copyright (C) 1999, Kenneth Albanowski. * This code may be used and distributed under the same license as any * version of Perl. * * This version of ppport.h is designed to support operation with Perl * installations back to 5.004, and has been tested up to 5.8.1. * * If this version of ppport.h is failing during the compilation of this * module, please check if a newer version of Devel::PPPort is available * on CPAN before sending a bug report. * * If you are using the latest version of Devel::PPPort and it is failing * during compilation of this module, please send a report to perlbug@perl.com * * Include all following information: * *	1. The complete output from running "perl -V" * *	2. This file. * *	3. The name & version of the module you were trying to build. * *	4. A full log of the build that failed. * *	5. Any other information that you think could be relevant. * * * For the latest version of this code, please retreive the Devel::PPPort * module from CPAN. * *//* * In order for a Perl extension module to be as portable as possible * across differing versions of Perl itself, certain steps need to be taken. * Including this header is the first major one, then using dTHR is all the * appropriate places and using a PL_ prefix to refer to global Perl * variables is the second. * *//* If you use one of a few functions that were not present in earlier * versions of Perl, please add a define before the inclusion of ppport.h * for a static include, or use the GLOBAL request in a single module to * produce a global definition that can be referenced from the other * modules. * * Function:			Static define:			 Extern define: * newCONSTSUB()		NEED_newCONSTSUB		 NEED_newCONSTSUB_GLOBAL * *//* To verify whether ppport.h is needed for your module, and whether any * special defines should be used, ppport.h can be run through Perl to check * your source code. Simply say: * *	perl -x ppport.h *.c *.h *.xs foo/bar*.c [etc] * * The result will be a list of patches suggesting changes that should at * least be acceptable, if not necessarily the most efficient solution, or a * fix for all possible problems. It won't catch where dTHR is needed, and * doesn't attempt to account for global macro or function definitions, * nested includes, typemaps, etc. * * In order to test for the need of dTHR, please try your module under a * recent version of Perl that has threading compiled-in. * *//*#!/usr/bin/perl@ARGV = ("*.xs") if !@ARGV;%badmacros = %funcs = %macros = (); $replace = 0;foreach (<DATA>) {	$funcs{$1} = 1 if /Provide:\s+(\S+)/;	$macros{$1} = 1 if /^#\s*define\s+([a-zA-Z0-9_]+)/;	$replace = $1 if /Replace:\s+(\d+)/;	$badmacros{$2}=$1 if $replace and /^#\s*define\s+([a-zA-Z0-9_]+).*?\s+([a-zA-Z0-9_]+)/;	$badmacros{$1}=$2 if /Replace (\S+) with (\S+)/;}foreach $filename (map(glob($_),@ARGV)) {	unless (open(IN, "<$filename")) {		warn "Unable to read from $file: $!\n";		next;	}	print "Scanning $filename...\n";	$c = ""; while (<IN>) { $c .= $_; } close(IN);	$need_include = 0; %add_func = (); $changes = 0;	$has_include = ($c =~ /#.*include.*ppport/m);	foreach $func (keys %funcs) {		if ($c =~ /#.*define.*\bNEED_$func(_GLOBAL)?\b/m) {			if ($c !~ /\b$func\b/m) {				print "If $func isn't needed, you don't need to request it.\n" if				$changes += ($c =~ s/^.*#.*define.*\bNEED_$func\b.*\n//m);			} else {				print "Uses $func\n";				$need_include = 1;			}		} else {			if ($c =~ /\b$func\b/m) {				$add_func{$func} =1 ;				print "Uses $func\n";				$need_include = 1;			}		}	}	if (not $need_include) {		foreach $macro (keys %macros) {			if ($c =~ /\b$macro\b/m) {				print "Uses $macro\n";				$need_include = 1;			}		}	}	foreach $badmacro (keys %badmacros) {		if ($c =~ /\b$badmacro\b/m) {			$changes += ($c =~ s/\b$badmacro\b/$badmacros{$badmacro}/gm);			print "Uses $badmacros{$badmacro} (instead of $badmacro)\n";			$need_include = 1;		}	}	if (scalar(keys %add_func) or $need_include != $has_include) {		if (!$has_include) {			$inc = join('',map("#define NEED_$_\n", sort keys %add_func)).				   "#include \"ppport.h\"\n";			$c = "$inc$c" unless $c =~ s/#.*include.*XSUB.*\n/$&$inc/m;		} elsif (keys %add_func) {			$inc = join('',map("#define NEED_$_\n", sort keys %add_func));			$c = "$inc$c" unless $c =~ s/^.*#.*include.*ppport.*$/$inc$&/m;		}		if (!$need_include) {			print "Doesn't seem to need ppport.h.\n";			$c =~ s/^.*#.*include.*ppport.*\n//m;		}		$changes++;	}	if ($changes) {		open(OUT,">/tmp/ppport.h.$$");		print OUT $c;		close(OUT);		open(DIFF, "diff -u $filename /tmp/ppport.h.$$|");		while (<DIFF>) { s!/tmp/ppport\.h\.$$!$filename.patched!; print STDOUT; }		close(DIFF);		unlink("/tmp/ppport.h.$$");	} else {		print "Looks OK\n";	}}__DATA__*/#ifndef _P_P_PORTABILITY_H_#define _P_P_PORTABILITY_H_#ifndef PERL_REVISION#ifndef __PATCHLEVEL_H_INCLUDED__#define PERL_PATCHLEVEL_H_IMPLICIT#include <patchlevel.h>#endif#if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))#include <could_not_find_Perl_patchlevel.h>#endif#ifndef PERL_REVISION#define PERL_REVISION	 (5) /* Replace: 1 */#define PERL_VERSION PATCHLEVEL#define PERL_SUBVERSION  SUBVERSION /* Replace PERL_PATCHLEVEL with PERL_VERSION */ /* Replace: 0 */#endif#endif#define PERL_BCDVERSION ((PERL_REVISION * 0x1000000L) + (PERL_VERSION * 0x1000L) + PERL_SUBVERSION)/* It is very unlikely that anyone will try to use this with Perl 6   (or greater), but who knows. */#if PERL_REVISION != 5#error ppport.h only works with Perl version 5#endif   /* PERL_REVISION != 5 */#ifndef ERRSV#define ERRSV perl_get_sv("@",FALSE)#endif#if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5))/* Replace: 1 */#define PL_Sv		 Sv#define PL_compiling compiling#define PL_copline	 copline#define PL_curcop	 curcop#define PL_curstash  curstash#define PL_defgv	 defgv#define PL_dirty	 dirty#define PL_dowarn	 dowarn#define PL_hints	 hints#define PL_na		 na#define PL_perldb	 perldb#define PL_rsfp_filters  rsfp_filters#define PL_rsfpv	 rsfp#define PL_stdingv	 stdingv#define PL_sv_no	 sv_no#define PL_sv_undef  sv_undef#define PL_sv_yes	 sv_yes/* Replace: 0 */#endif#ifdef HASATTRIBUTE#if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER)#define PERL_UNUSED_DECL#else#define PERL_UNUSED_DECL __attribute__((unused))#endif#else#define PERL_UNUSED_DECL#endif#ifndef dNOOP#define NOOP (void)0#define dNOOP extern int Perl___notused PERL_UNUSED_DECL#endif#ifndef dTHR#define dTHR		  dNOOP#endif#ifndef dTHX#define dTHX		  dNOOP#define dTHXa(x)	  dNOOP#define dTHXoa(x)	  dNOOP#endif#ifndef pTHX#define pTHX	void#define pTHX_#define aTHX#define aTHX_#endif#ifndef dAX#define dAX I32 ax = MARK - PL_stack_base + 1#endif#ifndef dITEMS#define dITEMS I32 items = SP - MARK#endif/* IV could also be a quad (say, a long long), but Perls * capable of those should have IVSIZE already. */#if !defined(IVSIZE) && defined(LONGSIZE)#define IVSIZE LONGSIZE#endif#ifndef IVSIZE#define IVSIZE 4				/* A bold guess, but the best we can make. */#endif#ifndef UVSIZE#define UVSIZE IVSIZE#endif#ifndef NVTYPE#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)#define NVTYPE long double#else#define NVTYPE double#endiftypedef NVTYPE NV;#endif#ifndef INT2PTR#if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)#define PTRV				  UV#define INT2PTR(any,d)		  (any)(d)#else#if PTRSIZE == LONGSIZE#define PTRV				unsigned long#else#define PTRV				unsigned#endif#define INT2PTR(any,d)		  (any)(PTRV)(d)#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)#if PTRSIZE == LONGSIZE#define PTR2ul(p)	  (unsigned long)(p)#else#define PTR2ul(p)	  INT2PTR(unsigned long,p)#endif#endif   /* !INT2PTR */#ifndef boolSV#define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no)#endif#ifndef gv_stashpvn#define gv_stashpvn(str,len,flags) gv_stashpv(str,flags)#endif#ifndef newSVpvn#define newSVpvn(data,len) ((len) ? newSVpv ((data), (len)) : newSVpv ("", 0))#endif#ifndef newRV_inc/* Replace: 1 */#define newRV_inc(sv) newRV(sv)/* Replace: 0 */#endif/* DEFSV appears first in 5.004_56 */#ifndef DEFSV#define DEFSV GvSV(PL_defgv)#endif#ifndef SAVE_DEFSV#define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv))#endif#ifndef newRV_noinc#ifdef __GNUC__#define newRV_noinc(sv)				  \	  ({								  \		  SV *nsv = (SV*)newRV(sv);		  \		  SvREFCNT_dec(sv);				  \		  nsv;							  \	  })#else#if defined(USE_THREADS)static SV  *newRV_noinc(SV *sv){	SV		   *nsv = (SV *) newRV(sv);	SvREFCNT_dec(sv);	return nsv;}#else#define newRV_noinc(sv)    \		(PL_Sv=(SV*)newRV(sv), SvREFCNT_dec(sv), (SV*)PL_Sv)#endif#endif#endif/* Provide: newCONSTSUB *//* newCONSTSUB from IO.xs is in the core starting with 5.004_63 */#if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION < 63))#if defined(NEED_newCONSTSUB)static#elseextern void newCONSTSUB(HV *stash, char *name, SV *sv);#endif#if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL)voidnewCONSTSUB(stash, name, sv)HV		   *stash;char	   *name;SV		   *sv;{	U32			oldhints = PL_hints;	HV		   *old_cop_stash = PL_curcop->cop_stash;	HV		   *old_curstash = PL_curstash;	line_t		oldline = PL_curcop->cop_line;	PL_curcop->cop_line = PL_copline;	PL_hints &= ~HINT_BLOCK_SCOPE;	if (stash)		PL_curstash = PL_curcop->cop_stash = stash;	newSUB(#if (PERL_VERSION < 3) || ((PERL_VERSION == 3) && (PERL_SUBVERSION < 22))	/* before 5.003_22 */		   start_subparse(),#else#if (PERL_VERSION == 3) && (PERL_SUBVERSION == 22)	/* 5.003_22 */		   start_subparse(0),#else	/* 5.003_23  onwards */		   start_subparse(FALSE, 0),#endif#endif		   newSVOP(OP_CONST, 0, newSVpv(name, 0)),		   newSVOP(OP_CONST, 0, &PL_sv_no),		/* SvPV(&PL_sv_no) == "" --												 * GMB */

⌨️ 快捷键说明

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