Commit Graph

227 Commits

Author SHA1 Message Date
Felipe Magno de Almeida 15acb0586a cxx: Fix uses of intrinsic eolian binbuf type
Add special binbuf and Eina_Strbuf conversions

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D11950
2020-06-09 10:29:32 +02:00
Felipe Magno de Almeida df0715a9aa C#: Add error checking for Eina.Success_Flag return type
When a get and/or set from property is defined to return, explicitly,
a Eina.Success_Flag, the mono generator will check the return value
and generate an exception if the call fails.
Resolves T8383.

Reviewed-by: João Paulo Taylor Ienczak Zanette <joao.tiz@expertisesolutions.com.br>
Differential Revision: https://phab.enlightenment.org/D11281
2020-02-18 17:53:19 -03:00
Felipe Magno de Almeida 595cb754b3 eolian-mono: Make Get/Set internal for generated properties
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-18 16:47:38 -03:00
Yeongjong Lee 292f4bc0da Revert "csharp: Property Indexer implementation"
Summary:
This reverts commit 0954e501fd.

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-21 07:00:44 +09:00
Felipe Magno de Almeida 25e52f8106 C++: Fix use of @c_type tag in struct definition
Summary: Depends on D11090

Reviewers: zmike

Reviewed By: zmike

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11099
2020-01-17 09:51:24 -05:00
Lauro Moura 0954e501fd csharp: Property Indexer implementation
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-23 13:50:12 -03:00
Xavi Artigas bd0231e98b eolian_mono: proper parsing of doc notes and paragraphs
Summary:
The documentation tokenizer relies on proper separation of paragraphs,
and we were not doing that. This fixes detection of Note:, Warning:,
Remark: and TODO: tags.
Additionally, we were removing the blank line between the summary and
the description, artificially joining them.

Test Plan: Everything builds and passes tests, and docs with `Note:` tags are correctly rendered (like `Efl.Loop_Consumer.new_promise`, for example)

Reviewers: lauromoura

Reviewed By: lauromoura

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D10868
2019-12-12 19:07:59 -03:00
João Paulo Taylor Ienczak Zanette e617ff441a csharp: Add implicit conversion from tuples to structs.
Summary:
Also generates implicit conversion for 1-field structs.
Usage examples:

```
// With tuples
Point2D p = (1, 2);
obj.SetPoint((1, 2));

// With 1-field structs
StringWrapper sw = "Must be handled by wrapper.";
```

Due to limitations of MSC compiler, implicit conversions are generated
only if struct has 4 fields or less.

Ref T8489.

Reviewers: brunobelo, cedric, lauromoura, segfaultxavi

Reviewed By: lauromoura

Subscribers: #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8489

Differential Revision: https://phab.enlightenment.org/D10801
2019-12-12 13:16:22 -03:00
Lauro Moura 11094aeaaf csharp: Add more since tags to members
Summary:
- Class constructors and other members
- Aliases fields

ref T8359

Reviewers: felipealmeida, segfaultxavi, brunobelo, woohyun

Reviewed By: felipealmeida

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8359

Differential Revision: https://phab.enlightenment.org/D10419
2019-11-26 12:40:32 -03:00
Lauro Moura 642b243df9 csharp: Fix helper function
Summary: Was failing if the suffix were equal to the source string

Reviewers: felipealmeida, segfaultxavi, YOhoho, brunobelo

Reviewed By: brunobelo

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D10708
2019-11-22 12:01:59 -03:00
Lauro Moura 135c69b23c eolian_cxx: Add key/value to function_def
Summary:
This commit adds explicit eolian key/value/return info to function_def. The
original parameter/return types are kept for compatibility.

parameter/return -> Mimics the behavior of the generated C API (i.e.
single-valued getters have their lone value translated to be their
return type)

explicit_return -> The actual return value for that block in the EO
file.
keys/values -> The values for respectively key and values blocks.

