forked from enlightenment/efl
eolian: add support for future.
Future is the read only side of a Promise. For now, I am not removing Eina_Promise until everything is in place, but eventually the promise type of eolian will be gone.
This commit is contained in:
parent
9a2ada6d87
commit
ed9dff8fbd
|
@ -112,12 +112,15 @@ tests_eolian_eolian_suite_SOURCES = \
|
|||
tests/eolian/eolian_parsing.c \
|
||||
tests/eolian/eolian_generation.c \
|
||||
tests/eolian/eolian_generated_promise.c \
|
||||
tests/eolian/eolian_generated_future.c \
|
||||
tests/eolian/eolian_suite.c \
|
||||
tests/eolian/eolian_suite.h
|
||||
|
||||
tests/eolian/tests_eolian_eolian_suite-eolian_generated_promise.$(OBJEXT): tests/eolian/generated_promise.eo.h tests/eolian/generated_promise.eo.c
|
||||
tests/eolian/tests_eolian_eolian_suite-eolian_generated_future.$(OBJEXT): tests/eolian/generated_future.eo.h tests/eolian/generated_future.eo.c
|
||||
|
||||
CLEANFILES += tests/eolian/generated_promise.eo.h tests/eolian/generated_promise.eo.c
|
||||
CLEANFILES += tests/eolian/generated_future.eo.h tests/eolian/generated_future.eo.c
|
||||
|
||||
tests_eolian_eolian_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl -I$(top_builddir)/src/tests/eolian \
|
||||
-DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/eolian\" \
|
||||
|
@ -148,4 +151,5 @@ tests/eolian/data/import_types_ref.h \
|
|||
tests/eolian/data/docs_ref.h \
|
||||
tests/eolian/data/docs_ref_legacy.h \
|
||||
tests/eolian/generated_promise.eo \
|
||||
tests/eolian/generated_future.eo \
|
||||
$(EOLIAN_TESTS_EOS)
|
||||
|
|
|
@ -75,7 +75,7 @@ static const char * const ctypes[] =
|
|||
NULL, NULL, /* array types */
|
||||
|
||||
"Eina_Accessor", "Eina_Array", "Eina_Iterator", "Eina_Hash", "Eina_List",
|
||||
"Eina_Promise",
|
||||
"Eina_Promise", "Efl_Future",
|
||||
"Eina_Value", "const char *", "Eina_Stringshare *",
|
||||
|
||||
"void *",
|
||||
|
|
|
@ -53,7 +53,7 @@ enum Tokens
|
|||
KW(static_array), KW(terminated_array), \
|
||||
\
|
||||
KW(accessor), KW(array), KW(iterator), KW(hash), KW(list), \
|
||||
KW(promise), \
|
||||
KW(promise), KW(future), \
|
||||
KW(generic_value), KW(string), KW(stringshare), \
|
||||
\
|
||||
KW(void_ptr), \
|
||||
|
|
|
@ -887,7 +887,7 @@ parse_type_void(Eo_Lexer *ls, Eina_Bool allow_ref, Eina_Bool allow_sarray)
|
|||
_fill_name(eina_stringshare_ref(ls->t.value.s), &def->full_name,
|
||||
&def->name, &def->namespaces);
|
||||
eo_lexer_get(ls);
|
||||
if (tpid >= KW_accessor && tpid <= KW_promise)
|
||||
if (tpid >= KW_accessor && tpid <= KW_future)
|
||||
{
|
||||
int bline = ls->line_number, bcol = ls->column;
|
||||
def->type = EOLIAN_TYPE_COMPLEX;
|
||||
|
@ -900,7 +900,7 @@ parse_type_void(Eo_Lexer *ls, Eina_Bool allow_ref, Eina_Bool allow_sarray)
|
|||
def->base_type->next_type = parse_type(ls, EINA_FALSE, EINA_FALSE);
|
||||
pop_type(ls);
|
||||
}
|
||||
else if(tpid == KW_promise && test_next(ls, ','))
|
||||
else if((tpid == KW_promise || tpid == KW_future) && test_next(ls, ','))
|
||||
{
|
||||
def->base_type->next_type = parse_type(ls, EINA_FALSE, EINA_FALSE);
|
||||
pop_type(ls);
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <Eina.h>
|
||||
#include <Eo.h>
|
||||
|
||||
#include <check.h>
|
||||
|
||||
struct Generated_Future_Data {};
|
||||
typedef struct Generated_Future_Data Generated_Future_Data;
|
||||
|
||||
static void _generated_future_method_progress_type(Eo *obj EINA_UNUSED, Generated_Future_Data *pd EINA_UNUSED,
|
||||
Efl_Future **future1 EINA_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
static Efl_Future * _generated_future_prop1_get(Eo *obj EINA_UNUSED, Generated_Future_Data *pd EINA_UNUSED)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void _generated_future_prop2_get(Eo *obj EINA_UNUSED, Generated_Future_Data *pd EINA_UNUSED, int *i EINA_UNUSED,
|
||||
Efl_Future **future1 EINA_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
static void _generated_future_prop3_set(Eo *obj EINA_UNUSED, Generated_Future_Data *pd EINA_UNUSED,
|
||||
Efl_Future *future1 EINA_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
static void _generated_future_method1(Eo *obj EINA_UNUSED, Generated_Future_Data *pd EINA_UNUSED,
|
||||
Efl_Future **future1 EINA_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
static void _generated_future_method2(Eo *obj EINA_UNUSED, Generated_Future_Data *pd EINA_UNUSED,
|
||||
Efl_Future **future1 EINA_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
static void _generated_future_method3(Eo *obj EINA_UNUSED, Generated_Future_Data *pd EINA_UNUSED,
|
||||
Efl_Future *future1 EINA_UNUSED)
|
||||
{
|
||||
ck_assert(future1 != NULL);
|
||||
}
|
||||
|
||||
#include "generated_future.eo.h"
|
||||
#include "generated_future.eo.c"
|
|
@ -0,0 +1,58 @@
|
|||
class Generated_Future (Efl.Object)
|
||||
{
|
||||
methods {
|
||||
method1 {
|
||||
params {
|
||||
@inout future1: future<int>;
|
||||
}
|
||||
}
|
||||
method_progress_type {
|
||||
params {
|
||||
@inout future1: future<int, double>;
|
||||
}
|
||||
}
|
||||
method_multiple_args_1 {
|
||||
params {
|
||||
@inout future1: future<int>;
|
||||
@in data: void_ptr;
|
||||
}
|
||||
}
|
||||
method_multiple_args_2 {
|
||||
params {
|
||||
@in data: void_ptr;
|
||||
@inout future1: future<int>;
|
||||
}
|
||||
}
|
||||
method2 {
|
||||
params {
|
||||
@out future1: future<int>;
|
||||
}
|
||||
}
|
||||
method3 {
|
||||
params {
|
||||
@in future1: future<int>;
|
||||
}
|
||||
}
|
||||
@property prop1 {
|
||||
get {}
|
||||
values {
|
||||
future1: future<int>;
|
||||
}
|
||||
}
|
||||
@property prop2 {
|
||||
get {}
|
||||
values {
|
||||
i: int;
|
||||
future1: future<int>;
|
||||
}
|
||||
}
|
||||
@property prop3 {
|
||||
set {}
|
||||
values {
|
||||
future1: future<int>;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue