- res.append(
- ' /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */')
- res.append('')
- res.append(' self->simcall.call = SIMCALL_%s;' %
- (self.name.upper()))
- res.append(
- ' memset(&self->simcall.result, 0, sizeof(self->simcall.result));')
- res.append(
- ' memset(self->simcall.args, 0, sizeof(self->simcall.args));')
- res.append('\n'.join(' self->simcall.args[%d].%s = (%s) %s;' % (i, arg.field(), arg.type, arg.name)
- for i, arg in enumerate(self.args)))
- res.append(' if (self != simix_global->maestro_process) {')
- res.append(
- ' XBT_DEBUG("Yield process \'%s\' on simcall %s (%d)", self->name.c_str(),')
- res.append(
- ' SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);')
- res.append(' SIMIX_process_yield(self);')
- res.append(' } else {')
- res.append(' SIMIX_simcall_handle(&self->simcall, 0);')
- res.append(' } ')
- if self.res.type != 'void':
- res.append(' return (%s) self->simcall.result.%s;' %
- (self.res.rettype(), self.res.field()))
- else:
- res.append(' ')
- res.append(' }')
+ res.append(' return simcall<%s%s>(SIMCALL_%s%s);' % (
+ self.res.rettype(),
+ "".join([ ", " + arg.rettype() for i, arg in enumerate(self.args) ]),
+ self.name.upper(),
+ "".join([ ", " + arg.name for i, arg in enumerate(self.args) ])
+ ));
+ res.append('}')