forked from enlightenment/efl
eolian-js: Fix compilation of JavaScript binding
This commit is contained in:
parent
90b6468bbd
commit
b06d2510de
|
@ -129,7 +129,7 @@ bindings/cxx/ecore_cxx/Ecore_Manual.hh
|
|||
nodist_installed_ecorecxxheaders_DATA = $(ecore_eolian_cxx_hh) $(ecore_eolian_cxx_impl_hh) \
|
||||
lib/ecore/Ecore.eo.hh
|
||||
|
||||
lib/ecore/Ecore.eo.hh: $(ecore_eolian_cxx_hh) $(eo_eolian_cxx_hh)
|
||||
lib/ecore/Ecore.eo.hh: $(ecore_eolian_cxx_hh) $(eo_eolian_cxx_hh) $(efl_eolian_cxx_hh)
|
||||
@echo @ECHO_E@ "#ifndef EFL_CXX_ECORE_HH\n#define EFL_CXX_ECORE_HH\n" > $(top_builddir)/src/lib/ecore/Ecore.eo.hh
|
||||
@echo @ECHO_E@ "#ifdef EFL_BETA_API_SUPPORT" >> $(top_builddir)/src/lib/ecore/Ecore.eo.hh
|
||||
@for i in $(ecore_eolian_cxx_hh); do echo "#include <$$(basename $$i)>" >> $(top_builddir)/src/lib/ecore/Ecore.eo.hh; done
|
||||
|
|
|
@ -204,6 +204,7 @@ SUITE_RUNNER_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
|
|||
-DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/efl_js\" \
|
||||
@CHECK_CFLAGS@ \
|
||||
@EFL_JS_CFLAGS@ \
|
||||
@EFL_CFLAGS@ \
|
||||
@EINA_CXX_CFLAGS@ \
|
||||
@EO_CXX_CFLAGS@ \
|
||||
@EO_CFLAGS@ \
|
||||
|
|
|
@ -13,6 +13,9 @@ bin_eolian_js_eolian_js_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
|
|||
-I$(top_srcdir)/src/bindings/js/eo_js \
|
||||
@EOLIAN_JS_CFLAGS@ \
|
||||
@EINA_CXX_CFLAGS@ \
|
||||
@EO_CXX_CFLAGS@ \
|
||||
@EFL_CFLAGS@ \
|
||||
@ECORE_CXX_CFLAGS@ \
|
||||
@EOLIAN_CXX_CFLAGS@
|
||||
|
||||
bin_eolian_js_eolian_js_LDADD = @USE_EO_LIBS@ @USE_EOLIAN_LIBS@
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef EOLIAN_KLASS_HH
|
||||
#define EOLIAN_KLASS_HH
|
||||
|
||||
#include <Eo.hh>
|
||||
#include <Eina.hh>
|
||||
|
||||
#include <eolian/js/domain.hh>
|
||||
|
@ -38,11 +39,6 @@ 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)
|
||||
{
|
||||
return type_class_name(::eolian_type_base_type_get(tp));
|
||||
}
|
||||
else
|
||||
{
|
||||
tp = ::eolian_type_aliased_base_get(tp);
|
||||
tpt = ::eolian_type_type_get(tp);
|
||||
|
|
|
@ -83,18 +83,57 @@ _final_type_and_type_type_get(Eolian_Type const* tp_in, Eolian_Type const*& tp_o
|
|||
}
|
||||
|
||||
std::string
|
||||
_eolian_type_cpp_type_named_get(const Eolian_Type *tp, std::string const& caller_class_prefix, std::set<std::string>& need_name_getter)
|
||||
_eolian_type_cpp_type_named_get(const Eolian_Type *tp, std::string const& caller_class_prefix, std::set<std::string>& need_name_getter, bool in_pointer = false)
|
||||
{
|
||||
const auto is_const = eolian_type_is_const(tp);
|
||||
|
||||
std::string result;
|
||||
|
||||
if(!in_pointer && (eolian_type_is_ptr(tp) || eolian_type_type_get(tp) == EOLIAN_TYPE_TERMINATED_ARRAY
|
||||
|| eolian_type_type_get(tp) == EOLIAN_TYPE_STATIC_ARRAY))
|
||||
// else if (tpt == EOLIAN_TYPE_POINTER)
|
||||
{
|
||||
// auto btp = eolian_type_base_type_get(tp);
|
||||
auto btp = eolian_type_type_get(tp) == EOLIAN_TYPE_TERMINATED_ARRAY
|
||||
|| eolian_type_type_get(tp) == EOLIAN_TYPE_STATIC_ARRAY
|
||||
? eolian_type_base_type_get(tp)
|
||||
: tp;
|
||||
result += _eolian_type_cpp_type_named_get(btp, caller_class_prefix, need_name_getter
|
||||
, eolian_type_is_ptr(tp));
|
||||
const auto base_is_const = eolian_type_is_const(btp);
|
||||
|
||||
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 (btpd && eolian_typedecl_type_get(btpd) == EOLIAN_TYPEDECL_STRUCT)
|
||||
{
|
||||
std::string f = "::make_struct_tag";
|
||||
auto p = result.find(f);
|
||||
if (p == std::string::npos)
|
||||
throw std::runtime_error("missing struct type tag");
|
||||
result.replace(p, f.size(), "::make_struct_ptr_tag");
|
||||
result.pop_back();
|
||||
result += " *";
|
||||
if (is_const) result += " const";
|
||||
result += ">";
|
||||
}
|
||||
else
|
||||
{
|
||||
// if (btpt != EOLIAN_TYPE_POINTER || base_is_const)
|
||||
// result += ' ';
|
||||
result += '*';
|
||||
if (is_const) result += " const";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Eolian_Type_Type tpt = EOLIAN_TYPE_UNKNOWN_TYPE;
|
||||
_final_type_and_type_type_get(tp, tp, tpt);
|
||||
|
||||
if (tpt == EOLIAN_TYPE_UNKNOWN_TYPE || tpt == EOLIAN_TYPE_UNDEFINED)
|
||||
return "error";
|
||||
|
||||
std::string result;
|
||||
|
||||
if ((tpt == EOLIAN_TYPE_VOID
|
||||
|| tpt == EOLIAN_TYPE_REGULAR
|
||||
|| tpt == EOLIAN_TYPE_COMPLEX
|
||||
|
@ -207,40 +246,19 @@ _eolian_type_cpp_type_named_get(const Eolian_Type *tp, std::string const& caller
|
|||
}
|
||||
else if (tpt == EOLIAN_TYPE_VOID)
|
||||
result += "void";
|
||||
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);
|
||||
const auto base_is_const = eolian_type_is_const(btp);
|
||||
|
||||
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 (btpd && eolian_typedecl_type_get(btpd) == EOLIAN_TYPEDECL_STRUCT)
|
||||
{
|
||||
std::string f = "::make_struct_tag";
|
||||
auto p = result.find(f);
|
||||
if (p == std::string::npos)
|
||||
throw std::runtime_error("missing struct type tag");
|
||||
result.replace(p, f.size(), "::make_struct_ptr_tag");
|
||||
result.pop_back();
|
||||
result += " *";
|
||||
if (is_const) result += " const";
|
||||
result += ">";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (btpt != EOLIAN_TYPE_POINTER || base_is_const)
|
||||
result += ' ';
|
||||
result += '*';
|
||||
if (is_const) result += " const";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("unhandled Eolian_Type_Type value");
|
||||
// else if(tpt == EOLIAN_TYPE_STATIC_ARRAY)
|
||||
// {
|
||||
// result += "void";
|
||||
// }
|
||||
// else if(tpt == EOLIAN_TYPE_TERMINATED_ARRAY)
|
||||
// {
|
||||
// result += "void";
|
||||
// }
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// throw std::runtime_error("unhandled Eolian_Type_Type value");
|
||||
// }
|
||||
|
||||
/*if (!name.empty())
|
||||
{
|
||||
|
|
|
@ -79,7 +79,6 @@ static v8::Local<v8::Object> wrap_eina_file(Eina_File *file,
|
|||
using v8::ObjectTemplate;
|
||||
using v8::Object;
|
||||
using v8::FunctionTemplate;
|
||||
using v8::WeakCallbackData;
|
||||
|
||||
auto obj_tpl = compatibility_new<ObjectTemplate>(isolate);
|
||||
obj_tpl->SetInternalFieldCount(1);
|
||||
|
|
Loading…
Reference in New Issue