X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Fphp_pq_object.h;h=6f45addcf0cff304638c88b86ccab732fc9f335c;hb=80a38048f8355392d81e23f4b3a27a8e77d58214;hp=7bbdd845f0675b42a5eae72ead458de80d4cd026;hpb=9f5cecf26bd70a92ed013f31afec59e272623ac1;p=m6w6%2Fext-pq diff --git a/src/php_pq_object.h b/src/php_pq_object.h index 7bbdd84..6f45add 100644 --- a/src/php_pq_object.h +++ b/src/php_pq_object.h @@ -13,28 +13,95 @@ #ifndef PHP_PQ_OBJECT_H #define PHP_PQ_OBJECT_H -typedef struct php_pq_object { +#define PHP_PQ_OBJ_DECL(_intern_type) \ + _intern_type intern; \ + HashTable *prophandler; \ + HashTable gc; \ zend_object zo; - zend_object_value zv; - HashTable *prophandler; - void *intern; + +typedef struct php_pq_object { + PHP_PQ_OBJ_DECL(void *) } php_pq_object_t; -typedef void (*php_pq_object_prophandler_func_t)(zval *object, void *o, zval *return_value TSRMLS_DC); +static inline void *PHP_PQ_OBJ(zval *zv, zend_object *zo) { + if (zv) { + zo = Z_OBJ_P(zv); + } + return (void *) (((char *) zo) - zo->handlers->offset); +} + +extern zend_class_entry *ancestor(zend_class_entry *ce); + +typedef void (*php_pq_object_prophandler_func_t)(void *o, zval *return_value); typedef struct php_pq_object_prophandler { php_pq_object_prophandler_func_t read; php_pq_object_prophandler_func_t write; + php_pq_object_prophandler_func_t gc; } php_pq_object_prophandler_t; -void php_pq_object_to_zval(void *o, zval **zv TSRMLS_DC); -void php_pq_object_to_zval_no_addref(void *o, zval **zv TSRMLS_DC); -void php_pq_object_addref(void *o TSRMLS_DC); -void php_pq_object_delref(void *o TSRMLS_DC); -HashTable *php_pq_object_debug_info(zval *object, int *temp TSRMLS_DC); -zend_class_entry *ancestor(zend_class_entry *ce); -zval *php_pq_object_read_prop(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC); -void php_pq_object_write_prop(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC); +extern void php_pq_object_prophandler_dtor(zval *zv); + +extern void *php_pq_object_create(zend_class_entry *ce, void *intern, size_t obj_size, zend_object_handlers *oh, HashTable *ph); +extern void php_pq_object_dtor(zend_object *obj); +extern void php_pq_object_to_zval(void *o, zval *zv); +extern void php_pq_object_to_zval_no_addref(void *o, zval *zv); +extern void php_pq_object_addref(void *o); +extern void php_pq_object_delref(void *o); + +#if PHP_VERSION_ID >= 80000 +# define php_pq_object_debug_info php_pq_object_debug_info_80 +#else +# define php_pq_object_debug_info php_pq_object_debug_info_70 +#endif +extern HashTable *php_pq_object_debug_info_80(zend_object *object, int *temp); +extern HashTable *php_pq_object_debug_info_70(zval *object, int *temp); + +#if PHP_VERSION_ID >= 80000 +# define php_pq_object_properties php_pq_object_properties_80 +#else +# define php_pq_object_properties php_pq_object_properties_70 +#endif +extern HashTable *php_pq_object_properties_80(zend_object *object); +extern HashTable *php_pq_object_properties_70(zval *object); + +#if PHP_VERSION_ID >= 80000 +# define php_pq_object_get_gc php_pq_object_get_gc_80 +#else +# define php_pq_object_get_gc php_pq_object_get_gc_70 +#endif +extern HashTable *php_pq_object_get_gc_80(zend_object *object, zval **table, int *n); +extern HashTable *php_pq_object_get_gc_70(zval *object, zval **table, int *n); + +#if PHP_VERSION_ID >= 80000 +# define php_pq_object_read_prop php_pq_object_read_prop_80 +#elif PHP_VERSION_ID >= 70400 +# define php_pq_object_read_prop php_pq_object_read_prop_74 +#else +# define php_pq_object_read_prop php_pq_object_read_prop_70 +#endif +extern zval *php_pq_object_read_prop_80(zend_object *object, zend_string *member, int type, void **cache_slot, zval *tmp); +extern zval *php_pq_object_read_prop_74(zval *object, zval *member, int type, void **cache_slot, zval *tmp); +extern void php_pq_object_read_prop_70(zval *object, zval *member, int type, void **cache_slot, zval *tmp); + +#if PHP_VERSION_ID >= 80000 +# define php_pq_object_write_prop php_pq_object_write_prop_80 +#elif PHP_VERSION_ID >= 70400 +# define php_pq_object_write_prop php_pq_object_write_prop_74 +#else +# define php_pq_object_write_prop php_pq_object_write_prop_70 +#endif +extern zval *php_pq_object_write_prop_80(zend_object *object, zend_string *member, zval *value, void **cache_slot); +extern zval *php_pq_object_write_prop_74(zval *object, zval *member, zval *value, void **cache_slot); +extern void php_pq_object_write_prop_70(zval *object, zval *member, zval *value, void **cache_slot); + +#if PHP_VERSION_ID >= 80000 +# define php_pq_object_get_prop_ptr_null php_pq_object_get_prop_ptr_null_80 +#else +# define php_pq_object_get_prop_ptr_null php_pq_object_get_prop_ptr_null_70 +#endif +extern zval *php_pq_object_get_prop_ptr_null_80(zend_object *object, zend_string *member, int type, void **cache_slot); +extern zval *php_pq_object_get_prop_ptr_null_70(zval *object, zval *member, int type, void **cache_slot); #endif