This should help working with properties in the generators instead of
fumbling with paremeter/return directly

Fixes T8431

Test Plan: extra tests in the diff

Reviewers: felipealmeida, brunobelo, segfaultxavi, YOhoho

Reviewed By: brunobelo

Subscribers: cedric, #reviewers, #committers, woohyun

Tags: #efl

Maniphest Tasks: T8431

Differential Revision: https://phab.enlightenment.org/D10494
2019-10-28 20:35:39 -03:00
Felipe Magno de Almeida a3ade15d5a cxx: Add license to CXX bindings.
Summary:
Like C#, it will also be Apache 2.0

Depends on D9414

Reviewers: vitor.sousa, woohyun, jpeg, lauromoura

Reviewed By: lauromoura

Subscribers: jpeg, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9418
2019-10-24 10:40:16 -03:00
Lauro Moura 5516b06af5 eolian-cxx: Make events inherit beta info from klass.
To mimic function behavior

Reviewed-by: Felipe Magno de Almeida <felipe@expertisesolutions.com.br>
Differential Revision: https://phab.enlightenment.org/D10381
2019-10-12 19:18:13 -03:00
Lauro Moura b1a1cdc701 eolian-cxx: Rename fields to standard naming
Summary: bool fields were missing the `is_` prefix.

Reviewers: felipealmeida, brunobelo, segfaultxavi, woohyun

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D10380
2019-10-12 18:36:44 -03:00
Lauro Moura fb7c35269c csharp: Respect beta for type aliases
Summary: Also add beta info to `alias_def` in eolian_cxx.

Reviewers: brunobelo, felipealmeida, woohyun, segfaultxavi

Reviewed By: segfaultxavi

Subscribers: segfaultxavi, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D10315
2019-10-09 16:45:30 +02:00
Yeongjong Lee d1dd3c30b9 eolian_mono: Respect beta for enum
Summary: this prevent generating beta enum with `-Dmono-beta=false`.

Test Plan: meson setup -Dbindings=mono,cxx -Dmono-beta=false

Reviewers: lauromoura, Jaehyun_Cho

Reviewed By: Jaehyun_Cho

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D10245
2019-09-30 13:52:45 +09:00
Bruno da Silva Belo 7ba4f00f57 eolian_cxx: Possible infinite loop, if called.
Reviewers: lauromoura, felipealmeida

Reviewed By: lauromoura

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D10200
2019-09-26 18:53:23 -03:00
Daniel Kolesa b0ee540ec9 eolian: rename param direction enum and fields for consistency 2019-09-26 16:56:13 +02:00
Daniel Kolesa 71cd89c580 eolian: expose most API as stable
There is still some TODO with builtin types, parameter
directions and prefixes, which will be resolved in the
next commits.
2019-09-25 18:26:07 +02:00
Daniel Kolesa 92da64a532 eolian: remove support for globals
This was meant to happen but did not previously happen. It is not
ideal to do it now but better do it while we still can.

In short, this removes one half of the variables API (keeps
constants as they are) and repurposes the API to be only for
constants. This is also better for consistency to match errors.
2019-09-24 18:27:37 +02:00
Lauro Moura 03da60997e cxx: Fix some warnings from -Wextra
Summary:
- As we don't have C++17's [[fallthrough]], rely on GCC'd detection
  of fallthrough comments.

  See https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/

- Replaced some copy constructors with typecast operators.

  Previously, a constructor with remove_const/remove_cv were used
  to allow const iterators to be constructed from non-const iterators.
  This had the side effect of making these constructors actual copy
  constructors for non const lists. As we did not define other
  special constructors/operators, the rule of 5 were violated for these
  cases.

  This commit replaces these constructors with actual typecast operators
  that promote non const iterators to their const counterparts.

- Cast a Eina_Bool/bool narrowing conversion

- Add a missing break statement from D10050

Reviewers: zmike, brunobelo, felipealmeida

