diff options
author | Vitor Sousa <vitorsousasilva@gmail.com> | 2016-03-14 13:14:37 -0300 |
---|---|---|
committer | Vitor Sousa <vitorsousasilva@gmail.com> | 2016-03-18 17:46:38 -0300 |
commit | a85348b70bdae9672ed2017d9a0c16fa315edcfa (patch) | |
tree | 75da634dbd86e26ed5133077239f7d76d9ff6eaa /src | |
parent | bd200cefc44cb8b03ef465791b4dfc6b6cec85be (diff) | |
download | efl-a85348b70bdae9672ed2017d9a0c16fa315edcfa.tar.gz |
efl js: Update Javascript binding to compile with new Eolian API
Reword test method names to check naming convention.
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/eolian_js/eolian/class.hh | 41 | ||||
-rw-r--r-- | src/bin/eolian_js/eolian/js/format.hh | 16 | ||||
-rw-r--r-- | src/bin/eolian_js/main.cc | 78 | ||||
-rw-r--r-- | src/bindings/js/efl_js/efl_js.cc | 21 | ||||
-rw-r--r-- | src/bindings/js/eina_js/eina_js_compatibility.hh | 9 | ||||
-rw-r--r-- | src/bindings/js/eina_js/eina_js_get_value_from_c.hh | 8 | ||||
-rw-r--r-- | src/bindings/js/eo_js/eo_js_call_function.hh | 20 | ||||
-rw-r--r-- | src/bindings/js/eo_js/eo_js_constructor.hh | 28 | ||||
-rw-r--r-- | src/bindings/js/eo_js/eo_js_event.hh | 10 | ||||
-rw-r--r-- | src/tests/efl_js/benchmark_object_impl.cc | 10 | ||||
-rwxr-xr-x | src/tests/eolian_js/eolian_js_suite.js | 192 | ||||
-rw-r--r-- | src/tests/eolian_js/eolian_js_test_test_object_impl.c | 440 | ||||
-rw-r--r-- | src/tests/eolian_js/test_object.eo | 94 |
13 files changed, 530 insertions, 437 deletions
diff --git a/src/bin/eolian_js/eolian/class.hh b/src/bin/eolian_js/eolian/class.hh index bd04d5fedd..227798700a 100644 --- a/src/bin/eolian_js/eolian/class.hh +++ b/src/bin/eolian_js/eolian/class.hh @@ -38,28 +38,37 @@ inline std::string type_class_name(Eolian_Type const* tp) if (tp) { Eolian_Type_Type tpt = ::eolian_type_type_get(tp); - if (tpt == EOLIAN_TYPE_POINTER || tpt == EOLIAN_TYPE_ALIAS || tpt == EOLIAN_TYPE_REGULAR) + if (tpt == EOLIAN_TYPE_POINTER) { return type_class_name(::eolian_type_base_type_get(tp)); } - else if(tpt == EOLIAN_TYPE_CLASS) + else { - Eolian_Class const* klass = ::eolian_type_class_get(tp); - if (klass) + tp = ::eolian_type_aliased_base_get(tp); + tpt = ::eolian_type_type_get(tp); + if (tpt == EOLIAN_TYPE_CLASS) { - Eina_Stringshare* klass_name = ::eolian_class_full_name_get(klass); - if (!klass_name) - throw std::runtime_error("Could not get Eo class name"); + Eolian_Class const* klass = ::eolian_type_class_get(tp); + if (klass) + { + Eina_Stringshare* klass_name = ::eolian_class_full_name_get(klass); + if (!klass_name) + throw std::runtime_error("Could not get Eo class name"); - return klass_name; - } // TODO: else should throw std::runtime_error("Could not get Eo class"); - } - else if(tpt == EOLIAN_TYPE_STRUCT) - { - auto struct_type_full_name = ::eolian_type_full_name_get(tp); - if (!struct_type_full_name) - throw std::runtime_error("Could not get struct name"); - return struct_type_full_name; + return klass_name; + } // TODO: else should throw std::runtime_error("Could not get Eo class"); + } + else if (tpt == EOLIAN_TYPE_REGULAR) + { + auto tpd = eolian_type_typedecl_get(tp); + if (tpd && eolian_typedecl_type_get(tpd) == EOLIAN_TYPEDECL_STRUCT) + { + auto struct_type_full_name = ::eolian_type_full_name_get(tp); + if (!struct_type_full_name) + throw std::runtime_error("Could not get struct name"); + return struct_type_full_name; + } + } } } return ""; diff --git a/src/bin/eolian_js/eolian/js/format.hh b/src/bin/eolian_js/eolian/js/format.hh index e1f02c30a6..679fb9bb79 100644 --- a/src/bin/eolian_js/eolian/js/format.hh +++ b/src/bin/eolian_js/eolian/js/format.hh @@ -152,7 +152,21 @@ std::string format_method(std::string const& in) std::string format_field(std::string const& in) { - return format_method(in); + std::string r; + bool up = false; + for (char c : in) + { + if (c == '_') + up = true; + else if (!up) + r += c; + else + { + r += std::toupper(c); + up = false; + } + } + return r; } std::string format_class(std::string const& in) diff --git a/src/bin/eolian_js/main.cc b/src/bin/eolian_js/main.cc index c8dc1f08a4..fdf782b076 100644 --- a/src/bin/eolian_js/main.cc +++ b/src/bin/eolian_js/main.cc @@ -66,13 +66,19 @@ _final_type_and_type_type_get(Eolian_Type const* tp_in, Eolian_Type const*& tp_o { tp_out = tp_in; tpt_out = eolian_type_type_get(tp_in); - while ((tpt_out == EOLIAN_TYPE_REGULAR || tpt_out == EOLIAN_TYPE_ALIAS) && !eolian_type_is_extern(tp_out)) + if (tpt_out == EOLIAN_TYPE_REGULAR) { - auto t = eolian_type_base_type_get(tp_out); - // TODO: shouldn't __undefined_type be flagged as external??? - if (!t || !eolian_type_full_name_get(t) || strcmp(eolian_type_full_name_get(t), "__undefined_type") == 0) break; - tp_out = t; - tpt_out = eolian_type_type_get(t); + auto tpd = eolian_type_typedecl_get(tp_out); + if (tpd && eolian_typedecl_type_get(tpd) == EOLIAN_TYPEDECL_ALIAS && + !eolian_typedecl_is_extern(tpd)) + { + auto btp = eolian_typedecl_aliased_base_get(tpd); + if (btp && eolian_type_full_name_get(btp) && + strcmp(eolian_type_full_name_get(btp), "__undefined_type") != 0) + { + _final_type_and_type_type_get(btp, tp_out, tpt_out); + } + } } } @@ -84,7 +90,7 @@ _eolian_type_cpp_type_named_get(const Eolian_Type *tp, std::string const& caller Eolian_Type_Type tpt = EOLIAN_TYPE_UNKNOWN_TYPE; _final_type_and_type_type_get(tp, tp, tpt); - if (tpt == EOLIAN_TYPE_UNKNOWN_TYPE) + if (tpt == EOLIAN_TYPE_UNKNOWN_TYPE || tpt == EOLIAN_TYPE_UNDEFINED) return "error"; std::string result; @@ -92,10 +98,6 @@ _eolian_type_cpp_type_named_get(const Eolian_Type *tp, std::string const& caller if ((tpt == EOLIAN_TYPE_VOID || tpt == EOLIAN_TYPE_REGULAR || tpt == EOLIAN_TYPE_COMPLEX - || tpt == EOLIAN_TYPE_STRUCT - || tpt == EOLIAN_TYPE_STRUCT_OPAQUE - || tpt == EOLIAN_TYPE_ENUM - || tpt == EOLIAN_TYPE_ALIAS || tpt == EOLIAN_TYPE_CLASS) && is_const) { @@ -105,10 +107,6 @@ _eolian_type_cpp_type_named_get(const Eolian_Type *tp, std::string const& caller if (tpt == EOLIAN_TYPE_REGULAR || tpt == EOLIAN_TYPE_COMPLEX - || tpt == EOLIAN_TYPE_STRUCT - || tpt == EOLIAN_TYPE_STRUCT_OPAQUE - || tpt == EOLIAN_TYPE_ENUM - || tpt == EOLIAN_TYPE_ALIAS || tpt == EOLIAN_TYPE_CLASS) { for (efl::eina::iterator<const char> first(::eolian_type_namespaces_get(tp)), last; first != last; ++first) @@ -164,14 +162,15 @@ _eolian_type_cpp_type_named_get(const Eolian_Type *tp, std::string const& caller type_name = it->second; result += type_name; - if (tpt == EOLIAN_TYPE_STRUCT) + auto tpd = eolian_type_typedecl_get(tp); + if (tpd && eolian_typedecl_type_get(tpd) == EOLIAN_TYPEDECL_STRUCT) { result = "efl::eina::js::make_struct_tag<" + result + ">"; } } else if (tpt == EOLIAN_TYPE_VOID) result += "void"; - else // tpt == EOLIAN_TYPE_POINTER + else if (tpt == EOLIAN_TYPE_POINTER) { auto btp = eolian_type_base_type_get(tp); result += _eolian_type_cpp_type_named_get(btp, caller_class_prefix, need_name_getter); @@ -180,8 +179,9 @@ _eolian_type_cpp_type_named_get(const Eolian_Type *tp, std::string const& caller Eolian_Type_Type btpt = EOLIAN_TYPE_UNKNOWN_TYPE; _final_type_and_type_type_get(btp, btp, btpt); + auto btpd = eolian_type_typedecl_get(btp); - if (btpt == EOLIAN_TYPE_STRUCT) + if (btpd && eolian_typedecl_type_get(btpd) == EOLIAN_TYPEDECL_STRUCT) { std::string f = "::make_struct_tag"; auto p = result.find(f); @@ -230,6 +230,10 @@ _eolian_type_cpp_type_named_get(const Eolian_Type *tp, std::string const& caller result += ">"; } } + else + { + throw std::runtime_error("unhandled Eolian_Type_Type value"); + } /*if (!name.empty()) { @@ -303,6 +307,10 @@ void separate_functions(Eolian_Class const* klass, Eolian_Function_Type t, bool strcmp("constructor", ::eolian_function_name_get(function)) != 0 && // TODO: remove this strcmp("render_updates", ::eolian_function_name_get(function)) != 0 && // TODO: remove this strcmp("render2_updates", ::eolian_function_name_get(function)) != 0 && // TODO: remove this + strcmp("efl_canvas_surface_x11_pixmap_set", ::eolian_function_full_c_name_get(function, t, EINA_FALSE)) != 0 && // TODO: remove this + strcmp("efl_canvas_surface_x11_pixmap_get", ::eolian_function_full_c_name_get(function, t, EINA_FALSE)) != 0 && // TODO: remove this + strcmp("efl_canvas_surface_native_buffer_set", ::eolian_function_full_c_name_get(function, t, EINA_FALSE)) != 0 && // TODO: remove this + strcmp("efl_canvas_surface_native_buffer_get", ::eolian_function_full_c_name_get(function, t, EINA_FALSE)) != 0 && // TODO: remove this strcmp("event_callback_priority_add", ::eolian_function_name_get(function)) != 0 && // TODO: remove this strcmp("event_callback_array_priority_add", ::eolian_function_name_get(function)) != 0 && // TODO: remove this strcmp("event_callback_array_del", ::eolian_function_name_get(function)) != 0 && // TODO: remove this @@ -591,16 +599,16 @@ int main(int argc, char** argv) // generate all structs parsed in this file std::stringstream structs_ss; - for (efl::eina::iterator<Eolian_Type> first(::eolian_type_structs_get_by_file(file_basename.c_str())) + for (efl::eina::iterator<Eolian_Typedecl> first(::eolian_typedecl_structs_get_by_file(file_basename.c_str())) , last; first != last; ++first) { std::stringstream ss; - auto tp = &*first; - if (::eolian_type_type_get(tp) == EOLIAN_TYPE_STRUCT_OPAQUE) + auto tpd = &*first; + if (!tpd || ::eolian_typedecl_type_get(tpd) == EOLIAN_TYPEDECL_STRUCT_OPAQUE) continue; - auto struct_name = ::eolian_type_name_get(tp); - auto struct_type_full_name = ::eolian_type_full_name_get(tp); + auto struct_name = ::eolian_typedecl_name_get(tpd); + auto struct_type_full_name = ::eolian_typedecl_full_name_get(tpd); if (!struct_name || !struct_type_full_name) { EINA_CXX_DOM_LOG_ERR(eolian::js::domain) << "Could not get struct type name"; @@ -613,11 +621,11 @@ int main(int argc, char** argv) ss << " {\n"; ss << " auto fields_func = [](v8::Isolate* isolate_, v8::Local<v8::ObjectTemplate> prototype_)\n"; ss << " {\n"; - for (efl::eina::iterator<Eolian_Struct_Type_Field> sf(::eolian_type_struct_fields_get(tp)) + for (efl::eina::iterator<Eolian_Struct_Type_Field> sf(::eolian_typedecl_struct_fields_get(tpd)) , sf_end; sf != sf_end; ++sf) { - auto field_type = ::eolian_type_struct_field_type_get(&*sf); - auto field_name = ::eolian_type_struct_field_name_get(&*sf); + auto field_type = ::eolian_typedecl_struct_field_type_get(&*sf); + auto field_name = ::eolian_typedecl_struct_field_name_get(&*sf); if (!field_name) { EINA_CXX_DOM_LOG_ERR(eolian::js::domain) << "Could not get struct field name"; @@ -654,7 +662,7 @@ int main(int argc, char** argv) ss << " };\n"; ss << " auto to_export = ::efl::eo::js::get_namespace({"; bool comma = false; - for (efl::eina::iterator<const char> ns_it(::eolian_type_namespaces_get(tp)), ns_end; ns_it != ns_end; ++ns_it) + for (efl::eina::iterator<const char> ns_it(::eolian_typedecl_namespaces_get(tpd)), ns_end; ns_it != ns_end; ++ns_it) { if (comma) ss << ", "; @@ -1042,17 +1050,17 @@ int main(int argc, char** argv) os << structs_ss.str(); // generate enumerations - for (efl::eina::iterator<Eolian_Type> first(::eolian_type_enums_get_by_file(file_basename.c_str())) + for (efl::eina::iterator<Eolian_Typedecl> first(::eolian_typedecl_enums_get_by_file(file_basename.c_str())) , last; first != last; ++first) { - auto tp = &*first; - if (::eolian_type_is_extern(tp)) + auto tpd = &*first; + if (::eolian_typedecl_is_extern(tpd)) continue; - std::string enum_name = ::eolian_type_name_get(tp); + std::string enum_name = ::eolian_typedecl_name_get(tpd); os << " {\n"; os << " auto to_export = ::efl::eo::js::get_namespace({"; bool comma = false; - for (efl::eina::iterator<const char> ns_it(::eolian_type_namespaces_get(tp)), ns_end; ns_it != ns_end; ++ns_it) + for (efl::eina::iterator<const char> ns_it(::eolian_typedecl_namespaces_get(tpd)), ns_end; ns_it != ns_end; ++ns_it) { if (comma) os << ", "; @@ -1063,11 +1071,11 @@ int main(int argc, char** argv) os << " v8::Handle<v8::Object> enum_obj = efl::eina::js::compatibility_new<v8::Object>(isolate);\n"; os << " to_export->Set(efl::eina::js::compatibility_new<v8::String>(isolate, \"" << format::format_enum(enum_name) << "\"), enum_obj);\n"; - for (efl::eina::iterator<Eolian_Enum_Type_Field> ef(::eolian_type_enum_fields_get(tp)) + for (efl::eina::iterator<Eolian_Enum_Type_Field> ef(::eolian_typedecl_enum_fields_get(tpd)) , ef_end; ef != ef_end; ++ef) { - auto field_name = ::eolian_type_enum_field_name_get(&*ef); - auto field_c_name = ::eolian_type_enum_field_c_name_get(&*ef); + auto field_name = ::eolian_typedecl_enum_field_name_get(&*ef); + auto field_c_name = ::eolian_typedecl_enum_field_c_name_get(&*ef); if (!field_name || !field_c_name) { EINA_CXX_DOM_LOG_ERR(eolian::js::domain) << "Could not get enum field name"; diff --git a/src/bindings/js/efl_js/efl_js.cc b/src/bindings/js/efl_js/efl_js.cc index 2701a85bf7..227766dc2b 100644 --- a/src/bindings/js/efl_js/efl_js.cc +++ b/src/bindings/js/efl_js/efl_js.cc @@ -51,15 +51,13 @@ 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); -namespace con { -EAPI void register_base(v8::Handle<v8::Object> global, v8::Isolate* isolate); -EAPI void register_client(v8::Handle<v8::Object> global, v8::Isolate* isolate); -EAPI void register_server(v8::Handle<v8::Object> global, v8::Isolate* isolate); -} } namespace efl { namespace network { +EAPI void register_base(v8::Handle<v8::Object> global, v8::Isolate* isolate); +EAPI void register_server(v8::Handle<v8::Object> global, v8::Isolate* isolate); EAPI void register_connector(v8::Handle<v8::Object> global, v8::Isolate* isolate); +EAPI void register_client(v8::Handle<v8::Object> global, v8::Isolate* isolate); EAPI void register_url(v8::Handle<v8::Object> global, v8::Isolate* isolate); }} @@ -97,7 +95,6 @@ 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_polygon(v8::Handle<v8::Object> global, v8::Isolate* isolate); EAPI void register_rectangle(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); @@ -120,6 +117,10 @@ 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); @@ -165,10 +166,10 @@ EAPI void init(v8::Handle<v8::Object> exports) ecore::register_parent(exports, v8::Isolate::GetCurrent()); ecore::register_poller(exports, v8::Isolate::GetCurrent()); ecore::register_timer(exports, v8::Isolate::GetCurrent()); - ecore::con::register_base(exports, v8::Isolate::GetCurrent()); - ecore::con::register_client(exports, v8::Isolate::GetCurrent()); + efl::network::register_base(exports, v8::Isolate::GetCurrent()); + efl::network::register_client(exports, v8::Isolate::GetCurrent()); efl::network::register_connector(exports, v8::Isolate::GetCurrent()); - ecore::con::register_server(exports, v8::Isolate::GetCurrent()); + efl::network::register_server(exports, v8::Isolate::GetCurrent()); efl::network::register_url(exports, v8::Isolate::GetCurrent()); #if 1 register_ecore_audio(exports, v8::Isolate::GetCurrent()); @@ -199,7 +200,6 @@ EAPI void init(v8::Handle<v8::Object> exports) evas::register_object(exports, v8::Isolate::GetCurrent()); evas::register_object_smart(exports, v8::Isolate::GetCurrent()); evas::register_out(exports, v8::Isolate::GetCurrent()); - evas::register_polygon(exports, v8::Isolate::GetCurrent()); evas::register_rectangle(exports, v8::Isolate::GetCurrent()); evas::register_scrollable_interface(exports, v8::Isolate::GetCurrent()); evas::register_selectable_interface(exports, v8::Isolate::GetCurrent()); @@ -218,6 +218,7 @@ EAPI void init(v8::Handle<v8::Object> exports) 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 1 edje::register_edit(exports, v8::Isolate::GetCurrent()); diff --git a/src/bindings/js/eina_js/eina_js_compatibility.hh b/src/bindings/js/eina_js/eina_js_compatibility.hh index 159c74a987..7cc16a3fe9 100644 --- a/src/bindings/js/eina_js/eina_js_compatibility.hh +++ b/src/bindings/js/eina_js/eina_js_compatibility.hh @@ -829,12 +829,11 @@ struct _v8_get_current_context<T, true> : T } }; -template <typename T> inline v8::Local<v8::Value> -new_v8_external_instance(v8::Handle<v8::Function>& ctor, T v, v8::Isolate* isolate) +new_v8_external_instance(v8::Handle<v8::Function>& ctor, void const* v, v8::Isolate* isolate) { // TODO: ensure v8::External ownership ??? (memory leak in case NewInstance throws) - v8::Handle<v8::Value> a[] = {efl::eina::js::compatibility_new<v8::External>(isolate, v)}; + v8::Handle<v8::Value> a[] = {efl::eina::js::compatibility_new<v8::External>(isolate, const_cast<void*>(v))}; return ctor->NewInstance(1, a); } @@ -842,10 +841,10 @@ inline compatibility_return_type cast_function(compatibility_callback_info_type args); inline v8::Local<v8::Value> -new_v8_external_instance(v8::Handle<v8::Function>& ctor, Eo* v, v8::Isolate* isolate) +new_v8_external_instance(v8::Handle<v8::Function>& ctor, Eo const* v, v8::Isolate* isolate) { // TODO: ensure v8::External ownership ??? (memory leak in case NewInstance throws) - v8::Handle<v8::Value> a[] = {efl::eina::js::compatibility_new<v8::External>(isolate, v)}; + v8::Handle<v8::Value> a[] = {efl::eina::js::compatibility_new<v8::External>(isolate, const_cast<Eo*>(v))}; auto obj = ctor->NewInstance(1, a); obj->Set(compatibility_new<v8::String>(isolate, "cast"), compatibility_new<v8::FunctionTemplate>(isolate, &cast_function)->GetFunction()); diff --git a/src/bindings/js/eina_js/eina_js_get_value_from_c.hh b/src/bindings/js/eina_js/eina_js_get_value_from_c.hh index 655b1b1974..9a0089e8b9 100644 --- a/src/bindings/js/eina_js/eina_js_get_value_from_c.hh +++ b/src/bindings/js/eina_js/eina_js_get_value_from_c.hh @@ -221,17 +221,17 @@ get_value_from_c(efl::eina::js::complex_tag<const Eina_Iterator *, T, K>, v8::Is std::abort(); } -template <typename T, typename U, typename K> +template <typename T, typename KT, typename U, typename KU> inline v8::Local<v8::Value> -get_value_from_c(efl::eina::js::complex_tag<Eina_Hash *, T, U, K>, v8::Isolate*, const char*) +get_value_from_c(efl::eina::js::complex_tag<Eina_Hash *, T, KT, U, KU>, v8::Isolate*, const char*) { std::cerr << "get_value_from_c for Eina_Hash not implemented. Aborting..." << std::endl; std::abort(); } -template <typename T, typename U, typename K> +template <typename T, typename KT, typename U, typename KU> inline v8::Local<v8::Value> -get_value_from_c(efl::eina::js::complex_tag<const Eina_Hash *, T, U, K>, v8::Isolate*, const char*) +get_value_from_c(efl::eina::js::complex_tag<const Eina_Hash *, T, KT, U, KU>, v8::Isolate*, const char*) { std::cerr << "get_value_from_c for Eina_Hash not implemented. Aborting..." << std::endl; std::abort(); diff --git a/src/bindings/js/eo_js/eo_js_call_function.hh b/src/bindings/js/eo_js/eo_js_call_function.hh index 26bf03f862..cebe902018 100644 --- a/src/bindings/js/eo_js/eo_js_call_function.hh +++ b/src/bindings/js/eo_js/eo_js_call_function.hh @@ -38,7 +38,7 @@ struct arg_index<In, 0> : std::integral_constant<std::size_t, 0> template <typename In, typename Out, typename Ownership, typename F, typename Return, typename Parameters> struct method_caller { - typedef typename eina::_mpl::function_params<F>::type parameters_t; + typedef typename eo::js::eo_function_params<F>::type parameters_t; template <std::size_t I> struct is_out : eina::_mpl::tuple_contains<std::integral_constant<std::size_t, I>, Out> @@ -190,7 +190,7 @@ struct method_caller template <typename OutParameters, std::size_t... I> eina::js::compatibility_return_type - aux(eina::js::compatibility_callback_info_type args, eina::index_sequence<I...> + aux(Eo* eo, eina::js::compatibility_callback_info_type args, eina::index_sequence<I...> , std::true_type) const { typename eina::_mpl::tuple_transform<Out, out_transform<parameters_t> >::type outs {}; @@ -200,13 +200,13 @@ struct method_caller {(init_inout<I>(args, outs, args.GetIsolate(), class_names[I], typename is_inout<I>::type()), 0)...}; static_cast<void>(l); - function(get_value<I>(args, outs, args.GetIsolate(), class_names[I], typename is_out<I>::type())...); + function(eo, get_value<I>(args, outs, args.GetIsolate(), class_names[I], typename is_out<I>::type())...); return create_return_value<OutParameters>(args, outs); } template <typename OutParameters, std::size_t... I> eina::js::compatibility_return_type - aux(eina::js::compatibility_callback_info_type args, eina::index_sequence<I...> + aux(Eo* eo, eina::js::compatibility_callback_info_type args, eina::index_sequence<I...> , std::false_type) const { typename eina::_mpl::tuple_transform<Out, out_transform<parameters_t> >::type outs {}; @@ -217,7 +217,7 @@ struct method_caller static_cast<void>(l); typename eina::_mpl::function_return<F>::type r = - function(get_value<I>(args, outs, args.GetIsolate(), class_names[I], typename is_out<I>::type())...); + function(eo, get_value<I>(args, outs, args.GetIsolate(), class_names[I], typename is_out<I>::type())...); return create_return_value<OutParameters>(args, r, outs); } @@ -243,13 +243,9 @@ struct method_caller Eo* eo = static_cast<Eo*>(v8::External::Cast(*external)->Value()); try { - eo_do - (eo, - aux<OutParameters>( - args, - eina::make_index_sequence<std::tuple_size<parameters_t>::value>(), - std::is_same<void, Return>()) - ); + aux<OutParameters>(eo, args, + eina::make_index_sequence<std::tuple_size<parameters_t>::value>(), + std::is_same<void, Return>()); } catch(std::logic_error const&) { diff --git a/src/bindings/js/eo_js/eo_js_constructor.hh b/src/bindings/js/eo_js/eo_js_constructor.hh index 09cc9dce71..6ca02ce533 100644 --- a/src/bindings/js/eo_js/eo_js_constructor.hh +++ b/src/bindings/js/eo_js/eo_js_constructor.hh @@ -15,6 +15,21 @@ namespace efl { namespace eo { namespace js { +template <typename T> +struct eo_function_params; + +template <typename R, typename... P> +struct eo_function_params<R(*)(Eo*, P...)> +{ + typedef std::tuple<P...> type; +}; + +template <typename R, typename... P> +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()) @@ -45,7 +60,7 @@ struct constructor_caller void operator()(T function) const { int const parameters - = std::tuple_size<typename eina::_mpl::function_params<T>::type>::value; + = std::tuple_size<typename eo::js::eo_function_params<T>::type>::value; if(*current + parameters <= args->Length()) { aux(function, eina::make_index_sequence<parameters>()); @@ -62,24 +77,25 @@ struct constructor_caller template <typename U, std::size_t I> static - typename std::tuple_element<I, typename eina::_mpl::function_params<U>::type>::type + 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 eina::_mpl::function_params<U>::type>::type + 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 eina::_mpl::function_params<U>::type>::type>()); + <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(get_value<T, I>((*args)[I + *current], args->GetIsolate())...); + function(obj_eo_self, get_value<T, I>((*args)[I + *current], args->GetIsolate())...); } + Eo* obj_eo_self; int* current; eina::js::compatibility_callback_info_pointer args; }; @@ -96,7 +112,7 @@ struct constructor_caller Eo* eo = eo_add (klass , parent - , eina::_mpl::for_each(constructors, call{¤t_index, &args}) + , eina::_mpl::for_each(constructors, call{eo_self, ¤t_index, &args}) ); assert(eo != 0); v8::Local<v8::Object> self = args.This(); diff --git a/src/bindings/js/eo_js/eo_js_event.hh b/src/bindings/js/eo_js/eo_js_event.hh index ab2dd34fee..280aeacae6 100644 --- a/src/bindings/js/eo_js/eo_js_event.hh +++ b/src/bindings/js/eo_js/eo_js_event.hh @@ -54,18 +54,17 @@ inline v8::Local<v8::Value> get_event_info<void>(void*, v8::Isolate* isolate, co } template <typename T> -inline Eina_Bool event_callback(void* data, Eo* obj, Eo_Event_Description const* - , void* event_info) +inline Eina_Bool event_callback(void* data, Eo_Event const* eo_event) { v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::HandleScope handle_scope(isolate); event_callback_information* event = static_cast<event_callback_information*>(data); - v8::Handle<v8::Value> a[] = {eina::js::compatibility_new<v8::External>(isolate, obj)}; + v8::Handle<v8::Value> a[] = {eina::js::compatibility_new<v8::External>(isolate, eo_event->obj)}; v8::Local<v8::Object> self = (event->event_info->constructor->handle())->NewInstance(1, a); v8::Local<v8::Value> call_args[] = { self, - get_event_info<T>(event_info, isolate, event->event_info->class_name) + get_event_info<T>(eo_event->event_info, isolate, event->event_info->class_name) }; event->function.handle()->Call(eina::js::compatibility_global(), 2, call_args); @@ -100,8 +99,7 @@ inline eina::js::compatibility_return_type on_event(eina::js::compatibility_call event_callback_information* i = new event_callback_information {event, {isolate, eina::js::compatibility_cast<v8::Function>(f)}}; - eo_do(eo, eo_event_callback_priority_add - (event->event, EO_CALLBACK_PRIORITY_DEFAULT, event->event_callback, i)); + eo_event_callback_add(eo, event->event, event->event_callback, i); } else { diff --git a/src/tests/efl_js/benchmark_object_impl.cc b/src/tests/efl_js/benchmark_object_impl.cc index 538c31b2ce..2c71a06e96 100644 --- a/src/tests/efl_js/benchmark_object_impl.cc +++ b/src/tests/efl_js/benchmark_object_impl.cc @@ -42,9 +42,9 @@ using efl::eina::js::compatibility_return; using efl::eina::js::compatibility_new; #define JS_BENCHMARK_ARGS0(v) -#define JS_BENCHMARK_ARGS1(v) v -#define JS_BENCHMARK_ARGS2(v) v,v -#define JS_BENCHMARK_ARGS10(v) v,v,v,v,v,v,v,v,v,v +#define JS_BENCHMARK_ARGS1(v) ,v +#define JS_BENCHMARK_ARGS2(v) ,v,v +#define JS_BENCHMARK_ARGS10(v) ,v,v,v,v,v,v,v,v,v,v #define JS_BENCHMARK_FUNC(name, number, v) \ compatibility_return_type js_benchmark_object_##name##arg(compatibility_callback_info_type) \ { \ @@ -55,13 +55,13 @@ using efl::eina::js::compatibility_new; /* Warm */ \ for(int i = 0; i != 10; i++) \ { \ - eo_do(object, benchmark_object_##name##arg(JS_BENCHMARK_ARGS##number(v))); \ + benchmark_object_##name##arg(object JS_BENCHMARK_ARGS##number(v)); \ } \ /* Real loop */ \ eina_counter_start(counter); \ for(int i = 0; i != 20000; i++) \ { \ - eo_do(object, benchmark_object_##name##arg(JS_BENCHMARK_ARGS##number(v))); \ + benchmark_object_##name##arg(object JS_BENCHMARK_ARGS##number(v)); \ } \ eina_counter_stop(counter, 20000); \ fprintf(stderr, "%s", eina_counter_dump(counter)); \ diff --git a/src/tests/eolian_js/eolian_js_suite.js b/src/tests/eolian_js/eolian_js_suite.js index 146127323e..44c4b5a3df 100755 --- a/src/tests/eolian_js/eolian_js_suite.js +++ b/src/tests/eolian_js/eolian_js_suite.js @@ -31,7 +31,7 @@ if(typeof process !== 'undefined') } else { - assert = function(test, message) { if (test !== true) throw message; }; + assert = function(test, message) { if (!test) throw message; }; print('running from libv8') //FIXME Add levels to v8 tests printError = print @@ -99,9 +99,9 @@ startTest("integral_in_and_out_parameters", function() { var obj = new TestObject(null); var expectedValue = 1234; - obj.methodIntegralInA(expectedValue); + obj.checkMethodIntegralInA(expectedValue); - var actualValue = obj.methodIntegralOutA(); + var actualValue = obj.checkMethodIntegralOutA(); assert(actualValue == expectedValue, actualValue + " == " + expectedValue); }); @@ -109,11 +109,11 @@ startTest("integral_inout_parameter", function() { var obj = new TestObject(null); var expectedValue = 1234; - var actualValue = obj.methodIntegralInout(-expectedValue); + var actualValue = obj.checkMethodIntegralInout(-expectedValue); assert(actualValue == expectedValue, actualValue + " == " + expectedValue); var expectedValue = -4321; - var actualValue = obj.methodIntegralInout(-expectedValue); + var actualValue = obj.checkMethodIntegralInout(-expectedValue); assert(actualValue == expectedValue, actualValue + " == " + expectedValue); }); @@ -121,38 +121,38 @@ startTest("integral_return_value", function() { var obj = new TestObject(null); var expectedValue = 1234; - obj.methodIntegralInA(expectedValue); + obj.checkMethodIntegralInA(expectedValue); - var actualValue = obj.methodIntegralReturnA(); + var actualValue = obj.checkMethodIntegralReturnA(); assert(actualValue == expectedValue, actualValue + " == " + expectedValue); }); startTest("more_parameters_than_expected_is_ok", function() { var obj = new TestObject(null); var expectedValue = 1234; - obj.methodIntegralInA(expectedValue, 4321); + obj.checkMethodIntegralInA(expectedValue, 4321); - var actualValue = obj.methodIntegralOutA(); + var actualValue = obj.checkMethodIntegralOutA(); assert(actualValue == expectedValue, actualValue + " == " + expectedValue); }); startTest("less_parameters_that_expected_fails", function() { var obj = new TestObject(null); expectException(function() { - obj.methodIntegralInA(); + obj.checkMethodIntegralInA(); }); }); startTest("wrong_parameter_type_fails", function() { var obj = new TestObject(null); expectException(function() { - obj.methodIntegralInA('string'); + obj.checkMethodIntegralInA('string'); }); }); startTest("mixed_in_out_and_result", function() { var obj = new TestObject(null); - var ret = obj.methodDivMod(7, 3); + var ret = obj.checkMethodDivMod(7, 3); var success = ret[0]; var quotient = ret[1]; var remainder = ret[2]; @@ -160,46 +160,46 @@ startTest("mixed_in_out_and_result", function() { assert(2 == quotient); assert(1 == remainder); - ret = obj.methodDivMod(42, 0); + ret = obj.checkMethodDivMod(42, 0); success = ret[0]; assert(!success); }); startTest("boolean", function() { var obj = new TestObject(null); - var ret = obj.methodAnd(false, false); + var ret = obj.checkMethodAnd(false, false); assert(ret == false); - ret = obj.methodAnd(false, true); + ret = obj.checkMethodAnd(false, true); assert(ret == false); - ret = obj.methodAnd(true, false); + ret = obj.checkMethodAnd(true, false); assert(ret == false); - ret = obj.methodAnd(true, true); + ret = obj.checkMethodAnd(true, true); assert(ret); }); startTest("floating_point", function() { var obj = new TestObject(null); - var ret = obj.methodModf(3.14159); + var ret = obj.checkMethodModf(3.14159); assert(Math.abs(ret[0] - 0.14159) < 0.00001, "Math.abs(ret[0] - 0.14159) < 0.00001 (" + Math.abs(ret[0] - 0.14159) + " < 0.00001)"); assert(ret[1] == 3, "ret[1] == 3 (" + ret[1] + " == 3)"); }); startTest("string_inout", function() { var obj = new TestObject(null); - var ret = obj.methodUppercase('hello world'); + var ret = obj.checkMethodUppercase('hello world'); assert(ret == "HELLO WORLD", "ret == " + ret); }); startTest("in_null_string", function() { var obj = new TestObject(null); - var success = obj.methodInNull(null); + var success = obj.checkMethodInNull(null); assert(success, "success == " + success); }); startTest("out_null_string", function() { var obj = new TestObject(null); - var ret = obj.methodOutNull(); + var ret = obj.checkMethodOutNull(); assert(ret[0], "success == " + ret[0]); assert(ret[1] === null, "output == " + ret[1]); }); @@ -207,7 +207,7 @@ startTest("out_null_string", function() { startTest("inout_null_string", function() { var obj = new TestObject(null); - var ret = obj.methodInoutNull(null); + var ret = obj.checkMethodInoutNull(null); assert(ret[0], "success == " + ret[0]); assert(ret[1] === null, "output == " + ret[1]); }); @@ -215,14 +215,14 @@ startTest("inout_null_string", function() { startTest("return_null_string", function() { var obj = new TestObject(null); - var ret = obj.methodReturnNull(); + var ret = obj.checkMethodReturnNull(); assert(ret === null, "ret == " + ret); }); startTest("null_values", function() { var obj = new TestObject(null); - var ret = obj.methodNull(null, null); + var ret = obj.checkMethodNull(null, null); assert(ret[0] === null, "ret == " + ret[0]); assert(ret[1] === null, "ret == " + ret[1]); assert(ret[2] === null, "ret == " + ret[2]); @@ -230,11 +230,11 @@ startTest("null_values", function() { startTest("enum_values", function() { var obj = new TestObject(null); - var ret = obj.methodInEnumReturnEnum(suite.Test.EnumEx.SECOND); + var ret = obj.checkMethodInEnumReturnEnum(suite.Test.EnumEx.SECOND); assert(ret === suite.Test.EnumEx.SECOND); var value = suite.Test.EnumEx.THIRD; assert(value === 2); - ret = obj.methodInEnumReturnEnum(value); + ret = obj.checkMethodInEnumReturnEnum(value); assert(ret === value); }); @@ -247,7 +247,7 @@ startTest("struct_values", function() { assert(ret === 42); ret = newStruct.valueEnum; assert(ret === suite.Test.EnumEx.FOURTH); - ret = obj.methodInStructReturnStruct(newStruct); + ret = obj.checkMethodInStructReturnStruct(newStruct); assert(ret.valueInt === 42); assert(ret.valueEnum === suite.Test.EnumEx.FOURTH); }); @@ -264,7 +264,7 @@ startTest("event_simple", function() { } ); printInfo('going to call event'); - obj.callEvent(); + obj.emitEvent(); printInfo('is event called?'); assert(v); }); @@ -280,14 +280,14 @@ startTest("event_object_call", function() { var o = arguments[0]; assert(o != null); var expectedValue = 1234; - o.methodIntegralInA(expectedValue); - var actualValue = o.methodIntegralOutA(); + o.checkMethodIntegralInA(expectedValue); + var actualValue = o.checkMethodIntegralOutA(); assert(actualValue == expectedValue, actualValue + " == " + expectedValue); v = true; } ); printInfo('going to call event'); - obj.callEvent(); + obj.emitEvent(); printInfo('is event called?'); assert(v); }); @@ -296,7 +296,7 @@ startTest("event_structarg", function() { var v = false; var obj = new TestObject(null); var ret = obj.on - ("test_structarg", + ("test,structarg", function() { printInfo('Event called'); @@ -308,7 +308,7 @@ startTest("event_structarg", function() { } ); printInfo('going to call event'); - obj.callEvent(); + obj.emitEvent(); printInfo('is event called?'); assert(v); }); @@ -317,7 +317,7 @@ startTest("event_stringarg", function() { var v = false; var obj = new TestObject(null); var ret = obj.on - ("test_stringarg", + ("test,stringarg", function() { printInfo('Event called'); @@ -327,7 +327,7 @@ startTest("event_stringarg", function() { } ); printInfo('going to call event'); - obj.callEvent(); + obj.emitEvent(); printInfo('is event called?'); assert(v); }); @@ -335,15 +335,15 @@ startTest("event_stringarg", function() { // // TODO: disabled. Not implemented yet // startTest("integral_array", function() { // var obj = new TestObject(null); -// var ret = obj.methodArrayAt([1, 2, 3, 4, 5], 1); +// var ret = obj.checkMethodArrayAt([1, 2, 3, 4, 5], 1); // assert(ret == 2, "ret == " + ret); // }); startTest("array_in_array_out", function() { var obj = new TestObject(null); - var newArray = obj.methodArrayWith42(); + var newArray = obj.checkMethodArrayWith42(); assert(newArray != null); - var arr = obj.methodArrayInArrayOut(newArray); + var arr = obj.checkMethodArrayInArrayOut(newArray); assert(arr != null); assert(arr[0] === 42); assert(newArray[0] === arr[0]); @@ -351,80 +351,80 @@ startTest("array_in_array_out", function() { startTest("method_array_of_objects", function() { var obj = new TestObject(null); - var arr = obj.methodArrayOfObjects(null); + var arr = obj.checkMethodArrayOfObjects(null); assert(arr != null); assert(arr[0] != null); - arr = obj.methodArrayOfObjects(arr); + arr = obj.checkMethodArrayOfObjects(arr); assert(arr != null); var v = arr[0]; assert(v != null); // assert(v == obj); // TODO: check if same Eo object pointer? var expectedValue = 1234; - v.methodIntegralInA(expectedValue); - var actualValue = v.methodIntegralOutA(); + v.checkMethodIntegralInA(expectedValue); + var actualValue = v.checkMethodIntegralOutA(); assert(actualValue == expectedValue, actualValue + " == " + expectedValue); }); // FIXME // startTest("method_array_of_strings", function() { // var obj = new TestObject(null); -// var arr = obj.methodArrayOfStrings(null); +// var arr = obj.checkMethodArrayOfStrings(null); // assert(arr != null); // assert(arr[0] === "foo"); -// arr = obj.methodArrayOfStrings(arr); +// arr = obj.checkMethodArrayOfStrings(arr); // assert(arr != null); // assert(arr[0] === "foo"); // }); startTest("method_array_of_ints", function() { var obj = new TestObject(null); - var arr = obj.methodArrayOfInts(null); + var arr = obj.checkMethodArrayOfInts(null); assert(arr != null); assert(arr[0] === 42); - arr = obj.methodArrayOfInts(arr); + arr = obj.checkMethodArrayOfInts(arr); assert(arr != null); assert(arr[0] === 42); }); startTest("method_array_of_bools", function() { var obj = new TestObject(null); - var arr = obj.methodArrayOfBools(null); + var arr = obj.checkMethodArrayOfBools(null); assert(arr != null); assert(arr[0] === true); - arr = obj.methodArrayOfBools(arr); + arr = obj.checkMethodArrayOfBools(arr); assert(arr != null); assert(arr[0] === true); }); startTest("method_array_of_doubles", function() { var obj = new TestObject(null); - var arr = obj.methodArrayOfDoubles(null); + var arr = obj.checkMethodArrayOfDoubles(null); assert(arr != null); assert(arr[0] === 42.0); - arr = obj.methodArrayOfDoubles(arr); + arr = obj.checkMethodArrayOfDoubles(arr); assert(arr != null); assert(arr[0] === 42.0); }); startTest("method_array_of_enums", function() { var obj = new TestObject(null); - var arr = obj.methodArrayOfEnums(null); + var arr = obj.checkMethodArrayOfEnums(null); assert(arr != null); assert(arr[0] === suite.Test.EnumEx.THIRD); - arr = obj.methodArrayOfEnums(arr); + arr = obj.checkMethodArrayOfEnums(arr); assert(arr != null); assert(arr[0] === suite.Test.EnumEx.THIRD); }); startTest("method_array_of_structs", function() { var obj = new TestObject(null); - var arr = obj.methodArrayOfStructs(null); + var arr = obj.checkMethodArrayOfStructs(null); assert(arr != null); var s = arr[0]; assert(s != null); assert(s.valueInt === 42); assert(s.valueEnum === suite.Test.EnumEx.THIRD); - arr = obj.methodArrayOfStructs(arr); + arr = obj.checkMethodArrayOfStructs(arr); s = arr[0]; assert(s != null); assert(s.valueInt === 42); @@ -433,9 +433,9 @@ startTest("method_array_of_structs", function() { startTest("list_in_list_out", function() { var obj = new TestObject(null); - var newList = obj.methodListWith42(); + var newList = obj.checkMethodListWith42(); assert(newList != null); - var lis = obj.methodListInListOut(newList); + var lis = obj.checkMethodListInListOut(newList); assert(lis != null); // assert(lis == newList); // TODO: check same list pointer? assert(lis[0] === 42); @@ -444,80 +444,80 @@ startTest("list_in_list_out", function() { startTest("method_list_of_objects", function() { var obj = new TestObject(null); - var lis = obj.methodListOfObjects(null); + var lis = obj.checkMethodListOfObjects(null); assert(lis != null); assert(lis[0] != null); - lis = obj.methodListOfObjects(lis); + lis = obj.checkMethodListOfObjects(lis); assert(lis != null); var v = lis[0]; assert(v != null); // assert(v == obj); // TODO: check if same Eo object pointer? var expectedValue = 1234; - v.methodIntegralInA(expectedValue); - var actualValue = v.methodIntegralOutA(); + v.checkMethodIntegralInA(expectedValue); + var actualValue = v.checkMethodIntegralOutA(); assert(actualValue == expectedValue, actualValue + " == " + expectedValue); }); // FIXME // startTest("method_list_of_strings", function() { // var obj = new TestObject(null); -// var lis = obj.methodListOfStrings(null); +// var lis = obj.checkMethodListOfStrings(null); // assert(lis != null); // assert(lis[0] === "foo"); -// lis = obj.methodListOfStrings(lis); +// lis = obj.checkMethodListOfStrings(lis); // assert(lis != null); // assert(lis[0] === "foo"); // }); startTest("method_list_of_ints", function() { var obj = new TestObject(null); - var lis = obj.methodListOfInts(null); + var lis = obj.checkMethodListOfInts(null); assert(lis != null); assert(lis[0] === 42); - lis = obj.methodListOfInts(lis); + lis = obj.checkMethodListOfInts(lis); assert(lis != null); assert(lis[0] === 42); }); startTest("method_list_of_bools", function() { var obj = new TestObject(null); - var lis = obj.methodListOfBools(null); + var lis = obj.checkMethodListOfBools(null); assert(lis != null); assert(lis[0] === true); - lis = obj.methodListOfBools(lis); + lis = obj.checkMethodListOfBools(lis); assert(lis != null); assert(lis[0] === true); }); startTest("method_list_of_doubles", function() { var obj = new TestObject(null); - var lis = obj.methodListOfDoubles(null); + var lis = obj.checkMethodListOfDoubles(null); assert(lis != null); assert(lis[0] === 42.0); - lis = obj.methodListOfDoubles(lis); + lis = obj.checkMethodListOfDoubles(lis); assert(lis != null); assert(lis[0] === 42.0); }); startTest("method_list_of_enums", function() { var obj = new TestObject(null); - var lis = obj.methodListOfEnums(null); + var lis = obj.checkMethodListOfEnums(null); assert(lis != null); assert(lis[0] === suite.Test.EnumEx.THIRD); - lis = obj.methodListOfEnums(lis); + lis = obj.checkMethodListOfEnums(lis); assert(lis != null); assert(lis[0] === suite.Test.EnumEx.THIRD); }); startTest("method_list_of_structs", function() { var obj = new TestObject(null); - var lis = obj.methodListOfStructs(null); + var lis = obj.checkMethodListOfStructs(null); assert(lis != null); var s = lis[0]; assert(s != null); assert(s.valueInt === 42); assert(s.valueEnum === suite.Test.EnumEx.THIRD); - lis = obj.methodListOfStructs(lis); + lis = obj.checkMethodListOfStructs(lis); s = lis[0]; assert(s != null); assert(s.valueInt === 42); @@ -526,79 +526,79 @@ startTest("method_list_of_structs", function() { startTest("method_accessor_of_objects", function() { var obj = new TestObject(null); - var acc = obj.methodAccessorOfObjects(null); + var acc = obj.checkMethodAccessorOfObjects(null); assert(acc != null); assert(acc.get(0) != null); - acc = obj.methodAccessorOfObjects(acc); + acc = obj.checkMethodAccessorOfObjects(acc); assert(acc != null); var v = acc.get(0); assert(v != null); var expectedValue = 1234; - v.methodIntegralInA(expectedValue); - var actualValue = v.methodIntegralOutA(); + v.checkMethodIntegralInA(expectedValue); + var actualValue = v.checkMethodIntegralOutA(); assert(actualValue == expectedValue, actualValue + " == " + expectedValue); }); // FIXME // startTest("method_accessor_of_strings", function() { // var obj = new TestObject(null); -// var acc = obj.methodAccessorOfStrings(null); +// var acc = obj.checkMethodAccessorOfStrings(null); // assert(acc != null); // assert(acc.get(0) === "foo"); -// acc = obj.methodAccessorOfStrings(acc); +// acc = obj.checkMethodAccessorOfStrings(acc); // assert(acc != null); // assert(acc.get(0) === "foo"); // }); startTest("method_accessor_of_ints", function() { var obj = new TestObject(null); - var acc = obj.methodAccessorOfInts(null); + var acc = obj.checkMethodAccessorOfInts(null); assert(acc != null); assert(acc.get(0) === 42); - acc = obj.methodAccessorOfInts(acc); + acc = obj.checkMethodAccessorOfInts(acc); assert(acc != null); assert(acc.get(0) === 42); }); startTest("method_accessor_of_bools", function() { var obj = new TestObject(null); - var acc = obj.methodAccessorOfBools(null); + var acc = obj.checkMethodAccessorOfBools(null); assert(acc != null); assert(acc.get(0) === true); - acc = obj.methodAccessorOfBools(acc); + acc = obj.checkMethodAccessorOfBools(acc); assert(acc != null); assert(acc.get(0) === true); }); startTest("method_accessor_of_doubles", function() { var obj = new TestObject(null); - var acc = obj.methodAccessorOfDoubles(null); + var acc = obj.checkMethodAccessorOfDoubles(null); assert(acc != null); assert(acc.get(0) === 42.0); - acc = obj.methodAccessorOfDoubles(acc); + acc = obj.checkMethodAccessorOfDoubles(acc); assert(acc != null); assert(acc.get(0) === 42.0); }); startTest("method_accessor_of_enums", function() { var obj = new TestObject(null); - var acc = obj.methodAccessorOfEnums(null); + var acc = obj.checkMethodAccessorOfEnums(null); assert(acc != null); assert(acc.get(0) === suite.Test.EnumEx.THIRD); - acc = obj.methodAccessorOfEnums(acc); + acc = obj.checkMethodAccessorOfEnums(acc); assert(acc != null); assert(acc.get(0) === suite.Test.EnumEx.THIRD); }); startTest("method_accessor_of_structs", function() { var obj = new TestObject(null); - var acc = obj.methodAccessorOfStructs(null); + var acc = obj.checkMethodAccessorOfStructs(null); assert(acc != null); var s = acc.get(0); assert(s != null); assert(s.valueInt === 42); assert(s.valueEnum === suite.Test.EnumEx.THIRD); - acc = obj.methodAccessorOfStructs(acc); + acc = obj.checkMethodAccessorOfStructs(acc); assert(acc != null); s = acc.get(0); assert(s != null); @@ -611,12 +611,12 @@ startTest("method_accessor_of_structs", function() { // FIXME // startTest("method_array_of_arrays_of_ints", function() { // var obj = new TestObject(null); -// var arr = obj.methodArrayOfArraysOfInts(null); +// var arr = obj.checkMethodArrayOfArraysOfInts(null); // assert(arr != null); // var a = arr[0]; // assert(a != null); // assert(a[0] === 42); -// arr = obj.methodArrayOfArraysOfInts(arr); +// arr = obj.checkMethodArrayOfArraysOfInts(arr); // assert(arr != null); // a = arr[0]; // assert(a != null); @@ -626,12 +626,12 @@ startTest("method_accessor_of_structs", function() { // FIXME // startTest("method_list_of_lists_of_ints", function() { // var obj = new TestObject(null); -// var lis = obj.methodListOfListsOfInts(null); +// var lis = obj.checkMethodListOfListsOfInts(null); // assert(lis != null); // var l = lis[0]; // assert(l != null); // assert(l[0] === 42); -// lis = obj.methodListOfListsOfInts(lis); +// lis = obj.checkMethodListOfListsOfInts(lis); // assert(lis != null); // l = lis[0]; // assert(l != null); @@ -641,12 +641,12 @@ startTest("method_accessor_of_structs", function() { // FIXME // startTest("method_array_of_lists_of_ints", function() { // var obj = new TestObject(null); -// var arr = obj.methodArrayOfListsOfInts(null); +// var arr = obj.checkMethodArrayOfListsOfInts(null); // assert(arr != null); // var l = arr[0]; // assert(l != null); // assert(l[0] === 42); -// arr = obj.methodArrayOfListsOfInts(arr); +// arr = obj.checkMethodArrayOfListsOfInts(arr); // assert(arr != null); // l = arr[0]; // assert(l != null); @@ -656,12 +656,12 @@ startTest("method_accessor_of_structs", function() { // FIXME // startTest("method_list_of_arrays_of_ints", function() { // var obj = new TestObject(null); -// var lis = obj.methodListOfArraysOfInts(null); +// var lis = obj.checkMethodListOfArraysOfInts(null); // assert(lis != null); // var a = lis[0]; // assert(a != null); // assert(a[0] === 42); -// lis = obj.methodListOfArraysOfInts(lis); +// lis = obj.checkMethodListOfArraysOfInts(lis); // assert(lis != null); // a = lis[0]; // assert(a != null); diff --git a/src/tests/eolian_js/eolian_js_test_test_object_impl.c b/src/tests/eolian_js/eolian_js_test_test_object_impl.c index 89e9d4764f..aecfbbf15a 100644 --- a/src/tests/eolian_js/eolian_js_test_test_object_impl.c +++ b/src/tests/eolian_js/eolian_js_test_test_object_impl.c @@ -27,6 +27,7 @@ EOLIAN static Eo_Base * _test_object_eo_base_constructor(Eo* obj, Test_Object_Data *pd) { fprintf(stdout, "_test_object_eo_base_constructor\n"); + fflush(stdout); pd->a = 0; return eo_constructor(eo_super(obj, MY_CLASS)); @@ -36,6 +37,7 @@ EOLIAN static Eo * _test_object_eo_base_finalize(Eo *obj, Test_Object_Data *pd EINA_UNUSED) { fprintf(stdout, "_test_object_eo_base_finalize\n"); + fflush(stdout); return eo_finalize(eo_super(obj, MY_CLASS)); } @@ -44,54 +46,60 @@ EOLIAN static void _test_object_eo_base_destructor(Eo* obj, Test_Object_Data *pd EINA_UNUSED) { fprintf(stdout, "_test_object_eo_base_destructor\n"); + fflush(stdout); eo_destructor(eo_super(obj, MY_CLASS)); } EOLIAN static void -_test_object_method_integral_in_a(Eo* obj EINA_UNUSED, - Test_Object_Data *pd, - int a) +_test_object_method_integral_in_a_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd, + int a) { - fprintf(stdout, "_test_object_method_integral_in_a(%d)\n", a); + fprintf(stdout, "_test_object_method_integral_in_a_check(%d)\n", a); + fflush(stdout); pd->a = a; } EOLIAN static void -_test_object_method_integral_out_a(Eo* obj EINA_UNUSED, - Test_Object_Data *pd, - int *a) +_test_object_method_integral_out_a_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd, + int *a) { - fprintf(stdout, "_test_object_method_integral_out_a(%p)\n", a); + fprintf(stdout, "_test_object_method_integral_out_a_check(%p)\n", a); + fflush(stdout); *a = pd->a; } EOLIAN static void -_test_object_method_integral_inout(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - int *a) +_test_object_method_integral_inout_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + int *a) { - fprintf(stdout, "_test_object_method_integral_inout(%d [%p])\n", *a, a); + fprintf(stdout, "_test_object_method_integral_inout_check(%d [%p])\n", *a, a); + fflush(stdout); *a = -(*a); } EOLIAN static int -_test_object_method_integral_return_a(Eo* obj EINA_UNUSED, - Test_Object_Data *pd) +_test_object_method_integral_return_a_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd) { - fprintf(stdout, "_test_object_method_integral_return_a()\n"); + fprintf(stdout, "_test_object_method_integral_return_a_check()\n"); + fflush(stdout); return pd->a; } EOLIAN static Eina_Bool -_test_object_method_div_mod(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - int a, - int b, - int *quotient, - int *remainder) -{ - fprintf(stdout, "_test_object_method_div_mod(%d, %d, %p, %p)\n", a, b, quotient, remainder); +_test_object_method_div_mod_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + int a, + int b, + int *quotient, + int *remainder) +{ + fprintf(stdout, "_test_object_method_div_mod_check(%d, %d, %p, %p)\n", a, b, quotient, remainder); + fflush(stdout); if (0 == b) return EINA_FALSE; *quotient = a / b; *remainder = a % b; @@ -99,31 +107,34 @@ _test_object_method_div_mod(Eo* obj EINA_UNUSED, } EOLIAN static Eina_Bool -_test_object_method_and(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_Bool a, - Eina_Bool b) +_test_object_method_and_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_Bool a, + Eina_Bool b) { - fprintf(stdout, "_test_object_method_and(%d, %d)\n", a, b); + fprintf(stdout, "_test_object_method_and_check(%d, %d)\n", a, b); + fflush(stdout); return a && b; } EOLIAN static double -_test_object_method_modf(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - double x, - double *int_part) +_test_object_method_modf_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + double x, + double *int_part) { - fprintf(stdout, "_test_object_method_modf(%f, %p)\n", x, int_part); + fprintf(stdout, "_test_object_method_modf_check(%f, %p)\n", x, int_part); + fflush(stdout); return modf(x, int_part); } EOLIAN static void -_test_object_method_uppercase(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - char **str) +_test_object_method_uppercase_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + char **str) { - fprintf(stdout, "_test_object_method_uppercase('%s')\n", *str); + fprintf(stdout, "_test_object_method_uppercase_check('%s')\n", *str); + fflush(stdout); if (!*str) return; char *p = *str; @@ -135,45 +146,50 @@ _test_object_method_uppercase(Eo* obj EINA_UNUSED, } EOLIAN static Eina_Bool -_test_object_method_in_null(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - char *a) +_test_object_method_in_null_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + char *a) { - fprintf(stdout, "_test_object_method_in_null(%p)\n", a); + fprintf(stdout, "_test_object_method_in_null_check(%p)\n", a); + fflush(stdout); return NULL == a; } EOLIAN static Eina_Bool -_test_object_method_out_null(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - char **a) +_test_object_method_out_null_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + char **a) { - fprintf(stdout, "_test_object_method_out_null(%p)\n", a); + fprintf(stdout, "_test_object_method_out_null_check(%p)\n", a); + fflush(stdout); *a = NULL; return EINA_TRUE; } EOLIAN static Eina_Bool -_test_object_method_inout_null(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - char **a) +_test_object_method_inout_null_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + char **a) { - fprintf(stdout, "_test_object_method_inout_null(%p)\n", a); + fprintf(stdout, "_test_object_method_inout_null_check(%p)\n", a); + fflush(stdout); return NULL == *a; } EOLIAN static char * -_test_object_method_return_null(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED) +_test_object_method_return_null_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED) { - fprintf(stdout, "_test_object_method_return_null()\n"); + fprintf(stdout, "_test_object_method_return_null_check()\n"); + fflush(stdout); return NULL; } EOLIAN static void -_test_object_call_event(Eo* obj, Test_Object_Data *pd EINA_UNUSED) +_test_object_event_emit(Eo* obj, Test_Object_Data *pd EINA_UNUSED) { - fprintf(stderr, "_test_object_event_call()\n"); fflush(stderr); + fprintf(stdout, "_test_object_event_emit()\n"); + fflush(stdout); static Test_Struct_Ex s = {42, TEST_ENUM_EX_THIRD}; eo_event_callback_call(obj, TEST_OBJECT_EVENT_TEST, NULL); eo_event_callback_call(obj, TEST_OBJECT_EVENT_TEST_STRUCTARG, &s); @@ -181,13 +197,14 @@ _test_object_call_event(Eo* obj, Test_Object_Data *pd EINA_UNUSED) } EOLIAN static char * -_test_object_method_null(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - char *in, - char **out, - char **inout) -{ - fprintf(stdout, "_test_object_method_null(%p, %p, %p)\n", in, out, inout); +_test_object_method_null_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + char *in, + char **out, + char **inout) +{ + fprintf(stdout, "_test_object_method_null_check(%p, %p, %p)\n", in, out, inout); + fflush(stdout); assert(!in); *out = NULL; *inout = NULL; @@ -197,20 +214,22 @@ _test_object_method_null(Eo* obj EINA_UNUSED, // Arrays // EOLIAN static int -_test_object_method_array_at(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_Array *array, - int index) +_test_object_method_array_at_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_Array *array, + int index) { - fprintf(stdout, "_test_object_method_array_at(%p, %d)\n", array, index); + fprintf(stdout, "_test_object_method_array_at_check(%p, %d)\n", array, index); + fflush(stdout); return *((int*)eina_array_data_get(array, index)); } EOLIAN static Eina_Array * -_test_object_method_array_with_42(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED) +_test_object_method_array_with_42_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED) { - fprintf(stdout, "_test_object_method_array_with_42()\n"); + fprintf(stdout, "_test_object_method_array_with_42_check()\n"); + fflush(stdout); Eina_Array *arr = eina_array_new(2); int* n = malloc(sizeof(int)); *n = 42; @@ -219,21 +238,23 @@ _test_object_method_array_with_42(Eo* obj EINA_UNUSED, } EOLIAN static void -_test_object_method_array_in_array_out(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_Array *a_in, - Eina_Array **a_out) +_test_object_method_array_in_array_out_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_Array *a_in, + Eina_Array **a_out) { - fprintf(stdout, "_test_object_method_array_in_array_out(%p, %p)\n", a_in, a_out); + fprintf(stdout, "_test_object_method_array_in_array_out_check(%p, %p)\n", a_in, a_out); + fflush(stdout); *a_out = a_in; } EOLIAN static Eina_Array * -_test_object_method_array_of_objects(Eo* obj, - Test_Object_Data *pd EINA_UNUSED, - Eina_Array *a_in) +_test_object_method_array_of_objects_check(Eo* obj, + Test_Object_Data *pd EINA_UNUSED, + Eina_Array *a_in) { - fprintf(stdout, "_test_object_method_array_of_objects(%p)\n", a_in); + fprintf(stdout, "_test_object_method_array_of_objects_check(%p)\n", a_in); + fflush(stdout); if (a_in) return a_in; Eina_Array *arr = eina_array_new(2); eina_array_push(arr, obj); @@ -242,11 +263,12 @@ _test_object_method_array_of_objects(Eo* obj, EOLIAN static Eina_Array * -_test_object_method_array_of_strings(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_Array *a_in) +_test_object_method_array_of_strings_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_Array *a_in) { - fprintf(stdout, "_test_object_method_array_of_strings(%p)\n", a_in); + fprintf(stdout, "_test_object_method_array_of_strings_check(%p)\n", a_in); + fflush(stdout); if (a_in) return a_in; Eina_Array *arr = eina_array_new(2); const char* v = "foo"; @@ -256,11 +278,12 @@ _test_object_method_array_of_strings(Eo* obj EINA_UNUSED, } EOLIAN static Eina_Array * -_test_object_method_array_of_ints(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_Array *a_in) +_test_object_method_array_of_ints_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_Array *a_in) { - fprintf(stdout, "_test_object_method_array_of_ints(%p)\n", a_in); + fprintf(stdout, "_test_object_method_array_of_ints_check(%p)\n", a_in); + fflush(stdout); if (a_in) return a_in; int *v = malloc(sizeof(int)); *v = 42; @@ -270,11 +293,12 @@ _test_object_method_array_of_ints(Eo* obj EINA_UNUSED, } EOLIAN static Eina_Array * -_test_object_method_array_of_bools(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_Array *a_in) +_test_object_method_array_of_bools_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_Array *a_in) { - fprintf(stdout, "_test_object_method_array_of_bools(%p)\n", a_in); + fprintf(stdout, "_test_object_method_array_of_bools_check(%p)\n", a_in); + fflush(stdout); if (a_in) return a_in; Eina_Bool *v = malloc(sizeof(Eina_Bool)); *v = EINA_TRUE; @@ -284,11 +308,12 @@ _test_object_method_array_of_bools(Eo* obj EINA_UNUSED, } EOLIAN static Eina_Array * -_test_object_method_array_of_doubles(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_Array *a_in) +_test_object_method_array_of_doubles_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_Array *a_in) { - fprintf(stdout, "_test_object_method_array_of_doubles(%p)\n", a_in); + fprintf(stdout, "_test_object_method_array_of_doubles_check(%p)\n", a_in); + fflush(stdout); if (a_in) return a_in; double *v = malloc(sizeof(double)); *v = 42; @@ -298,11 +323,12 @@ _test_object_method_array_of_doubles(Eo* obj EINA_UNUSED, } EOLIAN static Eina_Array * -_test_object_method_array_of_enums(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_Array *a_in) +_test_object_method_array_of_enums_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_Array *a_in) { - fprintf(stdout, "_test_object_method_array_of_enums(%p)\n", a_in); + fprintf(stdout, "_test_object_method_array_of_enums_check(%p)\n", a_in); + fflush(stdout); if (a_in) return a_in; Test_Enum_Ex *v = malloc(sizeof(Test_Enum_Ex)); *v = TEST_ENUM_EX_THIRD; @@ -312,11 +338,12 @@ _test_object_method_array_of_enums(Eo* obj EINA_UNUSED, } EOLIAN static Eina_Array * -_test_object_method_array_of_structs(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_Array *a_in) +_test_object_method_array_of_structs_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_Array *a_in) { - fprintf(stdout, "_test_object_method_array_of_structs(%p)\n", a_in); + fprintf(stdout, "_test_object_method_array_of_structs_check(%p)\n", a_in); + fflush(stdout); if (a_in) return a_in; Test_Struct_Ex *v = malloc(sizeof(Test_Struct_Ex)); v->value_int = 42; @@ -327,11 +354,12 @@ _test_object_method_array_of_structs(Eo* obj EINA_UNUSED, } EOLIAN static Eina_Array * -_test_object_method_array_of_arrays_of_ints(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_Array *a_in) +_test_object_method_array_of_arrays_of_ints_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_Array *a_in) { - fprintf(stdout, "_test_object_method_array_of_arrays_of_ints(%p)\n", a_in); + fprintf(stdout, "_test_object_method_array_of_arrays_of_ints_check(%p)\n", a_in); + fflush(stdout); if (a_in) return a_in; int *v = malloc(sizeof(int)); *v = 42; @@ -345,52 +373,57 @@ _test_object_method_array_of_arrays_of_ints(Eo* obj EINA_UNUSED, // Lists // EOLIAN static Eina_List * -_test_object_method_list_with_42(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED) +_test_object_method_list_with_42_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED) { - fprintf(stdout, "_test_object_method_list_with_42()\n"); + fprintf(stdout, "_test_object_method_list_with_42_check()\n"); + fflush(stdout); int* n = malloc(sizeof(int)); *n = 42; return eina_list_append(NULL, n); } EOLIAN static void -_test_object_method_list_in_list_out(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_List *l_in, - Eina_List **l_out) +_test_object_method_list_in_list_out_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_List *l_in, + Eina_List **l_out) { - fprintf(stdout, "_test_object_method_list_in_list_out(%p , %p)\n", l_in, l_out); + fprintf(stdout, "_test_object_method_list_in_list_out_check(%p , %p)\n", l_in, l_out); + fflush(stdout); *l_out = l_in; } EOLIAN static Eina_List * -_test_object_method_list_of_objects(Eo* obj, - Test_Object_Data *pd EINA_UNUSED, - Eina_List *l_in) +_test_object_method_list_of_objects_check(Eo* obj, + Test_Object_Data *pd EINA_UNUSED, + Eina_List *l_in) { - fprintf(stdout, "_test_object_method_list_of_objects(%p)\n", l_in); + fprintf(stdout, "_test_object_method_list_of_objects_check(%p)\n", l_in); + fflush(stdout); if (l_in) return l_in; return eina_list_append(NULL, obj); } EOLIAN static Eina_List * -_test_object_method_list_of_strings(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_List *l_in) +_test_object_method_list_of_strings_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_List *l_in) { - fprintf(stdout, "_test_object_method_list_of_strings(%p)\n", l_in); + fprintf(stdout, "_test_object_method_list_of_strings_check(%p)\n", l_in); + fflush(stdout); if (l_in) return l_in; return eina_list_append(NULL, "foo"); } EOLIAN static Eina_List * -_test_object_method_list_of_ints(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_List *l_in) +_test_object_method_list_of_ints_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_List *l_in) { - fprintf(stdout, "_test_object_method_list_of_ints(%p)\n", l_in); + fprintf(stdout, "_test_object_method_list_of_ints_check(%p)\n", l_in); + fflush(stdout); if (l_in) return l_in; int *v = malloc(sizeof(int)); *v = 42; @@ -398,11 +431,12 @@ _test_object_method_list_of_ints(Eo* obj EINA_UNUSED, } EOLIAN static Eina_List * -_test_object_method_list_of_bools(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_List *l_in) +_test_object_method_list_of_bools_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_List *l_in) { - fprintf(stdout, "_test_object_method_list_of_bools(%p)\n", l_in); + fprintf(stdout, "_test_object_method_list_of_bools_check(%p)\n", l_in); + fflush(stdout); if (l_in) return l_in; Eina_Bool *v = malloc(sizeof(Eina_Bool)); *v = EINA_TRUE; @@ -410,11 +444,12 @@ _test_object_method_list_of_bools(Eo* obj EINA_UNUSED, } EOLIAN static Eina_List * -_test_object_method_list_of_doubles(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_List *l_in) +_test_object_method_list_of_doubles_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_List *l_in) { - fprintf(stdout, "_test_object_method_list_of_doubles(%p)\n", l_in); + fprintf(stdout, "_test_object_method_list_of_doubles_check(%p)\n", l_in); + fflush(stdout); if (l_in) return l_in; double *v = malloc(sizeof(double)); *v = 42; @@ -422,11 +457,12 @@ _test_object_method_list_of_doubles(Eo* obj EINA_UNUSED, } EOLIAN static Eina_List * -_test_object_method_list_of_enums(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_List *l_in) +_test_object_method_list_of_enums_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_List *l_in) { - fprintf(stdout, "_test_object_method_list_of_enums(%p)\n", l_in); + fprintf(stdout, "_test_object_method_list_of_enums_check(%p)\n", l_in); + fflush(stdout); if (l_in) return l_in; Test_Enum_Ex *v = malloc(sizeof(Test_Enum_Ex)); *v = TEST_ENUM_EX_THIRD; @@ -434,11 +470,12 @@ _test_object_method_list_of_enums(Eo* obj EINA_UNUSED, } EOLIAN static Eina_List * -_test_object_method_list_of_structs(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_List *l_in) +_test_object_method_list_of_structs_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_List *l_in) { - fprintf(stdout, "_test_object_method_list_of_structs(%p)\n", l_in); + fprintf(stdout, "_test_object_method_list_of_structs_check(%p)\n", l_in); + fflush(stdout); if (l_in) return l_in; Test_Struct_Ex *v = malloc(sizeof(Test_Struct_Ex)); v->value_int = 42; @@ -449,11 +486,12 @@ _test_object_method_list_of_structs(Eo* obj EINA_UNUSED, // Accessors // EOLIAN static Eina_Accessor * -_test_object_method_accessor_of_objects(Eo* obj, - Test_Object_Data *pd EINA_UNUSED, - Eina_Accessor *a_in) +_test_object_method_accessor_of_objects_check(Eo* obj, + Test_Object_Data *pd EINA_UNUSED, + Eina_Accessor *a_in) { - fprintf(stdout, "_test_object_method_accessor_of_objects(%p)\n", a_in); + fprintf(stdout, "_test_object_method_accessor_of_objects_check(%p)\n", a_in); + fflush(stdout); if (a_in) return a_in; Eina_Array *arr = eina_array_new(2); eina_array_push(arr, obj); @@ -461,11 +499,12 @@ _test_object_method_accessor_of_objects(Eo* obj, } EOLIAN static Eina_Accessor * -_test_object_method_accessor_of_strings(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_Accessor *a_in) +_test_object_method_accessor_of_strings_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_Accessor *a_in) { - fprintf(stdout, "_test_object_method_accessor_of_strings(%p)\n", a_in); + fprintf(stdout, "_test_object_method_accessor_of_strings_check(%p)\n", a_in); + fflush(stdout); if (a_in) return a_in; Eina_Array *arr = eina_array_new(2); eina_array_push(arr, "foo"); @@ -473,11 +512,12 @@ _test_object_method_accessor_of_strings(Eo* obj EINA_UNUSED, } EOLIAN static Eina_Accessor * -_test_object_method_accessor_of_ints(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_Accessor *a_in) +_test_object_method_accessor_of_ints_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_Accessor *a_in) { - fprintf(stdout, "_test_object_method_accessor_of_ints(%p)\n", a_in); + fprintf(stdout, "_test_object_method_accessor_of_ints_check(%p)\n", a_in); + fflush(stdout); if (a_in) return a_in; int *v = malloc(sizeof(int)); *v = 42; @@ -487,11 +527,12 @@ _test_object_method_accessor_of_ints(Eo* obj EINA_UNUSED, } EOLIAN static Eina_Accessor * -_test_object_method_accessor_of_bools(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_Accessor *a_in) +_test_object_method_accessor_of_bools_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_Accessor *a_in) { - fprintf(stdout, "_test_object_method_accessor_of_bools(%p)\n", a_in); + fprintf(stdout, "_test_object_method_accessor_of_bools_check(%p)\n", a_in); + fflush(stdout); if (a_in) return a_in; Eina_Bool *v = malloc(sizeof(Eina_Bool)); *v = EINA_TRUE; @@ -501,11 +542,12 @@ _test_object_method_accessor_of_bools(Eo* obj EINA_UNUSED, } EOLIAN static Eina_Accessor * -_test_object_method_accessor_of_doubles(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_Accessor *a_in) +_test_object_method_accessor_of_doubles_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_Accessor *a_in) { - fprintf(stdout, "_test_object_method_accessor_of_doubles(%p)\n", a_in); + fprintf(stdout, "_test_object_method_accessor_of_doubles_check(%p)\n", a_in); + fflush(stdout); if (a_in) return a_in; double *v = malloc(sizeof(double)); *v = 42.0; @@ -515,11 +557,12 @@ _test_object_method_accessor_of_doubles(Eo* obj EINA_UNUSED, } EOLIAN static Eina_Accessor * -_test_object_method_accessor_of_enums(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_Accessor *a_in) +_test_object_method_accessor_of_enums_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_Accessor *a_in) { - fprintf(stdout, "_test_object_method_accessor_of_enums(%p)\n", a_in); + fprintf(stdout, "_test_object_method_accessor_of_enums_check(%p)\n", a_in); + fflush(stdout); if (a_in) return a_in; Test_Enum_Ex *v = malloc(sizeof(Test_Enum_Ex)); *v = TEST_ENUM_EX_THIRD; @@ -529,11 +572,12 @@ _test_object_method_accessor_of_enums(Eo* obj EINA_UNUSED, } EOLIAN static Eina_Accessor * -_test_object_method_accessor_of_structs(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_Accessor *a_in) +_test_object_method_accessor_of_structs_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_Accessor *a_in) { - fprintf(stdout, "_test_object_method_accessor_of_structs(%p)\n", a_in); + fprintf(stdout, "_test_object_method_accessor_of_structs_check(%p)\n", a_in); + fflush(stdout); if (a_in) return a_in; Test_Struct_Ex *v = malloc(sizeof(Test_Struct_Ex)); v->value_int = 42; @@ -546,11 +590,12 @@ _test_object_method_accessor_of_structs(Eo* obj EINA_UNUSED, // Combinations of complex types EOLIAN static Eina_List * -_test_object_method_list_of_lists_of_ints(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_List *l_in) +_test_object_method_list_of_lists_of_ints_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_List *l_in) { - fprintf(stdout, "_test_object_method_list_of_lists_of_ints(%p)\n", l_in); + fprintf(stdout, "_test_object_method_list_of_lists_of_ints_check(%p)\n", l_in); + fflush(stdout); if (l_in) return l_in; int *v = malloc(sizeof(int)); *v = 42; @@ -558,11 +603,12 @@ _test_object_method_list_of_lists_of_ints(Eo* obj EINA_UNUSED, } EOLIAN static Eina_Array * -_test_object_method_array_of_lists_of_ints(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_Array *a_in) +_test_object_method_array_of_lists_of_ints_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_Array *a_in) { - fprintf(stdout, "_test_object_method_array_of_lists_of_ints(%p)\n", a_in); + fprintf(stdout, "_test_object_method_array_of_lists_of_ints_check(%p)\n", a_in); + fflush(stdout); if (a_in) return a_in; int *v = malloc(sizeof(int)); *v = 42; @@ -572,11 +618,12 @@ _test_object_method_array_of_lists_of_ints(Eo* obj EINA_UNUSED, } EOLIAN static Eina_List * -_test_object_method_list_of_arrays_of_ints(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Eina_List *l_in) +_test_object_method_list_of_arrays_of_ints_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Eina_List *l_in) { - fprintf(stdout, "_test_object_method_list_of_arrays_of_ints(%p)\n", l_in); + fprintf(stdout, "_test_object_method_list_of_arrays_of_ints_check(%p)\n", l_in); + fflush(stdout); if (l_in) return l_in; int *v = malloc(sizeof(int)); *v = 42; @@ -586,35 +633,40 @@ _test_object_method_list_of_arrays_of_ints(Eo* obj EINA_UNUSED, } EOLIAN static const Eina_List * -_test_object_method_list_with_opaque_elements(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED) +_test_object_method_list_with_opaque_elements_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED) { - fprintf(stdout, "_test_object_method_list_with_opaque_elements()\n"); + fprintf(stdout, "_test_object_method_list_with_opaque_elements_check()\n"); + fflush(stdout); return NULL; } EOLIAN static Test_Enum_Ex -_test_object_method_in_enum_return_enum(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Test_Enum_Ex e) +_test_object_method_in_enum_return_enum_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Test_Enum_Ex e) { - fprintf(stdout, "_test_object_method_in_enum_return_enum(%d)\n", e); + fprintf(stdout, "_test_object_method_in_enum_return_enum_check(%d)\n", e); + fflush(stdout); return e; } EOLIAN static Test_Struct_Ex * -_test_object_method_in_struct_return_struct(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED, - Test_Struct_Ex *s) +_test_object_method_in_struct_return_struct_check(Eo* obj EINA_UNUSED, + Test_Object_Data *pd EINA_UNUSED, + Test_Struct_Ex *s) { - fprintf(stdout, "_test_object_method_in_struct_return_struct()\n"); + fprintf(stdout, "_test_object_method_in_struct_return_struct_check(%p)\n", s); + fflush(stdout); return s; } EOLIAN static void _test_object_event_repeated_event_name(Eo* obj EINA_UNUSED, - Test_Object_Data *pd EINA_UNUSED) + Test_Object_Data *pd EINA_UNUSED) { + fprintf(stdout, "_test_object_event_repeated_event_name()\n"); + fflush(stdout); } #include <test_object.eo.c> diff --git a/src/tests/eolian_js/test_object.eo b/src/tests/eolian_js/test_object.eo index c292c248e7..81043fe81d 100644 --- a/src/tests/eolian_js/test_object.eo +++ b/src/tests/eolian_js/test_object.eo @@ -13,23 +13,23 @@ struct Test.Struct_Ex { class Test.Object (Eo.Base) { legacy_prefix: null; methods { - method_integral_in_a { + method_integral_in_a_check { [[ tests integral in ]] params { a: int; } } - method_integral_out_a { + method_integral_out_a_check { [[ tests integral out ]] params { @out a: int; } } - method_integral_inout { + method_integral_inout_check { [[ tests integral inout ]] params { @inout a: int; } } - method_integral_return_a { + method_integral_return_a_check { [[ tests integral result ]] return: int; } - method_div_mod { + method_div_mod_check { [[ tests mixed in, outs and result ]] params { a: int; @@ -39,7 +39,7 @@ class Test.Object (Eo.Base) { } return: bool; } - method_and { + method_and_check { [[ tests boolean ]] params { a: bool; @@ -47,7 +47,7 @@ class Test.Object (Eo.Base) { } return: bool; } - method_modf { + method_modf_check { [[ tests floating point ]] params { a: double; @@ -55,38 +55,38 @@ class Test.Object (Eo.Base) { } return: double; } - method_uppercase { + method_uppercase_check { [[ tests string ]] params { @inout str: char*; } } - method_in_null { + method_in_null_check { [[ tests null input ]] params { a: char*; } return: bool; } - method_out_null { + method_out_null_check { [[ tests null output ]] params { @out a: char*; } return: bool; } - method_inout_null { + method_inout_null_check { [[ tests null output ]] params { @inout a: char*; } return: bool; } - method_return_null { + method_return_null_check { [[ tests null return ]] return: char*; } - method_null { + method_null_check { [[ tests null values ]] params { in: char*; @@ -95,7 +95,7 @@ class Test.Object (Eo.Base) { } return: char*; } - method_array_at { + method_array_at_check { [[ tests array ]] params { array: array<int>*; @@ -103,190 +103,190 @@ class Test.Object (Eo.Base) { } return: int; } - method_array_with_42 { + method_array_with_42_check { [[ tests parameters ]] return: free(own(array<int> *), eina_array_free) @warn_unused; } - method_array_in_array_out { + method_array_in_array_out_check { [[ tests parameters ]] params { @in a_in: array<int> *; @out a_out: array<int> *; } } - method_array_of_objects { + method_array_of_objects_check { params { @in a_in: array<Test.Object *> *; } return: array<Test.Object *> *; } - method_array_of_strings { + method_array_of_strings_check { params { @in a_in: array<const(char) *> *; } return: array<const(char) *> *; } - method_array_of_ints { + method_array_of_ints_check { params { @in a_in: array<int> *; } return: array<int> *; } - method_array_of_bools { + method_array_of_bools_check { params { @in a_in: array<bool> *; } return: array<bool> *; } - method_array_of_doubles { + method_array_of_doubles_check { params { @in a_in: array<double> *; } return: array<double> *; } - method_array_of_enums { + method_array_of_enums_check { params { @in a_in: array<Test.Enum_Ex> *; } return: array<Test.Enum_Ex> *; } - method_array_of_structs { + method_array_of_structs_check { params { @in a_in: array<Test.Struct_Ex> *; } return: array<Test.Struct_Ex> *; } - method_list_with_42 { + method_list_with_42_check { [[ tests parameters ]] return: free(own(list<int> *), eina_list_free) @warn_unused; } - method_list_in_list_out { + method_list_in_list_out_check { [[ tests parameters ]] params { @in l_in: list<int> *; @out l_out: list<int> *; } } - method_list_of_objects { + method_list_of_objects_check { params { @in l_in: list<Test.Object *> *; } return: list<Test.Object *> *; } - method_list_of_strings { + method_list_of_strings_check { params { @in l_in: list<const(char) *> *; } return: list<const(char) *> *; } - method_list_of_ints { + method_list_of_ints_check { params { @in l_in: list<int> *; } return: list<int> *; } - method_list_of_bools { + method_list_of_bools_check { params { @in l_in: list<bool> *; } return: list<bool> *; } - method_list_of_doubles { + method_list_of_doubles_check { params { @in l_in: list<double> *; } return: list<double> *; } - method_list_of_enums { + method_list_of_enums_check { params { @in l_in: list<Test.Enum_Ex> *; } return: list<Test.Enum_Ex> *; } - method_list_of_structs { + method_list_of_structs_check { params { @in l_in: list<Test.Struct_Ex> *; } return: list<Test.Struct_Ex> *; } - method_accessor_of_objects { + method_accessor_of_objects_check { params { @in a_in: accessor<Test.Object *> *; } return: accessor<Test.Object *> *; } - method_accessor_of_strings { + method_accessor_of_strings_check { params { @in a_in: accessor<const(char) *> *; } return: accessor<const(char) *> *; } - method_accessor_of_ints { + method_accessor_of_ints_check { params { @in a_in: accessor<int> *; } return: accessor<int> *; } - method_accessor_of_bools { + method_accessor_of_bools_check { params { @in a_in: accessor<bool> *; } return: accessor<bool> *; } - method_accessor_of_doubles { + method_accessor_of_doubles_check { params { @in a_in: accessor<double> *; } return: accessor<double> *; } - method_accessor_of_enums { + method_accessor_of_enums_check { params { @in a_in: accessor<Test.Enum_Ex> *; } return: accessor<Test.Enum_Ex> *; } - method_accessor_of_structs { + method_accessor_of_structs_check { params { @in a_in: accessor<Test.Struct_Ex> *; } return: accessor<Test.Struct_Ex> *; } - method_array_of_arrays_of_ints { + method_array_of_arrays_of_ints_check { params { @in a_in: array<array<int> *> *; } return: array<array<int> *> *; } - method_list_of_lists_of_ints { + method_list_of_lists_of_ints_check { params { @in l_in: list<list<int> *> *; } return: list<list<int> *> *; } - method_array_of_lists_of_ints { + method_array_of_lists_of_ints_check { params { @in a_in: array<list<int> *> *; } return: array<list<int> *> *; } - method_list_of_arrays_of_ints { + method_list_of_arrays_of_ints_check { params { @in l_in: list<array<int> *> *; } return: list<array<int> *> *; } - method_list_with_opaque_elements { + method_list_with_opaque_elements_check { return: const(list<Elm.Calendar.Mark*>)*; } - method_in_enum_return_enum { + method_in_enum_return_enum_check { params { e: Test.Enum_Ex; } return: Test.Enum_Ex; } - method_in_struct_return_struct { + method_in_struct_return_struct_check { params { e: Test.Struct_Ex *; } return: Test.Struct_Ex *; } - call_event { + event_emit { } event_repeated_event_name { } |