summaryrefslogtreecommitdiff
path: root/src/bindings (follow)
AgeCommit message (Collapse)Author
6 daysC#: Update C# code-generation to use a new ICustomMarshaler in some string ↵Lucas Cavalcante de Sousa
usages that were leaking When `C` calls a function that return/has an out string and it was overwritten by `C#` inherit class the `C` portion wasn't cleaning its copy. Now, when a `C` calls a `C#` delegate function, `Strings` that are `out` values or `return` values use a new marshaler (specific to this case) that uses Eina short lived strings (`Eina_Slstr`) instead of duplicating it with `strdup`, so at some point, the string passed to `C` is deleted. To do so, a `direction_context` (a new `Context` at `generation_contexts.hh`) was created. It is only used when a C# delegate is being called from C (so this context is only set in `function_definition.hh` and `property_definition.hh`, where it is set to `native_to_manage` to indicate that it is a native call to a managed function). When this `direction_context` is set and the `String` being marshaled is not marked with an `@move` tag and it is an `out` or `return` value, the new `StringOutMarshaler` (implemented at `iwrapper.cs`) is used (instead of `StringKeepOwnershipMarshaler`). When marshaling a managed data to native this marshaler uses eina short lived string (`Eina_Slstr`) that will be automatically deleted. This delete is bounded to "the loop of the current thread or until the clear function is called explicitly" as said at `src/lib/eina/eina_slstr.h`. Reviewed-by: Felipe Magno de Almeida <felipe@expertisesolutions.com.br> Differential Revision: https://phab.enlightenment.org/D11434
2020-02-18eolian-mono: Make Get/Set internal for generated propertiesFelipe Magno de Almeida
Make Get and Set methods internal for properties that get the property syntax generated. Reviewed-by: João Paulo Taylor Ienczak Zanette <joao.tiz@expertisesolutions.com.br> Differential Revision: https://phab.enlightenment.org/D11252
2020-02-13efl_mono: Create insert list/array c# wrapper for eina_value.Lucas Cavalcante de Sousa
Implements Insert() method to eina.Value containers (array/list). The Insert() (src/bindings/mono/eina_mono/eina_value.cs) method wraps native functions implemented with c (src/lib/eina/eina_inline_value.x). Resolves T7402 Differential Revision: https://phab.enlightenment.org/D11298
2020-02-13csharp: Prevent using system dll for eflcustomexportsmonoJoão Paulo Taylor Ienczak Zanette
If EFL is installed system-wide, `CustomExports` would use the system (`/usr`) dll instead of local build's, causing new implemented binding calls to native functions to crash with no entry point found for them. This patch fixes it by ensuring that the local build's `libeflcustomexportsmono.dll` will be used. Reviewed-by: Felipe Magno de Almeida <felipe@expertisesolutions.com.br> Differential Revision: https://phab.enlightenment.org/D11343
2020-02-04csharp: implement GetChildrenIndex for GenericModelYeongjong Lee
Summary: This patch will fix EFL# build error. Reviewers: felipealmeida, woohyun, Jaehyun_Cho Reviewed By: Jaehyun_Cho Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11269
2020-01-29eolian_mono: blacklist c-only internal APIsYeongjong Lee
Summary: This patch prevent generating c-only internal APIs. C# doesn't need c-only APIs. Test Plan: meson build -Dbindings=mono,cxx -Dmono-beta=true Reviewers: felipealmeida, Jaehyun_Cho, woohyun Reviewed By: woohyun Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11151
2020-01-29eolian_mono: change property name from args to ArgsYeongjong Lee
Summary: PascalCasing is always used for property names. Test Plan: meson build -Dbindings=mono,cxx -Dmono-beta=true Reviewers: woohyun, felipealmeida, segfaultxavi Reviewed By: woohyun Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11149
2020-01-28eolian_mono: make struct immutableYeongjong Lee
Summary: Immutable value type is recommeneded for struct type in cs world. `DO NOT define mutable value types.` (see, https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/struct) Also, this patch include refactoring of generated struct types. 1. Change field type to property type that have only getter. it will fix CA1051(ref T8397). 2. Remove internal NativeStruct. there is private field for marshalling struct instead. 3. Fix some test cases that change value inside struct. because struct is immutable. Test Plan: meson build -Dbindings=mono,cxx -Dmono-beta=true Reviewers: woohyun, felipealmeida, Jaehyun_Cho Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8397 Differential Revision: https://phab.enlightenment.org/D11146
2020-01-23csharp: cleanup concrete classYeongjong Lee
Summary: Concrete class is only used to call static member of NativeMethod. they don't need any inheritance and implementation of c functions. Depends on D9893 Test Plan: ninja test Reviewers: lauromoura, felipealmeida Subscribers: Jaehyun_Cho, woohyun, segfaultxavi, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9894
2020-01-22Revert "efl_mono: remove class ExtensionTag"Jaehyun Cho
Extension Methods' classes have methods with same names and parameters. e.g. Text<T>(this Efl.Ui.ItemFactory<T> fac) Although the where clause contains different classes, they cannot be identified as different methods by C# compiler. e.g. Text<T>(this Efl.Ui.ItemFactory<T> fac) where T : Efl.Ui.Button e.g. Text<T>(this Efl.Ui.ItemFactory<T> fac) where T : Efl.Ui.Check As a result, to avoid ambiguous methods, ExtensionTag should be used as a second parameter of each method. e.g. Text<T>(this Efl.Ui.ItemFactory<T> fac, ExtensionTag<Efl.Ui.Button, T>magic = null) where T : Efl.Ui.Button e.g. Text<T>(this Efl.Ui.ItemFactory<T> fac, ExtensionTag<Efl.Ui.Check, T>magic = null) where T : Efl.Ui.Check This reverts commit 76631f502a8234c04ed8124bfdebe62ed5bdf954.
2020-01-21Revert "csharp: Property Indexer implementation"Yeongjong Lee
Summary: This reverts commit 0954e501fd4008c40b3848de1f2c91bcd53b2f71. According to Framework Design Guidelines of MS, most of indexed properties are not recommended in EFL#. (see, https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/property) It is better to leave properties which have a key as methods. Reviewers: woohyun, felipealmeida Reviewed By: woohyun Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11114
2020-01-15c#: Remove warning about unused variableFelipe Magno de Almeida
Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D11097
2020-01-15efl_mono: remove class ExtensionTagJaehyun Cho
Summary: Since class BindablePart and class BindableProperty use generic type constraint as "where T : <class name>", class ExtensionTag is no longer needed. Reviewers: SanghyeonLee, felipealmeida, YOhoho Reviewed By: YOhoho Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11101
2020-01-14eina_mono: replace eina_list and eina_array with IListYeongjong Lee
Summary: Eina.List<T> => System.Collections.Generic.IList<T> Eina.Array<T> => System.Collections.Generic.IList<T> ref T8486 Depends On D10785 Test Plan: meson build -Dbindings=mono,cxx -Dmono-beta=true Reviewers: felipealmeida, Jaehyun_Cho Reviewed By: Jaehyun_Cho Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8486, T8488 Differential Revision: https://phab.enlightenment.org/D10902
2020-01-06csharp: rename ExtensionMethodsYeongjong Lee
Summary: This patch will rename `ExtensionMethods` to `Extensions` that is commonly used in csharp project. Depends on D10972 Test Plan: meson build -Dbindings=mono,cxx -Dmono-beta=true Reviewers: lauromoura, Jaehyun_Cho, felipealmeida Reviewed By: Jaehyun_Cho, felipealmeida Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10913
2019-12-30csharp: Add StyleCop support to dotnet buildLauro Moura
This patch adds support to run the StyleCop rules. To enable, -Ddotnet=true is needed, You can pass -Ddotnet-stylecop=CAXXXX,CAXXYY where X and Y are digits for CAs or SAs. You can also ask that the CAs and SAs cause errors instead of warnings. Differential Revision: https://phab.enlightenment.org/D10969
2019-12-26c#: Checking null for parameters.Bruno da Silva Belo
Checking for non-generated code. ref T8399 Reviewed-by: Felipe Magno de Almeida <felipe@expertisesolutions.com.br> Differential Revision: https://phab.enlightenment.org/D10959
2019-12-23eina_mono: make internal classes internalYeongjong Lee
This hide internal classes.. Reviewed-by: Felipe Magno de Almeida <felipe@expertisesolutions.com.br> Differential Revision: https://phab.enlightenment.org/D10912
2019-12-23eo_mono: make BindingEntityAttribute internalYeongjong Lee
`BindingEntityAttribute` is used internally to check whether the object is generated binding classes or not. API user should use protected `IsGeneratedBindingClass` instead. Reviewed-by: Felipe Magno de Almeida <felipe@expertisesolutions.com.br> Differential Revision: https://phab.enlightenment.org/D10937
2019-12-23eo_mono: make Eo.Globals internalYeongjong Lee
All members of `Eo.Globals` are already `internal`. It is unnecessary for `Eo.Globals` to be `public`. Reviewed-by: Felipe Magno de Almeida <felipe@expertisesolutions.com.br> Differential Revision: https://phab.enlightenment.org/D10938
2019-12-23csharp: Property Indexer implementationLauro Moura
Use Indexers to use brackets, eg [i], syntax. Keys now can be used as following: var someVal = obj.SomeProperty[key]; obj.SomeProperty[key] = someNewVal; And for multiple keys: var someVal = obj.SomeProperty[(key1, key2)]; obj.SomeProperty[(key1, key2)] = someNewVal; T8384 Reviewed-by: WooHyun Jung <wh0705.jung@samsung.com> Differential Revision: https://phab.enlightenment.org/D10791
2019-12-23c#: Fixing ca2208 for Eina.List.Bruno da Silva Belo
Some ca's warning reactivated. ref T8428 Reviewed-by: João Paulo Taylor Ienczak Zanette <joao.tiz@expertisesolutions.com.br> Differential Revision: https://phab.enlightenment.org/D10911
2019-12-22c#: Implement IList to Eina.Array.Bruno da Silva Belo
ref T8488 Reviewed-by: Felipe Magno de Almeida <felipe@expertisesolutions.com.br> Differential Revision: https://phab.enlightenment.org/D10785
2019-12-20csharp: add documentation of class Efl.Eo.Config in iwrapperJaehyun Cho
Summary: Description and since efl version of the class Efl.Eo.Config is added. Reviewers: YOhoho, lauromoura, segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10933
2019-12-19Fix invalid XML comment in efl_mono.dll.configFelipe Magno de Almeida
Use <!-- and --> to comment the license files Reviewed-by: João Paulo Taylor Ienczak Zanette <joao.tiz@expertisesolutions.com.br> Differential Revision: https://phab.enlightenment.org/D10790
2019-12-19csharp: remove unused code in workaroundYeongjong Lee
Test Plan: meson setup -Dbindings=mono,cxx -Dmono-beta=true Reviewers: lauromoura, Jaehyun_Cho Reviewed By: Jaehyun_Cho Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10914
2019-12-18csharp: Fix passing acessor with ownershipLauro Moura
Summary: When passing an owned acessor from a converted collection we need a way to unpin the passed data when the accessor is freed. This commits adds a thin wrapper around the CArray accessor that unpins the data when freed. Depends on D10900 Reviewers: YOhoho, felipealmeida Reviewed By: YOhoho Subscribers: cedric, #reviewers, #committers, jptiz, brunobelo Tags: #efl Maniphest Tasks: T8486 Differential Revision: https://phab.enlightenment.org/D10901
2019-12-18csharp: Fix accessor IEnumerable implementation.Lauro Moura
Summary: Fixed after `data_get` marshalling changed (correctly) the data parameter to `out IntPtr` instead of manually marshalling the double pointer. The existing test (`basic_accessor_list`) passed due to the empty enumerable behavior, which made the `foreach` running no iterations. Reviewers: brunobelo, jptiz, felipealmeida, YOhoho Reviewed By: jptiz, YOhoho Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10900
2019-12-17csharp : add move tag info to EinaAccessor, EinaIterator converterYeongjong Lee
Summary: Included commits in devs/lauromoura/remove_eina_mono-rebased ``` commit ed6679db1901c710cc6ddb50e7001cfd20caa77a Author: Lauro Moura <lauromoura@expertisesolutions.com.br> Date: Mon Dec 2 13:58:04 2019 -0300 csharp: add move information to EnumerableToAccessor Still need to fix the converted accessor ownership, maybe by creating a custom accessor class that released the pinned memory when is freed. ``` ref T8486 Depends On D10878 Co-authored-by: Lauro Moura <lauromoura@expertisesolutions.com.br> Test Plan: meson build -Dbindings=mono,cxx -Dmono-beta=true Reviewers: YOhoho Reviewed By: YOhoho Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8486 Differential Revision: https://phab.enlightenment.org/D10879
2019-12-17eina_mono: replace EinaAccessor and EinaIerator with IEnumerableYeongjong Lee
Summary: Eina.Accessor<T> => System.Collections.IEnumerable<T> Eina.Iterator<T> => System.Collections.IEnumerable<T> Unit test will work with D10879. ref T8486 Test Plan: meson build -Dbindings=mono,cxx -Dmono-beta=true Reviewers: lauromoura Reviewed By: lauromoura Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8486 Differential Revision: https://phab.enlightenment.org/D10878
2019-12-17csharp: Suppressing non-events Raise methods.Bruno da Silva Belo
Summary: ref T8390 Reviewers: lauromoura, felipealmeida, YOhoho, jptiz Reviewed By: jptiz Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8390 Differential Revision: https://phab.enlightenment.org/D10717
2019-12-17csharp:Suppressing Warning and Add suffix collection.Bruno da Silva Belo
Summary: ref T8408 Reviewers: lauromoura, felipealmeida, YOhoho, jptiz Reviewed By: jptiz Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8408 Differential Revision: https://phab.enlightenment.org/D10669
2019-12-17csharp: apply same form of "Since EFL" to all manual bindings .cs filesJaehyun Cho
The following form of "Since EFL" is applied to descriptions of all manual bindings .cs files. /// <para>Since EFL 1.XX.</para>
2019-12-12csharp: Implement Deconstruct for structs.João Paulo Taylor Ienczak Zanette
Summary: Usage example: ``` var (x, y) = somePos2D; ``` Not available on Mono environment due to [`mcs` not implementing it](https://github.com/mono/mono/blob/a3de0304a190c54124df3486ce9c34b6262787a8/mcs/mcs/tuples.cs#L590). To keep tests from breaking because of it, a `MONO` preprocessor variable is defined and checked during test compilation. Ref T8489. Reviewers: brunobelo, lauromoura, segfaultxavi Reviewed By: lauromoura Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8489 Differential Revision: https://phab.enlightenment.org/D10809
2019-12-11c#: Implement IList<T> to Eina.List.Bruno da Silva Belo
Summary: Container can have three configuration over `Own` and `OwnContent`: `Own = true` and `OwnContent = true`; `Own = true` and `OwnContent = false`; `Own = false`and `OwnContent = false; If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises. There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`: Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`. No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`. For the memory, `Own` frees the node, while `OwnContent` frees the data portion. ref T8487 Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz Reviewed By: lauromoura Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8487 Differential Revision: https://phab.enlightenment.org/D10742
2019-12-09eolian_mono: reduce duplicated code in OnXXXEventYeongjong Lee
Summary: `CallNativeEventCallback` is used to reduce duplicated code. E.g. Before ``` protected virtual void OnFullscreenChangedEvent(Efl.Ui.WinFullscreenChangedEventArgs e) { var key = "_EFL_UI_WIN_EVENT_FULLSCREEN_CHANGED"; IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Elementary, key); if (desc == IntPtr.Zero) { Eina.Log.Error($"Failed to get native event {key}"); return; } IntPtr info = Eina.PrimitiveConversion.ManagedToPointerAlloc(e.arg ? (byte) 1 : (byte) 0); try { Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, info); } finally { Marshal.FreeHGlobal(info); } } ``` After ``` protected virtual void OnFullscreenChangedEvent(Efl.Ui.WinFullscreenChangedEventArgs e) { IntPtr info = Eina.PrimitiveConversion.ManagedToPointerAlloc(e.arg ? (byte) 1 : (byte) 0); CallNativeEventCallback("elementary", "_EFL_UI_WIN_EVENT_FULLSCREEN_CHANGED", info, (p) => Marshal.FreeHGlobal(p)); } ``` Test Plan: meson setup -Dbindings=mono,cxx -Dmono-beta=true Reviewers: lauromoura Reviewed By: lauromoura Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10661
2019-12-09c#: Suppressing warning for CA1724.Bruno da Silva Belo
Summary: ref T8413 Reviewers: lauromoura, felipealmeida, YOhoho, jptiz Reviewed By: jptiz Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8413 Differential Revision: https://phab.enlightenment.org/D10811
2019-12-09csharp: changing string literal with nameof.Lauro Moura
Summary: ref T8407 Reviewers: lauromoura, felipealmeida, YOhoho, jptiz Reviewed By: jptiz Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8407 Differential Revision: https://phab.enlightenment.org/D10668
2019-12-04charp: Require mono bindings when using dotnetLauro Moura
Allow using `-Ddotnet=true` to automatically pull `bindings=mono`. Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D10610
2019-11-20csharp: Components enum are flags now.Bruno da Silva Belo
Reviewers: lauromoura, felipealmeida, YOhoho Reviewed By: lauromoura Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8411 Differential Revision: https://phab.enlightenment.org/D10541
2019-11-20csharp: Hiding p-invokes.Bruno da Silva Belo
Summary: ref T8406 Reviewers: lauromoura, felipealmeida, YOhoho Reviewed By: YOhoho Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8406 Differential Revision: https://phab.enlightenment.org/D10651
2019-11-20csharp: Specifying StringComparison.Bruno da Silva Belo
Summary: ref T8405 Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi Reviewed By: lauromoura Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8405 Differential Revision: https://phab.enlightenment.org/D10650
2019-11-19csharp: Add IEquatable on classes.Lauro Moura
Summary: ref T8418 Reviewers: lauromoura, felipealmeida, segfaultxavi, YOhoho Reviewed By: lauromoura Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8418 Differential Revision: https://phab.enlightenment.org/D10647
2019-11-15csharp: More CA2000 fixesLauro Moura
Summary: For eldbus.Proxy.Send, as the native function takes ownership of the message, we Ref it so it can still be used afterwards. Ref T8423 Reviewers: brunobelo, felipealmeida, YOhoho Reviewed By: brunobelo Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8423 Differential Revision: https://phab.enlightenment.org/D10670
2019-11-14csharp: Disposing IDisposable objects.Bruno da Silva Belo
Summary: ref T8423 Reviewers: lauromoura, felipealmeida, YOhoho Reviewed By: lauromoura Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8423 Differential Revision: https://phab.enlightenment.org/D10644
2019-11-13csharp: Some missing conversionsLauro Moura
Summary: Ref T8430 Depends on D10616 Reviewers: brunobelo, segfaultxavi, felipealmeida, YOhoho Reviewed By: YOhoho Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8430 Differential Revision: https://phab.enlightenment.org/D10652
2019-11-12csharp: Add To and From methods for implicit conversion.Bruno da Silva Belo
Summary: ref T8430 Reviewers: lauromoura, felipealmeida, segfaultxavi, YOhoho Reviewed By: lauromoura Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8430 Differential Revision: https://phab.enlightenment.org/D10616
2019-11-12mono: reduce duplicated event codeYeongjong Lee
Summary: Introduction GetInternalEventCallback function to reduce duplicated event code. Test Plan: ninja test Reviewers: lauromoura Reviewed By: lauromoura Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10638
2019-11-12dotnet: Generate doc and check for warningsLauro Moura
Reviewers: segfaultxavi, brunobelo, felipealmeida Reviewed By: brunobelo Subscribers: cedric, #reviewers, #committers, woohyun Tags: #efl Differential Revision: https://phab.enlightenment.org/D10630
2019-11-07csharp: Localization strings with CultureInfo.Bruno da Silva Belo
Summary: ref T8404 Reviewers: lauromoura, felipealmeida, YOhoho Reviewed By: lauromoura Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8404 Differential Revision: https://phab.enlightenment.org/D10608