Commit Graph

416 Commits

Author SHA1 Message Date
Daniel Kolesa d47610a732 eolian: do not require unit when stringifying types
As it is no longer necessary to pass unit when evaluating exprs,
it is not necessary to pass it here either. Convert all the APIs
to the new style and update all instances in our tree.
2018-01-16 16:39:05 +01:00
Daniel Kolesa dd2e579fec eolian: do not require unit for expr eval APIs
The necessary information is now stored directly in the expr
during database validation.

Also enable expr validation for params.
2018-01-16 16:37:52 +01:00
Daniel Kolesa c6436337a4 eolian: aliased_base_get funcs don't need unit 2018-01-12 18:05:13 +01:00
Daniel Kolesa 19c16b671e eolian: type_typedecl_get doesn't need a unit 2018-01-12 18:05:13 +01:00
Daniel Kolesa 18e18ca74c eolian: remove remaining global state (+ modify APIs accordingly) 2017-12-15 17:11:11 +01:00
Daniel Kolesa c8aa30e698 eolian: make declaration APIs use units 2017-12-15 17:11:11 +01:00
Daniel Kolesa 8a1f93f698 eolian: pass state where necessary
This modifies the API so that global state removal is made
possible. It's still used internally for now but externally
the state is contained.
2017-12-05 16:41:42 +01:00
Felipe Magno de Almeida 66eb8ddfeb eolian: Add inarray and inlist to source generation 2017-12-04 20:34:47 -02:00
Daniel Kolesa 2f81b26367 eolian: scan system dir by default
The '-S' option lets you reverse that. But by default, most
people will want the prefix to be scanned for eo files.
2017-11-14 13:47:09 +01:00
Daniel Kolesa 753359230a eolian: more intuitive generation options and mrge impls into .c
Previously the output base name used to include extension, now
you don't need to specify an extension and it's determined from
the input file name instead.

Also, implementation boilerplate used to merge with .eo.c before,
which made no sense. Now it's merged with .c instead when it
exists or makes a new .c file when it doesn't.
2017-11-10 14:48:59 +01:00
Daniel Kolesa 4f8a9b50f4 eolian: make inherits_get return a list of classes, not strings
Most of the time you need to retrieve the class from the string
anyway, so remove this relic of old Eolian and gain some small
performance benefits and extra convenience.

Subtly breaks API but everything should be updated.
2017-10-25 16:25:41 +02:00
Daniel Kolesa b88132932a eolian: fix setter generation for @auto functions
Because of a typo in generator source (and overlooked error in
tests) we were previously generating incorrect code for setters
with the @auto qualifier. This was brought up in D5306 and is
now fixed.
2017-10-13 23:49:57 +02:00
Daniel Kolesa 5699466dba eolian gen: generate documentation for first object param if present
This prevents doxygen from emitting warnings.

Fixes T6186.
2017-10-13 15:18:18 +02:00
Chris Michael 81d76776be eolian-bin: Free previously allocated eina_strbuf
Coverity reports that the eina_strbuf 'param_call' leaks when it goes
out of scope here, so fix the leak by freeing the strbuf

Fixes CID1381502

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-10-05 09:46:18 -04:00
Daniel Kolesa f73d794132 eolian gen: simplify generate_normal_free a bit 2017-09-29 13:00:07 +02:00
Marcel Hollerbach fc071d5aa9 eolian: generate free function for owned parameters
With this commit owned parameters are freed if the object function
cannot be called, this means bla(NULL,param) will not leak anymore
2017-09-29 11:28:15 +02:00
Daniel Kolesa 1577c576e6 eolian: remove static_array and terminated_array
These types are of questionable value and the API was not entirely
thought out - remove for now, and if a legitimate use is found
later, they may be readded (with a better API), but typically it
seems best to redesign the bad APIs around safe containers...
2017-09-22 18:01:15 +02:00
Jean-Philippe Andre f3eff6eb3e efl: Introduce Eina.Rect and switch EO APIs to it
It's a complex struct but defined in EO as a simple struct. ABI-wise
it's equivalent to Eina_Rectangle. Some macros that use Eina_Rectangle
also work on Eina_Rect out of the box, most of the code dealing with
x,y,w,h will require no modifications either.

But Eina_Rect provides direct access to a size or position 2d component,
as well as the usual x,y,w,h. The field "rect" is provided as a
convenience for code dealing with both Eina_Rectangle and Eina_Rect. We
may or may not require it.

Note: Size2D could use unsigned values but I have spotted a few places
in the code that actually use -1 to indicate invalid size (as opposed to
0x0).

