cvs: ZendEngine2 / zend.h zend_compile.c
| From: | Stanislav Malyshev | Date: | Wed, 23 Feb 2005 11:15:52 +0000 |
| Subject: | cvs: ZendEngine2 / zend.h zend_compile.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-3429@lists.php.net to get a copy of this message | ||
stas Wed Feb 23 06:15:52 2005 EDT
Modified files:
/ZendEngine2 zend.h zend_compile.c
Log:
Custom object serializer infrastructure
# The detailed announce on the list will follow
http://cvs.php.net/diff.php/ZendEngine2/zend.h?r1=1.272&r2=1.273&ty=u
Index: ZendEngine2/zend.h
diff -u ZendEngine2/zend.h:1.272 ZendEngine2/zend.h:1.273
--- ZendEngine2/zend.h:1.272 Tue Feb 22 03:48:33 2005
+++ ZendEngine2/zend.h Wed Feb 23 06:15:51 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend.h,v 1.272 2005/02/22 08:48:33 hyanantha Exp $ */
+/* $Id: zend.h,v 1.273 2005/02/23 11:15:51 stas Exp $ */
#ifndef ZEND_H
#define ZEND_H
@@ -303,6 +303,12 @@
#include "zend_iterators.h"
+struct _zend_serialize_data;
+struct _zend_unserialize_data;
+
+typedef struct _zend_serialize_data zend_serialize_data;
+typedef struct _zend_unserialize_data zend_unserialize_data;
+
struct _zend_class_entry {
char type;
char *name;
@@ -333,6 +339,10 @@
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 */
+ /* serializer callbacks */
+ int (*serialize)(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data
*data TSRMLS_DC);
+ int (*unserialize)(zval **object, const unsigned char *buf, zend_uint buf_len,
zend_unserialize_data *data TSRMLS_DC);
+
zend_class_entry **interfaces;
zend_uint num_interfaces;
http://cvs.php.net/diff.php/ZendEngine2/zend_compile.c?r1=1.612&r2=1.613&ty=u
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.612 ZendEngine2/zend_compile.c:1.613
--- ZendEngine2/zend_compile.c:1.612 Sun Feb 20 05:19:11 2005
+++ ZendEngine2/zend_compile.c Wed Feb 23 06:15:51 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_compile.c,v 1.612 2005/02/20 10:19:11 dmitry Exp $ */
+/* $Id: zend_compile.c,v 1.613 2005/02/23 11:15:51 stas Exp $ */
#include <zend_language_parser.h>
#include "zend.h"
@@ -1707,7 +1707,7 @@
/* You cannot change create_object */
ce->create_object = ce->parent->create_object;
-
+
/* Inherit special functions if needed */
if (!ce->get_iterator) {
ce->get_iterator = ce->parent->get_iterator;
@@ -1727,12 +1727,19 @@
if (!ce->clone) {
ce->clone = ce->parent->clone;
}
+ if(!ce->serialize) {
+ ce->serialize = ce->parent->serialize;
+ }
+ if(!ce->unserialize) {
+ ce->unserialize = ce->parent->unserialize;
+ }
if (!ce->destructor) {
ce->destructor = ce->parent->destructor;
}
if (ce->constructor) {
return;
}
+
if (zend_hash_find(&ce->parent->function_table, ZEND_CONSTRUCTOR_FUNC_NAME,
sizeof(ZEND_CONSTRUCTOR_FUNC_NAME), (void **)&function)==SUCCESS) {
/* inherit parent's constructor */
zend_hash_update(&ce->function_table, ZEND_CONSTRUCTOR_FUNC_NAME,
sizeof(ZEND_CONSTRUCTOR_FUNC_NAME), function, sizeof(zend_function), NULL);
@@ -3839,6 +3846,8 @@
ce->num_interfaces = 0;
ce->interfaces = NULL;
ce->module = NULL;
+ ce->serialize = NULL;
+ ce->unserialize = NULL;
}
}