Page MenuHomePhabricator

efl-mono: Add support for global constants
Closed, ResolvedPublic


In src/lib/efl/interfaces/efl_gfx_size_hint.eo there are two global constants defined like this:

const Efl.Gfx.Size_Hint_Expand: double = 1.0;
const Efl.Gfx.Size_Hint_Fill: double = -1.0;

They are not being used in any C# code yet, so there is no build error, but they are referenced a lot from documentation <see> tags, causing compilation warnings and incorrect documentation rendering.

segfaultxavi triaged this task as High priority.
segfaultxavi moved this task from Backlog to TODO on the efl: language bindings board.

As discsussed on IRC, the suggestion is to move then to something like Efl.Gfx.Constants.Size_Hint_Expand.

There has to be a class to hold them as we can't have free variables in C#. And they can't live in the interfaces due to the same problem as Event arguments structs (interfaces can't have things other than instance properties and methods).

This comment was removed by woohyun.


I think we can make a list of constants + enums in EFL. And then, let's think which are needed to be set as global.

These are the constants that I found by grepping the EO files:

src/lib/efl/interfaces/efl_gfx_size_hint.eo:  const Efl.Gfx.Size_Hint_Expand: double = 1.0;
src/lib/efl/interfaces/efl_gfx_size_hint.eo:  const Efl.Gfx.Size_Hint_Fill: double = -1.0;
src/lib/efl/interfaces/efl_gfx_stack.eo:      const Efl.Gfx.Stack_Layer_Min: short = -32768; [[bottom-most layer number]]
src/lib/efl/interfaces/efl_gfx_stack.eo:      const Efl.Gfx.Stack_Layer_Max: short = 32767;  [[top-most layer number]]
src/lib/eo/efl_object.eo:                     const Efl.Callback_Priority_Before : Efl.Callback_Priority = -100;
src/lib/eo/efl_object.eo:                     const Efl.Callback_Priority_Default : Efl.Callback_Priority = 0;
src/lib/eo/efl_object.eo:                     const Efl.Callback_Priority_After : Efl.Callback_Priority = 100;

Thank you for searching! :)

enum in .eo is already written in enum in .eo.cs so I think that we do not need to concern about enum case here.
As @lauromoura said, the problem case is constant in interface .eo. (constant in class or abstract .eo can be written in .eo.cs directly)

I'm doing an experiment with partial classes for those Namespace.Constants classes.

@lauromoura is this finished now?