00001
00002
00003
00004
00005
00006
00007
00008 #include "mpio.h"
00009 #include "adio.h"
00010
00011
00012 #if defined(MPIO_BUILD_PROFILING) || defined(HAVE_WEAK_SYMBOLS)
00013 #ifdef FORTRANCAPS
00014 #define mpi_info_get_ PMPI_INFO_GET
00015 #elif defined(FORTRANDOUBLEUNDERSCORE)
00016 #define mpi_info_get_ pmpi_info_get__
00017 #elif !defined(FORTRANUNDERSCORE)
00018 #if defined(HPUX) || defined(SPPUX)
00019 #pragma _HP_SECONDARY_DEF pmpi_info_get pmpi_info_get_
00020 #endif
00021 #define mpi_info_get_ pmpi_info_get
00022 #else
00023 #if defined(HPUX) || defined(SPPUX)
00024 #pragma _HP_SECONDARY_DEF pmpi_info_get_ pmpi_info_get
00025 #endif
00026 #define mpi_info_get_ pmpi_info_get_
00027 #endif
00028
00029 #if defined(HAVE_WEAK_SYMBOLS)
00030 #if defined(HAVE_PRAGMA_WEAK)
00031 #if defined(FORTRANCAPS)
00032 #pragma weak MPI_INFO_GET = PMPI_INFO_GET
00033 #elif defined(FORTRANDOUBLEUNDERSCORE)
00034 #pragma weak mpi_info_get__ = pmpi_info_get__
00035 #elif !defined(FORTRANUNDERSCORE)
00036 #pragma weak mpi_info_get = pmpi_info_get
00037 #else
00038 #pragma weak mpi_info_get_ = pmpi_info_get_
00039 #endif
00040
00041 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
00042 #if defined(FORTRANCAPS)
00043 #pragma _HP_SECONDARY_DEF PMPI_INFO_GET MPI_INFO_GET
00044 #elif defined(FORTRANDOUBLEUNDERSCORE)
00045 #pragma _HP_SECONDARY_DEF pmpi_info_get__ mpi_info_get__
00046 #elif !defined(FORTRANUNDERSCORE)
00047 #pragma _HP_SECONDARY_DEF pmpi_info_get mpi_info_get
00048 #else
00049 #pragma _HP_SECONDARY_DEF pmpi_info_get_ mpi_info_get_
00050 #endif
00051
00052 #elif defined(HAVE_PRAGMA_CRI_DUP)
00053 #if defined(FORTRANCAPS)
00054 #pragma _CRI duplicate MPI_INFO_GET as PMPI_INFO_GET
00055 #elif defined(FORTRANDOUBLEUNDERSCORE)
00056 #pragma _CRI duplicate mpi_info_get__ as pmpi_info_get__
00057 #elif !defined(FORTRANUNDERSCORE)
00058 #pragma _CRI duplicate mpi_info_get as pmpi_info_get
00059 #else
00060 #pragma _CRI duplicate mpi_info_get_ as pmpi_info_get_
00061 #endif
00062
00063
00064 #endif
00065
00066 #include "mpioprof.h"
00067 #endif
00068
00069 #else
00070
00071 #ifdef FORTRANCAPS
00072 #define mpi_info_get_ MPI_INFO_GET
00073 #elif defined(FORTRANDOUBLEUNDERSCORE)
00074 #define mpi_info_get_ mpi_info_get__
00075 #elif !defined(FORTRANUNDERSCORE)
00076 #if defined(HPUX) || defined(SPPUX)
00077 #pragma _HP_SECONDARY_DEF mpi_info_get mpi_info_get_
00078 #endif
00079 #define mpi_info_get_ mpi_info_get
00080 #else
00081 #if defined(HPUX) || defined(SPPUX)
00082 #pragma _HP_SECONDARY_DEF mpi_info_get_ mpi_info_get
00083 #endif
00084 #endif
00085 #endif
00086
00087 void mpi_info_get_(MPI_Fint *info, char *key, int *valuelen, char *value,
00088 int *flag, int *ierr, int keylen, int valspace)
00089 {
00090 MPI_Info info_c;
00091 char *newkey, *tmpvalue;
00092 int new_keylen, lead_blanks, i, tmpvaluelen;
00093
00094 if (key <= (char *) 0) {
00095 FPRINTF(stderr, "MPI_Info_get: key is an invalid address\n");
00096 MPI_Abort(MPI_COMM_WORLD, 1);
00097 }
00098
00099
00100 lead_blanks = 0;
00101 for (i=0; i<keylen; i++)
00102 if (key[i] == ' ') lead_blanks++;
00103 else break;
00104
00105 for (i=keylen-1; i>=0; i--) if (key[i] != ' ') break;
00106 if (i < 0) {
00107 FPRINTF(stderr, "MPI_Info_get: key is a blank string\n");
00108 MPI_Abort(MPI_COMM_WORLD, 1);
00109 }
00110 new_keylen = i + 1 - lead_blanks;
00111 key += lead_blanks;
00112
00113 newkey = (char *) ADIOI_Malloc((new_keylen+1)*sizeof(char));
00114 ADIOI_Strncpy(newkey, key, new_keylen);
00115 newkey[new_keylen] = '\0';
00116
00117 if (value <= (char *) 0) {
00118 FPRINTF(stderr, "MPI_Info_get: value is an invalid address\n");
00119 MPI_Abort(MPI_COMM_WORLD, 1);
00120 }
00121 if (*valuelen <= 0) {
00122 FPRINTF(stderr, "MPI_Info_get: Invalid valuelen argument\n");
00123 MPI_Abort(MPI_COMM_WORLD, 1);
00124 }
00125 if (*valuelen > valspace) {
00126 FPRINTF(stderr, "MPI_Info_get: valuelen is greater than the amount of memory available in value\n");
00127 MPI_Abort(MPI_COMM_WORLD, 1);
00128 }
00129
00130 tmpvalue = (char *) ADIOI_Malloc((*valuelen + 1)*sizeof(char));
00131
00132 info_c = MPI_Info_f2c(*info);
00133 *ierr = MPI_Info_get(info_c, newkey, *valuelen, tmpvalue, flag);
00134
00135 if (*flag) {
00136 tmpvaluelen = strlen(tmpvalue);
00137 ADIOI_Strncpy(value, tmpvalue, tmpvaluelen);
00138
00139 for (i=tmpvaluelen; i<valspace; i++) value[i] = ' ';
00140 }
00141
00142 ADIOI_Free(newkey);
00143 ADIOI_Free(tmpvalue);
00144 }