Commit Graph

1082 Commits

Author SHA1 Message Date
Daniel Kolesa f796a21d72 eolian: add event redefinition checks
As EFL fails build with this enabled, hide these behind the
EOLIAN_EVENT_REDEF_WARN environment variable for the time being.
2018-04-26 16:15:04 +02:00
Daniel Kolesa 6f69a8c56d eolian: clear chash on each iteration during validation
This is necessary because inheritance trees need to be validated
individually for proper name conflict checks. It also prevents
eina_hash_add related errors.
2018-04-26 16:15:04 +02:00
Daniel Kolesa dd90488b69 eolian: add capturing of variables/typedecls in expr eval
This will be used from validation to properly count actual
dependencies of a unit.
2018-04-20 16:10:55 +02:00
Daniel Kolesa 591567a6ac eolian: add 'parse' directive
This is much like 'import' but doesn't add the imported file into
the dependency list for the current file. This is to enable doc
reference validation to remain functional without needlessly
introducing file dependencies just to satisfy it.
2018-04-20 16:10:55 +02:00
Daniel Kolesa a2ccdb7b21 eolian: re-enable non-dependencied parsing
The issue was that standalone-parsed files (outside of dependencies
of some other unit) were not being included in that dependency tree
(obviously) which resulted in their own dependency tree being
excluded from merging, causing the database hashes to lack the
necessary elements.

To fix this, I trigger merging of the "standalone" dependency trees
separately, by calling _merge_units from defer parsing cb.
2018-04-19 13:44:14 +02:00
Daniel Kolesa 974fa323a1 eolian: disable non-dependencied parsing for the time being
As 543902f2ba breaks build,
disable parsing with state as a parent for now, until the issue
is figured out.
2018-04-18 21:17:31 +02:00
Daniel Kolesa 543902f2ba eolian: make doc ref resolution global
Doc refs no longer introduce new dependencies into files. Instead,
they're parsed globally, and any doc ref lookup is also made
globally. This allows unit based dependencies to correspond more
to what files actually really need at compile time/runtime, with
docs being irrelevant to that; it also simplifies the API.

The doc resolution API now takes Eolian_State instead of
Eolian_Unit, too.
2018-04-18 16:38:14 +02:00
Daniel Kolesa d13cfe1b83 eolian: doc ref validation cleanup 2018-04-18 16:38:14 +02:00
Daniel Kolesa 28b1dd25c7 eolian: add internal api for dep deferring + parsing without dep
This is cleaner than adding into a hash manually. Additionally, it
is now possible to request that the file be parsed not as a dep,
but rather standalone, which will be useful later.
2018-04-18 16:38:14 +02:00
Daniel Kolesa 311fada0d2 eolian: simpler and more efficient defer parsing 2018-04-18 16:38:14 +02:00
Daniel Kolesa 2defb32214 eolian: correct line/column number during doc reference validation
Eolian doc objects now bundle debug information necessary to
provide correct line/column numbers. It is not possible to get
this information cirectly from the text, as it's reformatted and
contains no extra whitespace or newlines beyond paragraph
separators.

