LTP GCOV extension - code coverage report
Current view: directory - Zend - zend_execute.h
Test: PHP Code Coverage
Date: 2007-04-10 Instrumented lines: 54
Code covered: 72.2 % Executed lines: 39
Legend: not executed executed

       1                 : /*
       2                 :    +----------------------------------------------------------------------+
       3                 :    | Zend Engine                                                          |
       4                 :    +----------------------------------------------------------------------+
       5                 :    | Copyright (c) 1998-2007 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_execute.h,v 1.84.2.4.2.6 2007/01/10 15:58:07 dmitry Exp $ */
      21                 : 
      22                 : #ifndef ZEND_EXECUTE_H
      23                 : #define ZEND_EXECUTE_H
      24                 : 
      25                 : #include "zend_compile.h"
      26                 : #include "zend_hash.h"
      27                 : #include "zend_operators.h"
      28                 : #include "zend_variables.h"
      29                 : 
      30                 : typedef union _temp_variable {
      31                 :         zval tmp_var;
      32                 :         struct {
      33                 :                 zval **ptr_ptr;
      34                 :                 zval *ptr;
      35                 :                 zend_bool fcall_returned_reference;
      36                 :         } var;
      37                 :         struct {
      38                 :                 zval **ptr_ptr;
      39                 :                 zval *ptr;
      40                 :                 zend_bool fcall_returned_reference;
      41                 :                 zval *str;
      42                 :                 zend_uint offset;
      43                 :         } str_offset;
      44                 :         struct {
      45                 :                 zval **ptr_ptr;
      46                 :                 zval *ptr;
      47                 :                 zend_bool fcall_returned_reference;
      48                 :                 HashPointer fe_pos;
      49                 :         } fe;
      50                 :         zend_class_entry *class_entry;
      51                 : } temp_variable;
      52                 : 
      53                 : 
      54                 : BEGIN_EXTERN_C()
      55                 : ZEND_API extern void (*zend_execute)(zend_op_array *op_array TSRMLS_DC);
      56                 : ZEND_API extern void (*zend_execute_internal)(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC);
      57                 : 
      58                 : void init_executor(TSRMLS_D);
      59                 : void shutdown_executor(TSRMLS_D);
      60                 : void shutdown_destructors(TSRMLS_D);
      61                 : ZEND_API void execute(zend_op_array *op_array TSRMLS_DC);
      62                 : ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC);
      63                 : ZEND_API int zend_is_true(zval *op);
      64                 : #define safe_free_zval_ptr(p) safe_free_zval_ptr_rel(p ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
      65                 : static inline void safe_free_zval_ptr_rel(zval *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
      66          231207 : {
      67                 :         TSRMLS_FETCH();
      68                 : 
      69          231207 :         if (p!=EG(uninitialized_zval_ptr)) {
      70          231207 :                 FREE_ZVAL_REL(p);
      71                 :         }
      72          231207 : }
      73                 : ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC);
      74                 : ZEND_API int zend_lookup_class_ex(char *name, int name_length, int use_autoload, zend_class_entry ***ce TSRMLS_DC);
      75                 : ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC);
      76                 : ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
      77                 : 
      78                 : static inline int i_zend_is_true(zval *op)
      79          231667 : {
      80                 :         int result;
      81                 : 
      82          231667 :         switch (Z_TYPE_P(op)) {
      83                 :                 case IS_NULL:
      84             332 :                         result = 0;
      85             332 :                         break;
      86                 :                 case IS_LONG:
      87                 :                 case IS_BOOL:
      88                 :                 case IS_RESOURCE:
      89          229973 :                         result = (Z_LVAL_P(op)?1:0);
      90          229973 :                         break;
      91                 :                 case IS_DOUBLE:
      92               0 :                         result = (Z_DVAL_P(op) ? 1 : 0);
      93               0 :                         break;
      94                 :                 case IS_STRING:
      95            2068 :                         if (Z_STRLEN_P(op) == 0
      96                 :                                 || (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) {
      97             763 :                                 result = 0;
      98                 :                         } else {
      99             542 :                                 result = 1;
     100                 :                         }
     101            1305 :                         break;
     102                 :                 case IS_ARRAY:
     103              47 :                         result = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0);
     104              47 :                         break;
     105                 :                 case IS_OBJECT:
     106              10 :                         if(IS_ZEND_STD_OBJECT(*op)) {
     107                 :                                 TSRMLS_FETCH();
     108                 : 
     109              10 :                                 if (Z_OBJ_HT_P(op)->cast_object) {
     110                 :                                         zval tmp;
     111              10 :                                         if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, IS_BOOL TSRMLS_CC) == SUCCESS) {
     112              10 :                                                 result = Z_LVAL(tmp);
     113              10 :                                                 break;
     114                 :                                         }
     115               0 :                                 } else if (Z_OBJ_HT_P(op)->get) {
     116               0 :                                         zval *tmp = Z_OBJ_HT_P(op)->get(op TSRMLS_CC);
     117               0 :                                         if(Z_TYPE_P(tmp) != IS_OBJECT) {
     118                 :                                                 /* for safety - avoid loop */
     119               0 :                                                 convert_to_boolean(tmp);
     120               0 :                                                 result = Z_LVAL_P(tmp);
     121               0 :                                                 zval_ptr_dtor(&tmp);
     122               0 :                                                 break;
     123                 :                                         }
     124                 :                                 }
     125                 :                         
     126               0 :                                 if(EG(ze1_compatibility_mode)) {
     127               0 :                                         result = (zend_hash_num_elements(Z_OBJPROP_P(op))?1:0);
     128                 :                                 } else {
     129               0 :                                         result = 1;
     130                 :                                 }
     131                 :                         } else {
     132               0 :                                 result = 1;
     133                 :                         }
     134               0 :                         break;
     135                 :                 default:
     136               0 :                         result = 0;
     137                 :                         break;
     138                 :         }
     139          231667 :         return result;
     140                 : }
     141                 : 
     142                 : ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC);
     143                 : ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *scope TSRMLS_DC);
     144                 : 
     145                 : /* dedicated Zend executor functions - do not use! */
     146                 : static inline void zend_ptr_stack_clear_multiple(TSRMLS_D)
     147          111927 : {
     148          111927 :         void **p = EG(argument_stack).top_element-2;
     149          111927 :         int delete_count = (ulong) *p;
     150                 : 
     151          111927 :         EG(argument_stack).top -= (delete_count+2);
     152          509267 :         while (--delete_count>=0) {
     153          285413 :                 zval *q = *(zval **)(--p);
     154          285413 :                 *p = NULL;
     155          285413 :                 zval_ptr_dtor(&q);
     156                 :         }
     157          111927 :         EG(argument_stack).top_element = p;
     158          111927 : }
     159                 : 
     160                 : static inline int zend_ptr_stack_get_arg(int requested_arg, void **data TSRMLS_DC)
     161          149365 : {
     162          149365 :         void **p = EG(argument_stack).top_element-2;
     163          149365 :         int arg_count = (ulong) *p;
     164                 : 
     165          149365 :         if (requested_arg>arg_count) {
     166             116 :                 return FAILURE;
     167                 :         }
     168          149249 :         *data = (p-arg_count+requested_arg-1);
     169          149249 :         return SUCCESS;
     170                 : }
     171                 : 
     172                 : void execute_new_code(TSRMLS_D);
     173                 : 
     174                 : 
     175                 : /* services */
     176                 : ZEND_API char *get_active_class_name(char **space TSRMLS_DC);
     177                 : ZEND_API char *get_active_function_name(TSRMLS_D);
     178                 : ZEND_API char *zend_get_executed_filename(TSRMLS_D);
     179                 : ZEND_API uint zend_get_executed_lineno(TSRMLS_D);
     180                 : ZEND_API zend_bool zend_is_executing(TSRMLS_D);
     181                 : 
     182                 : ZEND_API void zend_set_timeout(long seconds);
     183                 : ZEND_API void zend_unset_timeout(TSRMLS_D);
     184                 : ZEND_API void zend_timeout(int dummy);
     185                 : ZEND_API zend_class_entry *zend_fetch_class(char *class_name, uint class_name_len, int fetch_type TSRMLS_DC);
     186                 : void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC);
     187                 : 
     188                 : #ifdef ZEND_WIN32
     189                 : void zend_init_timeout_thread();
     190                 : void zend_shutdown_timeout_thread();
     191                 : #define WM_REGISTER_ZEND_TIMEOUT                (WM_USER+1)
     192                 : #define WM_UNREGISTER_ZEND_TIMEOUT              (WM_USER+2)
     193                 : #endif
     194                 : 
     195                 : #define zendi_zval_copy_ctor(p) zval_copy_ctor(&(p))
     196                 : #define zendi_zval_dtor(p) zval_dtor(&(p))
     197                 : 
     198                 : #define active_opline (*EG(opline_ptr))
     199                 : 
     200                 : /* The following tries to resolve the classname of a zval of type object.
     201                 :  * Since it is slow it should be only used in error messages.
     202                 :  */
     203                 : #define Z_OBJ_CLASS_NAME_P(zval) ((zval) && Z_TYPE_P(zval) == IS_OBJECT && Z_OBJ_HT_P(zval)->get_class_entry != NULL && Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC) ? Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC)->name : "")
     204                 : 
     205                 : ZEND_API zval** zend_get_compiled_variable_value(zend_execute_data *execute_data_ptr, zend_uint var);
     206                 : 
     207                 : #define ZEND_USER_OPCODE_CONTINUE   0 /* execute next opcode */
     208                 : #define ZEND_USER_OPCODE_RETURN     1 /* exit from executor (return from function) */
     209                 : #define ZEND_USER_OPCODE_DISPATCH   2 /* call original opcode handler */
     210                 : 
     211                 : #define ZEND_USER_OPCODE_DISPATCH_TO 0x100 /* call original handler of returned opcode */
     212                 : 
     213                 : ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, opcode_handler_t handler);
     214                 : ZEND_API opcode_handler_t zend_get_user_opcode_handler(zend_uchar opcode);
     215                 : 
     216                 : /* former zend_execute_locks.h */
     217                 : typedef struct _zend_free_op {
     218                 :         zval* var;
     219                 : /*      int   is_var; */
     220                 : } zend_free_op;
     221                 : 
     222                 : ZEND_API zval *zend_get_zval_ptr(znode *node, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC);
     223                 : ZEND_API zval **zend_get_zval_ptr_ptr(znode *node, temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC);
     224                 : 
     225                 : ZEND_API int zend_do_fcall(ZEND_OPCODE_HANDLER_ARGS);
     226                 : 
     227                 : END_EXTERN_C()
     228                 : 
     229                 : #endif /* ZEND_EXECUTE_H */
     230                 : 
     231                 : /*
     232                 :  * Local variables:
     233                 :  * tab-width: 4
     234                 :  * c-basic-offset: 4
     235                 :  * indent-tabs-mode: t
     236                 :  * End:
     237                 :  */

Generated by: LTP GCOV extension version 1.5