On Tue, Jul 23, 2013 at 12:01 PM, Gustavo Sverzut Barbieri
<barbi...@profusion.mobi> wrote:

[snip]

> the con I could see is we loose validation in the caller, you'd need
> to validate in the function... Example:
>     eo_do(evas_obj, ecore_timer_interval_set(10.0));
> this would still call directly ecore_timer_interval_set(), which
> internally would get the eo_o, which should be validated and return if
> not right. All in all that would be the case, as
> ecore_timer_interval_set() would need to get the actual method
> (virtual) to call.

Just an idea that might be expanded. What if you change the syntax a bit to:

  eo_do(obj
        , x = eo_call(ecore_foo) (10.0)
       );

This way we can hijack the arguments and the function name in
preprocessor-time using:

#define EO_FUNCTION_ARGS(...) (__eo_obj, ##__VA_ARGS__) };
#define eo_call(F) { F EO_FUNCTION_ARGS

#define eo_do( OBJ, ...)                        \
  do                                            \
  {                                             \
    void* __eo_obj = OBJ;                            \
    __VA_ARGS__                                 \
  }                                           \
  while(0)                                    \

int ecore_foo(void*, double)
{
  return 5;
}

int main()
{
  void* obj;
  int x;
  eo_do(obj
        , x = eo_call(ecore_foo) (10.0)
       );
}

A few problems: get the function's signature in C so the virtual
method to call can be get and be callable with the arguments
preprocessed; the function name and its arguments must be expanded in
order; it uses the GNU extension of statement expressions.

[snip]

> --
> Gustavo Sverzut Barbieri
> http://profusion.mobi embedded systems

Regards,
-- 
Felipe Magno de Almeida

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to