@feature
2017-09-18 13:22:52 +09:00
Daniel Kolesa e55ab81835 eolian: always implicitly validate database and remove its API 2017-09-13 23:58:47 +02:00
Daniel Kolesa 2071bbe8fb eolian: clean up and fix function pointer generation
Out/inout params are now correctly handled.
2017-08-30 15:45:20 +02:00
Daniel Kolesa 93c93328ac eolian gen: clean up param gen 2017-08-30 15:34:49 +02:00
Daniel Kolesa e288f5160b eolian: change C type serialization API to account for returns
This will allow proper handling of const.
2017-08-10 12:12:38 +02:00
Daniel Kolesa d5bca5b0cb eolian: always generate a class initializer
Because there might be hidden C implements defined, we need to
always generate the appropriate class initializer. This does not
hurt anything as the contents would have been called automatically
by Eo anyway.

@fix T5736
2017-07-17 11:04:29 +02:00
Lauro Moura 1634c14169 eolian: function pointers
First steps toward explicit function pointer support in eolian.

To declare a function pointer type, use the following syntax, similar to
a regular eolian method declaration.

function FunctionName {
  params {
    ...
  }
  return: Return type
}
2017-06-18 12:09:22 -03:00
Daniel Kolesa d2280f91a1 eolian: use unit in typedecl c_type_get 2017-05-30 17:15:54 +02:00
Daniel Kolesa c234b5ee69 eolian: expr eval APIs now take units 2017-05-30 17:15:54 +02:00
Daniel Kolesa 67bc32d9ac eolian: pass unit to enum get by name 2017-05-30 17:15:54 +02:00
Daniel Kolesa 9c2dae3531 eolian: pass unit to struct get by name 2017-05-30 17:15:54 +02:00
Daniel Kolesa 45a73a0878 eolian: pass unit to class get_by_name/file 2017-05-30 17:15:53 +02:00
Daniel Kolesa 6d453bc694 eolian gen: pass the unit around 2017-05-30 17:15:53 +02:00
Jean Guyomarc'h b67c13810b eolian: help and version shall not cause an error exit status
eolian_gen called with --help or --version is a valid action. It shall
terminates with the 0 exit status.
2017-05-06 21:15:40 +02:00
Daniel Kolesa 53fef30db0 eolian: allow extending eolian-generated classes from within C
If you define either the macro MY_CLASS_EXTRA_OPS for normal
methods/properties or MY_CLASS_EXTRA_CLASS_OPS for class methods
or properties, which contains a comma-delimited list of ops defs
(i.e. EFL_OBJECT_OP_FUNC(...), ...) right before including the
generated my_class.eo.c file, the definitions from these will
be included in the actual class. This can be used to override
certain things in a class internally without exposing it to
Eolian, or for testing/debugging.
2017-04-13 15:56:15 +02:00
Daniel Kolesa 7b20950aaf eolian: fix incorrect function prototypes in legacy headers
C functions that take no arguments need to have void in the arg
list. Otherwise, it would mean taking any number of arguments.
2017-03-31 17:49:41 +02:00
Daniel Kolesa f84e7ddc70 eolian gen: imply -gT if -o T:f is specified
If you specify type-explicit output filename, this automatically
adds it so that it's generated even without specifying -gT.

This is meant to help user friendliness. Also add a note about
this to help listing.
2017-01-27 17:13:04 +01:00
Marcel Hollerbach ea83a197be build: add eolian 2017-01-23 18:52:34 +01:00
Daniel Kolesa 6e8b628864 eolian: rmeove dependency on basename/libgen.h/evil 2017-01-21 18:06:00 +01:00
Daniel Kolesa 95181f2d36 eolian: move base function doc API into implements
This allows us to unify retrieval of docs for both regular and
overridden funcs without having two separate APIs. It's currently
missing validation and docgen is still not adjusted properly for
it either, but at least there's this. Enables retrieval of docs
for overridden funcs by default as well.
2017-01-19 15:09:07 +01:00
Daniel Kolesa 35c5e89269 eolian: remove/add APIs and clean up implements system
As there is no need to have separate is_auto, is_empty and
is_pure_virtual for functions and implements (each function has
its own base implement by default) I removed the function ones.
Instead, I added a way to retrieve a function's base implement
so that you can instead do the checks on the implement even when
you only have the function.

I also moved base implement build directly into the parser instead
of the database filler. That allows for significant cleanup. I
also removed distinction of implement pointers in Eolian_Function
for get and set as implements now always contain an entire thing
so the pointer was always the same anyway.

