summaryrefslogtreecommitdiff
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
parentda10b9524c96bcf2723963f939fecef49b7c6601 (diff)
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 = \
56 56
57endif 57endif
58 58
59bindings/js/efl_js/eolian_js_bindings.cc: $(GENERATED_JS_BINDINGS) 59# @echo @ECHO_E@ "#ifdef HAVE_CONFIG_H" > $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
60 @echo @ECHO_E@ "#ifdef HAVE_CONFIG_H" > $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc 60# @echo @ECHO_E@ "#include \"config.h\"" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
61 @echo @ECHO_E@ "#include \"config.h\"" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc 61# @echo @ECHO_E@ "#include \"elementary_config.h\"" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
62 @echo @ECHO_E@ "#include \"elementary_config.h\"" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc 62# @echo @ECHO_E@ "#endif\n" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
63 @echo @ECHO_E@ "#endif\n" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc 63# @echo @ECHO_E@ "#include <Efl.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
64 @echo @ECHO_E@ "#include <Efl.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc 64# @echo @ECHO_E@ "#include <Efl_Config.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
65 @echo @ECHO_E@ "#include <Efl_Config.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc 65# @echo @ECHO_E@ "#include <Ecore.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
66 @echo @ECHO_E@ "#include <Ecore.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc 66# @echo @ECHO_E@ "#include <Eo.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
67 @echo @ECHO_E@ "#include <Eo.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc 67# @echo @ECHO_E@ "#include <Ecore_Con.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
68 @echo @ECHO_E@ "#include <Ecore_Con.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc 68# @echo @ECHO_E@ "#include <Ecore_Audio.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
69 @echo @ECHO_E@ "#include <Ecore_Audio.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc 69# @echo @ECHO_E@ "#include <Evas.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
70 @echo @ECHO_E@ "#include <Evas.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc 70# @echo @ECHO_E@ "#include <Edje.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
71 @echo @ECHO_E@ "#include <Edje.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc 71# @echo @ECHO_E@ "#include <Ecore_Con_Eet.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
72 @echo @ECHO_E@ "#include <Ecore_Con_Eet.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc 72# @echo @ECHO_E@ "#include <Emotion.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
73 @echo @ECHO_E@ "#include <Emotion.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc 73# @echo @ECHO_E@ "#define ELM_INTERNAL_API_ARGESFSDFEFC" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
74 @echo @ECHO_E@ "#define ELM_INTERNAL_API_ARGESFSDFEFC" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc 74# @echo @ECHO_E@ "#include <Elementary.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
75 @echo @ECHO_E@ "#include <Elementary.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc 75# @echo @ECHO_E@ "extern \"C\" {" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
76 @echo @ECHO_E@ "extern \"C\" {" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc 76# @echo @ECHO_E@ "#include <elm_widget.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
77 @echo @ECHO_E@ "#include <elm_widget.h>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc 77# @echo @ECHO_E@ "}\n" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
78 @echo @ECHO_E@ "}\n" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc 78# @echo @ECHO_E@ "#include <Eina_Js.hh>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
79 @for i in $(GENERATED_JS_BINDINGS); do echo "#include <$$i>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc; done 79# @echo @ECHO_E@ "#include <Eo_Js.hh>" >> $(top_builddir)/src/bindings/js/efl_js/eolian_js_bindings.cc
80 80
81CLEANFILES += bindings/js/efl_js/eolian_js_bindings.cc 81bindings/js/efl_js/eolian_js_bindings.hh: $(GENERATED_JS_BINDINGS)
82 @echo @ECHO_E@ "" > $@
83 @for i in $(GENERATED_JS_BINDINGS); do echo "#include <$$i>" >> $@; done
84
85CLEANFILES += bindings/js/efl_js/eolian_js_bindings.hh
82 86
83## Install Ecore-JS headers 87## Install Ecore-JS headers
84installed_ecorejsheadersdir = $(includedir)/ecore-js-@VMAJ@ 88installed_ecorejsheadersdir = $(includedir)/ecore-js-@VMAJ@
@@ -160,8 +164,7 @@ bindings/js/eio_js/eio_js.cc \
160bindings/js/efl_js/efl_js.cc \ 164bindings/js/efl_js/efl_js.cc \
161bindings/js/ethumb_js/ethumb_js_client.cc 165bindings/js/ethumb_js/ethumb_js_client.cc
162 166
163nodist_bindings_js_efl_js_libefl_js_la_SOURCES = \ 167bindings/js/efl_js/bindings_js_efl_js_libefl_js_la-efl_js.l$(OBJEXT): bindings/js/efl_js/eolian_js_bindings.hh
164bindings/js/efl_js/eolian_js_bindings.cc
165 168
166bindings/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 169bindings/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
167 170
@@ -169,6 +172,7 @@ bindings_js_efl_js_libefl_js_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
169-I$(top_srcdir)/src/lib/efl \ 172-I$(top_srcdir)/src/lib/efl \
170-I$(top_builddir)/src/lib/efl/interfaces/ \ 173-I$(top_builddir)/src/lib/efl/interfaces/ \
171-I$(top_builddir)/src/lib/evas/canvas/ \ 174-I$(top_builddir)/src/lib/evas/canvas/ \
175-I$(top_builddir)/src/lib/evas/gesture/ \
172-I$(top_builddir)/src/lib/ecore/ \ 176-I$(top_builddir)/src/lib/ecore/ \
173-I$(top_srcdir)/src/bindings/js/eina_js \ 177-I$(top_srcdir)/src/bindings/js/eina_js \
174-I$(top_srcdir)/src/bindings/js/ecore_js \ 178-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 @@
2#define EOLIAN_JS_CLASS_DEFINITION_HPP 2#define EOLIAN_JS_CLASS_DEFINITION_HPP
3 3
4#include <grammar/klass_def.hpp> 4#include <grammar/klass_def.hpp>
5#include <grammar/indentation.hpp>
6#include <grammar/string.hpp>
5 7
6namespace eolian { namespace js { namespace grammar { 8namespace eolian { namespace js { namespace grammar {
7 9
@@ -12,7 +14,52 @@ struct class_registration_generator
12 template <typename OutputIterator, typename Context> 14 template <typename OutputIterator, typename Context>
13 bool generate(OutputIterator sink, attributes::klass_def const& cls, Context const& context) const 15 bool generate(OutputIterator sink, attributes::klass_def const& cls, Context const& context) const
14 { 16 {
17 using namespace efl::eolian::grammar;
18 using efl::eolian::grammar::attributes::unused;
19
20 std::string suffix;
21 switch(cls.type)
22 {
23 case attributes::class_type::regular:
24 case attributes::class_type::abstract_:
25 suffix = "CLASS";
26 break;
27 case attributes::class_type::mixin:
28 suffix = "MIXIN";
29 break;
30 case attributes::class_type::interface_:
31 suffix = "INTERFACE";
32 break;
33 }
15 34
35 std::string class_name;
36 as_generator(upper_case[*(string << "_")] << upper_case[string] << "_" << suffix)
37 .generate(std::back_inserter(class_name), std::make_tuple(cls.namespaces, cls.cxx_name), context_null{});
38
39 as_generator
40 (
41 "namespace efl { namespace js { namespace binding { namespace {\nstatic void register_"
42 << lower_case[*(string << "_")]
43 << lower_case[string]
44 << "(v8::Handle<v8::Object> global, v8::Isolate* isolate)\n"
45 << "{\n"
46 << scope_tab << "v8::Handle<v8::FunctionTemplate> constructor = ::efl::eina::js::compatibility_new<v8::FunctionTemplate>\n"
47 << scope_tab << scope_tab << "(isolate, & ::efl::eo::js::constructor, ::efl::eina::js::compatibility_new<v8::External>(isolate, const_cast<Efl_Class*>("<< class_name << ")));\n"
48 << scope_tab << "(void)" << class_name << ";\n"
49 << scope_tab << "(void)global; (void)isolate; (void)constructor;\n"
50 << "}\n"
51 << "} } } } // namespace efl { namespace js { namespace binding { namespace {\n\n"
52 ).generate(sink, std::make_tuple(cls.namespaces, cls.cxx_name), context);
53
54 // constructors ?
55
56 // v8::Handle<v8::FunctionTemplate> constructor = ::efl::eina::js::compatibility_new<v8::FunctionTemplate>
57 // (isolate, &efl::eo::js::constructor, efl::eina::js::compatibility_new<v8::External>(isolate, const_cast<Efl_Class*>(EFL_UI_WIN_CLASS)));
58
59
60 // methods
61
62 // events
16 63
17 return true; 64 return true;
18 } 65 }
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)
538 538
539 EINA_CXX_DOM_LOG_DBG(eolian::js::domain) << "output was opened"; 539 EINA_CXX_DOM_LOG_DBG(eolian::js::domain) << "output was opened";
540 540
541
541 std::ostream_iterator<char> iterator = std::ostream_iterator<char>(os); 542 std::ostream_iterator<char> iterator = std::ostream_iterator<char>(os);
542 543
543 efl::eolian::grammar::attributes::klass_def klass_def(klass, eolian_unit);
544 std::vector<efl::eolian::grammar::attributes::klass_def> klasses{klass_def};
545
546 // probably not eot file 544 // probably not eot file
547 if(klass) 545 if(klass)
548 { 546 {
547 os << "#ifndef EFL_JAVASCRIPT_EOLIAN_GENERATE_REGISTER_CALL\n";
548 // function to iterate through all inheritance class
549 std::function<void(Eolian_Class const*, std::function<void(Eolian_Class const*)>)>
550 recurse_inherits
551 = [&] (Eolian_Class const* klass, std::function<void(Eolian_Class const*)> function)
552 {
553 for(efl::eina::iterator<const char> first ( ::eolian_class_inherits_get(klass))
554 , last; first != last; ++first)
555 {
556 EINA_CXX_DOM_LOG_WARN(eolian::js::domain) << &*first << std::endl;
557 Eolian_Class const* base = ::eolian_class_get_by_name(eolian_unit, &*first);
558 if(base)
559 {
560 function(base);
561 recurse_inherits(base, function);
562 }
563 }
564 };
565
566 os << "extern \"C\" {\n\n";
567
568 auto includes_fun = [&os] (Eolian_Class const* klass)
569 {
570 os << "#include <" << eolian_class_file_get(klass) << ".h>\n\n";
571 };
572 // generate include for all inheritance
573 recurse_inherits(klass, includes_fun);
574 os << "#include <" << eolian_class_file_get(klass) << ".h>\n\n";
575
576 os << "}\n\n";
577
549 using efl::eolian::grammar::attributes::unused; 578 using efl::eolian::grammar::attributes::unused;
579 using efl::eolian::grammar::context_null;
550 efl::eolian::grammar::attributes::klass_def klass_def(klass, eolian_unit); 580 efl::eolian::grammar::attributes::klass_def klass_def(klass, eolian_unit);
551 if (!eolian::js::grammar::class_registration.generate(iterator, klass_def, unused)) 581 if (!eolian::js::grammar::class_registration.generate(iterator, klass_def, context_null{}))
552 { 582 {
553 throw std::runtime_error("Failed to generate class"); 583 throw std::runtime_error("Failed to generate class");
554 } 584 }
585
586 os << "#else\n";
587 // if (!eolian::js::grammar::call_registration.generate(iterator, klass_def, context_null{}))
588 // {
589 // throw std::runtime_error("Failed to generate class");
590 // }
591 os << "#endif\n";
555 } 592 }
556 593
557 // std::vector<Eolian_Function const*> constructor_functions; 594 // 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 @@
36# endif 36# endif
37#endif /* ! _WIN32 */ 37#endif /* ! _WIN32 */
38 38
39EAPI void eina_container_register(v8::Handle<v8::Object>, v8::Isolate* isolate); 39namespace {
40EAPI void eina_log_register(v8::Handle<v8::Object>, v8::Isolate* isolate);
41EAPI void eina_value_register(v8::Handle<v8::Object>, v8::Isolate* isolate);
42EAPI void register_ecore_mainloop(v8::Handle<v8::Object> global, v8::Isolate* isolate);
43
44namespace ecore {
45 //EAPI void register_exe(v8::Handle<v8::Object> global, v8::Isolate* isolate);
46EAPI void register_idler(v8::Handle<v8::Object> global, v8::Isolate* isolate);
47EAPI void register_ecore(v8::Isolate* isolate, v8::Handle<v8::Object> exports);
48namespace idle {
49EAPI void register_enterer(v8::Handle<v8::Object> global, v8::Isolate* isolate);
50EAPI void register_exiter(v8::Handle<v8::Object> global, v8::Isolate* isolate);
51}
52EAPI void register_job(v8::Handle<v8::Object> global, v8::Isolate* isolate);
53 //EAPI void register_parent(v8::Handle<v8::Object> global, v8::Isolate* isolate);
54EAPI void register_poller(v8::Handle<v8::Object> global, v8::Isolate* isolate);
55EAPI void register_timer(v8::Handle<v8::Object> global, v8::Isolate* isolate);
56}
57
58EAPI void register_ecore_audio(v8::Handle<v8::Object> global, v8::Isolate* isolate);
59EAPI void register_ecore_audio_in(v8::Handle<v8::Object> global, v8::Isolate* isolate);
60EAPI void register_ecore_audio_in_sndfile(v8::Handle<v8::Object> global, v8::Isolate* isolate);
61EAPI void register_ecore_audio_in_tone(v8::Handle<v8::Object> global, v8::Isolate* isolate);
62EAPI void register_ecore_audio_out(v8::Handle<v8::Object> global, v8::Isolate* isolate);
63EAPI void register_ecore_audio_out_pulse(v8::Handle<v8::Object> global, v8::Isolate* isolate);
64EAPI void register_ecore_audio_out_sndfile(v8::Handle<v8::Object> global, v8::Isolate* isolate);
65
66namespace efl {
67EAPI void register_object(v8::Handle<v8::Object> global, v8::Isolate* isolate);
68EAPI void register_animator(v8::Handle<v8::Object> global, v8::Isolate* isolate);
69EAPI void register_container(v8::Handle<v8::Object> global, v8::Isolate* isolate);
70EAPI void register_control(v8::Handle<v8::Object> global, v8::Isolate* isolate);
71EAPI void register_file(v8::Handle<v8::Object> global, v8::Isolate* isolate);
72EAPI void register_image(v8::Handle<v8::Object> global, v8::Isolate* isolate);
73EAPI void register_loop(v8::Handle<v8::Object> global, v8::Isolate* isolate);
74EAPI void register_orientation(v8::Handle<v8::Object> global, v8::Isolate* isolate);
75EAPI void register_player(v8::Handle<v8::Object> global, v8::Isolate* isolate);
76EAPI void register_text(v8::Handle<v8::Object> global, v8::Isolate* isolate);
77EAPI void register_text_properties(v8::Handle<v8::Object> global, v8::Isolate* isolate);
78}
79
80namespace efl { namespace ui {
81EAPI void register_button(v8::Handle<v8::Object> global, v8::Isolate* isolate);
82EAPI void register_check(v8::Handle<v8::Object> global, v8::Isolate* isolate);
83EAPI void register_progressbar(v8::Handle<v8::Object> global, v8::Isolate* isolate);
84EAPI void register_radio(v8::Handle<v8::Object> global, v8::Isolate* isolate);
85EAPI void register_slider(v8::Handle<v8::Object> global, v8::Isolate* isolate);
86EAPI void register_video(v8::Handle<v8::Object> global, v8::Isolate* isolate);
87EAPI void register_flip(v8::Handle<v8::Object> global, v8::Isolate* isolate);
88EAPI void register_frame(v8::Handle<v8::Object> global, v8::Isolate* isolate);
89EAPI void register_box(v8::Handle<v8::Object> global, v8::Isolate* isolate);
90EAPI void register_image(v8::Handle<v8::Object> global, v8::Isolate* isolate);
91EAPI void register_win(v8::Handle<v8::Object> global, v8::Isolate* isolate);
92}}
93
94namespace efl { namespace ui { namespace image {
95EAPI void register_zoomable(v8::Handle<v8::Object> global, v8::Isolate* isolate);
96}}}
97
98namespace efl { namespace ui { namespace image { namespace zoomable {
99EAPI void register_pan(v8::Handle<v8::Object> global, v8::Isolate* isolate);
100}}}}
101
102namespace efl { namespace canvas {
103EAPI void register_object(v8::Handle<v8::Object> global, v8::Isolate* isolate);
104EAPI void register_group(v8::Handle<v8::Object> global, v8::Isolate* isolate);
105EAPI void register_rectangle(v8::Handle<v8::Object> global, v8::Isolate* isolate);
106}}
107
108namespace evas {
109EAPI void register_box(v8::Handle<v8::Object> global, v8::Isolate* isolate);
110EAPI void register_canvas(v8::Handle<v8::Object> global, v8::Isolate* isolate);
111EAPI void register_clickable_interface(v8::Handle<v8::Object> global, v8::Isolate* isolate);
112EAPI void register_common_interface(v8::Handle<v8::Object> global, v8::Isolate* isolate);
113EAPI void register_draggable_interface(v8::Handle<v8::Object> global, v8::Isolate* isolate);
114EAPI void register_grid(v8::Handle<v8::Object> global, v8::Isolate* isolate);
115EAPI void register_image(v8::Handle<v8::Object> global, v8::Isolate* isolate);
116EAPI void register_line(v8::Handle<v8::Object> global, v8::Isolate* isolate);
117EAPI void register_object(v8::Handle<v8::Object> global, v8::Isolate* isolate);
118EAPI void register_object_smart(v8::Handle<v8::Object> global, v8::Isolate* isolate);
119EAPI void register_out(v8::Handle<v8::Object> global, v8::Isolate* isolate);
120EAPI void register_scrollable_interface(v8::Handle<v8::Object> global, v8::Isolate* isolate);
121EAPI void register_selectable_interface(v8::Handle<v8::Object> global, v8::Isolate* isolate);
122EAPI void register_signal_interface(v8::Handle<v8::Object> global, v8::Isolate* isolate);
123EAPI void register_smart_clipped(v8::Handle<v8::Object> global, v8::Isolate* isolate);
124EAPI void register_table(v8::Handle<v8::Object> global, v8::Isolate* isolate);
125EAPI void register_text(v8::Handle<v8::Object> global, v8::Isolate* isolate);
126EAPI void register_textblock(v8::Handle<v8::Object> global, v8::Isolate* isolate);
127EAPI void register_textgrid(v8::Handle<v8::Object> global, v8::Isolate* isolate);
128EAPI void register_zoomable_interface(v8::Handle<v8::Object> global, v8::Isolate* isolate);
129
130namespace canvas3d {
131EAPI void register_camera(v8::Handle<v8::Object> global, v8::Isolate* isolate);
132EAPI void register_light(v8::Handle<v8::Object> global, v8::Isolate* isolate);
133EAPI void register_material(v8::Handle<v8::Object> global, v8::Isolate* isolate);
134EAPI void register_mesh(v8::Handle<v8::Object> global, v8::Isolate* isolate);
135EAPI void register_node(v8::Handle<v8::Object> global, v8::Isolate* isolate);
136EAPI void register_object(v8::Handle<v8::Object> global, v8::Isolate* isolate);
137EAPI void register_scene(v8::Handle<v8::Object> global, v8::Isolate* isolate);
138EAPI void register_texture(v8::Handle<v8::Object> global, v8::Isolate* isolate);
139} }
140
141namespace efl { namespace canvas {
142EAPI void register_polygon(v8::Handle<v8::Object> global, v8::Isolate* isolate);
143}}
144
145namespace edje {
146EAPI void register_edit(v8::Handle<v8::Object> global, v8::Isolate* isolate);
147EAPI void register_object(v8::Handle<v8::Object> global, v8::Isolate* isolate);
148}
149 40
150namespace emotion { 41void namespace_accessor_get(v8::Local<v8::Name> name, v8::PropertyCallbackInfo<v8::Value> const& info)
151EAPI void register_object(v8::Handle<v8::Object> global, v8::Isolate* isolate); 42{
43 std::cout << "was it here?" << std::endl;
44 v8::Local<v8::String> name_str = name->ToString();
45 assert(!!*name_str);
46 v8::String::Utf8Value value(info.GetIsolate(), name_str);
47 std::cout << *value << std::endl;
48
49 if(info.Data()->IsNullOrUndefined())
50 {
51 std::cout << "no value already assigned" << std::endl;
52 }
53 else
54 std::cout << "value already assigned" << std::endl;
152} 55}
153EAPI void register_elm_atspi_app_object(v8::Handle<v8::Object> global, v8::Isolate* isolate); 56
154EAPI void register_elm_interface_atspi_accessible(v8::Handle<v8::Object> global, v8::Isolate* isolate);
155EAPI void register_elm_interface_atspi_action(v8::Handle<v8::Object> global, v8::Isolate* isolate);
156EAPI void register_efl_access_component(v8::Handle<v8::Object> global, v8::Isolate* isolate);
157EAPI void register_elm_interface_atspi_editable_text(v8::Handle<v8::Object> global, v8::Isolate* isolate);
158EAPI void register_elm_interface_atspi_image(v8::Handle<v8::Object> global, v8::Isolate* isolate);
159EAPI void register_elm_interface_atspi_selection(v8::Handle<v8::Object> global, v8::Isolate* isolate);
160EAPI void register_elm_interface_atspi_text(v8::Handle<v8::Object> global, v8::Isolate* isolate);
161EAPI void register_elm_interface_atspi_value(v8::Handle<v8::Object> global, v8::Isolate* isolate);
162EAPI void register_elm_interface_atspi_widget_action(v8::Handle<v8::Object> global, v8::Isolate* isolate);
163EAPI void register_elm_interface_atspi_window(v8::Handle<v8::Object> global, v8::Isolate* isolate);
164EAPI void register_elm_interface_fileselector(v8::Handle<v8::Object> global, v8::Isolate* isolate);
165EAPI void register_elm_interface_scrollable(v8::Handle<v8::Object> global, v8::Isolate* isolate);
166EAPI void register_elm_pan(v8::Handle<v8::Object> global, v8::Isolate* isolate);
167
168namespace elm {
169
170EAPI void register_bg(v8::Handle<v8::Object> global, v8::Isolate* isolate);
171EAPI void register_calendar(v8::Handle<v8::Object> global, v8::Isolate* isolate);
172EAPI void register_clock(v8::Handle<v8::Object> global, v8::Isolate* isolate);
173EAPI void register_colorselector(v8::Handle<v8::Object> global, v8::Isolate* isolate);
174EAPI void register_conformant(v8::Handle<v8::Object> global, v8::Isolate* isolate);
175EAPI void register_container(v8::Handle<v8::Object> global, v8::Isolate* isolate);
176EAPI void register_combobox(v8::Handle<v8::Object> global, v8::Isolate* isolate);
177EAPI void register_ctxpopup(v8::Handle<v8::Object> global, v8::Isolate* isolate);
178EAPI void register_dayselector(v8::Handle<v8::Object> global, v8::Isolate* isolate);
179EAPI void register_entry(v8::Handle<v8::Object> global, v8::Isolate* isolate);
180EAPI void register_fileselector(v8::Handle<v8::Object> global, v8::Isolate* isolate);
181EAPI void register_flip(v8::Handle<v8::Object> global, v8::Isolate* isolate);
182EAPI void register_gengrid(v8::Handle<v8::Object> global, v8::Isolate* isolate);
183EAPI void register_gengrid_pan(v8::Handle<v8::Object> global, v8::Isolate* isolate);
184EAPI void register_genlist(v8::Handle<v8::Object> global, v8::Isolate* isolate);
185EAPI void register_genlist_pan(v8::Handle<v8::Object> global, v8::Isolate* isolate);
186EAPI void register_gesture_layer(v8::Handle<v8::Object> global, v8::Isolate* isolate);
187EAPI void register_glview(v8::Handle<v8::Object> global, v8::Isolate* isolate);
188EAPI void register_hover(v8::Handle<v8::Object> global, v8::Isolate* isolate);
189EAPI void register_index(v8::Handle<v8::Object> global, v8::Isolate* isolate);
190EAPI void register_label(v8::Handle<v8::Object> global, v8::Isolate* isolate);
191EAPI void register_layout(v8::Handle<v8::Object> global, v8::Isolate* isolate);
192EAPI void register_list(v8::Handle<v8::Object> global, v8::Isolate* isolate);
193EAPI void register_map(v8::Handle<v8::Object> global, v8::Isolate* isolate);
194EAPI void register_map_pan(v8::Handle<v8::Object> global, v8::Isolate* isolate);
195EAPI void register_menu(v8::Handle<v8::Object> global, v8::Isolate* isolate);
196EAPI void register_multibuttonentry(v8::Handle<v8::Object> global, v8::Isolate* isolate);
197EAPI void register_notify(v8::Handle<v8::Object> global, v8::Isolate* isolate);
198EAPI void register_panel(v8::Handle<v8::Object> global, v8::Isolate* isolate);
199EAPI void register_panes(v8::Handle<v8::Object> global, v8::Isolate* isolate);
200EAPI void register_player(v8::Handle<v8::Object> global, v8::Isolate* isolate);
201EAPI void register_plug(v8::Handle<v8::Object> global, v8::Isolate* isolate);
202EAPI void register_popup(v8::Handle<v8::Object> global, v8::Isolate* isolate);
203EAPI void register_route(v8::Handle<v8::Object> global, v8::Isolate* isolate);
204EAPI void register_scroller(v8::Handle<v8::Object> global, v8::Isolate* isolate);
205EAPI void register_spinner(v8::Handle<v8::Object> global, v8::Isolate* isolate);
206EAPI void register_systray(v8::Handle<v8::Object> global, v8::Isolate* isolate);
207EAPI void register_toolbar(v8::Handle<v8::Object> global, v8::Isolate* isolate);
208EAPI void register_web(v8::Handle<v8::Object> global, v8::Isolate* isolate);
209EAPI void register_widget(v8::Handle<v8::Object> global, v8::Isolate* isolate);
210EAPI void register_win(v8::Handle<v8::Object> global, v8::Isolate* isolate);
211EAPI void register_widget_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
212EAPI void register_color_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
213EAPI void register_dayselector_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
214EAPI void register_flipselector_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
215EAPI void register_menu_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
216EAPI void register_ctxpopup_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
217EAPI void register_index_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
218EAPI void register_multibuttonentry_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
219EAPI void register_naviframe_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
220EAPI void register_genlist_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
221EAPI void register_gengrid_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
222EAPI void register_list_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
223EAPI void register_toolbar_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
224EAPI void register_diskselector_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
225EAPI void register_popup_item(v8::Handle<v8::Object> global, v8::Isolate* isolate);
226
227} 57}
228 58
229#ifdef HAVE_NODEJS 59#ifdef HAVE_NODEJS
@@ -235,7 +65,7 @@ namespace {
235namespace efl_js { 65namespace efl_js {
236#endif 66#endif
237 67
238EAPI void init(v8::Handle<v8::Object> exports) 68EAPI void init(v8::Local<v8::Object> exports, v8::Local<v8::Object> module)
239{ 69{
240 static char* argv[] = {const_cast<char*>("node")}; 70 static char* argv[] = {const_cast<char*>("node")};
241 ::elm_init(1, argv); 71 ::elm_init(1, argv);
@@ -246,267 +76,22 @@ EAPI void init(v8::Handle<v8::Object> exports)
246 76
247 try 77 try
248 { 78 {
249 eina_container_register(exports, v8::Isolate::GetCurrent()); 79 // eina_container_register(exports, v8::Isolate::GetCurrent());
250 eina_log_register(exports, v8::Isolate::GetCurrent()); 80 // eina_log_register(exports, v8::Isolate::GetCurrent());
251 eina_value_register(exports, v8::Isolate::GetCurrent()); 81 // eina_value_register(exports, v8::Isolate::GetCurrent());
252 //register_ecore_mainloop(exports, v8::Isolate::GetCurrent()); 82 // //register_ecore_mainloop(exports, v8::Isolate::GetCurrent());
253 efl::eio::js::register_eio(v8::Isolate::GetCurrent(), exports); 83
254 efl::eldbus::js::register_eldbus(v8::Isolate::GetCurrent(), exports); 84 v8::Isolate* isolate = exports->GetIsolate();
255 efl::ethumb::js::register_ethumb(v8::Isolate::GetCurrent(), exports); 85
256 //ecore::register_exe(exports, v8::Isolate::GetCurrent()); 86 v8::Local<v8::ObjectTemplate> ns_obj;
257 // ecore::register_idler(exports, v8::Isolate::GetCurrent()); 87 {
258 // ecore::idle::register_enterer(exports, v8::Isolate::GetCurrent()); 88 auto evas = ::efl::eina::js::compatibility_new<v8::Object>(isolate);
259 // ecore::idle::register_exiter(exports, v8::Isolate::GetCurrent()); 89 ns_obj = ::efl::eina::js::compatibility_new<v8::ObjectTemplate>(isolate);
260 // ecore::register_job(exports, v8::Isolate::GetCurrent()); 90 ns_obj->SetHandler({&namespace_accessor_get});
261 //ecore::register_parent(exports, v8::Isolate::GetCurrent()); 91 auto obj = ns_obj->NewInstance();
262 // ecore::register_poller(exports, v8::Isolate::GetCurrent()); 92 obj->Set(::efl::eina::js::compatibility_new<v8::String>(isolate, "evas"), evas);
263 // ecore::register_timer(exports, v8::Isolate::GetCurrent()); 93 module->Set(::efl::eina::js::compatibility_new<v8::String>(isolate, "exports"), obj);
264#if 0 94 }
265 register_ecore_audio(exports, v8::Isolate::GetCurrent());
266 register_ecore_audio_in(exports, v8::Isolate::GetCurrent());
267 register_ecore_audio_in_sndfile(exports, v8::Isolate::GetCurrent());
268 register_ecore_audio_in_tone(exports, v8::Isolate::GetCurrent());
269 register_ecore_audio_out(exports, v8::Isolate::GetCurrent());
270 register_ecore_audio_out_pulse(exports, v8::Isolate::GetCurrent());
271 register_ecore_audio_out_sndfile(exports, v8::Isolate::GetCurrent());
272#endif
273 // Manual ecore binding initialized last to allow extension of namespace
274 // created by eolian.
275 efl::ecore::js::register_ecore(v8::Isolate::GetCurrent(), exports);
276 efl::register_animator(exports, v8::Isolate::GetCurrent());
277 efl::register_control(exports, v8::Isolate::GetCurrent());
278 efl::register_file(exports, v8::Isolate::GetCurrent());
279 efl::register_image(exports, v8::Isolate::GetCurrent());
280 efl::register_orientation(exports, v8::Isolate::GetCurrent());
281 efl::register_loop(exports, v8::Isolate::GetCurrent());
282 efl::register_player(exports, v8::Isolate::GetCurrent());
283 efl::register_text(exports, v8::Isolate::GetCurrent());
284 // efl::register_text_properties(exports, v8::Isolate::GetCurrent());
285 efl::register_object(exports, v8::Isolate::GetCurrent());
286#if 1
287 // evas::register_box(exports, v8::Isolate::GetCurrent());
288 // evas::register_canvas(exports, v8::Isolate::GetCurrent());
289 // evas::register_clickable_interface(exports, v8::Isolate::GetCurrent());
290 // evas::register_common_interface(exports, v8::Isolate::GetCurrent());
291 // evas::register_draggable_interface(exports, v8::Isolate::GetCurrent());
292 // evas::register_grid(exports, v8::Isolate::GetCurrent());
293 // evas::register_image(exports, v8::Isolate::GetCurrent());
294 // evas::register_line(exports, v8::Isolate::GetCurrent());
295 efl::canvas::register_object(exports, v8::Isolate::GetCurrent());
296 efl::canvas::register_group(exports, v8::Isolate::GetCurrent());
297 // evas::register_object_smart(exports, v8::Isolate::GetCurrent());
298 // evas::register_out(exports, v8::Isolate::GetCurrent());
299 efl::canvas::register_rectangle(exports, v8::Isolate::GetCurrent());
300 // evas::register_scrollable_interface(exports, v8::Isolate::GetCurrent());
301 // evas::register_selectable_interface(exports, v8::Isolate::GetCurrent());
302 // evas::register_signal_interface(exports, v8::Isolate::GetCurrent());
303 // evas::register_smart_clipped(exports, v8::Isolate::GetCurrent());
304 // evas::register_table(exports, v8::Isolate::GetCurrent());
305 // evas::register_text(exports, v8::Isolate::GetCurrent());
306 // evas::register_textblock(exports, v8::Isolate::GetCurrent());
307 // evas::register_textgrid(exports, v8::Isolate::GetCurrent());
308 // evas::register_zoomable_interface(exports, v8::Isolate::GetCurrent());
309 // evas::canvas3d::register_camera(exports, v8::Isolate::GetCurrent());
310 // evas::canvas3d::register_light(exports, v8::Isolate::GetCurrent());
311 // evas::canvas3d::register_material(exports, v8::Isolate::GetCurrent());
312 // evas::canvas3d::register_mesh(exports, v8::Isolate::GetCurrent());
313 // evas::canvas3d::register_node(exports, v8::Isolate::GetCurrent());
314 // evas::canvas3d::register_object(exports, v8::Isolate::GetCurrent());
315 // evas::canvas3d::register_scene(exports, v8::Isolate::GetCurrent());
316 // evas::canvas3d::register_texture(exports, v8::Isolate::GetCurrent());
317 // efl::canvas::register_polygon(exports, v8::Isolate::GetCurrent());
318#endif
319#if 0
320 edje::register_edit(exports, v8::Isolate::GetCurrent());
321 edje::register_object(exports, v8::Isolate::GetCurrent());
322#endif
323#if 0
324 emotion::register_object(exports, v8::Isolate::GetCurrent());
325#endif
326
327 // elm::register_access(exports, v8::Isolate::GetCurrent());
328 // elm::register_actionslider(exports, v8::Isolate::GetCurrent());
329 // ::register_elm_atspi_app_object(exports, v8::Isolate::GetCurrent());
330 // elm::register_box(exports, v8::Isolate::GetCurrent());
331
332 elm::register_bg(exports, v8::Isolate::GetCurrent());
333 efl::ui::register_button(exports, v8::Isolate::GetCurrent());
334 elm::register_calendar(exports, v8::Isolate::GetCurrent());
335
336 efl::ui::register_check(exports, v8::Isolate::GetCurrent());
337
338 // crash
339 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
340 elm::register_clock(exports, v8::Isolate::GetCurrent());
341 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
342
343 // crash
344 // elm::register_colorselector(exports, v8::Isolate::GetCurrent());
345
346 elm::register_conformant(exports, v8::Isolate::GetCurrent());
347
348 // crash
349 // elm::register_combobox(exports, v8::Isolate::GetCurrent());
350
351 // doesn't exist
352 efl::register_container(exports, v8::Isolate::GetCurrent());
353
354 elm::register_ctxpopup(exports, v8::Isolate::GetCurrent());
355 elm::register_dayselector(exports, v8::Isolate::GetCurrent());
356
357 // crash
358 // elm::register_diskselector(exports, v8::Isolate::GetCurrent());
359
360 elm::register_entry(exports, v8::Isolate::GetCurrent());
361 elm::register_fileselector(exports, v8::Isolate::GetCurrent());
362
363 efl::ui::register_frame(exports, v8::Isolate::GetCurrent());
364 efl::ui::register_box(exports, v8::Isolate::GetCurrent());
365 efl::ui::register_image(exports, v8::Isolate::GetCurrent());
366
367 // crash
368 // elm::register_gengrid(exports, v8::Isolate::GetCurrent());
369
370 // doesn't exist
371 // elm::register_gengrid_pan(exports, v8::Isolate::GetCurrent());
372
373 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
374 // crash
375 elm::register_genlist(exports, v8::Isolate::GetCurrent());
376 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
377 // elm::register_genlist_pan(exports, v8::Isolate::GetCurrent());
378 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
379 elm::register_gesture_layer(exports, v8::Isolate::GetCurrent());
380 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
381 elm::register_glview(exports, v8::Isolate::GetCurrent());
382 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
383 // elm::register_grid(exports, v8::Isolate::GetCurrent());
384 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
385 elm::register_index(exports, v8::Isolate::GetCurrent());
386 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
387
388 // ::register_elm_interface_atspi_accessible(exports, v8::Isolate::GetCurrent());
389 // ::register_elm_interface_atspi_action(exports, v8::Isolate::GetCurrent());
390 // ::register_efl_access_component(exports, v8::Isolate::GetCurrent());
391 // ::register_elm_interface_atspi_editable_text(exports, v8::Isolate::GetCurrent());
392 // ::register_elm_interface_atspi_image(exports, v8::Isolate::GetCurrent());
393 // ::register_elm_interface_atspi_selection(exports, v8::Isolate::GetCurrent());
394 // ::register_elm_interface_atspi_text(exports, v8::Isolate::GetCurrent());
395 // ::register_elm_interface_atspi_value(exports, v8::Isolate::GetCurrent());
396 // ::register_elm_interface_atspi_widget_action(exports, v8::Isolate::GetCurrent());
397 // ::register_elm_interface_atspi_window(exports, v8::Isolate::GetCurrent());
398 // ::register_elm_interface_fileselector(exports, v8::Isolate::GetCurrent());
399 // ::register_elm_interface_scrollable(exports, v8::Isolate::GetCurrent());
400
401 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
402 elm::register_label(exports, v8::Isolate::GetCurrent());
403 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
404 elm::register_layout(exports, v8::Isolate::GetCurrent());
405 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
406 // elm::register_list(exports, v8::Isolate::GetCurrent());
407 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
408 elm::register_map(exports, v8::Isolate::GetCurrent());
409 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
410
411 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
412 // elm::register_map_pan(exports, v8::Isolate::GetCurrent());
413 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
414 //elm::register_mapbuf(exports, v8::Isolate::GetCurrent());
415 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
416 elm::register_menu(exports, v8::Isolate::GetCurrent());
417 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
418 elm::register_multibuttonentry(exports, v8::Isolate::GetCurrent());
419 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
420 elm::register_notify(exports, v8::Isolate::GetCurrent());
421 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
422
423 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
424 // ::register_elm_pan(exports, v8::Isolate::GetCurrent());
425 elm::register_panel(exports, v8::Isolate::GetCurrent());
426 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
427 elm::register_panes(exports, v8::Isolate::GetCurrent());
428 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
429 efl::ui::image::register_zoomable(exports, v8::Isolate::GetCurrent());
430 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
431 // efl::ui::image::zoomable::register_pan(exports, v8::Isolate::GetCurrent());
432 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
433 elm::register_player(exports, v8::Isolate::GetCurrent());
434 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
435 elm::register_plug(exports, v8::Isolate::GetCurrent());
436 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
437 elm::register_popup(exports, v8::Isolate::GetCurrent());
438 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
439 efl::ui::register_progressbar(exports, v8::Isolate::GetCurrent());
440 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
441 efl::ui::register_radio(exports, v8::Isolate::GetCurrent());
442 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
443
444 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
445 elm::register_route(exports, v8::Isolate::GetCurrent());
446 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
447 elm::register_scroller(exports, v8::Isolate::GetCurrent());
448 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
449 efl::ui::register_slider(exports, v8::Isolate::GetCurrent());
450 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
451 elm::register_spinner(exports, v8::Isolate::GetCurrent());
452 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
453 elm::register_systray(exports, v8::Isolate::GetCurrent());
454 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
455 // elm::register_table(exports, v8::Isolate::GetCurrent());
456 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
457 elm::register_toolbar(exports, v8::Isolate::GetCurrent());
458 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
459 efl::ui::register_flip(exports, v8::Isolate::GetCurrent());
460 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
461 efl::ui::register_video(exports, v8::Isolate::GetCurrent());
462 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
463 elm::register_web(exports, v8::Isolate::GetCurrent());
464 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
465 elm::register_widget(exports, v8::Isolate::GetCurrent());
466 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
467
468 // crash
469 // elm::register_win(exports, v8::Isolate::GetCurrent());
470 fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
471 efl::ui::register_win(exports, v8::Isolate::GetCurrent());
472
473 // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
474 // elm::register_widget_item(exports, v8::Isolate::GetCurrent());
475 // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
476 // elm::register_color_item(exports, v8::Isolate::GetCurrent());
477 // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
478 // elm::register_dayselector_item(exports, v8::Isolate::GetCurrent());
479 // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
480 // elm::register_hoversel_item(exports, v8::Isolate::GetCurrent());
481 // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
482 // elm::register_segment_control_item(exports, v8::Isolate::GetCurrent());
483 // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
484 // elm::register_slideshow_item(exports, v8::Isolate::GetCurrent());
485 // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
486 // elm::register_flipselector_item(exports, v8::Isolate::GetCurrent());
487 // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
488 // elm::register_menu_item(exports, v8::Isolate::GetCurrent());
489 // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
490 // elm::register_ctxpopup_item(exports, v8::Isolate::GetCurrent());
491 // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
492 // elm::register_index_item(exports, v8::Isolate::GetCurrent());
493 // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
494 // elm::register_multibuttonentry_item(exports, v8::Isolate::GetCurrent());
495 // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
496 // elm::register_naviframe_item(exports, v8::Isolate::GetCurrent());
497 // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
498 // elm::register_genlist_item(exports, v8::Isolate::GetCurrent());
499 // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
500 // elm::register_gengrid_item(exports, v8::Isolate::GetCurrent());
501 // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
502 // elm::register_list_item(exports, v8::Isolate::GetCurrent());
503 // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
504 // elm::register_toolbar_item(exports, v8::Isolate::GetCurrent());
505 // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
506 // elm::register_diskselector_item(exports, v8::Isolate::GetCurrent());
507 // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
508 // elm::register_popup_item(exports, v8::Isolate::GetCurrent());
509 // fprintf(stderr, __FILE__ ":%d\n", __LINE__); fflush(stderr);
510 } 95 }
511 catch(...) 96 catch(...)
512 { 97 {
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 @@
10#include <eo_js_namespace.hh> 10#include <eo_js_namespace.hh>
11#include <eo_js_struct.hh> 11#include <eo_js_struct.hh>
12#include <eo_js_construct_from_eo.hh> 12#include <eo_js_construct_from_eo.hh>
13#include <eo_js_namespace_accessor.hh>
13 14
14#endif 15#endif
15 16
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 @@
15 15
16namespace efl { namespace eo { namespace js { 16namespace efl { namespace eo { namespace js {
17 17
18inline eina::js::compatibility_return_type constructor(eina::js::compatibility_callback_info_type args)
19{
20 if(args.IsConstructCall())
21 {
22 std::size_t argc = args.Length();
23
24 Efl_Class* kls =
25 static_cast<Efl_Class*>(v8::External::Cast(*args.Data())->Value());
26 Eo* eo;
27
28 // constructor without parent or lambda
29 if(argc == 0)
30 {
31 eo = _efl_add_internal_start(__FILE__, __LINE__, kls, NULL, EINA_TRUE, EINA_TRUE);
32 }
33 // constructor with lambda or
34 // constructor with parent
35 else if(argc == 1)
36 {
37 auto arg_0 = args[0];
38 v8::Local<v8::Object> obj_arg0;
39 v8::Local<v8::Object> self = args.This();
40 v8::External* external;
41 v8::Function* function;
42 if(arg_0->IsObject() && (obj_arg0 = arg_0->ToObject())->InternalFieldCount() == 1
43 && (external = v8::External::Cast(*obj_arg0->GetInternalField(0)))) // parent
44 {
45 Eo* parent = static_cast<Eo*>(external->Value());
46 eo = _efl_add_internal_start(__FILE__, __LINE__, kls, parent, EINA_TRUE, EINA_TRUE);
47 self->SetInternalField(0, eina::js::compatibility_new<v8::External>(args.GetIsolate(), eo));
48 }
49 else if(arg_0->IsObject() && (function = v8::Function::Cast(*obj_arg0->GetInternalField(0))))
50 {
51 eo = _efl_add_internal_start(__FILE__, __LINE__, kls, NULL, EINA_TRUE, EINA_TRUE);
52 self->SetInternalField(0, eina::js::compatibility_new<v8::External>(args.GetIsolate(), eo));
53
54 // call lambda
55 v8::Local<v8::Value> call_args[] = {
56 args.This(),
57 };
58 function->Call(eina::js::compatibility_global(), 1, call_args);
59 }
60 else
61 {
62 // TypeError
63 }
64 self->SetInternalField(0, eina::js::compatibility_new<v8::External>(args.GetIsolate(), _efl_add_end(eo, EINA_TRUE, EINA_TRUE)));
65 return eina::js::compatibility_return();
66 }
67 // constructor with parent and lambda
68 else if(argc == 2)
69 {
70 Eo* parent;
71 eo = _efl_add_internal_start(__FILE__, __LINE__, kls, parent, EINA_TRUE, EINA_TRUE);
72 // call lambda
73 return eina::js::compatibility_return();
74 }
75 else
76 {
77 // TypeError
78 return eina::js::compatibility_return();
79 }
80 }
81 else
82 {
83 // TypeError
84
85 return eina::js::compatibility_return();
86 }
87}
88
18template <typename T> 89template <typename T>
19struct eo_function_params; 90struct eo_function_params;
20 91
@@ -30,126 +101,128 @@ struct eo_function_params<R(*)(Eo const*, P...)>
30 typedef std::tuple<P...> type; 101 typedef std::tuple<P...> type;
31}; 102};
32 103
33inline eina::js::compatibility_return_type constructor(eina::js::compatibility_callback_info_type args) 104// inline eina::js::compatibility_return_type constructor(eina::js::compatibility_callback_info_type args)
34{ 105// {
35 if(args.IsConstructCall()) 106// if(args.IsConstructCall())
36 { 107// {
37 void* data = v8::External::Cast(*args.Data())->Value(); 108// void* data = v8::External::Cast(*args.Data())->Value();
38 std::function<eina::js::compatibility_return_type(eina::js::compatibility_callback_info_type)>* 109// std::function<eina::js::compatibility_return_type(eina::js::compatibility_callback_info_type)>*
39 f = static_cast<std::function<eina::js::compatibility_return_type(eina::js::compatibility_callback_info_type)>*> 110// f = static_cast<std::function<eina::js::compatibility_return_type(eina::js::compatibility_callback_info_type)>*>
40 (data); 111// (data);
41 return (*f)(args); 112// return (*f)(args);
42 } 113// }
43 else 114// else
44 { 115// {
45 std::size_t argc = args.Length(); 116// std::size_t argc = args.Length();
46 std::vector<v8::Local<v8::Value> > argv (argc ? argc : 1 ); 117// std::vector<v8::Local<v8::Value> > argv (argc ? argc : 1 );
47 for(int i = 0; i != args.Length(); ++i) 118// for(int i = 0; i != args.Length(); ++i)
48 argv[i] = args[i]; 119// argv[i] = args[i];
49 args.Callee()->NewInstance(argc, &argv[0]); 120// args.Callee()->NewInstance(argc, &argv[0]);
50 return eina::js::compatibility_return(); 121// return eina::js::compatibility_return();
51 } 122// }
52} 123// }
53 124
54template <typename...F> 125// template <typename...F>
55struct constructor_caller 126// struct constructor_caller
56{ 127// {
57 struct call 128// struct call
58 { 129// {
59 template <typename T> 130// template <typename T>
60 void operator()(T function) const 131// void operator()(T function) const
61 { 132// {
62 int const parameters 133// int const parameters
63 = std::tuple_size<typename eo::js::eo_function_params<T>::type>::value; 134// = std::tuple_size<typename eo::js::eo_function_params<T>::type>::value;
64 if(*current + parameters <= args->Length()) 135// if(*current + parameters <= args->Length())
65 { 136// {
66 aux(function, eina::make_index_sequence<parameters>()); 137// aux(function, eina::make_index_sequence<parameters>());
67 *current += parameters; 138// *current += parameters;
68 } 139// }
69 else 140// else
70 { 141// {
71 throw std::logic_error("Expected more arguments for this call"); 142// throw std::logic_error("Expected more arguments for this call");
72 } 143// }
73 } 144// }
74 145
75 template <typename U, std::size_t I> 146// template <typename U, std::size_t I>
76 static 147// static
77 typename std::tuple_element<I, typename eo::js::eo_function_params<U>::type>::type 148// typename std::tuple_element<I, typename eo::js::eo_function_params<U>::type>::type
78 get_value(v8::Local<v8::Value> v, v8::Isolate* isolate) 149// get_value(v8::Local<v8::Value> v, v8::Isolate* isolate)
79 { 150// {
80 typename std::tuple_element<I, typename eo::js::eo_function_params<U>::type>::type 151// typename std::tuple_element<I, typename eo::js::eo_function_params<U>::type>::type
81 tmp = 152// tmp =
82 eina::js::get_value_from_javascript 153// eina::js::get_value_from_javascript
83 (v, isolate, "" 154// (v, isolate, ""
84 , eina::js::value_tag<typename std::tuple_element 155// , eina::js::value_tag<typename std::tuple_element
85 <I, typename eo::js::eo_function_params<U>::type>::type>()); 156// <I, typename eo::js::eo_function_params<U>::type>::type>());
86 return tmp; 157// return tmp;
87 } 158// }
88 159
89 template <typename T, std::size_t... I> 160// template <typename T, std::size_t... I>
90 void aux(T function, eina::index_sequence<I...>) const 161// void aux(T function, eina::index_sequence<I...>) const
91 { 162// {
92 function(obj_efl_self, get_value<T, I>((*args)[I + *current], args->GetIsolate())...); 163// function(obj_efl_self, get_value<T, I>((*args)[I + *current], args->GetIsolate())...);
93 } 164// }
94 165
95 Eo* obj_efl_self; 166// Eo* obj_efl_self;
96 int* current; 167// int* current;
97 eina::js::compatibility_callback_info_pointer args; 168// eina::js::compatibility_callback_info_pointer args;
98 }; 169// };
99 170
100 eina::js::compatibility_return_type operator()(eina::js::compatibility_callback_info_type args) const 171// eina::js::compatibility_return_type operator()(eina::js::compatibility_callback_info_type args) const
101 { 172// {
102 int current_index = 1; 173// int current_index = 1;
103 if(args.Length() != 0) 174// if(args.Length() != 0)
104 { 175// {
105 try 176// try
106 { 177// {
107 Eo* parent = eina::js::get_value_from_javascript 178// Eo* parent = eina::js::get_value_from_javascript
108 (args[0], args.GetIsolate(), "", eina::js::value_tag<Eo*>()); 179// (args[0], args.GetIsolate(), "", eina::js::value_tag<Eo*>());
109 Eo* eo = efl_add_ref 180// Eo* eo = efl_add_ref
110 (klass 181// (klass
111 , parent 182// , parent
112 , eina::_mpl::for_each(constructors, call{efl_added, &current_index, &args}) 183// , eina::_mpl::for_each(constructors, call{efl_added, &current_index, &args})
113 ); 184// );
114 if (!eo) 185// if (!eo)
115 throw std::logic_error("Failed to create object."); 186// throw std::logic_error("Failed to create object.");
116 v8::Local<v8::Object> self = args.This(); 187// v8::Local<v8::Object> self = args.This();
117 self->SetInternalField(0, eina::js::compatibility_new<v8::External>(args.GetIsolate(), eo)); 188// self->SetInternalField(0, eina::js::compatibility_new<v8::External>(args.GetIsolate(), eo));
118 efl::eina::js::make_weak(args.GetIsolate(), self 189// efl::eina::js::make_weak(args.GetIsolate(), self
119 , [eo] 190// , [eo]
120 { 191// {
121 efl_unref(eo); 192// efl_unref(eo);
122 }); 193// });
123 } 194// }
124 catch(std::logic_error const& error) 195// catch(std::logic_error const& error)
125 { 196// {
126 eina::js::compatibility_throw 197// eina::js::compatibility_throw
127 (v8::Exception::TypeError 198// (v8::Exception::TypeError
128 (eina::js::compatibility_new<v8::String>(args.GetIsolate(), error.what()))); 199// (eina::js::compatibility_new<v8::String>(args.GetIsolate(), error.what())));
129 } 200// }
130 } 201// }
131 else 202// else
132 { 203// {
133 eina::js::compatibility_throw 204// eina::js::compatibility_throw
134 (v8::Exception::TypeError 205// (v8::Exception::TypeError
135 (eina::js::compatibility_new<v8::String>(args.GetIsolate(), "Expected at least one argument for this call"))); 206// (eina::js::compatibility_new<v8::String>(args.GetIsolate(), "Expected at least one argument for this call")));
136 } 207// }
137 return eina::js::compatibility_return(); 208// return eina::js::compatibility_return();
138 } 209// }
139 210
140 Efl_Class const* klass; 211// Efl_Class const* klass;
141 std::tuple<F...> constructors; 212// std::tuple<F...> constructors;
142}; 213// };
143 214
144template <typename... F> 215// template <typename... F>
145v8::Handle<v8::Value> constructor_data(v8::Isolate* isolate, Efl_Class const* klass, F... f) 216// v8::Handle<v8::Value> constructor_data(v8::Isolate* isolate, Efl_Class const* klass, F... f)
146{ 217// {
147 return eina::js::compatibility_new<v8::External> 218// return eina::js::compatibility_new<v8::External>
148 (isolate 219// (isolate
149 , new std::function<eina::js::compatibility_return_type(eina::js::compatibility_callback_info_type)> 220// , new std::function<eina::js::compatibility_return_type(eina::js::compatibility_callback_info_type)>
150 (constructor_caller<F...>{klass, std::tuple<F...>{f...}})); 221// (constructor_caller<F...>{klass, std::tuple<F...>{f...}}));
151} 222// }
152 223
224
225
153} } } 226} } }
154 227
155#endif 228#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 @@
1#ifndef EFL_EO_JS_NAMESPACE_ACCESSOR_HH
2#define EFL_EO_JS_NAMESPACE_ACCESSOR_HH
3
4namespace efl { namespace eo { namespace js {
5
6inline void accessor_get(v8::Local<v8::Name> name, v8::PropertyCallbackInfo<v8::Value> const& info)
7{
8 v8::Local<v8::String> name_str = name->ToString();
9
10}
11
12inline v8::Local<v8::Object> create_namespace_object()
13{
14
15}
16
17
18} } }
19
20#endif