Commit Graph

52 Commits

Author SHA1 Message Date
Lauro Moura 3623753c1d csharp: Change to new class API.
Summary:
As discussed in T7204:

- Eo Interfaces/mixins -> C# Interfaces with concrete class
  implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods

Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.

Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.

Summary of API Changes:

- Merged Inherit/Concrete classes. (These suffixes disappear from
  regular classes).
- Interface still have implementations with 'Concrete' suffix for when
  they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
  naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass

Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)

Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.

Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.

Still need to work:

- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
  from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
  the interface and implemented "namespaced" in the classes,
  requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
  commit.

Depends on D7260

Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho

Reviewed By: vitor.sousa

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T7451, T7336

Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 21:29:48 -02:00
Daniel Kolesa 14ce54c303 eolian: implement new inherit behavior
Eolian now separates 'parent' and 'extensions'. For regular
classes, parent is the first item in the inherits list and
extesions is the rest. For interfaces and mixins, parent is
NULL and extends is the inherits list.

The reason for this is the separation of them in syntax in near
future. It also slightly changes the behavior; since for interfaces
and mixins, parent is always NULL now, you can freely inherit from
all types of classes without needing to manually put an interface
type as the first item of the inherits list.
2018-11-23 13:57:07 +01:00
Lauro Moura f1fddf5c74 cxx: Remove libeolian_cxx dependency on eo_cxx
Summary: Fixes T7324

Reviewers: felipealmeida, bu5hm4n, zmike

Reviewed By: felipealmeida, bu5hm4n, zmike

Subscribers: segfaultxavi, cedric, #reviewers, #committers, zmike

Tags: #efl

Maniphest Tasks: T7324

Differential Revision: https://phab.enlightenment.org/D6881
2018-08-21 14:21:43 -04:00
Lauro Moura da6f5932f1 efl_mono: Support type aliases.
Summary:
Due to the absence of typedef from C#, we generate thin structs with
implicit operators to allow reference the data from their typedef'd name
from C#.

The other alternatives would be always converting to the lowest base on
the alias stack (losing the meaningfulness of the typedef name) or using
the 'using' directive. The latter has the restriction that it makes an
alias visible only in the file they are declared.

Reviewers: felipealmeida, cedric, segfaultxavi

Reviewed By: segfaultxavi

Subscribers: zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6157
2018-05-11 11:01:59 -03:00
Lauro Moura c9dd86579f efl_mono: More uniformization of the handling of names
Summary:
Uses a common helper to open and close namespaces, to get the managed
and unmanaged name of things, the interface, concrete and inherit class
names, etc.

eolian_cxx: Add namespace information to func_def, as it'll avoid
eolian-cxx clients dealing with the eolian C api directly when trying
to access a function pointer namespace.
Depends on D6048

Reviewers: felipealmeida, vitor.sousa

Reviewed By: vitor.sousa

Subscribers: cedric

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6049
2018-05-03 18:04:41 -03:00
Lauro Moura a413914c18 efl_mono: Move event generators to its own header.
Summary:
Making it easier to share code between self and inherited events.

During this move, the namespace and keyword headers were merged into the
name_helpers header.

Also added the first seed of a generic namespace reducer function,
to be used by other functions in later commits.
Depends on D5994

Reviewers: felipealmeida

Reviewed By: felipealmeida

Subscribers: segfaultxavi, cedric

