prepare v2.2.3
[m6w6/ext-pq] / src / php_pq_object.h
1 /*
2 +--------------------------------------------------------------------+
3 | PECL :: pq |
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the conditions mentioned |
7 | in the accompanying LICENSE file are met. |
8 +--------------------------------------------------------------------+
9 | Copyright (c) 2013, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
11 */
12
13 #ifndef PHP_PQ_OBJECT_H
14 #define PHP_PQ_OBJECT_H
15
16 #define PHP_PQ_OBJ_DECL(_intern_type) \
17 _intern_type intern; \
18 HashTable *prophandler; \
19 HashTable gc; \
20 zend_object zo;
21
22 typedef struct php_pq_object {
23 PHP_PQ_OBJ_DECL(void *)
24 } php_pq_object_t;
25
26 static inline void *PHP_PQ_OBJ(zval *zv, zend_object *zo) {
27 if (zv) {
28 zo = Z_OBJ_P(zv);
29 }
30 return (void *) (((char *) zo) - zo->handlers->offset);
31 }
32
33 extern zend_class_entry *ancestor(zend_class_entry *ce);
34
35 typedef void (*php_pq_object_prophandler_func_t)(void *o, zval *return_value);
36
37 typedef struct php_pq_object_prophandler {
38 php_pq_object_prophandler_func_t read;
39 php_pq_object_prophandler_func_t write;
40 php_pq_object_prophandler_func_t gc;
41 } php_pq_object_prophandler_t;
42
43 extern void php_pq_object_prophandler_dtor(zval *zv);
44
45 extern void *php_pq_object_create(zend_class_entry *ce, void *intern, size_t obj_size, zend_object_handlers *oh, HashTable *ph);
46 extern void php_pq_object_dtor(zend_object *obj);
47 extern void php_pq_object_to_zval(void *o, zval *zv);
48 extern void php_pq_object_to_zval_no_addref(void *o, zval *zv);
49 extern void php_pq_object_addref(void *o);
50 extern void php_pq_object_delref(void *o);
51
52 #if PHP_VERSION_ID >= 80000
53 extern HashTable *php_pq_object_debug_info(zend_object *object, int *temp);
54 extern HashTable *php_pq_object_properties(zend_object *object);
55 extern HashTable *php_pq_object_get_gc(zend_object *object, zval **table, int *n);
56 extern zval *php_pq_object_read_prop(zend_object *object, zend_string *member, int type, void **cache_slot, zval *tmp);
57 extern zval *php_pq_object_write_prop(zend_object *object, zend_string *member, zval *value, void **cache_slot);
58 extern zval *php_pq_object_get_prop_ptr_null(zend_object *object, zend_string *member, int type, void **cache_slot);
59 #else
60 extern HashTable *php_pq_object_debug_info(zval *object, int *temp);
61 extern HashTable *php_pq_object_properties(zval *object);
62 extern HashTable *php_pq_object_get_gc(zval *object, zval **table, int *n);
63 extern zval *php_pq_object_read_prop(zval *object, zval *member, int type, void **cache_slot, zval *tmp);
64 # if PHP_VERSION_ID >= 70400
65 extern zval *php_pq_object_write_prop(zval *object, zval *member, zval *value, void **cache_slot);
66 # else
67 extern void php_pq_object_write_prop(zval *object, zval *member, zval *value, void **cache_slot);
68 # endif
69 extern zval *php_pq_object_get_prop_ptr_null(zval *object, zval *member, int type, void **cache_slot);
70 #endif
71
72 #endif
73
74 /*
75 * Local variables:
76 * tab-width: 4
77 * c-basic-offset: 4
78 * End:
79 * vim600: noet sw=4 ts=4 fdm=marker
80 * vim<600: noet sw=4 ts=4
81 */