root/ompi/mpi/fortran/base/datarep.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2004-2005 The University of Tennessee and The University
   6  *                         of Tennessee Research Foundation.  All rights
   7  *                         reserved.
   8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
   9  *                         University of Stuttgart.  All rights reserved.
  10  * Copyright (c) 2004-2005 The Regents of the University of California.
  11  *                         All rights reserved.
  12  * Copyright (c) 2007-2012 Cisco Systems, Inc.  All rights reserved.
  13  * Copyright (c) 2015      Research Organization for Information Science
  14  *                         and Technology (RIST). All rights reserved.
  15  * $COPYRIGHT$
  16  *
  17  * Additional copyrights may follow
  18  *
  19  * $HEADER$
  20  */
  21 
  22 /**
  23  * @file
  24  *
  25  * This file does two things:
  26  *
  27  * 1. Provides typedef for the Fortran versions of the callbacks
  28  * registered by MPI_REGISTER_DATAREP.  These typedefs are needed for
  29  * the Fortran MPI API.
  30  *
  31  * 2. Provides the sentinel value functions/function pointers for
  32  * Fortran's version of MPI_CONVERSION_FN_NULL, and some helpful
  33  * macros for testing whether an argument passed to a Fortran MPI API
  34  * function is that sentinel value or not.
  35  */
  36 
  37 #ifndef OMPI_FORTRAN_BASE_DATAREP_H
  38 #define OMPI_FORTRAN_BASE_DATAREP_H
  39 
  40 #include "ompi_config.h"
  41 
  42 #include "mpi.h"
  43 
  44 BEGIN_C_DECLS
  45 
  46 /**
  47  * Function typedef for the conversion function pointer in
  48  * MPI_REGISTER_DATAREP */
  49 typedef void (ompi_mpi2_fortran_datarep_conversion_fn_t)
  50     (char *userbuf, MPI_Fint *datatype, MPI_Fint *count, char *filebuf,
  51      MPI_Offset *position, MPI_Aint *extra_state, MPI_Fint *ierr);
  52 
  53 /**
  54  * Function typedef for the extent function pointer in
  55  * MPI_REGISTER_DATAREP */
  56 typedef void (ompi_mpi2_fortran_datarep_extent_fn_t)
  57     (MPI_Fint *datatype, MPI_Aint *extent, MPI_Aint *extra_state,
  58      MPI_Fint *ierr);
  59 
  60 /**
  61  * Macro for declaring each of the 5 back-end Fortran functions for
  62  * MPI_CONVERSION_FN_NULL.  We need the 4 fortran compiler convetions
  63  * and 1 for the "real" back-end function (even though these functions
  64  * are never invoked -- they're only used as sentinel values -- it's
  65  * simpler to use the same kind of code structure that we use for the
  66  * Fortran MPI API bindings and other callback functions).
  67  */
  68 #define OMPI_DATAREP_FORTRAN_DECLARE(lower_name, upper_name, args) \
  69   OMPI_DECLSPEC void lower_name##_f args;    \
  70   OMPI_DECLSPEC void lower_name args;        \
  71   OMPI_DECLSPEC void lower_name##_ args;     \
  72   OMPI_DECLSPEC void lower_name##__ args;    \
  73   OMPI_DECLSPEC void upper_name args;
  74 
  75 /*
  76  * Declare the 5 functions.
  77  */
  78 OMPI_DATAREP_FORTRAN_DECLARE(mpi_conversion_fn_null, MPI_CONVERSION_FN_NULL, (char *userbuf, MPI_Fint *datatype, MPI_Fint *count, char *filebuf, MPI_Offset *position, MPI_Aint *extra_state, MPI_Fint *ierr))
  79 
  80 /* Be social and remove this private macro from the global header file
  81    space */
  82 #undef OMPI_DATAREP_FORTRAN_DECLARE
  83 
  84 /**
  85  * Declare the test macro in all of its forms.  This macro provides a
  86  * convenient way to check whether an argument is the sentinel value
  87  * MPI_CONVERSION_FN_NULL.
  88  */
  89 #if OMPI_FORTRAN_CAPS
  90 #define OMPI_IS_FORTRAN_CONVERSION_FN_NULL(addr) \
  91   (MPI_CONVERSION_FN_NULL == addr)
  92 #elif OMPI_FORTRAN_PLAIN
  93 #define OMPI_IS_FORTRAN_CONVERSION_FN_NULL(addr) \
  94   (mpi_conversion_fn_null == addr)
  95 #elif OMPI_FORTRAN_SINGLE_UNDERSCORE
  96 #define OMPI_IS_FORTRAN_CONVERSION_FN_NULL(addr) \
  97   (mpi_conversion_fn_null_ == addr)
  98 #elif OMPI_FORTRAN_DOUBLE_UNDERSCORE
  99 #define OMPI_IS_FORTRAN_CONVERSION_FN_NULL(addr) \
 100   (mpi_conversion_fn_null__ == addr)
 101 #else
 102 #error Unrecognized Fortran name mangling scheme
 103 #endif
 104 
 105 END_C_DECLS
 106 
 107 #endif

/* [<][>][^][v][top][bottom][index][help] */