Fixes T6701.
2018-04-12 15:24:15 +02:00
Daniel Kolesa e9811c6596 eolian: simplify class validation logic 2018-04-11 14:58:41 +02:00
Daniel Kolesa 710748c551 eolian: better/more robust class inheritance list replacement 2018-04-11 14:31:03 +02:00
Daniel Kolesa 284e352811 eolian: _ is allowed in doc references 2018-04-05 13:54:20 +02:00
Daniel Kolesa 474a2a319b eolian: completely scoped validation
This is much stricter than the previous behavior,
as it allows no leakage of information from the
outside to the inside.
2018-03-27 13:48:58 +02:00
Daniel Kolesa e4fd05469d eolian: validate each class with its own unit's in mind only
This is stricter (doesn't allow outer symbols to leak in).
Also needed fixing some eo files.
2018-03-27 13:27:46 +02:00
Daniel Kolesa 2c76889347 eolian: fix segfault on error when input file fails to open 2018-03-26 11:57:53 +02:00
Daniel Kolesa d98dd33648 eolian: fill missing fields in doc objects 2018-03-26 11:56:26 +02:00
Daniel Kolesa 3bddb2b6c4 eolian: commit all changes into staging area first 2018-03-22 18:01:31 +01:00
Daniel Kolesa 806c30ec34 eolian: complete staging area merge logic 2018-03-22 17:56:52 +01:00
Daniel Kolesa db04d3f670 eolian: introduce main and staging areas properly
The state is now correctly divided. No merging is performed yet,
which is to be done next.
2018-03-22 17:56:52 +01:00
Daniel Kolesa 3ae67b24b3 eolian: validate staging unit when parsing all 2018-03-22 16:27:35 +01:00
Daniel Kolesa 93a64c5eab eolian: clean rollback support
Previously, when an error happened in Eolian, the state was left
in a presumably unusable and inconsistent condition. This work
aims to change that, as all changes are committed into a staging
area before being validated and merged back into main state.

This is not yet complete, as units and by-file lookups are not
currently involved in the rollback. This will change in the
subsequent commits.

@feature
2018-03-22 15:37:25 +01:00
Daniel Kolesa d9a8fe0fca eolian: add state staging area
This will be used for clean rollbacks on errors.
2018-03-22 15:37:25 +01:00
Daniel Kolesa bc182e69d7 eolian: flush defer table before parsing 2018-03-22 15:37:25 +01:00
Daniel Kolesa 2db8e8e914 eolian: make use of panics for certain alloc errors 2018-03-20 17:34:51 +01:00
Daniel Kolesa 7c6d8010a8 eolian: no need for printf-style for internal log funcs 2018-03-20 17:34:51 +01:00
Daniel Kolesa a1ae5cd918 eolian: use new error logging for all recoverable errors 2018-03-20 17:34:51 +01:00
Daniel Kolesa 9610459502 eolian: add APIs to get unit from object and state from unit 2018-03-16 16:16:16 +01:00
Daniel Kolesa 60c733670d eolian: intial API for a new error mechanism
Unlike panic, this will be used to handle regular errors
such as parse errors. There will be no jumps and you
will be able to pass in a pointer to get the error
data into some local memory. That way you will be
able to override printing error messages.
2018-03-16 16:07:12 +01:00
Daniel Kolesa 927bcfd60a eolian: initial API for a new panic mechanism
This will be used to handle unrecoverable errors.
For robustness, you will be able to set a custom
panic callback, jump and try to recover manually.
2018-03-16 15:41:57 +01:00
Daniel Kolesa a848278782 eolian: simplify lexer init 2018-03-16 14:49:35 +01:00
Daniel Kolesa bf1e3a702f eolian: event/function_get_by_name -> by_name_get 2018-03-16 14:26:15 +01:00
Daniel Kolesa 6c0180d7f8 eolian: more stringent and fine-grained validation 2018-03-16 00:14:13 +01:00
Daniel Kolesa fed326a3ef eolian: fix unit child management
Also pass correct unit to validation for performance.
2018-03-16 00:10:13 +01:00
Daniel Kolesa 2760f047d3 eolian: merge objects in units 2018-03-15 23:32:20 +01:00
Daniel Kolesa 978ba5052d eolian: reduce the number of database traversals during validation
This significantly improves performance by not iterating certain
paths multiple times.
2018-03-15 23:25:35 +01:00
Daniel Kolesa 2c59abc878 eolian: fix minor memory leaks 2018-03-15 16:45:23 +01:00
Daniel Kolesa edc73c4c4c eolian: make sure dtors are always run correctly 2018-03-15 16:34:39 +01:00
Daniel Kolesa df83efcef9 eolian: remove the temps system 2018-03-15 16:34:39 +01:00
Daniel Kolesa 5178b15ac5 eolian: manage exprs through node system 2018-03-15 16:34:39 +01:00
Daniel Kolesa da47159dbd eolian: manage typedecls through node system 2018-03-15 16:34:39 +01:00
Daniel Kolesa 80445f5160 eolian: manage class/vars through new node system 2018-03-15 16:34:39 +01:00
Daniel Kolesa aa313ccfb6 eolian: store types in node hash 2018-03-15 16:34:39 +01:00
Daniel Kolesa cd49130df7 eolian: generic dtor management for lexer 2018-03-15 16:34:39 +01:00
Daniel Kolesa 916c8cb046 eolian: unified node allocation api 2018-03-15 16:34:39 +01:00
Daniel Kolesa 938acf22c0 eolian: in-lexer-state current class storage 2018-03-15 16:34:39 +01:00
Daniel Kolesa ab43e61ef6 eolian: turn some state APIs into inlines over unit APIs 2018-03-14 17:20:49 +01:00
Daniel Kolesa 2d0a25c995 eolian: refactor doc ref resolution API 2018-03-14 16:51:11 +01:00
Daniel Kolesa 1f4d919cf9 eolian: update type/var name APIs 2018-03-12 16:28:28 +01:00
Daniel Kolesa 35d9ef2dd2 eolian: make more name APIs into inline helpers 2018-03-12 16:16:43 +01:00
Daniel Kolesa edcd81ee49 eolian: update class name APIs 2018-03-12 16:03:37 +01:00
Daniel Kolesa 0f0009cb4f eolian: expose short_name/namespaces via object 2018-03-12 13:55:21 +01:00
Daniel Kolesa 94e1487ed8 eolian: use short name for function pointer name 2018-03-12 12:26:17 +01:00
Daniel Kolesa 5cc3abb425 eolian: only merge units on success when parsing all files 2018-03-12 11:37:02 +01:00
Daniel Kolesa 665fc62916 eolian: simplify namespace handling
This is mostly a preparation for rework of name(space) APIs.
2018-03-11 17:35:13 +01:00
Daniel Kolesa 342974977f eolian: resolve to Eolian_Objects instead of voids 2018-03-09 15:25:36 +01:00
Daniel Kolesa c7fd43ad4e eolian: return Eolian_Object_Type from ref resolver
This needs only one enum and allows for better interop.
2018-03-09 15:25:36 +01:00
Daniel Kolesa 7a4669b1b7 eolian: remove old declaration APIs 2018-03-08 23:59:40 +01:00
Daniel Kolesa 1e8de641d8 eolian: tests for new object apis 2018-03-08 23:16:40 +01:00
Daniel Kolesa c6e0b7f44e eolian: remove obsolete file_get APIs 2018-03-08 22:54:12 +01:00
Daniel Kolesa 2248131295 eolian: give objects names, and reduce duplication 2018-03-08 19:47:28 +01:00
Daniel Kolesa 917a5216f8 eolian: add APIs to retrieve declarations as objects
This will replace the old declarations API.
2018-03-08 19:00:32 +01:00
Daniel Kolesa 9594f09156 eolian: add API to query information about Objects
As nearly every Eolian handle is backed by an Eolian_Object,
this information is now publicly exposed and has an API. This
opens up an array of new possibilities for tooling, as you
can now externally query file names, line numbers etc.,
as well as cast arbitrary handles to Eolian_Object pointers
and back.

This will be expanded later and it will replace the Declaration
system, as it's cleaner, better integrated and more versatile.

@feature
2018-03-08 17:32:38 +01:00
Daniel Kolesa 482c5d1ba2 eolian: get rid of old APIs for typedecl retrieval 2018-03-07 13:53:08 +01:00
Daniel Kolesa f596a97da6 eolian: remove old variable retrieval APIs 2018-03-07 13:25:28 +01:00
Daniel Kolesa 434b0a399d eolian: remove old class retrieval APIs 2018-03-07 13:08:49 +01:00
Daniel Kolesa b799fb1959 eolian: remove old APIs for path retrieval 2018-03-02 13:53:34 +01:00
Daniel Kolesa b45dc505cd eolian: remove old directory_scan/file_parse APIs 2018-03-02 13:46:57 +01:00
Daniel Kolesa f8505eddbd eolian: new APIs for typedecl lookups 2018-03-01 12:42:40 +01:00
Daniel Kolesa e28e481cca eolian: new variable lookup APIs 2018-03-01 12:16:28 +01:00
Daniel Kolesa d6382f3f2b eolian: new APIs for class retrieval 2018-03-01 12:16:28 +01:00
Daniel Kolesa 7a68ea5edb eolian: rename path/filename retrieval APIs 2018-02-27 16:12:35 +01:00
Daniel Kolesa b3596252eb eolian: rename all_files_parse functions 2018-02-27 16:12:35 +01:00
Daniel Kolesa 9f79d4ff22 eolian: eolian_file_parse -> eolian_state_file_parse 2018-02-27 16:12:35 +01:00
Daniel Kolesa 436f2d3363 eolian: add API to get file name of a unit 2018-02-27 16:12:35 +01:00
Daniel Kolesa 7d001fd93f eolian: add API to get children of a unit 2018-02-27 16:12:35 +01:00
Daniel Kolesa e91ae3984a eolian: add APIs to retrieve units from a state 2018-02-27 16:12:35 +01:00
Daniel Kolesa f5e3734cdd eolian: new APIs for directory scanning 2018-02-27 16:12:35 +01:00
Daniel Kolesa 6a284e48c9 eolian: eolian_* -> eolian_state_*, Eolian -> Eolian_State 2018-02-27 16:12:35 +01:00
Daniel Kolesa a11e70ab3c eolian: perform correct unit lookups in public API
This finally enables looking up things from the current unit
rather than from a backing storage in the Eolian state. This
also means that the benefits of having a unit system will
finally be visible.
2018-02-23 15:34:52 +01:00
Daniel Kolesa 39820fb5f5 eolian: simplify adding/refcounting objects 2018-02-23 15:25:55 +01:00
Daniel Kolesa 1a7dabeb74 eolian: proper in-unit storage for all declarations
This makes sure variables are stored as well as types within their
respective units. Also, declarations are now refcounted just like
any other Eolian object.
2018-02-23 15:25:55 +01:00
Daniel Kolesa 26f0c56faf eolian: fix eina hash usage so it doesn't consume all your memory
This makes sure items are checked before being added, so that eina
hash doesn't get confused, add each item thousands of times and
run out of memory.
2018-02-22 11:19:23 +01:00
Daniel Kolesa 665b88204c eolian: store types/typedecls in units 2018-02-22 11:19:22 +01:00
Daniel Kolesa 7b5a73b967 eolian: add eolian_object_add wrapper 2018-02-22 11:19:22 +01:00
Daniel Kolesa 76b9f4c224 eolian: prepare for proper unit API by merging unit hashes
Eolian now properly merges all unit hashes (e.g. unit A has
children B and C, hashes of B and C are merged into A's hashes
in order to be able to look up B and C's contents via A) and
maintains a (potentially cyclic) children graph.

Not everything is yet added into all hashes, but at least the
building blocks are there.
2018-02-21 17:09:08 +01:00
Mike Blumenkrantz 1f32a4fcd2 eolian: always print error and fail when name conflicts are detected 2018-02-15 13:50:56 -05:00
Daniel Kolesa 0745ec922b eolian: properly initialize warned (to avoid random parse failures) 2018-02-13 21:48:46 +01:00
Daniel Kolesa c82b30cc3c eolian: print all duplicate warnings before aborting build
Instead of aborting at the first warning, accumulate the warnings
and stop at the end of validation.
2018-02-13 10:17:41 +01:00
Daniel Kolesa 09bcf9e5fd eolian: stop build with EOLIAN_WARN_FUNC_DUPLICATES > 1 2018-02-12 18:56:38 +01:00
Daniel Kolesa a6d0e787e4 eolian: no need to store 'parsed' table anymore either 2018-01-31 19:14:15 +01:00
Daniel Kolesa 8b1f2f34b4 eolian: simplify parsed checking 2018-01-31 19:06:37 +01:00
Daniel Kolesa f0877c9329 eolian: no need to track currently parsing file anymore 2018-01-31 18:13:29 +01:00
Daniel Kolesa b5794afa58 eolian: all dependency parsing is now deferred 2018-01-31 18:13:29 +01:00
Daniel Kolesa 5651b2e586 eolian: deferred parsing of inherits + better static checks
This change finally introduces deferred parsing of inherits to
Eolian, after a long time and many iterations. That means instead
of parsing inherits directly as part of the main file's parse pass,
they're pushed into a queue and parsed later. The validation engine
was modified to properly fill in the remaining info afterwards.

This may introduce breakages but I haven't noticed any. It also
properly unlocks cyclic dependency support in Eolian.

Additionally, this also introduces checks for duplicates in class
inherits (class Foo(Bar, Bar) is no longer possible) and it adds
stricter name checks, so you can no longer have a class Foo.Bar
and refer to it as Foo_Bar in implements. This was actually never
meant to be supported, but the check was previously broken.

@feature
2018-01-30 17:08:44 +01:00
Daniel Kolesa 7b643f6919 eolian: move impl/ctor fill to validation stage 2018-01-30 17:08:44 +01:00
Daniel Kolesa 1017f37de7 eolian: fix redefined function checks
For one, the hash has to be populated once per inheritance tree
and the skipping on already-validated funcs was interfering with
that as the function might have been validated in another
inheritance tree already.

Also, if a class appeared multiple times in an inheritance tree,
as is common with e.g. Efl.Object, it would get added into the
hash the first time and then checked against the second time,
which would result in a strange error message about the
function being redefined in its own class.

So now we prevent both cases from happening.
2018-01-18 12:49:05 +01:00
Vincent Torri f5b01ac5ce all: Simplify definition of EAPI
This will help in the transition from Autotools to Meson. This has been
tested on Windows for which EFL_XXX_BUILD were first introduced.
2018-01-18 18:04:03 +09:00
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 b70604d018 eolian: cache enum expr in the database 2018-01-16 16:37:52 +01:00
Daniel Kolesa 29a9b9ad44 eolian: expose _eval_type to internals 2018-01-16 16:37:52 +01:00
Daniel Kolesa 54eac123c2 eolian: correctly validate function pointers 2018-01-12 19:14:13 +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 707ed05d58 eolian: do not require unit for type_class_get 2018-01-12 18:05:13 +01:00
Daniel Kolesa db41734954 eolian: store typedecl/class in type 2018-01-12 18:05:13 +01:00
Daniel Kolesa efb419fd74 eolian: prevent unnecessary hash table allocs 2017-12-22 15:36:31 +01:00
Daniel Kolesa 65ea735fd7 eolian: remove the toplevel information 2017-12-22 15:36:31 +01:00
Daniel Kolesa 7da6675c34 eolian: perform partial class validation every time
This makes sure that duplicate method/part/etc checks are done on
every database update, removing the need for clunky toplevel
checks and improving reliability. It also sacrifices some
performance but it shouldn't be too bad (if a class is already
validated, some checks are avoided to speed things up).
2017-12-22 15:36:31 +01:00
Daniel Kolesa 30c5753172 eolian: deferred parsing of type deps 2017-12-22 15:36:31 +01:00
Daniel Kolesa e1bcd61bdf eolian: move inherit type checking to validation 2017-12-22 15:36:31 +01:00
Daniel Kolesa 03e77ea361 eolian: fix use-after-free in eo_parser
Thanks @netstar for finding this.

Fixes T6523.
2017-12-19 00:20:40 +01:00
Daniel Kolesa 373392d56e eolian: remove now unused database init/shutdown 2017-12-15 17:11:11 +01:00
Daniel Kolesa 18e18ca74c eolian: remove remaining global state (+ modify APIs accordingly) 2017-12-15 17:11:11 +01:00
Daniel Kolesa d624464ab4 eolian: filename retrieval APIs are read only 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 9aaa5cf839 eolian: remove _cunit and prepare for returning actual units 2017-12-14 17:31:21 +01:00
Daniel Kolesa 2259b6f16f eolian: remove parent info from units (actually doesn't make sense) 2017-12-14 16:45:13 +01:00
Daniel Kolesa f9868b541e eolian: store unit inside lexer 2017-12-14 16:38:35 +01:00
Daniel Kolesa 535fa0e8f1 eolian: no need to init eina in db 2017-12-07 19:11:58 +01:00
Daniel Kolesa 3ebd1f1506 eolian: store units in state 2017-12-07 19:11:58 +01:00
Daniel Kolesa 8653d8cd73 eolian: properly free all hashes in state free 2017-12-07 19:11:58 +01:00
Daniel Kolesa e7bf69fc04 eolian: make deferred parsing map non-global 2017-12-07 19:11:58 +01:00
Daniel Kolesa 2343e6cc54 eolian: make parsing/parsed files mapping non-global 2017-12-07 19:11:58 +01:00
Daniel Kolesa 9a5c3cfbe2 eolian: remove internal state struct (rely on external Eolian state) 2017-12-06 15:07:31 +01:00
Daniel Kolesa a39d2e8fe5 eolian: move filenames hashes to state 2017-12-06 15:07:31 +01:00
Daniel Kolesa a25327c62e eolian: move constants to temporary state 2017-12-06 15:07:31 +01:00
Daniel Kolesa 21db23f702 eolian: move global vars to temporary state 2017-12-06 15:07:31 +01:00
Daniel Kolesa 7491f9353f eolian: move enums to temporary state 2017-12-06 15:07:31 +01:00
Daniel Kolesa 51ec796497 eolian: move structs to temporary state 2017-12-06 15:07:31 +01:00
Daniel Kolesa 8428eaa663 eolian: store aliases in temporary state 2017-12-06 15:07:31 +01:00
Daniel Kolesa 9fb3abc662 eolian: store classes in temporary state 2017-12-06 15:07:31 +01:00
Daniel Kolesa 14cd25a8d3 eolian: create an internal temporary state 2017-12-06 15:07:31 +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
Daniel Kolesa 67e1c2ab88 eolian: add initial refcounting for database objects
This will be necessary once the unit system is in (it will be used
to keep track of multiple references to objects across units).
2017-12-05 16:41:42 +01:00
Daniel Kolesa 2a0f873c84 eolian: pass unit within validation engine 2017-12-05 16:41:42 +01:00
Daniel Kolesa e83e089765 eolian: contain master state in a larger structure 2017-12-05 16:41:42 +01:00
Daniel Kolesa 53aa99550d eolian: add API for master unit creation 2017-12-05 16:41:42 +01:00
Daniel Kolesa 6abb24b717 eolian: create an actual unit structure for files
Units now form an actual tree stored in their own hash. This will
later replace all global state of Eolian, by introducing a master
unit that you will pass around.
2017-12-05 16:41:42 +01:00
Jean-Philippe Andre 43a6fddf1f eolian: Add builtin type "strbuf"
Refers to Eina_Strbuf*
2017-12-05 10:09:58 +09:00
Lauro Moura 0931696a4f eolian: Add inarray and inlist 2017-12-04 15:47:48 -03:00
Jean-Philippe Andre aef05c26d6 eolian: Warn less on duplicate beta APIs
The check was only done on one of the two functions, resulting in some
unwanted warnings.

EOLIAN_WARN_FUNC_DUPLICATES=1 will show non-beta warnings.
EOLIAN_WARN_FUNC_DUPLICATES=2 will still show all warnings.
2017-11-30 10:48:24 +09:00
Jean-Philippe Andre d49c544e81 eolian: Add API's for part enumeration
@feature
2017-11-23 15:14:41 +09:00
Pawel Aksiutowicz 319f497a72 eolian: Removed warning of unused var from eo_parser
Reviewers: stanluk, lukasz.stanislawski

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D5502
2017-11-21 11:12:27 +09:00
Jean-Philippe Andre 8f2e491573 eolian: Fix odd syntax (remove EINA_UNUSED) 2017-11-14 13:40:19 +09:00
Daniel Kolesa 70ee11af84 eolian: enable cyclic imports of eo files 2017-11-08 16:46:14 +01:00
Daniel Kolesa 5c2611d93a eolian: simplify dependency parsing and cut down on hash lookups 2017-11-08 16:12:40 +01:00
Daniel Kolesa 0dbbb18171 eolian: disallow ptr() on things that are already pointer-like
This disallows deeply nested pointers, you can only explicitly
ptr() on types that are strictly value types.

For a few cases where it was necessary to override this behavior,
you can use legacy(ptr(x)) as a temporary measure.
2017-11-03 15:30:10 +01:00
Daniel Kolesa cf63573e73 eolian: only allow reference (ownable) types in containers 2017-11-02 13:51:02 +01:00
Daniel Kolesa f851fa511e eolian: add part validation (including dup check with funcs) 2017-11-01 13:19:33 +01:00
Daniel Kolesa eab6f009e2 eolian: add @cref as alternative to @in
This is a "pass by reference to const" equivalent. There is no explicit pointer
and currently it's the same as ptr(const(x)) on the type. However, it is also
usable on properties.
2017-11-01 12:40:39 +01:00
Daniel Kolesa c8e7ad530e eolian: properly free parts 2017-10-31 12:15:23 +01:00
Daniel Kolesa 0a92c0c61f eolian: fill parts into db 2017-10-31 12:15:23 +01:00
Jean-Philippe Andre c1d21cef89 eolian: Add some color to those warning messages
Note: This is not using eina_log, not entirely sure why, but this
doesn't prevent us from adding some color.
2017-10-31 14:52:34 +09:00
Jean-Philippe Andre 1adb93b3e5 eolian: Skip @beta APIs for duplicate warnings
No warnings:
export EOLIAN_WARN_FUNC_DUPLICATES=0

No beta warnings:
export EOLIAN_WARN_FUNC_DUPLICATES=1

All warnings including beta:
export EOLIAN_WARN_FUNC_DUPLICATES=2

EOLIAN_WARN_FUNC_DUPLICATES is not an API and may change in the future
as we improve the tool :)
2017-10-31 14:52:34 +09: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 a4c96ceb73 eolian: add part definition 2017-10-25 16:25:41 +02:00
Daniel Kolesa c46f9bec2d eolian: enable duplicate validation but only warn for now
Use the EOLIAN_WARN_FUNC_DUPLICATES environment variable to enable
those warnings.
2017-10-25 13:03:20 +02:00
Daniel Kolesa bd90fff392 eolian: only check for validation where really necessary 2017-10-24 23:41:59 +02:00
Daniel Kolesa 88083b0f14 eolian: check for inheritance tree function conflicts
Now a class cannot define a method/property of some name if there
already is something of the same name within the inheritance tree.
2017-10-24 23:39:14 +02:00
Daniel Kolesa 05b395be47 eolian: validate classes in a recursive manner
This allows for proper order of validation which will improve our
performance when also validating for name duplicates.
2017-10-24 23:21:24 +02:00
Daniel Kolesa 903fd9065c eolian: keep track of which objects are validated 2017-10-24 17:49:21 +02:00
Daniel Kolesa 62e46e70ef eolian: initial parsing for parts in eo files 2017-10-24 17:33:07 +02:00
Cedric BAIL c0b2ae2cc8 eolian: there should be nothing depending on efl config in our public header. 2017-10-19 15:29:35 -07:00
Daniel Kolesa 7c7e5ec423 eolian: validate inner types of complex types
This makes sure the inner types are all correctly defined and
that freefuncs are actually correctly filled.
2017-09-28 23:22:05 +02:00
Daniel Kolesa 5e788e3a5c elua: bind new eolian type builtin API 2017-09-22 21:03:23 +02:00
Daniel Kolesa c146d6f877 eolian: add a way to query the builtin type of a type 2017-09-22 21:01:12 +02:00
Daniel Kolesa 9009d3dae4 eolian: add any_value_ptr
Because pointer Eina_Values and value Eina_Values have slightly
different semantics (when it comes to resource management) it's
better to split them.
2017-09-22 20:25:31 +02:00
Daniel Kolesa 3d8081d085 eolian: rename generic_value to any_value 2017-09-22 20:16:06 +02:00
Daniel Kolesa a6e5caba10 eolian: remove leftover code 2017-09-22 18:08:36 +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
Daniel Kolesa 4bae2a7385 eolian: merge REGULAR and COMPLEX types 2017-09-22 17:46:02 +02:00
Daniel Kolesa f36e5bd543 eolian: add mstring
This is a new type representing a mutable string (no const).
Regular strings cannot be made mutable with @owned because
they might be hidden behind typedefs.
2017-09-22 17:10:42 +02:00
Daniel Kolesa fdd27cadf8 eo: make more freefuncs implicit 2017-09-22 16:17:19 +02:00
Daniel Kolesa 9da5cf20aa eolian: remove old ownership system 2017-09-15 17:52:55 +02:00
Daniel Kolesa 1afd3c215f eolian: correctness fixes in tests and eo files 2017-09-15 17:48:28 +02:00
Daniel Kolesa 21213802e4 eolian: switch validation to new ownership system 2017-09-15 16:37:26 +02:00
Daniel Kolesa 4b27fe6571 eolian: add API to check for @owned 2017-09-15 16:33:57 +02:00
Daniel Kolesa 010650663b eolian: store ownership info in types
Even though ownership info belongs to params/returns/etc at syntax
level, we can still store it in the type and turn several API funcs
into one this way.
2017-09-15 16:30:52 +02:00
Daniel Kolesa 792855a1fa eolian: parsing of new @owned syntax for complex types 2017-09-15 16:24:46 +02:00
Daniel Kolesa 4c4c641c4b eolian: disallow parsing of warn_unused/owned for funcptrs 2017-09-15 15:54:48 +02:00
Daniel Kolesa 11ad2b94ff eolian: initial parsing for @owned
This is the new ownership system for Eolian, working on params,
returns, struct fields or events directly rather than specifying
ownership at type level. As the new system will evolve it will
gain missing features and necessary checks.
2017-09-15 15:51:25 +02:00
Daniel Kolesa 518ca72d06 eolian: default free funcs for builtin types 2017-09-14 15:53:30 +02:00
Daniel Kolesa a9aed90fde eolian: more relaxed rules on what is actually ownable
For example, aliases to ownable types are now also ownable,
which wasn't possible in the previous version, where you could
only own actual expanded ownable types.
2017-09-14 00:34:06 +02:00
Daniel Kolesa 59347d4c4b eolian: include terminatable checks in ownable check 2017-09-14 00:28:32 +02:00
Daniel Kolesa 8ff2bf35fe eolian: inherit freefunc between types/typedecls 2017-09-14 00:12:46 +02:00
Daniel Kolesa e55ab81835 eolian: always implicitly validate database and remove its API 2017-09-13 23:58:47 +02:00
Daniel Kolesa 2a9be1f5be eolian: move terminated_array typecheck to validate pass 2017-09-13 23:58:47 +02:00
Daniel Kolesa a0adca9cb9 eolian: move ownable checks to validation stage 2017-09-13 23:58:47 +02:00
Daniel Kolesa 0af3254020 eolian: fix float parsing with locales with ',' decpoint 2017-09-01 16:08:10 +02:00
Daniel Kolesa 10fd3c32e8 eolian: remove c_only
Unused and of questionable value.
2017-08-30 19:46:41 +02:00
Daniel Kolesa 4a16e1d862 eolian: @extern for function pointers 2017-08-30 16:02:30 +02:00
Daniel Kolesa fd93caf4b2 eolian: remove unused variable 2017-08-30 15:34:49 +02:00
Daniel Kolesa c9d8814be1 eolian: funcptr docs in correct place, remove more qualifiers 2017-08-28 17:27:47 +02:00
Daniel Kolesa eeca57fdb0 eolian: less clumsy return type handling 2017-08-28 17:22:09 +02:00
Daniel Kolesa 700ec978cc eolian: remove unused qualifiers from func pointers 2017-08-28 17:20:18 +02:00
Daniel Kolesa 706de57b9f eolian: implement proper return type serialization
This accounts for const so that you can't generate functions
that return const values, as that makes no sense.

@fix T5024
2017-08-10 12:41:03 +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
Carsten Haitzler ead5d9cefd eo lexer - handle malloc failure with longjmp
handles possible error case nicely
2017-07-16 15:56:02 +09:00
Uma Devika d4ab6ff90a Evas and Eolian : Freed string buffer
Summary:
Summary : String buffer returned by eina_strbuf_new() is not freed in some cases

@Fix

Signed-off-by: Uma Devika <u.bodapati@samsung.com>

Reviewers: cedric, tasn, jpeg, raster, singh.amitesh

Subscribers: tanwar.umesh07, yashu21985, cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D5000
2017-07-07 13:22:53 +09: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 584e91d4f9 eolian: prepare to defer all dependency parses
Dependencies are now going to be parsed strictly after the main
file, to allow proper dependency cycle behavior in all places. For
now there is correct parsing of deferred deps but they're not
queued yet.
2017-06-09 15:57:44 +02:00
Daniel Kolesa cc7b354db2 eolian: silence a unused warning temporarily 2017-05-30 17:15:54 +02:00
Daniel Kolesa d2280f91a1 eolian: use unit in typedecl c_type_get 2017-05-30 17:15:54 +02:00
Daniel Kolesa d4c835545b eolian: pass unit in internal type serialization 2017-05-30 17:15:54 +02:00
Daniel Kolesa a5e66b3421 eolian: doc token ref resolver now takes unit 2017-05-30 17:15:54 +02:00
Daniel Kolesa 81a1d9659a eolian: type_class_get takes unit 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 4125e3f34b eolian: more expr system unit updates 2017-05-30 17:15:54 +02:00
Daniel Kolesa 2cfbd3a42b eolian: pass unit around in expr eval 2017-05-30 17:15:54 +02:00
Daniel Kolesa 308a3d91a3 eolian: use unit in all getters for typedecls 2017-05-30 17:15:54 +02:00
Daniel Kolesa 4f88aa424d eolian: use units in by_file getters for typedecls 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 52a0255e38 eolian: pass unit to alias get by name 2017-05-30 17:15:54 +02:00
Daniel Kolesa 9699d074bc eolian: pass unit to all_classes_get 2017-05-30 17:15:53 +02:00
Daniel Kolesa 45a73a0878 eolian: pass unit to class get_by_name/file 2017-05-30 17:15:53 +02:00
Daniel Kolesa 83bf422159 eolian: make all variable lookups take unit 2017-05-30 17:15:53 +02:00
Daniel Kolesa cee3b604a3 eolian: make by-file variable lookups take unit 2017-05-30 17:15:53 +02:00
Daniel Kolesa 653cf6bac3 eolian: make by-name variable lookups take unit 2017-05-30 17:15:53 +02:00
Daniel Kolesa 7da0549970 eolian: make eolian_file_parse return unit 2017-05-30 17:15:53 +02:00
Daniel Kolesa 91411c5389 eolian: units will contain multiple files 2017-05-30 17:15:53 +02:00
Daniel Kolesa 5f4c2f7b79 eolian: initial structure for units
Units are Eolian files (eo/eot). Each unit contains information
about its class, dependencies, variables and types. This allows
for saner checking to be done.
2017-05-30 17:15:53 +02:00
Daniel Kolesa 802d544265 eolian: allow future<void> for value-less futures 2017-05-04 15:27:17 +02:00
Daniel Kolesa da43c63ce1 eo: move event related structures and callback to C
We don't need to keep this in eo files anymore because the APIs
using them are now fully in C. This also allows removal of the
event callback builtin from Eolian.
2017-04-21 15:48:31 +02:00
Daniel Kolesa 84a584b313 eolian: fix buggy generation of auto/empty on properties
We only want to generate auto/empty function bodies on what is
specified inside the braces for properties, not for the whole
property.
2017-04-19 13:24:38 +02:00
Daniel Kolesa d53ed9b0db eolian: silence static analyzer null check (CID 1369018) 2017-02-10 16:56:35 +01:00
Daniel Kolesa db238d606c eolian: fix memory leak in doc tokens (CID 1367505) 2017-02-10 16:54:19 +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 47cebbc1f1 eolian: merge database_fill into parser 2017-01-20 13:43:32 +01:00
Daniel Kolesa 35a3f72d25 eolian: prevent memory leaks in db fill 2017-01-20 12:52:04 +01:00
Daniel Kolesa b178918c26 eolian: simplify database_fill by reducing the number of passes 2017-01-20 12:34:43 +01:00
Daniel Kolesa 5411dba596 eolian: add implement validation (currently for docs) 2017-01-19 15:09:07 +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 5f8172a589 eolian: add syntax for overridding docs in implements 2017-01-18 15:33:44 +01:00
Daniel Kolesa b1105da1da eolian: merge internal funcs in database fill 2017-01-16 16:00:45 +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 cb3f8304e0 eolian: change eo file syntax @virtual_pure -> @pure_virtual 2017-01-13 15:44:09 +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 078a4eef71 eolian: strict function type input checks in APIs
Strictness of various Eolian APIs has been enhanced, for example
eolian_class_function_get_by_name now won't return anything if
you request an EOLIAN_PROPERTY and the found func is just an
EOLIAN_PROP_GET, and various APIs won't accept arbitrary inputs
like EOLIAN_UNRESOLVED or EOLIAN_PROPERTY now, instead you will
need to provide EOLIAN_PROP_GET, EOLIAN_PROP_SET or EOLIAN_METHOD
explicitly.

The purpose of this is to reduce potential bugs and fix ambiguous
behavior. Thanks to use of EINA_SAFETY, appropriate errors should
be printed into terminal when an API is used incorrectly.
2017-01-12 16:56:49 +01:00
Daniel Kolesa baaa482ebf eolian: fine-grained is_auto/is_empty for implements 2017-01-11 19:26:21 +01:00
Daniel Kolesa 289287f497 eolian: remove function_is_implemented
Its design does not match current Eolian and will be replaced later.
There isn't any generator using it right now, so it's safe to remove.
2017-01-11 19:26:21 +01:00
Daniel Kolesa 6a46b08c3b eolian: improve implement error messages
By retrieving by EOLIAN_UNDEFINED, we can provide more concrete error messages
thanks to the logic later.
2017-01-11 16:45:53 +01:00
Daniel Kolesa 85fbc333dd eolian: enforce specification of both get and set in prop impls
Now you can't use the same syntax as you would for a method to
implement a property as whole, instead you need to specify the
getter and/or setter explicitly. This is to allow parent classes
to expand their properties without altering behavior of the child
classes.
2017-01-11 16:38:41 +01:00
Daniel Kolesa 5355699859 eolian: stricter implement/constructor verification
The system now verifies whether the class of an implement or
constructor exists within the inheritance hierarchy. It also
properly checks duplicates everywhere and prints better error
messages.
2017-01-05 16:00:14 +01:00
Daniel Kolesa 4fddc11e64 eolian: correctly set the empty/auto flags in implements 2017-01-02 16:25:26 +01:00