Commit Graph

614 Commits

Author SHA1 Message Date
Daniel Kolesa 246288fff7 eolian: forgotten free() (leaks memory otherwise) 2016-12-07 14:06:02 +01:00
Daniel Kolesa 5fa81d9fab eolian: switch reference validation to new tokenizer 2016-12-07 13:56:35 +01:00
Daniel Kolesa 2ffc93ddf9 eolian: add a reference resolver
New API function eolian_doc_token_ref_get will resolve the kind of
reference in the given token and extract the necessary data you
might need for further use, for example class and function for
methods, or struct and field for struct field. It also supports
event references that will be added into Eolian later.

EFL will be switched to the new resolver (by changing the validator
code) during the next step.
2016-12-06 19:11:17 +01:00
Daniel Kolesa 66b48f8f5d eolian: remove handling of short refs in tokenizer
Already expanded in the main lexer.
2016-12-01 17:22:19 +01:00
Daniel Kolesa d2105f99d4 eolian: add documentation tokenizer
This provides an API to tokenize Eolian docstrings. It does not
yet switch the rest of the infra to it, but it does have tests.
It doesn't verify correctness of references, as that's Eolian's
job. Therefore it's also your job to provide it with strings that
do not contain invalid references. Lua bindings are to come and
a complete switch will be done later.

@feature
2016-12-01 16:37:28 +01:00
Jee-Yong Um 0e2a2cbacf eolian: remove all duplicated affix
Summary:
Currently eolian abbreviates when only the last word of class name and
the first word of method name are same, but this patch abbreviates
generated c name of function to remove all duplicated affix.
For example, "efl_io_closer_fd_closer_fd_set" will be "efl_io_closer_fd_set".

Reviewers: jpeg

