Commit Graph

160 Commits

Author SHA1 Message Date
Cedric BAIL 8a513a522e efl: major rewrite of efl_part.
The interface efl_part_get should not be directly called from C, but the efl_part
wrapper should. It rely on efl_noref to properly destroy the object. Binding can
control the lifecycle of the reference the way they want by either calling the
wrapper or efl_part_get directly. It also means that the ugly ___efl_auto_unref_set
doesn't need to be exposed outside of EFL anymore.

Differential Revision: https://phab.enlightenment.org/D6098
2018-05-24 16:02:18 -07:00
Lauro Moura da6f5932f1 efl_mono: Support type aliases.
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-11 11:01:59 -03:00
Lauro Moura c9dd86579f efl_mono: More uniformization of the handling of names
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-05-03 18:04:41 -03:00
Lauro Moura 473d5b79c5 efl_cxx: remove eolized promises from the CXX bindings
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
2018-05-01 10:39:01 -07:00
Lauro Moura a413914c18 efl_mono: Move event generators to its own header.
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-26 10:55:18 -03:00
Lauro Moura 65f868786a efl_mono: Proper support for @class methods.
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-12 21:23:42 -03:00
Lauro Moura 9a6dd32cb1 eolian_cxx: Fill documentation of part_def. 2018-03-20 16:50:30 -03:00
Lauro Moura 38bf8cc923 eolian-cxx: Add helper method to get all parts
Line get_all_methods, gets everything from the inherits too.
2018-03-20 16:50:30 -03:00
Lauro Moura 78251aa0d2 eolian_cxx: Add 'unknown' to parameter direction
It'll be used in eolian_mono as the 'direction' of return types in some
helper functions.
2018-03-16 11:12:49 -03:00
Daniel Kolesa 1f4d919cf9 eolian: update type/var name APIs 2018-03-12 16:28:28 +01:00
Daniel Kolesa edcd81ee49 eolian: update class name APIs 2018-03-12 16:03:37 +01:00
Daniel Kolesa 1117a67818 eolian cxx: remove usages of obsolete file_get APIs 2018-03-08 22:53:51 +01:00
Lauro Moura 6f092071ac eolian cxx,csharp: Update after eolian changes
Closes D5829.
2018-03-02 23:58:20 +01:00
Daniel Kolesa 6a284e48c9 eolian: eolian_* -> eolian_state_*, Eolian -> Eolian_State 2018-02-27 16:12:35 +01:00
Lauro Moura e70368f10e eolian_cxx: Fix "unused parameter" warnings
The Klass(Klass &&other) one was causing "synthesized method ... first
required here' warnings on Windows gcc-4.8.
2018-01-25 15:56:08 -03:00
Jean-Philippe Andre 9ceb9419af cxx: Fix a trivial warning 2018-01-19 15:59:21 +09:00
Daniel Kolesa d47610a732 eolian: do not require unit when stringifying types
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.
2018-01-16 16:39:05 +01:00
Daniel Kolesa dd2e579fec eolian: do not require unit for expr eval APIs
The necessary information is now stored directly in the expr
during database validation.

Also enable expr validation for params.
2018-01-16 16:37:52 +01:00
Daniel Kolesa 19c16b671e eolian: type_typedecl_get doesn't need a unit 2018-01-12 18:05:13 +01:00
Daniel Kolesa 707ed05d58 eolian: do not require unit for type_class_get 2018-01-12 18:05:13 +01:00
Thiep Ha 360ce182ef eolian_cxx: support multiple function pointers 2018-01-12 18:45:40 +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 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
Daniel Kolesa 18e18ca74c eolian: remove remaining global state (+ modify APIs accordingly) 2017-12-15 17:11:11 +01:00
Lauro Moura c5ff7f0f46 eolian_cxx: Fix Eolian_Unit support
Summary:
Unit is now stored in klass_def, parameter_def and function_def for
future calls to the Eolian API.

Reviewers: felipealmeida, jpeg

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D5613
2017-12-06 19:10:40 -03:00
Jean-Philippe Andre 207a0cf3e3 eo: Move hacky API auto_unref to C only
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).
2017-12-05 15:06:34 +09:00
Jean-Philippe Andre 8cdb3184f8 cxx: Fix compilation after merge
This resolves a few issues and brings back the experimental features.

Also, disable some of the ugliest experiments:
 - manual function overrides,
 - define APIs only in eo_cxx namespace

Some APIs are generated behind EFL_CXXPERIMENT (eg. event_name_cb_add or
some weak pointer stuff). I believe they are useful but would like to
make sure there are no serious drawbacks with generating those.
2017-12-05 15:01:45 +09:00
Jean-Philippe Andre 2b0805ddce cxx: Define types after forward declarations
This is useful if the types refer to the current class.
2017-12-05 15:01:45 +09:00
Jean-Philippe Andre 09cf282741 cxx: Use per-function guards in efl object
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??).
2017-12-05 15:01:45 +09:00
Jean-Philippe Andre 5d6a5343b7 cxx: Include definition header in impl header
Good for IDE's. Not extremely useful considering how unreadable those
files are.
2017-12-05 15:01:43 +09:00
Jean-Philippe Andre cb7f2d0dd5 cxx: Add header guards for manual definitions
This will be used for things like efl_del