Things should still behave more or less the same, but ordering
of generated functions has changed because ordering of implements
has changed.
2017-01-16 15:55:06 +01:00
Daniel Kolesa 692ae7adb6 eolian: use consistent pure_virtual naming in API
Previously one API used just virtual (incorrect) and one used
virtual_pure (which just sounds weird). So unify with a single
name, pure_virtual, similar as in other lanugages.

This does not change eo file syntax yet.
2017-01-13 15:40:29 +01:00
Daniel Kolesa a70645e154 eolian: consistent and cleaner error values from APIs
Now all error/unknown/etc values returned from APIs are zero,
previously it was a mix of zeroes and minus ones. Also, some
enums that had no error/invalid value before have one now, which
allows for better distinction between what is an error and what
is an intended result.
2017-01-13 15:26:05 +01:00
Daniel Kolesa deb1e58e06 eolian gen: do not use EOLIAN_UNRESOLVED/PROPERTY for lookups 2017-01-12 15:13:30 +01:00
Daniel Kolesa baaa482ebf eolian: fine-grained is_auto/is_empty for implements 2017-01-11 19:26:21 +01:00
Daniel Kolesa 72b8dbc30d eolian gen: properly deal with __eolian wrappers and mixed prop impls 2016-12-27 17:16:17 +01:00
Daniel Kolesa 431d36e9a0 eolian gen: fix enum member reference generation 2016-12-21 15:12:58 +01:00
Daniel Kolesa db9e6354c3 eolian gen: specialize default values by type
Now we can generate NULL for stuff that is pointers and empty
struct literals for struct instead of just 0 for everything. The
previous behavior was incorrect for those cases and generated
broken code.
2016-12-14 18:23:16 +01:00
Daniel Kolesa 698631578f eolian gen: remove dead code
Cedric forgot to remove all of the promise code.

Fixes CID1365652.
2016-12-08 14:06:09 +01:00
Daniel Kolesa 6e8f97a22f eolian gen: fix leak in type generator
Fixes CID1365322.
2016-12-08 14:00:02 +01:00
Daniel Kolesa 8d4de0d787 eolian: use the generic class name instead of C name in source
This changes the string in Efl_Class_Description to use the real
class name (with namespaces) instead of the C class name. The
reason for this is that this string is generic, not C-related.
2016-12-07 13:31:54 +00:00
Jaehyun Cho c32c5dd222 eolian: Fix to unregister eina log domain if it was registered. 2016-12-06 19:05:00 +09:00
Cedric BAIL 997249e6c2 eolian: remove generation of Eina_Promise. 2016-11-07 13:43:11 -08:00
Daniel Kolesa 82ef73ca18 eolian: remove type silencing stuff entirely
this was useful during transition, but not anymore
2016-10-25 18:02:23 +02:00
Daniel Kolesa 306aba7848 eolian gen: add -s for silencing type errors in validation 2016-10-25 16:01:54 +02:00
Daniel Kolesa 3758d5b9fa eolian gen: always validate database 2016-10-25 15:59:41 +02:00
Daniel Kolesa db7b6dd7e0 eolian gen: use EWAPI for events instead of EOAPI
Apparently only methods/properties can be EOAPI.
2016-10-20 16:48:41 +02:00
Daniel Kolesa 5db3f14f85 eolian gen: use EWAPI for all generated variables 2016-10-20 16:44:20 +02:00
Daniel Kolesa 930af741b9 eolian gen: automatically uppercase names for vars/constants 2016-10-20 16:01:11 +02:00
Daniel Kolesa 0ee248fb86 eolian gen: generate vars in source files for globals with value 2016-10-20 15:11:43 +02:00
Daniel Kolesa 9e12fd39af eolian gen: initial generation of variables in headers 2016-10-20 14:39:50 +02:00
Jee-Yong Um c0a41034cd eolian: fix build warning
Differential Revision: https://phab.enlightenment.org/D4356
2016-10-19 23:50:49 +02:00
Daniel Kolesa 2515556673 eolian gen: better checks for whether to add space after type 2016-10-14 15:31:49 +02:00
Daniel Kolesa 57fb92e952 eolian gen: use the new data type API to simplify the code 2016-10-13 15:04:20 +02:00
Daniel Kolesa a862e07520 eolian gen: use the C get function name getter instead of manual concat 2016-10-12 15:11:16 +02:00
Daniel Kolesa d3d63ea8d3 eolian gen: utilize the new class C name getter instead of manual concat 2016-10-12 15:05:46 +02:00
Daniel Kolesa 9553fd9640 eolian gen2: move to eolian gen (as the old one is gone) 2016-10-07 13:34:47 +02:00
Daniel Kolesa 4cc17ae28a eolian gen2: remove old eolian gen 2016-10-07 13:26:08 +02:00
Daniel Kolesa dd9155cf24 eolian: properly add < in struct/enum field docs
Fixes T4443.
2016-09-09 13:04:04 +02:00
Daniel Kolesa 12dbab33f9 eolian: separate ops struct for normal and class funcs (to match new API) 2016-09-09 11:14:35 +01:00
Tom Hacohen bd3801247e Eo: Make function overrides implicit.
Before this commit, function overrides were explicit. That is, you'd
have to explicitly state you were overriding a function instead of
creating a new one. This made the code a tad more complex, and was also
a bit more annoying to use. This commit removes this extra piece of
information.

