PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LTP GCOV extension - code coverage report
Current view: directory - var/php_gcov/PHP_5_3/Zend - zend.h
Test: PHP Code Coverage
Date: 2009-11-21 Instrumented lines: 16
Code covered: 100.0 % Executed lines: 16
Legend: not executed executed

       1                 : /*
       2                 :    +----------------------------------------------------------------------+
       3                 :    | Zend Engine                                                          |
       4                 :    +----------------------------------------------------------------------+
       5                 :    | Copyright (c) 1998-2009 Zend Technologies Ltd. (http://www.zend.com) |
       6                 :    +----------------------------------------------------------------------+
       7                 :    | This source file is subject to version 2.00 of the Zend license,     |
       8                 :    | that is bundled with this package in the file LICENSE, and is        | 
       9                 :    | available through the world-wide-web at the following url:           |
      10                 :    | http://www.zend.com/license/2_00.txt.                                |
      11                 :    | If you did not receive a copy of the Zend license and are unable to  |
      12                 :    | obtain it through the world-wide-web, please send a note to          |
      13                 :    | license@zend.com so we can mail you a copy immediately.              |
      14                 :    +----------------------------------------------------------------------+
      15                 :    | Authors: Andi Gutmans <andi@zend.com>                                |
      16                 :    |          Zeev Suraski <zeev@zend.com>                                |
      17                 :    +----------------------------------------------------------------------+
      18                 : */
      19                 : 
      20                 : /* $Id: zend.h 288110 2009-09-06 15:56:58Z pajoye $ */
      21                 : 
      22                 : #ifndef ZEND_H
      23                 : #define ZEND_H
      24                 : 
      25                 : #define ZEND_VERSION "2.3.0"
      26                 : 
      27                 : #define ZEND_ENGINE_2
      28                 : 
      29                 : #ifdef __cplusplus
      30                 : #define BEGIN_EXTERN_C() extern "C" {
      31                 : #define END_EXTERN_C() }
      32                 : #else
      33                 : #define BEGIN_EXTERN_C()
      34                 : #define END_EXTERN_C()
      35                 : #endif
      36                 : 
      37                 : /*
      38                 :  * general definitions
      39                 :  */
      40                 : 
      41                 : #ifdef ZEND_WIN32
      42                 : # include "zend_config.w32.h"
      43                 : # define ZEND_PATHS_SEPARATOR           ';'
      44                 : #elif defined(NETWARE)
      45                 : # include <zend_config.h>
      46                 : # define ZEND_PATHS_SEPARATOR           ';'
      47                 : #elif defined(__riscos__)
      48                 : # include <zend_config.h>
      49                 : # define ZEND_PATHS_SEPARATOR           ';'
      50                 : #else
      51                 : # include <zend_config.h>
      52                 : # define ZEND_PATHS_SEPARATOR           ':'
      53                 : #endif
      54                 : 
      55                 : #ifdef ZEND_WIN32
      56                 : /* Only use this macro if you know for sure that all of the switches values
      57                 :    are covered by its case statements */
      58                 : #define EMPTY_SWITCH_DEFAULT_CASE() \
      59                 :                         default:                                \
      60                 :                                 __assume(0);            \
      61                 :                                 break;
      62                 : #else
      63                 : #define EMPTY_SWITCH_DEFAULT_CASE()
      64                 : #endif
      65                 : 
      66                 : /* all HAVE_XXX test have to be after the include of zend_config above */
      67                 : 
      68                 : #include <stdio.h>
      69                 : 
      70                 : #ifdef HAVE_UNIX_H
      71                 : # include <unix.h>
      72                 : #endif
      73                 : 
      74                 : #ifdef HAVE_STDARG_H
      75                 : # include <stdarg.h>
      76                 : #endif
      77                 : 
      78                 : #ifdef HAVE_DLFCN_H
      79                 : # include <dlfcn.h>
      80                 : #endif
      81                 : 
      82                 : #if defined(HAVE_LIBDL) && !defined(ZEND_WIN32)
      83                 : 
      84                 : # ifndef RTLD_LAZY
      85                 : #  define RTLD_LAZY 1    /* Solaris 1, FreeBSD's (2.1.7.1 and older) */
      86                 : # endif
      87                 : 
      88                 : # ifndef RTLD_GLOBAL
      89                 : #  define RTLD_GLOBAL 0
      90                 : # endif
      91                 : 
      92                 : # if defined(RTLD_GROUP) && defined(RTLD_WORLD) && defined(RTLD_PARENT)
      93                 : #  define DL_LOAD(libname)                      dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_GROUP | RTLD_WORLD | RTLD_PARENT)
      94                 : # elif defined(RTLD_DEEPBIND)
      95                 : #  define DL_LOAD(libname)                      dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_DEEPBIND)
      96                 : # else
      97                 : #  define DL_LOAD(libname)                      dlopen(libname, RTLD_LAZY | RTLD_GLOBAL)
      98                 : # endif
      99                 : # define DL_UNLOAD                                      dlclose
     100                 : # if defined(DLSYM_NEEDS_UNDERSCORE)
     101                 : #  define DL_FETCH_SYMBOL(h,s)          dlsym((h), "_" s)
     102                 : # else
     103                 : #  define DL_FETCH_SYMBOL                       dlsym
     104                 : # endif
     105                 : # define DL_ERROR                                       dlerror
     106                 : # define DL_HANDLE                                      void *
     107                 : # define ZEND_EXTENSIONS_SUPPORT        1
     108                 : #elif defined(ZEND_WIN32)
     109                 : # define DL_LOAD(libname)                       LoadLibrary(libname)
     110                 : # define DL_FETCH_SYMBOL                        GetProcAddress
     111                 : # define DL_UNLOAD                                      FreeLibrary
     112                 : # define DL_HANDLE                                      HMODULE
     113                 : # define ZEND_EXTENSIONS_SUPPORT        1
     114                 : #else
     115                 : # define DL_HANDLE                                      void *
     116                 : # define ZEND_EXTENSIONS_SUPPORT        0
     117                 : #endif
     118                 : 
     119                 : #if HAVE_ALLOCA_H && !defined(_ALLOCA_H)
     120                 : #  include <alloca.h>
     121                 : #endif
     122                 : 
     123                 : /* AIX requires this to be the first thing in the file.  */
     124                 : #ifndef __GNUC__
     125                 : # ifndef HAVE_ALLOCA_H
     126                 : #  ifdef _AIX
     127                 : #pragma alloca
     128                 : #  else
     129                 : #   ifndef alloca /* predefined by HP cc +Olibcalls */
     130                 : char *alloca ();
     131                 : #   endif
     132                 : #  endif
     133                 : # endif
     134                 : #endif
     135                 : 
     136                 : /* GCC x.y.z supplies __GNUC__ = x and __GNUC_MINOR__ = y */
     137                 : #ifdef __GNUC__
     138                 : # define ZEND_GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
     139                 : #else
     140                 : # define ZEND_GCC_VERSION 0
     141                 : #endif
     142                 : 
     143                 : #if ZEND_GCC_VERSION >= 2096
     144                 : # define ZEND_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
     145                 : #else
     146                 : # define ZEND_ATTRIBUTE_MALLOC
     147                 : #endif
     148                 : 
     149                 : #if ZEND_GCC_VERSION >= 2007
     150                 : # define ZEND_ATTRIBUTE_FORMAT(type, idx, first) __attribute__ ((format(type, idx, first)))
     151                 : #else
     152                 : # define ZEND_ATTRIBUTE_FORMAT(type, idx, first)
     153                 : #endif
     154                 : 
     155                 : #if ZEND_GCC_VERSION >= 3001 && !defined(__INTEL_COMPILER)
     156                 : # define ZEND_ATTRIBUTE_PTR_FORMAT(type, idx, first) __attribute__ ((format(type, idx, first)))
     157                 : #else
     158                 : # define ZEND_ATTRIBUTE_PTR_FORMAT(type, idx, first)
     159                 : #endif
     160                 : 
     161                 : #if ZEND_GCC_VERSION >= 3001
     162                 : # define ZEND_ATTRIBUTE_DEPRECATED  __attribute__((deprecated))
     163                 : #elif defined(ZEND_WIN32) && defined(_MSC_VER) && _MSC_VER >= 1300
     164                 : # define ZEND_ATTRIBUTE_DEPRECATED  __declspec(deprecated)
     165                 : #else
     166                 : # define ZEND_ATTRIBUTE_DEPRECATED
     167                 : #endif
     168                 : 
     169                 : #if defined(__GNUC__) && ZEND_GCC_VERSION >= 3400 && defined(__i386__)
     170                 : # define ZEND_FASTCALL __attribute__((fastcall))
     171                 : #elif defined(_MSC_VER) && defined(_M_IX86)
     172                 : # define ZEND_FASTCALL __fastcall
     173                 : #else
     174                 : # define ZEND_FASTCALL
     175                 : #endif
     176                 : 
     177                 : #if defined(__GNUC__) && ZEND_GCC_VERSION >= 3400
     178                 : #else
     179                 : # define __restrict__
     180                 : #endif
     181                 : #define restrict __restrict__
     182                 : 
     183                 : #if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(ZEND_WIN32)) && !(defined(ZTS) && defined(NETWARE)) && !(defined(ZTS) && defined(HPUX)) && !defined(DARWIN)
     184                 : # define ZEND_ALLOCA_MAX_SIZE (32 * 1024)
     185                 : # define ALLOCA_FLAG(name) \
     186                 :         zend_bool name;
     187                 : # define SET_ALLOCA_FLAG(name) \
     188                 :         name = 1
     189                 : # define do_alloca_ex(size, limit, use_heap) \
     190                 :         ((use_heap = (UNEXPECTED((size) > (limit)))) ? emalloc(size) : alloca(size))
     191                 : # define do_alloca(size, use_heap) \
     192                 :         do_alloca_ex(size, ZEND_ALLOCA_MAX_SIZE, use_heap)
     193                 : # define free_alloca(p, use_heap) \
     194                 :         do { if (UNEXPECTED(use_heap)) efree(p); } while (0)
     195                 : #else
     196                 : # define ALLOCA_FLAG(name)
     197                 : # define SET_ALLOCA_FLAG(name)
     198                 : # define do_alloca(p, use_heap)         emalloc(p)
     199                 : # define free_alloca(p, use_heap)       efree(p)
     200                 : #endif
     201                 : 
     202                 : #if ZEND_DEBUG
     203                 : #define ZEND_FILE_LINE_D                                char *__zend_filename, uint __zend_lineno
     204                 : #define ZEND_FILE_LINE_DC                               , ZEND_FILE_LINE_D
     205                 : #define ZEND_FILE_LINE_ORIG_D                   char *__zend_orig_filename, uint __zend_orig_lineno
     206                 : #define ZEND_FILE_LINE_ORIG_DC                  , ZEND_FILE_LINE_ORIG_D
     207                 : #define ZEND_FILE_LINE_RELAY_C                  __zend_filename, __zend_lineno
     208                 : #define ZEND_FILE_LINE_RELAY_CC                 , ZEND_FILE_LINE_RELAY_C
     209                 : #define ZEND_FILE_LINE_C                                __FILE__, __LINE__
     210                 : #define ZEND_FILE_LINE_CC                               , ZEND_FILE_LINE_C
     211                 : #define ZEND_FILE_LINE_EMPTY_C                  NULL, 0
     212                 : #define ZEND_FILE_LINE_EMPTY_CC                 , ZEND_FILE_LINE_EMPTY_C
     213                 : #define ZEND_FILE_LINE_ORIG_RELAY_C             __zend_orig_filename, __zend_orig_lineno
     214                 : #define ZEND_FILE_LINE_ORIG_RELAY_CC    , ZEND_FILE_LINE_ORIG_RELAY_C
     215                 : #else
     216                 : #define ZEND_FILE_LINE_D
     217                 : #define ZEND_FILE_LINE_DC
     218                 : #define ZEND_FILE_LINE_ORIG_D
     219                 : #define ZEND_FILE_LINE_ORIG_DC
     220                 : #define ZEND_FILE_LINE_RELAY_C
     221                 : #define ZEND_FILE_LINE_RELAY_CC
     222                 : #define ZEND_FILE_LINE_C
     223                 : #define ZEND_FILE_LINE_CC
     224                 : #define ZEND_FILE_LINE_EMPTY_C
     225                 : #define ZEND_FILE_LINE_EMPTY_CC
     226                 : #define ZEND_FILE_LINE_ORIG_RELAY_C
     227                 : #define ZEND_FILE_LINE_ORIG_RELAY_CC
     228                 : #endif  /* ZEND_DEBUG */
     229                 : 
     230                 : #ifdef ZTS
     231                 : #define ZTS_V 1
     232                 : #else
     233                 : #define ZTS_V 0
     234                 : #endif
     235                 : 
     236                 : #include "zend_errors.h"
     237                 : #include "zend_alloc.h"
     238                 : 
     239                 : #include "zend_types.h"
     240                 : 
     241                 : #ifdef HAVE_LIMITS_H
     242                 : # include <limits.h>
     243                 : #endif
     244                 : 
     245                 : #ifndef LONG_MAX
     246                 : #define LONG_MAX 2147483647L
     247                 : #endif
     248                 : 
     249                 : #ifndef LONG_MIN
     250                 : #define LONG_MIN (- LONG_MAX - 1)
     251                 : #endif
     252                 : 
     253                 : #if SIZEOF_LONG == 4
     254                 : #define MAX_LENGTH_OF_LONG 11
     255                 : static const char long_min_digits[] = "2147483648";
     256                 : #elif SIZEOF_LONG == 8
     257                 : #define MAX_LENGTH_OF_LONG 20
     258                 : static const char long_min_digits[] = "9223372036854775808";
     259                 : #else
     260                 : #error "Unknown SIZEOF_LONG"
     261                 : #endif
     262                 : 
     263                 : #define MAX_LENGTH_OF_DOUBLE 32
     264                 : 
     265                 : #undef SUCCESS
     266                 : #undef FAILURE
     267                 : #define SUCCESS 0
     268                 : #define FAILURE -1                              /* this MUST stay a negative number, or it may affect functions! */
     269                 : 
     270                 : #include "zend_hash.h"
     271                 : #include "zend_ts_hash.h"
     272                 : #include "zend_llist.h"
     273                 : 
     274                 : #define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, zval **return_value_ptr, zval *this_ptr, int return_value_used TSRMLS_DC
     275                 : #define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, return_value_ptr, this_ptr, return_value_used TSRMLS_CC
     276                 : 
     277                 : #if defined(__GNUC__) && __GNUC__ >= 3 && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX) && !defined(__osf__)
     278                 : void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((noreturn));
     279                 : #else
     280                 : #  define zend_error_noreturn zend_error
     281                 : #endif
     282                 : 
     283                 : /*
     284                 :  * zval
     285                 :  */
     286                 : typedef struct _zval_struct zval;
     287                 : typedef struct _zend_class_entry zend_class_entry;
     288                 : 
     289                 : typedef struct _zend_guard {
     290                 :         zend_bool in_get;
     291                 :         zend_bool in_set;
     292                 :         zend_bool in_unset;
     293                 :         zend_bool in_isset;
     294                 :         zend_bool dummy; /* sizeof(zend_guard) must not be equal to sizeof(void*) */
     295                 : } zend_guard;
     296                 : 
     297                 : typedef struct _zend_object {
     298                 :         zend_class_entry *ce;
     299                 :         HashTable *properties;
     300                 :         HashTable *guards; /* protects from __get/__set ... recursion */
     301                 : } zend_object;
     302                 : 
     303                 : #include "zend_object_handlers.h"
     304                 : 
     305                 : typedef union _zvalue_value {
     306                 :         long lval;                                      /* long value */
     307                 :         double dval;                            /* double value */
     308                 :         struct {
     309                 :                 char *val;
     310                 :                 int len;
     311                 :         } str;
     312                 :         HashTable *ht;                          /* hash table value */
     313                 :         zend_object_value obj;
     314                 : } zvalue_value;
     315                 : 
     316                 : struct _zval_struct {
     317                 :         /* Variable information */
     318                 :         zvalue_value value;             /* value */
     319                 :         zend_uint refcount__gc;
     320                 :         zend_uchar type;        /* active type */
     321                 :         zend_uchar is_ref__gc;
     322                 : };
     323                 : 
     324                 : #define Z_REFCOUNT_PP(ppz)              Z_REFCOUNT_P(*(ppz))
     325                 : #define Z_SET_REFCOUNT_PP(ppz, rc)      Z_SET_REFCOUNT_P(*(ppz), rc)
     326                 : #define Z_ADDREF_PP(ppz)                Z_ADDREF_P(*(ppz))
     327                 : #define Z_DELREF_PP(ppz)                Z_DELREF_P(*(ppz))
     328                 : #define Z_ISREF_PP(ppz)                 Z_ISREF_P(*(ppz))
     329                 : #define Z_SET_ISREF_PP(ppz)             Z_SET_ISREF_P(*(ppz))
     330                 : #define Z_UNSET_ISREF_PP(ppz)           Z_UNSET_ISREF_P(*(ppz))
     331                 : #define Z_SET_ISREF_TO_PP(ppz, isref)   Z_SET_ISREF_TO_P(*(ppz), isref)
     332                 : 
     333                 : #define Z_REFCOUNT_P(pz)                zval_refcount_p(pz)
     334                 : #define Z_SET_REFCOUNT_P(pz, rc)        zval_set_refcount_p(pz, rc)
     335                 : #define Z_ADDREF_P(pz)                  zval_addref_p(pz)
     336                 : #define Z_DELREF_P(pz)                  zval_delref_p(pz)
     337                 : #define Z_ISREF_P(pz)                   zval_isref_p(pz)
     338                 : #define Z_SET_ISREF_P(pz)               zval_set_isref_p(pz)
     339                 : #define Z_UNSET_ISREF_P(pz)             zval_unset_isref_p(pz)
     340                 : #define Z_SET_ISREF_TO_P(pz, isref)     zval_set_isref_to_p(pz, isref)
     341                 : 
     342                 : #define Z_REFCOUNT(z)                   Z_REFCOUNT_P(&(z))
     343                 : #define Z_SET_REFCOUNT(z, rc)           Z_SET_REFCOUNT_P(&(z), rc)
     344                 : #define Z_ADDREF(z)                     Z_ADDREF_P(&(z))
     345                 : #define Z_DELREF(z)                     Z_DELREF_P(&(z))
     346                 : #define Z_ISREF(z)                      Z_ISREF_P(&(z))
     347                 : #define Z_SET_ISREF(z)                  Z_SET_ISREF_P(&(z))
     348                 : #define Z_UNSET_ISREF(z)                Z_UNSET_ISREF_P(&(z))
     349                 : #define Z_SET_ISREF_TO(z, isref)        Z_SET_ISREF_TO_P(&(z), isref)
     350                 : 
     351                 : #if defined(__GNUC__)
     352                 : #if __GNUC__ >= 3
     353                 : #define zend_always_inline inline __attribute__((always_inline))
     354                 : #else
     355                 : #define zend_always_inline inline
     356                 : #endif
     357                 : 
     358                 : #elif defined(_MSC_VER)
     359                 : #define zend_always_inline __forceinline
     360                 : #else
     361                 : #define zend_always_inline inline
     362                 : #endif
     363                 : 
     364                 : #if (defined (__GNUC__) && __GNUC__ > 2 ) && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX)
     365                 : # define EXPECTED(condition)   __builtin_expect(condition, 1)
     366                 : # define UNEXPECTED(condition) __builtin_expect(condition, 0)
     367                 : #else
     368                 : # define EXPECTED(condition)   (condition)
     369                 : # define UNEXPECTED(condition) (condition)
     370                 : #endif
     371                 : 
     372       136706448 : static zend_always_inline zend_uint zval_refcount_p(zval* pz) {
     373       136706448 :         return pz->refcount__gc;
     374                 : }
     375                 : 
     376        30791897 : static zend_always_inline zend_uint zval_set_refcount_p(zval* pz, zend_uint rc) {
     377        30791897 :         return pz->refcount__gc = rc;
     378                 : }
     379                 : 
     380       171887664 : static zend_always_inline zend_uint zval_addref_p(zval* pz) {
     381       171887664 :         return ++pz->refcount__gc;
     382                 : }
     383                 : 
     384       127311392 : static zend_always_inline zend_uint zval_delref_p(zval* pz) {
     385       127311392 :         return --pz->refcount__gc;
     386                 : }
     387                 : 
     388        72066735 : static zend_always_inline zend_bool zval_isref_p(zval* pz) {
     389        72066735 :         return pz->is_ref__gc;
     390                 : }
     391                 : 
     392         4902431 : static zend_always_inline zend_bool zval_set_isref_p(zval* pz) {
     393         4902431 :         return pz->is_ref__gc = 1;
     394                 : }
     395                 : 
     396        58125759 : static zend_always_inline zend_bool zval_unset_isref_p(zval* pz) {
     397        58125759 :         return pz->is_ref__gc = 0;
     398                 : }
     399                 : 
     400          221132 : static zend_always_inline zend_bool zval_set_isref_to_p(zval* pz, zend_bool isref) {
     401          221132 :         return pz->is_ref__gc = isref;
     402                 : }
     403                 : 
     404                 : /* excpt.h on Digital Unix 4.0 defines function_table */
     405                 : #undef function_table
     406                 : 
     407                 : /* A lot of stuff needs shifiting around in order to include zend_compile.h here */
     408                 : union _zend_function;
     409                 : 
     410                 : #include "zend_iterators.h"
     411                 : 
     412                 : struct _zend_serialize_data;
     413                 : struct _zend_unserialize_data;
     414                 : 
     415                 : typedef struct _zend_serialize_data zend_serialize_data;
     416                 : typedef struct _zend_unserialize_data zend_unserialize_data;
     417                 : 
     418                 : struct _zend_class_entry {
     419                 :         char type;
     420                 :         char *name;
     421                 :         zend_uint name_length;
     422                 :         struct _zend_class_entry *parent;
     423                 :         int refcount;
     424                 :         zend_bool constants_updated;
     425                 :         zend_uint ce_flags;
     426                 : 
     427                 :         HashTable function_table;
     428                 :         HashTable default_properties;
     429                 :         HashTable properties_info;
     430                 :         HashTable default_static_members;
     431                 :         HashTable *static_members;
     432                 :         HashTable constants_table;
     433                 :         const struct _zend_function_entry *builtin_functions;
     434                 : 
     435                 :         union _zend_function *constructor;
     436                 :         union _zend_function *destructor;
     437                 :         union _zend_function *clone;
     438                 :         union _zend_function *__get;
     439                 :         union _zend_function *__set;
     440                 :         union _zend_function *__unset;
     441                 :         union _zend_function *__isset;
     442                 :         union _zend_function *__call;
     443                 :         union _zend_function *__callstatic;
     444                 :         union _zend_function *__tostring;
     445                 :         union _zend_function *serialize_func;
     446                 :         union _zend_function *unserialize_func;
     447                 : 
     448                 :         zend_class_iterator_funcs iterator_funcs;
     449                 : 
     450                 :         /* handlers */
     451                 :         zend_object_value (*create_object)(zend_class_entry *class_type TSRMLS_DC);
     452                 :         zend_object_iterator *(*get_iterator)(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC);
     453                 :         int (*interface_gets_implemented)(zend_class_entry *iface, zend_class_entry *class_type TSRMLS_DC); /* a class implements this interface */
     454                 :         union _zend_function *(*get_static_method)(zend_class_entry *ce, char* method, int method_len TSRMLS_DC);
     455                 : 
     456                 :         /* serializer callbacks */
     457                 :         int (*serialize)(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC);
     458                 :         int (*unserialize)(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC);
     459                 : 
     460                 :         zend_class_entry **interfaces;
     461                 :         zend_uint num_interfaces;
     462                 : 
     463                 :         char *filename;
     464                 :         zend_uint line_start;
     465                 :         zend_uint line_end;
     466                 :         char *doc_comment;
     467                 :         zend_uint doc_comment_len;
     468                 : 
     469                 :         struct _zend_module_entry *module;
     470                 : };
     471                 : 
     472                 : #include "zend_stream.h"
     473                 : typedef struct _zend_utility_functions {
     474                 :         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);
     475                 :         int (*printf_function)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2);
     476                 :         int (*write_function)(const char *str, uint str_length);
     477                 :         FILE *(*fopen_function)(const char *filename, char **opened_path TSRMLS_DC);
     478                 :         void (*message_handler)(long message, void *data TSRMLS_DC);
     479                 :         void (*block_interruptions)(void);
     480                 :         void (*unblock_interruptions)(void);
     481                 :         int (*get_configuration_directive)(const char *name, uint name_length, zval *contents);
     482                 :         void (*ticks_function)(int ticks);
     483                 :         void (*on_timeout)(int seconds TSRMLS_DC);
     484                 :         int (*stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
     485                 :         int (*vspprintf_function)(char **pbuf, size_t max_len, const char *format, va_list ap);
     486                 :         char *(*getenv_function)(char *name, size_t name_len TSRMLS_DC);
     487                 :         char *(*resolve_path_function)(const char *filename, int filename_len TSRMLS_DC);
     488                 : } zend_utility_functions;
     489                 : 
     490                 : typedef struct _zend_utility_values {
     491                 :         char *import_use_extension;
     492                 :         uint import_use_extension_length;
     493                 :         zend_bool html_errors;
     494                 : } zend_utility_values;
     495                 : 
     496                 : typedef int (*zend_write_func_t)(const char *str, uint str_length);
     497                 : 
     498                 : #undef MIN
     499                 : #undef MAX
     500                 : #define MAX(a, b)  (((a)>(b))?(a):(b))
     501                 : #define MIN(a, b)  (((a)<(b))?(a):(b))
     502                 : #define ZEND_STRL(str)          (str), (sizeof(str)-1)
     503                 : #define ZEND_STRS(str)          (str), (sizeof(str))
     504                 : #define ZEND_NORMALIZE_BOOL(n)                  \
     505                 :         ((n) ? (((n)>0) ? 1 : -1) : 0)
     506                 : #define ZEND_TRUTH(x)           ((x) ? 1 : 0)
     507                 : #define ZEND_LOG_XOR(a, b)              (ZEND_TRUTH(a) ^ ZEND_TRUTH(b))
     508                 : 
     509                 : /* data types */
     510                 : /* All data types <= IS_BOOL have their constructor/destructors skipped */
     511                 : #define IS_NULL         0
     512                 : #define IS_LONG         1
     513                 : #define IS_DOUBLE       2
     514                 : #define IS_BOOL         3
     515                 : #define IS_ARRAY        4
     516                 : #define IS_OBJECT       5
     517                 : #define IS_STRING       6
     518                 : #define IS_RESOURCE     7
     519                 : #define IS_CONSTANT     8
     520                 : #define IS_CONSTANT_ARRAY       9
     521                 : 
     522                 : /* Ugly hack to support constants as static array indices */
     523                 : #define IS_CONSTANT_TYPE_MASK   0x0f
     524                 : #define IS_CONSTANT_UNQUALIFIED 0x10
     525                 : #define IS_CONSTANT_INDEX               0x80
     526                 : #define IS_LEXICAL_VAR                  0x20
     527                 : #define IS_LEXICAL_REF                  0x40
     528                 : 
     529                 : /* overloaded elements data types */
     530                 : #define OE_IS_ARRAY             (1<<0)
     531                 : #define OE_IS_OBJECT    (1<<1)
     532                 : #define OE_IS_METHOD    (1<<2)
     533                 : 
     534                 : int zend_startup(zend_utility_functions *utility_functions, char **extensions TSRMLS_DC);
     535                 : void zend_shutdown(TSRMLS_D);
     536                 : void zend_register_standard_ini_entries(TSRMLS_D);
     537                 : void zend_post_startup(TSRMLS_D);
     538                 : void zend_set_utility_values(zend_utility_values *utility_values);
     539                 : 
     540                 : BEGIN_EXTERN_C()
     541                 : ZEND_API void _zend_bailout(char *filename, uint lineno);
     542                 : END_EXTERN_C()
     543                 : 
     544                 : #define zend_bailout()          _zend_bailout(__FILE__, __LINE__)
     545                 : 
     546                 : #ifdef HAVE_SIGSETJMP
     547                 : #       define SETJMP(a) sigsetjmp(a, 0)
     548                 : #       define LONGJMP(a,b) siglongjmp(a, b)
     549                 : #       define JMP_BUF sigjmp_buf
     550                 : #else
     551                 : #       define SETJMP(a) setjmp(a)
     552                 : #       define LONGJMP(a,b) longjmp(a, b)
     553                 : #       define JMP_BUF jmp_buf
     554                 : #endif
     555                 : 
     556                 : #define zend_try                                                                                                \
     557                 :         {                                                                                                                       \
     558                 :                 JMP_BUF *__orig_bailout = EG(bailout);                                  \
     559                 :                 JMP_BUF __bailout;                                                                              \
     560                 :                                                                                                                                 \
     561                 :                 EG(bailout) = &__bailout;                                                           \
     562                 :                 if (SETJMP(__bailout)==0) {
     563                 : #define zend_catch                                                                                              \
     564                 :                 } else {                                                                                                \
     565                 :                         EG(bailout) = __orig_bailout;
     566                 : #define zend_end_try()                                                                                  \
     567                 :                 }                                                                                                               \
     568                 :                 EG(bailout) = __orig_bailout;                                                   \
     569                 :         }
     570                 : #define zend_first_try          EG(bailout)=NULL;       zend_try
     571                 : 
     572                 : BEGIN_EXTERN_C()
     573                 : ZEND_API char *get_zend_version(void);
     574                 : ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy);
     575                 : ZEND_API int zend_print_zval(zval *expr, int indent);
     576                 : ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent);
     577                 : ZEND_API void zend_print_zval_r(zval *expr, int indent TSRMLS_DC);
     578                 : ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC);
     579                 : ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent TSRMLS_DC);
     580                 : ZEND_API void zend_output_debug_string(zend_bool trigger_break, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
     581                 : END_EXTERN_C()
     582                 : 
     583                 : void zend_activate(TSRMLS_D);
     584                 : void zend_deactivate(TSRMLS_D);
     585                 : void zend_call_destructors(TSRMLS_D);
     586                 : void zend_activate_modules(TSRMLS_D);
     587                 : void zend_deactivate_modules(TSRMLS_D);
     588                 : void zend_post_deactivate_modules(TSRMLS_D);
     589                 : 
     590                 : #if ZEND_DEBUG
     591                 : #define Z_DBG(expr)             (expr)
     592                 : #else
     593                 : #define Z_DBG(expr)
     594                 : #endif
     595                 : 
     596                 : BEGIN_EXTERN_C()
     597                 : ZEND_API void free_estring(char **str_p);
     598                 : END_EXTERN_C()
     599                 : 
     600                 : /* FIXME: Check if we can save if (ptr) too */
     601                 : 
     602                 : #define STR_FREE(ptr) if (ptr) { efree(ptr); }
     603                 : #define STR_FREE_REL(ptr) if (ptr) { efree_rel(ptr); }
     604                 : 
     605                 : #define STR_EMPTY_ALLOC() estrndup("", sizeof("")-1)
     606                 : 
     607                 : #define STR_REALLOC(ptr, size) \
     608                 :                         ptr = (char *) erealloc(ptr, size);
     609                 : 
     610                 : /* output support */
     611                 : #define ZEND_WRITE(str, str_len)                zend_write((str), (str_len))
     612                 : #define ZEND_WRITE_EX(str, str_len)             write_func((str), (str_len))
     613                 : #define ZEND_PUTS(str)                                  zend_write((str), strlen((str)))
     614                 : #define ZEND_PUTS_EX(str)                               write_func((str), strlen((str)))
     615                 : #define ZEND_PUTC(c)                                    zend_write(&(c), 1), (c)
     616                 : 
     617                 : BEGIN_EXTERN_C()
     618                 : extern ZEND_API int (*zend_printf)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2);
     619                 : extern ZEND_API zend_write_func_t zend_write;
     620                 : extern ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path TSRMLS_DC);
     621                 : extern ZEND_API void (*zend_block_interruptions)(void);
     622                 : extern ZEND_API void (*zend_unblock_interruptions)(void);
     623                 : extern ZEND_API void (*zend_ticks_function)(int ticks);
     624                 : 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);
     625                 : extern void (*zend_on_timeout)(int seconds TSRMLS_DC);
     626                 : extern ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
     627                 : extern int (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap);
     628                 : extern ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC);
     629                 : extern ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_len TSRMLS_DC);
     630                 : 
     631                 : ZEND_API void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
     632                 : 
     633                 : void zenderror(const char *error);
     634                 : 
     635                 : /* The following #define is used for code duality in PHP for Engine 1 & 2 */
     636                 : #define ZEND_STANDARD_CLASS_DEF_PTR zend_standard_class_def
     637                 : extern ZEND_API zend_class_entry *zend_standard_class_def;
     638                 : extern ZEND_API zend_utility_values zend_uv;
     639                 : extern ZEND_API zval zval_used_for_init;
     640                 : 
     641                 : END_EXTERN_C()
     642                 : 
     643                 : #define ZEND_UV(name) (zend_uv.name)
     644                 : 
     645                 : #define HANDLE_BLOCK_INTERRUPTIONS()            if (zend_block_interruptions) { zend_block_interruptions(); }
     646                 : #define HANDLE_UNBLOCK_INTERRUPTIONS()          if (zend_unblock_interruptions) { zend_unblock_interruptions(); }
     647                 : 
     648                 : BEGIN_EXTERN_C()
     649                 : ZEND_API void zend_message_dispatcher(long message, void *data TSRMLS_DC);
     650                 : 
     651                 : ZEND_API int zend_get_configuration_directive(const char *name, uint name_length, zval *contents);
     652                 : END_EXTERN_C()
     653                 : 
     654                 : /* Messages for applications of Zend */
     655                 : #define ZMSG_FAILED_INCLUDE_FOPEN               1L
     656                 : #define ZMSG_FAILED_REQUIRE_FOPEN               2L
     657                 : #define ZMSG_FAILED_HIGHLIGHT_FOPEN             3L
     658                 : #define ZMSG_MEMORY_LEAK_DETECTED               4L
     659                 : #define ZMSG_MEMORY_LEAK_REPEATED               5L
     660                 : #define ZMSG_LOG_SCRIPT_NAME                    6L
     661                 : #define ZMSG_MEMORY_LEAKS_GRAND_TOTAL   7L
     662                 : 
     663                 : #define INIT_PZVAL(z)           \
     664                 :         (z)->refcount__gc = 1;       \
     665                 :         (z)->is_ref__gc = 0;
     666                 : 
     667                 : #define INIT_ZVAL(z) z = zval_used_for_init;
     668                 : 
     669                 : #define ALLOC_INIT_ZVAL(zp)                                             \
     670                 :         ALLOC_ZVAL(zp);         \
     671                 :         INIT_ZVAL(*zp);
     672                 : 
     673                 : #define MAKE_STD_ZVAL(zv)                                \
     674                 :         ALLOC_ZVAL(zv); \
     675                 :         INIT_PZVAL(zv);
     676                 : 
     677                 : #define PZVAL_IS_REF(z)         Z_ISREF_P(z)
     678                 : 
     679                 : #define SEPARATE_ZVAL(ppzv)                                                                     \
     680                 :         {                                                                                                               \
     681                 :                 zval *orig_ptr = *(ppzv);                                                       \
     682                 :                                                                                                                         \
     683                 :                 if (Z_REFCOUNT_P(orig_ptr) > 1) {                                    \
     684                 :                         Z_DELREF_P(orig_ptr);                                                   \
     685                 :                         ALLOC_ZVAL(*(ppzv));                                                    \
     686                 :                         **(ppzv) = *orig_ptr;                                                   \
     687                 :                         zval_copy_ctor(*(ppzv));                                                \
     688                 :                         Z_SET_REFCOUNT_PP(ppzv, 1);                                             \
     689                 :                         Z_UNSET_ISREF_PP((ppzv));                                               \
     690                 :                 }                                                                                                       \
     691                 :         }
     692                 : 
     693                 : #define SEPARATE_ZVAL_IF_NOT_REF(ppzv)          \
     694                 :         if (!PZVAL_IS_REF(*ppzv)) {                             \
     695                 :                 SEPARATE_ZVAL(ppzv);                            \
     696                 :         }
     697                 : 
     698                 : #define SEPARATE_ZVAL_TO_MAKE_IS_REF(ppzv)      \
     699                 :         if (!PZVAL_IS_REF(*ppzv)) {                             \
     700                 :                 SEPARATE_ZVAL(ppzv);                            \
     701                 :                 Z_SET_ISREF_PP((ppzv));                         \
     702                 :         }
     703                 : 
     704                 : #define COPY_PZVAL_TO_ZVAL(zv, pzv)                     \
     705                 :         (zv) = *(pzv);                                                  \
     706                 :         if (Z_REFCOUNT_P(pzv)>1) {                           \
     707                 :                 zval_copy_ctor(&(zv));                              \
     708                 :                 Z_DELREF_P((pzv));                                      \
     709                 :         } else {                                                                \
     710                 :                 FREE_ZVAL(pzv);                                         \
     711                 :         }                                                                               \
     712                 :         INIT_PZVAL(&(zv));
     713                 : 
     714                 : #define REPLACE_ZVAL_VALUE(ppzv_dest, pzv_src, copy) {  \
     715                 :         int is_ref, refcount;                                           \
     716                 :                                                                                                 \
     717                 :         SEPARATE_ZVAL_IF_NOT_REF(ppzv_dest);            \
     718                 :         is_ref = Z_ISREF_PP(ppzv_dest);                         \
     719                 :         refcount = Z_REFCOUNT_PP(ppzv_dest);            \
     720                 :         zval_dtor(*ppzv_dest);                                          \
     721                 :         **ppzv_dest = *pzv_src;                                         \
     722                 :         if (copy) {                                 \
     723                 :                 zval_copy_ctor(*ppzv_dest);                             \
     724                 :     }                                               \
     725                 :         Z_SET_ISREF_TO_PP(ppzv_dest, is_ref);           \
     726                 :         Z_SET_REFCOUNT_PP(ppzv_dest, refcount);         \
     727                 : }
     728                 : 
     729                 : #define SEPARATE_ARG_IF_REF(varptr) \
     730                 :         if (PZVAL_IS_REF(varptr)) { \
     731                 :                 zval *original_var = varptr; \
     732                 :                 ALLOC_ZVAL(varptr); \
     733                 :                 varptr->value = original_var->value; \
     734                 :                 Z_TYPE_P(varptr) = Z_TYPE_P(original_var); \
     735                 :                 Z_UNSET_ISREF_P(varptr); \
     736                 :                 Z_SET_REFCOUNT_P(varptr, 1); \
     737                 :                 zval_copy_ctor(varptr); \
     738                 :         } else { \
     739                 :                 Z_ADDREF_P(varptr); \
     740                 :         }
     741                 : 
     742                 : #define READY_TO_DESTROY(zv) \
     743                 :         (Z_REFCOUNT_P(zv) == 1 && \
     744                 :          (Z_TYPE_P(zv) != IS_OBJECT || \
     745                 :           zend_objects_store_get_refcount(zv TSRMLS_CC) == 1))
     746                 : 
     747                 : #define ZEND_MAX_RESERVED_RESOURCES     4
     748                 : 
     749                 : #include "zend_gc.h"
     750                 : #include "zend_operators.h"
     751                 : #include "zend_variables.h"
     752                 : 
     753                 : typedef enum {
     754                 :         EH_NORMAL = 0,
     755                 :         EH_SUPPRESS,
     756                 :         EH_THROW
     757                 : } zend_error_handling_t;
     758                 : 
     759                 : typedef struct {
     760                 :         zend_error_handling_t  handling;
     761                 :         zend_class_entry       *exception;
     762                 :         zval                   *user_handler;
     763                 : } zend_error_handling;
     764                 : 
     765                 : ZEND_API void zend_save_error_handling(zend_error_handling *current TSRMLS_DC);
     766                 : ZEND_API void zend_replace_error_handling(zend_error_handling_t error_handling, zend_class_entry *exception_class, zend_error_handling *current TSRMLS_DC);
     767                 : ZEND_API void zend_restore_error_handling(zend_error_handling *saved TSRMLS_DC);
     768                 : 
     769                 : #endif /* ZEND_H */
     770                 : 
     771                 : /*
     772                 :  * Local variables:
     773                 :  * tab-width: 4
     774                 :  * c-basic-offset: 4
     775                 :  * indent-tabs-mode: t
     776                 :  * End:
     777                 :  */

Generated by: LTP GCOV extension version 1.5

Generated at Sat, 21 Nov 2009 12:26:55 +0000 (3 days ago)

Copyright © 2005-2009 The PHP Group
All rights reserved.