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