From 5bfd6df6e3880e128c78afbeff9dfc131f8c8fef Mon Sep 17 00:00:00 2001 From: Cristian Rosa Date: Fri, 7 Sep 2012 12:33:18 -0300 Subject: [PATCH] Extend definition of simcalls to include a pointer to the simcall handler functions. Use these pointers to initialize a simcall dispatch table. --- src/simix/smx_smurf.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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, ...) { -- 2.20.1