2016-06-23 10:53:46 -07:00
|
|
|
// Internal header are to be used only inside efl itself.
|
|
|
|
#ifndef _ECORE_INTERNAL_H
|
|
|
|
#define _ECORE_INTERNAL_H
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
#include <ecore_api.h>
|
2016-06-23 10:53:46 -07:00
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API void ecore_loop_arguments_send(int argc, const char **argv);
|
|
|
|
ECORE_API Eina_Bool efl_loop_message_process(Eo *obj);
|
2016-06-23 10:53:46 -07:00
|
|
|
|
2017-12-20 14:19:56 -08:00
|
|
|
static inline Eina_Value
|
|
|
|
efl_model_list_value_get(Eina_List *childrens,
|
|
|
|
unsigned int start,
|
|
|
|
unsigned int count)
|
|
|
|
{
|
|
|
|
Eina_Value v = EINA_VALUE_EMPTY;
|
|
|
|
Eina_List *l;
|
|
|
|
Eo *child;
|
|
|
|
|
2018-04-12 14:39:45 -07:00
|
|
|
if (eina_list_count(childrens) < start + count)
|
|
|
|
return eina_value_error_init(EFL_MODEL_ERROR_INCORRECT_VALUE);
|
|
|
|
|
|
|
|
eina_value_array_setup(&v, EINA_VALUE_TYPE_OBJECT, 4);
|
2017-12-20 14:19:56 -08:00
|
|
|
|
2018-03-05 13:39:52 -08:00
|
|
|
childrens = eina_list_nth_list(childrens, start);
|
|
|
|
|
2017-12-20 14:19:56 -08:00
|
|
|
EINA_LIST_FOREACH(childrens, l, child)
|
|
|
|
{
|
|
|
|
if (count == 0)
|
2018-03-05 13:39:52 -08:00
|
|
|
break;
|
2017-12-20 14:19:56 -08:00
|
|
|
count--;
|
|
|
|
|
|
|
|
eina_value_array_append(&v, child);
|
|
|
|
}
|
|
|
|
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
2019-09-04 08:07:37 -07:00
|
|
|
#define EFL_COMPOSITE_MODEL_CHILD_INDEX "child.index"
|
|
|
|
|
|
|
|
#define EFL_COMPOSITE_MODEL_PROPERTIES(name, dyn, sta, ...) \
|
|
|
|
EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(name, NULL, NULL, (dyn), sta, ##__VA_ARGS__)
|
|
|
|
|
|
|
|
#define EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(name, obj, klass, dyn, ...) \
|
|
|
|
Eina_Iterator *name; \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
static const char *static_props__[] = { \
|
|
|
|
__VA_ARGS__ \
|
|
|
|
}; \
|
|
|
|
name = _efl_composite_model_properties_mix( \
|
|
|
|
((obj) ? efl_model_properties_get(efl_super((obj), (klass))) : NULL), \
|
|
|
|
(dyn), \
|
|
|
|
EINA_C_ARRAY_ITERATOR_NEW(static_props__)); \
|
|
|
|
} \
|
|
|
|
while (0)
|
|
|
|
|
|
|
|
|
|
|
|
static inline Eina_Iterator *
|
|
|
|
_efl_composite_model_properties_mix(Eina_Iterator *super, Eina_Iterator *dyn, Eina_Iterator *sta)
|
|
|
|
{
|
|
|
|
Eina_Iterator *its[3];
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
if (sta) its[i++] = sta;
|
|
|
|
if (dyn) its[i++] = dyn;
|
|
|
|
if (super) its[i++] = super;
|
|
|
|
|
|
|
|
switch (i)
|
|
|
|
{
|
|
|
|
case 1: return its[0];
|
|
|
|
case 2: return eina_multi_iterator_new(its[0], its[1]);
|
|
|
|
case 3: return eina_multi_iterator_new(its[0], its[1], its[2]);
|
|
|
|
default: return NULL;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#define EFL_COMPOSITE_LOOKUP_RETURN(Remember, Parent, View, Base) \
|
|
|
|
Efl_Model *Remember; \
|
|
|
|
char buf[1024]; \
|
|
|
|
\
|
|
|
|
snprintf(buf, sizeof (buf), Base"-%p", Parent); \
|
|
|
|
Remember = efl_key_wref_get(View, buf); \
|
|
|
|
if (Remember) \
|
|
|
|
{ \
|
|
|
|
efl_ref(Remember); \
|
|
|
|
return Remember; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define EFL_COMPOSITE_REMEMBER_RETURN(Remember, View) \
|
|
|
|
efl_key_wref_set(View, buf, Remember); \
|
|
|
|
return Remember;
|
|
|
|
|
|
|
|
|
|
|
|
static inline Efl_Model *
|
|
|
|
_efl_composite_lookup(const Efl_Class *self, Eo *parent, Efl_Model *view, unsigned int index)
|
|
|
|
{
|
|
|
|
EFL_COMPOSITE_LOOKUP_RETURN(remember, parent, view, "_efl.composite_model");
|
|
|
|
|
|
|
|
remember = efl_add_ref(self, parent,
|
|
|
|
efl_ui_view_model_set(efl_added, view),
|
|
|
|
efl_composite_model_index_set(efl_added, index),
|
|
|
|
efl_loop_model_volatile_make(efl_added));
|
|
|
|
if (!remember) return NULL;
|
|
|
|
|
|
|
|
EFL_COMPOSITE_REMEMBER_RETURN(remember, view);
|
|
|
|
}
|
|
|
|
|
2020-01-24 10:59:01 -08:00
|
|
|
/* Result from eina_future_all_* is an EINA_VALUE_TYPE_ARRAY that contain Eina_Value of
|
|
|
|
Eo Model. It is expected that children slice get return an EINA_VALUE_TYPE_ARRAY that
|
|
|
|
contain Eo Model directly.
|
|
|
|
*/
|
|
|
|
static inline Eina_Value
|
|
|
|
_efl_future_all_repack(Eo *o EINA_UNUSED, void *data EINA_UNUSED, const Eina_Value v)
|
|
|
|
{
|
|
|
|
unsigned int i, len;
|
|
|
|
Eina_Value created = EINA_VALUE_EMPTY;
|
|
|
|
Eina_Value r = EINA_VALUE_EMPTY;
|
|
|
|
|
|
|
|
eina_value_array_setup(&r, EINA_VALUE_TYPE_OBJECT, 4);
|
|
|
|
|
|
|
|
EINA_VALUE_ARRAY_FOREACH(&v, len, i, created)
|
|
|
|
{
|
|
|
|
Eo *target = NULL;
|
|
|
|
|
|
|
|
if (eina_value_type_get(&created) != EINA_VALUE_TYPE_OBJECT)
|
|
|
|
goto on_error;
|
|
|
|
|
|
|
|
target = eina_value_object_get(&created);
|
|
|
|
if (!target) goto on_error;
|
|
|
|
|
|
|
|
eina_value_array_append(&r, target);
|
|
|
|
}
|
|
|
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
on_error:
|
|
|
|
eina_value_flush(&r);
|
|
|
|
return eina_value_error_init(EFL_MODEL_ERROR_UNKNOWN);
|
|
|
|
}
|
|
|
|
|
2016-06-23 10:53:46 -07:00
|
|
|
#endif
|