felipealmeida pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=297415cc53ebf7746642eb2e1c6c011b441bea01
commit 297415cc53ebf7746642eb2e1c6c011b441bea01 Author: Felipe Magno de Almeida <fel...@expertisesolutions.com.br> Date: Tue Oct 25 12:21:34 2016 -0200 js: Fix compilation of new data types in JS binding --- src/Makefile_Eolian_Js.am | 4 ++-- src/bin/eolian_js/main.cc | 3 ++- src/bindings/js/eina_js/eina_js_compatibility.hh | 6 ++++++ src/bindings/js/eina_js/eina_js_get_value.hh | 13 +++++++++++++ src/bindings/js/eina_js/eina_js_get_value_from_c.hh | 7 +++++++ src/bindings/js/eo_js/eo_js_constructor.hh | 2 +- 6 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/Makefile_Eolian_Js.am b/src/Makefile_Eolian_Js.am index b15fa87..8f6ba5c 100644 --- a/src/Makefile_Eolian_Js.am +++ b/src/Makefile_Eolian_Js.am @@ -52,7 +52,7 @@ tests_eolian_js_libeolian_js_suite_la_CPPFLAGS = \ -DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/eolian_js\" \ @CHECK_CFLAGS@ @EOLIAN_CXX_CFLAGS@ @EINA_JS_CFLAGS@ @EO_JS_CFLAGS@ \ @EOLIAN_CFLAGS@ @EINA_CFLAGS@ @EO_CFLAGS@ @ECORE_CFLAGS@ @EINA_CXX_CFLAGS@ \ -@EO_JS_CFLAGS@ @EO_CXX_CFLAGS@ +@EO_JS_CFLAGS@ @EO_CXX_CFLAGS@ @ECORE_CXX_CFLAGS@ tests_eolian_js_libeolian_js_suite_la_LIBADD = \ @CHECK_LIBS@ @USE_EO_LIBS@ @USE_EINA_LIBS@ @USE_EOLIAN_LIBS@ @USE_EFL_JS_LIBS@ tests_eolian_js_libeolian_js_suite_la_DEPENDENCIES = @USE_EINA_INTERNAL_LIBS@ @USE_EO_INTERNAL_LIBS@ @USE_EFL_JS_INTERNAL_LIBS@ @@ -109,7 +109,7 @@ tests_eolian_js_eolian_js_suite_CPPFLAGS = \ -DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/eolian_js\" \ @CHECK_CFLAGS@ @EOLIAN_CXX_CFLAGS@ @EINA_JS_CFLAGS@ @EO_JS_CFLAGS@ @EFL_JS_CFLAGS@ \ @EOLIAN_CFLAGS@ @EINA_CFLAGS@ @EO_CFLAGS@ @ECORE_CFLAGS@ @EINA_CXX_CFLAGS@ \ -@EO_JS_CFLAGS@ @EO_CXX_CFLAGS@ @EFL_JS_CFLAGS@ +@EO_JS_CFLAGS@ @EO_CXX_CFLAGS@ @EFL_JS_CFLAGS@ @ECORE_CXX_CFLAGS@ tests_eolian_js_eolian_js_suite_LDADD = \ @CHECK_LIBS@ @USE_EO_LIBS@ @USE_EINA_LIBS@ @USE_EOLIAN_LIBS@ @USE_EFL_JS_LIBS@ @USE_EVAS_LIBS@ @USE_EFL_JS_LIBS@ diff --git a/src/bin/eolian_js/main.cc b/src/bin/eolian_js/main.cc index d38700c..14d4e65 100644 --- a/src/bin/eolian_js/main.cc +++ b/src/bin/eolian_js/main.cc @@ -157,7 +157,8 @@ _eolian_type_cpp_type_named_get(const Eolian_Type *tp, std::string const& caller {"promise", "Eina_Promise"}, {"string", "const char*"}, {"void_ptr", "void *"}, - {"stringshare", "Eina_Stringshare*"} + {"stringshare", "Eina_Stringshare*"}, + {"future", "Efl_Future*"} }; diff --git a/src/bindings/js/eina_js/eina_js_compatibility.hh b/src/bindings/js/eina_js/eina_js_compatibility.hh index 7b5c920..37a9457 100644 --- a/src/bindings/js/eina_js/eina_js_compatibility.hh +++ b/src/bindings/js/eina_js/eina_js_compatibility.hh @@ -308,6 +308,12 @@ R wrap_value(T v, value_tag<eina::js::complex_tag<T, U...>>) return R {v}; } +template <typename R, typename T, typename... U> +R wrap_value(T const& v, value_tag<eina::js::complex_tag<T*, U...>>) +{ + return R {const_cast<T*>(&v)}; +} + template <typename T = v8::External> struct _libv8_isolate_test { diff --git a/src/bindings/js/eina_js/eina_js_get_value.hh b/src/bindings/js/eina_js/eina_js_get_value.hh index 856e21f..3a96970 100644 --- a/src/bindings/js/eina_js/eina_js_get_value.hh +++ b/src/bindings/js/eina_js/eina_js_get_value.hh @@ -111,6 +111,19 @@ inline Eo* get_value_from_javascript return get_value_from_javascript(v, isolate, class_name, value_tag<Eo*>(), throw_js_exception); } +// Futures +template <typename ClassGetter> +Eo* get_value_from_javascript + (v8::Local<v8::Value> + , v8::Isolate* + , const char* + , value_tag<complex_tag<Eo**, void*, ClassGetter>> + , bool = true) +{ + throw std::logic_error(""); + return nullptr; +} + template <typename T> inline T get_value_from_javascript (v8::Local<v8::Value> v diff --git a/src/bindings/js/eina_js/eina_js_get_value_from_c.hh b/src/bindings/js/eina_js/eina_js_get_value_from_c.hh index 4d71229..f949ae6 100644 --- a/src/bindings/js/eina_js/eina_js_get_value_from_c.hh +++ b/src/bindings/js/eina_js/eina_js_get_value_from_c.hh @@ -200,6 +200,13 @@ get_value_from_c(efl::eina::js::complex_tag<Eina_Accessor *, T, K> v, v8::Isolat template <typename T, typename K> inline v8::Local<v8::Value> +get_value_from_c(efl::eina::js::complex_tag<Eo**, T, K>, v8::Isolate*, const char*) +{ + throw std::logic_error(""); +} + +template <typename T, typename K> +inline v8::Local<v8::Value> get_value_from_c(efl::eina::js::complex_tag<const Eina_Accessor *, T, K> v, v8::Isolate* isolate, const char* class_name) { // TODO implement const accessor? diff --git a/src/bindings/js/eo_js/eo_js_constructor.hh b/src/bindings/js/eo_js/eo_js_constructor.hh index 191eb9d..e0c0f2f 100644 --- a/src/bindings/js/eo_js/eo_js_constructor.hh +++ b/src/bindings/js/eo_js/eo_js_constructor.hh @@ -109,7 +109,7 @@ struct constructor_caller Eo* eo = efl_add (klass , parent - , eina::_mpl::for_each(constructors, call{efl_self, ¤t_index, &args}) + , eina::_mpl::for_each(constructors, call{efl_added, ¤t_index, &args}) ); if (!eo) throw std::logic_error("Failed to create object."); --