~ubuntu-branches/ubuntu/vivid/mpich/vivid-proposed

« back to all changes in this revision

Viewing changes to src/mpi_t/enum_get_info.c

  • Committer: Package Import Robot
  • Author(s): Anton Gladky
  • Date: 2014-04-01 20:24:20 UTC
  • mfrom: (5.2.4 sid)
  • Revision ID: package-import@ubuntu.com-20140401202420-t5ey1ia2klt5dkq3
Tags: 3.1-4
* [c3e3398] Disable test_primitives, which is unreliable on some platforms.
            (Closes: #743047)
* [265a699] Add minimal autotest.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#ifndef MPICH_MPI_FROM_PMPI
22
22
#undef MPI_T_enum_get_info
23
23
#define MPI_T_enum_get_info PMPI_T_enum_get_info
24
 
 
25
 
/* any non-MPI functions go here, especially non-static ones */
26
 
 
27
 
#undef FUNCNAME
28
 
#define FUNCNAME MPIR_T_enum_get_info_impl
29
 
#undef FCNAME
30
 
#define FCNAME MPIU_QUOTE(FUNCNAME)
31
 
int MPIR_T_enum_get_info_impl(MPI_T_enum enumtype, int *num, char *name, int *name_len)
32
 
{
33
 
    int mpi_errno = MPI_SUCCESS;
34
 
 
35
 
    /* TODO implement this function */
36
 
 
37
 
fn_exit:
38
 
    return mpi_errno;
39
 
fn_fail:
40
 
    goto fn_exit;
41
 
}
42
 
 
43
24
#endif /* MPICH_MPI_FROM_PMPI */
44
25
 
45
26
#undef FUNCNAME
47
28
#undef FCNAME
48
29
#define FCNAME MPIU_QUOTE(FUNCNAME)
49
30
/*@
50
 
MPI_T_enum_get_info - XXX description here
 
31
MPI_T_enum_get_info - Get the information about an enumeration
51
32
 
52
33
Input/Output Parameters:
53
34
. name_len - length of the string and/or buffer for name (integer)
61
42
 
62
43
.N ThreadSafe
63
44
 
64
 
.N Fortran
65
 
 
66
45
.N Errors
 
46
.N MPI_SUCCESS
 
47
.N MPI_T_ERR_NOT_INITIALIZED
 
48
.N MPI_T_ERR_INVALID_HANDLE
67
49
@*/
68
50
int MPI_T_enum_get_info(MPI_T_enum enumtype, int *num, char *name, int *name_len)
69
51
{
70
52
    int mpi_errno = MPI_SUCCESS;
 
53
 
71
54
    MPID_MPI_STATE_DECL(MPID_STATE_MPI_T_ENUM_GET_INFO);
72
 
 
73
 
    MPIU_THREAD_CS_ENTER(ALLFUNC,);
 
55
    MPIR_ERRTEST_MPIT_INITIALIZED(mpi_errno);
 
56
    MPIR_T_THREAD_CS_ENTER();
74
57
    MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_T_ENUM_GET_INFO);
75
58
 
76
 
    /* Validate parameters, especially handles needing to be converted */
77
 
#   ifdef HAVE_ERROR_CHECKING
78
 
    {
79
 
        MPID_BEGIN_ERROR_CHECKS
80
 
        {
81
 
 
82
 
            /* TODO more checks may be appropriate */
83
 
            if (mpi_errno != MPI_SUCCESS) goto fn_fail;
84
 
        }
85
 
        MPID_END_ERROR_CHECKS
86
 
    }
87
 
#   endif /* HAVE_ERROR_CHECKING */
88
 
 
89
 
    /* Convert MPI object handles to object pointers */
90
 
 
91
 
    /* Validate parameters and objects (post conversion) */
92
 
#   ifdef HAVE_ERROR_CHECKING
93
 
    {
94
 
        MPID_BEGIN_ERROR_CHECKS
95
 
        {
 
59
    /* Validate parameters */
 
60
#   ifdef HAVE_ERROR_CHECKING
 
61
    {
 
62
        MPID_BEGIN_ERROR_CHECKS
 
63
        {
 
64
            MPIR_ERRTEST_ENUM_HANDLE(enumtype, mpi_errno);
96
65
            MPIR_ERRTEST_ARGNULL(num, "num", mpi_errno);
97
 
            /* TODO more checks may be appropriate (counts, in_place, buffer aliasing, etc) */
98
 
            if (mpi_errno != MPI_SUCCESS) goto fn_fail;
 
66
            /* Do not do _TEST_ARGNULL for name or name_len, since this is
 
67
             * permitted per MPI_T standard.
 
68
             */
99
69
        }
100
70
        MPID_END_ERROR_CHECKS
101
71
    }
103
73
 
104
74
    /* ... body of routine ...  */
105
75
 
106
 
    mpi_errno = MPIR_T_enum_get_info_impl(enumtype, num, name, name_len);
107
 
    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
 
76
    *num = utarray_len(enumtype->items);
 
77
    MPIR_T_strncpy(name, enumtype->name, name_len);
108
78
 
109
79
    /* ... end of body of routine ... */
110
80
 
111
81
fn_exit:
112
82
    MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_T_ENUM_GET_INFO);
113
 
    MPIU_THREAD_CS_EXIT(ALLFUNC,);
 
83
    MPIR_T_THREAD_CS_EXIT();
114
84
    return mpi_errno;
115
85
 
116
86
fn_fail:
119
89
    {
120
90
        mpi_errno = MPIR_Err_create_code(
121
91
            mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER,
122
 
            "**mpi_t_enum_get_info", "**mpi_t_enum_get_info %p %p %p %p", enumtype, num, name, name_len);
 
92
            "**mpi_t_enum_get_info", "**mpi_t_enum_get_info %p %p %p %p",
 
93
            enumtype, num, name, name_len);
123
94
    }
124
95
#   endif
125
96
    mpi_errno = MPIR_Err_return_comm(NULL, FCNAME, mpi_errno);