Commit Graph

189 Commits

Author SHA1 Message Date
Daniel Zaoui 0efeeaf1c0 Eolian: modify APIs to return iterators instead of lists.
The change affects the C and the C++ generators.
2014-07-23 13:45:25 +01:00
Daniel Kolesa 89ca97aceb eolian: new API: eolian_type_structs/aliases_get_by_file 2014-07-22 13:14:44 +01:00
Daniel Kolesa ccf157aa57 eolian: prevent freeing of full named structures that are inside of typedefs and fix a memory leak 2014-07-22 10:39:54 +01:00
Daniel Kolesa 058a3c314c eolian: rename _types to _aliases 2014-07-21 16:58:12 +01:00
Daniel Kolesa e797e40478 eolian: remove Eolian_Typedef, use Eolian_Type instead; allow eolian_type_base_type_get on aliases 2014-07-21 16:53:25 +01:00
Daniel Kolesa 7b9438e76e eolian: refactoring: remove Eo_Type_Def 2014-07-10 15:10:24 +01:00
Daniel Kolesa 441455259e eolian: refactoring: more consistent naming 2014-07-10 14:19:06 +01:00
Daniel Kolesa 37bc20298c eolian: refactoring: split up eolian_database into individual files 2014-07-10 12:15:29 +01:00
Daniel Kolesa a26546bc6b eolian: the entire API is now const correct 2014-07-09 21:31:03 +01:00
Daniel Kolesa 133607936d eolian: const correctness 2014-07-09 21:07:15 +01:00
Daniel Kolesa 580aea04cd eolian: refactoring step six
Move Eolian_Function as well, plus fix const correctness of several API funcs.
2014-07-09 20:59:31 +01:00
Daniel Kolesa accdd50f50 eolian: refactoring step five
Move from all instances of Eolian_Type to Eolian_Type*.
2014-07-09 17:18:02 +01:00
Daniel Kolesa 1a4f87d365 eolian: refactoring step four
Move from all isntances of Eolian_Function_Parameter to Eolian_Function_Parameter* plus const fixes.
2014-07-09 17:01:19 +01:00
Daniel Kolesa c9119b0c88 eolian: refactoring step three
Move from all instances of Eolian_Event and Eolian_Implement to Eolian_Event* and Eolian_Implement*.
2014-07-09 16:45:58 +01:00
Daniel Kolesa 96eaaaf074 eolian: refactoring step two
Move from all instances of Eolian_Class to Eolian_Class*.
2014-07-09 16:33:19 +01:00
Daniel Kolesa ca82befa8a eolian: refactoring step one
Rename the public Eolian types to use a consistent naing scheme.
2014-07-09 16:33:19 +01:00
Daniel Kolesa 8f14930d68 eolian: function dump now uses the actual syntax 2014-07-09 13:49:21 +01:00
Daniel Kolesa 60bf9fcaef eolian: reduce code duplication 2014-07-09 13:26:20 +01:00
Daniel Kolesa 7b4f4af873 eolian: support for structs in eolian_show 2014-07-09 13:06:46 +01:00
Daniel Kolesa 881a8754ab eolian: new API: eolian_type_struct_description_get 2014-07-09 12:48:16 +01:00
Daniel Kolesa 295f1f4847 eolian: new API: eolian_type_struct_field_description_get 2014-07-09 12:05:56 +01:00
Daniel Kolesa cc387bd621 eolian: add EOLIAN_TYPE_REGULAR_STRUCT rather than including the struct keyword in name field 2014-07-09 10:49:52 +01:00
Daniel Kolesa 892c5cba5f eolian: fix coverity defects 2014-07-09 10:19:42 +01:00
Daniel Kolesa f6c7242609 eolian: fix base_type_get (only allow for pointers) 2014-07-08 16:56:13 +01:00
Daniel Kolesa 16da25bca2 eolian: support for structs in c_type_get 2014-07-08 16:54:22 +01:00
Daniel Kolesa 6bd0e0ab7f eolian: better struct support including an API for by-name lookup 2014-07-08 16:42:33 +01:00
Daniel Kolesa b2db8d3ffa eolian: new API for struct types
This commit adds new Eolian API and proper parsing support for struct types.
Structs can be named (allowed in global context, like typedefs, and in typedefs)
and unnamed (allowed as fields of other structs). This extends the existing type
API to support structs. This is incomplete for now - I still gotta add a way to
query global structs besides other things.

