~ubuntu-branches/ubuntu/hardy/openmpi/hardy-updates

« back to all changes in this revision

Viewing changes to ompi/mpi/c/op_f2c.c

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2006-10-15 00:46:11 UTC
  • Revision ID: james.westby@ubuntu.com-20061015004611-uuhxnaxyjmuxfd5h
Tags: upstream-1.1
ImportĀ upstreamĀ versionĀ 1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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) 2006      Cisco Systems, Inc.  All rights reserved.
 
13
 * $COPYRIGHT$
 
14
 * 
 
15
 * Additional copyrights may follow
 
16
 * 
 
17
 * $HEADER$
 
18
 */
 
19
#include "ompi_config.h"
 
20
 
 
21
#include "ompi/mpi/c/bindings.h"
 
22
#include "ompi/mpi/f77/fint_2_int.h"
 
23
#include "ompi/op/op.h"
 
24
 
 
25
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
 
26
#pragma weak MPI_Op_f2c = PMPI_Op_f2c
 
27
#endif
 
28
 
 
29
#if OMPI_PROFILING_DEFINES
 
30
#include "ompi/mpi/c/profile/defines.h"
 
31
#endif
 
32
 
 
33
static const char FUNC_NAME[] = "MPI_Op_f2c";
 
34
 
 
35
 
 
36
MPI_Op MPI_Op_f2c(MPI_Fint op_f)
 
37
{
 
38
    int op_index = OMPI_FINT_2_INT(op_f);
 
39
 
 
40
    /* Error checking */
 
41
 
 
42
    if (MPI_PARAM_CHECK) {
 
43
        OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
 
44
    }
 
45
    
 
46
    /* Per MPI-2:4.12.4, do not invoke an error handler if we get an
 
47
       invalid fortran handle.  If we get an invalid fortran handle,
 
48
       return an invalid C handle. */
 
49
    
 
50
    if (op_index < 0 || 
 
51
        op_index >= 
 
52
        ompi_pointer_array_get_size(ompi_op_f_to_c_table)) {
 
53
        return NULL;
 
54
    }
 
55
 
 
56
    return ompi_pointer_array_get_item(ompi_op_f_to_c_table, op_index);
 
57
}