cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=ed9dff8fbd422b613042cd9f402018eda28ffc67

commit ed9dff8fbd422b613042cd9f402018eda28ffc67
Author: Cedric BAIL <ced...@osg.samsung.com>
Date:   Wed Jun 29 15:00:17 2016 -0700

    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.
---
 src/Makefile_Eolian.am                     |  4 +++
 src/lib/eolian/eo_lexer.c                  |  2 +-
 src/lib/eolian/eo_lexer.h                  |  2 +-
 src/lib/eolian/eo_parser.c                 |  4 +--
 src/tests/eolian/eolian_generated_future.c | 51 ++++++++++++++++++++++++++
 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 164495b..dac5638 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 5a55b01..499ff92 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 cc36d77..b33f047 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 0f302c1..1fc4b97 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 0000000..47f3251
--- /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 0000000..5e19c90
--- /dev/null
+++ b/src/tests/eolian/generated_future.eo
@@ -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>;
+         }
+      }
+   }
+}
+
+

-- 


Reply via email to