Reviewed By: brunobelo

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9934
2019-09-23 13:58:01 -03:00
Daniel Kolesa 53a3326ddc eolian: rename any_value_ptr -> any_value_ref for consistency 2019-09-20 18:03:39 +02:00
Lauro Moura 32f92d3d86 csharp: Add support for default param references in documentation
Summary:
This also adds the information of default values in `parameter_def`.
This will help adding actual default parameter support in the C#
bindings.

Thanks to @segfaultxavi for improved formatting and escaping.

Fixes T8224

Reviewers: segfaultxavi, felipealmeida, brunobelo

Reviewed By: segfaultxavi

Subscribers: cedric, #reviewers, segfaultxavi, #committers

Tags: #efl

Maniphest Tasks: T8224

Differential Revision: https://phab.enlightenment.org/D10050
2019-09-20 16:23:54 +02:00
Mike Blumenkrantz 9dc7643f93 Revert "cxx: Fix some warnings from -Wextra"
This reverts commit bdb8505f3b.

more review pending on this
2019-09-16 14:19:43 -04:00
Lauro Moura bdb8505f3b cxx: Fix some warnings from -Wextra
Summary:
- As we don't have C++17's [[fallthrough]], rely on GCC'd detection
  of fallthrough comments.

See https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/

- Add some missing copy assignment operators as reported by
  -Wdeprecated-copy

- Cast a Eina_Bool/bool narrowing conversion

Reviewers: zmike, brunobelo, felipealmeida

Reviewed By: zmike

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9934
2019-09-16 12:41:37 -04:00
Daniel Kolesa d9594dbc9d eolian: drop @ctor_param and the associated APIs
This has been unused for a while, and has been just lingering
around the code, so drop it so it doesn't make it into a release.
2019-09-16 15:37:04 +02:00
Lauro Moura dfb856158c csharp: Skip non-public members from interfaces
Summary:
Eolian allows non-public members in interfaces and mixins (usually
@protected). As both kinds are converted to C# interfaces, this
causes problem as non-public members are forbidden in C# interfaces.

This commit changes eolian_mono by removing those members from the C#
interfaces. If a generated class implements the interface, the method is
generated as if it were a protected member of the class directly.

For mixed properties like `Efl.Io.Reader.CanRead { get; set @protected; }`,
the interface has only the public getter and the the implementing class has both
the public getter and the protected setter.

