Summary:
Previously, the type_impl and marshall_type_impl generators relied on a
type mismatch in the match table to fallback to the else branch in the
match check to actually print the type string. This was achieved by
adding the " " prefix to the type.
This commit changes this behavior to invoke a proper visitor just to
print and makes both generators return trimmed type strings.
This will help conforming to the C# coding conventions.
Test Plan: run test suite
Reviewers: felipealmeida, vitor.sousa
Reviewed By: felipealmeida, vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8441
Summary:
Conforming to C# coding conventions.
For properties, now we only generate a wrapper if its name does not
clash with the name of the class that would be implementing it.
Fixes T7751
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7751
Differential Revision: https://phab.enlightenment.org/D8397
Summary:
Only the number was being used, and in places were it should not be.
Now the Since version appears only in <summary> tags, with proper
context (Since EFL 1.22).
Test Plan: make && gendoc should produce DocFX pages which make more sense.
Reviewers: lauromoura, zmike, bu5hm4n
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8012
Summary:
To better adhere to C# conventions and state it is for generated code
only.
Ref T7702
Reviewers: vitor.sousa, segfaultxavi
Reviewed By: segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7702
Differential Revision: https://phab.enlightenment.org/D8369
Summary:
The nativeInherit field was replaced by using a C# attribute to declare
the native class.
Ref T7702
Reviewers: segfaultxavi, vitor.sousa
Reviewed By: segfaultxavi, vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7702
Differential Revision: https://phab.enlightenment.org/D8368
Summary:
The `GetEflClassStatic` method for interface is in their Concrete
sidekick.
Previously, passing a valid Eo interface as a type caused the binding to
complain that `Type is not an Efl.Object`.
Test Plan: run test case
Reviewers: vitor.sousa, felipealmeida
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8360
Summary:
In order to work around an issue with Efl.App, which is stable but
inherits from Efl.Core.Command_Line, @beta interfaces/mixins in the
inheritance chain are simply skipped.
Also changed the class used int test for inheritance from C#
Efl.Loop is stable but internally it uses a @beta class as argument to
its Register() method in the constructor. When instantiating a
user-defined C# subclass, the binding calls the C# override in the
NativeInherit class and the marshalling fails as no code is generated
for the beta class.
Also moved Efl.Part test to a beta class. Efl.Part is still beta.
Regarding parts, they are skipped if its class is @beta too.
Also rejected all elm_* files in elm public eo files. They should get
back in as they are converted to Efl.Ui.* api. An exception is
elm_interface_scrollable.eo, as efl_ui_panel depends on it.
Fixes T7730
Test Plan: Run tests
Reviewers: vitor.sousa, segfaultxavi, felipealmeida, cedric, bu5hm4n, zmike
Reviewed By: vitor.sousa
Subscribers: #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7730
Differential Revision: https://phab.enlightenment.org/D8268
Summary:
This removes all Eolian API that deals with handling of legacy
code. It also removes the code using it in the generator as well
as bindings, but for now keeps generation of .eo.legacy.h types,
as there are still instances in our codebase where things are
otherwise broken. We can remove the rest once that is resolved.
Reviewers: zmike, cedric
Subscribers: #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8255
Summary:
Could trigger bogus generation with phantom calls thinking beta is
enabled from the want_beta field of the options struct.
Reviewers: vitor.sousa
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8151
Summary:
Fixes compilation after Efl.Ui.Win parameter changes.
Also removed an unused var and now we pass the beta option to the eolian
mono invocation for the tests.
Fixes T7723
Reviewers: segfaultxavi, felipealmeida, vitor.sousa
Reviewed By: segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7723
Differential Revision: https://phab.enlightenment.org/D8150
Summary:
This commits adds dotnet as a supported C# platform for EFL# bindings.
Due to differences between Mono and Dotnet regarding DllImport, the
bindings now are using an imperative approach to load the function
pointers through the NativeModule and FunctionWrapper classes. These
classes handle the dlopen/LoadLibrary and dlsym/GetProcAddress calls.
Also, the previous caching of non-owned strings returned to native code
was removed until further memory checks.
We also had to create workaround for bool and chars in Structs for C#
marshaling. Going through System.Byte instead and Marshaling manually
to their respective types.
In order to actually build efl_mono.dll with dotnet right now,
issue #4782 from Meson should be fixed to make it properly detect and
used the Dotnet compiler. Also use "-Ddotnet=true" when running meson.
Fixes T7394
Reviewers: felipealmeida, vitor.sousa, bu5hm4n
Reviewed By: vitor.sousa
Subscribers: cedric
Tags: #efl
Maniphest Tasks: T7394
Differential Revision: https://phab.enlightenment.org/D8069
Efl.Class (in practice, the return from the *_class_get() functions) can
be used as argument to functions, like in Efl.Object.provider_find and
Efl.Ui.Widget_Factory.item_class(get/set).
This commits adds support by representing Efl.Class instances
as System.Type in the C# API, allowing someone to do things like:
`factory.ItemClass == typeof(MyFramework.MyButton)`
It also supports user-defined classes that inherit from efl classes.
Summary:
Mono's old compiler (mcs) accepts LL as suffix for longs while Roslyn
(csc) is strict, allowing only a single L.
Test Plan: Run tests
Reviewers: vitor.sousa, felipealmeida
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8061
Summary:
Support for global constant variables has been recently added to the C# bindings.
This patch fixes doc references so they use the proper name.
This brings the mono doc warnings from 71 down to 29.
Depends on D8048
Test Plan:
Just build and see less doc warnings when building the C# bindings.
Also, doc refs to constants are links now.
Reviewers: lauromoura, vitor.sousa
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8051
Summary: To be added again in a later release after rework in Eolian
Reviewers: q66, vitor.sousa, felipealmeida
Reviewed By: q66
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8056
Summary: Using a simple wrapper as event parameters are not ownable.
Reviewers: vitor.sousa
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7981
eolian_mono now generates properties (which simply wrap the setter and getter
methods when both ara available), but they were missing docs, because
properties require a special <value> tag instead of <returns> or <param> which
we are already implementing.
This commit adds <value> tags only if docs can be retrieved from the setter or
the getter methods.
Until this commit eo did class functions as part of the vtable, which
enabled those functions to be overwritten in classes inheriting another
class. However in task T7675 we decided that this is not really good for
bindings, as most OOP languages do not support this sort of feature.
After this commit eolian realizes class function completly outside of
the vtable, the c-symbol that is the class funciton is now just directly
redirecting to a implementation, without the involvement of the vtable.
This also means a change to the syntax created by eo:
Calling before:
class_function(CLASS_A);
Calling after:
class_function();
Implementation before:
class_function(const Eo *obj, void *pd) { ... }
Implementation after:
class_function(void) { ... }
This fixes T7675.
Co-authored-by: lauromauro <lauromoura@expertisesolutions.com.br>
Reviewed-by: Daniel Kolesa <daniel@octaforge.org>
Differential Revision: https://phab.enlightenment.org/D7901
Summary:
It was mistakenly being called as static functions.
Fixes T7619
Test Plan: See attached testcase.
Reviewers: segfaultxavi, bu5hm4n, vitor.sousa
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7619
Differential Revision: https://phab.enlightenment.org/D7904
Summary: The constructing method is not used anymore after D7789 landed.
Test Plan: run tests
Reviewers: segfaultxavi, felipealmeida, vitor.sousa
Reviewed By: segfaultxavi, vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7875
This fixes intermittent errors in C# classes with inheritance from Eo,
just like a lot of unit tests.
Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es>
Differential Revision: https://phab.enlightenment.org/D7683
Summary:
For autotools, use --enable-csharp-beta to enable the generation of beta
methods and properties, for meson use -Dmono-beta=true.
By default, no beta method or property is generated.
Reviewers: woohyun, segfaultxavi, bu5hm4n, lauromoura
Reviewed By: woohyun
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7637
Summary:
Previously, any unhandled Eina_Error would cause an exception
to be thrown when the control returned to C#.
This commit changes this behavior to only raise it when an exception
went unhandled from a C# callback back to C, like in an event handler,
for example.
Test Plan: run tests
Reviewers: segfaultxavi, Jaehyun_Cho, felipealmeida
Reviewed By: Jaehyun_Cho
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7537
Summary:
Previously, we just converted through PtrToStructure, which didn't have
the full marshalling info converting from the internal one to the
external.
This fixes the usage of the Efl.Loop.arguments event.
Also renamed the ToExternal methods to ToManaged, to make clearer that
the output struct is the one intended to be used from the managed code.
Also fixed a minor styling in the generated code (making it easier to be
inspected).
Depends on D7538
Reviewers: segfaultxavi, felipealmeida, bu5hm4n
Reviewed By: bu5hm4n
Subscribers: bu5hm4n, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7539
Summary:
"type" in .eo is converted to "struct" in .eo.cs.
Since the type name in .eo is the same with the struct name .eo.cs,
'_' is removed from the converted struct in .eo.cs for C# naming
convention.
For example, Efl.Callback_Priority is defined in efl_object.eo and
the name is converted to Efl.CallbackPriority in efl_object.eo.cs.
Efl.Access.StateSet in workaround.cs causes duplicated definition
with this patch so Efl.Access.StateSet in workaround.cs is removed.
Test Plan: Compile with autogen.sh --enable-csharp-bindings
Reviewers: lauromoura, segfaultxavi, felipealmeida
Reviewed By: felipealmeida
Subscribers: segfaultxavi, cedric, #reviewers, #committers, woohyun
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7597
Summary:
Event wrappers have a comment saying:
///<summary>Event argument wrapper for event XxxEvt</summary>"
This patch simply adds a link to that comment:
///<summary>Event argument wrapper for event <see cref="Fully.Qualified.XxxEvt"/></summary>"
Test Plan: Generate the C# files and enjoy fully-linked doc comments for event wrappers.
Reviewers: lauromoura
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7525
Summary:
Some EO docs include () after a @method reference (some don't).
When the method reference is redered by DocFX it already includes
the trailing parenthese (and it even includes the parameter types),
so it looks very weird: Efl.Gfx.Stack.Raise()()
This patch removes the "()" string from any text comment following
an @ reference.
Test Plan:
Check DocFX docs for Efl.Gfx.Stack.Lower before and after this patch.
There are references to other methods which include the double parentheses.
Reviewers: lauromoura
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7504
Summary:
This allows them to be nicely rendered by IDEs and automatic
documentation generators like DocFX.
The conversion includes things like turning $name to <c>name</c>
or solving references to objects, which in turn requires converting
from EO object names to C# names.
It uses the same helper methods used to generate the C# object names,
so if these change in the future, the references in the comments
will change too.
Additionally, this patch fixes some minor bugs, like <para> tags
outside <summary> tags, misspelled <returns> tags or missing <returns>
documentation for getter methods.
Fixes T7453
Reviewers: lauromoura, vitor.sousa
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7453
Differential Revision: https://phab.enlightenment.org/D7467
Previously, "Type" was used with "using System".
However, it caused ambiguity if some classes had "Type" property.
Therefore, "System.Type" is used explicitly to remove ambiguity.
Summary:
After the new API, the virtual wrapper classes (*NativeInherit) just
declared the wrappers for the current class. But as they didn't have any
inheritance information, reimplementing methods from a parent Eo class
wouldn't work. (e.g. Efl.Ui.Button reimplementing Efl.Object
FinalizeAdd).
This commit changes these NativeInherit classes to mimic the inheritance
chain of their regular/abstract counterparts, reusing the virtual
wrapper implementations.
In order to access the correct Eo class created, the methods on it were
changed from static to instance methods. The instance will be held as a
class member of the regular/abstract API class to keep the delegates
alive and allow getting C Function pointers from them.
The class_initializer method was also split in two. The method
collecting the wrapper delegates was extracted in order to call the
parent ones.
Also avoid exception in cached strings queries as TryGetValue requires
non-null keys.
Test Plan: Run test suite.
Reviewers: vitor.sousa, felipealmeida
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7460
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
Summary:
Too many warnings about missing docs in generated code makes difficult
to see "real" warnings.
Reviewers: vitor.sousa, segfaultxavi
Reviewed By: segfaultxavi
Subscribers: segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7135
Summary:
The efl.Event struct has a class field that gets generated normally but
can be problematic when marshalling the struct back from C to C#. The
compilation works fine but when C# runtime tries to marshall the C data
(e.g. accessing the Event.Info field), it becomes erratic, either
complaining about missing references to object or even segfault.
This commit changes the event handling code to use the
"Event_StructInternal" struct as is already done when receiving structs
from C code.
In order to work with other assemblies, the _StructInternal fields were
made publit too.
Fixes the events tests and the text editor app.
Test Plan: make check and run the text editor app in examples repo.
Reviewers: segfaultxavi, vitor.sousa
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7106
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
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
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
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>
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
Summary:
Promise/Future cleanup:
In the promises, we use a wrapper Eina_Promise_Cancel_Cb to
invalidate the wrapper if it ever gets cancelled from outside. When
invalidating from C#, we can do it directly.
For the futures, likewise, in order to be able to invalidate the
wrapper when the chain it belongs to gets resolved we then() an
internal future with a callback to invalidate the wrapper we return to
C#. The return of this intermediate then() is the future we actually
return to the user.
Also added ECANCELED to the list of default eina.Errors
Depends on D6173
Reviewers: felipealmeida
Reviewed By: felipealmeida
Subscribers: cedric, zmike
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D6174
Summary:
eina.Value.Empty now means that we have an zeroed (empty) eina value.
For optional values that are empty use eina.Value.OptionalEmpty.
This was required to support the empty values passed with
EINA_VALUE_EMPTY in some Ecore futures.
Also, returning an eina_value by value is not supported in eolian
for safety reasons, so we removed some tests that tried to use this
behavior.
Depends on D6171
Reviewers: felipealmeida
Reviewed By: felipealmeida
Subscribers: cedric, zmike
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D6172
Summary:
Event argument was getting its type name from another path, different
from the type_generator.
In later commits the other functions from name_helpers should use the
type_generator too.
Reviewers: felipealmeida
Reviewed By: felipealmeida
Subscribers: cedric, zmike
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D6170
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
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
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
Summary:
Using a type visitor scheme similar to type and marshall_type, to ease
increasing coverage for other types if needed.
Also, changed the filter functions for those selections to check for the
full name of the regular_type_def, allowing a better specificity of the
name selections. This fixes things like "Eina.Error", which was
conflicting with Efl.Image.Load.Error when we compared only the last
name. It didn't appear before as Load.Error only appears in a
Efl.Image.Load event.
Depends on D5996
Reviewers: felipealmeida
Reviewed By: felipealmeida
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D5997
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
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
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
Summary: It was a reminiscing bit from the c++ generator.
Reviewers: felipealmeida
Reviewed By: felipealmeida
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D5991
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).
Function pointers now go through the same argument marshalling pipeline
as normal functions.
This will enable interfaces like Efl.Ui.Format to work properly.
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.
In general, ptr(struct) parameters behavior depends whether the
parameter has the @owned modifier or not.
If there is no @owned parameter (meaning no transfer of ownership
happens) and it is a "complex" struct, with reference type fields
(like strings), the struct is converted to the respective
<Struct>Internal struct and passed with "ref" to the DllImport'd
function. For @in parameters, after the function it returns, this
intermediate struct is converted to the public struct type and
assigned to the original parameter, updating it to the external
world.
When we have ownership transfers, the structure is copied to unmanaged
memory and given to the callee. We can't send managed memory directly as
the callee may try to free it. On the managed side, the original struct
is left to be garbage collected normally.
Summary:
C# does not have a literal form for structs (like C++'s {} aggregate
initialization). Before this commit the user would need to explicitly
instantiate a struct and assign the required values to it, like:
eina.Size2D size;
size.W = width;
size.H = height;
widget.SetSize(size);
As a workaround, this commit generates helper constructor with
parameters corresponding to the struct fields in the order they are
declared. These parameters have default values if one does not want to
explicitly initialize all fields directly. With these constructs, the
above code could be translated to:
widget.SetSize(new eina.Size2D(width, height));
It should be noted that the constructed struct will live on the managed
memory (GC) instead of the stack.
Test Plan: run "make check"
Reviewers: felipealmeida
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D5838
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
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.
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.
Efl_Ui_List doesn't properly define, as it should, the class Efl_Ui_List_SegArray. This workaround allows the mono binding compilation in spite of this.
Mono's JIT fails to generate function pointer for delegates with empty
structs in the signature, leading to those mini-amd64.c crashes on empty
fields.
This commit generates a placeholder IntPtr field in empty structs.