diff options
author | Cedric BAIL <cedric@osg.samsung.com> | 2016-06-29 15:00:17 -0700 |
---|---|---|
committer | Cedric Bail <cedric@osg.samsung.com> | 2016-08-04 11:00:24 -0700 |
commit | f73fa86950dfda44c1c93c4e449face2861572b9 (patch) | |
tree | 89dfa3a59f422d812fb844e5771b3b6a7d58ef8b | |
parent | 3213d46ca93373543a3537c0bbf2df3179897ce8 (diff) | |
download | efl-f73fa86950dfda44c1c93c4e449face2861572b9.tar.gz |
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.
-rw-r--r-- | src/Makefile_Eolian.am | 4 | ||||
-rw-r--r-- | src/lib/eolian/eo_lexer.c | 2 | ||||
-rw-r--r-- | src/lib/eolian/eo_lexer.h | 2 | ||||
-rw-r--r-- | src/lib/eolian/eo_parser.c | 4 | ||||
-rw-r--r-- | src/tests/eolian/eolian_generated_future.c | 51 | ||||
-rw-r--r-- | src/tests/eolian/generated_future.eo | 58 |
6 files changed, 117 insertions, 4 deletions
diff --git a/src/Makefile_Eolian.am b/src/Makefile_Eolian.am index 164495bc0e..dac5638389 100644 --- a/src/Makefile_Eolian.am +++ b/src/Makefile_Eolian.am @@ -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) diff --git a/src/lib/eolian/eo_lexer.c b/src/lib/eolian/eo_lexer.c index a3a4d4d7f6..63320bcc0a 100644 --- a/src/lib/eolian/eo_lexer.c +++ b/src/lib/eolian/eo_lexer.c @@ -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 *", diff --git a/src/lib/eolian/eo_lexer.h b/src/lib/eolian/eo_lexer.h index cc36d77fe8..b33f047396 100644 --- a/src/lib/eolian/eo_lexer.h +++ b/src/lib/eolian/eo_lexer.h @@ -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), \ diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c index ead4183e19..c6170ae8ae 100644 --- a/src/lib/eolian/eo_parser.c +++ b/src/lib/eolian/eo_parser.c @@ -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); diff --git a/src/tests/eolian/eolian_generated_future.c b/src/tests/eolian/eolian_generated_future.c new file mode 100644 index 0000000000..47f3251aad --- /dev/null +++ b/src/tests/eolian/eolian_generated_future.c @@ -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" diff --git a/src/tests/eolian/generated_future.eo b/src/tests/eolian/generated_future.eo new file mode 100644 index 0000000000..cedd27d2ae --- /dev/null +++ b/src/tests/eolian/generated_future.eo @@ -0,0 +1,58 @@ +class Generated_Future (Eo.Base) +{ + 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>; + } + } + } +} + + |