Commit Graph

682 Commits

Author SHA1 Message Date
Daniel Kolesa 45e6a3e86a eolian: disallow duplicate implements 2017-01-02 16:09:04 +01:00
Daniel Kolesa 3dc9d28279 eolian: fill ctor class early on 2017-01-02 15:28:45 +01:00
Daniel Kolesa bd21080c82 eolian: no need to fill func in eolian_implement_function_get
All implements are now filled in the previous stage.
2017-01-02 15:28:45 +01:00
Daniel Kolesa 0b2c070b06 eolian: partially clean up implement filling logic 2017-01-02 15:28:45 +01:00
Daniel Kolesa 692d445dcf eolian: require specification of either get or set in property impls 2017-01-02 15:28:45 +01:00
Daniel Kolesa 34abcd33c9 eolian: enable cyclic dependencies between classes 2016-12-27 21:53:00 +01:00
Daniel Kolesa 71b217451d eolian: remove old property impl syntax and clean up parsing 2016-12-27 19:37:15 +01:00
Daniel Kolesa 3797a269b6 eolian: allow new property impl syntax with auto/empty 2016-12-27 19:33:12 +01:00
Daniel Kolesa d48baf533f eolian: require semicolon after get/set in new property impl syntax 2016-12-27 16:05:22 +01:00
Daniel Kolesa 757cc83413 eolian: implement new partial property impl syntax
Instead of

    Other.Class.some_prop.get;
    Other.Class.some_prop.set;

you can write

    Other.Class.some_prop { get; set; }

The other syntax is deprecated from now on.
2016-12-23 17:28:11 +01:00
Daniel Kolesa 2ebea22bc3 eolian: add dev warning for old style property implements 2016-12-23 17:17:11 +01:00
Daniel Kolesa df55f75ace eolian implements: prepare API for whole-property implements 2016-12-23 16:31:37 +01:00
Cedric BAIL 8a57cb44b2 eolian: silence clobbered variable warning. 2016-12-15 10:44:22 -08:00
Daniel Kolesa 3dfb7a6ba8 eolian: enable typechecked expression validation
This code was formerly disabled, but it's safe now.
2016-12-15 13:31:58 +01:00
Daniel Kolesa e444d43bbb eolian: handle pointer types in typechecking expr eval
Also improve expr error messages and fix Eolian tests.
2016-12-14 18:23:16 +01:00
Daniel Kolesa d123978718 eolian: handle pointers in aliased_base_get 2016-12-14 18:23:16 +01:00
Daniel Kolesa c813e94606 eolian: unary expr eval for floats and add a signed number mask
This adds a new mask for all signed numbers (sint + float) and
fixes unary expr evaluation for floats, as well as fixes eval
error messages.
2016-12-14 18:23:16 +01:00
Daniel Kolesa 7df8625c40 eolian: clean up unnecessary logic in eolian_documentation_string_split
Fixes CID1366824.
2016-12-08 13:53:03 +01:00
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
Tom Hacohen cfd7b57006 Eolian: Turn on strict type checking.
Thanks to q66 for the code.
I'm stealing credit here because:
1. I'm lazy.
2. He's lazy and doesn't deserve it.
2016-04-19 17:15:28 +01: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
Daniel Kolesa 9b845e7135 eolian: add APIs to get all things of each type 2016-03-29 15:01:17 +01:00
Daniel Kolesa 22875f066c eolian: builtin support for event callback signature 2016-03-14 17:16:41 +00:00
Daniel Kolesa c420cbe9f0 eolian: refactor database_typedecl_to_str to remove dead code
After the type system transition there was some unnecessary dead code.
Fixes CID 1352512.
2016-03-11 13:04:41 +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
Daniel Kolesa bf2c0c3405 eolian: validate eo/legacy prefix to be [a-z_][a-z0-9_]* 2016-03-07 15:01:19 +00:00
Felipe Magno de Almeida f9ba80ab33 ecore: Create Promises
Add a promise object that 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 {
            promise: Promise<int>;
         }
      }
   }
}

Which will create the following API interface:

void foo_bar(Ecore_Promise** promise);

and the equivalent declaration for implementation.

However, the API function will instantiate the Promise for the
user and the implementer of the class.
2016-03-06 17:55:33 -03:00
Daniel Kolesa 32e0b60bb4 eolian: type documentation and other cleanups 2016-03-03 18:58:11 +00:00
Daniel Kolesa e061d49aac eolian: completely clean up the type system 2016-03-03 18:58:11 +00:00
Daniel Kolesa 1f58ccb49f eolian: clean up some temporary hashes 2016-03-03 18:58:11 +00:00
Daniel Kolesa c3a33653f3 eolian: separate type_to_str for decls 2016-03-03 18:58:11 +00:00
Daniel Kolesa 5401c775ec eolian: remove database_type_print (unused) 2016-03-03 18:58:11 +00:00
Daniel Kolesa 4c4fbfae0b eolian: remove most of the old type APIs 2016-03-03 18:58:11 +00:00
Daniel Kolesa 863212f84a eolian: more old type api removals 2016-03-03 18:58:11 +00:00
Daniel Kolesa 4e40b60f06 eolian: remove retrieval funcs for type-style enums/aliases/structs 2016-03-03 18:58:11 +00:00
Daniel Kolesa cb42da514b eolian: initial conversion of C gen and tests to new type APIs 2016-03-03 18:58:11 +00:00
Daniel Kolesa 8514c1846f eolian: add api to deal with typedecl free funcs 2016-03-03 18:58:11 +00:00
Daniel Kolesa c0287a2752 eolian: add some missing typedecl APIs 2016-03-03 18:58:11 +00:00
Daniel Kolesa cf9dbaa7da eolian: add matching APIs to get typedecls by file 2016-03-03 18:58:11 +00:00
Daniel Kolesa 6e2497bc01 eolian: add wrappers for most of typedecl APIs 2016-03-03 18:58:11 +00:00
Daniel Kolesa 2be79061fd eolian: remove unneeded hashes 2016-03-03 18:58:11 +00:00
Daniel Kolesa 1425523bd4 eolian: actually generate typedecls as necessary 2016-03-03 18:58:11 +00:00
Daniel Kolesa 06c246ee27 eolian: free the hashes (prevent leaks) 2016-03-03 18:58:11 +00:00
Daniel Kolesa 8944cc44c1 eolian: add typedecl delete func and init hashes correctly 2016-03-03 18:58:11 +00:00
Daniel Kolesa 67f17f1068 eolian: rename typedef to typedecl to clear name confusion 2016-03-03 18:58:11 +00:00
Daniel Kolesa 87c763ac8b eolian: add a structure + hashes representing type decls 2016-03-03 18:58:11 +00:00
Daniel Kolesa ff7e2b5b6b eolian: always define the first enum value for consistency 2016-03-03 18:58:11 +00:00
Daniel Kolesa 0d291ac43e eolian: add typedef enumeration for type definitions 2016-03-03 18:58:11 +00:00
Daniel Kolesa eee5cc4fdc eolian: re-enable strict validation 2016-02-18 10:14:41 +00:00
Cedric BAIL 56a21ab5f2 Revert "eolian: strict validation for EFL (errors by default)"
This reverts commit 21a2a8007d.

Please run make check from time to time.
2016-02-17 14:37:42 -08:00
Daniel Kolesa 21a2a8007d eolian: strict validation for EFL (errors by default) 2016-02-17 13:00:41 +00:00