Add two parameters for macros that generate API functions in Eo so
that the generation can be customized with macros used by Eolian.
Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
While we had the functionality to generate type stubs header we never had
these tested in our unit test setup. Adding to simple cases for struct
and typedef which we already use for normal header generation tests.
I just ran my script (email to follow) to migrate all of the EFL
automatically. This commit is *only* the automatic conversion, so it can
be easily reverted and re-run.
Until now it wasn't allowed/possible to init (eo_init) eo after it has
been shut down (eo_shutdown). This commit fixes that, so now that is
fully legal to have as many init/shutdown cycles as you want.
There was a previous workaround for this issue:
e47edc250d.
This should allow more flexibility when using the EFL in loadable
modules and in various other scenarios.
The problem is that the class_get() functions cache the previously
created class for efficiency, but the class is freed if eo is shut down,
so the cached pointer is actually invalid.
The solution to the problem was to maintain a generation count
(incremented every time we shut down eo), and compare that to a locally
saved version in class_get(). If they don't match, recreate the class,
as it has already been freed.
@feature
Summary:
Add code to unit test to check if Eolian correctly recognize a struct
name as a struct type when it is used in a method.
Add new method to struct.eo to create this test.
Update struct_ref.c accordingly.
Reviewers: tasn, q66
Differential Revision: https://phab.enlightenment.org/D3213
As described by Carsten in his email to edev ML titled:
"[E-devel] eo stability - i think we need to postpone that"
with the switch to Eo2 we significantly increased our usage of RW memory
pages, and thus significantly increased our memory usage when running
multiple applications.
The problem was that during the migration to Eo2 the op id cache and the
op description arrays were merged, causing the op description arrays to
no longer be RO. This patch enables users of Eo (mainly Eolian) to
declare those arrays as const (RO) again, saving that memory.
There might be performance implications with this patch. I had to remove
the op desc array sorting, and I used a hash table for the lookup. I
think the op desc sorting doesn't really affect performance because that
array is seldom accessed and is usually pretty short. The hash table
is not a problem either, because it's behind the scenes, so it can be
changed to a more efficient data structure if the hash table is not good
enough. The hash table itself is also rarely accessed, so it's mostly
about memory.
Please keep an eye for any bugs, performance or excessive memory usage.
I believe this should be better on all fronts.
This commit *BREAKS ABI*.
@fix
This hasn't been used for a while. Since we are going to break Eo a bit anyway
it's a good opportunity to drop this.
This may cause a slight performance issues with legacy events, such as
smart callbacks. This shouldn't really be a problem as we've migrated away from
them. If it does, we need to migrate the remaining parts. Only relevant
for callbacks that are added before the classes are created, which
shouldn't be possible except for smart, only for old evas callbacks.
Sorry for last minute new API, but this one is necessary to implement
proper verification of references in docs, which I would like to have
in 1.15. It allows you to retrieve any kind of declaration by full
namespace, so that you can check for an existence of an Eolian decl,
rather than checking every type individually.
@feature
This is kind of ugly, but I didn't see a better way to do it without turning
this into a much more complicated parser. So this will have to do unless we
find something else to add, in which case a new doc parser will be required.
@feature
This commit adds the necessary generator logic to emit doc
comments from the new doc syntax. Old doc comments are kept
in for the time being as they're used within the EFL but they
will be removed eventually. This new generator focuses all the
important code in one place, making usage easy.
@feature
This adds new APIs that deal with the new documentation syntax
provided by Eolian. The old doc comment APIs are considered
deprecated from now on and will be removed.
@feature
Sometimes it is necessary to specify a different set of values for a
getter or a setter. This commit allows such specializations. This also
renders @const_get and @const_set useless (soon to be removed).
To function correctly, this required adjustment of several public APIs
as well as deprecation of eolian_function_parameter_get_by_name.
This function was not used in any generator and was pretty much
useless in the first place, so it was removed.
@fix
Instead of "@in type name;" we now use "@in name: type;". This change
is done because of consistency with the rest of Eolian; pretty much
every other part of Eolian syntax uses the latter form.
This is a big breaking change in the .eo format, so please update your
.eo files accordingly and compile Elementary together with the EFL.
@feature
Typedef word was not generated for enums. Camel case was not respected
for type definition.
Tests have been updated to check enums generation.
@fix T2400
This is needed in Erigo to determine if a virtual pure function can be
invoked via eo_do, as we don't want error messages to be displayed in
case of a non implementation in the Eo object.
This function works with non virtual functions too.
Tests have been provided.
@feature
In previous version of this commit we checked if the _WIN32 macro was
defined. But now I am using EXEEXT from autotools to get
eolian_gen extension.
@fix
From now on, there are 5 builtin complex types, particularly accessor, array,
iterator, hash and list. All other types are simple - they can't have a complex
part. Also, the <> now binds to the type itself, not the pointer. More builtin
complex types will be added as needed.
Local and base class functions are supported.
When @empty is provided, dummy functions (initializing the parameters with default
values if needed) are generated.
When @auto is provided on properties, access to internal data variables is done. On
set, it will assign parameters values to private data members. On get,
parameters are set with private data members values.
See the supplied tests as examples.
@feature
Now they're registered correctly. Also, add new API, eolian_implement_is_virtual.
Also, deal with get/set properly (when filling in additional implements)
This is needed when get properties or methods have to return a
value in case of failure or to initialize parameters.
The way used is to generate an intermediate function that will
initialize the parameters and then invoke the "user" function.
Because of Eina_Value being less than optimal in our usage, we're dropping it in Eolian.
This simplifies the code and makes it easier to bind to other languages, which
will aid new generators. Also, we're dropping long double support from eo files
and expressions as it causes an ABI breakage in gcc 4.4.
This change adds a new API to retrieve the legacy prefix for enum members
and also adds support for generating enums into the C generator. Besides that,
it prevents generation of entire struct contents when the .eo file declares
a named struct inside of a typedef - as the struct itself gets generated later on.
Also added API to retrieve value of a variable (forgot about that one)
and made it impossible to create extern constants (doesn't make sense)
as well as made it impossible to give extern globals values.
This way we can only lex expr related tokens (operators etc.) when actually
about to parse an expression. That allows stuff like nested complex types
without the lexer treating the endings as right shift.
so the test suites were useless because they didn't ecompile what was
generated. it was missing a ) at the end of calling eo_do_super to
start with. it was missing a call to do_uper fo destructors too. also
it didnt deal with the #include "blah.eo.c" at the file end either so
it produced uncompilable src at the start. again - also fix. this also
fixes test case comparisons to match the now correct generation that
compiles.
The function eolian_implement_information_get was returning strings for
the class and the function. It was written in this way at the beginning
because it was not needed to verify the correctness of the class and
the function.
Now that we have the namespace feature, this function must check it,
meaning that the class and the function are now known.
So we can return them instead of returning the strings.
The generators had to find the class from the classname. It is no more
needed.
The C++ generator has been adapted to this new API.
Until now, the functions giving access to class information were taking
the class name as parameter.
Except the fact that we needed to search into a hash table for the internal
class structure, no flexibility is possible.
This change consists in modifying most of the APIs using the class name
with a new Eolian_Class type and adapt the code of the C and C++
generators accordingly.
By using -gi option, the generator appends the functions that are
present into the given eo file and missing into the developer file
(given via -o option as an in/out file).
@feature
It includes parser updates, database fill and tests on basic and complex
types.
One can define types in this way:
type Evas_Coord: int; /* Simple type definition */
type List_Objects: Eina_List * <Eo *>;
@feature
Before this change, all the .eo files of the directories given with -I
option were parsed. Most of this information was not necessary at all,
since only the classes belonging to the inheritance of the class given
as parameter were needed.
Now, during the parsing of the given class, the inherits classes are
searched and parsed.
A condition is needed to make it work well. To find a filename for a
class, we consider the lowercase of the class name as the filename we
have to parse.
e.g, Elm_Button -> elm_button -> elm_button.eo
It considerably reduces the generation time.
A fix in the tests was needed.
It includes too fixes for the complex type. If I had listened to Tasn,
I would have detected them a long time ago.
But he didn't insist enough. He just said:
"Write your tests, ?#@*&%! french!"