Commit Graph

26 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
Xavi Artigas edae5021bc efl-mono: Typos in generated code comments
These comments end up in the API reference docs, so typos look bad.
2018-11-05 11:14:37 +01:00
Lauro Moura 4c53151096 efl-csharp: Fix event callback removal.
Summary:
Use the native event loaded from dlsym directly instead of wrapping it
in a Event_Description structure.

Fixes: T7355

Reviewers: felipealmeida, vitor.sousa, segfaultxavi

Reviewed By: vitor.sousa

Subscribers: cedric, #reviewers, #committers

Tags: #efl_language_bindings

Differential Revision: https://phab.enlightenment.org/D6981
2018-09-05 14:47:19 -03:00
Lauro Moura 5e107aa19d efl-csharp: Make sure efl_finalize overrides are callable
Summary:
efl_finalize override is called inside efl_add_end. Previously by this
time the constructor still hadn't saved the C# wrapper handle into the
Eo instance private data, to be recovered in the static delegates that
call the C# overrides.

This commit just changes the order to save the C# handle *before*
calling efl_add_end.

Test Plan: added unit test to be run with make check

Reviewers: felipealmeida, vitor.sousa, Jaehyun_Cho

Reviewed By: vitor.sousa

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6956
2018-09-05 14:19:39 -03:00
Lauro Moura a9efc38885 csharp: Fix event registration in constructor.
Summary:
The binding user should be able to register to events inside the initialization callback given to the constructor.

Fixes T7346

Reviewers: segfaultxavi, felipealmeida, vitor.sousa

Reviewed By: segfaultxavi, vitor.sousa

Subscribers: cedric, #reviewers, #committers, zmike

Tags: #efl

Maniphest Tasks: T7346

Differential Revision: https://phab.enlightenment.org/D6908
2018-08-24 11:34:34 -03:00
Lauro Moura a8b7833a48 efl_mono: Fix efl_add_internal_end call.
Summary:
It was missing setting the 'is_ref' parameter to 1 to mirror the
internal_start call.

Test Plan: make check

Reviewers: cedric

Subscribers: #committers, zmike

Tags: #efl

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

Reviewed-by: Cedric BAIL <cedric@osg.samsung.com>
2018-05-25 10:01:09 -07:00
Lauro Moura c4572d3f79 efl_mono: Fix events after Event_Description rename. 2018-05-23 17:33:47 +02:00
Lauro Moura c8fbc31ee2 efl_mono: Start generating eina future in eolian_mono.
Summary:
Besides the normal methods returning Futures, we now generate
a wrapper with the "Async" suffix. This wrapper returns a
Systems.Threading.Tasks.Task which can be awaited on and reflect the
status of the Future.

When an eina.Future fails with ECANCELED, TaskCanceledException is
raised in the Task. Otherwise, an efl.FutureException(eina.Error) is
raised.
Depends on D6174

Reviewers: felipealmeida

Reviewed By: felipealmeida

Subscribers: cedric, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6175
2018-05-17 16:56:31 -03:00
Lauro Moura 2b8cbfe2f4 efl_mono: Add documentation tag in part decl
Summary: Depends on D6170

Reviewers: felipealmeida

Reviewed By: felipealmeida

Subscribers: cedric, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6171
2018-05-17 16:56:02 -03:00
Lauro Moura 4636d6e0eb efl_mono: Change generated classes naming scheme
Summary:
Now the generated classes use an approach more familiar to C#
developers:

Interfaces: efl.Object -> efl.IObject

Concrete (implementation) classes: efl.ObjectConcrete -> efl.Object.

During this change, some methods that could clash with the
implementation class name (CS0542) had the prefix "Do" added (like in
efl.Duplicate.Duplicate() and efl.Pack.Pack()).
Depends on D6049

Reviewers: felipealmeida, vitor.sousa

Reviewed By: vitor.sousa

Subscribers: cedric

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6050
2018-05-03 18:04:41 -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 429d7510b0 efl_mono: Reorganize utility functions.
Summary:
Blacklist functions are all in the header/namespace blacklist.

Helper functions returning strings (names) are in the name_helpers
header. They act somewhat like "mini-generators".

Helpers.hh was left with other kind of helper functions (checks, etc)
that do not return strings.
Depends on D5992

Reviewers: felipealmeida

Reviewed By: felipealmeida

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D5993
2018-04-26 10:55:18 -03:00
Lauro Moura 628e5ab950 efl_mono: Use PascalCase in events
Summary:
To deal with events with the same name as some methods (Del, Invalidate,
etc), the suffix Evt was added.

Thus, now we use

obj.ButtonClickedEvt += callback;

Instead of

obj.BUTTON_CLICKED += cal

The argument classes use the same scheme, being called <Evt name>_Args.
Depends on D5991

Reviewers: felipealmeida

Reviewed By: felipealmeida

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D5992
2018-04-26 10:55:18 -03:00
Lauro Moura 87c58a460a efl_mono: Add namespace on helpers.
Make it easier on finding where those functions are coming from.
2018-04-12 21:23:42 -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
Felipe Magno de Almeida af80ec3716 efl-mono: Fix using efl_add_ref instead of efl_ref 2018-04-03 17:26:52 -03:00
Felipe Magno de Almeida be06c27762 efl-mono: Fix compile flags, .config files and class_name in description 2018-04-03 14:01:29 -03:00
Lauro Moura f9586a831b csharp: Add support for efl parts as Properties
Instead of
   var bg = efl.ui.Background.static_cast(myobj.Part("background"));

Now do
   var bg = myobj.Background;

Also a couple helper functions were added.
2018-03-20 16:50:30 -03:00
Lauro Moura 42f2aefbaf eolian_mono: Add underlying pointer to ToString
It'll make easier to track where an object is coming from.
2018-01-25 15:27:05 -03:00
Lauro Moura eaf41d9bce eolian_mono: Fix event argument for strings 2018-01-25 15:27:05 -03:00
Lauro Moura 4cd760c9a7 eolian_mono: Fix visibility of generated events
Protected members do not make sense in sealed classes like the Concrete
ones.

Also document the placeholder field in extern structures.
2018-01-25 15:27:05 -03:00
Felipe Magno de Almeida 481853e1ed efl-mono: Fix using right description pointer in event registration 2017-12-20 19:57:17 -02: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
Lauro Moura 3861f8b01d eolian_mono: Fix build after Eolian_State
Summary:
eolian_mono now properly fills Eolian Unit when calling eolian_cxx
classes and functions.

Reviewers: felipealmeida

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D5614
2017-12-06 19:11:13 -03:00
Lauro Moura d93e9ff286 eolian_mono: Added code for eolian_mono generator
Based on the eolian_cxx library generators. Buildsystem files will come
in a future commmit.
2017-12-04 15:47:50 -03:00