Summary:
`Efl.Event` became a builtin type that is no longer declared in `efl_object.eo`,
and therefore it is no longer automatically generated in EFL#.
Given that, we define a struct manually to reflect the memory layout of the
native struct.
Containers of value types are now allowed in eolian, so tests that were disabled
because of the restriction on `ptr` were re-enabled using the plain type.
But since these containers have just arrived, handling of ownership for value
types is currently undefined in bindings.
Hence, tests that used `ptr(int) @owned` as elements were left disable.
This will be solved in a future patch.
`void_pr` is now deprecated, so we remove it from tests also.
Reviewers: q66, segfaultxavi, lauromoura, felipealmeida
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9417
Remove a compilation warning about an unsupported warning category for g++ 7.x.
A `#pragma` directive was used to suppress a `-Wcast-function-type` warning
in g++.
Versions older than 8.x do not have this warning category and raises a warning
because of this directive.
Now this directive is only enabled for g++ version 8.x or newer.
Binbuf is like strbuf and allows not using the Eina opaque wrapper
now, which will remove some ptr(). And event translates to
Efl.Event because otherwise there would be no way to get rid
of void_ptr.
Summary:
Remove almost all the compilation warnings from C++ code. Only explicit
warnings using the `#warning` preprocessor directive remain.
Some warnings had to be suppressed with `#pragma` directives because the
behavior they were warning about is intended in some specific places.
Code comments were added in such situations.
Added a generator that creates `#pragma` directives in order to suppress
warnings in all generated C++ headers.
Currently `-Wignored-qualifiers` is the only warning category being suppressed.
The innocuous const qualifiers that it points are inoffensive and have
no effect in compilation at all.
They are also hard to track in generation since they can emerge from different
types in many places.
To ease the generation of the warning suppressors an utility constructor was
added to `efl::eolian::grammar::attributes::unused_type`.
Add constructors to `eolian_mono::class_context` to default initialize its
internal string and avoid field initialization warnings.
Test Plan: `meson test`
Reviewers: lauromoura, felipealmeida, zmike, segfaultxavi
Reviewed By: zmike
Subscribers: cedric, #reviewers, #committers
Tags: #efl_language_bindings
Differential Revision: https://phab.enlightenment.org/D9275
Summary:
When creating a new Value with any IEnumerable of a supported type, the IEnumerable
will be copied into an Eina.Value of type EINA_VALUE_ARRAY_TYPE.
Similarly, `Unwrap()` on a Eina.Value container will create a new
System.Collections.List<T> and return it.
Depends on D9272
Reviewers: felipealmeida, vitor.sousa, segfaultxavi
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl, #expertise_solutions
Differential Revision: https://phab.enlightenment.org/D9273
Summary:
The user can construct an `Eina.Value` from a plain C# `object`, using
reflection to get the correct type of object and construct the correct
underlying C value.
Also added the `Unwrap()` method to return a C# object representing the
wrapped value.
Both operations are useful when using `Eina.Value` to
Get/Set values from `PropertyInfo` targets as in
```
var v = new Eina.Value(propInfo.GetValue(sourceObj));
...
propInfo.SetValue(targetObj, v.Unwrap());
```
Currently, containers are not supported. It will be added in a following
commit.
Depends on D9270
Reviewers: felipealmeida, vitor.sousa, segfaultxavi
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9272
Summary:
Attributes to be used by the API export tool. For end users, no changes
in the public API (except for a new attribute in generated classes).
Also simplifies constructor forwarding by not needing to pass the type
of the first "generated" class to compare.
Currently only automatically generated items are tagged.
Depends: D9259
Reviewers: vitor.sousa, felipealmeida
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9270
Summary:
Some parameter names, tag names and cref identifiers in the documentation were
incorrect and causing warnings during compilation.
There were also warnings related with missing documentation in publicly
visible elements in the manual binding.
This commit fixes these incorrections and adds documentation to the manual
binding in order to solve these compilation warnings.
Warnings related with missing documentation in `.eo` files are still present.
Test Plan: Just compile with mono binding.
Reviewers: lauromoura, felipealmeida, segfaultxavi
Reviewed By: segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9243
Assigning a method directly to a field expecting a delegate creates a
delegate on the fly. This delegate can be collected normally as any
collectable object. In dotnet the GC is more aggressive, causing this
delegate to be collected and C trying to call an invalid function.
To avoid this, we create a static delegate that will be passed to C. Its
lifetime will be tied to the static method it wraps.
Summary:
Encapsulate some parts of EoWrapper making them less accessible to lib users.
This can avoid unnecessary and risky usage of code that is only intended for
internal usage.
`inherited` field was made private and renamed to `generated`. Now its value
can only be obtained through the `IsGeneratedBindingClass` property.
`handle` field was made private.
`eventLock` was renamed to `eflBindingEventLock`
`ConstructingHandle` property set was made private.
Constructors that are used to create new EFL# managed objects by wrapping a
preexisting eo handle now receive a specific struct wrapping the handle pointer.
This can avoid faulty interactions with the Reflection engine used only for
generated classes that implement this constructor.
Test Plan: meson test
Reviewers: lauromoura, felipealmeida, YOhoho
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9212
Summary:
Both C strings and eina stringshares are bound as regular strings in EFL#, as
working directly with these types would demand unnecessary hassle from the user
viewpoint.
But for eina containers this distinction is important, and since C# generics
do not provide a convenient way of dealing with the same type requiring a
different management based on some other condition (at least not without
compromising the usability for other types), we added a simple `System.String`
wrapper named `Eina.Stringshare` that works as a placeholder for signaling
this distinction.
Working with this class should be transparent in most use cases because it
converts to and from `System.String` implicitly.
It also implements equality/inequality methods for easier comparison with
strings and other stringshare objects.
Add new methods and a new container element trait for dealing specifically
with `Eina_Stringshare` elements.
Adapt eolian_mono to identify and generate the proper placeholder in methods
that require stringshare containers.
Remove some direct uses of DllImport-ed functions in favor of more flexible
manual binding methods.
Move `Eina.Stringshare` DllImport directives to a static class named
`NativeMethods`, in accordance with the code design warning CA1060.
Also add a TODO comment to move all other DllImport directives to this class.
Change parameter of the method `Efl.Csharp.Application.OnInitialize` from
`Eina.Array<System.String>` to `string[]`.
This will make this API more similar with the default C# way of receiving
command line arguments.
Add tests for containers storing stringshare elements.
Reviewers: felipealmeida, lauromoura, segfaultxavi, bu5hm4n
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9178
Summary:
With this commit it is now possible for a class that inherits from a C# binding
class to be instantiated from native C code. It only has to provide a
constructor that receives an `Efl.Eo.EoWrapper.ConstructingHandle` struct,
and which calls the base binding constructor passing it.
For example:
`private Type(ConstructingHandle ch) : base(ch) {}`.
Add some test files to validate the proper behavior of this feature.
Add some small fixes in generation contexts in order to properly
generate base constructors.
Depends on D9070
Test Plan: `meson test` and `make check`
Reviewers: lauromoura, felipealmeida, segfaultxavi, woohyun, YOhoho
Reviewed By: YOhoho
Subscribers: YOhoho, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9071
Summary:
Values returned from C# Then callbacks must release ownership of the
underlying native value, so Eina code can clean it up nicely and avoid
the Wrapper flushing it early.
The same issue applied to the Async wrappers. In this case the value
passed as the Task parameter could be released by an `using` block
awaiting the value.
Also Future creation was then-ing the wrong handle.
Also add better exception messages.
Reviewers: vitor.sousa, felipealmeida
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9197
Summary:
Iterator and Accessors are views only, not owning the data they point
to.
Also updated the tests by handling some test data that were leaking.
Fixes T8036
Reviewers: vitor.sousa, felipealmeida
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers, segfaultxavi, q66
Tags: #efl
Maniphest Tasks: T8036
Differential Revision: https://phab.enlightenment.org/D9189
Summary:
C# `Eina.Value` now has builtin support for `EINA_VALUE_TYPE_OBJECT`.
To avoid ambiguity with the `Set` method overloads, explicit casting
operators were used for wrapping/unwrapping `Efl.Object` instead of
implicit ones like for other value types.
Thus, to initialize an `Eina.Value` from an object, you can use the
following:
`var v = (Eina.Value)myObj;`
Reviewers: felipealmeida, vitor.sousa, segfaultxavi, Jaehyun_Cho
Reviewed By: Jaehyun_Cho
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9164
Summary:
When it creates multilevel class of NativeClass, internal c function is not
called because eo vtables aren't created
Test Plan:
Check "MyBox2 UpdateLayout" printed.
```
//mcs test_box.cs -out:test_box.exe `pkg-config --libs efl-mono`
//mono test_box.exe
using System;
public class MyBox2 : MyBox
{
public MyBox2(Efl.Object parent, string style = null) : base(parent, style)
{
}
public override void UpdateLayout()
{
Eina.Log.Error("MyBox2 UpdateLayout");
base.UpdateLayout();
}
}
public class MyBox : Efl.Ui.Box
{
public MyBox(Efl.Object parent, string style = null) : base(parent, style)
{
}
public override void UpdateLayout()
{
Eina.Log.Error("MyBox UpdateLayout");
base.UpdateLayout();
}
}
public class Example : Efl.Csharp.Application
{
protected override void OnInitialize(Eina.Array<System.String> args)
{
Efl.Ui.Win win = new Efl.Ui.Win(Efl.App.AppMain);
var box = new MyBox(win);
box.SetHintSizeMin(new Eina.Size2D(360, 240));
win.SetContent(box);
var box2 = new MyBox2(win);
box2.SetHintSizeMin(new Eina.Size2D(360, 240));
box2.Pack(box);
var button = new Efl.Ui.Button(box);
button.SetText("Click");
button.ClickedEvt += (object sender, Efl.Ui.IClickableClickedEvt_Args e) =>
{
box.CalculateGroup();
box2.CalculateGroup();
};
box.Pack(button);
}
public static void Main()
{
var example = new Example();
example.Launch();
}
}
```
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, lauromoura, woohyun, Jaehyun_Cho
Reviewed By: Jaehyun_Cho
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9079
Summary:
This commit makes use of the `ownership,shared` and `ownership,unique`
events from Efl.Object in order to avoid the C# wrapper from being
collected while C code holds a reference to the object.
For example, creating a list of items in a for loop and attaching events to
them would fails without this commit, as the C# GC may collect the wrapper.
The basic idea is that we use a `WrapperSupervisor`, which is stored in
the Eo data storage, with a GCHandle allocated for the lifetime of the
underlying Eo object. This supervisor takes care of holding either a
weak C# reference (when in unique mode, allowing the wrapper to be GC'd)
or a hard C# reference (when in shared mode, making the wrapper
non-collectable while the Eo has extra references).
One limitation is that object graphs can leak if a shared object in the
graph - an Eo child for example - stores a hard reference to another
object in the graph as a C# field. In this example, this causes the
parent to always have a hard C# reference (from the child) as the child
is non-collectable due to the parent holding an Eo reference to it.
Depends on D8678
Test Plan: `ninja test` and `make test`
Reviewers: lauromoura, felipealmeida, woohyun, segfaultxavi
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9014
@warn_unused in syntax is now called @no_unused - this is because
"warning about unused" is a C thing (or rather, an extension to C)
and various languages might want to use stricter behavior for this.
Its associated API does the reverse now - it lets you query whether
being unused is allowed at all. This is to match future behavior
of Eolian (once it supports versioning) that will likely reverse it.
@feature
This has been deprecated for a while and is not strictly necessary
- as a part of an effort to stabilize Eolian, remove this. Eolian
will eventually gain support for versioning and use a reversed
behavior (i.e. no NULL by default), but the API it wlll use for
that will be very different. Features can always be added, it's
much harder to drop them.
@feature
This was an experiment that never properly took off and was never
used by any generator. Its use was highly variable, so it could
not be relied upon. We will still want to reverse the current
behavior eventually (no null by default), but that will be
done with eo file versioning in the future.
@feature
This is for consistency with the new eolian_class_c_macro_get
as well as for better clarity, as c_name_get is already provided
by Object and refers to something else.
This is to prepare for type/class renaming support. This adds
the necessary API to retrieve C-specific names. Other refactoring
is necessary elsewhere for now.
This also renames the old API eolian_class_c_name_get to
eolian_class_c_macro_get to avoid conflict as well as clarify
the intention.
Summary:
This removes another bit of legacy API from the C# bindings.
This also reverts "elm: Put back Policy and Policy_Quit in EO files"
(a9132a9a66) so that these two Elm enums are
definitely out of the EO files.
Test Plan:
Everything, including mono bindings, continue to build.
At runtime, C# apps still exit when all windows are closed.
Reviewers: lauromoura, vitor.sousa, q66
Reviewed By: q66
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8890
This commit is the same as 0e8f289d7d
but this commit is for meson.
To use vector graphics in efl csharp bindings, it is permitted to
generate efl_canvas_vg_object.eo.cs.
Other efl_canvas_vg .eo.cs files have already been generated because the
file names were changed from efl_vg to efl_canvas_vg.
meson generates libeflcustomexportsmono.so to lib/efl-mono-1/ directory
unlike other so files.
Moreover, the so file does not have versions in the file name unlike
other so files.
Like other so files, libeflcustomexportsmono.so is moved to lib
directory with versions in the file name.
This splits the eolian_file_parse API into two, one for parsing
files already present in the database (always by filename) and
one for parsing paths.
It fixes several bugs/leaks on the way (incorrect use of
stringshare etc.) as well as adds checking for whether there
are no conflicting filenames at scan time, for free. That means
it is now no longer possible to scan two paths which have an eo
or eot file of the same name in them.
It should also be faster now.
It also fixes T7820.
@fix
Summary:
before we had *correct* fileds in the subdir: keyword. However,
install_dir: was wrong, so *this* time, this seems right.
Reviewers: cedric, zmike, segfaultxavi, raster
Reviewed By: zmike
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8634
Summary:
dotnet's GC seems to be more agressive, showing some issues that usually
do not appear when running under Mono's.
This commit uses for free_cb's the same scheme we already use for
regular Eo refs, using a GC handle to keep the cleaning callback alive.
Reviewers: vitor.sousa, felipealmeida, woohyun
Reviewed By: vitor.sousa
Subscribers: segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8593
Summary:
New option added to eolian_gen: -e <dir>
This specifies a directory to search for examples. If a file is found with the
same name as an EFL C# class (e.g. Efl.Ui.Button.cs) or as an EFL C# method or
property (e.g. Efl.IText.Text.cs, Efl.IText.SetText.cs) its full
contents will be embedded in the documentation for that class or method within
<example> and <code> tags. This is, in turn, is parsed by DocFX and shown
in Example boxes in the generated pages.
If an example file is not found, no examples are embedded for that object.
If -e is not used, no examples are embedded for any object.
New option added to meson: mono-examples-dir to point to the examples directory.
This directory is then passed to eolian_mono through -e.
Do not use it (or define it to nothing) to disable example embedding.
No performance drop has been observed because of these extra tests.
Right now examples can only be given for base classes, not for derived ones
(i.e. Efl.IText.Text but not Efl.Ui.Button.Text). This will be addressed in a
later commit.
Feature
Depends on D8587
Test Plan:
Create an examples folder and put some files in it:
```
mkdir /tmp/examples
echo 'var button = new Efl.Ui.Button();' > /tmp/examples/Efl.Ui.Button.cs
echo 'button.AutoRepeatEnabled = true;' > /tmp/examples/Efl.Ui.IAutorepeat.AutorepeatEnabled.cs
echo 'button.SetAutoRepeatEnabled(true);' > /tmp/examples/Efl.Ui.IAutorepeat.SetAutorepeatEnabled.cs
```
Configure meson to embed examples and build:
```
meson configure -Dmono-examples-dir=/tmp/examples
ninja
```
Examine the generated efl_ui_button.eo.cs file to see embedded <example> tags,
or run DocFX and bask in the glory of documentation pages with examples:
```
cd doc/docfx
./gendoc.sh
```
Reviewers: lauromoura, felipealmeida, vitor.sousa, zmike, bu5hm4n
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8592
Summary:
- Should only search for methods locally.
- dotnet requires passing false to GetAttributes
- Also added a check when the class overrides no Eo ops.
Reviewers: felipealmeida, vitor.sousa, woohyun
Reviewed By: felipealmeida, vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8588
Summary:
The code that searches the type dynamically fails instead of falling
back to Efl.Object. Now it fallbacks to Efl.Object.
Fixes T7783
Reviewers: bu5hm4n, vitor.sousa, segfaultxavi, woohyun, Jaehyun_Cho, YOhoho, lauromoura
Reviewed By: vitor.sousa, lauromoura
Subscribers: lauromoura, cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7783
Differential Revision: https://phab.enlightenment.org/D8574
Summary:
- Check for nullness when getting stuff from C# to C
- We should return null when wrapping a NULL pointer instead of throwing
an exception
Reviewers: felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8580
Summary:
Instead of overriding every method and making the callback to C, we
just override the methods that are found by reflection on the type.
Reviewers: bu5hm4n, vitor.sousa, segfaultxavi, woohyun, Jaehyun_Cho, YOhoho, lauromoura
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8579
Summary:
Rework general event handling to check individually each event call, if the
object is not alive then the event will not be propagated.
WeakReferences (and lambdas capturing those WeakRefs) are used to ensure this.
Dispose methods in object now take care of checking if efl libraries are still
initialized and thread-safely unregister each event before performing an
efl_unref on the Eo object.
Event handling in C# is now centered around a single dictionary inside the
object: `EoEvents`.
C# event triggers now properly trigger events on C too.
Standardize C# event-triggering methods names (remove underscores).
Some diminished use of static memory due events no longer requiring static key
objects to be registered/unregistered.
Some fixing of white space generation for generated events.
Depends on D8431
Reviewers: lauromoura, felipealmeida, segfaultxavi
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8564
Summary:
This commit mainly fixes errors caused by deallocating resources in the garbage
collector thread. Using `ecore_main_loop_thread_safe_call_async` to queue
resource deallocation in the main thread seems to solve it.
Also, some `efl_ref` calls are added in places they were missing, mainly
objects that unref in the destructor thus taking ownership if efl_ref is not
called.
Also fix improper resource deallocation in tests that were causing it to crash,
enabling it to call Efl.All.Shutdown again. This allocation and the deallocation
process was moved from the Eo class constructor to static class methods that are
called in the test 'set up' and 'tear down' methods.
Queuing resource deallocation in the main thread make it mandatory that tests
call `Efl.App.AppMain.Iterate()` if they want to check proper resource
deallocation (like TestFunctionPointers.set_callback_inherited_called_from_c).
Extras:
Remove duplicated declaration of 'eflcustomexportsmono' in meson in order to fix
some linking problems.
Remove some unused code around deallocation functions that had to be reworked.
Object allocation is now supplied with the call site information it expects
(file name and line for _efl_add_start).
Depends on D8550
Test Plan: meson test
Reviewers: felipealmeida, lauromoura, cedric, segfaultxavi
Reviewed By: lauromoura
Subscribers: segfaultxavi
Tags: #efl_language_bindings, #do_not_merge
Differential Revision: https://phab.enlightenment.org/D8431
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
Summary:
Rework the struct binding generator to declare the native struct nested inside
the managed one.
This way native structs are less likely to cause confusion; for example
with an IDE that supports automatic completion.
Get rid of struct conversion class methods in favor of using (the already
generated) implicit conversion operators.
Depends on D8469
Reviewers: segfaultxavi, lauromoura, felipealmeida
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8470
ecore_init, ecore_shutdown, elm_init, elm_policy_set, elm_shutdown,
elm_exit are imported in efl_all.cs.
Moreover, efl_csharp_application.cs is using Efl.UnsafeNativeMethods.
Therefore, the unnecessary external function import is removed in
efl_all.cs.
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:
Added basic documentation for things that were missing.
Some other files are silent due to a pragma disabling CS1591. They
should be handled later.
Also, removed `Efl.Io.Positioner` from the blacklist as it is referenced
from the `Efl.Io.Reader.eos` event documentation.
Reviewers: segfaultxavi
Reviewed By: segfaultxavi
Subscribers: felipealmeida, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8370
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 correctly install the xml file alongside the dll, a install
script is used to work around meson's limitation of tracking files
generated by library() other than the dll.
Fixes T7722
Reviewers: segfaultxavi, bu5hm4n
Reviewed By: segfaultxavi, bu5hm4n
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7722
Differential Revision: https://phab.enlightenment.org/D8331
we did a completly wrong thing here, and it only worked by accident.
We passed a absolut path into a parameter where only a number should be
passed. This is now fixed.
This fixes meson build with meson-0.50 and bindings enabled
Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D8328
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:
This also simplifies the beta checking API by unifying it under
objects (makes much more sense that way) and reworks the validator
to have betaness support within its context state, allowing checks
to be done easily in any place.
The betaness checks are disabled for types for the time being,
because otherwise there are too many errors (types are assumed
to be stable as they are not tagged beta, but they reference beta
classes all over the place). Set EOLIAN_TYPEDECL_BETA_WARN to 1
in your environment to force enable the checks.
Reviewers: zmike, bu5hm4n, stefan_schmidt, lauromoura, cedric
Reviewed By: zmike
Subscribers: #reviewers, #committers
Tags: #efl, #eolian
Differential Revision: https://phab.enlightenment.org/D8102
this takes the current generated output from eolian for legacy code in
efl and adds it to the tree, then removes legacy references from the
corresponding eo files. in the case where the entire eo file was for
a legacy object, that eo file has been removed from the tree
ref T7724
Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D8173
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
This will erase the need of the `runtime_assemblies` kw_arg, allowing ot
use a single invocation without warnings about unsupported parameters.
Reviewed-by: Marcel Hollerbach <marcel-hollerbach@t-online.de>
Differential Revision: https://phab.enlightenment.org/D8092
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:
It was marshalling erroneously data into and out of arrays and lists.
Instead of passing data by value (or by address of correct size), it was
stuffing data into IntPtr and trying to parse out afterwards.
This commit changes the binding to use the same approach of plain
Get/Set, with proper overloads.
Reviewers: vitor.sousa, segfaultxavi, felipealmeida
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8057
This feature was kind of ill-conceived and never worked properly.
Since there isn't enough time to make it work right at this point
and there are no users of it in the API, remove it for now.
It might get added in the next release cycle, in a proper form.
@feature
Summary:
PtrToStringAuto may switch between ANSI and UTF16 encodings in a not so
clear way, leading to decoding errors when getting messages from DBus.
Reviewers: vitor.sousa
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8023
Summary:
This adds two new complex types, slice<T> and rw_slice<T>. This
is necessary to make the type useful to bindings, as Eina_Slice
on its own says nothing about what it's carrying and that prevents
useful code from being generated outside of C.
@feature
Reviewers: bu5hm4n, segfaultxavi, lauromoura, cedric
Reviewed By: cedric
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7980
This reverts commit a57c7f7510.
I pretty much hate to just revert your revert, but you failed to read my
replies, and failed to understand what i was talking about.
And YES we talked at fosdem about the platform issue, and do you
remember my answer, that back in time this might be the case, today is
different freebsd suppoerts setenv, and for windows we have a setenv
implementation in evil. And yes, vtorri also created a issue how bad and
evil this commit is, however, i still fail to see the issue since setenv
unsetenv and clearenv usages are taken as needed. (T7693)
The ownership question is answered in
https://phab.enlightenment.org/D7516#137367.
Can we please get into a state of technical discussions, and not *oh
shit, i am going to revert this* this has been in review for a long
time, a lots of people have tested it, we discussed things on it, and
there was 3 weeks of no reply from you.
The issues that exist will be dealed with. Feel free to create tasks if
you want :)
Revert "ecore: get rid of commands in efl_task."
This reverts commit 616381e9cf.
Revert "ecore: here comes a command line object"
This reverts commit 48e5684b3c.
1. this is broken:
EOLIAN static const char*
_efl_core_command_line_command_get(const Eo *obj EINA_UNUSED, Efl_Core_Command_Line_Data *pd)
{
return eina_strdup(pd->string_command);
}
it returns a const char * BUT it duplicates it on return. no. a big
fat honking NO. return a char * or don't duplicate. pick.
2. _efl_core_command_line_command_array_set() is broken by design. it
accepts an array of strings, but the strings are owned by the caller
who creates the array (requiring they free them up themselves after
this call) but the array becomes owned by the callee. the code here frees the
incoming array but doesn't care about the string content of it. it's
leak heaven waiting to happen (or bugs when someone wants to access
the array they create to walk it to free the strings they put into it
after it is set).
i brought this up and it was dismissed. now exactly he issue i brought
up is there with mixed ownership and the added complexity as well as
transfer of some ownership but not others.
go back and think about this so it isn't broken by design.
Note that the usage in efl_thread.c should and could be removed.
the problem with its usage is that when the ARGUMENTS event is fired,
noone ever had the chance to subscribe to the loop of the thread yet. So
all in all this is unneccessary, since noone could ever touch that.
Differential Revision: https://phab.enlightenment.org/D7517
The next commit will bring support for something like reflection. This
commit prepares the whole tree for getting another argument in
efl_class_functions_set.
ref T7681
Differential Revision: https://phab.enlightenment.org/D7882
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
this removes the need for the calling a Init function.
Reviewed-by: Felipe Magno de Almeida <felipe@expertisesolutions.com.br>
Differential Revision: https://phab.enlightenment.org/D7556
Summary:
until to today you had to call init functions and a run function which
were static function in a class called Efl.Ui.Config.
However, calling those init functions there is not really OOP style.
Right now things have changed into a manner where you are defining you
application class with inheriting from the Application /
SimpleApplication abstract.
This enables you to call launch() on your application class, calling
launch there leads to a call to the args function, you can call and use
the Efl classes in there, everything is booted up.
Option parsing and dependency start can still be done in the main method
or application constructor, just ensure that you never call any efl
class / function outside the launch function.
A commit that demonstrates the usage can be found at
ref T7204
https://git.enlightenment.org/tools/examples.git/log/?h=devs/bu5hm4n/POC
Reviewers: felipealmeida, segfaultxavi, Jaehyun_Cho, cedric
Reviewed By: segfaultxavi
Subscribers: zmike, woohyun, akanad, lauromoura, #reviewers, #committers
Tags: #efl_language_bindings
Maniphest Tasks: T7204
Differential Revision: https://phab.enlightenment.org/D7495
Summary: The trailings end up in the final version, which causes it to create a invalid XML file.
Reviewers: bu5hm4n, woohyun, segfaultxavi
Reviewed By: bu5hm4n
Subscribers: cedric, segfaultxavi, woohyun, #reviewers, bu5hm4n, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7613
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:
"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:
new Eina.Value(0) is a special case. The 0 is silently converted
to an enum (Eina.ValueType) and therefore the call is ambiguous
with the 0 being first converted to an Eina.Value via the implicit
conversion operator (calling the Eina.Value deep copy constructor).
Adding constructors for all supported types solves the problem because
they have higher priority. Also, they avoid one deep copy of the
Eina.Value.
Includes test case to catch this problem in the future. This was discovered
in the tutorials, where new Eina.Value(0) is being used.
Test Plan:
The src/efl_reference_core_event.exe example from the examples repo was
not compiling before, and now it is.
make check and make examples still work as expected.
Reviewers: lauromoura
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7598
Required by some distros like Arch.
Reviewed-by: Marcel Hollerbach <marcel-hollerbach@t-online.de>
Reviewed-by: Felipe Magno de Almeida <felipe@expertisesolutions.com.br>
Differential Revision: https://phab.enlightenment.org/D7527
Summary:
For basic types, this will make it easier to pass Eina.Values into
functions, without requiring to setup and later Set() or Get() calls.
As discussed on irc, this seems to be a better way to improve the Value
C# API than using method chaining.
Fixes T7388
Test Plan: run tests
Reviewers: segfaultxavi, felipealmeida
Reviewed By: segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7388
Differential Revision: https://phab.enlightenment.org/D7526
This brings in the possibility to receive the app object from bindings.
With the app object you can listen to pause / args / terminate / resume
events.
fix T7509
Differential Revision: https://phab.enlightenment.org/D7480
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
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.
Summary:
This commit removes some clashes (i.e. names as classes and namespaces
at the same time). It'll avoid nested items that are either forbidden
(C#) or problematic (Python) in some languages.
Reviewers: segfaultxavi, bu5hm4n, felipealmeida
Reviewed By: segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7260
This information has been stored and used in Eolian until now
but not exposed to the API user. While there are roundabout ways
to retrieve the class for an event, this one is direct and costs
us nothing.
This will make it easier for generators and utilities to retrieve
the class that implemented a method/property/etc rather than the
class the implement was originally defined for. Thanks to this
it will no longer be necessary to carry the class pointer around
the place.
Summary: its only required when having mono
Reviewers: q66, netstar, jeyzu
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7213
The tests are added and build. For running C# code please see the wiki.
you can enable -Dmono=true
Differential Revision: https://phab.enlightenment.org/D7203
Summary:
The previous declaration was causing the implicit copy constructor to be
invoked when copying a new eina::value from an existing eina::value,
thus leading to two wrappers pointing to the same underlying C pointer.
This showed some error messages when running the tests but under autotools
it didn't fail, while building with meson caused it to segfault.
Reviewers: vitor.sousa
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7166
a new shiny buildtool that currently completes in the total of ~ 4 min..
1 min. conf time
2:30 min. build time
Where autotools takes:
1:50 min. conf time
3:40 min. build time.
meson was taken because it went quite good for enlightenment, and is a traction gaining system that is also used by other mayor projects. Additionally, the DSL that is defined my meson makes the configuration of the builds a lot easier to read.
Further informations can be gathered from the README.meson
Right now, bindings & windows support are missing.
It is highly recommented to use meson 0.48 due to optimizations in meson
that reduced the time the meson call would need.
Co-authored-by: Mike Blumenkrantz <zmike@samsung.com>
Differential Revision: https://phab.enlightenment.org/D7012
Depends on D7011
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: This will allow deep copying the given value from C#.
Reviewers: felipealmeida, vitor.sousa, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7017
Summary:
eina_list_reverse() returns the list, the C# version should do the same.
This fixes the reference/csharp/eina/src/eina_list.cs example.
Fixes T7112
Test Plan: The eina_list.cs example works after this change.
Reviewers: lauromoura, vitor.sousa, felipealmeida
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7112
Differential Revision: https://phab.enlightenment.org/D6995
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:
Using malloc/free as it was used before would cause double frees and
other issues when mixing with eina_values created from the value
mempool inside Eina.
Fixes T7359
Reviewers: felipealmeida, vitor.sousa, segfaultxavi
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7359
Differential Revision: https://phab.enlightenment.org/D6958
Summary:
XML document generation was skipping the rest of this file because of a missing
XMl closing tag. Fortunately, it was almost at the end of the file.
Reviewers: lauromoura, vitor.sousa, felipealmeida
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers, zmike
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D6905
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:
Also changed the previously failing tests to use ck_assert_int_eqinstead
of fail_if for better reporting.
Test Plan: make check
Reviewers: cedric, felipealmeida
Reviewed By: cedric
Subscribers: #committers, zmike
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D6194
Reviewed-by: Cedric BAIL <cedric@osg.samsung.com>
Summary:
Plain conversion to IEnumerable, which is the base of LINQ
Depends on D6189
Reviewers: felipealmeida, vitor.sousa
Reviewed By: vitor.sousa
Subscribers: cedric, #committers, zmike
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D6190
Summary:
As futures are tied to a given promises and are usually handled in
a 'attach and forget' scheme, we can't cancel them as it would cancel
the whole chain.
Reviewers: felipealmeida, vitor.sousa
Reviewed By: vitor.sousa
Subscribers: cedric, #committers, zmike
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D6189
Summary:
All events must have a type now, otherwise bindings don't know how to handle
the event_info field.
Most of the missing event types were actually "void" (no event_info present).
Some struct definitions had to be moved to eo instead of h files, so they
are available to bindings. Some have not, and are marked with FIXME.
Some namespaces have been fixed (like Efl_Event_Cb -> Efl.Event_Cb).
In general, there are hundreds of changed files, but mostly to add a type which
was not present before, so there's no harm done.
Also, A lot of FIXMEs have been added which should be, like, fixed.
For example, some events can send different types of event_info, which is
very inconvenient (and error prone).
Test Plan: make with c# bindings works, make check and make examples work too.
Reviewers: cedric, q66, lauromoura
Subscribers: zmike
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D6169
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:
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:
Also added a blacklist header to temporarily disable generation of eo
methods with futures as arguments or return type.
Once the models branch lands, we should enable future support again with
eina_futures.
Reviewers: cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D6018
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.
When we have an eina.Value_Native (representing an Eina_Value passed by
value) and assign it to an eina.Value (a class with an IntPtr to an
underlying Eina_Value) we copy it so the eina.Value can take ownership
and free the data normally.
A possibly better alternative would be adding an extra flag to
eina.Value (something like OwnsPointer) to check whether we should free
the struct we point to or not.
When transferring the ownership of a ptr(struct) from Unamanaged to
managed, we should marshal the reference-typed fields or they can point
to Managed memory that would make no sense to access from C (for
example, strings would return garbage).
The downside is that it can cause potential leaks if the receiver of the
memory do not free it. In the current state of the EFL api this can
happen in two places:
- Efl.Ui.List.SegArray::remove
return -> ptr(Efl.Ui.List.LayoutItem) @owned
- Efl.Ui.Focus.Manager::fetch
return -> ptr(Efl.Ui.Focus.Relations) @owned
The resources copied by both structs may leak when those functions are
overriden in C# and the values returned to the C code.
Also hide some internal stuff instead of exporting it and generate
implicit conversion operators for struct external/internal.
Added support for Eolian_Object, made other luaified types
"inherited" from Eolian_Object, removed type-specific file_get
as it was replaced by Object's file_get, declarations API still
in place
This reverts commit 135154303b.
Revert "efl: move signal events from efl.loop to efl.app"
This reverts commit 3dbca39f98.
Revert "efl: add test suite for efl_app"
This reverts commit 3e94be5d73.
Revert "efl: create Efl.App class, the parent of Efl.Loop"
This reverts commit 28fe00b94e.
Go back to before efl.app because I think this should be done with
superclassing here not a parent object. reasons?
1. multiple loops per single thread make no sense. so if multilpe loop
objects they wont be contained in a single app object and then deleted
like this.
2. the app object is not really sharable in this design so it cant be
accessed from other threads
3. it makes it harder to get the main loop or app object (well 2 func
calls one calling the other and more typing. it is longer to type and
more work where it is not necessary, and again it can't work from
other threads unless we go duplicating efl.app per thread and then
what is the point of splittyign out the signal events from efl.loop
then?)
etc.
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.
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.
This API is meant to be used by parts only, and by bindings dealing with
part objects. This patch fixes make check which got broken in the after
the previous one (cxx).
This is really just calling efl_del() and detaching the internal pointer
from the C++ object. This will not affect other references, which means
after del the object may still be alive, probably without a parent.
This prevents generation of del().
I also removed constructor, finalize and destructor as I believe this
requires special work with eo_inherit (where did this work go??).
I'll hide some controversial features behind this, until we come to an
agreement with @felipealmeida and people who actually know C++ (iow: not
just me^^).
Features protected:
- easy wref (using -> without locking)
- xxx_event_cb_add() functions in object classes
- instantiate(obj) to create a new object
- add as a synonym for instantiate (both in efl::eo)
I think some concepts are not handled properly in this set of classes.
I'll do some more experiments to see if I can find a working solution,
but I think we need 3 variants of eina_value, instead of just the two
provided.
This still uses the instantiate object but provides a more convenient
syntax for objects declared before their creation (eg. a global win).
Note: I wonder if we shouldn't rename instantiate to add. It would be
closer to EFL API's while being much much easier to type.
Instead of messing around with varargs, create individual wrappers for
each type supported.
The va_list approach was getting problems with float/double on Windows.
On instantiation objects get either one or two refs:
- with a parent, they will have 2 refs, one for C++, one for the
parent.
- without a parent, they get a single ref, the one for C++
This will break the existing C++ examples, which I will fix in later
patches.
Note that the window is a strange object which can be created with no
parent but internally reparents itself to an object it creates (oh so
ugly).
I hid it behind ifdef for now as I'm very much unsure of what I'm doing.
This whole modern C++ thing is still weird to me :)
Prerequisite:
#define EFL_CXX_WREF_EASY
This allows constructs such as:
auto wobj = obj._get_wref();
std::cout << wobj->text_get() << std::endl;
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.
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...