Differential Revision: https://phab.enlightenment.org/D5995
2018-04-26 10:55:18 -03:00
Lauro Moura 65f868786a efl_mono: Proper support for @class methods.
Previously, class methods were implemented as regular instance methods.
This commits generates C# static methods for @class methods on the
*Concrete classes (and their childs).
2018-04-12 21:23:42 -03:00
Lauro Moura 9a6dd32cb1 eolian_cxx: Fill documentation of part_def. 2018-03-20 16:50:30 -03:00
Lauro Moura 38bf8cc923 eolian-cxx: Add helper method to get all parts
Line get_all_methods, gets everything from the inherits too.
2018-03-20 16:50:30 -03:00
Lauro Moura 78251aa0d2 eolian_cxx: Add 'unknown' to parameter direction
It'll be used in eolian_mono as the 'direction' of return types in some
helper functions.
2018-03-16 11:12:49 -03:00
Daniel Kolesa 1f4d919cf9 eolian: update type/var name APIs 2018-03-12 16:28:28 +01:00
Daniel Kolesa edcd81ee49 eolian: update class name APIs 2018-03-12 16:03:37 +01:00
Daniel Kolesa 1117a67818 eolian cxx: remove usages of obsolete file_get APIs 2018-03-08 22:53:51 +01:00
Lauro Moura 6f092071ac eolian cxx,csharp: Update after eolian changes
Closes D5829.
2018-03-02 23:58:20 +01:00
Jean-Philippe Andre 9ceb9419af cxx: Fix a trivial warning 2018-01-19 15:59:21 +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 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
Thiep Ha 360ce182ef eolian_cxx: support multiple function pointers 2018-01-12 18:45:40 +09:00
Lauro Moura 46b202b86c eolian-mono: Add documentation generation support
This commit adds the "documentation" generator, which gets the
documentation_def attribute of the given item and generates xml comments
to be exported by MCS.

For items requiring some customization of the generated comments (e.g.
functions and its parameters), the helpers to generate the preamble
(summary), body (paragraphs) and epilogue (currently just the @since
tag) were added.

Currently we do not support converting Eolian references into xmldoc
references.

As we explicitly generate Get/Set methods for properties, for now the
generator tries to get the get/set specific documentation first. If it
is not present, fallback to the common docs.

Later this could be changed to generate the common one as paragraphs of
the Get/Set.

Also some generated code like the wrappers for calling C# methods
from C can be private. This will cleanup the introspection results
and warnings when generating documentation.

Due to this visibility change, the binbuf tests had to be changed
to add redirect calls to the native methods instead of directly
calling the DllImport'd methods.
2017-12-20 19:57:17 -02:00
Vitor Sousa acd99be98b efl_mono: tests and better support for structs, plus some other fixes
Fix several integer binding type deduction based in its size on C.

Generation for function pointers no longer use modified argument name
which is different from the parameter name.

New generation context for structs.

bool from UnmanagedType.I1 to UnmanagedType.U1 (correct use
inside structs according to mono documentation).

byte (signed char) and int8 now is correctly represented by
sbyte in C#.

Check parameter direction in some out generators in parameter.hh.

Add efl_libs.csv to gitignore.

Make eina.Value pointer constructor public.

Add missing fields to efl.kw_event.Description struct.

Remove eina.File workaround (let struct gen handle it).

Remove is_function_ptr bool from regular_type_def and
add a typedecl_type enum to it. Also add some helper
methods for easier comparison.

Left some test cases commented for when pointer parameters
are properly working.
2017-12-15 22:26:29 -02:00
Daniel Kolesa 18e18ca74c eolian: remove remaining global state (+ modify APIs accordingly) 2017-12-15 17:11:11 +01:00
Lauro Moura c5ff7f0f46 eolian_cxx: Fix Eolian_Unit support
Summary:
Unit is now stored in klass_def, parameter_def and function_def for
future calls to the Eolian API.

Reviewers: felipealmeida, jpeg

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D5613
2017-12-06 19:10:40 -03:00
Jean-Philippe Andre 8cdb3184f8 cxx: Fix compilation after merge
This resolves a few issues and brings back the experimental features.

Also, disable some of the ugliest experiments:
 - manual function overrides,
 - define APIs only in eo_cxx namespace

Some APIs are generated behind EFL_CXXPERIMENT (eg. event_name_cb_add or
some weak pointer stuff). I believe they are useful but would like to
make sure there are no serious drawbacks with generating those.
2017-12-05 15:01:45 +09:00
Jean-Philippe Andre 6653b9e2b1 cxx: Implement support for @class static functions 2017-12-05 10:17:02 +09:00
Jean-Philippe Andre 5901b4601e cxx: Implement support for parts
This generates methods like this:

  Part_Class part_name() const;