With this, C# devs won't be able to directly implement protected Eo
methods from interfaces. (But this really does not make sense from the
C# point of view).

ref T7494

Reviewers: segfaultxavi, felipealmeida, YOhoho

Reviewed By: YOhoho

Subscribers: cedric, brunobelo, Jaehyun_Cho, #reviewers, woohyun, #committers

Tags: #efl

Maniphest Tasks: T7494

Differential Revision: https://phab.enlightenment.org/D9800
2019-09-10 19:30:47 -03:00
Daniel Kolesa 267c57d0f1 eolian: remove second parameter for eolian_type_c_type_get
This has been replaced by newer APIs.
2019-09-09 18:26:49 +02:00
Lauro Moura 165921ec04 eolian_cxx: Add support for @by_ref
Summary:
It will coexist with `eolian_type_is_ptr` while we phase out the latter.

Fixes: T8211

Depends on D9866

Reviewers: q66, felipealmeida

Reviewed By: q66

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9867
2019-09-09 18:10:02 +02:00
Lauro Moura f6747d6822 eolian_cxx: Remove last usage of type_is_owned
Reviewers: q66, felipealmeida

Reviewed By: q66

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9866
2019-09-07 00:57:14 +02:00
Lauro Moura 1e85548214 eolian_cxx: Replace type_is_owned with is_move
Summary:
is_owned is being replaced with the is_move family of functions.

This commit changes only the libeolian usage inside libeolian_cxx,
keeping the has_own naming in the generators for a simpler patch
during this freeze period.

Fixes T8199

Reviewers: q66, felipealmeida

Reviewed By: q66

Subscribers: cedric, #reviewers, brunobelo, #committers

Tags: #efl

Maniphest Tasks: T8199

Differential Revision: https://phab.enlightenment.org/D9843
2019-09-05 20:05:19 +02:00
Daniel Kolesa 6751f011c1 eolian: remove the expression eval_type API
This is unnecessary because for all contexts where type is
relevant the validator already makes sure the type and expression
match correctly, so you don't ever need to re-validate it. If you
are doing a generic case and are not sure, just use MASK_ALL.
2019-09-04 18:02:47 +02:00
Felipe Magno de Almeida 1aa05ab41b eolian-mono: Add support for multi-value properties with tuples
Summary: T8133

Reviewers: woohyun, segfaultxavi, felipealmeida

Reviewed By: felipealmeida

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9577
2019-08-23 14:07:09 -03:00
Daniel Kolesa 2f147f2725 eolian: rename is_class api for functions to is_static
Still needs restriction to classes only etc to be done later.

Ref https://phab.enlightenment.org/T8118
Ref https://phab.enlightenment.org/T7675
2019-08-16 16:33:37 +02:00
Felipe Magno de Almeida 491a9a5bf8 eolian-mono: Use correct allocator to free with free, and not delete
T8137
Differential Revision: https://phab.enlightenment.org/D9576
2019-08-16 16:01:38 +02:00
Lauro Moura ccd5441b8f cxx: Fix funcptr c_args declaration.
Summary:
The internal wrapper was generating the argument types directly instead
of passing through the translation generator `grammar::c_type`.

This caused the type in the `caller` callback to be different from the
actual C type of the declared function pointer, like in `@out` parameters.

Reviewers: tasn, felipealmeida

Reviewed By: felipealmeida

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9524
2019-08-07 16:14:27 -03:00
Vitor Sousa c1b76d3008 csharp: fix ownership of value types in arrays and lists
Summary:
`eolian_mono` now considers the implicit ownership of value types in arrays and
lists when generating ownership flags.

Also, update manual bindings for arrays and lists to no longer free elements
in the `Dispose` method when the container has ownership of the elements
but C# itself does not have ownership of the container; the elements will be
freed by whoever owns the container.
Modifying and removing elements will still free them though.

Re-enabled unit tests that required ownership of value type elements.

Reviewers: felipealmeida, q66, vitor.sousa

Reviewed By: felipealmeida

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9457
2019-08-05 19:15:35 -03:00
Xavi Artigas 44e0027338 mono-docs: Add misc struct docs
Summary:
Structs have a convenience constructor which was missing parameter documentation.
Struct fields need a <value> tag or there is a hole in the generated docs.
The documentation for the type of the field has been used, when available.

Test Plan: Build docs and look at generated pages for structs.

Reviewers: lauromoura, vitor.sousa, felipealmeida

Reviewed By: lauromoura

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9478
2019-08-01 21:12:36 +02:00
Felipe Magno de Almeida 69975fc72d eolian-cxx: Add special type tags to make function_wrapper specializations unique
Reviewers: lauromoura, bu5hm4n, woohyun

Reviewed By: lauromoura

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9469
2019-07-31 18:38:59 -03:00
Felipe Magno de Almeida f230dc9dbc eolian-cxx: Add binbuf and event keywords handling
n

Summary:
Add support in Eolian-Cxx for binbuf and event keywords and tests. It
will generate the C type while the manual binding in C++ for the types
do not exist.

Reviewers: q66, lauromoura

Reviewed By: q66

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9412
2019-07-26 13:02:28 +02:00
Xavi Artigas d20b8ad42a mono-docs: Allow HTML codes in documentation
Summary:
All comments from EO files are HTML-escaped (i.e. "<" is turned into "&lt;"), and this is good.
However all text added by the mono code generator is HTML-escaped too, and that is a pity.
Circumventing the escaping in the generator involves serious code changes so it is simpler to
allow "escaping" characters to avoid escaping...
"<" is turned into "&lt;"
but
"\<" is turned into "<"

If you are giving these strings from C, remember that the backslash needs to be escaped too!
For example: "\\<b\\>Hello\\</b\\>"

This is intended for use in the generators, NOT in the EO docs.

Test Plan: Everything works as before, but now HTML codes can be added from the generators.

Reviewers: lauromoura, vitor.sousa, felipealmeida

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9380
2019-07-23 21:53:01 +02:00
Vitor Sousa b1e44484a5 cxx: remove compilation warnings in C++ code, from both gcc and clang
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
2019-07-12 09:07:27 -04:00
Vitor Sousa 5ae9e04e4d eolian_cxx: update eolian_cxx to recognize slice and rw_slice
Summary:
Update eolian_cxx to recognize the new keywords `slice` and `rw_slice`, so it
can generate the corresponding types `Eina_Slice` and `Eina_Rw_Slice`.

Reviewers: lauromoura, felipealmeida, q66

Reviewed By: q66

Subscribers: cedric, bu5hm4n, #reviewers, segfaultxavi, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9237
2019-07-08 16:16:07 +02:00
Yeongjong Lee 127209ce2b eolian_mono: support eo access modifiers
Summary:
Because in C# interface members can't include access modifiers, eolian_mono
ignore function scope tags in eo interfaces.

ref T7494

Reviewers: q66, felipealmeida, lauromoura, segfaultxavi, Jaehyun_Cho

Reviewed By: Jaehyun_Cho

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T7494

Differential Revision: https://phab.enlightenment.org/D9128
2019-06-24 19:19:00 +09:00
Lauro Moura bf1d2d86e4 eolian-cxx: Fix some warnings from cppcheck
Differential Revision: https://phab.enlightenment.org/D9052
2019-05-29 11:26:47 -07:00
Daniel Kolesa e5c9f5e76f eolian: rename eolian_event_c_name_get
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.
2019-05-16 15:57:39 +02:00
Daniel Kolesa b3a870c7bb eolian: rename eolian_typedecl_enum_field_c_name_get
This is to allow for better object oriented APIs, as the `c_name`
field would be inherited from Object. This also makes it more
clear in C.
2019-05-16 15:52:46 +02:00
Vitor Sousa 2b86e84b56 eolian_cxx: rework context code, also more flexible scope indentation generator
Summary:
Context management classes now store constant copies of the tags they
are supposed to hold. So, they are immutable objects now.
Functions that manipulate context create new object copies as needed.
`constexpr` was added for class constructor and functions.

Indentation generator now used four space by default.
Also, the amount of desired spaces can now be specified at call site.

Added helper methods to return 'indented' and 'unindented' version of a
given indentation generator object.

Test Plan: ninja test

Reviewers: felipealmeida, lauromoura

Reviewed By: lauromoura

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8467
2019-03-26 16:42:18 -03:00
Xavi Artigas 016e4df78b mono-docs: Use @since tags properly
Summary:
Only the number was being used, and in places were it should not be.
Now the Since version appears only in <summary> tags, with proper
context (Since EFL 1.22).

Test Plan: make && gendoc should produce DocFX pages which make more sense.

Reviewers: lauromoura, zmike, bu5hm4n

Reviewed By: lauromoura

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8012
2019-03-20 11:23:41 +01:00
Lauro Moura 2a003420f8 eolian-cxx: Add beta information to *_def
Summary: Fixes T7732

Reviewers: cedric, felipealmeida, vitor.sousa, bu5hm4n

Reviewed By: vitor.sousa

Subscribers: #reviewers, #committers

Tags: #efl

Maniphest Tasks: T7732

Differential Revision: https://phab.enlightenment.org/D8267
2019-03-11 14:41:01 -03:00