aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2018-01-07 16:00:54 -0200
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2018-01-07 16:00:54 -0200
commitedbf07cd1f0eb1129598b23d7e156c6600e348c6 (patch)
tree6167a65c78fd48bb5c6eb95fd42a719be3818498
parenteolian-js: Start using eolian_cxx grammar library (diff)
downloadefl-edbf07cd1f0eb1129598b23d7e156c6600e348c6.tar.gz
efl-js: Lots of changes
-rw-r--r--src/Makefile_Efl_Js.am54
-rw-r--r--src/bin/eolian_js/eolian/grammar/class_registration.hpp47
-rw-r--r--src/bin/eolian_js/main.cc45
-rw-r--r--src/bindings/js/efl_js/efl_js.cc481
-rw-r--r--src/bindings/js/eo_js/Eo_Js.hh1
-rw-r--r--src/bindings/js/eo_js/eo_js_constructor.hh299
-rw-r--r--src/bindings/js/eo_js/eo_js_namespace_accessor.hh20
7 files changed, 357 insertions, 590 deletions
diff --git a/src/Makefile_Efl_Js.am b/src/Makefile_Efl_Js.am
index 085f05f3e5..addf072949 100644
--- a/src/Makefile_Efl_Js.am
+++ b/src/Makefile_Efl_Js.am
@@ -56,29 +56,33 @@ bin_efl_js_eflv8js_LDADD = \
endif
-bindings/js/efl_js/eolian_js_bindings.cc: $(GENERATED_JS_BINDINGS)
- @echo @ECHO_E@ "#ifdef HAVE_CONFIG_H" > $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
- @echo @ECHO_E@ "#include \"config.h\"" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
- @echo @ECHO_E@ "#include \"elementary_config.h\"" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
- @echo @ECHO_E@ "#endif\n" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
- @echo @ECHO_E@ "#include <Efl.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
- @echo @ECHO_E@ "#include <Efl_Config.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
- @echo @ECHO_E@ "#include <Ecore.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
- @echo @ECHO_E@ "#include <Eo.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
- @echo @ECHO_E@ "#include <Ecore_Con.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
- @echo @ECHO_E@ "#include <Ecore_Audio.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
- @echo @ECHO_E@ "#include <Evas.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
- @echo @ECHO_E@ "#include <Edje.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
- @echo @ECHO_E@ "#include <Ecore_Con_Eet.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
- @echo @ECHO_E@ "#include <Emotion.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
- @echo @ECHO_E@ "#define ELM_INTERNAL_API_ARGESFSDFEFC" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
- @echo @ECHO_E@ "#include <Elementary.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
- @echo @ECHO_E@ "extern \"C\" {" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
- @echo @ECHO_E@ "#include <elm_widget.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
- @echo @ECHO_E@ "}\n" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
- @for i in $(GENERATED_JS_BINDINGS); do echo "#include <$$i>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc; done
-
-CLEANFILES += bindings/js/efl_js/eolian_js_bindings.cc
+# @echo @ECHO_E@ "#ifdef HAVE_CONFIG_H" > $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
+# @echo @ECHO_E@ "#include \"config.h\"" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
+# @echo @ECHO_E@ "#include \"elementary_config.h\"" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
+# @echo @ECHO_E@ "#endif\n" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
+# @echo @ECHO_E@ "#include <Efl.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
+# @echo @ECHO_E@ "#include <Efl_Config.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
+# @echo @ECHO_E@ "#include <Ecore.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
+# @echo @ECHO_E@ "#include <Eo.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
+# @echo @ECHO_E@ "#include <Ecore_Con.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
+# @echo @ECHO_E@ "#include <Ecore_Audio.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
+# @echo @ECHO_E@ "#include <Evas.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
+# @echo @ECHO_E@ "#include <Edje.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
+# @echo @ECHO_E@ "#include <Ecore_Con_Eet.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
+# @echo @ECHO_E@ "#include <Emotion.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
+# @echo @ECHO_E@ "#define ELM_INTERNAL_API_ARGESFSDFEFC" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
+# @echo @ECHO_E@ "#include <Elementary.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
+# @echo @ECHO_E@ "extern \"C\" {" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
+# @echo @ECHO_E@ "#include <elm_widget.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
+# @echo @ECHO_E@ "}\n" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
+# @echo @ECHO_E@ "#include <Eina_Js.hh>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
+# @echo @ECHO_E@ "#include <Eo_Js.hh>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
+
+bindings/js/efl_js/eolian_js_bindings.hh: $(GENERATED_JS_BINDINGS)
+ @echo @ECHO_E@ "" > $@
+ @for i in $(GENERATED_JS_BINDINGS); do echo "#include <$$i>" >> $@; done
+
+CLEANFILES += bindings/js/efl_js/eolian_js_bindings.hh
## Install Ecore-JS headers
installed_ecorejsheadersdir = $(includedir)/ecore-js-@VMAJ@
@@ -160,8 +164,7 @@ bindings/js/eio_js/eio_js.cc \
bindings/js/efl_js/efl_js.cc \
bindings/js/ethumb_js/ethumb_js_client.cc
-nodist_bindings_js_efl_js_libefl_js_la_SOURCES = \
-bindings/js/efl_js/eolian_js_bindings.cc
+bindings/js/efl_js/bindings_js_efl_js_libefl_js_la-efl_js.l$(OBJEXT): bindings/js/efl_js/eolian_js_bindings.hh
bindings/js/efl_js/efl_js.cc $(bindings_js_efl_js_libefl_js_la_SOURCES): $(ecore_eolian_cxx_public_hh) $(ecore_eolian_cxx_public_impl_hh) $(eo_eolian_cxx_public_hh) $(eo_eolian_cxx_public_impl_hh) $(efl_eolian_cxx_public_hh) $(efl_eolian_cxx_public_impl_hh) lib/ecore/Ecore.eo.hh
@@ -169,6 +172,7 @@ bindings_js_efl_js_libefl_js_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
-I$(top_srcdir)/src/lib/efl \
-I$(top_builddir)/src/lib/efl/interfaces/ \
-I$(top_builddir)/src/lib/evas/canvas/ \
+-I$(top_builddir)/src/lib/evas/gesture/ \
-I$(top_builddir)/src/lib/ecore/ \
-I$(top_srcdir)/src/bindings/js/eina_js \
-I$(top_srcdir)/src/bindings/js/ecore_js \
diff --git a/src/bin/eolian_js/eolian/grammar/class_registration.hpp b/src/bin/eolian_js/eolian/grammar/class_registration.hpp
index b0350f792c..11ab61f4bf 100644
--- a/src/bin/eolian_js/eolian/grammar/class_registration.hpp
+++ b/src/bin/eolian_js/eolian/grammar/class_registration.hpp
@@ -2,6 +2,8 @@
#define EOLIAN_JS_CLASS_DEFINITION_HPP
#include <grammar/klass_def.hpp>
+#include <grammar/indentation.hpp>
+#include <grammar/string.hpp>
namespace eolian { namespace js { namespace grammar {
@@ -12,7 +14,52 @@ struct class_registration_generator
template <typename OutputIterator, typename Context>
bool generate(OutputIterator sink, attributes::klass_def const& cls, Context const& context) const
{
+ using namespace efl::eolian::grammar;
+ using efl::eolian::grammar::attributes::unused;
+
+ std::string suffix;
+ switch(cls.type)
+ {
+ case attributes::class_type::regular:
+ case attributes::class_type::abstract_:
+ suffix = "CLASS";
+ break;
+ case attributes::class_type::mixin:
+ suffix = "MIXIN";
+ break;
+ case attributes::class_type::interface_:
+ suffix = "INTERFACE";
+ break;
+ }
+ std::string class_name;
+ as_generator(upper_case[*(string << "_")] << upper_case[string] << "_" << suffix)
+ .generate(std::back_inserter(class_name), std::make_tuple(cls.namespaces, cls.cxx_name), context_null{});
+
+ as_generator
+ (
+ "namespace efl { namespace js { namespace binding { namespace {\nstatic void register_"
+ << lower_case[*(string << "_")]
+ << lower_case[string]
+ << "(v8::Handle<v8::Object> global, v8::Isolate* isolate)\n"
+ << "{\n"
+ << scope_tab << "v8::Handle<v8::FunctionTemplate> constructor = ::efl::eina::js::compatibility_new<v8::FunctionTemplate>\n"
+ << scope_tab << scope_tab << "(isolate, & ::efl::eo::js::constructor, ::efl::eina::js::compatibility_new<v8::External>(isolate, const_cast<Efl_Class*>("<< class_name << ")));\n"
+ << scope_tab << "(void)" << class_name << ";\n"
+ << scope_tab << "(void)global; (void)isolate; (void)constructor;\n"
+ << "}\n"
+ << "} } } } // namespace efl { namespace js { namespace binding { namespace {\n\n"
+ ).generate(sink, std::make_tuple(cls.namespaces, cls.cxx_name), context);
+
+ // constructors ?
+
+ // v8::Handle<v8::FunctionTemplate> constructor = ::efl::eina::js::compatibility_new<v8::FunctionTemplate>
+ // (isolate, &efl::eo::js::constructor, efl::eina::js::compatibility_new<v8::External>(isolate, const_cast<Efl_Class*>(EFL_UI_WIN_CLASS)));
+
+
+ // methods
+
+ // events
return true;
}
diff --git a/src/bin/eolian_js/main.cc b/src/bin/eolian_js/main.cc
index 7844b0234b..4921a58525 100644
--- a/src/bin/eolian_js/main.cc
+++ b/src/bin/eolian_js/main.cc
@@ -538,20 +538,57 @@ int main(int argc, char** argv)
EINA_CXX_DOM_LOG_DBG(eolian::js::domain) << "output was opened";
+
std::ostream_iterator<char> iterator = std::ostream_iterator<char>(os);
- efl::eolian::grammar::attributes::klass_def klass_def(klass, eolian_unit);
- std::vector<efl::eolian::grammar::attributes::klass_def> klasses{klass_def};
-
// probably not eot file
if(klass)
{
+ os << "#ifndef EFL_JAVASCRIPT_EOLIAN_GENERATE_REGISTER_CALL\n";
+ // function to iterate through all inheritance class
+ std::function<void(Eolian_Class const*, std::function<void(Eolian_Class const*)>)>
+ recurse_inherits
+ = [&] (Eolian_Class const* klass, std::function<void(Eolian_Class const*)> function)
+ {
+ for(efl::eina::iterator<const char> first ( ::eolian_class_inherits_get(klass))
+ , last; first != last; ++first)
+ {
+ EINA_CXX_DOM_LOG_WARN(eolian::js::domain) << &*first << std::endl;
+ Eolian_Class const* base = ::eolian_class_get_by_name(eolian_unit, &*first);
+ if(base)
+ {
+ function(base);
+ recurse_inherits(base, function);
+ }
+ }
+ };
+
+ os << "extern \"C\" {\n\n";
+
+ auto includes_fun = [&os] (Eolian_Class const* klass)
+ {
+ os << "#include <" << eolian_class_file_get(klass) << ".h>\n\n";
+ };
+ // generate include for all inheritance
+ recurse_inherits(klass, includes_fun);
+ os << "#include <" << eolian_class_file_get(klass) << ".h>\n\n";
+
+ os << "}\n\n";
+
using efl::eolian::grammar::attributes::unused;
+ using efl::eolian::grammar::context_null;
efl::eolian::grammar::attributes::klass_def klass_def(klass, eolian_unit);
- if (!eolian::js::grammar::class_registration.generate(iterator, klass_def, unused))
+ if (!eolian::js::grammar::class_registration.generate(iterator, klass_def, context_null{}))
{
throw std::runtime_error("Failed to generate class");
}
+
+ os << "#else\n";
+ // if (!eolian::js::grammar::call_registration.generate(iterator, klass_def, context_null{}))
+ // {
+ // throw std::runtime_error("Failed to generate class");
+ // }
+ os << "#endif\n";
}
// std::vector<Eolian_Function const*> constructor_functions;
diff --git a/src/bindings/js/efl_js/efl_js.cc b/src/bindings/js/efl_js/efl_js.cc
index c4f1f0bb71..b85574ae6c 100644
--- a/src/bindings/js/efl_js/efl_js.cc
+++ b/src/bindings/js/efl_js/efl_js.cc
@@ -36,194 +36,24 @@
# endif
#endif /* ! _WIN32 */
-EAPI void eina_container_register(v8::Handle<v8::Object>, v8::Isolate* isolate);
-EAPI void eina_log_register(v8::Handle<v8::Object>, v8::Isolate* isolate);
-EAPI void eina_value_register(v8::Handle<v8::Object>, v8::Isolate* isolate);
-EAPI void register_ecore_mainloop(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-
-namespace ecore {
- //EAPI void register_exe(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_idler(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_ecore(v8::Isolate* isolate, v8::Handle<v8::Object> exports);
-namespace idle {
-EAPI void register_enterer(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_exiter(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-}
-EAPI void register_job(v8::Handle<v8::Object> global, v8::Isolate* isolate);
- //EAPI void register_parent(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_poller(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_timer(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-}
-
-EAPI void register_ecore_audio(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_ecore_audio_in(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_ecore_audio_in_sndfile(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_ecore_audio_in_tone(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_ecore_audio_out(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_ecore_audio_out_pulse(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_ecore_audio_out_sndfile(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-
-namespace efl {
-EAPI void register_object(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_animator(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_container(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_control(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_file(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_image(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_loop(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_orientation(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_player(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_text(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_text_properties(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-}
-
-namespace efl { namespace ui {
-EAPI void register_button(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_check(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_progressbar(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_radio(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_slider(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_video(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_flip(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_frame(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_box(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_image(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_win(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-}}
-
-namespace efl { namespace ui { namespace image {
-EAPI void register_zoomable(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-}}}
-
-namespace efl { namespace ui { namespace image { namespace zoomable {
-EAPI void register_pan(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-}}}}
-
-namespace efl { namespace canvas {
-EAPI void register_object(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_group(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_rectangle(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-}}
-
-namespace evas {
-EAPI void register_box(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_canvas(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_clickable_interface(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_common_interface(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_draggable_interface(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_grid(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_image(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_line(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_object(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_object_smart(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_out(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_scrollable_interface(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_selectable_interface(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_signal_interface(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_smart_clipped(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_table(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_text(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_textblock(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_textgrid(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_zoomable_interface(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-
-namespace canvas3d {
-EAPI void register_camera(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_light(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_material(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_mesh(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_node(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_object(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_scene(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_texture(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-} }
-
-namespace efl { namespace canvas {
-EAPI void register_polygon(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-}}
-
-namespace edje {
-EAPI void register_edit(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_object(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-}
+namespace {
-namespace emotion {
-EAPI void register_object(v8::Handle<v8::Object> global, v8::Isolate* isolate);
+void namespace_accessor_get(v8::Local<v8::Name> name, v8::PropertyCallbackInfo<v8::Value> const& info)
+{
+ std::cout << "was it here?" << std::endl;
+ v8::Local<v8::String> name_str = name->ToString();
+ assert(!!*name_str);
+ v8::String::Utf8Value value(info.GetIsolate(), name_str);
+ std::cout << *value << std::endl;
+
+ if(info.Data()->IsNullOrUndefined())
+ {
+ std::cout << "no value already assigned" << std::endl;
+ }
+ else
+ std::cout << "value already assigned" << std::endl;
}
-EAPI void register_elm_atspi_app_object(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_elm_interface_atspi_accessible(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_elm_interface_atspi_action(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_efl_access_component(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_elm_interface_atspi_editable_text(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_elm_interface_atspi_image(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_elm_interface_atspi_selection(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_elm_interface_atspi_text(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_elm_interface_atspi_value(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_elm_interface_atspi_widget_action(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_elm_interface_atspi_window(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_elm_interface_fileselector(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_elm_interface_scrollable(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_elm_pan(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-
-namespace elm {
-
-EAPI void register_bg(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_calendar(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_clock(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_colorselector(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_conformant(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_container(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_combobox(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_ctxpopup(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_dayselector(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_entry(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_fileselector(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_flip(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_gengrid(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_gengrid_pan(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_genlist(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_genlist_pan(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_gesture_layer(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_glview(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_hover(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_index(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_label(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_layout(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_list(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_map(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_map_pan(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_menu(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_multibuttonentry(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_notify(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_panel(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_panes(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_player(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_plug(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_popup(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_route(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_scroller(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_spinner(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_systray(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_toolbar(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_web(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_widget(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_win(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_widget_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_color_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_dayselector_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_flipselector_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_menu_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_ctxpopup_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_index_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_multibuttonentry_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_naviframe_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_genlist_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_gengrid_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_list_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_toolbar_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_diskselector_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_popup_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-
+
}
#ifdef HAVE_NODEJS
@@ -235,7 +65,7 @@ namespace {
namespace efl_js {
#endif
-EAPI void init(v8::Handle<v8::Object> exports)
+EAPI void init(v8::Local<v8::Object> exports, v8::Local<v8::Object> module)
{
static char* argv[] = {const_cast<char*>("node")};
::elm_init(1, argv);
@@ -246,267 +76,22 @@ EAPI void init(v8::Handle<v8::Object> exports)
try
{
- eina_container_register(exports, v8::Isolate::GetCurrent());
- eina_log_register(exports, v8::Isolate::GetCurrent());
- eina_value_register(exports, v8::Isolate::GetCurrent());
- //register_ecore_mainloop(exports, v8::Isolate::GetCurrent());
- efl::eio::js::register_eio(v8::Isolate::GetCurrent(), exports);
- efl::eldbus::js::register_eldbus(v8::Isolate::GetCurrent(), exports);
- efl::ethumb::js::register_ethumb(v8::Isolate::GetCurrent(), exports);
- //ecore::register_exe(exports, v8::Isolate::GetCurrent());
- // ecore::register_idler(exports, v8::Isolate::GetCurrent());
- // ecore::idle::register_enterer(exports, v8::Isolate::GetCurrent());
- // ecore::idle::register_exiter(exports, v8::Isolate::GetCurrent());
- // ecore::register_job(exports, v8::Isolate::GetCurrent());
- //ecore::register_parent(exports, v8::Isolate::GetCurrent());
- // ecore::register_poller(exports, v8::Isolate::GetCurrent());
- // ecore::register_timer(exports, v8::Isolate::GetCurrent());
-#if 0
- register_ecore_audio(exports, v8::Isolate::GetCurrent());
- register_ecore_audio_in(exports, v8::Isolate::GetCurrent());
- register_ecore_audio_in_sndfile(exports, v8::Isolate::GetCurrent());
- register_ecore_audio_in_tone(exports, v8::Isolate::GetCurrent());
- register_ecore_audio_out(exports, v8::Isolate::GetCurrent());
- register_ecore_audio_out_pulse(exports, v8::Isolate::GetCurrent());
- register_ecore_audio_out_sndfile(exports, v8::Isolate::GetCurrent());
-#endif
- // Manual ecore binding initialized last to allow extension of namespace
- // created by eolian.
- efl::ecore::js::register_ecore(v8::Isolate::GetCurrent(), exports);
- efl::register_animator(exports, v8::Isolate::GetCurrent());
- efl::register_control(exports, v8::Isolate::GetCurrent());
- efl::register_file(exports, v8::Isolate::GetCurrent());
- efl::register_image(exports, v8::Isolate::GetCurrent());
- efl::register_orientation(exports, v8::Isolate::GetCurrent());
- efl::register_loop(exports, v8::Isolate::GetCurrent());
- efl::register_player(exports, v8::Isolate::GetCurrent());
- efl::register_text(exports, v8::Isolate::GetCurrent());
- // efl::register_text_properties(exports, v8::Isolate::GetCurrent());
- efl::register_object(exports, v8::Isolate::GetCurrent());
-#if 1
- // evas::register_box(exports, v8::Isolate::GetCurrent());
- // evas::register_canvas(exports, v8::Isolate::GetCurrent());
- // evas::register_clickable_interface(exports, v8::Isolate::GetCurrent());
- // evas::register_common_interface(exports, v8::Isolate::GetCurrent());
- // evas::register_draggable_interface(exports, v8::Isolate::GetCurrent());
- // evas::register_grid(exports, v8::Isolate::GetCurrent());
- // evas::register_image(exports, v8::Isolate::GetCurrent());
- // evas::register_line(exports, v8::Isolate::GetCurrent());
- efl::canvas::register_object(exports, v8::Isolate::GetCurrent());
- efl::canvas::register_group(exports, v8::Isolate::GetCurrent());
- // evas::register_object_smart(exports, v8::Isolate::GetCurrent());
- // evas::register_out(exports, v8::Isolate::GetCurrent());
- efl::canvas::register_rectangle(exports, v8::Isolate::GetCurrent());
- // evas::register_scrollable_interface(exports, v8::Isolate::GetCurrent());
- // evas::register_selectable_interface(exports, v8::Isolate::GetCurrent());
- // evas::register_signal_interface(exports, v8::Isolate::GetCurrent());
- // evas::register_smart_clipped(exports, v8::Isolate::GetCurrent());
- // evas::register_table(exports, v8::Isolate::GetCurrent());
- // evas::register_text(exports, v8::Isolate::GetCurrent());
- // evas::register_textblock(exports, v8::Isolate::GetCurrent());
- // evas::register_textgrid(exports, v8::Isolate::GetCurrent());
- // evas::register_zoomable_interface(exports, v8::Isolate::GetCurrent());
- // evas::canvas3d::register_camera(exports, v8::Isolate::GetCurrent());
- // evas::canvas3d::register_light(exports, v8::Isolate::GetCurrent());
- // evas::canvas3d::register_material(exports, v8::Isolate::GetCurrent());
- // evas::canvas3d::register_mesh(exports, v8::Isolate::GetCurrent());
- // evas::canvas3d::register_node(exports, v8::Isolate::GetCurrent());
- // evas::canvas3d::register_object(exports, v8::Isolate::GetCurrent());
- // evas::canvas3d::register_scene(exports, v8::Isolate::GetCurrent());
- // evas::canvas3d::register_texture(exports, v8::Isolate::GetCurrent());
- // efl::canvas::register_polygon(exports, v8::Isolate::GetCurrent());
-#endif
-#if 0
- edje::register_edit(exports, v8::Isolate::GetCurrent());
- edje::register_object(exports, v8::Isolate::GetCurrent());
-#endif
-#if 0
- emotion::register_object(exports, v8::Isolate::GetCurrent());
-#endif
-
- // elm::register_access(exports, v8::Isolate::GetCurrent());
- // elm::register_actionslider(exports, v8::Isolate::GetCurrent());
- // ::register_elm_atspi_app_object(exports, v8::Isolate::GetCurrent());
- // elm::register_box(exports, v8::Isolate::GetCurrent());
-
- elm::register_bg(exports, v8::Isolate::GetCurrent());
- efl::ui::register_button(exports, v8::Isolate::GetCurrent());
- elm::register_calendar(exports, v8::Isolate::GetCurrent());
-
- efl::ui::register_check(exports, v8::Isolate::GetCurrent());
-
- // crash
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- elm::register_clock(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
-
- // crash
- // elm::register_colorselector(exports, v8::Isolate::GetCurrent());
-
- elm::register_conformant(exports, v8::Isolate::GetCurrent());
-
- // crash
- // elm::register_combobox(exports, v8::Isolate::GetCurrent());
-
- // doesn't exist
- efl::register_container(exports, v8::Isolate::GetCurrent());
-
- elm::register_ctxpopup(exports, v8::Isolate::GetCurrent());
- elm::register_dayselector(exports, v8::Isolate::GetCurrent());
-
- // crash
- // elm::register_diskselector(exports, v8::Isolate::GetCurrent());
-
- elm::register_entry(exports, v8::Isolate::GetCurrent());
- elm::register_fileselector(exports, v8::Isolate::GetCurrent());
-
- efl::ui::register_frame(exports, v8::Isolate::GetCurrent());
- efl::ui::register_box(exports, v8::Isolate::GetCurrent());
- efl::ui::register_image(exports, v8::Isolate::GetCurrent());
-
- // crash
- // elm::register_gengrid(exports, v8::Isolate::GetCurrent());
-
- // doesn't exist
- // elm::register_gengrid_pan(exports, v8::Isolate::GetCurrent());
-
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // crash
- elm::register_genlist(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // elm::register_genlist_pan(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- elm::register_gesture_layer(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- elm::register_glview(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // elm::register_grid(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- elm::register_index(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
-
- // ::register_elm_interface_atspi_accessible(exports, v8::Isolate::GetCurrent());
- // ::register_elm_interface_atspi_action(exports, v8::Isolate::GetCurrent());
- // ::register_efl_access_component(exports, v8::Isolate::GetCurrent());
- // ::register_elm_interface_atspi_editable_text(exports, v8::Isolate::GetCurrent());
- // ::register_elm_interface_atspi_image(exports, v8::Isolate::GetCurrent());
- // ::register_elm_interface_atspi_selection(exports, v8::Isolate::GetCurrent());
- // ::register_elm_interface_atspi_text(exports, v8::Isolate::GetCurrent());
- // ::register_elm_interface_atspi_value(exports, v8::Isolate::GetCurrent());
- // ::register_elm_interface_atspi_widget_action(exports, v8::Isolate::GetCurrent());
- // ::register_elm_interface_atspi_window(exports, v8::Isolate::GetCurrent());
- // ::register_elm_interface_fileselector(exports, v8::Isolate::GetCurrent());
- // ::register_elm_interface_scrollable(exports, v8::Isolate::GetCurrent());
-
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- elm::register_label(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- elm::register_layout(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // elm::register_list(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- elm::register_map(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
-
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // elm::register_map_pan(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- //elm::register_mapbuf(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- elm::register_menu(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- elm::register_multibuttonentry(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- elm::register_notify(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
-
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // ::register_elm_pan(exports, v8::Isolate::GetCurrent());
- elm::register_panel(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- elm::register_panes(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- efl::ui::image::register_zoomable(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // efl::ui::image::zoomable::register_pan(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- elm::register_player(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- elm::register_plug(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- elm::register_popup(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- efl::ui::register_progressbar(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- efl::ui::register_radio(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
-
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- elm::register_route(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- elm::register_scroller(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- efl::ui::register_slider(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- elm::register_spinner(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- elm::register_systray(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // elm::register_table(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- elm::register_toolbar(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- efl::ui::register_flip(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- efl::ui::register_video(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- elm::register_web(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- elm::register_widget(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
-
- // crash
- // elm::register_win(exports, v8::Isolate::GetCurrent());
- fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- efl::ui::register_win(exports, v8::Isolate::GetCurrent());
-
- // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // elm::register_widget_item(exports, v8::Isolate::GetCurrent());
- // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // elm::register_color_item(exports, v8::Isolate::GetCurrent());
- // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // elm::register_dayselector_item(exports, v8::Isolate::GetCurrent());
- // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // elm::register_hoversel_item(exports, v8::Isolate::GetCurrent());
- // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // elm::register_segment_control_item(exports, v8::Isolate::GetCurrent());
- // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // elm::register_slideshow_item(exports, v8::Isolate::GetCurrent());
- // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // elm::register_flipselector_item(exports, v8::Isolate::GetCurrent());
- // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // elm::register_menu_item(exports, v8::Isolate::GetCurrent());
- // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // elm::register_ctxpopup_item(exports, v8::Isolate::GetCurrent());
- // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // elm::register_index_item(exports, v8::Isolate::GetCurrent());
- // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // elm::register_multibuttonentry_item(exports, v8::Isolate::GetCurrent());
- // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // elm::register_naviframe_item(exports, v8::Isolate::GetCurrent());
- // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // elm::register_genlist_item(exports, v8::Isolate::GetCurrent());
- // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // elm::register_gengrid_item(exports, v8::Isolate::GetCurrent());
- // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // elm::register_list_item(exports, v8::Isolate::GetCurrent());
- // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // elm::register_toolbar_item(exports, v8::Isolate::GetCurrent());
- // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // elm::register_diskselector_item(exports, v8::Isolate::GetCurrent());
- // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
- // elm::register_popup_item(exports, v8::Isolate::GetCurrent());
- // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
+ // eina_container_register(exports, v8::Isolate::GetCurrent());
+ // eina_log_register(exports, v8::Isolate::GetCurrent());
+ // eina_value_register(exports, v8::Isolate::GetCurrent());
+ // //register_ecore_mainloop(exports, v8::Isolate::GetCurrent());
+
+ v8::Isolate* isolate = exports->GetIsolate();
+
+ v8::Local<v8::ObjectTemplate> ns_obj;
+ {
+ auto evas = ::efl::eina::js::compatibility_new<v8::Object>(isolate);
+ ns_obj = ::efl::eina::js::compatibility_new<v8::ObjectTemplate>(isolate);
+ ns_obj->SetHandler({&namespace_accessor_get});
+ auto obj = ns_obj->NewInstance();
+ obj->Set(::efl::eina::js::compatibility_new<v8::String>(isolate, "evas"), evas);
+ module->Set(::efl::eina::js::compatibility_new<v8::String>(isolate, "exports"), obj);
+ }
}
catch(...)
{
diff --git a/src/bindings/js/eo_js/Eo_Js.hh b/src/bindings/js/eo_js/Eo_Js.hh
index ab08b9886e..6b23fa01ea 100644
--- a/src/bindings/js/eo_js/Eo_Js.hh
+++ b/src/bindings/js/eo_js/Eo_Js.hh
@@ -10,6 +10,7 @@
#include <eo_js_namespace.hh>
#include <eo_js_struct.hh>
#include <eo_js_construct_from_eo.hh>
+#include <eo_js_namespace_accessor.hh>
#endif
diff --git a/src/bindings/js/eo_js/eo_js_constructor.hh b/src/bindings/js/eo_js/eo_js_constructor.hh
index 202ff561e4..f977d09190 100644
--- a/src/bindings/js/eo_js/eo_js_constructor.hh
+++ b/src/bindings/js/eo_js/eo_js_constructor.hh
@@ -15,6 +15,77 @@
namespace efl { namespace eo { namespace js {
+inline eina::js::compatibility_return_type constructor(eina::js::compatibility_callback_info_type args)
+{
+ if(args.IsConstructCall())
+ {
+ std::size_t argc = args.Length();
+
+ Efl_Class* kls =
+ static_cast<Efl_Class*>(v8::External::Cast(*args.Data())->Value());
+ Eo* eo;
+
+ // constructor without parent or lambda
+ if(argc == 0)
+ {
+ eo = _efl_add_internal_start(__FILE__, __LINE__, kls, NULL, EINA_TRUE, EINA_TRUE);
+ }
+ // constructor with lambda or
+ // constructor with parent
+ else if(argc == 1)
+ {
+ auto arg_0 = args[0];
+ v8::Local<v8::Object> obj_arg0;
+ v8::Local<v8::Object> self = args.This();
+ v8::External* external;
+ v8::Function* function;
+ if(arg_0->IsObject() && (obj_arg0 = arg_0->ToObject())->InternalFieldCount() == 1
+ && (external = v8::External::Cast(*obj_arg0->GetInternalField(0)))) // parent
+ {
+ Eo* parent = static_cast<Eo*>(external->Value());
+ eo = _efl_add_internal_start(__FILE__, __LINE__, kls, parent, EINA_TRUE, EINA_TRUE);
+ self->SetInternalField(0, eina::js::compatibility_new<v8::External>(args.GetIsolate(), eo));
+ }
+ else if(arg_0->IsObject() && (function = v8::Function::Cast(*obj_arg0->GetInternalField(0))))
+ {
+ eo = _efl_add_internal_start(__FILE__, __LINE__, kls, NULL, EINA_TRUE, EINA_TRUE);
+ self->SetInternalField(0, eina::js::compatibility_new<v8::External>(args.GetIsolate(), eo));
+
+ // call lambda
+ v8::Local<v8::Value> call_args[] = {
+ args.This(),
+ };
+ function->Call(eina::js::compatibility_global(), 1, call_args);
+ }
+ else
+ {
+ // TypeError
+ }
+ self->SetInternalField(0, eina::js::compatibility_new<v8::External>(args.GetIsolate(), _efl_add_end(eo, EINA_TRUE, EINA_TRUE)));
+ return eina::js::compatibility_return();
+ }
+ // constructor with parent and lambda
+ else if(argc == 2)
+ {
+ Eo* parent;
+ eo = _efl_add_internal_start(__FILE__, __LINE__, kls, parent, EINA_TRUE, EINA_TRUE);
+ // call lambda
+ return eina::js::compatibility_return();
+ }
+ else
+ {
+ // TypeError
+ return eina::js::compatibility_return();
+ }
+ }
+ else
+ {
+ // TypeError
+
+ return eina::js::compatibility_return();
+ }
+}
+
template <typename T>
struct eo_function_params;
@@ -30,126 +101,128 @@ struct eo_function_params<R(*)(Eo const*, P...)>
typedef std::tuple<P...> type;
};
-inline eina::js::compatibility_return_type constructor(eina::js::compatibility_callback_info_type args)
-{
- if(args.IsConstructCall())
- {
- void* data = v8::External::Cast(*args.Data())->Value();
- std::function<eina::js::compatibility_return_type(eina::js::compatibility_callback_info_type)>*
- f = static_cast<std::function<eina::js::compatibility_return_type(eina::js::compatibility_callback_info_type)>*>
- (data);
- return (*f)(args);
- }
- else
- {
- std::size_t argc = args.Length();
- std::vector<v8::Local<v8::Value> > argv (argc ? argc : 1 );
- for(int i = 0; i != args.Length(); ++i)
- argv[i] = args[i];
- args.Callee()->NewInstance(argc, &argv[0]);
- return eina::js::compatibility_return();
- }
-}
+// inline eina::js::compatibility_return_type constructor(eina::js::compatibility_callback_info_type args)
+// {
+// if(args.IsConstructCall())
+// {
+// void* data = v8::External::Cast(*args.Data())->Value();
+// std::function<eina::js::compatibility_return_type(eina::js::compatibility_callback_info_type)>*
+// f = static_cast<std::function<eina::js::compatibility_return_type(eina::js::compatibility_callback_info_type)>*>
+// (data);
+// return (*f)(args);
+// }
+// else
+// {
+// std::size_t argc = args.Length();
+// std::vector<v8::Local<v8::Value> > argv (argc ? argc : 1 );
+// for(int i = 0; i != args.Length(); ++i)
+// argv[i] = args[i];
+// args.Callee()->NewInstance(argc, &argv[0]);
+// return eina::js::compatibility_return();
+// }
+// }
-template <typename...F>
-struct constructor_caller
-{
- struct call
- {
- template <typename T>
- void operator()(T function) const
- {
- int const parameters
- = std::tuple_size<typename eo::js::eo_function_params<T>::type>::value;
- if(*current + parameters <= args->Length())
- {
- aux(function, eina::make_index_sequence<parameters>());
- *current += parameters;
- }
- else
- {
- throw std::logic_error("Expected more arguments for this call");
- }
- }
+// template <typename...F>
+// struct constructor_caller
+// {
+// struct call
+// {
+// template <typename T>
+// void operator()(T function) const
+// {
+// int const parameters
+// = std::tuple_size<typename eo::js::eo_function_params<T>::type>::value;
+// if(*current + parameters <= args->Length())
+// {
+// aux(function, eina::make_index_sequence<parameters>());
+// *current += parameters;
+// }
+// else
+// {
+// throw std::logic_error("Expected more arguments for this call");
+// }
+// }
- template <typename U, std::size_t I>
- static
- typename std::tuple_element<I, typename eo::js::eo_function_params<U>::type>::type
- get_value(v8::Local<v8::Value> v, v8::Isolate* isolate)
- {
- typename std::tuple_element<I, typename eo::js::eo_function_params<U>::type>::type
- tmp =
- eina::js::get_value_from_javascript
- (v, isolate, ""
- , eina::js::value_tag<typename std::tuple_element
- <I, typename eo::js::eo_function_params<U>::type>::type>());
- return tmp;
- }
+// template <typename U, std::size_t I>
+// static
+// typename std::tuple_element<I, typename eo::js::eo_function_params<U>::type>::type
+// get_value(v8::Local<v8::Value> v, v8::Isolate* isolate)
+// {
+// typename std::tuple_element<I, typename eo::js::eo_function_params<U>::type>::type
+// tmp =
+// eina::js::get_value_from_javascript
+// (v, isolate, ""
+// , eina::js::value_tag<typename std::tuple_element
+// <I, typename eo::js::eo_function_params<U>::type>::type>());
+// return tmp;
+// }
- template <typename T, std::size_t... I>
- void aux(T function, eina::index_sequence<I...>) const
- {
- function(obj_efl_self, get_value<T, I>((*args)[I + *current], args->GetIsolate())...);
- }
+// template <typename T, std::size_t... I>
+// void aux(T function, eina::index_sequence<I...>) const
+// {
+// function(obj_efl_self, get_value<T, I>((*args)[I + *current], args->GetIsolate())...);
+// }
- Eo* obj_efl_self;
- int* current;
- eina::js::compatibility_callback_info_pointer args;
- };
-
- eina::js::compatibility_return_type operator()(eina::js::compatibility_callback_info_type args) const
- {
- int current_index = 1;
- if(args.Length() != 0)
- {
- try
- {
- Eo* parent = eina::js::get_value_from_javascript
- (args[0], args.GetIsolate(), "", eina::js::value_tag<Eo*>());
- Eo* eo = efl_add_ref
- (klass
- , parent
- , eina::_mpl::for_each(constructors, call{efl_added, &current_index, &args})
- );
- if (!eo)
- throw std::logic_error("Failed to create object.");
- v8::Local<v8::Object> self = args.This();
- self->SetInternalField(0, eina::js::compatibility_new<v8::External>(args.GetIsolate(), eo));
- efl::eina::js::make_weak(args.GetIsolate(), self
- , [eo]
- {
- efl_unref(eo);
- });
- }
- catch(std::logic_error const& error)
- {
- eina::js::compatibility_throw
- (v8::Exception::TypeError
- (eina::js::compatibility_new<v8::String>(args.GetIsolate(), error.what())));
- }
- }
- else
- {
- eina::js::compatibility_throw
- (v8::Exception::TypeError
- (eina::js::compatibility_new<v8::String>(args.GetIsolate(), "Expected at least one argument for this call")));
- }
- return eina::js::compatibility_return();
- }
+// Eo* obj_efl_self;
+// int* current;
+// eina::js::compatibility_callback_info_pointer args;
+// };
+
+// eina::js::compatibility_return_type operator()(eina::js::compatibility_callback_info_type args) const
+// {
+// int current_index = 1;
+// if(args.Length() != 0)
+// {
+// try
+// {
+// Eo* parent = eina::js::get_value_from_javascript
+// (args[0], args.GetIsolate(), "", eina::js::value_tag<Eo*>());
+// Eo* eo = efl_add_ref
+// (klass
+// , parent
+// , eina::_mpl::for_each(constructors, call{efl_added, &current_index, &args})
+// );
+// if (!eo)
+// throw std::logic_error("Failed to create object.");
+// v8::Local<v8::Object> self = args.This();
+// self->SetInternalField(0, eina::js::compatibility_new<v8::External>(args.GetIsolate(), eo));
+// efl::eina::js::make_weak(args.GetIsolate(), self
+// , [eo]
+// {
+// efl_unref(eo);
+// });
+// }
+// catch(std::logic_error const& error)
+// {
+// eina::js::compatibility_throw
+// (v8::Exception::TypeError
+// (eina::js::compatibility_new<v8::String>(args.GetIsolate(), error.what())));
+// }
+// }
+// else
+// {
+// eina::js::compatibility_throw
+// (v8::Exception::TypeError
+// (eina::js::compatibility_new<v8::String>(args.GetIsolate(), "Expected at least one argument for this call")));
+// }
+// return eina::js::compatibility_return();
+// }
- Efl_Class const* klass;
- std::tuple<F...> constructors;
-};
+// Efl_Class const* klass;
+// std::tuple<F...> constructors;
+// };
-template <typename... F>
-v8::Handle<v8::Value> constructor_data(v8::Isolate* isolate, Efl_Class const* klass, F... f)
-{
- return eina::js::compatibility_new<v8::External>
- (isolate
- , new std::function<eina::js::compatibility_return_type(eina::js::compatibility_callback_info_type)>
- (constructor_caller<F...>{klass, std::tuple<F...>{f...}}));
-}
+// template <typename... F>
+// v8::Handle<v8::Value> constructor_data(v8::Isolate* isolate, Efl_Class const* klass, F... f)
+// {
+// return eina::js::compatibility_new<v8::External>
+// (isolate
+// , new std::function<eina::js::compatibility_return_type(eina::js::compatibility_callback_info_type)>
+// (constructor_caller<F...>{klass, std::tuple<F...>{f...}}));
+// }
+
+
} } }
#endif
diff --git a/src/bindings/js/eo_js/eo_js_namespace_accessor.hh b/src/bindings/js/eo_js/eo_js_namespace_accessor.hh
new file mode 100644
index 0000000000..901173be0e
--- /dev/null
+++ b/src/bindings/js/eo_js/eo_js_namespace_accessor.hh
@@ -0,0 +1,20 @@
+#ifndef EFL_EO_JS_NAMESPACE_ACCESSOR_HH
+#define EFL_EO_JS_NAMESPACE_ACCESSOR_HH
+
+namespace efl { namespace eo { namespace js {
+
+inline void accessor_get(v8::Local<v8::Name> name, v8::PropertyCallbackInfo<v8::Value> const& info)
+{
+ v8::Local<v8::String> name_str = name->ToString();
+
+}
+
+inline v8::Local<v8::Object> create_namespace_object()
+{
+
+}
+
+
+} } }
+
+#endif