This means we now store much less information per function, that will
let us further optimise out structures in the future.
2016-09-08 13:59:04 +01:00
Tom Hacohen c8c0bbcfcf Efl object: rename EFL_OBJECT_OVERRIDE_OPS_DEFINE.
It is now called EFL_OPS_DEFINE as it's used for general purpose ops
definition.
2016-09-05 16:03:16 +01:00
Daniel Kolesa f92a67e191 eolian: update generation of op funcs 2016-09-05 16:03:16 +01:00
Daniel Kolesa b24342e783 eolian gen: don't generate events in eo.c 2016-08-23 14:47:28 +01:00
Daniel Kolesa df74455ec9 eolian gen: include return type in event docs
Fixes T4393.
2016-08-23 12:06:28 +01:00
Tom Hacohen b623d89b01 Efl Object: Make event description arrays const.
This was an oversight. They should have been const arrays, and not just arrays
of pointers to const items.
2016-08-17 12:03:49 +01:00
Tom Hacohen e65aae994e Eo: Finish the renaming of Eo to the EFL.
This renames all the rest of the API to the EFL namespace except for
Eo_Event that will follow soon.

Obviously breaks both API and ABI.
2016-08-15 15:07:42 +01:00
Daniel Kolesa 9dcddd220a eolian gen: do not generate legacy for beta APIs 2016-08-13 01:15:21 +01:00
Tom Hacohen c662934be8 Change the EFL to follow the new Eo rename. 2016-08-11 17:04:43 +01:00
Daniel Kolesa 6a05289063 eolian: simplify enum generation logic 2016-07-07 15:59:09 +01:00
Daniel Kolesa ab2e608239 eolian: add support for static and terminated arrays
Adds two new type types, STATIC_ARRAY and TERMINATED_ARRAY. Static arrays are
only allowed as struct members right now - they translate to regular C static
arrays (allowing them elsewhere wouldn't be good, as C isn't very good at
working with the size information). Terminated arrays are basically sequences
of data terminated at the end. The base type of static arrays can be any type
that is not marked ref (explicit ref may get allowed later). The base type of
terminated arrays has the same restriction plus that it has to be either
implicitly reference type (i.e. translating to pointer in C), integer type
or a character. In case of ref types, the terminator is NULL. In case of
integer types, the terminator is a zero. In case of character types, the
terminator is also a zero (null terminator like C strings).

@feature
2016-06-30 16:59:21 +01:00
Daniel Kolesa 33c147f6d4 eolian: remove the unnecessary subtypes API
Inner type can now be retrieved as a base type of the type.
If the type has two inner types or more, there is a new API that allows you to
get the second inner type by calling it on the first one (same would apply to
getting third via second etc.).

This API is simpler to use and doesn't require an iterator.
2016-06-10 14:28:19 +01:00
Lauro Moura 5a3331618e eolian: remove support for value-type promises 2016-06-09 19:14:18 -03:00
Daniel Kolesa 375179b47f eolian: support @protected for accessors (get/set)
Previously it was only possible to set it for the whole property.

@feature
2016-06-09 16:55:24 +01:00
Daniel Kolesa 1a34d89d20 eolian: fix incorrect doxygen param generation
The first param on methods was skipped for some reason.

@fix
2016-06-09 14:41:12 +01:00
Daniel Kolesa b87c4f6de8 eolian: refine the ref system to suit more cases
Now references are first class (but still restricted to one level). Unlike
pointers they only mark the type instead of introducing a whole new type.
2016-06-08 15:49:09 +01:00
Daniel Kolesa 1637c21a76 eolian: support @ref on returns
This adds basic support for @ref on return types.
2016-06-07 15:26:09 +01:00
Daniel Kolesa 9752c44a48 eolian: add a new references system to help replace pointers
It's now possible to mark struct fields and function params as "references",
which causes them to become pointers in C (in bindings, they become whatever
is necessary). They're not a part of the type and are much more restricted
than pointers, allowing bindings to be easier. This system will be gradually
utilized and expanded as required.

