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