root/ompi/mca/io/romio321/romio/mpi-io/fortran/openf.c

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

DEFINITIONS

This source file includes following definitions.
  1. mpi_file_open_
  2. mpi_file_open_
  3. mpi_file_open_

   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 #ifdef _UNICOS
   9 #include <fortran.h>
  10 #endif
  11 #include "adio.h"
  12 #include "mpio.h"
  13 
  14 
  15 #if defined(MPIO_BUILD_PROFILING) || defined(HAVE_WEAK_SYMBOLS)
  16 
  17 #if defined(HAVE_WEAK_SYMBOLS)
  18 #if defined(HAVE_PRAGMA_WEAK)
  19 #if defined(FORTRANCAPS)
  20 extern FORTRAN_API void FORT_CALL MPI_FILE_OPEN( MPI_Fint *, char * FORT_MIXED_LEN_DECL, MPI_Fint *, MPI_Fint *, MPI_File*, MPI_Fint * FORT_END_LEN_DECL );
  21 #pragma weak MPI_FILE_OPEN = PMPI_FILE_OPEN
  22 #elif defined(FORTRANDOUBLEUNDERSCORE)
  23 extern FORTRAN_API void FORT_CALL mpi_file_open__( MPI_Fint *, char * FORT_MIXED_LEN_DECL, MPI_Fint *, MPI_Fint *, MPI_File*, MPI_Fint * FORT_END_LEN_DECL );
  24 #pragma weak mpi_file_open__ = pmpi_file_open__
  25 #elif !defined(FORTRANUNDERSCORE)
  26 extern FORTRAN_API void FORT_CALL mpi_file_open( MPI_Fint *, char * FORT_MIXED_LEN_DECL, MPI_Fint *, MPI_Fint *, MPI_File*, MPI_Fint * FORT_END_LEN_DECL );
  27 #pragma weak mpi_file_open = pmpi_file_open
  28 #else
  29 extern FORTRAN_API void FORT_CALL mpi_file_open_( MPI_Fint *, char * FORT_MIXED_LEN_DECL, MPI_Fint *, MPI_Fint *, MPI_File*, MPI_Fint * FORT_END_LEN_DECL );
  30 #pragma weak mpi_file_open_ = pmpi_file_open_
  31 #endif
  32 
  33 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
  34 #if defined(FORTRANCAPS)
  35 #pragma _HP_SECONDARY_DEF PMPI_FILE_OPEN MPI_FILE_OPEN
  36 #elif defined(FORTRANDOUBLEUNDERSCORE)
  37 #pragma _HP_SECONDARY_DEF pmpi_file_open__ mpi_file_open__
  38 #elif !defined(FORTRANUNDERSCORE)
  39 #pragma _HP_SECONDARY_DEF pmpi_file_open mpi_file_open
  40 #else
  41 #pragma _HP_SECONDARY_DEF pmpi_file_open_ mpi_file_open_
  42 #endif
  43 
  44 #elif defined(HAVE_PRAGMA_CRI_DUP)
  45 #if defined(FORTRANCAPS)
  46 #pragma _CRI duplicate MPI_FILE_OPEN as PMPI_FILE_OPEN
  47 #elif defined(FORTRANDOUBLEUNDERSCORE)
  48 #pragma _CRI duplicate mpi_file_open__ as pmpi_file_open__
  49 #elif !defined(FORTRANUNDERSCORE)
  50 #pragma _CRI duplicate mpi_file_open as pmpi_file_open
  51 #else
  52 #pragma _CRI duplicate mpi_file_open_ as pmpi_file_open_
  53 #endif
  54 
  55 /* end of weak pragmas */
  56 #endif
  57 /* Include mapping from MPI->PMPI */
  58 #include "mpioprof.h"
  59 #endif
  60 
  61 #ifdef FORTRANCAPS
  62 #define mpi_file_open_ PMPI_FILE_OPEN
  63 #elif defined(FORTRANDOUBLEUNDERSCORE)
  64 #define mpi_file_open_ pmpi_file_open__
  65 #elif !defined(FORTRANUNDERSCORE)
  66 #if defined(HPUX) || defined(SPPUX)
  67 #pragma _HP_SECONDARY_DEF pmpi_file_open pmpi_file_open_
  68 #endif
  69 #define mpi_file_open_ pmpi_file_open
  70 #else
  71 #if defined(HPUX) || defined(SPPUX)
  72 #pragma _HP_SECONDARY_DEF pmpi_file_open_ pmpi_file_open
  73 #endif
  74 #define mpi_file_open_ pmpi_file_open_
  75 #endif
  76 
  77 #else
  78 
  79 #ifdef FORTRANCAPS
  80 #define mpi_file_open_ MPI_FILE_OPEN
  81 #elif defined(FORTRANDOUBLEUNDERSCORE)
  82 #define mpi_file_open_ mpi_file_open__
  83 #elif !defined(FORTRANUNDERSCORE)
  84 #if defined(HPUX) || defined(SPPUX)
  85 #pragma _HP_SECONDARY_DEF mpi_file_open mpi_file_open_
  86 #endif
  87 #define mpi_file_open_ mpi_file_open
  88 #else
  89 #if defined(HPUX) || defined(SPPUX)
  90 #pragma _HP_SECONDARY_DEF mpi_file_open_ mpi_file_open
  91 #endif
  92 #endif
  93 #endif
  94 
  95 #if defined(MPIHP) || defined(MPILAM)
  96 /* Prototype to keep compiler happy */
  97 void mpi_file_open_(MPI_Fint *comm,char *filename,MPI_Fint *amode,
  98                     MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr, int str_len );
  99 
 100 void mpi_file_open_(MPI_Fint *comm,char *filename,MPI_Fint *amode,
 101                   MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr, int str_len )
 102 {
 103     char *newfname;
 104     MPI_File fh_c;
 105     int real_len, i;
 106     MPI_Comm comm_c;
 107     MPI_Info info_c;
 108 
 109     comm_c = MPI_Comm_f2c(*comm);
 110     info_c = MPI_Info_f2c(*info);
 111 
 112     /* strip trailing blanks */
 113     if (filename <= (char *) 0) {
 114         FPRINTF(stderr, "MPI_File_open: filename is an invalid address\n");
 115         MPI_Abort(MPI_COMM_WORLD, 1);
 116     }
 117     for (i=str_len-1; i>=0; i--) if (filename[i] != ' ') break;
 118     if (i < 0) {
 119         FPRINTF(stderr, "MPI_File_open: filename is a blank string\n");
 120         MPI_Abort(MPI_COMM_WORLD, 1);
 121     }
 122     real_len = i + 1;
 123 
 124     newfname = (char *) ADIOI_Malloc((real_len+1)*sizeof(char));
 125     ADIOI_Strncpy(newfname, filename, real_len);
 126     newfname[real_len] = '\0';
 127 
 128     *ierr = MPI_File_open(comm_c, newfname, *amode, info_c, &fh_c);
 129 
 130     *fh = MPI_File_c2f(fh_c);
 131     ADIOI_Free(newfname);
 132 }
 133 
 134 #else
 135 
 136 #ifdef _UNICOS
 137 void mpi_file_open_(MPI_Fint *comm,_fcd filename_fcd,MPI_Fint *amode,
 138                   MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr)
 139 {
 140     char *filename = _fcdtocp(filename_fcd);
 141     int str_len = _fcdlen(filename_fcd);
 142 #else
 143 /* Prototype to keep compiler happy */
 144 /*
 145 FORTRAN_API void FORT_CALL mpi_file_open_(MPI_Comm *comm,char *filename,MPI_Fint *amode,
 146                     MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr, int str_len );
 147 
 148 FORTRAN_API void FORT_CALL mpi_file_open_(MPI_Comm *comm,char *filename,MPI_Fint *amode,
 149                   MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr, int str_len )
 150 */
 151 /* Prototype to keep compiler happy */
 152 FORTRAN_API void FORT_CALL mpi_file_open_(MPI_Fint *comm,char *filename FORT_MIXED_LEN_DECL,MPI_Fint *amode,
 153                     MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr FORT_END_LEN_DECL);
 154 
 155 FORTRAN_API void FORT_CALL mpi_file_open_(MPI_Fint *comm,char *filename FORT_MIXED_LEN(str_len),MPI_Fint *amode,
 156                   MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr FORT_END_LEN(str_len))
 157 {
 158 #endif
 159     char *newfname;
 160     MPI_File fh_c;
 161     int real_len, i;
 162     MPI_Info info_c;
 163 
 164     info_c = MPI_Info_f2c(*info);
 165 
 166     /* strip trailing blanks */
 167     if (filename <= (char *) 0) {
 168         FPRINTF(stderr, "MPI_File_open: filename is an invalid address\n");
 169         MPI_Abort(MPI_COMM_WORLD, 1);
 170     }
 171     for (i=str_len-1; i>=0; i--) if (filename[i] != ' ') break;
 172     if (i < 0) {
 173         FPRINTF(stderr, "MPI_File_open: filename is a blank string\n");
 174         MPI_Abort(MPI_COMM_WORLD, 1);
 175     }
 176     real_len = i + 1;
 177 
 178     newfname = (char *) ADIOI_Malloc((real_len+1)*sizeof(char));
 179     ADIOI_Strncpy(newfname, filename, real_len);
 180     newfname[real_len] = '\0';
 181 
 182     *ierr = MPI_File_open((MPI_Comm)(*comm), newfname, *amode, info_c, &fh_c);
 183 
 184     *fh = MPI_File_c2f(fh_c);
 185     ADIOI_Free(newfname);
 186 }
 187 #endif

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