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