cedric pushed a commit to branch master.

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

commit 1c8225099414109c8360b078cc27410f2215040a
Author: Cedric Bail <[email protected]>
Date:   Fri Oct 27 15:31:57 2017 -0700

    ecore: efl_loop should actually handle exit via Eina_Value.
    
    This is for binding consistency. Example with python :
    sys.exit("Bye, world")
    
    Which with efl would be :
    loop.quit("Bye, world")
    
    T6228
---
 src/lib/ecore/ecore_main.c | 9 +++++----
 src/lib/ecore/efl_loop.eo  | 4 ++--
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/lib/ecore/ecore_main.c b/src/lib/ecore/ecore_main.c
index 8fef249cfe..149df63006 100644
--- a/src/lib/ecore/ecore_main.c
+++ b/src/lib/ecore/ecore_main.c
@@ -285,7 +285,7 @@ int in_main_loop = 0;
 
 static Eina_List *_pending_futures = NULL;
 static Eina_List *_pending_promises = NULL;
-static unsigned char _ecore_exit_code = 0;
+static Eina_Value _ecore_exit_code = EINA_VALUE_EMPTY;
 static int do_quit = 0;
 static Ecore_Fd_Handler *fd_handlers = NULL;
 static Ecore_Fd_Handler *fd_handler_current = NULL;
@@ -2852,15 +2852,16 @@ EOLIAN static int _efl_loop_iterate_may_block(Eo *obj 
EINA_UNUSED, Efl_Loop_Data
    return ecore_main_loop_iterate_may_block(may_block);
 }
 
-EOLIAN static unsigned char
+// FIXME: This should return an Eina_Value, but that doesn't work at the moment
+EOLIAN static Eina_Value *
 _efl_loop_begin(Eo *obj EINA_UNUSED, Efl_Loop_Data *pd EINA_UNUSED)
 {
    ecore_main_loop_begin();
-   return _ecore_exit_code;
+   return &_ecore_exit_code;
 }
 
 EOLIAN static void
-_efl_loop_quit(Eo *obj EINA_UNUSED, Efl_Loop_Data *pd EINA_UNUSED, unsigned 
char exit_code)
+_efl_loop_quit(Eo *obj EINA_UNUSED, Efl_Loop_Data *pd EINA_UNUSED, Eina_Value 
exit_code)
 {
    ecore_main_loop_quit();
    _ecore_exit_code = exit_code;
diff --git a/src/lib/ecore/efl_loop.eo b/src/lib/ecore/efl_loop.eo
index b1e725de5d..bb70a8f377 100644
--- a/src/lib/ecore/efl_loop.eo
+++ b/src/lib/ecore/efl_loop.eo
@@ -61,13 +61,13 @@ class Efl.Loop (Efl.Object)
       }
       begin {
          [[Runs the application main loop.]]
-         return: ubyte; [[Value set by quit()]]
+         return: any_value_ptr; [[Value set by quit()]]
       }
       quit {
          [[Quits the main loop once all the events currently on the queue have
          been processed.]]
          params {
-            @in exit_code: ubyte; [[Returned value by begin()]]
+            @in exit_code: any_value; [[Returned value by begin()]]
          }
       }
       Eina_FutureXXX_job {

-- 


Reply via email to