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

📄 basic_functions.c

📁 php-4.4.7学习linux时下载的源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
/*   +----------------------------------------------------------------------+   | PHP Version 4                                                        |   +----------------------------------------------------------------------+   | Copyright (c) 1997-2007 The PHP Group                                |   +----------------------------------------------------------------------+   | This source file is subject to version 3.01 of the PHP license,      |   | that is bundled with this package in the file LICENSE, and is        |   | available through the world-wide-web at the following url:           |   | http://www.php.net/license/3_01.txt                                  |   | If you did not receive a copy of the PHP license and are unable to   |   | obtain it through the world-wide-web, please send a note to          |   | license@php.net so we can mail you a copy immediately.               |   +----------------------------------------------------------------------+   | Authors: Andi Gutmans <andi@zend.com>                                |   |          Zeev Suraski <zeev@zend.com>                                |   +----------------------------------------------------------------------+ *//* $Id: basic_functions.c,v 1.543.2.51.2.12 2007/01/01 09:46:47 sebastian Exp $ */#include "php.h"#include "php_streams.h"#include "php_main.h"#include "php_globals.h"#include "php_ini.h"#include "internal_functions_registry.h"#include "php_standard.h"#include "php_math.h"#include "php_incomplete_class.h"#include "ext/standard/info.h"#include "ext/session/php_session.h"#include "zend_operators.h"#ifdef PHP_WIN32#include "win32/php_win32_globals.h"#endif#include <stdarg.h>#include <stdlib.h>#include <math.h>#include <time.h>#include <stdio.h>#include <netdb.h>#if HAVE_ARPA_INET_H# include <arpa/inet.h>#endif#if HAVE_UNISTD_H# include <unistd.h>#endif#if HAVE_STRING_H# include <string.h>#else# include <strings.h>#endif#if HAVE_LOCALE_H# include <locale.h>#endif#if HAVE_SYS_MMAN_H# include <sys/mman.h>#endif#ifdef HARTMUT_0#include <getopt.h>#endif#include "safe_mode.h"#ifdef PHP_WIN32# include "win32/unistd.h"#endif#ifndef INADDR_NONE#define INADDR_NONE ((unsigned long int) -1)#endif#include "zend_globals.h"#include "php_globals.h"#include "SAPI.h"#include "php_ticks.h"#ifdef ZTSint basic_globals_id;#elsephp_basic_globals basic_globals;#endif#include "php_fopen_wrappers.h"static unsigned char first_and_second__args_force_ref[] = { 2, BYREF_FORCE, BYREF_FORCE };static unsigned char second_and_third_args_force_ref[] = { 3, BYREF_NONE, BYREF_FORCE, BYREF_FORCE };static unsigned char second_args_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };static unsigned char third_and_fourth_args_force_ref[] = { 4, BYREF_NONE, BYREF_NONE, BYREF_FORCE, BYREF_FORCE };static unsigned char third_and_rest_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE_REST };static unsigned char first_through_third_args_force_ref[] ={3, BYREF_FORCE, BYREF_FORCE, BYREF_FORCE};typedef struct _php_shutdown_function_entry {	zval **arguments;	int arg_count;} php_shutdown_function_entry;typedef struct _user_tick_function_entry {	zval **arguments;	int arg_count;	int calling;} user_tick_function_entry;/* some prototypes for local functions */static void user_shutdown_function_dtor(php_shutdown_function_entry *shutdown_function_entry);static void user_tick_function_dtor(user_tick_function_entry *tick_function_entry);/* Demo code. Enable only if you need this. */#define ENABLE_TEST_CLASS 0#if ENABLE_TEST_CLASSvoid test_class_startup(void);pval test_class_get_property(zend_property_reference *property_reference);int test_class_set_property(zend_property_reference *property_reference, pval *value);void test_class_call_function(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);pval test_class_get_property(zend_property_reference *property_reference){	pval result;	zend_overloaded_element *overloaded_property;	zend_llist_element *element;	printf("Reading a property from a OverloadedTestClass object:\n");	for (element = property_reference->elements_list->head; element; element = element->next) {		overloaded_property = (zend_overloaded_element *) element->data;			switch (Z_TYPE_P(overloaded_property)) {				case OE_IS_ARRAY:				printf("Array offset:  ");				break;			case OE_IS_OBJECT:				printf("Object property:  ");				break;		}			switch (Z_TYPE(overloaded_property->element)) {				case IS_LONG:				printf("%ld (numeric)\n", Z_LVAL(overloaded_property->element));				break;			case IS_STRING:				printf("'%s'\n", Z_STRVAL(overloaded_property->element));				break;		}		pval_destructor(&overloaded_property->element);	}	Z_STRVAL(result) = estrndup("testing", 7);	Z_STRLEN(result) = 7;	Z_TYPE(result) = IS_STRING;	return result;}int test_class_set_property(zend_property_reference *property_reference, pval * value){	zend_overloaded_element *overloaded_property;	zend_llist_element *element;	printf("Writing to a property from a OverloadedTestClass object:\n");	printf("Writing '");	zend_print_variable(value);	printf("'\n");	for (element = property_reference->elements_list->head; element; element = element->next) {		overloaded_property = (zend_overloaded_element *) element->data;				switch (Z_TYPE_P(overloaded_property)) {				case OE_IS_ARRAY:				printf("Array offset:  ");				break;				case OE_IS_OBJECT:				printf("Object property:  ");				break;		}		switch (Z_TYPE(overloaded_property->element)) {			case IS_LONG:				printf("%ld (numeric)\n", Z_LVAL(overloaded_property->element));				break;				case IS_STRING:				printf("'%s'\n", Z_STRVAL(overloaded_property->element));				break;		}		pval_destructor(&overloaded_property->element);	}	return 0;}void test_class_call_function(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference){	zend_overloaded_element *overloaded_property;	zend_llist_element *element;	printf("Invoking a method on OverloadedTestClass object:\n");	for (element = property_reference->elements_list->head; element; element = element->next) {		overloaded_property = (zend_overloaded_element *) element->data;		switch (Z_TYPE_P(overloaded_property)) {				case OE_IS_ARRAY:				printf("Array offset:  ");				break;				case OE_IS_OBJECT:				printf("Object property:  ");				break;				case OE_IS_METHOD:				printf("Overloaded method:  ");		}		switch (Z_TYPE(overloaded_property->element)) {			case IS_LONG:				printf("%ld (numeric)\n", Z_LVAL(overloaded_property->element));				break;				case IS_STRING:				printf("'%s'\n", Z_STRVAL(overloaded_property->element));				break;		}		pval_destructor(&overloaded_property->element);	}	printf("%d arguments\n", ZEND_NUM_ARGS());	RETVAL_STRING("testing", 1);}void test_class_startup(void){	zend_class_entry test_class_entry;	TSRMLS_FETCH();	INIT_OVERLOADED_CLASS_ENTRY(test_class_entry,								"OverloadedTestClass",								NULL, test_class_call_function,								test_class_get_property,								test_class_set_property);	zend_register_internal_class(&test_class_entry TSRMLS_CC);}#endif#undef sprintffunction_entry basic_functions[] = {	PHP_FE(constant,														NULL)	PHP_FE(bin2hex,															NULL)	PHP_FE(sleep,															NULL)	PHP_FE(usleep,															NULL)	PHP_FE(time,															NULL)	PHP_FE(mktime,															NULL)	PHP_FE(gmmktime,														NULL)#if HAVE_STRFTIME	PHP_FE(strftime,														NULL)	PHP_FE(gmstrftime,														NULL)#endif	PHP_FE(strtotime,														NULL)	PHP_FE(date,															NULL)	PHP_FE(gmdate,															NULL)	PHP_FE(getdate,															NULL)	PHP_FE(localtime,														NULL)	PHP_FE(checkdate,														NULL)	PHP_FE(flush,															NULL)	PHP_FE(wordwrap,														NULL)	PHP_FE(htmlspecialchars,												NULL)	PHP_FE(htmlentities,													NULL)	PHP_FE(html_entity_decode,												NULL)	PHP_FE(get_html_translation_table,										NULL)	PHP_FE(sha1,															NULL)	PHP_FE(sha1_file,														NULL)	PHP_NAMED_FE(md5,php_if_md5,											NULL)	PHP_NAMED_FE(md5_file,php_if_md5_file,									NULL)	PHP_NAMED_FE(crc32,php_if_crc32,										NULL)	PHP_FE(iptcparse,														NULL)																PHP_FE(iptcembed,														NULL)	PHP_FE(getimagesize,			second_args_force_ref)	PHP_FE(image_type_to_mime_type,											NULL)	PHP_FE(phpinfo,															NULL)	PHP_FE(phpversion,														NULL)	PHP_FE(phpcredits,														NULL)	PHP_FE(php_logo_guid,													NULL)	PHP_FE(zend_logo_guid,													NULL)	PHP_FE(php_sapi_name,													NULL)	PHP_FE(php_uname,														NULL)	PHP_FE(php_ini_scanned_files,											NULL)	PHP_FE(strnatcmp,														NULL)	PHP_FE(strnatcasecmp,													NULL)	PHP_FE(substr_count,													NULL)	PHP_FE(strspn,															NULL)	PHP_FE(strcspn,															NULL)	PHP_FE(strtok,															NULL)	PHP_FE(strtoupper,														NULL)	PHP_FE(strtolower,														NULL)	PHP_FE(strpos,															NULL)	PHP_FE(strrpos,															NULL)	PHP_FE(strrev,															NULL)	PHP_FE(hebrev,															NULL)	PHP_FE(hebrevc,															NULL)	PHP_FE(nl2br,															NULL)	PHP_FE(basename,														NULL)	PHP_FE(dirname,															NULL)	PHP_FE(pathinfo,														NULL)	PHP_FE(stripslashes,													NULL)	PHP_FE(stripcslashes,													NULL)	PHP_FE(strstr,															NULL)	PHP_FE(stristr,															NULL)	PHP_FE(strrchr,															NULL)	PHP_FE(str_shuffle,															NULL)	PHP_FE(str_word_count,														NULL)#ifdef HAVE_STRCOLL	PHP_FE(strcoll,															NULL)#endif#ifdef HAVE_STRFMON	PHP_FE(money_format,                                                    NULL)#endif	PHP_FE(substr,															NULL)	PHP_FE(substr_replace,													NULL)	PHP_FE(quotemeta,														NULL)	PHP_FE(ucfirst,															NULL)	PHP_FE(ucwords,															NULL)	PHP_FE(strtr,															NULL)	PHP_FE(addslashes,														NULL)	PHP_FE(addcslashes,														NULL)	PHP_FE(rtrim,															NULL)	PHP_FE(str_replace,														NULL)	PHP_FE(str_repeat,														NULL)	PHP_FE(count_chars,														NULL)	PHP_FE(chunk_split,														NULL)	PHP_FE(trim,															NULL)	PHP_FE(ltrim,															NULL)	PHP_FE(strip_tags,														NULL)	PHP_FE(similar_text,			third_arg_force_ref)	PHP_FE(explode,															NULL)	PHP_FE(implode,															NULL)	PHP_FE(setlocale,														NULL)	PHP_FE(localeconv,														NULL)#if HAVE_NL_LANGINFO	PHP_FE(nl_langinfo,														NULL)#endif	PHP_FE(soundex,															NULL)	PHP_FE(levenshtein,														NULL)	PHP_FE(chr,																NULL)	PHP_FE(ord,																NULL)	PHP_FE(parse_str,				second_arg_force_ref)	PHP_FE(str_pad,															NULL)	PHP_FALIAS(chop,				rtrim,									NULL)	PHP_FALIAS(strchr,				strstr,									NULL)	PHP_NAMED_FE(sprintf,			PHP_FN(user_sprintf),					NULL)	PHP_NAMED_FE(printf,			PHP_FN(user_printf),					NULL)	PHP_FE(vprintf,															NULL)	PHP_FE(vsprintf,														NULL)	PHP_FE(sscanf,					third_and_rest_force_ref)	PHP_FE(fscanf,					third_and_rest_force_ref)	PHP_FE(parse_url,														NULL)	PHP_FE(urlencode,														NULL)	PHP_FE(urldecode,														NULL)	PHP_FE(rawurlencode,													NULL)	PHP_FE(rawurldecode,													NULL)#ifdef HAVE_SYMLINK	PHP_FE(readlink,														NULL)	PHP_FE(linkinfo,														NULL)	PHP_FE(symlink,															NULL)	PHP_FE(link,															NULL)#endif	PHP_FE(unlink,															NULL)	PHP_FE(exec,					second_and_third_args_force_ref)	PHP_FE(system,					second_arg_force_ref)	PHP_FE(escapeshellcmd,													NULL)	PHP_FE(escapeshellarg,													NULL)	PHP_FE(passthru,				second_arg_force_ref)	PHP_FE(shell_exec,														NULL)	PHP_FE(proc_open,				third_arg_force_ref)	PHP_FE(proc_close,														NULL)	PHP_FE(rand,															NULL)	PHP_FE(srand,															NULL)	PHP_FE(getrandmax,														NULL)	PHP_FE(mt_rand,															NULL)	PHP_FE(mt_srand,														NULL)	PHP_FE(mt_getrandmax,													NULL)#if HAVE_GETSERVBYNAME	PHP_FE(getservbyname,													NULL)#endif#if HAVE_GETSERVBYPORT	PHP_FE(getservbyport,													NULL)#endif#if HAVE_GETPROTOBYNAME	PHP_FE(getprotobyname,													NULL)#endif#if HAVE_GETPROTOBYNUMBER	PHP_FE(getprotobynumber,												NULL)#endif	PHP_FE(gethostbyaddr,													NULL)	PHP_FE(gethostbyname,													NULL)	PHP_FE(gethostbynamel,													NULL)#if HAVE_RES_SEARCH && !(defined(__BEOS__) || defined(PHP_WIN32) || defined(NETWARE))	PHP_FE(checkdnsrr,														NULL)	PHP_FE(getmxrr,second_and_third_args_force_ref)#endif	PHP_FE(getmyuid,														NULL)	PHP_FE(getmygid,														NULL)	PHP_FE(getmypid,														NULL)	PHP_FE(getmyinode,														NULL)	PHP_FE(getlastmod,														NULL)	PHP_FE(base64_decode,													NULL)	PHP_FE(base64_encode,													NULL)

⌨️ 快捷键说明

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