root/ompi/mca/io/romio321/romio/mpi2-other/info/info_getnth.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. MPI_Info_get_nthkey

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
   2 /* 
   3  *
   4  *   Copyright (C) 1997 University of Chicago. 
   5  *   See COPYRIGHT notice in top-level directory.
   6  */
   7 
   8 #include "mpioimpl.h"
   9 
  10 #ifdef HAVE_WEAK_SYMBOLS
  11 
  12 #if defined(HAVE_PRAGMA_WEAK)
  13 #pragma weak MPI_Info_get_nthkey = PMPI_Info_get_nthkey
  14 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
  15 #pragma _HP_SECONDARY_DEF PMPI_Info_get_nthkey MPI_Info_get_nthkey
  16 #elif defined(HAVE_PRAGMA_CRI_DUP)
  17 #pragma _CRI duplicate MPI_Info_get_nthkey as PMPI_Info_get_nthkey
  18 /* end of weak pragmas */
  19 #endif
  20 
  21 /* Include mapping from MPI->PMPI */
  22 #define MPIO_BUILD_PROFILING
  23 #include "mpioprof.h"
  24 #endif
  25 
  26 /*@
  27     MPI_Info_get_nthkey - Returns the nth defined key in info
  28 
  29 Input Parameters:
  30 . info - info object (handle)
  31 . n - key number (integer)
  32 
  33 Output Parameters:
  34 . keys - key (string)
  35 
  36 .N fortran
  37 @*/
  38 int MPI_Info_get_nthkey(MPI_Info info, int n, char *key)
  39 {
  40     MPI_Info curr;
  41     int nkeys, i;
  42 
  43     if ((info <= (MPI_Info) 0) || (info->cookie != MPIR_INFO_COOKIE)) {
  44         FPRINTF(stderr, "MPI_Info_get_nthkey: Invalid info object\n");
  45         MPI_Abort(MPI_COMM_WORLD, 1);
  46     }
  47 
  48     if (key <= (char *) 0) {
  49         FPRINTF(stderr, "MPI_Info_get: key is an invalid address\n");
  50         MPI_Abort(MPI_COMM_WORLD, 1);
  51     }
  52 
  53     curr = info->next;
  54     nkeys = 0;
  55     while (curr) {
  56         curr = curr->next;
  57         nkeys++;
  58     }
  59 
  60     if ((n < 0) || (n >= nkeys)) {
  61         FPRINTF(stderr, "MPI_Info_get_nthkey: n is an invalid number\n");
  62         MPI_Abort(MPI_COMM_WORLD, 1);
  63     }
  64 
  65     curr = info->next;
  66     i = 0;
  67     while (i < n) {
  68         curr = curr->next;
  69         i++;
  70     }
  71     ADIOI_Strncpy(key, curr->key, MPI_MAX_INFO_KEY);
  72 
  73     return MPI_SUCCESS;
  74 }

/* [<][>][^][v][top][bottom][index][help] */