efl_part was a lucky case where the entire class was to be implemented
manually, thus the global header guard was sufficient.
2017-12-05 10:17:46 +09:00
Jean-Philippe Andre 6653b9e2b1 cxx: Implement support for @class static functions 2017-12-05 10:17:02 +09:00
Jean-Philippe Andre 0f812f1584 cxx: Fix indentation of ifdef guard 2017-12-05 10:15:40 +09:00
Jean-Philippe Andre 5901b4601e cxx: Implement support for parts
This generates methods like this:

  Part_Class part_name() const;

Which can then be used like:

  slider.indicator().format_string_set("%1.1f");
2017-12-05 10:15:40 +09:00
Jean-Philippe Andre 0f5d40e6d4 cxx: Add header guards to .impl.hh
Those are included headers after all, even if they're only included once
from Elementary.hh (or whatever Efl_Header.hh).
2017-12-05 10:14:03 +09:00
Jean-Philippe Andre b4e3d4d8a4 cxx: Avoid pedantic warning with -Wold-style-cast
This affects the generated headers.
2017-12-05 10:14:03 +09:00
Jean-Philippe Andre 03af836332 cxx: Use set for forward classes
This avoids duplication. Not very important as there are FWD_GUARD
macros anyway.
2017-12-05 10:14:03 +09:00
Jean-Philippe Andre d887c4de52 cxx: Add implicit conversion to Eo* pointer
This is part of the experimental stuff.

Allows calling C functions without using ._eo_ptr() explicitly. Probably
not super useful, assuming the interfaces are done :)
2017-12-05 10:14:03 +09:00
Jean-Philippe Andre a787c3cc07 cxx: Only use eo_cxx:: for methods
Add an experimental (disabled) macro to only generate functions inside
the eo_cxx equivalent of a class, instead of inside both the eo_cxx and
the normal class definition.

I guess the duplicated definition had something to do with doxygen, but
I'm not sure this is quite necessary as doc will be generated with
custom scripts.
2017-12-05 10:14:03 +09:00
Jean-Philippe Andre 12d50cbe19 cxx: No instantiate ctors for non-regular classes
Only regular classes can be instantiated, this should be reflected in
the C++ binding as well.
2017-12-05 10:14:03 +09:00
Jean-Philippe Andre 753304c69d cxx: Add define EFL_CXXPERIMENTAL for testing
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)
2017-12-05 10:14:03 +09:00
Jean-Philippe Andre 5425baa906 cxx: Add support for function pointers
This was tested on the function pointer Efl.Ui.Format_Func_Cb
2017-12-05 10:14:03 +09:00
Jean-Philippe Andre a597084db7 cxx: Add strbuf to the list of recognized builtins 2017-12-05 10:09:58 +09:00
Jean-Philippe Andre 258a214e0f cxx: Add event_cb_add functions to events
This enables a syntax like:

  button.clicked_event_cb_add([]() { std::cout << "Hello" << std::endl; });

I could not manage to pass the std::placeholders inside the template,
depending on whether the lambda has arguments or not. Not sure if
that's even possible.
2017-12-05 10:09:58 +09:00
Lauro Moura e6dd831f7e eolian_cxx: Many changes for the C# bindings
- Added helper function to get all methods of a given class (local and
  inherited methods)
- Add filename information to klass
- Added new defs: enum, value (currently only integers), struct
- Generator refactoring
- Eolian C compatibility
2017-12-04 15:47:49 -03:00
Jean-Philippe Andre c490392ee6 cxx: Fix ifdef protections in function impl
Mote: for protected we should use "protected:" if that is somehow
possible.
2017-11-07 09:57:24 +09:00
Jean-Philippe Andre e7009b77a2 cxx: Add experimental "easy" way to use wref
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;
2017-11-07 09:57:24 +09:00
Jean-Philippe Andre 73ec85aeff cxx: Add _get_wref() convenience to all classes
This allows constructs like:

  auto w_obj = obj._get_wref();
  auto cb = std::bind([w_obj]() {
    auto o = w_obj.lock();
    if (!o) return;
    o->call();
  });
  event_add(..., obj, cb);

Note: I don't like how those wref work. Close to c++ wref but far from
EFL wref.
2017-11-07 09:57:24 +09:00
Jean-Philippe Andre 3f64dcc521 cxx: Place beta API declarations behind ifdef
NOTE: protected APIs are placed behind ifdef as well in the
implementation file. This makes sense since the define is required for
the C code to compile, but this isn't what @protected means.
2017-11-07 09:57:24 +09:00
Felipe Magno de Almeida f05a799daa eolian-cxx: Fix multiple definitions in forward declaration 2017-10-25 18:03:09 -02:00