Hi, I'm a developer of EFL libraries and recently we changed our API
in a way that I think could be automated by Coccinelle. So, I started
looking on this software yesterday.
What we did is changing the signature of some callback functions to
return Eina_Bool instead of int. Eina_Bool is a typedef for unsigned
char that is declared in a header included by Eina.h. I'm making some
tests with the following snippet:
--------------
#include <Eina.h>
#include <Ecore.h>
static int test_func(void *data) {
if (data == NULL) {
ecore_main_loop_quit();
return 0;
}
return 1;
}
int main(void) {
ecore_init();
ecore_timer_add(1, test_func, 1);
ecore_main_loop_begin();
ecore_shutdown();
return 0;
}
------------------------------
Applying the following semantic patch:
------------------------------
@r1@
identifier fn;
@@
ecore_timer_add(..., fn, ...);
@r2@
identifier r1.fn;
identifier data;
@@
- int
+ Eina_Bool
fn(void *data) {
...
(
- return 0;
+ return EINA_FALSE;
|
- return 1;
+ return EINA_TRUE;
)
...
}
---------------------------------
However it's not working because of that Eina_Bool. If I change
Eina_Bool to char, it works as expected. I tried playing with the
-all_includes and -I options but it doesn't work either. What am I
doing wrong?
Thanks
Best Regards,
Lucas De Marchi
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)