2004-01-26 01:07:54 +03:00
|
|
|
/*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "lam_config.h"
|
|
|
|
|
|
|
|
#include "mpi.h"
|
|
|
|
#include "mpi/interface/c/bindings.h"
|
2004-02-11 01:15:55 +03:00
|
|
|
#include "lam/lfc/lam_list.h"
|
2004-02-02 01:28:20 +03:00
|
|
|
#include "mpi/info/info.h"
|
2004-02-04 01:34:01 +03:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2004-01-26 01:07:54 +03:00
|
|
|
|
|
|
|
#if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES
|
|
|
|
#pragma weak MPI_Info_get_valuelen = PMPI_Info_get_valuelen
|
|
|
|
#endif
|
|
|
|
|
2004-02-02 01:28:20 +03:00
|
|
|
/**
|
|
|
|
* MPI_Info_get_valuelen - Get the length of a value for a given key in an 'M
|
|
|
|
*
|
|
|
|
* @param info - info object (handle)
|
|
|
|
* @param key - null-terminated character string of the index key
|
|
|
|
* @param valuelen - length of the value associated with 'key' (integer)
|
|
|
|
* @param flag - true (1) if 'key' defined on 'info', false (0) if not
|
|
|
|
* (logical)
|
|
|
|
*
|
|
|
|
* @retval MPI_SUCCESS
|
|
|
|
* @retval MPI_ERR_ARG
|
|
|
|
* @retval MPI_ERR_INFO_KEY
|
|
|
|
*
|
|
|
|
* The length returned in C and C++ does not include the end-of-string
|
2004-02-04 01:34:01 +03:00
|
|
|
* character. If the 'key' is not found on 'info', 'valuelen' is left
|
|
|
|
* alone.
|
2004-02-02 01:28:20 +03:00
|
|
|
*/
|
2004-01-26 01:07:54 +03:00
|
|
|
int MPI_Info_get_valuelen(MPI_Info info, char *key, int *valuelen,
|
|
|
|
int *flag) {
|
2004-02-04 01:34:01 +03:00
|
|
|
|
|
|
|
lam_info_entry_t *search;
|
|
|
|
int key_length;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Simple function. All we need to do is search for the value
|
|
|
|
* having the "key" associated with it and return the length
|
|
|
|
*/
|
|
|
|
if (NULL == info){
|
|
|
|
printf ("Invalid MPI_Info handle passed\n");
|
|
|
|
return MPI_ERR_ARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
key_length = (key) ? strlen (key) : 0;
|
|
|
|
if ( (0 == key_length) || (MPI_MAX_INFO_KEY <= key_length)) {
|
|
|
|
printf ("The key passed to MPI_INFO_SET is too long\n");
|
|
|
|
return MPI_ERR_INFO_KEY;
|
|
|
|
}
|
|
|
|
|
|
|
|
search = lam_info_find_key (info, key);
|
|
|
|
|
|
|
|
if (NULL == search){
|
|
|
|
*flag = 0;
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* We have found the element, so we can return the value
|
|
|
|
* Set the flag, value_length and value
|
|
|
|
*/
|
|
|
|
*flag = 1;
|
|
|
|
*valuelen = strlen(search->ie_value);
|
|
|
|
}
|
2004-01-26 01:07:54 +03:00
|
|
|
return MPI_SUCCESS;
|
|
|
|
}
|