00001 /* -*- Mode: C; c-basic-offset:4 ; -*- */ 00002 /* 00003 * 00004 * Copyright (C) 1997 University of Chicago. 00005 * See COPYRIGHT notice in top-level directory. 00006 */ 00007 00008 #include "mpioimpl.h" 00009 00010 #ifdef HAVE_WEAK_SYMBOLS 00011 00012 #if defined(HAVE_PRAGMA_WEAK) 00013 #pragma weak MPI_Info_c2f = PMPI_Info_c2f 00014 #elif defined(HAVE_PRAGMA_HP_SEC_DEF) 00015 #pragma _HP_SECONDARY_DEF PMPI_Info_c2f MPI_Info_c2f 00016 #elif defined(HAVE_PRAGMA_CRI_DUP) 00017 #pragma _CRI duplicate MPI_Info_c2f as PMPI_Info_c2f 00018 /* end of weak pragmas */ 00019 #endif 00020 00021 /* Include mapping from MPI->PMPI */ 00022 #define MPIO_BUILD_PROFILING 00023 #include "mpioprof.h" 00024 #endif 00025 #include "adio_extern.h" 00026 00027 /*@ 00028 MPI_Info_c2f - Translates a C info handle to a Fortran info handle 00029 00030 Input Parameters: 00031 . info - C info handle (integer) 00032 00033 Return Value: 00034 Fortran info handle (handle) 00035 @*/ 00036 MPI_Fint MPI_Info_c2f(MPI_Info info) 00037 { 00038 #ifndef INT_LT_POINTER 00039 return (MPI_Fint) info; 00040 #else 00041 int i; 00042 00043 if ((info <= (MPI_Info) 0) || (info->cookie != MPIR_INFO_COOKIE)) 00044 return (MPI_Fint) 0; 00045 if (!MPIR_Infotable) { 00046 MPIR_Infotable_max = 1024; 00047 MPIR_Infotable = (MPI_Info *) 00048 ADIOI_Malloc(MPIR_Infotable_max*sizeof(MPI_Info)); 00049 MPIR_Infotable_ptr = 0; /* 0 can't be used though, because 00050 MPI_INFO_NULL=0 */ 00051 for (i=0; i<MPIR_Infotable_max; i++) MPIR_Infotable[i] = MPI_INFO_NULL; 00052 } 00053 if (MPIR_Infotable_ptr == MPIR_Infotable_max-1) { 00054 MPIR_Infotable = (MPI_Info *) ADIOI_Realloc(MPIR_Infotable, 00055 (MPIR_Infotable_max+1024)*sizeof(MPI_Info)); 00056 for (i=MPIR_Infotable_max; i<MPIR_Infotable_max+1024; i++) 00057 MPIR_Infotable[i] = MPI_INFO_NULL; 00058 MPIR_Infotable_max += 1024; 00059 } 00060 MPIR_Infotable_ptr++; 00061 MPIR_Infotable[MPIR_Infotable_ptr] = info; 00062 return (MPI_Fint) MPIR_Infotable_ptr; 00063 #endif 00064 }