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

📄 perl_predicate.c

📁 该软件可以方便的把HTML网页解析成一棵Tree
💻 C
字号:
/***	HTML::Tree**	perl_predicate.c****	Copyright (C) 2001  Paul J. Lucas****	This program is free software; you can redistribute it and/or modify**	it under the terms of the GNU General Public License as published by**	the Free Software Foundation; either version 2 of the License, or**	(at your option) any later version.****	This program is distributed in the hope that it will be useful,**	but WITHOUT ANY WARRANTY; without even the implied warranty of**	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the**	GNU General Public License for more details.****	You should have received a copy of the GNU General Public License**	along with this program; if not, write to the Free Software**	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.*/// Perl#define	PERL_NO_GET_CONTEXTextern "C" {#include <XSUB.h>}// local#include "util.h"			/* must go first */#include "blessed.h"#include "managed_ptr.h"#include "perl_predicate.h"#ifndef PJL_NO_NAMESPACESusing namespace HTML_Tree;#endif//*****************************************************************************//// SYNOPSIS//	/* virtual */ bool perl_predicate::operator()( HTML_Node &node ) const//// DESCRIPTION////	Call the Perl predicate function on the given node and return the Perl//	function's value.//// PARAMETERS////	node	The HTML node being tested by the predicate.//// RETURN VALUE////	Returns true only if the predicate is true.//// SEE ALSO////	Sriram Srinivasan. "Advanced Perl Programming," O'Reilly and//	Associates, Inc., Sebastopol, CA, 1997, pp. 352-353.////*****************************************************************************{	dTHX;	dSP;	ENTER;	SAVETMPS;	PUSHMARK( sp );	XPUSHs( blessed( "HTML::Tree", new managed_node( &node ) ) );	PUTBACK;	int const result_count = perl_call_sv( func_ref_, G_SCALAR );	SPAGAIN;	if ( result_count != 1 )		croak(	"HTML::Tree: predicate function "			"didn't return a single scalar value "			"(it returned %d)", result_count		);#ifdef	SvIVx_BROKEN_GCC	I32 const ax = (--SP - PL_stack_base) + 1;	bool const result = SvIV( ST(0) );#else	bool const result = POPi;#endif	PUTBACK;	FREETMPS;	LEAVE;	return result;}

⌨️ 快捷键说明

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