This repository was archived by the owner on Mar 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathphp_v8_callback_info.cc
128 lines (96 loc) · 3.74 KB
/
php_v8_callback_info.cc
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
/*
* This file is part of the pinepain/php-v8 PHP extension.
*
* Copyright (c) 2015-2017 Bogdan Padalko <[email protected]>
*
* Licensed under the MIT license: http://opensource.org/licenses/MIT
*
* For the full copyright and license information, please view the
* LICENSE file that was distributed with this source or visit
* http://opensource.org/licenses/MIT
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php_v8_callback_info.h"
#include "php_v8_return_value.h"
#include "php_v8_value.h"
#include "php_v8.h"
zend_class_entry *php_v8_callback_info_class_entry;
#define this_ce php_v8_callback_info_class_entry
static zend_object_handlers php_v8_callback_info_object_handlers;
static PHP_METHOD(CallbackInfo, getIsolate) {
zval rv;
zval *tmp;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
tmp = zend_read_property(this_ce, getThis(), ZEND_STRL("isolate"), 0, &rv);
ZVAL_COPY(return_value, tmp);
}
static PHP_METHOD(CallbackInfo, getContext) {
zval rv;
zval *tmp;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
tmp = zend_read_property(this_ce, getThis(), ZEND_STRL("context"), 0, &rv);
ZVAL_COPY(return_value, tmp);
}
static PHP_METHOD(CallbackInfo, this) {
zval rv;
zval *tmp;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
tmp = zend_read_property(this_ce, getThis(), ZEND_STRL("this"), 0, &rv);
ZVAL_COPY(return_value, tmp);
}
static PHP_METHOD(CallbackInfo, holder) {
zval rv;
zval *tmp;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
tmp = zend_read_property(this_ce, getThis(), ZEND_STRL("holder"), 0, &rv);
ZVAL_COPY(return_value, tmp);
}
static PHP_METHOD(CallbackInfo, getReturnValue) {
zval rv;
zval *tmp;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
tmp = zend_read_property(this_ce, getThis(), ZEND_STRL("return_value"), 0, &rv);
ZVAL_COPY(return_value, tmp);
}
PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getIsolate, ZEND_RETURN_VALUE, 0, V8\\Isolate, 0)
ZEND_END_ARG_INFO()
PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getContext, ZEND_RETURN_VALUE, 0, V8\\Context, 0)
ZEND_END_ARG_INFO()
PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_this, ZEND_RETURN_VALUE, 0, V8\\ObjectValue, 0)
ZEND_END_ARG_INFO()
PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_holder, ZEND_RETURN_VALUE, 0, V8\\ObjectValue, 0)
ZEND_END_ARG_INFO()
PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getReturnValue, ZEND_RETURN_VALUE, 0, V8\\ReturnValue, 0)
ZEND_END_ARG_INFO()
static const zend_function_entry php_v8_callback_info_methods[] = {
PHP_V8_ME(CallbackInfo, this, ZEND_ACC_PUBLIC)
PHP_V8_ME(CallbackInfo, holder, ZEND_ACC_PUBLIC)
PHP_V8_ME(CallbackInfo, getIsolate, ZEND_ACC_PUBLIC)
PHP_V8_ME(CallbackInfo, getContext, ZEND_ACC_PUBLIC)
PHP_V8_ME(CallbackInfo, getReturnValue, ZEND_ACC_PUBLIC)
PHP_FE_END
};
PHP_MINIT_FUNCTION (php_v8_callback_info) {
zend_class_entry ce;
INIT_NS_CLASS_ENTRY(ce, PHP_V8_NS, "CallbackInfo", php_v8_callback_info_methods);
this_ce = zend_register_internal_class(&ce);
memcpy(&php_v8_callback_info_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
zend_declare_property_null(this_ce, ZEND_STRL("isolate"), ZEND_ACC_PRIVATE);
zend_declare_property_null(this_ce, ZEND_STRL("context"), ZEND_ACC_PRIVATE);
zend_declare_property_null(this_ce, ZEND_STRL("this"), ZEND_ACC_PRIVATE);
zend_declare_property_null(this_ce, ZEND_STRL("holder"), ZEND_ACC_PRIVATE);
zend_declare_property_null(this_ce, ZEND_STRL("return_value"), ZEND_ACC_PRIVATE);
return SUCCESS;
}