mirror of
https://github.com/phpv8/v8js.git
synced 2024-12-21 16:31:53 +00:00
remove SINCE74(...) and SINCE80(...) macro fluff
This commit is contained in:
parent
6be2206aab
commit
9b3d1d1c8f
@ -506,7 +506,7 @@ static PHP_METHOD(V8Js, __construct)
|
||||
V8JS_GLOBAL(isolate)->DefineOwnProperty(context, object_name_js, php_obj, v8::ReadOnly);
|
||||
|
||||
/* Export public property values */
|
||||
HashTable *properties = zend_std_get_properties(SINCE80(Z_OBJ_P(getThis()), getThis()));
|
||||
HashTable *properties = zend_std_get_properties(Z_OBJ_P(getThis()));
|
||||
zval *value;
|
||||
zend_string *member;
|
||||
|
||||
@ -1305,13 +1305,10 @@ const zend_function_entry v8js_methods[] = { /* {{{ */
|
||||
|
||||
|
||||
/* V8Js object handlers */
|
||||
static SINCE74(zval*, void) v8js_write_property(SINCE80(zend_object, zval) *_object, SINCE80(zend_string, zval) *_member, zval *value, void **cache_slot) /* {{{ */
|
||||
static zval* v8js_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot) /* {{{ */
|
||||
{
|
||||
zend_object *object = SINCE80(_object, Z_OBJ_P(_object));
|
||||
zend_string *member = SINCE80(_member, Z_STR_P(_member));
|
||||
|
||||
v8js_ctx *c = Z_V8JS_CTX_OBJ(object);
|
||||
V8JS_CTX_PROLOGUE_EX(c, SINCE74(value,));
|
||||
V8JS_CTX_PROLOGUE_EX(c, value);
|
||||
|
||||
/* Check whether member is public, if so, export to V8. */
|
||||
zend_property_info *property_info = zend_get_property_info(c->std.ce, member, 1);
|
||||
@ -1326,7 +1323,7 @@ static SINCE74(zval*, void) v8js_write_property(SINCE80(zend_object, zval) *_obj
|
||||
if (ZSTR_LEN(member) > std::numeric_limits<int>::max()) {
|
||||
zend_throw_exception(php_ce_v8js_exception,
|
||||
"Property name exceeds maximum supported length", 0);
|
||||
return SINCE74(value,);
|
||||
return value;
|
||||
}
|
||||
|
||||
/* Write value to PHP JS object */
|
||||
@ -1335,15 +1332,12 @@ static SINCE74(zval*, void) v8js_write_property(SINCE80(zend_object, zval) *_obj
|
||||
}
|
||||
|
||||
/* Write value to PHP object */
|
||||
SINCE74(return,) std_object_handlers.write_property(SINCE80(object, _object), SINCE80(member, _member), value, NULL);
|
||||
return std_object_handlers.write_property(object, member, value, NULL);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void v8js_unset_property(SINCE80(zend_object, zval) *_object, SINCE80(zend_string, zval) *_member, void **cache_slot) /* {{{ */
|
||||
static void v8js_unset_property(zend_object *object, zend_string *member, void **cache_slot) /* {{{ */
|
||||
{
|
||||
zend_object *object = SINCE80(_object, Z_OBJ_P(_object));
|
||||
zend_string *member = SINCE80(_member, Z_STR_P(_member));
|
||||
|
||||
V8JS_BEGIN_CTX_OBJ(c, object);
|
||||
/* Global PHP JS object */
|
||||
v8::Local<v8::String> object_name_js = v8::Local<v8::String>::New(isolate, c->object_name);
|
||||
@ -1361,7 +1355,7 @@ static void v8js_unset_property(SINCE80(zend_object, zval) *_object, SINCE80(zen
|
||||
jsobj->Delete(v8_context, key);
|
||||
|
||||
/* Unset from PHP object */
|
||||
std_object_handlers.unset_property(SINCE80(object, _object), SINCE80(member, _member), NULL);
|
||||
std_object_handlers.unset_property(object, member, NULL);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -133,7 +133,7 @@ v8::Local<v8::Value> zval_to_v8js(zval *value, v8::Isolate *isolate) /* {{{ */
|
||||
ce = php_date_get_date_ce();
|
||||
if (instanceof_function(Z_OBJCE_P(value), ce)) {
|
||||
zval dtval;
|
||||
zend_call_method_with_0_params(SINCE80(Z_OBJ_P(value), value), NULL, NULL, "getTimestamp", &dtval);
|
||||
zend_call_method_with_0_params(Z_OBJ_P(value), NULL, NULL, "getTimestamp", &dtval);
|
||||
v8::Date::New(isolate->GetEnteredOrMicrotaskContext(), ((double)Z_LVAL(dtval) * 1000.0)).ToLocal(&jsValue);
|
||||
zval_dtor(&dtval);
|
||||
} else
|
||||
|
@ -51,7 +51,7 @@ void v8js_create_script_exception(zval *return_value, v8::Isolate *isolate, v8::
|
||||
object_init_ex(return_value, php_ce_v8js_script_exception);
|
||||
|
||||
#define PHPV8_EXPROP(type, name, value) \
|
||||
zend_update_property##type(php_ce_v8js_script_exception, SINCE80(Z_OBJ_P(return_value), return_value), #name, sizeof(#name) - 1, value);
|
||||
zend_update_property##type(php_ce_v8js_script_exception, Z_OBJ_P(return_value), #name, sizeof(#name) - 1, value);
|
||||
|
||||
|
||||
if (tc_message.IsEmpty()) {
|
||||
@ -137,7 +137,7 @@ void v8js_throw_script_exception(v8::Isolate *isolate, v8::TryCatch *try_catch)
|
||||
if (zend_parse_parameters_none() == FAILURE) { \
|
||||
return; \
|
||||
} \
|
||||
value = zend_read_property(php_ce_v8js_script_exception, SINCE80(Z_OBJ_P(getThis()), getThis()), #property, sizeof(#property) - 1, 0, &rv); \
|
||||
value = zend_read_property(php_ce_v8js_script_exception, Z_OBJ_P(getThis()), #property, sizeof(#property) - 1, 0, &rv); \
|
||||
RETURN_ZVAL(value, 1, 0); \
|
||||
}
|
||||
|
||||
|
@ -787,7 +787,7 @@ v8::Local<v8::Value> v8js_named_property_callback(v8::Local<v8::Name> property_n
|
||||
const zend_object_handlers *h = object->handlers;
|
||||
|
||||
if (callback_type == V8JS_PROP_QUERY) {
|
||||
if (h->has_property(&zobject, SINCE80(Z_STR_P(&zname), &zname), 0, NULL)) {
|
||||
if (h->has_property(&zobject, Z_STR_P(&zname), 0, NULL)) {
|
||||
ret_value = V8JS_UINT(v8::None);
|
||||
} else {
|
||||
ret_value = v8::Local<v8::Value>(); // empty handle
|
||||
@ -798,7 +798,7 @@ v8::Local<v8::Value> v8js_named_property_callback(v8::Local<v8::Name> property_n
|
||||
if(!property_info ||
|
||||
(property_info != ZEND_WRONG_PROPERTY_INFO &&
|
||||
property_info->flags & ZEND_ACC_PUBLIC)) {
|
||||
h->unset_property(&zobject, SINCE80(Z_STR_P(&zname), &zname), NULL);
|
||||
h->unset_property(&zobject, Z_STR_P(&zname), NULL);
|
||||
ret_value = V8JS_TRUE();
|
||||
}
|
||||
else {
|
||||
|
@ -88,9 +88,6 @@ int v8js_get_properties_hash(v8::Local<v8::Value> jsValue, HashTable *retval, in
|
||||
V8JS_CTX_PROLOGUE(ctx);
|
||||
|
||||
|
||||
#define SINCE74(x,y) x
|
||||
#define SINCE80(x,y) x
|
||||
|
||||
// polyfill for ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX, which changes between 7.1 and 7.2
|
||||
#define V8_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null)
|
||||
|
@ -45,10 +45,8 @@ static zend_object_handlers v8js_v8generator_handlers;
|
||||
#define V8JS_V8_INVOKE_FUNC_NAME "V8Js::V8::Invoke"
|
||||
|
||||
/* V8 Object handlers */
|
||||
static int v8js_v8object_has_property(SINCE80(zend_object, zval) *_object, SINCE80(zend_string, zval) *_member, int has_set_exists, void **cache_slot) /* {{{ */
|
||||
static int v8js_v8object_has_property(zend_object *object, zend_string *member, int has_set_exists, void **cache_slot) /* {{{ */
|
||||
{
|
||||
zend_object *object = SINCE80(_object, Z_OBJ_P(_object));
|
||||
zend_string *member = SINCE80(_member, Z_STR_P(_member));
|
||||
/* param has_set_exists:
|
||||
* 0 (has) whether property exists and is not NULL - isset()
|
||||
* 1 (set) whether property exists and is true-ish - empty()
|
||||
@ -128,11 +126,8 @@ static int v8js_v8object_has_property(SINCE80(zend_object, zval) *_object, SINCE
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static zval *v8js_v8object_read_property(SINCE80(zend_object, zval) *_object, SINCE80(zend_string, zval) *_member, int type, void **cache_slot, zval *rv) /* {{{ */
|
||||
static zval *v8js_v8object_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv) /* {{{ */
|
||||
{
|
||||
zend_object *object = SINCE80(_object, Z_OBJ_P(_object));
|
||||
zend_string *member = SINCE80(_member, Z_STR_P(_member));
|
||||
|
||||
zval *retval = rv;
|
||||
v8js_v8object *obj = Z_V8JS_V8OBJECT_OBJ(object);
|
||||
|
||||
@ -140,7 +135,7 @@ static zval *v8js_v8object_read_property(SINCE80(zend_object, zval) *_object, SI
|
||||
{
|
||||
zend_throw_exception(php_ce_v8js_exception,
|
||||
"Can't access V8Object after V8Js instance is destroyed!", 0);
|
||||
return SINCE80(&EG(uninitialized_zval), retval);
|
||||
return &EG(uninitialized_zval);
|
||||
}
|
||||
|
||||
V8JS_CTX_PROLOGUE_EX(obj->ctx, retval);
|
||||
@ -152,7 +147,7 @@ static zval *v8js_v8object_read_property(SINCE80(zend_object, zval) *_object, SI
|
||||
{
|
||||
zend_throw_exception(php_ce_v8js_exception,
|
||||
"Member name length exceeds maximum supported length", 0);
|
||||
return SINCE80(&EG(uninitialized_zval), retval);
|
||||
return &EG(uninitialized_zval);
|
||||
}
|
||||
|
||||
v8::Local<v8::String> jsKey = V8JS_ZSYM(member);
|
||||
@ -174,34 +169,31 @@ static zval *v8js_v8object_read_property(SINCE80(zend_object, zval) *_object, SI
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static zval *v8js_v8object_get_property_ptr_ptr(SINCE80(zend_object, zval) *object, SINCE80(zend_string, zval) *member, int type, void **cache_slot) /* {{{ */
|
||||
static zval *v8js_v8object_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot) /* {{{ */
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static SINCE74(zval *, void) v8js_v8object_write_property(SINCE80(zend_object, zval) *_object, SINCE80(zend_string, zval) *_member, zval *value, void **cache_slot) /* {{{ */
|
||||
static zval *v8js_v8object_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot) /* {{{ */
|
||||
{
|
||||
zend_object *object = SINCE80(_object, Z_OBJ_P(_object));
|
||||
zend_string *member = SINCE80(_member, Z_STR_P(_member));
|
||||
|
||||
v8js_v8object *obj = Z_V8JS_V8OBJECT_OBJ(object);
|
||||
|
||||
if (!obj->ctx)
|
||||
{
|
||||
zend_throw_exception(php_ce_v8js_exception,
|
||||
"Can't access V8Object after V8Js instance is destroyed!", 0);
|
||||
return SINCE74(value, );
|
||||
return value;
|
||||
}
|
||||
|
||||
V8JS_CTX_PROLOGUE_EX(obj->ctx, SINCE74(value, ));
|
||||
V8JS_CTX_PROLOGUE_EX(obj->ctx, value);
|
||||
v8::Local<v8::Value> v8objHandle = v8::Local<v8::Value>::New(isolate, obj->v8obj);
|
||||
|
||||
if (ZSTR_LEN(member) > std::numeric_limits<int>::max())
|
||||
{
|
||||
zend_throw_exception(php_ce_v8js_exception,
|
||||
"Member name length exceeds maximum supported length", 0);
|
||||
return SINCE74(value, );
|
||||
return value;
|
||||
}
|
||||
|
||||
v8::Local<v8::Object> v8obj;
|
||||
@ -210,15 +202,12 @@ static SINCE74(zval *, void) v8js_v8object_write_property(SINCE80(zend_object, z
|
||||
v8obj->CreateDataProperty(v8_context, V8JS_ZSYM(member), zval_to_v8js(value, isolate));
|
||||
}
|
||||
|
||||
return SINCE74(value, );
|
||||
return value;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void v8js_v8object_unset_property(SINCE80(zend_object, zval) *_object, SINCE80(zend_string, zval) *_member, void **cache_slot) /* {{{ */
|
||||
static void v8js_v8object_unset_property(zend_object *object, zend_string *member, void **cache_slot) /* {{{ */
|
||||
{
|
||||
zend_object *object = SINCE80(_object, Z_OBJ_P(_object));
|
||||
zend_string *member = SINCE80(_member, Z_STR_P(_member));
|
||||
|
||||
v8js_v8object *obj = Z_V8JS_V8OBJECT_OBJ(object);
|
||||
|
||||
if (!obj->ctx)
|
||||
@ -246,9 +235,9 @@ static void v8js_v8object_unset_property(SINCE80(zend_object, zval) *_object, SI
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static HashTable *v8js_v8object_get_properties(SINCE80(zend_object, zval) *object) /* {{{ */
|
||||
static HashTable *v8js_v8object_get_properties(zend_object *object) /* {{{ */
|
||||
{
|
||||
v8js_v8object *obj = SINCE80(Z_V8JS_V8OBJECT_OBJ, Z_V8JS_V8OBJECT_OBJ_P)(object);
|
||||
v8js_v8object *obj = Z_V8JS_V8OBJECT_OBJ(object);
|
||||
|
||||
if (obj->properties == NULL)
|
||||
{
|
||||
@ -287,7 +276,7 @@ static HashTable *v8js_v8object_get_properties(SINCE80(zend_object, zval) *objec
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static HashTable *v8js_v8object_get_debug_info(SINCE80(zend_object, zval) *object, int *is_temp) /* {{{ */
|
||||
static HashTable *v8js_v8object_get_debug_info(zend_object *object, int *is_temp) /* {{{ */
|
||||
{
|
||||
*is_temp = 0;
|
||||
return v8js_v8object_get_properties(object);
|
||||
@ -426,7 +415,7 @@ static ZEND_FUNCTION(zend_v8object_func)
|
||||
static zend_function *v8js_v8object_get_method(zend_object **object_ptr, zend_string *method, const zval *key) /* {{{ */
|
||||
{
|
||||
v8js_v8object *obj = v8js_v8object_fetch_object(*object_ptr);
|
||||
SINCE80(zend_internal_function, zend_function) *f;
|
||||
zend_internal_function *f;
|
||||
|
||||
if (!obj->ctx)
|
||||
{
|
||||
@ -581,8 +570,8 @@ static int v8js_v8object_call_method(zend_string *method, zend_object *object, I
|
||||
|
||||
static int v8js_v8object_get_closure(zend_object *object, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **zobj_ptr, bool call) /* {{{ */
|
||||
{
|
||||
SINCE80(zend_internal_function, zend_function) *invoke;
|
||||
v8js_v8object *obj = SINCE80(Z_V8JS_V8OBJECT_OBJ, Z_V8JS_V8OBJECT_OBJ_P)(object);
|
||||
zend_internal_function *invoke;
|
||||
v8js_v8object *obj = Z_V8JS_V8OBJECT_OBJ(object);
|
||||
|
||||
if (!obj->ctx)
|
||||
{
|
||||
@ -609,7 +598,7 @@ static int v8js_v8object_get_closure(zend_object *object, zend_class_entry **ce_
|
||||
|
||||
if (zobj_ptr)
|
||||
{
|
||||
*zobj_ptr = SINCE80(object, Z_OBJ_P(object));
|
||||
*zobj_ptr = object;
|
||||
}
|
||||
|
||||
*ce_ptr = NULL;
|
||||
@ -1034,7 +1023,6 @@ PHP_MINIT_FUNCTION(v8js_v8object_class) /* {{{ */
|
||||
v8js_v8object_handlers.unset_property = v8js_v8object_unset_property;
|
||||
v8js_v8object_handlers.get_properties = v8js_v8object_get_properties;
|
||||
v8js_v8object_handlers.get_method = v8js_v8object_get_method;
|
||||
SINCE80(, v8js_v8object_handlers.call_method = v8js_v8object_call_method);
|
||||
v8js_v8object_handlers.get_debug_info = v8js_v8object_get_debug_info;
|
||||
v8js_v8object_handlers.get_closure = v8js_v8object_get_closure;
|
||||
v8js_v8object_handlers.offset = XtOffsetOf(struct v8js_v8object, std);
|
||||
|
Loading…
Reference in New Issue
Block a user