2014-09-23 12:48:16 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2014-07-10 05:13:46 -07:00
|
|
|
#include <Eina.h>
|
|
|
|
#include "eolian_database.h"
|
|
|
|
|
eolian: Rename EAPI macro to EOLIAN_API in Eolian library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
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, woohyun, jptiz, lucas
Reviewed By: vtorri
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12196
2020-11-25 06:39:05 -08:00
|
|
|
EOLIAN_API Eolian_Object_Scope
|
2016-06-09 08:54:43 -07:00
|
|
|
eolian_function_scope_get(const Eolian_Function *fid, Eolian_Function_Type ftype)
|
2014-07-10 05:13:46 -07:00
|
|
|
{
|
2017-01-13 06:15:10 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EOLIAN_SCOPE_UNKNOWN);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_UNRESOLVED, EOLIAN_SCOPE_UNKNOWN);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_PROPERTY, EOLIAN_SCOPE_UNKNOWN);
|
2016-06-09 08:54:43 -07:00
|
|
|
switch (ftype)
|
|
|
|
{
|
2017-01-12 07:56:49 -08:00
|
|
|
case EOLIAN_METHOD:
|
|
|
|
if (fid->type != EOLIAN_METHOD)
|
2017-01-13 06:15:10 -08:00
|
|
|
return EOLIAN_SCOPE_UNKNOWN;
|
2017-01-12 07:56:49 -08:00
|
|
|
return fid->get_scope;
|
|
|
|
case EOLIAN_PROP_GET:
|
|
|
|
if ((fid->type != EOLIAN_PROP_GET) && (fid->type != EOLIAN_PROPERTY))
|
2017-01-13 06:15:10 -08:00
|
|
|
return EOLIAN_SCOPE_UNKNOWN;
|
2017-01-12 07:56:49 -08:00
|
|
|
return fid->get_scope;
|
|
|
|
case EOLIAN_PROP_SET:
|
|
|
|
if ((fid->type != EOLIAN_PROP_SET) && (fid->type != EOLIAN_PROPERTY))
|
2017-01-13 06:15:10 -08:00
|
|
|
return EOLIAN_SCOPE_UNKNOWN;
|
2017-01-12 07:56:49 -08:00
|
|
|
return fid->set_scope;
|
|
|
|
default:
|
2017-01-13 06:15:10 -08:00
|
|
|
return EOLIAN_SCOPE_UNKNOWN;
|
2016-06-09 08:54:43 -07:00
|
|
|
}
|
2014-07-10 05:13:46 -07:00
|
|
|
}
|
|
|
|
|
eolian: Rename EAPI macro to EOLIAN_API in Eolian library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
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, woohyun, jptiz, lucas
Reviewed By: vtorri
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12196
2020-11-25 06:39:05 -08:00
|
|
|
EOLIAN_API Eolian_Function_Type
|
2014-07-10 05:13:46 -07:00
|
|
|
eolian_function_type_get(const Eolian_Function *fid)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EOLIAN_UNRESOLVED);
|
|
|
|
return fid->type;
|
|
|
|
}
|
|
|
|
|
2014-09-25 07:37:18 -07:00
|
|
|
static const char *
|
2019-05-09 07:16:42 -07:00
|
|
|
_get_c_prefix(const Eolian_Function *foo_id, char *buf)
|
2014-09-25 07:37:18 -07:00
|
|
|
{
|
2019-05-09 07:16:42 -07:00
|
|
|
if (foo_id->klass->c_prefix)
|
|
|
|
return foo_id->klass->c_prefix;
|
2019-05-30 08:00:52 -07:00
|
|
|
strcpy(buf, foo_id->klass->base.c_name);
|
2014-09-25 07:37:18 -07:00
|
|
|
eina_str_tolower(&buf);
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
|
2016-11-28 10:55:27 -08:00
|
|
|
static char *
|
|
|
|
_get_abbreviated_name(const char *prefix, const char *fname)
|
|
|
|
{
|
|
|
|
Eina_Strbuf *buf = eina_strbuf_new();
|
|
|
|
|
|
|
|
const char *last_p = strrchr(prefix, '_');
|
|
|
|
last_p = (last_p) ? (last_p + 1) : prefix;
|
|
|
|
|
|
|
|
const char *tmp = strstr(fname, last_p);
|
|
|
|
int len = strlen(last_p);
|
|
|
|
|
|
|
|
if ((tmp) &&
|
|
|
|
((tmp == fname) || (*(tmp - 1) == '_')) &&
|
|
|
|
((*(tmp + len) == '\0') || (*(tmp + len) == '_')))
|
|
|
|
{
|
|
|
|
int plen = strlen(prefix);
|
|
|
|
len += (tmp - fname);
|
|
|
|
|
|
|
|
if ((plen >= len) && !strncmp(prefix + plen - len, fname, len))
|
|
|
|
{
|
|
|
|
eina_strbuf_append_n(buf, prefix, plen - len);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (eina_strbuf_length_get(buf) == 0)
|
|
|
|
eina_strbuf_append_printf(buf, "%s_", prefix);
|
|
|
|
eina_strbuf_append(buf, fname);
|
|
|
|
|
|
|
|
char *ret = eina_strbuf_string_steal(buf);
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
eolian: Rename EAPI macro to EOLIAN_API in Eolian library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
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, woohyun, jptiz, lucas
Reviewed By: vtorri
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12196
2020-11-25 06:39:05 -08:00
|
|
|
EOLIAN_API Eina_Stringshare *
|
2015-07-08 04:09:56 -07:00
|
|
|
eolian_function_full_c_name_get(const Eolian_Function *foo_id,
|
2019-03-08 06:58:52 -08:00
|
|
|
Eolian_Function_Type ftype)
|
2014-07-10 05:13:46 -07:00
|
|
|
{
|
2014-09-25 07:37:18 -07:00
|
|
|
char tbuf[512];
|
2017-11-21 22:44:06 -08:00
|
|
|
tbuf[0] = '\0';
|
2019-05-09 07:16:42 -07:00
|
|
|
const char *prefix = (ftype != EOLIAN_FUNCTION_POINTER) ? _get_c_prefix(foo_id, tbuf): tbuf;
|
2015-07-08 04:09:56 -07:00
|
|
|
|
|
|
|
if (!prefix)
|
|
|
|
return NULL;
|
|
|
|
|
2014-07-10 05:13:46 -07:00
|
|
|
const char *funcn = eolian_function_name_get(foo_id);
|
|
|
|
Eina_Strbuf *buf = eina_strbuf_new();
|
|
|
|
Eina_Stringshare *ret;
|
|
|
|
|
2016-11-28 10:55:27 -08:00
|
|
|
char *abbr = _get_abbreviated_name(prefix, funcn);
|
|
|
|
eina_strbuf_append(buf, abbr);
|
|
|
|
free(abbr);
|
2015-07-08 04:09:56 -07:00
|
|
|
|
|
|
|
if ((ftype == EOLIAN_PROP_GET) || (ftype == EOLIAN_PROPERTY))
|
|
|
|
eina_strbuf_append(buf, "_get");
|
|
|
|
else if (ftype == EOLIAN_PROP_SET)
|
|
|
|
eina_strbuf_append(buf, "_set");
|
|
|
|
|
2014-07-10 05:13:46 -07:00
|
|
|
ret = eina_stringshare_add(eina_strbuf_string_get(buf));
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
eolian: Rename EAPI macro to EOLIAN_API in Eolian library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
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, woohyun, jptiz, lucas
Reviewed By: vtorri
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12196
2020-11-25 06:39:05 -08:00
|
|
|
EOLIAN_API const Eolian_Implement *
|
2017-01-16 06:51:11 -08:00
|
|
|
eolian_function_implement_get(const Eolian_Function *fid)
|
2014-09-03 06:25:50 -07:00
|
|
|
{
|
2017-01-16 06:51:11 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
|
|
|
|
return fid->impl;
|
2014-09-03 06:25:50 -07:00
|
|
|
}
|
|
|
|
|
eolian: Rename EAPI macro to EOLIAN_API in Eolian library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
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, woohyun, jptiz, lucas
Reviewed By: vtorri
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12196
2020-11-25 06:39:05 -08:00
|
|
|
EOLIAN_API Eina_Bool
|
2019-08-16 07:32:13 -07:00
|
|
|
eolian_function_is_static(const Eolian_Function *fid)
|
2014-07-24 04:05:12 -07:00
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
|
2019-08-16 07:27:00 -07:00
|
|
|
return fid->is_static;
|
2014-07-24 04:05:12 -07:00
|
|
|
}
|
|
|
|
|
eolian: Rename EAPI macro to EOLIAN_API in Eolian library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
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, woohyun, jptiz, lucas
Reviewed By: vtorri
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12196
2020-11-25 06:39:05 -08:00
|
|
|
EOLIAN_API Eina_Bool
|
2014-09-12 12:51:37 -07:00
|
|
|
eolian_function_is_constructor(const Eolian_Function *fid, const Eolian_Class *klass)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
|
2018-03-08 10:30:40 -08:00
|
|
|
Eina_Stringshare *s = eina_stringshare_ref(klass->base.name);
|
2014-09-12 12:51:37 -07:00
|
|
|
Eina_Bool r = !!eina_list_search_sorted_list
|
|
|
|
(fid->ctor_of, EINA_COMPARE_CB(strcmp), s);
|
|
|
|
eina_stringshare_del(s);
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2015-05-20 09:42:00 -07:00
|
|
|
static Eina_List *
|
|
|
|
_get_prop_keys(const Eolian_Function *fid, Eolian_Function_Type ftype)
|
2014-07-10 05:13:46 -07:00
|
|
|
{
|
2015-05-20 09:42:00 -07:00
|
|
|
Eina_List *l = fid->prop_keys_get;
|
|
|
|
if (ftype == EOLIAN_PROP_SET) l = fid->prop_keys_set;
|
|
|
|
if (!l) return fid->prop_keys;
|
|
|
|
return l;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_List *
|
|
|
|
_get_prop_values(const Eolian_Function *fid, Eolian_Function_Type ftype)
|
|
|
|
{
|
|
|
|
Eina_List *l = fid->prop_values_get;
|
|
|
|
if (ftype == EOLIAN_PROP_SET) l = fid->prop_values_set;
|
|
|
|
if (!l) return fid->prop_values;
|
|
|
|
return l;
|
2014-07-10 05:13:46 -07:00
|
|
|
}
|
|
|
|
|
eolian: Rename EAPI macro to EOLIAN_API in Eolian library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
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, woohyun, jptiz, lucas
Reviewed By: vtorri
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12196
2020-11-25 06:39:05 -08:00
|
|
|
EOLIAN_API Eina_Iterator *
|
2015-05-20 09:03:14 -07:00
|
|
|
eolian_property_keys_get(const Eolian_Function *fid, Eolian_Function_Type ftype)
|
2014-07-10 05:13:46 -07:00
|
|
|
{
|
2015-05-20 09:42:00 -07:00
|
|
|
Eina_List *l = NULL;
|
2014-07-10 05:13:46 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
|
2015-05-20 09:03:14 -07:00
|
|
|
if (ftype != EOLIAN_PROP_GET && ftype != EOLIAN_PROP_SET)
|
|
|
|
return NULL;
|
2015-05-20 09:42:00 -07:00
|
|
|
l = _get_prop_keys(fid, ftype);
|
|
|
|
return (l ? eina_list_iterator_new(l) : NULL);
|
2014-07-10 05:13:46 -07:00
|
|
|
}
|
|
|
|
|
eolian: Rename EAPI macro to EOLIAN_API in Eolian library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
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, woohyun, jptiz, lucas
Reviewed By: vtorri
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12196
2020-11-25 06:39:05 -08:00
|
|
|
EOLIAN_API Eina_Iterator *
|
2015-05-20 09:03:14 -07:00
|
|
|
eolian_property_values_get(const Eolian_Function *fid, Eolian_Function_Type ftype)
|
2014-07-10 05:13:46 -07:00
|
|
|
{
|
2015-05-20 09:42:00 -07:00
|
|
|
Eina_List *l = NULL;
|
2015-05-20 09:03:14 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
|
|
|
|
if (ftype != EOLIAN_PROP_GET && ftype != EOLIAN_PROP_SET)
|
|
|
|
return NULL;
|
2015-05-20 09:42:00 -07:00
|
|
|
l = _get_prop_values(fid, ftype);
|
|
|
|
return (l ? eina_list_iterator_new(l) : NULL);
|
2014-07-10 05:13:46 -07:00
|
|
|
}
|
|
|
|
|
eolian: Rename EAPI macro to EOLIAN_API in Eolian library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
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, woohyun, jptiz, lucas
Reviewed By: vtorri
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12196
2020-11-25 06:39:05 -08:00
|
|
|
EOLIAN_API Eina_Iterator *
|
2014-07-23 06:17:19 -07:00
|
|
|
eolian_function_parameters_get(const Eolian_Function *fid)
|
2014-07-10 05:13:46 -07:00
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
|
2017-04-07 09:54:55 -07:00
|
|
|
if (fid->type != EOLIAN_METHOD && fid->type != EOLIAN_FUNCTION_POINTER)
|
2015-05-20 09:03:14 -07:00
|
|
|
return NULL;
|
2014-07-23 05:44:42 -07:00
|
|
|
return (fid->params ? eina_list_iterator_new(fid->params) : NULL);
|
2014-07-10 05:13:46 -07:00
|
|
|
}
|
|
|
|
|
eolian: Rename EAPI macro to EOLIAN_API in Eolian library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
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, woohyun, jptiz, lucas
Reviewed By: vtorri
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12196
2020-11-25 06:39:05 -08:00
|
|
|
EOLIAN_API const Eolian_Type *
|
2014-07-10 05:13:46 -07:00
|
|
|
eolian_function_return_type_get(const Eolian_Function *fid, Eolian_Function_Type ftype)
|
|
|
|
{
|
2017-01-12 07:56:49 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_UNRESOLVED, NULL);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_PROPERTY, NULL);
|
2014-07-10 05:13:46 -07:00
|
|
|
switch (ftype)
|
|
|
|
{
|
2017-01-12 07:56:49 -08:00
|
|
|
case EOLIAN_METHOD:
|
2019-09-03 06:03:44 -07:00
|
|
|
case EOLIAN_FUNCTION_POINTER:
|
|
|
|
if (fid->type != ftype)
|
2017-01-12 07:56:49 -08:00
|
|
|
return NULL;
|
|
|
|
return fid->get_ret_type;
|
|
|
|
case EOLIAN_PROP_GET:
|
|
|
|
if ((fid->type != EOLIAN_PROP_GET) && (fid->type != EOLIAN_PROPERTY))
|
|
|
|
return NULL;
|
|
|
|
return fid->get_ret_type;
|
|
|
|
case EOLIAN_PROP_SET:
|
|
|
|
if ((fid->type != EOLIAN_PROP_SET) && (fid->type != EOLIAN_PROPERTY))
|
|
|
|
return NULL;
|
|
|
|
return fid->set_ret_type;
|
|
|
|
default:
|
|
|
|
return NULL;
|
2014-07-10 05:13:46 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
eolian: Rename EAPI macro to EOLIAN_API in Eolian library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
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, woohyun, jptiz, lucas
Reviewed By: vtorri
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12196
2020-11-25 06:39:05 -08:00
|
|
|
EOLIAN_API const Eolian_Expression *
|
2014-07-11 06:30:22 -07:00
|
|
|
eolian_function_return_default_value_get(const Eolian_Function *fid, Eolian_Function_Type ftype)
|
2014-07-10 05:13:46 -07:00
|
|
|
{
|
2017-01-12 07:56:49 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_UNRESOLVED, NULL);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_PROPERTY, NULL);
|
2014-07-10 05:13:46 -07:00
|
|
|
switch (ftype)
|
|
|
|
{
|
2017-01-12 07:56:49 -08:00
|
|
|
case EOLIAN_METHOD:
|
2019-09-03 06:03:44 -07:00
|
|
|
case EOLIAN_FUNCTION_POINTER:
|
|
|
|
if (fid->type != ftype)
|
2017-01-12 07:56:49 -08:00
|
|
|
return NULL;
|
|
|
|
return fid->get_ret_val;
|
|
|
|
case EOLIAN_PROP_GET:
|
|
|
|
if ((fid->type != EOLIAN_PROP_GET) && (fid->type != EOLIAN_PROPERTY))
|
|
|
|
return NULL;
|
|
|
|
return fid->get_ret_val;
|
|
|
|
case EOLIAN_PROP_SET:
|
|
|
|
if ((fid->type != EOLIAN_PROP_SET) && (fid->type != EOLIAN_PROPERTY))
|
|
|
|
return NULL;
|
|
|
|
return fid->set_ret_val;
|
|
|
|
default:
|
|
|
|
return NULL;
|
2014-07-10 05:13:46 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
eolian: Rename EAPI macro to EOLIAN_API in Eolian library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
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, woohyun, jptiz, lucas
Reviewed By: vtorri
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12196
2020-11-25 06:39:05 -08:00
|
|
|
EOLIAN_API const Eolian_Documentation *
|
2015-06-03 08:16:53 -07:00
|
|
|
eolian_function_return_documentation_get(const Eolian_Function *fid, Eolian_Function_Type ftype)
|
|
|
|
{
|
2017-01-12 07:56:49 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_UNRESOLVED, NULL);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_PROPERTY, NULL);
|
2015-06-03 08:16:53 -07:00
|
|
|
switch (ftype)
|
|
|
|
{
|
2017-01-12 07:56:49 -08:00
|
|
|
case EOLIAN_METHOD:
|
2019-09-03 06:03:44 -07:00
|
|
|
case EOLIAN_FUNCTION_POINTER:
|
|
|
|
if (fid->type != ftype)
|
2017-01-12 07:56:49 -08:00
|
|
|
return NULL;
|
|
|
|
return fid->get_return_doc;
|
|
|
|
case EOLIAN_PROP_GET:
|
|
|
|
if ((fid->type != EOLIAN_PROP_GET) && (fid->type != EOLIAN_PROPERTY))
|
|
|
|
return NULL;
|
|
|
|
return fid->get_return_doc;
|
|
|
|
case EOLIAN_PROP_SET:
|
|
|
|
if ((fid->type != EOLIAN_PROP_SET) && (fid->type != EOLIAN_PROPERTY))
|
|
|
|
return NULL;
|
|
|
|
return fid->set_return_doc;
|
|
|
|
default:
|
|
|
|
return NULL;
|
2015-06-03 08:16:53 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
eolian: Rename EAPI macro to EOLIAN_API in Eolian library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
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, woohyun, jptiz, lucas
Reviewed By: vtorri
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12196
2020-11-25 06:39:05 -08:00
|
|
|
EOLIAN_API Eina_Bool
|
2019-05-26 08:41:22 -07:00
|
|
|
eolian_function_return_allow_unused(const Eolian_Function *fid,
|
2014-07-10 05:13:46 -07:00
|
|
|
Eolian_Function_Type ftype)
|
|
|
|
{
|
2019-05-26 08:41:22 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_TRUE);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_UNRESOLVED, EINA_TRUE);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_PROPERTY, EINA_TRUE);
|
2014-07-10 05:13:46 -07:00
|
|
|
switch (ftype)
|
|
|
|
{
|
2017-01-12 07:56:49 -08:00
|
|
|
case EOLIAN_METHOD:
|
2019-09-03 06:03:44 -07:00
|
|
|
case EOLIAN_FUNCTION_POINTER:
|
|
|
|
if (fid->type != ftype)
|
2019-05-26 08:41:22 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
return !fid->get_return_no_unused;
|
2017-01-12 07:56:49 -08:00
|
|
|
case EOLIAN_PROP_GET:
|
|
|
|
if ((fid->type != EOLIAN_PROP_GET) && (fid->type != EOLIAN_PROPERTY))
|
2019-05-26 08:41:22 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
return !fid->get_return_no_unused;
|
2017-01-12 07:56:49 -08:00
|
|
|
case EOLIAN_PROP_SET:
|
|
|
|
if ((fid->type != EOLIAN_PROP_SET) && (fid->type != EOLIAN_PROPERTY))
|
2019-05-26 08:41:22 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
return !fid->set_return_no_unused;
|
2017-01-12 07:56:49 -08:00
|
|
|
default:
|
2019-05-26 08:41:22 -07:00
|
|
|
return EINA_TRUE;
|
2016-06-07 06:59:36 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
eolian: Rename EAPI macro to EOLIAN_API in Eolian library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
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, woohyun, jptiz, lucas
Reviewed By: vtorri
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12196
2020-11-25 06:39:05 -08:00
|
|
|
EOLIAN_API Eina_Bool
|
2019-08-30 08:04:44 -07:00
|
|
|
eolian_function_return_is_by_ref(const Eolian_Function *fid,
|
|
|
|
Eolian_Function_Type ftype)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_UNRESOLVED, EINA_FALSE);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_PROPERTY, EINA_FALSE);
|
|
|
|
switch (ftype)
|
|
|
|
{
|
|
|
|
case EOLIAN_METHOD:
|
2019-09-03 06:03:44 -07:00
|
|
|
case EOLIAN_FUNCTION_POINTER:
|
|
|
|
if (fid->type != ftype)
|
2019-08-30 08:04:44 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
return fid->get_return_by_ref;
|
|
|
|
case EOLIAN_PROP_GET:
|
|
|
|
if ((fid->type != EOLIAN_PROP_GET) && (fid->type != EOLIAN_PROPERTY))
|
|
|
|
return EINA_FALSE;
|
2019-09-03 06:02:00 -07:00
|
|
|
return fid->get_return_by_ref;
|
2019-08-30 08:04:44 -07:00
|
|
|
case EOLIAN_PROP_SET:
|
|
|
|
if ((fid->type != EOLIAN_PROP_SET) && (fid->type != EOLIAN_PROPERTY))
|
|
|
|
return EINA_FALSE;
|
2019-09-03 06:02:00 -07:00
|
|
|
return fid->set_return_by_ref;
|
2019-08-30 08:04:44 -07:00
|
|
|
default:
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
eolian: Rename EAPI macro to EOLIAN_API in Eolian library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
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, woohyun, jptiz, lucas
Reviewed By: vtorri
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12196
2020-11-25 06:39:05 -08:00
|
|
|
EOLIAN_API Eina_Bool
|
2019-08-30 08:04:44 -07:00
|
|
|
eolian_function_return_is_move(const Eolian_Function *fid,
|
|
|
|
Eolian_Function_Type ftype)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_UNRESOLVED, EINA_FALSE);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_PROPERTY, EINA_FALSE);
|
|
|
|
switch (ftype)
|
|
|
|
{
|
|
|
|
case EOLIAN_METHOD:
|
2019-09-03 06:03:44 -07:00
|
|
|
case EOLIAN_FUNCTION_POINTER:
|
|
|
|
if (fid->type != ftype)
|
2019-08-30 08:04:44 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
return fid->get_return_move;
|
|
|
|
case EOLIAN_PROP_GET:
|
|
|
|
if ((fid->type != EOLIAN_PROP_GET) && (fid->type != EOLIAN_PROPERTY))
|
|
|
|
return EINA_FALSE;
|
2019-09-02 06:23:21 -07:00
|
|
|
return fid->get_return_move;
|
2019-08-30 08:04:44 -07:00
|
|
|
case EOLIAN_PROP_SET:
|
|
|
|
if ((fid->type != EOLIAN_PROP_SET) && (fid->type != EOLIAN_PROPERTY))
|
|
|
|
return EINA_FALSE;
|
2019-09-02 06:23:21 -07:00
|
|
|
return fid->set_return_move;
|
2019-08-30 08:04:44 -07:00
|
|
|
default:
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
eolian: Rename EAPI macro to EOLIAN_API in Eolian library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
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, woohyun, jptiz, lucas
Reviewed By: vtorri
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12196
2020-11-25 06:39:05 -08:00
|
|
|
EOLIAN_API Eina_Stringshare *
|
2019-09-04 06:56:32 -07:00
|
|
|
eolian_function_return_c_type_get(const Eolian_Function *fid,
|
|
|
|
Eolian_Function_Type ftype)
|
|
|
|
{
|
2019-09-19 07:04:56 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_UNRESOLVED, NULL);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_PROPERTY, NULL);
|
2019-09-04 06:56:32 -07:00
|
|
|
const Eolian_Type *tp = NULL;
|
|
|
|
Eina_Bool by_ref = EINA_FALSE;
|
|
|
|
switch (ftype)
|
|
|
|
{
|
|
|
|
case EOLIAN_METHOD:
|
|
|
|
case EOLIAN_FUNCTION_POINTER:
|
|
|
|
if (fid->type != ftype)
|
|
|
|
return NULL;
|
|
|
|
tp = fid->get_ret_type;
|
|
|
|
by_ref = fid->get_return_by_ref;
|
|
|
|
break;
|
|
|
|
case EOLIAN_PROP_GET:
|
|
|
|
if ((fid->type != EOLIAN_PROP_GET) && (fid->type != EOLIAN_PROPERTY))
|
|
|
|
return NULL;
|
|
|
|
tp = fid->get_ret_type;
|
|
|
|
by_ref = fid->get_return_by_ref;
|
|
|
|
break;
|
|
|
|
case EOLIAN_PROP_SET:
|
|
|
|
if ((fid->type != EOLIAN_PROP_SET) && (fid->type != EOLIAN_PROPERTY))
|
|
|
|
return NULL;
|
|
|
|
tp = fid->set_ret_type;
|
|
|
|
by_ref = fid->set_return_by_ref;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
Eina_Strbuf *buf = eina_strbuf_new();
|
|
|
|
database_type_to_str(tp, buf, NULL, EOLIAN_C_TYPE_RETURN, by_ref);
|
|
|
|
Eina_Stringshare *ret = eina_stringshare_add(eina_strbuf_string_get(buf));
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
eolian: Rename EAPI macro to EOLIAN_API in Eolian library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
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, woohyun, jptiz, lucas
Reviewed By: vtorri
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12196
2020-11-25 06:39:05 -08:00
|
|
|
EOLIAN_API Eina_Bool
|
2014-07-10 05:13:46 -07:00
|
|
|
eolian_function_object_is_const(const Eolian_Function *fid)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
|
|
|
|
return fid->obj_is_const;
|
|
|
|
}
|
2014-12-03 06:59:24 -08:00
|
|
|
|
eolian: Rename EAPI macro to EOLIAN_API in Eolian library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
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, woohyun, jptiz, lucas
Reviewed By: vtorri
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12196
2020-11-25 06:39:05 -08:00
|
|
|
EOLIAN_API const Eolian_Class *
|
2015-03-16 08:04:44 -07:00
|
|
|
eolian_function_class_get(const Eolian_Function *fid)
|
|
|
|
{
|
2015-04-21 02:41:48 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
|
2015-03-16 08:04:44 -07:00
|
|
|
return fid->klass;
|
|
|
|
}
|