Commit Graph

48 Commits

Author SHA1 Message Date
Vitor Sousa 09be34b825 eolian_cxx: fix build error for some generated C++ wrappers
Name generation for some C++ wrapper functions were adding an illegal ":"
in the function name.
Fixed the logical error that was causing this to happens when converting
namespaces to function prefixes.

@fix
2015-04-03 16:30:46 +02:00
Vitor Sousa 0ca8f7c718 eolian_cxx: Fix wrapper constructors by updating to the new eo_add_ref interface 2015-02-23 17:04:53 -03:00
Felipe Magno de Almeida c57fa54fc8 eolian-cxx: Fixed mixed inheritance between C and C++ classes
Removed genereation for Eo.Base primitive methods which segfault'ed
on parent_set function.
2015-01-05 18:59:09 -02:00
Vitor Sousa 666b0da912 eolian_cxx: Using eina::optional to handle parameters without @nonull property 2015-01-05 15:52:27 -02:00
Vitor Sousa 4222cd3f50 eolian_cxx: Fix compilation of inheritance from Eolian generated classes
Updated the code for the "inheritance helper" functions and classes
to be in conformance with the new wrapper architecture.

Member variable "parents" of efl::eo::eo_class struct was split in two
member variables, "ancestors" and "parents", the former containing all
Eo class ancestors and the later only the direct bases.
Changed all required files accordingly.

Check to avoid using biding string when the parameter is @out now matches
any variation of "char".

Add default constructor to efl::eo::concrete in order to allow it to be
NULL initialized in the "inheritance helper" classes.

Removed conflicting parent_set member function in the efl::eo::inherit
class.

Removed the "inheritance_extension_function" generator since it is no
longer used.
2015-01-05 15:52:27 -02:00
Larry Jr 2b12114777 allow C++ user create new classes inheriting from Eolian generated Classes 2015-01-05 15:52:27 -02:00
Vitor Sousa 0685885c2a eolian_cxx: Add implicit conversion of the returned pointer of C++ wrappers
Overloaded address-of operator for C++ Eolian wrappers for implicit converting
to any ancestor pointer type when getting the object memory address.

Added new grammars to aid the creation of the pointer wrappers
responsible of doing the implicit conversions.

Added a unit test which checks the address-of overload for arbitrary classes.
Added new .eo files to be used in it.
2015-01-05 15:52:27 -02:00
Vitor Sousa 6519ae6ed9 eolian_cxx: Fix "dreaded diamond" inheritance problem for C++ wrappers
Solved diamond inheritance problem by completely removing inheritance in
the abstract class.
All ancestors are inherited directly in the concrete class.
The algorithm that list the ancestors also avoid repetition.

Now concrete classes define methods too. This helps referring the correct
method directly by the object type (when there are methods with the same
name).

Moved the declaration and definition of constructor methods to the concrete
class, since they should not be used in derived classes.

Updated example that call "color_set".
With this model, if two ancestor classes have a method with the same name,
to call one of them from a derived class you must write the scoped name of
the member function in the wrapper.
In this case, either Evas.Object and Evas.SmartObject have a property
named "color".

Added "from_global" option to the full_name grammar too.
2015-01-05 15:52:27 -02:00
Vitor Sousa ed75aa32d6 cxx: General C++ Eo wrapper generation improvement
Using a new architecture in the generated files that simplify multiple
inheritance and allows the use of interface types as parameters.

No longer using a hand-crafted C++ header for eo_base.eo.
This file was added to the generation process.

Updated all files that are dependent in the hand-crafted eo_base
C++ header.

Now there is a class that contains the essentials functions of the former
eo::base wrapper and that is used to create (through inheritance) the
"concrete" classes for all Eo generated wrappers.

No longer binding any function or property that are protected, private or
legacy for now.

eolian_type_instance is now a struct with general information for the
whole type.

Added the new header file namespace_generator.hh to hold namespace
generation grammars.

Separated declaration and definition of Eo wrappers methods.

Referring for most objects by its full name (starting at the global
namespace ::) in the generated files.

Created additional helper grammars to avoid code replication.

