forked from php-amqp/php-amqp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
php5_support.h
119 lines (89 loc) · 5.18 KB
/
php5_support.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Alexandre Kalendarev [email protected] Copyright (c) 2009-2010 |
| Lead: |
| - Pieter de Zwart |
| Maintainers: |
| - Brad Rodriguez |
| - Jonathan Tansavatdi |
+----------------------------------------------------------------------+
*/
#ifndef PHP_AMQP_PHP5_SUPPORT_H
#define PHP_AMQP_PHP5_SUPPORT_H
typedef int PHP5to7_param_str_len_type_t;
typedef long PHP5to7_param_long_type_t;
typedef zval* PHP5to7_zval_t;
#define PHP5to7_MAYBE_SET_TO_NULL = NULL
#define PHP5to7_MAYBE_DEREF(zv) (*(zv))
#define PHP5to7_MAYBE_PTR(zv) (zv)
#define PHP5to7_MAYBE_PARAM_PTR(zv) (&(zv))
#define PHP5to7_MAYBE_INIT(zv) MAKE_STD_ZVAL(zv);
#define PHP5to7_ARRAY_INIT(zv) array_init(zv);
#define PHP5to7_MAYBE_DESTROY(zv) zval_ptr_dtor(&(zv));
#define PHP5to7_MAYBE_DESTROY2(zv, pzv) zval_ptr_dtor(&pzv);
#define PHP5to7_ZVAL_STRINGL_DUP(z, s, l) ZVAL_STRINGL((z), (s), (l), 1)
#define PHP5to7_ADD_NEXT_INDEX_STRINGL_DUP(arg, str, length) add_next_index_stringl((arg), (str), (uint)(length), 1)
#define PHP5to7_ZEND_HASH_FIND(ht, str, len, res) \
(zend_hash_find((ht), (str), (uint)(len), (void **) &(res)) != FAILURE)
#define PHP5to7_ZEND_HASH_DEL(ht, key, len) zend_hash_del_key_or_index((ht), (key), (uint)(len), 0, HASH_DEL_KEY);
#define PHP5to7_ZEND_HASH_ADD(ht, key, len, pData, nDataSize) (zend_hash_add((ht), (key), (uint)(len), &(pData), nDataSize, NULL) != FAILURE)
#define PHP5to7_ZEND_HASH_STR_UPD_MEM(ht, key, len, pData, nDataSize) PHP5to7_ZEND_HASH_ADD((ht), (key), (len), (pData), (nDataSize))
#define PHP5to7_ZEND_HASH_STR_FIND_PTR(ht, key, len, res) PHP5to7_ZEND_HASH_FIND((ht), (key), (len), (res))
#define PHP5to7_ZEND_HASH_STR_DEL(ht, key, len) PHP5to7_ZEND_HASH_DEL((ht), (key), (len))
#define PHP5to7_SET_FCI_RETVAL_PTR(fci, pzv) (fci).retval_ptr_ptr = &(pzv);
#define PHP5to7_CHECK_FCI_RETVAL_PTR(fci) ((fci).retval_ptr_ptr && *(fci).retval_ptr_ptr)
#define PHP5to7_IS_FALSE_P(pzv) ((Z_TYPE_P(pzv) == IS_BOOL && !Z_BVAL_P(pzv)))
#define PHP5to7_obj_free_zend_object void
#define PHP5to7_zend_object_value zend_object_value
#define PHP5to7_zend_register_internal_class_ex(ce, parent_ce) zend_register_internal_class_ex((ce), (parent_ce), NULL TSRMLS_CC)
#define PHP5to7_ECALLOC_CONNECTION_OBJECT(ce) (amqp_connection_object*)ecalloc(1, sizeof(amqp_connection_object))
#define PHP5to7_ECALLOC_CHANNEL_OBJECT(ce) (amqp_channel_object*)ecalloc(1, sizeof(amqp_channel_object))
#define PHP5to7_CASE_IS_BOOL case IS_BOOL
#define PHP5to7_READ_PROP_RV_PARAM_DECL
#define PHP5to7_READ_PROP_RV_PARAM_CC
#define PHP5to7_ZEND_REAL_HASH_KEY_T void
#define PHP5to7_ZEND_HASH_FOREACH_KEY_VAL(ht, num_key, real_key, key, key_len, data, val, pos) \
for ( \
zend_hash_internal_pointer_reset_ex((ht), &(pos)); \
zend_hash_get_current_data_ex((ht), (void**) &(data), &(pos)) == SUCCESS && ((value) = *(data)); \
zend_hash_move_forward_ex((ht), &(pos)) \
)
#define PHP5to7_ZEND_HASH_KEY_IS_STRING(ht, real_key, key, key_len, num_key, pos) \
(zend_hash_get_current_key_ex((ht), &(key), &(key_len), &(num_key), 0, &(pos)) == HASH_KEY_IS_STRING)
#define PHP5to7_ZEND_HASH_KEY_MAYBE_UNPACK(real_key, key, key_len)
#define PHP5to7_ZEND_HASH_FOREACH_END()
#define Z_TRY_ADDREF_P(pz) Z_ADDREF_P(pz)
/* Resources stuff */
typedef int PHP5to7_zend_resource_t;
typedef zend_rsrc_list_entry PHP5to7_zend_resource_store_t;
typedef zend_rsrc_list_entry PHP5to7_zend_resource_le_t;
#define PHP5to7_ZEND_RESOURCE_DTOR_ARG rsrc
#define Z_RES_P(le) (le)
#define PHP5to7_ZEND_RESOURCE_EMPTY 0
#define PHP5to7_ZEND_RESOURCE_LE_EMPTY NULL
#define PHP5to7_ZEND_RSRC_TYPE_P(le) Z_TYPE_P(le)
#define PHP5to7_ZEND_REGISTER_RESOURCE(rsrc_pointer, rsrc_type) ZEND_REGISTER_RESOURCE(NULL, (rsrc_pointer), (rsrc_type))
#define PHP5to7_PARENT_CLASS_NAME_C(name) , (name)
#define ZEND_ULONG_FMT "%" PRIu64
#define PHP5to7_ZEND_ACC_FINAL_CLASS ZEND_ACC_FINAL_CLASS
#endif //PHP_AMQP_PHP5_SUPPORT_H
/*
*Local variables:
*tab-width: 4
*c-basic-offset: 4
*End:
*vim600: noet sw=4 ts=4 fdm=marker
*vim<600: noet sw=4 ts=4
*/