X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/07bacc793410c12a213226b8be422a67157dd9de..453d43c197818b5469f79845e522f5451c811791:/src/smpi/smpi_f77.c diff --git a/src/smpi/smpi_f77.c b/src/smpi/smpi_f77.c index 43c93d3510..aa9af8c26e 100644 --- a/src/smpi/smpi_f77.c +++ b/src/smpi/smpi_f77.c @@ -1,8 +1,8 @@ -/* Copyright (c) 2010-2013. The SimGrid Team. +/* Copyright (c) 2010-2014. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ + * under the terms of the license (GNU LGPL) which comes with this package. */ #include #include @@ -23,29 +23,24 @@ static int running_processes = 0; /* Bindings for MPI special values */ union u_smpi_common { struct s_smpi_common { - integer mpi_in_place; - integer mpi_bottom; - integer mpi_status_ignore; - integer mpi_statuses_ignore; - } f90; /* with gftortran */ - struct s_smpi_common *f77; /* with f2c */ -} smpi_; + integer _MPI_IN_PLACE; + integer _MPI_BOTTOM; + integer _MPI_STATUS_IGNORE; + integer _MPI_STATUSES_IGNORE; + } *f77; /* with f2c, remains NULL with gfortran */ + struct s_smpi_common f90; /* with gftortran */ +} smpi_ = { NULL }; /* Convert between Fortran and C */ -static XBT_INLINE void *f2c_addr(void *addr, void *cval, void *chk1, void *chk2) -{ - return (addr == chk1 || addr == chk2) ? cval : addr; -} -#define F2C_ADDR(addr, cval, fval) \ - f2c_addr(addr, cval, &smpi_.f90.fval, &smpi_.f77[smpi_current_rank].fval) -#define F2C_BOTTOM(addr) \ - F2C_ADDR(addr, MPI_BOTTOM, mpi_bottom) -#define F2C_IN_PLACE(addr) \ - F2C_ADDR(addr, MPI_IN_PLACE, mpi_in_place) -#define F2C_STATUS_IGNORE(addr) \ - F2C_ADDR(addr, MPI_STATUS_IGNORE, mpi_status_ignore) -#define F2C_STATUSES_IGNORE(addr) \ - F2C_ADDR(addr, MPI_STATUSES_IGNORE, mpi_statuses_ignore) +#define F2C_ADDR(addr, val) \ + (((void *)(addr) == (void *)(smpi_.f77 \ + ? &smpi_.f77[smpi_current_rank]._ ## val \ + : &smpi_.f90._ ## val)) \ + ? (val) : (void *)(addr)) +#define F2C_BOTTOM(addr) F2C_ADDR(addr, MPI_BOTTOM) +#define F2C_IN_PLACE(addr) F2C_ADDR(addr, MPI_IN_PLACE) +#define F2C_STATUS_IGNORE(addr) F2C_ADDR(addr, MPI_STATUS_IGNORE) +#define F2C_STATUSES_IGNORE(addr) F2C_ADDR(addr, MPI_STATUSES_IGNORE) #define KEY_SIZE (sizeof(int) * 2 + 1)