-
Notifications
You must be signed in to change notification settings - Fork 622
Open
Description
This is a followup to #969 and remarks from @Propanu and @nxhack , it is not a solution but just a trick to reach a successfull compilation. If anybody with the necessary competences can transform this contribution into a true solution it will be a great step... The changes made are validated by the compiler but I am not sure at all that they are correct or they will yield a totally operational library.
First of all start the compilation with the last master then apply the following patch on the file mraajsJAVASCRIPT_wrap.cxx and restart compilation.
--- mraajsJAVASCRIPT_wrap.cxx
+++ mraajsJAVASCRIPT_wrap.cxx
@@ -782,7 +782,7 @@
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031803)
#define SWIGV8_STRING_NEW2(cstr, len) v8::String::New(cstr, len)
#else
-#define SWIGV8_STRING_NEW2(cstr, len) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), cstr, v8::String::kNormalString, len)
+#define SWIGV8_STRING_NEW2(cstr, len) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), cstr, v8::NewStringType::kNormal, len).ToLocalChecked()
#endif
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
@@ -823,7 +823,7 @@
#define SWIGV8_ADJUST_MEMORY(size) v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size)
#define SWIGV8_CURRENT_CONTEXT() v8::Isolate::GetCurrent()->GetCurrentContext()
#define SWIGV8_THROW_EXCEPTION(err) v8::Isolate::GetCurrent()->ThrowException(err)
-#define SWIGV8_STRING_NEW(str) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str)
+#define SWIGV8_STRING_NEW(str) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str).ToLocalChecked()
#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sym)
#endif
@@ -884,7 +884,7 @@
#define SWIGV8_TO_STRING(handle) (handle)->ToString(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()
#define SWIGV8_NUMBER_VALUE(handle) (handle)->NumberValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
#define SWIGV8_INTEGER_VALUE(handle) (handle)->IntegerValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
-#define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
+#define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue(SWIGV8_CURRENT_CONTEXT()->GetIsolate())
#define SWIGV8_WRITE_UTF8(handle, buffer, len) (handle)->WriteUtf8(v8::Isolate::GetCurrent(), buffer, len)
#define SWIGV8_UTF8_LENGTH(handle) (handle)->Utf8Length(v8::Isolate::GetCurrent())
#endif
@@ -1134,7 +1134,7 @@
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
cdata->handle.MarkIndependent(v8::Isolate::GetCurrent());
#else
- cdata->handle.MarkIndependent();
+ cdata->handle.SetWeak();
#endif
}
@@ -1184,8 +1184,8 @@
}
#endif
-// v8::Handle<v8::Object> result = class_templ->InstanceTemplate()->NewInstance();
- v8::Local<v8::Object> result = class_templ->InstanceTemplate()->NewInstance();
+ v8::Local<v8::ObjectTemplate> result_templ = class_templ->PrototypeTemplate();
+ v8::Local<v8::Object> result = result_templ->NewInstance(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked();
SWIGV8_SetPrivateData(result, ptr, info, flags);
SWIGV8_ESCAPE(result);
@@ -1409,7 +1409,7 @@
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
cdata->handle.MarkIndependent(v8::Isolate::GetCurrent());
#else
- cdata->handle.MarkIndependent();
+ cdata->handle.SetWeak();
#endif
SWIGV8_ESCAPE(obj);
@@ -1441,7 +1441,7 @@
#else
v8::Local<v8::Array> arr = v8::Local<v8::Array>::Cast(result);
#endif
- arr->Set(arr->Length(), obj);
+ arr->Set(SWIGV8_CURRENT_CONTEXT(),arr->Length(), obj);
SWIGV8_ESCAPE(arr);
}
@@ -1473,16 +1473,16 @@
SWIGV8_HANDLESCOPE_ESC();
v8::Local<v8::FunctionTemplate> class_templ = SWIGV8_FUNCTEMPLATE_NEW_VOID();
- class_templ->SetClassName(SWIGV8_SYMBOL_NEW(symbol));
+ class_templ->SetClassName(SWIGV8_SYMBOL_NEW(symbol).ToLocalChecked());
v8::Handle<v8::ObjectTemplate> inst_templ = class_templ->InstanceTemplate();
inst_templ->SetInternalFieldCount(1);
v8::Handle<v8::ObjectTemplate> equals_templ = class_templ->PrototypeTemplate();
- equals_templ->Set(SWIGV8_SYMBOL_NEW("equals"), SWIGV8_FUNCTEMPLATE_NEW(_SWIGV8_wrap_equals));
+ equals_templ->Set(SWIGV8_SYMBOL_NEW("equals").ToLocalChecked(), SWIGV8_FUNCTEMPLATE_NEW(_SWIGV8_wrap_equals), v8::PropertyAttribute::None);
v8::Handle<v8::ObjectTemplate> cptr_templ = class_templ->PrototypeTemplate();
- cptr_templ->Set(SWIGV8_SYMBOL_NEW("getCPtr"), SWIGV8_FUNCTEMPLATE_NEW(_wrap_getCPtr));
+ cptr_templ->Set(SWIGV8_SYMBOL_NEW("getCPtr").ToLocalChecked(), SWIGV8_FUNCTEMPLATE_NEW(_wrap_getCPtr), v8::PropertyAttribute::None);
SWIGV8_ESCAPE(class_templ);
}
@@ -1493,7 +1493,7 @@
SWIGRUNTIME void SWIGV8_AddMemberFunction(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol,
SwigV8FunctionCallback _func) {
v8::Handle<v8::ObjectTemplate> proto_templ = class_templ->PrototypeTemplate();
- proto_templ->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func));
+ proto_templ->Set(SWIGV8_SYMBOL_NEW(symbol).ToLocalChecked(), SWIGV8_FUNCTEMPLATE_NEW(_func), v8::PropertyAttribute::None);
}
/**
@@ -1502,7 +1502,7 @@
SWIGRUNTIME void SWIGV8_AddMemberVariable(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol,
SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) {
v8::Handle<v8::ObjectTemplate> proto_templ = class_templ->InstanceTemplate();
- proto_templ->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter);
+ proto_templ->SetAccessor(SWIGV8_SYMBOL_NEW(symbol).ToLocalChecked(), getter, setter);
}
/**
@@ -1510,7 +1510,7 @@
*/
SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Handle<v8::Object> obj, const char* symbol,
const SwigV8FunctionCallback& _func) {
- obj->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction());
+ obj->Set(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol).ToLocalChecked(), SWIGV8_FUNCTEMPLATE_NEW(_func)->NewRemoteInstance().ToLocalChecked());
}
/**
@@ -1521,7 +1521,7 @@
#if (V8_MAJOR_VERSION-0) < 5
obj->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter);
#else
- obj->SetAccessor(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol), getter, setter);
+ obj->SetAccessor(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol).ToLocalChecked(), getter, setter);
#endif
}
@@ -12392,50 +12392,50 @@
v8::Handle<v8::FunctionTemplate> _exports_uint8Array_class_0 = SWIGV8_CreateClassTemplate("uint8Array");
_exports_uint8Array_class_0->SetCallHandler(_wrap_new_uint8Array);
_exports_uint8Array_class_0->Inherit(_exports_uint8Array_class);
-_exports_uint8Array_class_0->SetHiddenPrototype(true);
-v8::Handle<v8::Object> _exports_uint8Array_obj = _exports_uint8Array_class_0->GetFunction();
+_exports_uint8Array_class_0->ReadOnlyPrototype();
+v8::Handle<v8::Object> _exports_uint8Array_obj = _exports_uint8Array_class_0->NewRemoteInstance().ToLocalChecked();
/* Class: Gpio (_exports_Gpio) */
v8::Handle<v8::FunctionTemplate> _exports_Gpio_class_0 = SWIGV8_CreateClassTemplate("Gpio");
_exports_Gpio_class_0->SetCallHandler(_wrap_new_Gpio);
_exports_Gpio_class_0->Inherit(_exports_Gpio_class);
-_exports_Gpio_class_0->SetHiddenPrototype(true);
-v8::Handle<v8::Object> _exports_Gpio_obj = _exports_Gpio_class_0->GetFunction();
+_exports_Gpio_class_0->ReadOnlyPrototype();
+v8::Handle<v8::Object> _exports_Gpio_obj = _exports_Gpio_class_0->NewRemoteInstance().ToLocalChecked();
/* Class: I2c (_exports_I2c) */
v8::Handle<v8::FunctionTemplate> _exports_I2c_class_0 = SWIGV8_CreateClassTemplate("I2c");
_exports_I2c_class_0->SetCallHandler(_wrap_new_I2c);
_exports_I2c_class_0->Inherit(_exports_I2c_class);
-_exports_I2c_class_0->SetHiddenPrototype(true);
-v8::Handle<v8::Object> _exports_I2c_obj = _exports_I2c_class_0->GetFunction();
+_exports_I2c_class_0->ReadOnlyPrototype();
+v8::Handle<v8::Object> _exports_I2c_obj = _exports_I2c_class_0->NewRemoteInstance().ToLocalChecked();
/* Class: Pwm (_exports_Pwm) */
v8::Handle<v8::FunctionTemplate> _exports_Pwm_class_0 = SWIGV8_CreateClassTemplate("Pwm");
_exports_Pwm_class_0->SetCallHandler(_wrap_new_Pwm);
_exports_Pwm_class_0->Inherit(_exports_Pwm_class);
-_exports_Pwm_class_0->SetHiddenPrototype(true);
-v8::Handle<v8::Object> _exports_Pwm_obj = _exports_Pwm_class_0->GetFunction();
+_exports_Pwm_class_0->ReadOnlyPrototype();
+v8::Handle<v8::Object> _exports_Pwm_obj = _exports_Pwm_class_0->NewRemoteInstance().ToLocalChecked();
/* Class: Spi (_exports_Spi) */
v8::Handle<v8::FunctionTemplate> _exports_Spi_class_0 = SWIGV8_CreateClassTemplate("Spi");
_exports_Spi_class_0->SetCallHandler(_wrap_new_Spi);
_exports_Spi_class_0->Inherit(_exports_Spi_class);
-_exports_Spi_class_0->SetHiddenPrototype(true);
-v8::Handle<v8::Object> _exports_Spi_obj = _exports_Spi_class_0->GetFunction();
+_exports_Spi_class_0->ReadOnlyPrototype();
+v8::Handle<v8::Object> _exports_Spi_obj = _exports_Spi_class_0->NewRemoteInstance().ToLocalChecked();
/* Class: Aio (_exports_Aio) */
v8::Handle<v8::FunctionTemplate> _exports_Aio_class_0 = SWIGV8_CreateClassTemplate("Aio");
_exports_Aio_class_0->SetCallHandler(_wrap_new_Aio);
_exports_Aio_class_0->Inherit(_exports_Aio_class);
-_exports_Aio_class_0->SetHiddenPrototype(true);
-v8::Handle<v8::Object> _exports_Aio_obj = _exports_Aio_class_0->GetFunction();
+_exports_Aio_class_0->ReadOnlyPrototype();
+v8::Handle<v8::Object> _exports_Aio_obj = _exports_Aio_class_0->NewRemoteInstance().ToLocalChecked();
/* Class: Uart (_exports_Uart) */
v8::Handle<v8::FunctionTemplate> _exports_Uart_class_0 = SWIGV8_CreateClassTemplate("Uart");
_exports_Uart_class_0->SetCallHandler(_wrap_new_Uart);
_exports_Uart_class_0->Inherit(_exports_Uart_class);
-_exports_Uart_class_0->SetHiddenPrototype(true);
-v8::Handle<v8::Object> _exports_Uart_obj = _exports_Uart_class_0->GetFunction();
+_exports_Uart_class_0->ReadOnlyPrototype();
+v8::Handle<v8::Object> _exports_Uart_obj = _exports_Uart_class_0->NewRemoteInstance().ToLocalChecked();
/* Class: Led (_exports_Led) */
v8::Handle<v8::FunctionTemplate> _exports_Led_class_0 = SWIGV8_CreateClassTemplate("Led");
_exports_Led_class_0->SetCallHandler(_wrap_new_Led);
_exports_Led_class_0->Inherit(_exports_Led_class);
-_exports_Led_class_0->SetHiddenPrototype(true);
-v8::Handle<v8::Object> _exports_Led_obj = _exports_Led_class_0->GetFunction();
+_exports_Led_class_0->ReadOnlyPrototype();
+v8::Handle<v8::Object> _exports_Led_obj = _exports_Led_class_0->NewRemoteInstance().ToLocalChecked();
/* add static class functions and variables */
@@ -12482,14 +12482,14 @@
/* register classes */
- exports_obj->Set(SWIGV8_SYMBOL_NEW("uint8Array"), _exports_uint8Array_obj);
-exports_obj->Set(SWIGV8_SYMBOL_NEW("Gpio"), _exports_Gpio_obj);
-exports_obj->Set(SWIGV8_SYMBOL_NEW("I2c"), _exports_I2c_obj);
-exports_obj->Set(SWIGV8_SYMBOL_NEW("Pwm"), _exports_Pwm_obj);
-exports_obj->Set(SWIGV8_SYMBOL_NEW("Spi"), _exports_Spi_obj);
-exports_obj->Set(SWIGV8_SYMBOL_NEW("Aio"), _exports_Aio_obj);
-exports_obj->Set(SWIGV8_SYMBOL_NEW("Uart"), _exports_Uart_obj);
-exports_obj->Set(SWIGV8_SYMBOL_NEW("Led"), _exports_Led_obj);
+exports_obj->Set(SWIGV8_CURRENT_CONTEXT(), _exports_uint8Array_obj, SWIGV8_SYMBOL_NEW("uint8Array").ToLocalChecked());
+exports_obj->Set(SWIGV8_CURRENT_CONTEXT(), _exports_Gpio_obj, SWIGV8_SYMBOL_NEW("Gpio").ToLocalChecked());
+exports_obj->Set(SWIGV8_CURRENT_CONTEXT(), _exports_I2c_obj, SWIGV8_SYMBOL_NEW("I2c").ToLocalChecked());
+exports_obj->Set(SWIGV8_CURRENT_CONTEXT(), _exports_Pwm_obj, SWIGV8_SYMBOL_NEW("Pwm").ToLocalChecked());
+exports_obj->Set(SWIGV8_CURRENT_CONTEXT(), _exports_Spi_obj, SWIGV8_SYMBOL_NEW("Spi").ToLocalChecked());
+exports_obj->Set(SWIGV8_CURRENT_CONTEXT(), _exports_Aio_obj, SWIGV8_SYMBOL_NEW("Aio").ToLocalChecked());
+exports_obj->Set(SWIGV8_CURRENT_CONTEXT(), _exports_Uart_obj, SWIGV8_SYMBOL_NEW("Uart").ToLocalChecked());
+exports_obj->Set(SWIGV8_CURRENT_CONTEXT(), _exports_Led_obj, SWIGV8_SYMBOL_NEW("Led").ToLocalChecked());
/* create and register namespace objects */
Metadata
Metadata
Assignees
Labels
No labels