@feature
2014-07-08 16:17:44 +01:00
Daniel Kolesa 826f85675c eolian: @own -> own 2014-07-08 13:34:25 +01:00
Daniel Kolesa 5168297fdb eolian: new API: eolian_system_directory_scan, use it 2014-07-07 16:48:54 +01:00
Daniel Kolesa 8e8dbc322e eolian: scan directories recursively 2014-07-07 14:25:57 +01:00
Daniel Kolesa 84451db638 eolian: have eolian_all_classes_list_get instead of eolian_class_names_list_get 2014-07-03 22:12:31 +01:00
Daniel Kolesa f12b36e1c1 eolian: some dirty janitoring 2014-07-01 18:25:17 +01:00
Daniel Kolesa 8c44810525 eolian: keep the struct keyword in the regular type name 2014-07-01 18:03:20 +01:00
Daniel Kolesa 39aad55991 eolian: support for void as separate type type 2014-06-30 23:07:32 +01:00
Daniel Kolesa e84275cc37 eolian: make tests pass 2014-06-30 17:20:39 +01:00
Daniel Kolesa 7b54a0101c eolian: new type API
This new API supports function pointer types, multiple type subtypes, const attribute without parsing
the name string, own attribute for any partial type and more. This commit also updates the C and C++
generators so that they compile and generate correct code.

@feature
2014-06-30 17:20:39 +01:00
Daniel Kolesa 74d0cbf29b eolian: allow multiple subtypes by reorganizing the type structure - preparation for new API 2014-06-30 17:20:39 +01:00
Daniel Kolesa c0576cee73 eolian: new API: eolian_function_full_c_name_get - reduces duplication of code 2014-06-30 17:20:06 +01:00
Daniel Kolesa 1674d967d2 eolian: free the iterator 2014-06-30 17:20:06 +01:00
Daniel Kolesa 7a8ef6d02a eolian: introducing support for .eot files
.eot files are similar to .eo, but they can't contain classes; all .eot files found in include paths
are parsed and information is added into the database. They're there for typedefs and eventually also
enums, structs and constants.

@feature
2014-06-30 17:20:06 +01:00
Daniel Kolesa e9f4890747 eolian: fix end-of-file checking, move namespaces from :: to . 2014-06-20 10:46:04 +01:00
Daniel Kolesa 9b833f1dbd eolian: introducing a new lexer/parser
This handwritten lexer/parser is more strict and cleaner than the previous Ragel based one,
as well as faster and doesn't leak memory (or shouldn't). It's a recursive descent style
parser with separate lexer part (unlike the previous effort) which is run at the same
stage as the parser (so it doesn't pre-lex).

@feature
2014-06-19 16:04:08 +01:00
Tom Hacohen 8a4849b1eb Eolian: Improve support (still incomplete) for namespaces. 2014-06-19 15:57:27 +01:00
Daniel Zaoui f3ce7031e2 Eolian: Fix class look up.
If a class (e.g Evas_Object) is expected as a base class but is not
present in the existing expected file (e.g evas_object.eo), it will not
fail.
This patch fixes it by checking the existence of the class into the
database after the parsing of the file.

@fix
2014-06-02 17:13:34 +03:00
Daniel Zaoui dc3178404f Eolian: modify 'implement' API parameters.
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.
2014-05-29 14:48:05 +03:00
Daniel Zaoui 70f530e2d6 Eolian: fix issue for Windows.
On Windows, '\' are used to separate the names of a path. It was not
supported.
This patch fixes that. Thanks to Vincent Torri for catching it (and good
luck in Windows ;-))
2014-05-28 09:36:30 +03:00
Daniel Zaoui b10a1b11f1 Eolian: fix coverity issues.
CID 1216274
CID 1216275
CID 1216276
CID 1216277
CID 1216278
CID 1216279
CID 1216280
2014-05-27 08:22:40 +03:00
Daniel Zaoui 8e4700ce65 Eolian: add support of namespaces.
It is now possible to define a class in a .eo file as e.g:
Elm::Widgets::Button.
Elm and Widgets will be the namespaces of the class Button.

