2014-09-23 12:48:16 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2014-08-07 07:15:07 -07:00
|
|
|
#include <Eina.h>
|
2018-01-16 06:30:58 -08:00
|
|
|
|
|
|
|
#include "eolian_database.h"
|
2014-08-07 07:15:07 -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_Value
|
2018-01-16 07:10:43 -08:00
|
|
|
eolian_expression_eval(const Eolian_Expression *expr, Eolian_Expression_Mask m)
|
2014-08-07 07:15:07 -07:00
|
|
|
{
|
2014-08-18 05:12:08 -07:00
|
|
|
Eolian_Value err;
|
|
|
|
err.type = EOLIAN_EXPR_UNKNOWN;
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(expr, err);
|
2018-04-20 06:58:06 -07:00
|
|
|
return database_expr_eval(NULL, (Eolian_Expression *)expr, m, NULL, NULL);
|
2014-08-07 07:15:07 -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
|
2020-05-30 17:11:15 -07:00
|
|
|
eolian_expression_eval_fill(const Eolian_Expression *expr,
|
|
|
|
Eolian_Expression_Mask m, Eolian_Value *val)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(expr, EINA_FALSE);
|
|
|
|
Eolian_Value ret = database_expr_eval(NULL, (Eolian_Expression *)expr, m,
|
|
|
|
NULL, NULL);
|
|
|
|
if (ret.type == EOLIAN_EXPR_UNKNOWN)
|
|
|
|
return EINA_FALSE;
|
|
|
|
*val = ret;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-08-07 07:46:11 -07:00
|
|
|
static void
|
|
|
|
_append_char_escaped(Eina_Strbuf *buf, char c)
|
|
|
|
{
|
|
|
|
switch (c)
|
|
|
|
{
|
|
|
|
case '\'': eina_strbuf_append(buf, "\\\'"); break;
|
|
|
|
case '\"': eina_strbuf_append(buf, "\\\""); break;
|
|
|
|
case '\?': eina_strbuf_append(buf, "\\\?"); break;
|
|
|
|
case '\\': eina_strbuf_append(buf, "\\\\"); break;
|
|
|
|
case '\a': eina_strbuf_append(buf, "\\a"); break;
|
|
|
|
case '\b': eina_strbuf_append(buf, "\\b"); break;
|
|
|
|
case '\f': eina_strbuf_append(buf, "\\f"); break;
|
|
|
|
case '\n': eina_strbuf_append(buf, "\\n"); break;
|
|
|
|
case '\r': eina_strbuf_append(buf, "\\r"); break;
|
|
|
|
case '\t': eina_strbuf_append(buf, "\\t"); break;
|
|
|
|
case '\v': eina_strbuf_append(buf, "\\v"); break;
|
|
|
|
default:
|
|
|
|
if ((c < 32) || (c > 126))
|
|
|
|
eina_strbuf_append_printf(buf, "\\x%X", (unsigned char)c);
|
|
|
|
else
|
|
|
|
eina_strbuf_append_char(buf, c);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-18 05:12:08 -07:00
|
|
|
static void
|
|
|
|
_number_to_str(const Eolian_Value *v, Eina_Strbuf *buf)
|
2014-08-07 08:29:03 -07:00
|
|
|
{
|
2014-08-18 05:12:08 -07:00
|
|
|
switch (v->type)
|
2014-08-07 08:29:03 -07:00
|
|
|
{
|
2014-08-18 05:12:08 -07:00
|
|
|
case EOLIAN_EXPR_INT:
|
|
|
|
eina_strbuf_append_printf(buf, "%d", v->value.i); break;
|
2014-08-07 08:29:03 -07:00
|
|
|
case EOLIAN_EXPR_UINT:
|
2014-08-18 05:12:08 -07:00
|
|
|
eina_strbuf_append_printf(buf, "%uU", v->value.u); break;
|
2014-08-07 08:29:03 -07:00
|
|
|
case EOLIAN_EXPR_LONG:
|
2014-08-18 05:12:08 -07:00
|
|
|
eina_strbuf_append_printf(buf, "%ldL", v->value.l); break;
|
2014-08-07 08:29:03 -07:00
|
|
|
case EOLIAN_EXPR_ULONG:
|
2014-08-18 05:12:08 -07:00
|
|
|
eina_strbuf_append_printf(buf, "%luUL", v->value.ul); break;
|
2014-08-07 08:29:03 -07:00
|
|
|
case EOLIAN_EXPR_LLONG:
|
2014-08-18 05:12:08 -07:00
|
|
|
eina_strbuf_append_printf(buf, "%ldLL", (long)v->value.ll); break;
|
2014-08-07 08:29:03 -07:00
|
|
|
case EOLIAN_EXPR_ULLONG:
|
2014-08-18 05:12:08 -07:00
|
|
|
eina_strbuf_append_printf(buf, "%luULL", (unsigned long)v->value.ull);
|
|
|
|
break;
|
2014-08-07 08:29:03 -07:00
|
|
|
case EOLIAN_EXPR_FLOAT:
|
2014-08-18 05:12:08 -07:00
|
|
|
eina_strbuf_append_printf(buf, "%ff", v->value.f); break;
|
|
|
|
case EOLIAN_EXPR_DOUBLE:
|
|
|
|
eina_strbuf_append_printf(buf, "%f", v->value.d); break;
|
2014-08-07 08:29:03 -07:00
|
|
|
default:
|
2014-08-18 05:12:08 -07:00
|
|
|
break;
|
2014-08-07 08:29:03 -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_Stringshare *
|
2014-08-18 05:12:08 -07:00
|
|
|
eolian_expression_value_to_literal(const Eolian_Value *val)
|
2014-08-07 07:15:07 -07:00
|
|
|
{
|
2014-08-18 05:12:08 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(val, NULL);
|
|
|
|
switch (val->type)
|
2014-08-07 07:15:07 -07:00
|
|
|
{
|
|
|
|
case EOLIAN_EXPR_BOOL:
|
2014-08-18 05:12:08 -07:00
|
|
|
return eina_stringshare_add(val->value.b ? "EINA_TRUE"
|
|
|
|
: "EINA_FALSE");
|
2014-08-07 07:15:07 -07:00
|
|
|
case EOLIAN_EXPR_NULL:
|
|
|
|
return eina_stringshare_add("NULL");
|
|
|
|
case EOLIAN_EXPR_CHAR:
|
|
|
|
{
|
2014-08-18 05:12:08 -07:00
|
|
|
char c = val->value.c;
|
2014-08-07 07:46:11 -07:00
|
|
|
Eina_Strbuf *buf = eina_strbuf_new();
|
|
|
|
const char *ret;
|
|
|
|
eina_strbuf_append_char(buf, '\'');
|
|
|
|
_append_char_escaped(buf, c);
|
|
|
|
eina_strbuf_append_char(buf, '\'');
|
|
|
|
ret = eina_stringshare_add(eina_strbuf_string_get(buf));
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
return ret;
|
2014-08-07 07:15:07 -07:00
|
|
|
}
|
|
|
|
case EOLIAN_EXPR_STRING:
|
|
|
|
{
|
2014-08-07 07:46:11 -07:00
|
|
|
const char *ret;
|
2014-08-18 05:12:08 -07:00
|
|
|
char *c = (char*)val->value.s;
|
2014-08-07 07:46:11 -07:00
|
|
|
Eina_Strbuf *buf = eina_strbuf_new();
|
|
|
|
eina_strbuf_append_char(buf, '\"');
|
|
|
|
while (*c) _append_char_escaped(buf, *(c++));
|
|
|
|
eina_strbuf_append_char(buf, '\"');
|
|
|
|
ret = eina_stringshare_add(eina_strbuf_string_get(buf));
|
|
|
|
eina_strbuf_free(buf);
|
2014-08-07 07:15:07 -07:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
case EOLIAN_EXPR_INT:
|
|
|
|
case EOLIAN_EXPR_UINT:
|
|
|
|
case EOLIAN_EXPR_LONG:
|
|
|
|
case EOLIAN_EXPR_ULONG:
|
|
|
|
case EOLIAN_EXPR_LLONG:
|
|
|
|
case EOLIAN_EXPR_ULLONG:
|
|
|
|
case EOLIAN_EXPR_FLOAT:
|
|
|
|
case EOLIAN_EXPR_DOUBLE:
|
|
|
|
{
|
2014-08-07 08:29:03 -07:00
|
|
|
const char *ret;
|
|
|
|
Eina_Strbuf *buf = eina_strbuf_new();
|
2014-08-18 05:12:08 -07:00
|
|
|
_number_to_str(val, buf);
|
2014-08-07 08:29:03 -07:00
|
|
|
ret = eina_stringshare_add(eina_strbuf_string_get(buf));
|
|
|
|
eina_strbuf_free(buf);
|
2014-08-07 07:15:07 -07:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
2014-08-13 03:25:04 -07:00
|
|
|
|
|
|
|
static const char *_binops[] = {
|
|
|
|
"+", "-", "*", "/", "%",
|
|
|
|
"==", "!=", ">", "<", ">=", "<=",
|
|
|
|
"&&", "||",
|
|
|
|
"&", "|", "^", "<<", ">>"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *_unops[] = {
|
2015-06-11 08:41:32 -07:00
|
|
|
"-", "+", "!", "~"
|
2014-08-13 03:25:04 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_expr_serialize(const Eolian_Expression *expr, Eina_Strbuf *buf, Eina_Bool outer)
|
|
|
|
{
|
|
|
|
switch (expr->type)
|
|
|
|
{
|
|
|
|
case EOLIAN_EXPR_UNKNOWN:
|
|
|
|
return EINA_FALSE;
|
|
|
|
case EOLIAN_EXPR_INT:
|
|
|
|
case EOLIAN_EXPR_UINT:
|
|
|
|
case EOLIAN_EXPR_LONG:
|
|
|
|
case EOLIAN_EXPR_ULONG:
|
|
|
|
case EOLIAN_EXPR_LLONG:
|
|
|
|
case EOLIAN_EXPR_ULLONG:
|
|
|
|
case EOLIAN_EXPR_FLOAT:
|
|
|
|
case EOLIAN_EXPR_DOUBLE:
|
|
|
|
case EOLIAN_EXPR_STRING:
|
|
|
|
case EOLIAN_EXPR_CHAR:
|
|
|
|
{
|
2019-09-30 02:28:32 -07:00
|
|
|
Eolian_Value v;
|
|
|
|
v.type = expr->type;
|
|
|
|
v.value = expr->value;
|
|
|
|
const char *x = eolian_expression_value_to_literal(&v);
|
2014-08-13 03:25:04 -07:00
|
|
|
if (!x)
|
2014-08-18 05:12:08 -07:00
|
|
|
return EINA_FALSE;
|
2014-08-13 03:25:04 -07:00
|
|
|
eina_strbuf_append(buf, x);
|
|
|
|
eina_stringshare_del(x);
|
|
|
|
break;
|
|
|
|
}
|
2014-09-02 05:06:59 -07:00
|
|
|
case EOLIAN_EXPR_NULL:
|
|
|
|
eina_strbuf_append(buf, "null");
|
|
|
|
break;
|
|
|
|
case EOLIAN_EXPR_BOOL:
|
|
|
|
eina_strbuf_append(buf, expr->value.b ? "true" : "false");
|
|
|
|
break;
|
2014-08-13 03:25:04 -07:00
|
|
|
case EOLIAN_EXPR_NAME:
|
|
|
|
{
|
|
|
|
eina_strbuf_append(buf, expr->value.s);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EOLIAN_EXPR_UNARY:
|
|
|
|
eina_strbuf_append(buf, _unops[expr->unop]);
|
|
|
|
_expr_serialize(expr->expr, buf, EINA_FALSE);
|
|
|
|
break;
|
|
|
|
case EOLIAN_EXPR_BINARY:
|
|
|
|
if (!outer)
|
|
|
|
eina_strbuf_append_char(buf, '(');
|
|
|
|
_expr_serialize(expr->lhs, buf, EINA_FALSE);
|
|
|
|
eina_strbuf_append_printf(buf, " %s ", _binops[expr->binop]);
|
|
|
|
_expr_serialize(expr->rhs, buf, EINA_FALSE);
|
|
|
|
if (!outer)
|
|
|
|
eina_strbuf_append_char(buf, ')');
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
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 *
|
2014-08-13 03:25:04 -07:00
|
|
|
eolian_expression_serialize(const Eolian_Expression *expr)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(expr, NULL);
|
|
|
|
Eina_Strbuf *buf = eina_strbuf_new();
|
|
|
|
if (!_expr_serialize(expr, buf, EINA_TRUE))
|
|
|
|
{
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
const char *ret = eina_stringshare_add(eina_strbuf_string_get(buf));
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
return ret;
|
|
|
|
}
|
2014-09-02 05:32:47 -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_Expression_Type
|
2014-09-02 05:32:47 -07:00
|
|
|
eolian_expression_type_get(const Eolian_Expression *expr)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(expr, EOLIAN_EXPR_UNKNOWN);
|
|
|
|
return expr->type;
|
|
|
|
}
|
|
|
|
|
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_Binary_Operator
|
2014-09-02 05:32:47 -07:00
|
|
|
eolian_expression_binary_operator_get(const Eolian_Expression *expr)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(expr, EOLIAN_BINOP_INVALID);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(expr->type == EOLIAN_EXPR_BINARY,
|
|
|
|
EOLIAN_BINOP_INVALID);
|
|
|
|
return expr->binop;
|
|
|
|
}
|
|
|
|
|
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-09-02 05:32:47 -07:00
|
|
|
eolian_expression_binary_lhs_get(const Eolian_Expression *expr)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(expr, NULL);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(expr->type == EOLIAN_EXPR_BINARY, NULL);
|
|
|
|
return expr->lhs;
|
|
|
|
}
|
|
|
|
|
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-09-02 05:32:47 -07:00
|
|
|
eolian_expression_binary_rhs_get(const Eolian_Expression *expr)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(expr, NULL);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(expr->type == EOLIAN_EXPR_BINARY, NULL);
|
|
|
|
return expr->rhs;
|
|
|
|
}
|
|
|
|
|
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_Unary_Operator
|
2014-09-02 05:32:47 -07:00
|
|
|
eolian_expression_unary_operator_get(const Eolian_Expression *expr)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(expr, EOLIAN_UNOP_INVALID);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(expr->type == EOLIAN_EXPR_UNARY,
|
|
|
|
EOLIAN_UNOP_INVALID);
|
|
|
|
return expr->unop;
|
|
|
|
}
|
|
|
|
|
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-09-02 05:32:47 -07:00
|
|
|
eolian_expression_unary_expression_get(const Eolian_Expression *expr)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(expr, NULL);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(expr->type == EOLIAN_EXPR_UNARY, NULL);
|
|
|
|
return expr->expr;
|
|
|
|
}
|
|
|
|
|
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_Value
|
2014-09-02 05:32:47 -07:00
|
|
|
eolian_expression_value_get(const Eolian_Expression *expr)
|
|
|
|
{
|
|
|
|
Eolian_Value v;
|
|
|
|
v.type = EOLIAN_EXPR_UNKNOWN;
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(expr, v);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(expr->type != EOLIAN_EXPR_UNKNOWN
|
|
|
|
&& expr->type != EOLIAN_EXPR_BINARY
|
|
|
|
&& expr->type != EOLIAN_EXPR_UNARY, v);
|
|
|
|
v.type = expr->type;
|
|
|
|
v.value = expr->value;
|
|
|
|
return v;
|
|
|
|
}
|
2020-05-30 17:11:15 -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
|
2020-05-30 17:11:15 -07:00
|
|
|
eolian_expression_value_get_fill(const Eolian_Expression *expr, Eolian_Value *val)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(expr, EINA_FALSE);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(expr->type != EOLIAN_EXPR_UNKNOWN
|
|
|
|
&& expr->type != EOLIAN_EXPR_BINARY
|
|
|
|
&& expr->type != EOLIAN_EXPR_UNARY, EINA_FALSE);
|
|
|
|
val->type = expr->type;
|
|
|
|
val->value = expr->value;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|