1 /*
2  * Copyright (c) 2004-2005 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) 2011-2012 Cisco Systems, Inc.  All rights reserved.
13  * Copyright (c) 2012      Oracle and/or its affiliates.  All rights reserved.
14  * Copyright (c) 2015      Research Organization for Information Science
15  *                         and Technology (RIST). All rights reserved.
16  * $COPYRIGHT$
17  *
18  * Additional copyrights may follow
19  *
20  * $HEADER$
21  */
22 
23 #include "ompi_config.h"
24 
25 #include "ompi/mpi/fortran/mpif-h/bindings.h"
26 #include "ompi/mpi/fortran/mpif-h/status-conversion.h"
27 #include "ompi/mpi/fortran/base/constants.h"
28 #include "ompi/communicator/communicator.h"
29 
30 #if OMPI_BUILD_MPI_PROFILING
31 #if OPAL_HAVE_WEAK_SYMBOLS
32 #pragma weak PMPI_PROBE = ompi_probe_f
33 #pragma weak pmpi_probe = ompi_probe_f
34 #pragma weak pmpi_probe_ = ompi_probe_f
35 #pragma weak pmpi_probe__ = ompi_probe_f
36 
37 #pragma weak PMPI_Probe_f = ompi_probe_f
38 #pragma weak PMPI_Probe_f08 = ompi_probe_f
39 #else
40 OMPI_GENERATE_F77_BINDINGS (PMPI_PROBE,
41                            pmpi_probe,
42                            pmpi_probe_,
43                            pmpi_probe__,
44                            pompi_probe_f,
45                            (MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *status, MPI_Fint *ierr),
46                            (source, tag, comm, status, ierr) )
47 #endif
48 #endif
49 
50 #if OPAL_HAVE_WEAK_SYMBOLS
51 #pragma weak MPI_PROBE = ompi_probe_f
52 #pragma weak mpi_probe = ompi_probe_f
53 #pragma weak mpi_probe_ = ompi_probe_f
54 #pragma weak mpi_probe__ = ompi_probe_f
55 
56 #pragma weak MPI_Probe_f = ompi_probe_f
57 #pragma weak MPI_Probe_f08 = ompi_probe_f
58 #else
59 #if ! OMPI_BUILD_MPI_PROFILING
60 OMPI_GENERATE_F77_BINDINGS (MPI_PROBE,
61                            mpi_probe,
62                            mpi_probe_,
63                            mpi_probe__,
64                            ompi_probe_f,
65                            (MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *status, MPI_Fint *ierr),
66                            (source, tag, comm, status, ierr) )
67 #else
68 #define ompi_probe_f pompi_probe_f
69 #endif
70 #endif
71 
72 
ompi_probe_f(MPI_Fint * source,MPI_Fint * tag,MPI_Fint * comm,MPI_Fint * status,MPI_Fint * ierr)73 void ompi_probe_f(MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *status, MPI_Fint *ierr)
74 {
75     int c_ierr;
76     MPI_Comm c_comm;
77     OMPI_FORTRAN_STATUS_DECLARATION(c_status,c_status2)
78 
79     c_comm = PMPI_Comm_f2c (*comm);
80 
81     OMPI_FORTRAN_STATUS_SET_POINTER(c_status,c_status2,status)
82 
83     c_ierr = PMPI_Probe(OMPI_FINT_2_INT(*source),
84                        OMPI_FINT_2_INT(*tag),
85                        c_comm, c_status);
86     if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
87 
88     OMPI_FORTRAN_STATUS_RETURN(c_status,c_status2,status,c_ierr)
89 }
90