@feature
2016-06-06 15:28:10 +01:00
Felipe Magno de Almeida 96f0783e04 eolian: Fix generating pointer promises for class types 2016-06-05 16:50:54 -03:00
Felipe Magno de Almeida 8fec0d5139 eina: Remove unnecessary indirection to promises
Now when dealing with pointer types, we will not get pointer to
pointer semantics in callbacks and eina_promise_owner_value_set
for Eina_Promise.

It will work as expected:

Eina_Promise_Owner* promise = eina_promise_add();

void* p = malloc(sizeof(T));
eina_promise_owner_value_set(promise, p, &free);
2016-06-03 17:22:12 -03:00
Daniel Kolesa e984e5a11a eolian: remove pointers from complex and class types
Complex types (i.e. list, array, hash, accessor etc.) now do not require
pointers with them anymore (the pointer is implied) and the same goes for
class handles. Eolian now explicitly disallows creating pointers to these
as well. This is the first part of the work to remove pointers from Eolian
completely, with the goal of simplifying the DSL (higher level) and therefore
making it easier for bindings (as well as easier API usage).

@feature
2016-05-23 15:58:33 +01:00
Felipe Magno de Almeida 46903d76f5 eolian: Fix promise generation with multiple parameters
When generating multiple parameters, they inadvertedly got
replaced by __eo_promise. Replacing all arguments to the
promise pointer.
2016-04-29 17:15:51 -03:00
Cedric BAIL 842a020e1f eolian: add support for restartable event. 2016-04-20 15:53:16 -07:00
Stefan Schmidt 28dfe2f0ff eolian: free impl_full_params strbuf before going out of scope
Just missed impl_full_params here while all others are free'd fine.

CID: 1354287
2016-04-18 16:00:49 +02:00
Felipe Magno de Almeida 62841aee3c eolian: Make promise eolian generation use macros for hooks
Modify the way hooks are defined and used by promise generation in
Eolian in the Eo API.

Instead of passing macro names as parameters to EO_FUNC_BODY macros,
just re-define the actual hooks when it is needed.
2016-04-11 01:28:50 -03:00
Felipe Magno de Almeida dc954d8dba eolian: add Eolian support for Eina Promises
Add a promise object to allows Eolian interface to include promises
as a way to have asynchronous value return and composibility.

The usage is like this in a .eo file:

class Foo {
   methods {
      bar {
         params {
            @inout promise: Promise<int>;
         }
      }
   }
}

Which will create the following API interface:

void foo_bar(Eo* obj, Eina_Promise** promise);

and a Eina_Promise_Owner for the implementation, like this:

void _foo_bar(Eo* obj, Private_Data* pdata, Eina_Promise_Owner* promise);

Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
2016-04-06 14:34:15 -07:00
Felipe Magno de Almeida 944e11559c eo: add before and after macro hooks for API generation functions
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>
2016-04-06 14:32:04 -07:00
Jean-Philippe Andre 78bb21a2d9 Eolian: Mark all EO class_get() as weak
This follows the previous commit for the same reasons.
2016-04-01 12:09:06 +09:00
Daniel Kolesa fbd9defdd4 eolian generator: simplify typedef gen 2016-03-14 16:58:09 +00:00
Daniel Kolesa d558c0122f eolian generator: close the file with zero write 2016-03-11 16:19:53 +00:00
Daniel Kolesa 97adf6d52b eolian generator: check fwrite return value currectly
This fixes CID 1327247.

@fix
2016-03-11 13:16:34 +00:00
Tom Hacohen 7d8cd6c40f Revert "ecore: Create Promises"
Reverting this at Felipe's request following my email. There are many
things I strongly object to in this commit. I've touched the surface of
those on the ML (which doesn't work at the moment), though we need to
better discuss it.

The gist:
1. dlsym is a really bad hack that is not even needed.
2. I don't see why eo should even be aware of promises. It's not aware
of list, hash and etc.
3. The eolian changes were done wrong.

This should have been discussed and consulted before done, even if only
because of the amount of hacks it includes and the cross-domain (ecore,
eo and eolian) nature of it.

This reverts commit f9ba80ab33.
2016-03-08 14:23:57 +00:00
Stefan Schmidt 29028a50ce eolian_gen: mention the option for generating a stub header in the example use
Listed in the available options already but better also list it in the example
usage where the other three generation types are listed as well.
2016-03-08 11:14:56 +01:00