Removed a TODO comment referring to a doubt about inheritance of
constructor methods.
Added a TODO comment regarding memory allocation for callbacks in static
member functions.
2015-01-05 15:52:27 -02:00
Larry Jr ebebcf6438 catch exceptions in cxx wrappers and throw a eina_error 2015-01-05 15:52:27 -02:00
Vitor Sousa d5ec6c41d9 eolian_cxx: Fix: Using binding type for @out parameter instead of native type
No longer reverting to the native type when the parameter has "@out"
direction.

Added "is_out" member variable to eolian_type class.
With that, generators can keep track of the direction of the parameters.
Also added helper functions "type_is_out" and "type_is_complex".

Created "to_native" functions in eo_cxx_interop.hh to convert binding types
from C++ arguments to the actual C function arguments.
Added static assertions in these functions to enforce compatibility
between the binding and the native type (Required by @out parameters).

Reworked the overload of the "to_c" function for eo::base derivated
objects. Now there is a overload that rely in the compatibility
between the native type and the wrapper, enabling a wrapper to be used as
an output parameter.
2015-01-05 15:52:27 -02:00
Felipe Magno de Almeida 890ce1f9cf eolian-cxx: Fixed C++ conversion for lists
Signed-off-by: Vitor Sousa <vitorsousasilva@gmail.com>
2015-01-05 15:52:27 -02:00
Vitor Sousa 64dede1cf1 eolian_cxx: Fix callback handling on generated wrappers
Added callbacks to the event EO_EV_DEL for deleting heap-allocated
function objects. This will enforce that the allocated memory,
necessary for maintaining these callable objects alive, is freed at
least when the underlaying Eo object is destroyed.

Functions and constructor methods are now able to have multiple
callback types.

Removed some unused generators, since they become inconsistent now that
functions are required to handle multiple callback types.

Allocating callback objects in the constructor methods instead of
delaying it until the final constructor is called.

Created some generators to avoid code repetition.

Now the generator parameters_forward_to_c replicate the behavior of the
generator parameters_list. The generator parameters_list was, then,
removed since it have a less intuitive name.

Added a TODO comment regarding the behaviour of simple not translating
callbacks that are not followed by a user data pointer.

The generator parameter_type was moved from "parameters_generator.hh" to
"type_generator.hh" for more consistency and convenience.
2015-01-05 15:52:27 -02:00
Vitor Sousa 132abc3534 eolian_cxx: Fix Eolian C++ generated wrapper inconsistencies
In convert.cc: Reading functions instead of implements to convert the
Eolian_Class. It avoids creation of methods that do not belong to the
class, in special it avoids calling the default constructor twice in the
generated code.

No longer generating one constructor in the C++ wrapper for each eolian
class constructor, since the correct behavior demands that all constructor
should be called. Now the wrappers have "constructor methods" that
must be called when creating a new object.

Updated test cases and examples to match the new interface. Some class
constructors and some test cases have to be removed since they were based
on the wrong assumption that constructors are mutually exclusive.

Created new generators for forwarding parameters and for looping over
the relevant parameters to the C++ wrapper executing a generic lambda.

Added a TODO comment regarding the call of constructor methods of all
base classes. Currently there is no base type with constructors, so this
situation should be discussed more.

Added a TODO comment regarding the way callback parameters are being
processed.
2015-01-05 15:52:27 -02:00
Vitor Sousa ed8ce801cb eolian_cxx: Assertions to ensure C++ wrapper compatibility with Eo*
Added static assertion in the generated header to ensure that the wrapper
have the same size of Eo*, thus grating compatibility between these types.

Added static assertion in the generated header to ensure that the wrapper
have standard layout. This should ensure correct type sizes when dealing
with inheritance.

Created a test to ensure that eo::base and the eolian wrappers have the
same size of a Eo*.

