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

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

DEFINITIONS

This source file includes following definitions.
  1. MPI_Info_get_valuelen

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

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