From: Cristian Rosa Date: Fri, 7 Sep 2012 15:33:18 +0000 (-0300) Subject: Extend definition of simcalls to include a pointer to the simcall handler functions. X-Git-Tag: v3_9_rc1~86^2~237^2~9 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/5bfd6df6e3880e128c78afbeff9dfc131f8c8fef?hp=2f4b693b1235e1d82f41a1639046c3ac66063fba Extend definition of simcalls to include a pointer to the simcall handler functions. Use these pointers to initialize a simcall dispatch table. --- diff --git a/src/simix/smx_smurf.c b/src/simix/smx_smurf.c index 0f1bdfb609..5a573ff89d 100644 --- a/src/simix/smx_smurf.c +++ b/src/simix/smx_smurf.c @@ -658,7 +658,13 @@ void __SIMIX_simcall(e_smx_simcall_t simcall_id, u_smx_scalar_t *args) /* FIXME: add types for every simcall */ const char *simcall_types[NUM_SIMCALLS] = { [SIMCALL_HOST_EXECUTE] = "%s%p%f%f%p" }; -simcall_handler_t simcall_table[NUM_SIMCALLS] = {[SIMCALL_HOST_EXECUTE] = &SIMIX_host_execute}; +simcall_handler_t simcall_table[NUM_SIMCALLS] = { +#undef SIMCALL_ENUM_ELEMENT +#define SIMCALL_ENUM_ELEMENT(x,y) &y /* generate strings from the enumeration values */ +SIMCALL_LIST +#undef SIMCALL_ENUM_ELEMENT +}; + void SIMIX_simcall_typecheck(const char *fmt, ...) {