@feature
2014-05-26 13:56:06 +03:00
Daniel Zaoui eb58e70ce9 Eolian: remove unused structures.
These structs were belonging to a feature that has been removed cause
not considered as needed.
2014-05-26 13:56:06 +03:00
Daniel Zaoui 62082548bc Eolian: modify API to allow future scalability
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.
2014-05-26 13:56:06 +03:00
Daniel Zaoui e4444d2518 Eolian: add support for typedefs.
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
2014-05-26 13:56:05 +03:00
Daniel Zaoui e1abaf7c37 Eolian: fix class lookup during parsing.
If classes A and B are stored in a same file, when A inherits from B,
and A needs to be generated, the generator, even if B is parsed, will
not search the class in the database but will look for some b.eo.

This patch fixes that issue by checking the existence of the classes
into the database before looking for a corresponding file.
2014-05-21 15:55:28 +03:00
Jérémy Zurcher f8c2c57406 do not use EINA_FALSE instead of NULL 2014-05-07 17:45:11 +02:00
Daniel Zaoui 56fd4ef704 Eolian: fix type resolving for implement functions.
The type of the virtual functions implemented in a class was let unresolved
and led to inconsistency when working with them.
In fact, the type can be resolved easily after all the classes that the
specific class inherits from are parsed and stored in the database.

Fix T1228
2014-05-07 09:13:11 +03:00
Daniel Zaoui 05963f4052 Eolian: Fix support of virtual constructors. 2014-05-04 09:36:02 +03:00
Daniel Zaoui 0fdd06c73b Eolian: fix prints 2014-04-30 14:07:09 +03:00
Daniel Zaoui 183ecab18b Eolian: add API to retrieve the file name of a class 2014-04-28 08:46:19 +03:00
Daniel Zaoui fea029a0a3 Eolian: add API to parse all the .eo files. 2014-04-27 16:25:23 +03:00
Daniel Zaoui 1c19d274d8 Eolian: Valgrind fixes. 2014-04-27 10:57:50 +03:00
Daniel Zaoui 7f90088232 Eolian/Generator: only requests .eo files parsing when needed.
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.
2014-04-27 10:03:39 +03:00
Daniel Zaoui 64e947512a Eolian: Remove support of legacy into implement section.
It has been decided that this support is not needed.
2014-04-24 16:51:04 +03:00
Daniel Zaoui cc84a36734 Eolian: Removal of the support for custom destructors.
For no reason, I added it a long time ago.
2014-04-24 16:30:40 +03:00
Daniel Zaoui f36fac8ec6 Eolian: Remove useless functions.
Default ctor/dtor are considered as implemented functions and no more as
special functions.
2014-04-23 16:28:33 +03:00
Daniel Zaoui a046f34590 Eolian/Lexer: Fix coverity issues.
Fix CID 1203411
Fix CID 1203412
2014-04-18 09:21:35 +03:00
Daniel Zaoui 7aab226a81 Eolian/Lexer: support of complex types
Complex types are now supported in .eo files:
Eina_List * @own <Eo *>

The parser is in charge of creating a list of formatted basic types.
2014-04-17 15:15:17 +03:00
Daniel Zaoui 87776ff0fa Eolian: add support for functions scope.
This patch adds support for protected functions.

In the .eo file, the scope (public by default) has to be added before
the function name e.g:
protected foo ...

To access the protected APIs, #define (CLASS)_PROTECTED is needed e.g:
 #define ELM_BUTTON_PROTECTED
2014-04-10 05:55:16 +03:00
Daniel Zaoui 1d89978c5b Eolian: clean API.
defines used as keys for internal hash tables are now replaced by
functions giving access to the internal data.
2014-04-08 04:27:01 +03:00
Daniel Zaoui 912409df3c Eolian: rename enums.
Add the EOLIAN namespace to the function types.
2014-04-08 04:27:01 +03:00
Daniel Zaoui 0eb092d157 Eolian/Lexer: support data type for events. 2014-04-02 14:27:12 +03:00
Daniel Zaoui fd25b44cab Eolian: extend const attributes for parameters to 'set' properties.
When const is used for parameters into 'set' properties, the generator
doesn't prepend 'const'.
This fixes this bad behavior.
2014-03-27 15:19:22 +02:00
Daniel Zaoui eb65cac12d Eolian/Generator: enable forcing return type as void.
For get properties, if only one parameter is given, the generator sets this one as return type.

There are cases where this parameter must stay a parameter (legacy API).

For example, elm_thumb_compress_get must be like:
void elm_thumb_compress_get(const Eo *obj, int *compress).
Eolian was generating the function as:
int elm_thumb_compress_get(const Eo *obj);