Which can then be used like:

  slider.indicator().format_string_set("%1.1f");
2017-12-05 10:15:40 +09:00
Jean-Philippe Andre 03af836332 cxx: Use set for forward classes
This avoids duplication. Not very important as there are FWD_GUARD
macros anyway.
2017-12-05 10:14:03 +09:00
Jean-Philippe Andre 5425baa906 cxx: Add support for function pointers
This was tested on the function pointer Efl.Ui.Format_Func_Cb
2017-12-05 10:14:03 +09:00
Lauro Moura e6dd831f7e eolian_cxx: Many changes for the C# bindings
- Added helper function to get all methods of a given class (local and
  inherited methods)
- Add filename information to klass
- Added new defs: enum, value (currently only integers), struct
- Generator refactoring
- Eolian C compatibility
2017-12-04 15:47:49 -03: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 4bae2a7385 eolian: merge REGULAR and COMPLEX types 2017-09-22 17:46:02 +02:00
Felipe Magno de Almeida a7649a7897 eolian-cxx: Add workaround for function pointer types 2017-08-22 22:40:13 -03:00
Daniel Kolesa 9738a6e3d2 eolian cxx: fix the remaining type errors 2017-08-10 14:10:52 +02:00
Daniel Kolesa 22e27ab045 eolian cxx: fix build after eolian type api change 2017-08-10 13:38:38 +02:00
Felipe Magno de Almeida c40ecb6282 eolian-cxx: Add constructor with default argument
Fixes compilation error in clang. T5588
2017-06-18 20:02:10 -03:00
Felipe Magno de Almeida 0fcee227aa eolian-cxx: Fix C++ generation errors with handle opaque types 2017-06-18 11:31:43 -03:00
Felipe Magno de Almeida 6dcc8dd07f eolian-cxx: Fixed compilation error after Eolian_Unit type introduction 2017-06-02 18:27:46 -03:00
Felipe Magno de Almeida 891376f42a eolian-cxx: Add all cases in switch to remove warning 2017-01-18 23:07:46 -02:00
Felipe Magno de Almeida 679bbc5cab eolian-cxx: Do not call eolian_function_scope_get with EOLIAN_PROPERTY 2017-01-18 23:06:51 -02:00
Felipe Magno de Almeida a1f2db255b cxx: Modify how to generate C++ headers and allow cyclic dependencies
Allow cyclic dependencies in generated C++ headers by changing order
of includes and creating forward declarations.
2017-01-18 22:47:04 -02:00
Felipe Magno de Almeida e64327bacc eolian-cxx: Add std::move to member variable initialization
CID 1361231
2016-12-20 16:06:58 -03:00
Felipe Magno de Almeida 45e1ccf312 eolian-cxx: Remove EOLIAN_TYPE_POINTER enumeration 2016-11-10 15:20:36 -02:00
Felipe Magno de Almeida 137dd4864d eina-cxx: eolian-cxx: Fix correct usage of is_eolian_object traits 2016-11-03 17:59:20 -02:00
Felipe Magno de Almeida dbed78ad3b eina-cxx: Moved variant to eina C++ 2016-09-14 00:33:22 -03:00
Lauro Moura 16986ffc7a eolian_cxx: Fix behavior with explicit void return
Only perform the single value/return type substitution on properties if the
void return type is implicit (i.e. NULL return from function_return_type_get),
following the eolian-C implementation as we use the generated headers.

Also update example after Eo-Efl changes.
2016-08-17 20:54:27 -03:00
Felipe Magno de Almeida 8906998ef2 eolian-cxx: Add support for ref parameters and correct ownership handling 2016-06-14 22:44:02 -03:00
Jean-Philippe Andre c6dfdeb0c8 cxx: Add support for protected and beta events
The code is horrible, pardon my C++.

Note: I guess @protected should also change the scope from
public: to protected: but that's another problem. Here I'm only
trying to fix the build while still introducing @beta and
@protected flags.
2016-06-14 16:27:42 +09: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 7b63ecf4f6 eolian_cxx: Fix build after scope_get changes 2016-06-09 18:53:31 -03:00