Commit Graph

113 Commits

Author SHA1 Message Date
Lauro Moura f9586a831b csharp: Add support for efl parts as Properties
Instead of
   var bg = efl.ui.Background.static_cast(myobj.Part("background"));

Now do
   var bg = myobj.Background;

Also a couple helper functions were added.
2018-03-20 16:50:30 -03:00
Lauro Moura 2705ea8531 csharp: Fix support for ptr(structs)
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-16 11:12:49 -03:00
Lauro Moura 067a8baffa csharp: generate helper constructors for structs.
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-08 15:46:45 -08:00
Lauro Moura cf03e35766 efl_mono: Remove unneeded code from tests 2018-01-25 15:27:05 -03:00
Lauro Moura eaf41d9bce eolian_mono: Fix event argument for strings 2018-01-25 15:27:05 -03:00
Vincent Torri f5b01ac5ce all: Simplify definition of EAPI
This will help in the transition from Autotools to Meson. This has been
tested on Windows for which EFL_XXX_BUILD were first introduced.
2018-01-18 18:04:03 +09:00
Lauro Moura 46b202b86c eolian-mono: Add documentation generation support
This commit adds the "documentation" generator, which gets the
documentation_def attribute of the given item and generates xml comments
to be exported by MCS.

For items requiring some customization of the generated comments (e.g.
functions and its parameters), the helpers to generate the preamble
(summary), body (paragraphs) and epilogue (currently just the @since
tag) were added.

Currently we do not support converting Eolian references into xmldoc
references.

As we explicitly generate Get/Set methods for properties, for now the
generator tries to get the get/set specific documentation first. If it
is not present, fallback to the common docs.

Later this could be changed to generate the common one as paragraphs of
the Get/Set.

Also some generated code like the wrappers for calling C# methods
from C can be private. This will cleanup the introspection results
and warnings when generating documentation.

Due to this visibility change, the binbuf tests had to be changed
to add redirect calls to the native methods instead of directly
calling the DllImport'd methods.
2017-12-20 19:57:17 -02:00
Vitor Sousa b55542889b efl_mono: fix test and example compilation on Windows 2017-12-15 22:26:30 -02:00
Vitor Sousa acd99be98b efl_mono: tests and better support for structs, plus some other fixes
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-15 22:26:29 -02:00
Felipe Magno de Almeida ff9293827f efl-mono: Fix automake files in C# binding search with buggy mono version 2017-12-11 14:45:57 -02:00
Jean-Philippe Andre b3435831f7 c#: Fix test case
return -1 in a void function breaks the build for me (clang)
2017-12-05 15:06:34 +09:00
Felipe Magno de Almeida 66eb8ddfeb eolian: Add inarray and inlist to source generation 2017-12-04 20:34:47 -02:00
Lauro Moura 345336c46d efl_mono: Added test files for the C# bindings.
Buildsystem integration will come in a future commit.
2017-12-04 15:47:50 -03:00