Subscribers: cedric

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-11-28 11:35:27 -08:00
Daniel Kolesa 8002b3b24e eolian: remove parsing of pointers and the corresponding APIs
Everything should be done via the new ptr() system now.
2016-11-10 16:20:19 +01:00
Cedric BAIL 144ef9dad3 eolian: remove Eina_Promise. 2016-11-07 13:43:11 -08:00
Daniel Kolesa f399e77a92 eolian: rename is_ref API to is_ptr to match syntax 2016-11-03 14:22:21 +01:00
Daniel Kolesa c4f64a3390 eolian: rename ref to ptr to avoid confusion with eo refs 2016-11-02 13:06:38 +01: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 8c9fa54be4 eolian: fix the nonsensical semantics for variables
Both variables and constants can have extern on them (it means the same thing
as in types, they won't get generated in C). This is different from the previous
semantics which only allowed extern on globals, which makes no sense.

Both globals and constants are allowed to have a value (previously only
constants were); constants are required to have a value. Globals having
a value is just a convenience for initialization during source generation.
This is unlike the previous behavior, where the value was optional for both
globals and constants and only allowed when not marked extern, which makes
no sense either.

Obivously, even when globals have a value, they're not allowed to be used
in expressions, as they cannot be evaluated at compile time (they're mutable).
2016-10-19 15:32:22 +02:00
Daniel Kolesa b6113a6bd9 eolian: add API to get the C class datatype 2016-10-13 15:04:20 +02:00
Daniel Kolesa e5d016bb63 eolian: add an API to get the C name used to access the class 2016-10-12 14:56:22 +02:00
Cedric BAIL 36bc9aa187 eolian: add a builtin to handle a free callback. 2016-09-08 14:58:05 -07:00
Cedric BAIL ed9dff8fbd eolian: add support for future.
Future is the read only side of a Promise. For now, I am not removing
Eina_Promise until everything is in place, but eventually the promise
type of eolian will be gone.
2016-09-08 14:58:05 -07:00
Tom Hacohen d5e321466e Efl object: Rename Eo_Event -> Efl_Event.
This is the last step of the Eo renaming efforts.
2016-08-30 13:34:10 +01:00
Daniel Kolesa 1c78d2196b eolian: enforce no get/set as method/property name rule
Fixes T3849.
2016-08-23 13:44:18 +01:00
Gustavo Sverzut Barbieri e3e0a6bd65 eolian: gracefully handle incorrect case of inherit.
If you use "EFl" instead of "Efl", it will find the proper file, but
won't find the type... crashing.

Handle that case and hint the user about it.
2016-08-18 02:13:19 -03:00
Tom Hacohen c662934be8 Change the EFL to follow the new Eo rename. 2016-08-11 17:04:43 +01:00
Daniel Kolesa da90173936 eolian: cleanup type serialization logic 2016-07-01 14:34:24 +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 7584960377 eolian: implement a stringshare builtin
This implements a new builtin, stringshare, which is replaced with the right
pointer to Eina_Strinshare as necessary. This allows simplifying binding code
(it can call the proper eina APIs, deal with lifetime etc).

It also removes the extern Eina.Stringshare typedef from eina_types.eot, which
was actually incorrect and would generate invalid code in binding generators.

@feature @fix
2016-06-21 14:41:18 +01:00
Tom Hacohen d648eb5311 Eo event callbacks: Change the way callbacks are stopped.
Instead of using the return value, we now use eo_event_callback_stop()
to stop calling other callbacks.
2016-06-20 18:02:00 +01:00
Daniel Kolesa a7c6086c42 eolian: enable inheritance checks and fix EFL to build with them
Somehow, there was code in the tree that apparently isn't tested at all, even
once - if it was, the eo.c logic that performs inheritance checks would be
triggered. I don't know how this could have happened (actually I do, it's
Cedric's fault and he should be publicly shamed for it) but these checks
make sure this will never happen again. But since the code itself appears
to be untested, I don't know if there isn't any other brokenness in it.
But that's beyond the scope of this change, so for now, let's make sure
all our inheritance is at least formally correct.

Also, enable eo_interface.eo generated code in Eo itself so that Eo.Interface
can be used when inheriting.

@fix
2016-06-15 16:37:15 +01:00
Daniel Kolesa f7e09d3570 eolian: move deferred eo file parsing to the very end
Because of this the cyclic check would occasionally have false positives.
By moving deferred eo parsing to the end of the whole parse process, it
can no longer affect the cyclic checker.

@fix
2016-06-15 16:20:45 +01:00
Daniel Kolesa 70d2866662 eolian: add (for now disabled) inherit validity checks
Somehow I cannot enable this right now because we have issues with existing
eo files that need to be resolved first.
2016-06-14 14:09:13 +01:00
Daniel Kolesa 54590d677e eolian: fix impl func fill
If there is a dot in the remaining part of the implement, it means it
actually implements another class - do not fail in those cases.
2016-06-13 16:24:35 +01:00
Daniel Kolesa 922e4e9181 eolian: fix error cursor positioning
Previously, multi-char tokens (such as strings, docs etc) always put the error
cursor to the end of the token. That was confusing, so now the cursor always
appears at the beginning of the token instead (for multiline tokens, currently
only docs, the line number is also adjusted to point to the first line of the
doc token).

@fix
2016-06-13 14:55:15 +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
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 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 1a0928eb14 eolian: we don't support unnamed structs/enums, so don't check 2016-06-06 16:15:14 +01:00
Daniel Kolesa 7cf7cba88e eolian: remove the c_type_named_get APIs
These have inconsistent behavior and are generally unnecessary, so I'm
removing them. Use the c_type_get funcs instead.
2016-06-06 15:50:15 +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
Daniel Kolesa 4844034a1a eolian: add core infra to support builtin strings and void pointers 2016-05-26 14:36:41 +01:00
Daniel Kolesa 2781680b51 eolian: put ownable checks into its own func 2016-05-26 14:17:07 +01:00
Daniel Kolesa 39b9c7564a eolian: add support for warning when pointer type is found (with env var) 2016-05-24 11:48:44 +01:00
Felipe Magno de Almeida b613d6f1d9 eolian: Allow promises to have a second type
Promises can have a second type, which is the progress type
2016-05-23 15:58:11 -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
Daniel Kolesa 4bdb1f73b8 eolian: handle invalid keywords correctly
Before this Eolian segfaulted when an invalid keyword was used.

Fixes T3672.
2016-05-23 10:49:42 +01:00
Daniel Kolesa 9be179d740 eolian: add warnings for class/complex types with pointers (with env var) 2016-05-20 17:15:20 +01:00
Daniel Kolesa 7344417306 eolian: enable incorrect property doc warnings with env var
This adds env var EOLIAN_PROPERTY_DOC_WARN which enables extra
warnings for properties that don't have a general doc but have
getter/setter doc. This will eventually become an error and
will be enabled by default. For now it's too verbose.
2016-05-19 16:57:12 +01:00
Daniel Kolesa 7782c0bcb9 eolian: add event_prefix and have classes follow that or eo_prefix by default
Previously events used to use class name as a prefix and ignored eo_prefix
when specified. This is no longer the case. Events follow eo_prefix by default
now. In order to get around this for classes where this is undesirable, a new
field event_prefix was added which takes priority over eo_prefix. If neither
is specified, class name is used like previously.

@feature
2016-05-17 17:50:43 +01:00
Daniel Kolesa 1a0566452f eolian: do not generate legacy without explicit class legacy_prefix 2016-05-12 17:27:34 +01:00
Daniel Kolesa 7e94eb22b4 eolian: mark pure virtual funcs outside of implements
This is a better syntax and should've been like this in the first place.
2016-05-12 16:15:24 +01:00
Daniel Kolesa 4126b7faba eolian: fix C type serialization (handle undefined) 2016-05-10 18:06:56 +01:00
Daniel Kolesa 8df2686d90 eolian: lift restriction on namespace/class name conflicts in library
This will allow us to name classes the same as namespaces.
2016-05-06 12:57:01 +01:00
Cedric BAIL 842a020e1f eolian: add support for restartable event. 2016-04-20 15:53:16 -07:00