eo2: add eo2_call_stack_depth
authorJérémy Zurcher <jeremy@asynk.ch>
Sat, 27 Jul 2013 20:46:50 +0000 (22:46 +0200)
committerTom Hacohen <tom@stosb.com>
Thu, 10 Apr 2014 03:20:16 +0000 (04:20 +0100)
src/lib/eo/Eo.h
src/lib/eo/eo.c

index dbcd42d..ea3709f 100644 (file)
@@ -680,6 +680,8 @@ EAPI Eina_Bool eo2_do_start(Eo *obj_id, Eina_Bool do_super);
 // end of the eo2_do barrier, unref the obj, move the stack pointer
 EAPI void eo2_do_end();
 
+EAPI int eo2_call_stack_depth();
+
 // eo object method calls batch,
 // DO NOT use return statement in it, use break if necessary
 #define eo2_do(objid, ...)                            \
index 9632aa8..bdb5105 100644 (file)
@@ -300,6 +300,13 @@ static Eo2_Call_Stack eo2_call_stack = {
        },
        NULL };
 
+EAPI int
+eo2_call_stack_depth()
+{
+   return ((eo2_call_stack.frame_ptr == NULL) ? 0 :
+           1 + (eo2_call_stack.frame_ptr - eo2_call_stack.stack));
+}
+
 EAPI Eina_Bool
 eo2_do_start(Eo *obj_id, Eina_Bool do_super)
 {