6f45addcf0cff304638c88b86ccab732fc9f335c
[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 # define php_pq_object_debug_info php_pq_object_debug_info_80
54 #else
55 # define php_pq_object_debug_info php_pq_object_debug_info_70
56 #endif
57 extern HashTable *php_pq_object_debug_info_80(zend_object *object, int *temp);
58 extern HashTable *php_pq_object_debug_info_70(zval *object, int *temp);
59
60 #if PHP_VERSION_ID >= 80000
61 # define php_pq_object_properties php_pq_object_properties_80
62 #else
63 # define php_pq_object_properties php_pq_object_properties_70
64 #endif
65 extern HashTable *php_pq_object_properties_80(zend_object *object);
66 extern HashTable *php_pq_object_properties_70(zval *object);
67
68 #if PHP_VERSION_ID >= 80000
69 # define php_pq_object_get_gc php_pq_object_get_gc_80
70 #else
71 # define php_pq_object_get_gc php_pq_object_get_gc_70
72 #endif
73 extern HashTable *php_pq_object_get_gc_80(zend_object *object, zval **table, int *n);
74 extern HashTable *php_pq_object_get_gc_70(zval *object, zval **table, int *n);
75
76 #if PHP_VERSION_ID >= 80000
77 # define php_pq_object_read_prop php_pq_object_read_prop_80
78 #elif PHP_VERSION_ID >= 70400
79 # define php_pq_object_read_prop php_pq_object_read_prop_74
80 #else
81 # define php_pq_object_read_prop php_pq_object_read_prop_70
82 #endif
83 extern zval *php_pq_object_read_prop_80(zend_object *object, zend_string *member, int type, void **cache_slot, zval *tmp);
84 extern zval *php_pq_object_read_prop_74(zval *object, zval *member, int type, void **cache_slot, zval *tmp);
85 extern void php_pq_object_read_prop_70(zval *object, zval *member, int type, void **cache_slot, zval *tmp);
86
87 #if PHP_VERSION_ID >= 80000
88 # define php_pq_object_write_prop php_pq_object_write_prop_80
89 #elif PHP_VERSION_ID >= 70400
90 # define php_pq_object_write_prop php_pq_object_write_prop_74
91 #else
92 # define php_pq_object_write_prop php_pq_object_write_prop_70
93 #endif
94 extern zval *php_pq_object_write_prop_80(zend_object *object, zend_string *member, zval *value, void **cache_slot);
95 extern zval *php_pq_object_write_prop_74(zval *object, zval *member, zval *value, void **cache_slot);
96 extern void php_pq_object_write_prop_70(zval *object, zval *member, zval *value, void **cache_slot);
97
98 #if PHP_VERSION_ID >= 80000
99 # define php_pq_object_get_prop_ptr_null php_pq_object_get_prop_ptr_null_80
100 #else
101 # define php_pq_object_get_prop_ptr_null php_pq_object_get_prop_ptr_null_70
102 #endif
103 extern zval *php_pq_object_get_prop_ptr_null_80(zend_object *object, zend_string *member, int type, void **cache_slot);
104 extern zval *php_pq_object_get_prop_ptr_null_70(zval *object, zval *member, int type, void **cache_slot);
105
106 #endif
107
108 /*
109 * Local variables:
110 * tab-width: 4
111 * c-basic-offset: 4
112 * End:
113 * vim600: noet sw=4 ts=4 fdm=marker
114 * vim<600: noet sw=4 ts=4
115 */