This repository has been archived by the owner on Dec 16, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 501
/
handlers.h
132 lines (109 loc) · 7.18 KB
/
handlers.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
120
121
122
123
124
125
126
127
128
129
130
131
132
/*
+----------------------------------------------------------------------+
| pthreads |
+----------------------------------------------------------------------+
| Copyright (c) Joe Watkins 2012 |
+----------------------------------------------------------------------+
| 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 |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Joe Watkins <joe.watkins@live.co.uk> |
+----------------------------------------------------------------------+
*/
/*
* These handlers provide thread-safe read/write/call/count/cast for pthreads objects
*/
#ifndef HAVE_PTHREADS_HANDLERS_H
#define HAVE_PTHREADS_HANDLERS_H
#ifndef HAVE_PTHREADS_H
# include <src/pthreads.h>
#endif
#ifndef HAVE_PTHREADS_STORE_H
# include <src/store.h>
#endif
#define PTHREADS_CAST_PASSTHRU_D zval *from, zval *to, int type TSRMLS_DC
#define PTHREADS_CAST_PASSTHRU_C from, to, type TSRMLS_CC
#define PTHREADS_COUNT_PASSTHRU_D zval *object, long *count TSRMLS_DC
#define PTHREADS_COUNT_PASSTHRU_C object, count TSRMLS_CC
/* {{{ these resolve differences in 5.3 and 5.4 object handling API */
#if PHP_VERSION_ID > 50399
# define PTHREADS_READ_DEBUG_PASSTHRU_D zval *object, int *is_temp TSRMLS_DC
# define PTHREADS_READ_DEBUG_PASSTHRU_C object, is_temp TSRMLS_CC
# define PTHREADS_READ_PROPERTIES_PASSTHRU_D zval *object TSRMLS_DC
# define PTHREADS_READ_PROPERTIES_PASSTHRU_C object TSRMLS_CC
# define PTHREADS_READ_PROPERTY_PASSTHRU_D zval *object, zval *member, int type, const struct _zend_literal *key TSRMLS_DC
# define PTHREADS_READ_DIMENSION_PASSTHRU_D zval *object, zval *member, int type TSRMLS_DC
# define PTHREADS_READ_PROPERTY_PASSTHRU_C object, member, type, key TSRMLS_CC
# define PTHREADS_READ_DIMENSION_PASSTHRU_C object, member, type, NULL TSRMLS_CC
# define PTHREADS_WRITE_PROPERTY_PASSTHRU_D zval *object, zval *member, zval *value, const struct _zend_literal *key TSRMLS_DC
# define PTHREADS_WRITE_DIMENSION_PASSTHRU_D zval *object, zval *member, zval *value TSRMLS_DC
# define PTHREADS_WRITE_PROPERTY_PASSTHRU_C object, member, value, key TSRMLS_CC
# define PTHREADS_WRITE_DIMENSION_PASSTHRU_C object, member, value, NULL TSRMLS_CC
# define PTHREADS_HAS_PROPERTY_PASSTHRU_D zval *object, zval *member, int has_set_exists, const struct _zend_literal *key TSRMLS_DC
# define PTHREADS_HAS_DIMENSION_PASSTHRU_D zval *object, zval *member, int has_set_exists TSRMLS_DC
# define PTHREADS_HAS_PROPERTY_PASSTHRU_C object, member, has_set_exists, key TSRMLS_CC
# define PTHREADS_HAS_DIMENSION_PASSTHRU_C object, member, has_set_exists, NULL TSRMLS_CC
# define PTHREADS_UNSET_PROPERTY_PASSTHRU_D zval *object, zval *member, const struct _zend_literal *key TSRMLS_DC
# define PTHREADS_UNSET_DIMENSION_PASSTHRU_D zval *object, zval *member TSRMLS_DC
# define PTHREADS_UNSET_PROPERTY_PASSTHRU_C object, member, key TSRMLS_CC
# define PTHREADS_UNSET_DIMENSION_PASSTHRU_C object, member, NULL TSRMLS_CC
# define PTHREADS_GET_METHOD_PASSTHRU_D zval **pobject, char *method, int methodl, const struct _zend_literal *key TSRMLS_DC
# define PTHREADS_GET_METHOD_PASSTHRU_C pobject, method, methodl, key TSRMLS_CC
# define PTHREADS_CALL_METHOD_PASSTHRU_D const char *method, INTERNAL_FUNCTION_PARAMETERS
# define PTHREADS_CALL_METHOD_PASSTHRU_C method, INTERNAL_FUNCTION_PARAM_PASSTHRU
#else
# define PTHREADS_READ_DEBUG_PASSTHRU_D zval *object, int *is_temp TSRMLS_DC
# define PTHREADS_READ_DEBUG_PASSTHRU_C object, is_temp TSRMLS_CC
# define PTHREADS_READ_PROPERTIES_PASSTHRU_D zval *object TSRMLS_DC
# define PTHREADS_READ_PROPERTIES_PASSTHRU_C object TSRMLS_CC
# define PTHREADS_READ_PROPERTY_PASSTHRU_D zval *object, zval *member, int type TSRMLS_DC
# define PTHREADS_READ_DIMENSION_PASSTHRU_D PTHREADS_READ_PROPERTY_PASSTHRU_D
# define PTHREADS_READ_PROPERTY_PASSTHRU_C object, member, type TSRMLS_CC
# define PTHREADS_READ_DIMENSION_PASSTHRU_C PTHREADS_READ_PROPERTY_PASSTHRU_C
# define PTHREADS_WRITE_PROPERTY_PASSTHRU_D zval *object, zval *member, zval *value TSRMLS_DC
# define PTHREADS_WRITE_DIMENSION_PASSTHRU_D PTHREADS_WRITE_PROPERTY_PASSTHRU_D
# define PTHREADS_WRITE_PROPERTY_PASSTHRU_C object, member, value TSRMLS_CC
# define PTHREADS_WRITE_DIMENSION_PASSTHRU_C PTHREADS_WRITE_PROPERTY_PASSTHRU_C
# define PTHREADS_HAS_PROPERTY_PASSTHRU_D zval *object, zval *member, int has_set_exists TSRMLS_DC
# define PTHREADS_HAS_DIMENSION_PASSTHRU_D PTHREADS_HAS_PROPERTY_PASSTHRU_D
# define PTHREADS_HAS_PROPERTY_PASSTHRU_C object, member, has_set_exists TSRMLS_CC
# define PTHREADS_HAS_DIMENSION_PASSTHRU_C PTHREADS_HAS_PROPERTY_PASSTHRU_C
# define PTHREADS_UNSET_PROPERTY_PASSTHRU_D zval *object, zval *member TSRMLS_DC
# define PTHREADS_UNSET_DIMENSION_PASSTHRU_D PTHREADS_UNSET_PROPERTY_PASSTHRU_D
# define PTHREADS_UNSET_PROPERTY_PASSTHRU_C object, member TSRMLS_CC
# define PTHREADS_UNSET_DIMENSION_PASSTHRU_C PTHREADS_UNSET_PROPERTY_PASSTHRU_C
# define PTHREADS_GET_METHOD_PASSTHRU_D zval **pobject, char *method, int methodl TSRMLS_DC
# define PTHREADS_GET_METHOD_PASSTHRU_C pobject, method, methodl TSRMLS_CC
# define PTHREADS_CALL_METHOD_PASSTHRU_D char *method, INTERNAL_FUNCTION_PARAMETERS
# define PTHREADS_CALL_METHOD_PASSTHRU_C method, INTERNAL_FUNCTION_PARAM_PASSTHRU
#endif /* }}} */
/* {{{ read proeprties from storage */
HashTable* pthreads_read_debug(PTHREADS_READ_DEBUG_PASSTHRU_D); /* }}} */
/* {{{ read proeprties from storage */
HashTable* pthreads_read_properties(PTHREADS_READ_PROPERTIES_PASSTHRU_D); /* }}} */
/* {{{ read a property from the referenced thread */
zval * pthreads_read_property(PTHREADS_READ_PROPERTY_PASSTHRU_D);
zval * pthreads_read_dimension(PTHREADS_READ_DIMENSION_PASSTHRU_D); /* }}} */
/* {{{ write a property to the referenced thread */
void pthreads_write_property(PTHREADS_WRITE_PROPERTY_PASSTHRU_D);
void pthreads_write_dimension(PTHREADS_WRITE_DIMENSION_PASSTHRU_D); /* }}} */
/* {{{ check if the referenced thread has a specific property */
int pthreads_has_property(PTHREADS_HAS_PROPERTY_PASSTHRU_D);
int pthreads_has_dimension(PTHREADS_HAS_DIMENSION_PASSTHRU_D); /* }}} */
/* {{{ unset a property in the referenced thread */
void pthreads_unset_property(PTHREADS_UNSET_PROPERTY_PASSTHRU_D);
void pthreads_unset_dimension(PTHREADS_UNSET_DIMENSION_PASSTHRU_D); /* }}} */
/* {{{ count properties in storage */
int pthreads_count_properties(PTHREADS_COUNT_PASSTHRU_D); /* }}} */
/* {{{ fetch a pthreads friendly method */
zend_function * pthreads_get_method(PTHREADS_GET_METHOD_PASSTHRU_D); /* }}} */
/* {{{ make a pthreads method call */
int pthreads_call_method(PTHREADS_CALL_METHOD_PASSTHRU_D); /* }}} */
/* {{{ cast an object to a normal array helper */
int pthreads_cast_object(PTHREADS_CAST_PASSTHRU_D); /* }}} */
#endif