Added eolian_cxx_test_wrapper.cc to the list of test source files in
Makefile_Eolian_Cxx.am.
2015-01-05 15:52:27 -02:00
Felipe Magno de Almeida 36405c6556 eolian-cxx: Fixed pointer dereferencing for Eolian types and constant propagation for C++ eina list containers
With the addition of pointer types, the eolian C++ generator now has
to dereference to get the base type which might be a complex type.
2014-10-08 22:28:51 -03:00
Savio Sena e9e2344982 eolian-cxx: Replace old eo_add with eo_add_ref.
eo_add_ref behaves like the old eo_add.
2014-09-26 18:56:41 -03:00
Savio Sena 684617cfdc eo-cxx: Get rid of eo_add_custom. 2014-09-25 16:11:03 -03:00
Savio Sena ab43773a43 eolian-cxx: Include Efl.h in generated headers. 2014-09-12 15:28:23 -03:00
Savio Sena 916ddb46b8 eolian-cxx: Fix generated code indentation. 2014-09-12 15:28:23 -03:00
Savio Sena 07c6cadee3 eolian-cxx: Renamed event_*_callback_{add,call} to callback_*_{add,call}. 2014-08-13 10:17:53 -03:00
Savio Sena 0cc5f5c94d eolian-cxx: Added generation of call_constructor for parent_type. 2014-07-25 11:32:56 -03:00
Savio Sena fb82d67ab1 eolian-cxx: Fixed inheritance operations generation rules.
The generated code was not converting the types from C to C++ correctly.
2014-07-24 19:52:23 -03:00
Savio Sena bd68d29968 eolian-cxx: Added grammar rule parameters_cxx_list.
Now with the correct semantics: list parameters converting to C++.
2014-07-24 19:52:23 -03:00
Savio Sena 90f46e36f2 eolian-cxx: Renamed parameters_cxx_list -> constructor_parameters_list 2014-07-24 19:52:23 -03:00
Savio Sena cc04dff0b9 eolian-cxx: Removed unused code.
Sanitized grammar removing old code which is not unecessary for good.
2014-07-24 19:52:23 -03:00
Savio Sena dcb75cdc1d eolian-cxx: Fixed a bug in the generator.
It was not considering the variable name correctly.
2014-07-24 19:52:23 -03:00
Felipe Magno de Almeida ad66192465 eolian-cxx: Fixed generation using abstract return-type instead of C type
The _tmp_ret variable should use the native C type and not the
abstracted C++ type.
2014-07-18 19:20:55 -03:00
Felipe Magno de Almeida c1e8918b88 eolian-cxx: Fixed inheritance feature with callbacks
The addition of callbacks was making the inheritance to fail. Fixed
generation by using the C types, instead of the abstracted callback
types for the wrapper functions.
2014-07-18 19:00:35 -03:00
Felipe Magno de Almeida 907544be7b eolian-cxx: Various and various fixes with callbacks
Mimic the callback function generation for other functions that were
being generated incorrectly and inconsistently.
2014-07-18 18:59:12 -03:00
Felipe Magno de Almeida 15d85d7dc6 eolian-cxx: Workaround for callbacks without void* data parameter 2014-07-18 18:57:14 -03:00
Felipe Magno de Almeida 7e84cc0154 eo-cxx: Added a few complex types to lookup table 2014-07-18 18:57:14 -03:00
Felipe Magno de Almeida 401cc81355 eolian-cxx: Workaround for multiple callbacks without corresponding void*data
Added workaround for generating classes with methods that have more
than one callback but doesn't have a corresponding void* data
parameter. E.g., elm_box.eo.
2014-07-18 18:57:14 -03:00
Felipe Magno de Almeida bb1e5248c4 eolian-cxx: Fixed double qualifying operator on generated code
Fixed the generation of double qualifying operators on extension
inheritance for classes defined in the global namespace.
2014-07-18 18:57:14 -03:00
Savio Sena e807421f60 eolian-cxx: Fixed complex-types. 2014-07-18 18:57:13 -03:00
Savio Sena 04d90ae131 eolian-cxx: Relevant cosmetics. 2014-07-18 18:57:13 -03:00
Felipe Magno de Almeida 377bb449ba eolian-cxx: Added empty wrapper constructor
Added empty wrapper constructor to generation from std::nullptr_t and
allowed efl::eo::base to be empty with proper copy-constructors and
assignment operators.
2014-07-18 18:57:13 -03:00
Felipe Magno de Almeida 6109d17de1 eolian-cxx: Fixed inheritance extensions not proper qualifying the base class
The generator now globally qualifies the base names, so it works
outside the efl namespace
2014-07-18 18:57:13 -03:00
Savio Sena 67e187bebc eolian-cxx: Fixed the translation of the native type. 2014-07-18 18:57:13 -03:00
Savio Sena 027fa407bd eolian-cxx: Fixed a bug in class validator. 2014-07-18 18:57:13 -03:00
Savio Sena 78e396ac19 eolian-cxx: Initial version of complex types / callbacks / events implementation. 2014-07-18 18:57:13 -03:00
Felipe Magno de Almeida 5e5b00bc90 eolian-cxx: Disabled temporarily the inheritance feature
This feature is buggy when using multi-level namespaces. I disabled it
temporarily and will fix it ASAP and re-enable it.
2014-07-18 12:28:03 -03:00
Savio Sena ce63b16f40 eolian-cxx: Make proper handling of namespaces.
Summary:
The generation of class prefixes was not taking into account the full
classname -- the namespace was not being prepended to it. Fixed that and
also re-organized the code a bit, removed some Wshadow warnings also.

