- res.append(' if (0) simcall_HANDLER_%s(%s);' % (self.name,
- ', '.join(["&self->simcall"] + [arg.name for arg in self.args])))
- else:
- res.append(' if (0) SIMIX_%s(%s);' % (self.name,
- ', '.join(arg.name for arg in self.args)))
- 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()))