php-src/Zend/zend.h

619 lines
18 KiB
C
Raw Normal View History

1999-04-08 02:10:10 +08:00
/*
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
1999-04-08 02:10:10 +08:00
+----------------------------------------------------------------------+
2001-12-11 23:16:21 +08:00
| This source file is subject to version 2.00 of the Zend license, |
1999-07-16 22:58:16 +08:00
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
2001-12-11 23:16:21 +08:00
| http://www.zend.com/license/2_00.txt. |
1999-07-16 22:58:16 +08:00
| If you did not receive a copy of the Zend license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@zend.com so we can mail you a copy immediately. |
1999-04-08 02:10:10 +08:00
+----------------------------------------------------------------------+
| Authors: Andi Gutmans <andi@zend.com> |
| Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
2001-12-11 17:17:38 +08:00
/* $Id$ */
1999-07-16 22:58:16 +08:00
#ifndef ZEND_H
#define ZEND_H
1999-04-08 02:10:10 +08:00
2004-07-14 03:56:49 +08:00
#define ZEND_VERSION "2.0.1-dev"
1999-04-08 02:10:10 +08:00
#define ZEND_ENGINE_2
#ifdef __cplusplus
#define BEGIN_EXTERN_C() extern "C" {
#define END_EXTERN_C() }
#else
#define BEGIN_EXTERN_C()
#define END_EXTERN_C()
#endif
1999-04-08 02:10:10 +08:00
#include <stdio.h>
/*
* general definitions
*/
2000-02-11 23:59:30 +08:00
#ifdef ZEND_WIN32
# include "zend_config.w32.h"
2001-01-03 16:35:23 +08:00
# define ZEND_PATHS_SEPARATOR ';'
2002-05-30 16:52:21 +08:00
#elif defined(NETWARE)
# include "zend_config.nw.h"
# include "acconfig.h"
# define ZEND_PATHS_SEPARATOR ';'
2001-11-03 21:35:14 +08:00
#elif defined(__riscos__)
# include "zend_config.h"
# define ZEND_PATHS_SEPARATOR ';'
1999-04-08 02:10:10 +08:00
#else
# include "zend_config.h"
2001-01-03 16:35:23 +08:00
# define ZEND_PATHS_SEPARATOR ':'
#endif
#ifdef ZEND_WIN32
/* Only use this macro if you know for sure that all of the switches values
are covered by its case statements */
#define EMPTY_SWITCH_DEFAULT_CASE() \
default: \
__assume(0); \
break;
#else
#define EMPTY_SWITCH_DEFAULT_CASE()
#endif
/* all HAVE_XXX test have to be after the include of zend_config above */
#ifdef HAVE_UNIX_H
# include <unix.h>
#endif
#ifdef HAVE_STDARG_H
# include <stdarg.h>
1999-04-08 02:10:10 +08:00
#endif
#ifdef HAVE_DLFCN_H
# include <dlfcn.h>
#endif
#if HAVE_MACH_O_DYLD_H
#include <mach-o/dyld.h>
/* MH_BUNDLE loading functions for Mac OS X / Darwin */
void *zend_mh_bundle_load (char* bundle_path);
int zend_mh_bundle_unload (void *bundle_handle);
void *zend_mh_bundle_symbol(void *bundle_handle, const char *symbol_name);
const char *zend_mh_bundle_error(void);
#endif /* HAVE_MACH_O_DYLD_H */
#if defined(HAVE_LIBDL) && !defined(HAVE_MACH_O_DYLD_H)
2000-03-25 23:40:08 +08:00
# ifndef RTLD_LAZY
# define RTLD_LAZY 1 /* Solaris 1, FreeBSD's (2.1.7.1 and older) */
# endif
# ifndef RTLD_GLOBAL
# define RTLD_GLOBAL 0
# endif
# if defined(RTLD_GROUP) && defined(RTLD_WORLD) && defined(RTLD_PARENT)
# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_GROUP | RTLD_WORLD | RTLD_PARENT)
# else
# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL)
# endif
2000-01-14 04:34:45 +08:00
# define DL_UNLOAD dlclose
# if defined(DLSYM_NEEDS_UNDERSCORE)
2002-08-13 23:14:45 +08:00
# define DL_FETCH_SYMBOL(h,s) dlsym((h), "_" s)
# else
# define DL_FETCH_SYMBOL dlsym
# endif
2002-04-08 01:12:38 +08:00
# define DL_ERROR dlerror
# define DL_HANDLE void *
# define ZEND_EXTENSIONS_SUPPORT 1
#elif defined(HAVE_MACH_O_DYLD_H)
# define DL_LOAD(libname) zend_mh_bundle_load(libname)
# define DL_UNLOAD(handle) zend_mh_bundle_unload(handle)
# define DL_FETCH_SYMBOL(h,s) zend_mh_bundle_symbol(h,s)
2002-04-08 01:12:38 +08:00
# define DL_ERROR zend_mh_bundle_error
2000-01-14 04:34:45 +08:00
# define DL_HANDLE void *
# define ZEND_EXTENSIONS_SUPPORT 1
2000-02-11 23:59:30 +08:00
#elif defined(ZEND_WIN32)
2000-01-14 04:34:45 +08:00
# define DL_LOAD(libname) LoadLibrary(libname)
# define DL_FETCH_SYMBOL GetProcAddress
# define DL_UNLOAD FreeLibrary
# define DL_HANDLE HMODULE
# define ZEND_EXTENSIONS_SUPPORT 1
#else
2000-01-14 04:34:45 +08:00
# define DL_HANDLE void *
# define ZEND_EXTENSIONS_SUPPORT 0
#endif
2002-11-12 00:32:57 +08:00
#if HAVE_ALLOCA_H && !defined(_ALLOCA_H)
# include <alloca.h>
#endif
2001-12-11 17:17:38 +08:00
/* AIX requires this to be the first thing in the file. */
#ifndef __GNUC__
2002-11-12 00:32:57 +08:00
# ifndef HAVE_ALLOCA_H
2001-12-11 17:17:38 +08:00
# ifdef _AIX
#pragma alloca
2001-12-11 17:17:38 +08:00
# else
# ifndef alloca /* predefined by HP cc +Olibcalls */
char *alloca ();
# endif
# endif
# endif
#endif
/* GCC x.y.z supplies __GNUC__ = x and __GNUC_MINOR__ = y */
#ifdef __GNUC__
# define ZEND_GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
#else
# define ZEND_GCC_VERSION 0
#endif
#if ZEND_GCC_VERSION >= 2096
# define ZEND_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
#else
# define ZEND_ATTRIBUTE_MALLOC
#endif
#if ZEND_GCC_VERSION >= 2007
# define ZEND_ATTRIBUTE_FORMAT(type, idx, first) __attribute__ ((format(type, idx, first)))
#else
# define ZEND_ATTRIBUTE_FORMAT(type, idx, first)
#endif
#if ZEND_GCC_VERSION >= 3001
# define ZEND_ATTRIBUTE_PTR_FORMAT(type, idx, first) __attribute__ ((format(type, idx, first)))
#else
# define ZEND_ATTRIBUTE_PTR_FORMAT(type, idx, first)
#endif
#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(ZEND_WIN32)) && !(defined(ZTS) && defined(NETWARE)) && !(defined(ZTS) && defined(HPUX)) && !defined(__darwin__) && !defined(__APPLE__)
# define do_alloca(p) alloca(p)
# define free_alloca(p)
#else
# define do_alloca(p) emalloc(p)
# define free_alloca(p) efree(p)
#endif
1999-08-29 05:43:24 +08:00
#if ZEND_DEBUG
1999-08-28 18:18:54 +08:00
#define ZEND_FILE_LINE_D char *__zend_filename, uint __zend_lineno
#define ZEND_FILE_LINE_DC , ZEND_FILE_LINE_D
#define ZEND_FILE_LINE_ORIG_D char *__zend_orig_filename, uint __zend_orig_lineno
#define ZEND_FILE_LINE_ORIG_DC , ZEND_FILE_LINE_ORIG_D
#define ZEND_FILE_LINE_RELAY_C __zend_filename, __zend_lineno
#define ZEND_FILE_LINE_RELAY_CC , ZEND_FILE_LINE_RELAY_C
#define ZEND_FILE_LINE_C __FILE__, __LINE__
#define ZEND_FILE_LINE_CC , ZEND_FILE_LINE_C
#define ZEND_FILE_LINE_EMPTY_C NULL, 0
#define ZEND_FILE_LINE_EMPTY_CC , ZEND_FILE_LINE_EMPTY_C
#define ZEND_FILE_LINE_ORIG_RELAY_C __zend_orig_filename, __zend_orig_lineno
#define ZEND_FILE_LINE_ORIG_RELAY_CC , ZEND_FILE_LINE_ORIG_RELAY_C
1999-08-28 03:17:19 +08:00
#else
#define ZEND_FILE_LINE_D
#define ZEND_FILE_LINE_DC
1999-08-28 18:18:54 +08:00
#define ZEND_FILE_LINE_ORIG_D
#define ZEND_FILE_LINE_ORIG_DC
1999-08-28 03:17:19 +08:00
#define ZEND_FILE_LINE_RELAY_C
#define ZEND_FILE_LINE_RELAY_CC
#define ZEND_FILE_LINE_C
#define ZEND_FILE_LINE_CC
1999-08-28 18:18:54 +08:00
#define ZEND_FILE_LINE_EMPTY_C
#define ZEND_FILE_LINE_EMPTY_CC
#define ZEND_FILE_LINE_ORIG_RELAY_C
#define ZEND_FILE_LINE_ORIG_RELAY_CC
1999-08-28 03:17:19 +08:00
#endif /* ZEND_DEBUG */
#ifdef ZTS
#define ZTS_V 1
#else
#define ZTS_V 0
#endif
1999-08-28 03:17:19 +08:00
1999-04-08 02:10:10 +08:00
#include "zend_errors.h"
#include "zend_alloc.h"
2002-06-24 15:11:12 +08:00
#include "zend_types.h"
1999-04-08 02:10:10 +08:00
2001-04-29 04:21:42 +08:00
#ifdef HAVE_LIMITS_H
# include <limits.h>
#endif
2001-04-29 04:13:25 +08:00
#ifndef LONG_MAX
#define LONG_MAX 2147483647L
#endif
#ifndef LONG_MIN
#define LONG_MIN (- LONG_MAX - 1)
#endif
1999-04-08 02:10:10 +08:00
#undef SUCCESS
#undef FAILURE
#define SUCCESS 0
#define FAILURE -1 /* this MUST stay a negative number, or it may affect functions! */
1999-04-08 02:10:10 +08:00
#include "zend_hash.h"
#include "zend_ts_hash.h"
1999-04-08 02:10:10 +08:00
#include "zend_llist.h"
#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, zval *this_ptr, int return_value_used TSRMLS_DC
#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, this_ptr, return_value_used TSRMLS_CC
1999-04-08 02:10:10 +08:00
1999-04-08 02:10:10 +08:00
/*
* zval
*/
typedef struct _zval_struct zval;
typedef struct _zend_class_entry zend_class_entry;
typedef struct _zend_object {
zend_class_entry *ce;
HashTable *properties;
unsigned int in_get:1;
unsigned int in_set:1;
} zend_object;
typedef unsigned int zend_object_handle;
typedef struct _zend_object_value zend_object_value;
#include "zend_object_handlers.h"
struct _zend_object_value {
zend_object_handle handle;
zend_object_handlers *handlers;
2001-08-19 23:23:25 +08:00
};
typedef union _zvalue_value {
1999-04-08 02:10:10 +08:00
long lval; /* long value */
double dval; /* double value */
struct {
char *val;
int len;
1999-04-08 02:10:10 +08:00
} str;
HashTable *ht; /* hash table value */
zend_object_value obj;
1999-04-08 02:10:10 +08:00
} zvalue_value;
struct _zval_struct {
/* Variable information */
zvalue_value value; /* value */
zend_uint refcount;
zend_uchar type; /* active type */
zend_uchar is_ref;
1999-04-08 02:10:10 +08:00
};
1999-10-05 23:13:22 +08:00
/* excpt.h on Digital Unix 4.0 defines function_table */
#undef function_table
1999-04-08 02:10:10 +08:00
/* A lot of stuff needs shifiting around in order to include zend_compile.h here */
union _zend_function;
#include "zend_iterators.h"
1999-04-08 02:10:10 +08:00
struct _zend_class_entry {
char type;
char *name;
2002-04-24 02:06:54 +08:00
zend_uint name_length;
1999-04-08 02:10:10 +08:00
struct _zend_class_entry *parent;
int refcount;
zend_bool constants_updated;
zend_uint ce_flags;
1999-04-08 02:10:10 +08:00
HashTable function_table;
HashTable default_properties;
HashTable properties_info;
HashTable *static_members;
HashTable constants_table;
struct _zend_function_entry *builtin_functions;
1999-04-08 02:10:10 +08:00
union _zend_function *constructor;
union _zend_function *destructor;
2001-12-27 03:54:20 +08:00
union _zend_function *clone;
union _zend_function *__get;
union _zend_function *__set;
union _zend_function *__call;
zend_class_iterator_funcs iterator_funcs;
1999-04-08 02:10:10 +08:00
/* handlers */
2002-02-14 17:20:51 +08:00
zend_object_value (*create_object)(zend_class_entry *class_type TSRMLS_DC);
zend_object_iterator *(*get_iterator)(zend_class_entry *ce, zval *object TSRMLS_DC);
int (*interface_gets_implemented)(zend_class_entry *iface, zend_class_entry *class_type TSRMLS_DC); /* a class implements this interface */
2003-03-05 19:14:44 +08:00
zend_class_entry **interfaces;
zend_uint num_interfaces;
char *filename;
zend_uint line_start;
zend_uint line_end;
char *doc_comment;
zend_uint doc_comment_len;
struct _zend_module_entry *module;
1999-04-08 02:10:10 +08:00
};
#include "zend_stream.h"
typedef struct _zend_utility_functions {
void (*error_function)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0);
int (*printf_function)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2);
1999-04-08 02:10:10 +08:00
int (*write_function)(const char *str, uint str_length);
FILE *(*fopen_function)(const char *filename, char **opened_path);
1999-04-08 02:10:10 +08:00
void (*message_handler)(long message, void *data);
void (*block_interruptions)(void);
void (*unblock_interruptions)(void);
int (*get_configuration_directive)(char *name, uint name_length, zval *contents);
void (*ticks_function)(int ticks);
2002-09-19 23:58:01 +08:00
void (*on_timeout)(int seconds TSRMLS_DC);
int (*stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
int (*vspprintf_function)(char **pbuf, size_t max_len, const char *format, va_list ap);
2004-09-06 06:40:35 +08:00
char *(*getenv_function)(char *name, size_t name_len TSRMLS_DC);
1999-04-08 02:10:10 +08:00
} zend_utility_functions;
typedef struct _zend_utility_values {
char *import_use_extension;
uint import_use_extension_length;
zend_bool html_errors;
1999-04-08 02:10:10 +08:00
} zend_utility_values;
typedef int (*zend_write_func_t)(const char *str, uint str_length);
1999-04-08 02:10:10 +08:00
#undef MIN
#undef MAX
2001-08-11 23:56:40 +08:00
#define MAX(a, b) (((a)>(b))?(a):(b))
#define MIN(a, b) (((a)<(b))?(a):(b))
#define ZEND_STRL(str) (str), (sizeof(str)-1)
#define ZEND_STRS(str) (str), (sizeof(str)-1)
#define ZEND_NORMALIZE_BOOL(n) \
((n) ? (((n)>0) ? 1 : -1) : 0)
#define ZEND_TRUTH(x) ((x) ? 1 : 0)
#define ZEND_LOG_XOR(a, b) (ZEND_TRUTH(a) ^ ZEND_TRUTH(b))
1999-04-08 02:10:10 +08:00
/* data types */
/* All data types <= IS_BOOL have their constructor/destructors skipped */
#define IS_NULL 0
1999-04-08 02:10:10 +08:00
#define IS_LONG 1
#define IS_DOUBLE 2
#define IS_BOOL 3
1999-04-08 02:10:10 +08:00
#define IS_ARRAY 4
#define IS_OBJECT 5
#define IS_STRING 6
#define IS_RESOURCE 7
#define IS_CONSTANT 8
#define IS_CONSTANT_ARRAY 9
2001-07-16 19:41:06 +08:00
/* Ugly hack to support constants as static array indices */
#define IS_CONSTANT_INDEX 0x80
/* overloaded elements data types */
#define OE_IS_ARRAY (1<<0)
#define OE_IS_OBJECT (1<<1)
#define OE_IS_METHOD (1<<2)
1999-04-08 02:10:10 +08:00
2000-03-22 02:48:28 +08:00
int zend_startup(zend_utility_functions *utility_functions, char **extensions, int start_builtin_functions);
2001-07-31 12:53:54 +08:00
void zend_shutdown(TSRMLS_D);
2002-11-20 01:51:30 +08:00
void zend_register_standard_ini_entries(TSRMLS_D);
2002-09-17 20:42:11 +08:00
#ifdef ZTS
void zend_post_startup(TSRMLS_D);
#endif
void zend_set_utility_values(zend_utility_values *utility_values);
BEGIN_EXTERN_C()
2001-07-22 00:21:22 +08:00
ZEND_API void _zend_bailout(char *filename, uint lineno);
END_EXTERN_C()
1999-04-08 02:10:10 +08:00
2001-07-22 00:21:22 +08:00
#define zend_bailout() _zend_bailout(__FILE__, __LINE__)
#define zend_try \
{ \
jmp_buf orig_bailout; \
zend_bool orig_bailout_set=EG(bailout_set); \
\
EG(bailout_set) = 1; \
memcpy(&orig_bailout, &EG(bailout), sizeof(jmp_buf)); \
if (setjmp(EG(bailout))==0)
#define zend_catch \
else
#define zend_end_try() \
memcpy(&EG(bailout), &orig_bailout, sizeof(jmp_buf)); \
EG(bailout_set) = orig_bailout_set; \
}
2001-08-08 23:06:08 +08:00
#define zend_first_try EG(bailout_set)=0; zend_try
BEGIN_EXTERN_C()
ZEND_API char *get_zend_version(void);
ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy);
1999-04-08 02:10:10 +08:00
ZEND_API int zend_print_zval(zval *expr, int indent);
ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent);
2003-01-12 22:25:58 +08:00
ZEND_API void zend_print_zval_r(zval *expr, int indent TSRMLS_DC);
ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC);
ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent TSRMLS_DC);
ZEND_API void zend_output_debug_string(zend_bool trigger_break, char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
END_EXTERN_C()
void zend_activate(TSRMLS_D);
void zend_deactivate(TSRMLS_D);
void zend_call_destructors(TSRMLS_D);
void zend_activate_modules(TSRMLS_D);
void zend_deactivate_modules(TSRMLS_D);
void zend_post_deactivate_modules(TSRMLS_D);
#if ZEND_DEBUG
#define Z_DBG(expr) (expr)
#else
#define Z_DBG(expr)
#endif
BEGIN_EXTERN_C()
2001-01-15 18:52:06 +08:00
ZEND_API void free_estring(char **str_p);
END_EXTERN_C()
2003-02-11 00:11:24 +08:00
/* FIXME: Check if we can save if (ptr) too */
1999-04-08 02:10:10 +08:00
#define STR_FREE(ptr) if (ptr) { efree(ptr); }
#define STR_FREE_REL(ptr) if (ptr) { efree_rel(ptr); }
#define STR_EMPTY_ALLOC() estrndup("", sizeof("")-1)
#define STR_REALLOC(ptr, size) \
ptr = (char *) erealloc(ptr, size);
1999-04-08 02:10:10 +08:00
/* output support */
#define ZEND_WRITE(str, str_len) zend_write((str), (str_len))
#define ZEND_PUTS(str) zend_write((str), strlen((str)))
#define ZEND_PUTC(c) zend_write(&(c), 1), (c)
BEGIN_EXTERN_C()
extern ZEND_API int (*zend_printf)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2);
extern ZEND_API zend_write_func_t zend_write;
extern ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path);
extern ZEND_API void (*zend_block_interruptions)(void);
extern ZEND_API void (*zend_unblock_interruptions)(void);
2000-02-17 16:03:13 +08:00
extern ZEND_API void (*zend_ticks_function)(int ticks);
extern ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0);
2002-09-19 23:58:01 +08:00
extern void (*zend_on_timeout)(int seconds TSRMLS_DC);
extern ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
extern int (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap);
2004-09-06 06:40:35 +08:00
extern ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC);
ZEND_API void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
1999-04-08 02:10:10 +08:00
void zenderror(char *error);
2002-03-13 03:41:02 +08:00
/* The following #define is used for code duality in PHP for Engine 1 & 2 */
#define ZEND_STANDARD_CLASS_DEF_PTR zend_standard_class_def
extern ZEND_API zend_class_entry *zend_standard_class_def;
2002-09-03 18:25:06 +08:00
extern ZEND_API zend_utility_values zend_uv;
1999-12-23 04:24:52 +08:00
extern ZEND_API zval zval_used_for_init;
END_EXTERN_C()
1999-04-08 02:10:10 +08:00
#define ZEND_UV(name) (zend_uv.name)
#define HANDLE_BLOCK_INTERRUPTIONS() if (zend_block_interruptions) { zend_block_interruptions(); }
#define HANDLE_UNBLOCK_INTERRUPTIONS() if (zend_unblock_interruptions) { zend_unblock_interruptions(); }
2000-03-06 18:46:40 +08:00
BEGIN_EXTERN_C()
2000-03-06 03:50:10 +08:00
ZEND_API void zend_message_dispatcher(long message, void *data);
2000-03-06 18:46:40 +08:00
ZEND_API int zend_get_configuration_directive(char *name, uint name_length, zval *contents);
END_EXTERN_C()
2000-03-06 03:50:10 +08:00
1999-04-08 02:10:10 +08:00
/* Messages for applications of Zend */
2000-06-13 00:07:15 +08:00
#define ZMSG_FAILED_INCLUDE_FOPEN 1L
#define ZMSG_FAILED_REQUIRE_FOPEN 2L
#define ZMSG_FAILED_HIGHLIGHT_FOPEN 3L
#define ZMSG_MEMORY_LEAK_DETECTED 4L
#define ZMSG_MEMORY_LEAK_REPEATED 5L
#define ZMSG_LOG_SCRIPT_NAME 6L
#define ZMSG_MEMORY_LEAKS_GRAND_TOTAL 7L
1999-04-08 02:10:10 +08:00
2000-06-29 23:07:59 +08:00
#define ZVAL_ADDREF(pz) (++(pz)->refcount)
#define ZVAL_DELREF(pz) (--(pz)->refcount)
#define ZVAL_REFCOUNT(pz) ((pz)->refcount)
#define INIT_PZVAL(z) \
(z)->refcount = 1; \
(z)->is_ref = 0;
#define INIT_ZVAL(z) z = zval_used_for_init;
#define ALLOC_INIT_ZVAL(zp) \
1999-12-27 05:21:33 +08:00
ALLOC_ZVAL(zp); \
INIT_ZVAL(*zp);
#define MAKE_STD_ZVAL(zv) \
1999-12-27 05:21:33 +08:00
ALLOC_ZVAL(zv); \
INIT_PZVAL(zv);
2000-02-17 00:00:02 +08:00
#define PZVAL_IS_REF(z) ((z)->is_ref)
#define SEPARATE_ZVAL(ppzv) \
{ \
zval *orig_ptr = *(ppzv); \
\
if (orig_ptr->refcount>1) { \
orig_ptr->refcount--; \
2000-02-17 00:00:02 +08:00
ALLOC_ZVAL(*(ppzv)); \
**(ppzv) = *orig_ptr; \
zval_copy_ctor(*(ppzv)); \
(*(ppzv))->refcount=1; \
(*(ppzv))->is_ref = 0; \
} \
}
2000-02-17 00:00:02 +08:00
#define SEPARATE_ZVAL_IF_NOT_REF(ppzv) \
if (!PZVAL_IS_REF(*ppzv)) { \
SEPARATE_ZVAL(ppzv); \
}
#define SEPARATE_ZVAL_TO_MAKE_IS_REF(ppzv) \
if (!PZVAL_IS_REF(*ppzv)) { \
SEPARATE_ZVAL(ppzv); \
(*(ppzv))->is_ref = 1; \
}
2000-02-17 00:00:02 +08:00
#define COPY_PZVAL_TO_ZVAL(zv, pzv) \
(zv) = *(pzv); \
if ((pzv)->refcount>1) { \
zval_copy_ctor(&(zv)); \
(pzv)->refcount--; \
} else { \
FREE_ZVAL(pzv); \
} \
INIT_PZVAL(&(zv));
2001-08-11 23:56:40 +08:00
#define REPLACE_ZVAL_VALUE(ppzv_dest, pzv_src, copy) { \
int is_ref, refcount; \
\
SEPARATE_ZVAL_IF_NOT_REF(ppzv_dest); \
is_ref = (*ppzv_dest)->is_ref; \
refcount = (*ppzv_dest)->refcount; \
zval_dtor(*ppzv_dest); \
**ppzv_dest = *pzv_src; \
2001-08-11 23:56:40 +08:00
if (copy) { \
zval_copy_ctor(*ppzv_dest); \
} \
(*ppzv_dest)->is_ref = is_ref; \
(*ppzv_dest)->refcount = refcount; \
}
2001-02-14 21:17:49 +08:00
#define ZEND_MAX_RESERVED_RESOURCES 4
1999-08-16 03:29:39 +08:00
2004-09-27 06:19:57 +08:00
#include "zend_variables.h"
#endif /* ZEND_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* indent-tabs-mode: t
* End:
*/