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

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

DEFINITIONS

This source file includes following definitions.
  1. MPI_Info_c2f

   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_c2f = PMPI_Info_c2f
  14 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
  15 #pragma _HP_SECONDARY_DEF PMPI_Info_c2f MPI_Info_c2f
  16 #elif defined(HAVE_PRAGMA_CRI_DUP)
  17 #pragma _CRI duplicate MPI_Info_c2f as PMPI_Info_c2f
  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 #include "adio_extern.h"
  26 
  27 /*@
  28     MPI_Info_c2f - Translates a C info handle to a Fortran info handle
  29 
  30 Input Parameters:
  31 . info - C info handle (integer)
  32 
  33 Return Value:
  34   Fortran info handle (handle)
  35 @*/
  36 MPI_Fint MPI_Info_c2f(MPI_Info info)
  37 {
  38 #ifndef INT_LT_POINTER
  39     return (MPI_Fint) info;
  40 #else
  41     int i;
  42 
  43     if ((info <= (MPI_Info) 0) || (info->cookie != MPIR_INFO_COOKIE)) 
  44         return (MPI_Fint) 0;
  45     if (!MPIR_Infotable) {
  46         MPIR_Infotable_max = 1024;
  47         MPIR_Infotable = (MPI_Info *)
  48             ADIOI_Malloc(MPIR_Infotable_max*sizeof(MPI_Info)); 
  49         MPIR_Infotable_ptr = 0;  /* 0 can't be used though, because 
  50                                   MPI_INFO_NULL=0 */
  51         for (i=0; i<MPIR_Infotable_max; i++) MPIR_Infotable[i] = MPI_INFO_NULL;
  52     }
  53     if (MPIR_Infotable_ptr == MPIR_Infotable_max-1) {
  54         MPIR_Infotable = (MPI_Info *) ADIOI_Realloc(MPIR_Infotable, 
  55                            (MPIR_Infotable_max+1024)*sizeof(MPI_Info));
  56         for (i=MPIR_Infotable_max; i<MPIR_Infotable_max+1024; i++) 
  57             MPIR_Infotable[i] = MPI_INFO_NULL;
  58         MPIR_Infotable_max += 1024;
  59     }
  60     MPIR_Infotable_ptr++;
  61     MPIR_Infotable[MPIR_Infotable_ptr] = info;
  62     return (MPI_Fint) MPIR_Infotable_ptr;
  63 #endif
  64 }

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