summaryrefslogtreecommitdiff
path: root/src/bin/eolian_mono (follow)
AgeCommit message (Collapse)Author
2018-12-17eolian_mono: use System.Type explicitlyJaehyun Cho
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.
2018-12-14efl-mono: Fix call of virtual methods after new APILauro Moura
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
2018-12-14eolian_mono: Add support for C# style propertiesLauro Moura
Summary: Syntatic sugar around the Get/Set functions for now. Test Plan: Run efl-mono-suite Reviewers: vitor.sousa, segfaultxavi, felipealmeida, Jaehyun_Cho Reviewed By: vitor.sousa Subscribers: cedric Tags: #efl_language_bindings Differential Revision: https://phab.enlightenment.org/D7394
2018-11-29csharp: Change to new class API.Lauro Moura
Summary: As discussed in T7204: - Eo Interfaces/mixins -> C# Interfaces with concrete class implementations - Eo Regular/Abstracts -> Proper C# classes - Added some new generators and helper methods. - Refactored the class generator, splitting into helper methods Eo handles now are stored only in the "root" class in any given inheritance tree (generally, Efl.Object), and accessible to each child. Methods also are defined in a single place instead of repeatedly generated in everyfile, reducing the size of the generated .dll from 30MB to around 4.5MB. Mixins are generated as C# interfaces but any regular class it inherits from is lost, as we can't have interfaces inheriting from regular classes. This will be dealt with in a later commit. Summary of API Changes: - Merged Inherit/Concrete classes. (These suffixes disappear from regular classes). - Interface still have implementations with 'Concrete' suffix for when they are returned from methods. - Removed 'I' from interface names. - Removed interfaces for regular/abstract Eo classes. - Concrete classes for interfaces/mixins hold the event argument struct. - Removed '_' from classes, enums, structs, etc, as indicated in C# naming conventions. - Namespaces are now Camel.Cased. - Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass Also renamed the test classes as after the namespace change, the test namespace Test can conflict with the helper Test namespace. (And use more meaningful names than Test.Testing...) Also Fixes T7336 by removing a deprecated example and adding efl_loop_timer_example to build system. Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper fields. The native handlers are used in the manual binding. Still need to work: - As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize" from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on the interface and implemented "namespaced" in the classes, requiring the cast to the interface to access the event. - The Mixin Conundrum. Mixin inheritance will be dealt in a future commit. Depends on D7260 Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho Reviewed By: vitor.sousa Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T7451, T7336 Differential Revision: https://phab.enlightenment.org/D7262
2018-11-05efl-mono: Typos in generated code commentsXavi Artigas
These comments end up in the API reference docs, so typos look bad.
2018-10-04csharp: Temporarily disable missing docs warningLauro Moura
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
2018-09-26efl-csharp: Fix event struct marshalling.Lauro Moura
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
2018-09-05efl-csharp: Fix event callback removal.Lauro Moura
Summary: Use the native event loaded from dlsym directly instead of wrapping it in a Event_Description structure. Fixes: T7355 Reviewers: felipealmeida, vitor.sousa, segfaultxavi Reviewed By: vitor.sousa Subscribers: cedric, #reviewers, #committers Tags: #efl_language_bindings Differential Revision: https://phab.enlightenment.org/D6981
2018-09-05efl-csharp: Make sure efl_finalize overrides are callableLauro Moura
Summary: efl_finalize override is called inside efl_add_end. Previously by this time the constructor still hadn't saved the C# wrapper handle into the Eo instance private data, to be recovered in the static delegates that call the C# overrides. This commit just changes the order to save the C# handle *before* calling efl_add_end. Test Plan: added unit test to be run with make check Reviewers: felipealmeida, vitor.sousa, Jaehyun_Cho Reviewed By: vitor.sousa Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D6956
2018-08-24csharp: Fix event registration in constructor.Lauro Moura
Summary: The binding user should be able to register to events inside the initialization callback given to the constructor. Fixes T7346 Reviewers: segfaultxavi, felipealmeida, vitor.sousa Reviewed By: segfaultxavi, vitor.sousa Subscribers: cedric, #reviewers, #committers, zmike Tags: #efl Maniphest Tasks: T7346 Differential Revision: https://phab.enlightenment.org/D6908
2018-05-25efl_mono: Fix efl_add_internal_end call.Lauro Moura
Summary: It was missing setting the 'is_ref' parameter to 1 to mirror the internal_start call. Test Plan: make check Reviewers: cedric Subscribers: #committers, zmike Tags: #efl Differential Revision: https://phab.enlightenment.org/D6193 Reviewed-by: Cedric BAIL <cedric@osg.samsung.com>
2018-05-24efl_mono: Fixes after efl_part/del changes.Lauro Moura
Reviewed-by: Cedric BAIL <cedric@osg.samsung.com>
2018-05-23efl_mono: Generate support for accessors in .eosLauro Moura
Summary: Depends on D6190 Reviewers: felipealmeida, vitor.sousa Reviewed By: vitor.sousa Subscribers: cedric, #committers, zmike Tags: #efl Differential Revision: https://phab.enlightenment.org/D6191
2018-05-23efl_mono: Fix events after Event_Description rename.Lauro Moura
2018-05-17efl_mono: Start generating eina future in eolian_mono.Lauro Moura
Summary: Besides the normal methods returning Futures, we now generate a wrapper with the "Async" suffix. This wrapper returns a Systems.Threading.Tasks.Task which can be awaited on and reflect the status of the Future. When an eina.Future fails with ECANCELED, TaskCanceledException is raised in the Task. Otherwise, an efl.FutureException(eina.Error) is raised. Depends on D6174 Reviewers: felipealmeida Reviewed By: felipealmeida Subscribers: cedric, zmike Tags: #efl Differential Revision: https://phab.enlightenment.org/D6175
2018-05-17efl_mono: Initial support for Futures/PromisesLauro Moura
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
2018-05-17efl_mono: Add support for Eina.Error/Empty in eina.ValueLauro Moura
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
2018-05-17efl_mono: Add documentation tag in part declLauro Moura
Summary: Depends on D6170 Reviewers: felipealmeida Reviewed By: felipealmeida Subscribers: cedric, zmike Tags: #efl Differential Revision: https://phab.enlightenment.org/D6171
2018-05-17efl_mono: Fix generation of event argumentsLauro Moura
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
2018-05-11efl_mono: Support type aliases.Lauro Moura
Summary: Due to the absence of typedef from C#, we generate thin structs with implicit operators to allow reference the data from their typedef'd name from C#. The other alternatives would be always converting to the lowest base on the alias stack (losing the meaningfulness of the typedef name) or using the 'using' directive. The latter has the restriction that it makes an alias visible only in the file they are declared. Reviewers: felipealmeida, cedric, segfaultxavi Reviewed By: segfaultxavi Subscribers: zmike Tags: #efl Differential Revision: https://phab.enlightenment.org/D6157
2018-05-03efl_mono: Change generated classes naming schemeLauro Moura
Summary: Now the generated classes use an approach more familiar to C# developers: Interfaces: efl.Object -> efl.IObject Concrete (implementation) classes: efl.ObjectConcrete -> efl.Object. During this change, some methods that could clash with the implementation class name (CS0542) had the prefix "Do" added (like in efl.Duplicate.Duplicate() and efl.Pack.Pack()). Depends on D6049 Reviewers: felipealmeida, vitor.sousa Reviewed By: vitor.sousa Subscribers: cedric Tags: #efl Differential Revision: https://phab.enlightenment.org/D6050
2018-05-03efl_mono: More uniformization of the handling of namesLauro Moura
Summary: Uses a common helper to open and close namespaces, to get the managed and unmanaged name of things, the interface, concrete and inherit class names, etc. eolian_cxx: Add namespace information to func_def, as it'll avoid eolian-cxx clients dealing with the eolian C api directly when trying to access a function pointer namespace. Depends on D6048 Reviewers: felipealmeida, vitor.sousa Reviewed By: vitor.sousa Subscribers: cedric Tags: #efl Differential Revision: https://phab.enlightenment.org/D6049
2018-04-26efl_mono: Fix support for event arguments.Lauro Moura
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
2018-04-26efl_mono: Move event generators to its own header.Lauro Moura
Summary: Making it easier to share code between self and inherited events. During this move, the namespace and keyword headers were merged into the name_helpers header. Also added the first seed of a generic namespace reducer function, to be used by other functions in later commits. Depends on D5994 Reviewers: felipealmeida Reviewed By: felipealmeida Subscribers: segfaultxavi, cedric Differential Revision: https://phab.enlightenment.org/D5995
2018-04-26efl_mono: Reorganize utility functions.Lauro Moura
Summary: Blacklist functions are all in the header/namespace blacklist. Helper functions returning strings (names) are in the name_helpers header. They act somewhat like "mini-generators". Helpers.hh was left with other kind of helper functions (checks, etc) that do not return strings. Depends on D5992 Reviewers: felipealmeida Reviewed By: felipealmeida Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D5993
2018-04-26efl_mono: Use PascalCase in eventsLauro Moura
Summary: To deal with events with the same name as some methods (Del, Invalidate, etc), the suffix Evt was added. Thus, now we use obj.ButtonClickedEvt += callback; Instead of obj.BUTTON_CLICKED += cal The argument classes use the same scheme, being called <Evt name>_Args. Depends on D5991 Reviewers: felipealmeida Reviewed By: felipealmeida Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D5992
2018-04-26eolian_mono: Register is not a kw in C#Lauro Moura
Summary: It was a reminiscing bit from the c++ generator. Reviewers: felipealmeida Reviewed By: felipealmeida Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D5991
2018-04-12efl_mono: Add namespace on helpers.Lauro Moura
Make it easier on finding where those functions are coming from.
2018-04-12efl_mono: Proper support for @class methods.Lauro Moura
Previously, class methods were implemented as regular instance methods. This commits generates C# static methods for @class methods on the *Concrete classes (and their childs).
2018-04-03csharp: Fix typo in generated code.Lauro Moura
2018-04-03csharp: Support argument marshalling in func ptrsLauro Moura
Function pointers now go through the same argument marshalling pipeline as normal functions. This will enable interfaces like Efl.Ui.Format to work properly.
2018-04-03efl_mono: Initial version of Strbuf support.Lauro Moura
Also moved the ValueOwnership enum from eina value to eina.Ownership. It can be shared among the eina structures if needed.
2018-04-03efl-mono: Fix using efl_add_ref instead of efl_refFelipe Magno de Almeida
2018-04-03efl-mono: Fix compile flags, .config files and class_name in descriptionFelipe Magno de Almeida
2018-03-20csharp: Add support for efl parts as PropertiesLauro Moura
Instead of var bg = efl.ui.Background.static_cast(myobj.Part("background")); Now do var bg = myobj.Background; Also a couple helper functions were added.
2018-03-16csharp: Fix support for ptr(structs)Lauro Moura
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.
2018-03-08csharp: generate helper constructors for structs.Lauro Moura
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>
2018-03-02eolian cxx,csharp: Update after eolian changesLauro Moura
Closes D5829.
2018-03-02eolian*: replace various directory_scan/file_parseDaniel Kolesa
2018-02-27eolian: eolian_* -> eolian_state_*, Eolian -> Eolian_StateDaniel Kolesa
2018-01-25eolian_mono: Add underlying pointer to ToStringLauro Moura
It'll make easier to track where an object is coming from.
2018-01-25eolian_mono: Fix event argument for stringsLauro Moura
2018-01-25eolian_mono: Fix visibility of generated eventsLauro Moura
Protected members do not make sense in sealed classes like the Concrete ones. Also document the placeholder field in extern structures.
2017-12-20efl-mono: Fix using right description pointer in event registrationFelipe Magno de Almeida
2017-12-20eolian-mono: Add documentation generation supportLauro Moura
This commit adds the "documentation" generator, which gets the documentation_def attribute of the given item and generates xml comments to be exported by MCS. For items requiring some customization of the generated comments (e.g. functions and its parameters), the helpers to generate the preamble (summary), body (paragraphs) and epilogue (currently just the @since tag) were added. Currently we do not support converting Eolian references into xmldoc references. As we explicitly generate Get/Set methods for properties, for now the generator tries to get the get/set specific documentation first. If it is not present, fallback to the common docs. Later this could be changed to generate the common one as paragraphs of the Get/Set. Also some generated code like the wrappers for calling C# methods from C can be private. This will cleanup the introspection results and warnings when generating documentation. Due to this visibility change, the binbuf tests had to be changed to add redirect calls to the native methods instead of directly calling the DllImport'd methods.
2017-12-15eolian_mono: fix handling of regular ptr() typesVitor Sousa
2017-12-15efl_mono: tests and better support for structs, plus some other fixesVitor Sousa
Fix several integer binding type deduction based in its size on C. Generation for function pointers no longer use modified argument name which is different from the parameter name. New generation context for structs. bool from UnmanagedType.I1 to UnmanagedType.U1 (correct use inside structs according to mono documentation). byte (signed char) and int8 now is correctly represented by sbyte in C#. Check parameter direction in some out generators in parameter.hh. Add efl_libs.csv to gitignore. Make eina.Value pointer constructor public. Add missing fields to efl.kw_event.Description struct. Remove eina.File workaround (let struct gen handle it). Remove is_function_ptr bool from regular_type_def and add a typedecl_type enum to it. Also add some helper methods for easier comparison. Left some test cases commented for when pointer parameters are properly working.
2017-12-14efl-mono: Add workaround for efl_ui_listFelipe Magno de Almeida
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.
2017-12-14efl.image.load: fix eolian redefine warnings for load_error{}Amitesh Singh
load_error{} was defined in efl.file as well. remove load_error{} from efl.image.load intf and implement Efl.File.load_error{} instead. Ref T6514
2017-12-06eolian_mono: Fix build after Eolian_StateLauro Moura
Summary: eolian_mono now properly fills Eolian Unit when calling eolian_cxx classes and functions. Reviewers: felipealmeida Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D5614