Attached is a patch that exposes zend_execute_data in the executor globals, this
data is useful for lowerlevel access to the Zend scripting engine, especially when
accessing data directly out of the OP structures.

-Sterling
Index: zend_execute.c
===================================================================
RCS file: /repository/Zend/zend_execute.c,v
retrieving revision 1.295
diff -u -r1.295 zend_execute.c
--- zend_execute.c      4 May 2002 17:29:01 -0000       1.295
+++ zend_execute.c      14 May 2002 16:00:21 -0000
@@ -990,24 +990,13 @@
        EX(opline)++;                   \
        continue;
 
-typedef struct _object_info {
-       zval *ptr;
-} object_info;
-
-typedef struct _zend_execute_data {
-       zend_op *opline;
-       zend_function_state function_state;
-       zend_function *fbc; /* Function Being Called */
-       object_info object;
-       temp_variable *Ts;
-       zend_bool original_in_execution;
-} zend_execute_data;
-
 #define EX(element) execute_data.element
 
 ZEND_API void execute(zend_op_array *op_array TSRMLS_DC)
 {
        zend_execute_data execute_data;
+
+       EG(execute_data_ptr) = &execute_data;
 
        /* Initialize execute_data */
        EX(fbc) = NULL;
Index: zend_execute.h
===================================================================
RCS file: /repository/Zend/zend_execute.h,v
retrieving revision 1.42
diff -u -r1.42 zend_execute.h
--- zend_execute.h      6 Jan 2002 15:21:09 -0000       1.42
+++ zend_execute.h      14 May 2002 16:00:21 -0000
@@ -25,28 +25,7 @@
 #include "zend_hash.h"
 #include "zend_variables.h"
 #include "zend_operators.h"
-
-typedef union _temp_variable {
-       zval tmp_var;
-       struct {
-               zval **ptr_ptr;
-               zval *ptr;
-       } var;
-       struct {
-               zval tmp_var; /* a dummy */
-
-               union {
-                       struct {
-                               zval *str;
-                               int offset;
-                       } str_offset;
-                       zend_property_reference overloaded_element;
-               } data;
-                       
-               unsigned char type;
-       } EA;
-} temp_variable;
-
+#include "zend_execute_globals.h"
 
 ZEND_API extern void (*zend_execute)(zend_op_array *op_array TSRMLS_DC);
 
Index: zend_globals.h
===================================================================
RCS file: /repository/Zend/zend_globals.h,v
retrieving revision 1.83
diff -u -r1.83 zend_globals.h
--- zend_globals.h      8 May 2002 12:29:51 -0000       1.83
+++ zend_globals.h      14 May 2002 16:00:21 -0000
@@ -31,6 +31,7 @@
 #include "zend_hash.h"
 #include "zend_llist.h"
 #include "zend_fast_cache.h"
+#include "zend_execute_globals.h"
 
 #ifdef ZEND_MULTIBYTE
 #include "zend_multibyte.h"
@@ -151,6 +152,8 @@
 
        zend_op **opline_ptr;
 
+    zend_execute_data *execute_data_ptr;
+    
        HashTable *active_symbol_table;
        HashTable symbol_table;         /* main symbol table */
 
/*
   +----------------------------------------------------------------------+
   | Zend Engine                                                          |
   +----------------------------------------------------------------------+
   | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) |
   +----------------------------------------------------------------------+
   | This source file is subject to version 2.00 of the Zend license,     |
   | that is bundled with this package in the file LICENSE, and is        | 
   | available at through the world-wide-web at                           |
   | http://www.zend.com/license/2_00.txt.                                |
   | 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          |
   | [EMAIL PROTECTED] so we can mail you a copy immediately.              |
   +----------------------------------------------------------------------+
   | Authors: Andi Gutmans <[EMAIL PROTECTED]>                                |
   |          Zeev Suraski <[EMAIL PROTECTED]>                                |
   +----------------------------------------------------------------------+
*/


#ifndef ZEND_EXECUTE_GLOBALS_H
#define ZEND_EXECUTE_GLOBALS_H

#include "zend_compile.h"
#include "zend_hash.h"
#include "zend_variables.h"
#include "zend_operators.h"

typedef union _temp_variable {
        zval tmp_var;
        struct {
                zval **ptr_ptr;
                zval *ptr;
        } var;
        struct {
                zval tmp_var; /* a dummy */

                union {
                        struct {
                                zval *str;
                                int offset;
                        } str_offset;
                        zend_property_reference overloaded_element;
                } data;
                        
                unsigned char type;
        } EA;
} temp_variable;

typedef struct _object_info {
        zval *ptr;
} object_info;

typedef struct _zend_execute_data {
        zend_op *opline;
        zend_function_state function_state;
        zend_function *fbc; /* Function Being Called */
        object_info object;
        temp_variable *Ts;
        zend_bool original_in_execution;
} zend_execute_data;

#endif

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to