1 #ifndef PHP_DS_QUEUE_H 2 #define PHP_DS_QUEUE_H 3 4 #include "../../ds/ds_queue.h" 5 6 typedef struct _php_ds_queue_t { 7 ds_queue_t *queue; 8 zend_object std; 9 } php_ds_queue_t; 10 php_ds_queue_fetch_object(zend_object * obj)11static inline php_ds_queue_t *php_ds_queue_fetch_object(zend_object *obj) { 12 return (php_ds_queue_t *)((char*)(obj) - XtOffsetOf(php_ds_queue_t, std)); 13 } 14 15 #define Z_DS_QUEUE(z) php_ds_queue_fetch_object(Z_OBJ(z))->queue 16 #define Z_DS_QUEUE_P(z) Z_DS_QUEUE(*z) 17 #define THIS_DS_QUEUE() Z_DS_QUEUE_P(getThis()) 18 19 #define ZVAL_DS_QUEUE(z, queue) \ 20 ZVAL_OBJ(z, php_ds_queue_create_object_ex(queue)) 21 22 #define RETURN_DS_QUEUE(q) \ 23 do { \ 24 ds_queue_t *_q = q; \ 25 if (_q) { \ 26 ZVAL_DS_QUEUE(return_value, _q); \ 27 } else { \ 28 ZVAL_NULL(return_value); \ 29 } \ 30 return; \ 31 } while(0) 32 33 zend_object *php_ds_queue_create_object_ex(ds_queue_t *queue); 34 zend_object *php_ds_queue_create_object(zend_class_entry *ce); 35 zend_object *php_ds_queue_create_clone(ds_queue_t *queue); 36 37 PHP_DS_SERIALIZE_FUNCIONS(php_ds_queue); 38 39 #endif 40