-: 0:Source:/home/MPI/testing/mpich2/mpich2/src/mpi/romio/mpi-io/register_datarep.c
-: 0:Graph:register_datarep.gcno
-: 0:Data:register_datarep.gcda
-: 0:Runs:509
-: 0:Programs:136
-: 1:/* -*- Mode: C; c-basic-offset:4 ; -*- */
-: 2:/*
-: 3: * Copyright (C) 1997 University of Chicago.
-: 4: * See COPYRIGHT notice in top-level directory.
-: 5: */
-: 6:
-: 7:#include "mpioimpl.h"
-: 8:#include "adio_extern.h"
-: 9:
-: 10:#ifdef HAVE_WEAK_SYMBOLS
-: 11:
-: 12:#if defined(HAVE_PRAGMA_WEAK)
-: 13:#pragma weak MPI_Register_datarep = PMPI_Register_datarep
-: 14:#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
-: 15:#pragma _HP_SECONDARY_DEF PMPI_Register_datarep MPI_Register_datarep
-: 16:#elif defined(HAVE_PRAGMA_CRI_DUP)
-: 17:#pragma _CRI duplicate MPI_Register_datarep as PMPI_Register_datarep
-: 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:
-: 26:/*@
-: 27: MPI_Register_datarep - Register functions for user-defined data
-: 28: representations
-: 29:
-: 30: Input Parameters:
-: 31:+ name - data representation name (string)
-: 32:. read_conv_fn - function invoked to convert from file representation to
-: 33: native representation (function)
-: 34:. write_conv_fn - function invoked to convert from native representation to
-: 35: file representation (function)
-: 36:. extent_fn - function invoked to get the exted of a datatype as represented
-: 37: in the file (function)
-: 38:- extra_state - pointer to extra state that is passed to each of the
-: 39: three functions
-: 40:
-: 41: Notes:
-: 42: This function allows the user to provide routines to convert data from
-: 43: an external representation, used within a file, and the native representation,
-: 44: used within the CPU. There is one predefined data representation,
-: 45: 'external32'. Please consult the MPI-2 standard for details on this
-: 46: function.
-: 47:
-: 48:.N fortran
-: 49:
-: 50: @*/
-: 51:int MPI_Register_datarep(char *name,
-: 52: MPI_Datarep_conversion_function *read_conv_fn,
-: 53: MPI_Datarep_conversion_function *write_conv_fn,
-: 54: MPI_Datarep_extent_function *extent_fn,
-: 55: void *state)
|
-: 64: /* --BEGIN ERROR HANDLING-- */
-: 65: /* check datarep name (use strlen instead of strnlen because
-: 66: strnlen is not portable) */
#####: 67: if (name == NULL ||
-: 68: strlen(name) < 1 ||
-: 69: strlen(name) > MPI_MAX_DATAREP_STRING)
-: 70: {
#####: 71: error_code = MPIO_Err_create_code(MPI_SUCCESS,
-: 72: MPIR_ERR_RECOVERABLE,
-: 73: myname, __LINE__,
-: 74: MPI_ERR_ARG,
-: 75: "**datarepname", 0);
#####: 76: error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code);
#####: 77: goto fn_exit;
-: 78: }
-: 79: /* --END ERROR HANDLING-- */
-: 80:
|
-: 84: /* --BEGIN ERROR HANDLING-- */
-: 85: /* check datarep isn't already registered */
#####: 86: for (datarep = ADIOI_Datarep_head; datarep; datarep = datarep->next) {
#####: 87: if (!strncmp(name, datarep->name, MPI_MAX_DATAREP_STRING)) {
#####: 88: error_code = MPIO_Err_create_code(MPI_SUCCESS,
-: 89: MPIR_ERR_RECOVERABLE,
-: 90: myname, __LINE__,
-: 91: MPI_ERR_DUP_DATAREP,
-: 92: "**datarepused",
-: 93: "**datarepused %s",
-: 94: name);
#####: 95: error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code);
#####: 96: goto fn_exit;
-: 97: }
-: 98: }
-: 99:
-: 100: /* check extent function pointer */
#####: 101: if (extent_fn == NULL)
-: 102: {
#####: 103: error_code = MPIO_Err_create_code(MPI_SUCCESS,
-: 104: MPIR_ERR_RECOVERABLE,
-: 105: myname, __LINE__,
-: 106: MPI_ERR_ARG,
-: 107: "**datarepextent", 0);
#####: 108: error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code);
#####: 109: goto fn_exit;
-: 110: }
-: 111: /* --END ERROR HANDLING-- */
-: 112:
|
#####: 113: datarep = ADIOI_Malloc(sizeof(ADIOI_Datarep));
-: 114:/* need to ifdef MPICH2 because if it is MPICH2 in memory tracing mode, it will complain
-: 115: about the use of strdup instead of MPIU_Strdup. (mpiimpl.h is being included in mpioimpl.h
-: 116: ifdef MPICH2 */
-: 117:#ifdef MPICH2
#####: 118: datarep->name = MPIU_Strdup(name);
-: 119:#else
-: 120: datarep->name = ADIOI_Strdup(name);
-: 121:#endif
#####: 122: datarep->state = state;
#####: 123: datarep->read_conv_fn = read_conv_fn;
#####: 124: datarep->write_conv_fn = write_conv_fn;
#####: 125: datarep->extent_fn = extent_fn;
#####: 126: datarep->next = ADIOI_Datarep_head;
-: 127:
#####: 128: ADIOI_Datarep_head = datarep;
-: 129:
#####: 130: error_code = MPI_SUCCESS;
-: 131:
#####: 132:fn_exit:
#####: 133: MPIU_THREAD_CS_EXIT(ALLFUNC,);
-: 134:
#####: 135: return error_code;
-: 136:}
|