This commit fixes 'make examples' and 'make check'.

Reviewers: tasn, cedric, q66

CC: felipealmeida, smohanty, cedric

Differential Revision: https://phab.enlightenment.org/D1100
2014-07-01 10:55:45 +01:00
Daniel Kolesa c05493b480 eolian-cxx: Added namespaces and more (see below)
Implemented namespaces
Added eolian_wrappers.hh with C++ code wrapping Eolain API
Changed eolian_cxx program options. Now they're eolian_gen's
Added functions to safe_str.hh (safe_lower, safe_upper, normalize_spaces, path_base)
Added a mocked version of type_lookup.hh in advance. The full
version will come as soon as complex-types are added.

Made apply again by Daniel Kolesa, original implementation by Savio Sena.
2014-06-30 19:35:06 +01:00
Savio Sena a9babe8053 eolian-cxx: remove annoying compilation warnings and messages
Summary:
- remove an automake warning caused by a variable redefinition
- remove unnecessary verbosity during debug compilation

Reviewers: cedric, smohanty

CC: felipealmeida, cedric

Differential Revision: https://phab.enlightenment.org/D844

Signed-off-by: Cedric Bail <cedric.bail@free.fr>
2014-05-10 10:15:37 +02:00
Savio Sena e4f16cb2c5 eolian_cxx: pass eo_class by reference instead of by value.
Summary: This patch gets rid of a "defect" pointed out by Coverty Scan -- as per jackdanielz request.
CID 1211985.

Reviewers: cedric, smohanty, JackDanielZ

CC: felipealmeida, cedric

Differential Revision: https://phab.enlightenment.org/D840

Signed-off-by: Cedric Bail <cedric.bail@free.fr>
2014-05-09 13:02:43 +02:00
Savio Sena e61004e30f eolian_cxx: remove warnings from bin and lib.
Reviewers: cedric, smohanty, stefan_schmidt, stefan

CC: felipealmeida, cedric

Differential Revision: https://phab.enlightenment.org/D826

Signed-off-by: Cedric Bail <cedric.bail@free.fr>
2014-05-07 00:18:43 +02:00
Savio Sena 46b6e8a563 eolian_cxx: initial version of the EFL C++ Bindings Generator.
Summary:
This patch adds 'eolian_cxx' -- a C++ bindings generator --
to the EFL tree. Eolian Cxx uses Eolian API to read .eo files and generate
.eo.hh. It relies/depends on Eo Cxx and Eina Cxx (both non-generated
bindings).

src/bin/eolian_cxx: The eolian_cxx program.
src/lib/eolian_cxx: A header-only library that implements the C++ code
generation that binds the .eo classes.

=Examples=

src/examples/eolian_cxx/eolian_cxx_simple_01.cc: The simplest example,
it just uses some "dummy" generated C++ classes.

src/examples/eolian_cxx/eolian_cxx_inherit_01.cc: Illustrates how
pure C++ classes inherit from .eo generated classes.

src/examples/evas/evas_cxx_rectangle.cc: More realistic example using
the generated bindings Evas Cxx. Still a bit shallow because we don't
have full fledged .eo descriptions yet, but will be improved.

=Important=

The generated code is not supported and not a stable API/ABI. It is
here to gather people interest and get review before we set things in
stone for release 1.11.

@feature

Reviewers: cedric, smohanty, raster, stefan_schmidt

CC: felipealmeida, JackDanielZ, cedric, stefan

Differential Revision: https://phab.enlightenment.org/D805

Signed-off-by: Cedric Bail <cedric.bail@free.fr>
2014-05-03 00:56:32 +02:00