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

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

DEFINITIONS

This source file includes following definitions.
  1. MPI_Info_get

   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 = PMPI_Info_get
  14 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
  15 #pragma _HP_SECONDARY_DEF PMPI_Info_get MPI_Info_get
  16 #elif defined(HAVE_PRAGMA_CRI_DUP)
  17 #pragma _CRI duplicate MPI_Info_get as PMPI_Info_get
  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 - Retrieves the value associated with a key
  28 
  29 Input Parameters:
  30 . info - info object (handle)
  31 . key - key (string)
  32 . valuelen - length of value argument (integer)
  33 
  34 Output Parameters:
  35 . value - value (string)
  36 . flag - true if key defined, false if not (boolean)
  37 
  38 .N fortran
  39 @*/
  40 int MPI_Info_get(MPI_Info info, char *key, int valuelen, char *value, int *flag)
  41 {
  42     MPI_Info curr;
  43 
  44     if ((info <= (MPI_Info) 0) || (info->cookie != MPIR_INFO_COOKIE)) {
  45         FPRINTF(stderr, "MPI_Info_get: Invalid info object\n");
  46         MPI_Abort(MPI_COMM_WORLD, 1);
  47     }
  48 
  49     if (key <= (char *) 0) {
  50         FPRINTF(stderr, "MPI_Info_get: key is an invalid address\n");
  51         MPI_Abort(MPI_COMM_WORLD, 1);
  52     }
  53 
  54     if (strlen(key) > MPI_MAX_INFO_KEY) {
  55         FPRINTF(stderr, "MPI_Info_get: key is longer than MPI_MAX_INFO_KEY\n");
  56         MPI_Abort(MPI_COMM_WORLD, 1);
  57     }
  58 
  59     if (!strlen(key)) {
  60         FPRINTF(stderr, "MPI_Info_get: key is a null string\n");
  61         MPI_Abort(MPI_COMM_WORLD, 1);
  62     }
  63 
  64     if (valuelen <= 0) {
  65         FPRINTF(stderr, "MPI_Info_get: Invalid valuelen argument\n");
  66         MPI_Abort(MPI_COMM_WORLD, 1);
  67     }
  68 
  69     if (value <= (char *) 0) {
  70         FPRINTF(stderr, "MPI_Info_get: value is an invalid address\n");
  71         MPI_Abort(MPI_COMM_WORLD, 1);
  72     }
  73 
  74     curr = info->next;
  75     *flag = 0;
  76 
  77     while (curr) {
  78         if (!strcmp(curr->key, key)) {
  79             ADIOI_Strncpy(value, curr->value, valuelen);
  80             value[valuelen] = '\0';
  81             *flag = 1;
  82             break;
  83         }
  84         curr = curr->next;
  85     }
  86 
  87     return MPI_SUCCESS;
  88 }

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