00001
00002
00003
00004
00005
00006
00007
00008 #include "mpioimpl.h"
00009
00010 #ifdef HAVE_WEAK_SYMBOLS
00011
00012 #if defined(HAVE_PRAGMA_WEAK)
00013 #pragma weak MPI_Info_get_nthkey = PMPI_Info_get_nthkey
00014 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
00015 #pragma _HP_SECONDARY_DEF PMPI_Info_get_nthkey MPI_Info_get_nthkey
00016 #elif defined(HAVE_PRAGMA_CRI_DUP)
00017 #pragma _CRI duplicate MPI_Info_get_nthkey as PMPI_Info_get_nthkey
00018
00019 #endif
00020
00021
00022 #define MPIO_BUILD_PROFILING
00023 #include "mpioprof.h"
00024 #endif
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 int MPI_Info_get_nthkey(MPI_Info info, int n, char *key)
00039 {
00040 MPI_Info curr;
00041 int nkeys, i;
00042
00043 if ((info <= (MPI_Info) 0) || (info->cookie != MPIR_INFO_COOKIE)) {
00044 FPRINTF(stderr, "MPI_Info_get_nthkey: Invalid info object\n");
00045 MPI_Abort(MPI_COMM_WORLD, 1);
00046 }
00047
00048 if (key <= (char *) 0) {
00049 FPRINTF(stderr, "MPI_Info_get: key is an invalid address\n");
00050 MPI_Abort(MPI_COMM_WORLD, 1);
00051 }
00052
00053 curr = info->next;
00054 nkeys = 0;
00055 while (curr) {
00056 curr = curr->next;
00057 nkeys++;
00058 }
00059
00060 if ((n < 0) || (n >= nkeys)) {
00061 FPRINTF(stderr, "MPI_Info_get_nthkey: n is an invalid number\n");
00062 MPI_Abort(MPI_COMM_WORLD, 1);
00063 }
00064
00065 curr = info->next;
00066 i = 0;
00067 while (i < n) {
00068 curr = curr->next;
00069 i++;
00070 }
00071 ADIOI_Strncpy(key, curr->key, MPI_MAX_INFO_KEY);
00072
00073 return MPI_SUCCESS;
00074 }