By setting "return void;" in the .eo file, you force the function to
return void.
2014-03-27 13:15:02 +02:00
Daniel Zaoui c863154a79 Eolian: fix virtual pure support.
When a property needs be defined as virtual pure, its type could not be
given.
It means that, even it was explicit that e.g only the get property if
virtual pure, both (set and get) were considered as virtual pure.

@fix
2014-03-27 08:52:53 +02:00
Daniel Zaoui c203df0b5d Eolian: Support default return values from .eo file.
Now, it is possible to assign a default return value for a
method/property.
It will be used in case the function invocation makes issues, e.g eo_do
failing to find the function...
2014-03-16 08:37:23 +02:00
Daniel Zaoui 66e1cc29bc Eolian/Lexer: support of @own tag on parameter and return values.
This tag indicates that the ownership of the parameter/return
value changes.
It is needed by generators (C++/LUA...) to determine if it has to be
freed or not, if it can be used as is or need to be copied...
2014-03-14 13:21:51 +02:00
Daniel Zaoui 4e33fd16e2 Eolian: add support of eo_prefix and data.
You can add in the .eo file the eo_prefix:... and data:... in case
you want to override respectively the Eo prefix and the data type.
If "data: null" is used, no data type will be added.
2014-03-10 15:07:05 +02:00
Daniel Zaoui a78f779486 Eolian: Fixes into generated files.
- Added Doxygen description to parameters and return
- Added default description for parameters
- Return type needs to be after all the other parameters
- Better handling of stars for pointers: try to figure if a space is
needed between the type and the variable (e.g int *a / int a)
2014-03-07 17:42:41 +02:00
Daniel Zaoui bb8af681f9 Eolian: Coverity fixes 2014-03-07 17:42:41 +02:00
Daniel Zaoui 2e0b5742e3 Eolian: Fix build for Windows
The definition of EAPI was missing in Eolian.h.

Spank on you, Tom! I expect you to be perfect and to tell me those
things before I push all the stuff ;-)
2014-03-04 11:40:46 +02:00
Daniel Zaoui 87f661e08e Eolian: support non null parameters.
The generation is only needed in legacy headers.
2014-03-03 14:09:57 +02:00
Daniel Zaoui 10d7bffc4a Eolian: support warn_unused variables. 2014-03-03 14:09:56 +02:00
Daniel Zaoui 2db3cdb5e3 Eolian: Valgrind cleaning 2014-03-03 14:09:56 +02:00
Daniel Zaoui 748a01c47f Eolian/Library: add log domain and NULL checks 2014-03-03 14:09:56 +02:00
Daniel Zaoui 920c035c57 Eolian: Support of virtual pure functions.
Virtual pure can be defined in Eolian format by adding in the section
implements virtual::class_name::func_name[::func_type].
2014-03-03 14:09:55 +02:00
Daniel Zaoui 4d7e908e49 Eolian/Lexer: support class::constructor/destructor 2014-03-03 14:09:55 +02:00
Daniel Zaoui 5ae7cc962f Eolian: Format changes
- Support keys/values for properties instead of params
- Direction for parameters syntax changed from in to @in...
- obj:const changed to const in .eo
2014-03-03 14:09:55 +02:00
Daniel Zaoui 9add4c695c Eolian: remove --class option.
Now, the .eo file needs to be supplied instead of the class.
2014-03-03 14:09:54 +02:00
Yossi Kantor 17abdbdd43 Eolian: Code review fixes
1) API defined under EFL_BETA_API_SUPPORT
2) Init counters for init and shutdown
3) void for no-parameters functions
2014-03-03 14:09:54 +02:00
Tom Hacohen 036e3eeaa3 Eolian: Add EAPI to API calls. 2014-03-03 14:09:53 +02:00
Daniel Zaoui 5dea8ee0a8 Eolian: first import.
Imported by Tom, from the eolian repo which was written by:
Daniel Zaoui <daniel.zaoui@samsung.com>
Yakov Goldberg <yakov.g@samsung.com>
Yossi Kantor <yossi.kantor@samsung.com>
Savio Sena <savio@expertisesolutions.com.br>
Jérémy Zurcher <jeremy@asynk.ch>

Signed-off-by: Tom Hacohen <tom@stosb.com>
2014-03-03 14:09:53 +02:00