diff options
author | Robb Matzke <matzke@llnl.gov> | 1997-08-05 02:07:08 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1997-08-05 02:07:08 (GMT) |
commit | e251f45b8741c7e7bf2dbd4d76a76d67dbfc6da1 (patch) | |
tree | 99ce978bac2ceec3646a60753b437d874a92de29 /src/H5F.c | |
parent | 6a3cb617d3aa57f439065118fbc68afcb1465a54 (diff) | |
download | hdf5-e251f45b8741c7e7bf2dbd4d76a76d67dbfc6da1.zip hdf5-e251f45b8741c7e7bf2dbd4d76a76d67dbfc6da1.tar.gz hdf5-e251f45b8741c7e7bf2dbd4d76a76d67dbfc6da1.tar.bz2 |
[svn-r13] ./src/H5.c
Added an `_g' to the end of library_initialize,
thread_initialize, and interface_initialize to abide by the
naming convention. Removed setting of these variables from
the various initialization functions since it happens in the
FUNC_ENTER() macro now.
Defined PABLO_MASK.
Removed `CONSTR(FUNC,"function_name")' everywhere since it's
handled by the various FUNC_ENTER macros.
Fixed calls to FUNC_ENTER(), FUNC_LEAVE(), and HRETURN_ERROR()
so they don't need so many arguments.
Changed PABLO_TRACE_ON() to FUNC_ENTER() since there is no
longer any danger of infinite recursion.
H5_term_library() now returns SUCCEED/FAIL and uses
FUNC_ENTER/FUNC_EXIT macros.
./src/H5A.c
Changes similar to H5.c.
Most (all?) of the functions called PABLO_TRACE_ON() and the
package doesn't have an interface initializer that I can see,
so the second argument to FUNC_ENTER() is always NULL.
H5A_release_atom_node() returns SUCCEED/FAIL.
./src/H5AC.c
Added error handling.
Arguments for internal functions are checked with assert().
./src/H5C.c
Changes similar to H5.c
Fixed the FUNC variable in H5C_get_default_atom() since it was
initialized to the wrong name.
./src/H5D.c
Changes similar to H5.c
./src/H5E.c
Changes similar to H5.c
Changed the pablo mask from H5_mask to H5E_mask in
H5E_init_interface().
H5Eclear(), H5E_store(), and H5Epush() return SUCCEED/FAIL.
Changed PABLO_TRACE_OFF() calls to FUNC_LEAVE() calls in the
same functions.
./src/H5Eprivate.h
./src/H5Eproto.h
Added additional error symbols for the H5AC package.
Changed prototypes for H5Eclear() and H5Epush().
Changes to HRETURN_ERROR() and HGOTO_ERROR() to reduce the
number of arguments.
./src/H5F.c
Changes similr to H5.c
Changed the pablo mask from H5_mask to H5F_mask for the
FUNC_LEAVE() call of H5F_init_interface().
Added FUNC_ENTER() and FUNC_LEAVE() calls to some functions
that didn't have them.
./src/H5M.c
Changes similar to H5.c
Fixed the FUNC variable in H5M_init_interface() since it was
initialized to the wrong name.
./src/H5P.c
Changes similar to H5.c
./src/H5T.c
Changes similar to H5.c
./src/hdf5gen.c
Changes to FUNC_ENTER() and FUNC_EXIT() to reduce the number
of arguments. FUNC_ENTER() is now safe from infinite
recursion since it updates the library_initialize_g,
thread_initialize_g, or interface_initialize_g variables
before calling the appropriate initialize function.
Diffstat (limited to 'src/H5F.c')
-rw-r--r-- | src/H5F.c | 132 |
1 files changed, 57 insertions, 75 deletions
@@ -42,10 +42,12 @@ static char RcsId[] = "@(#)$Revision$"; #include "H5Gprivate.h" /*symbol tables */ #include "H5MMprivate.h" /*core memory management */ +#define PABLO_MASK H5F_mask + /*--------------------- Locally scoped variables -----------------------------*/ /* Whether we've installed the library termination function yet for this interface */ -static intn interface_initialize = FALSE; +static intn interface_initialize_g = FALSE; /*--------------------- Local function prototypes ----------------------------*/ static herr_t H5F_init_interface(void); @@ -63,24 +65,21 @@ RETURNS DESCRIPTION Initializes any interface-specific data or routines. +Modifications: + Robb Matzke, 4 Aug 1997 + Changed pablo mask from H5_mask to H5F_mask for the FUNC_LEAVE call. + It was already H5F_mask for the PABLO_TRACE_ON call. + --------------------------------------------------------------------------*/ static herr_t H5F_init_interface(void) { -#ifdef LATER - CONSTR(FUNC, "H5F_init_interface"); /* For HERROR */ -#endif /* LATER */ herr_t ret_value = SUCCEED; - - /* Don't use "FUNC_ENTER" macro, to avoid potential infinite recursion */ - PABLO_TRACE_ON(H5F_mask, ID_H5F_init_interface); - - /* Don't call this routine again... */ - interface_initialize = TRUE; + FUNC_ENTER (H5F_init_interface, NULL, FAIL); /* Initialize the atom group for the file IDs */ ret_value=H5Ainit_group(H5_FILE,HDF5_FILEID_HASHSIZE,0); - FUNC_LEAVE(H5_mask, ID_H5F_init_interface, ret_value); + FUNC_LEAVE(ret_value); } /* H5F_init_interface */ #ifdef LATER @@ -99,9 +98,6 @@ static herr_t H5F_init_interface(void) --------------------------------------------------------------------------*/ void H5F_encode_length_unusual(const hdf5_file_t *f, uint8 **p, uint8 *l) { -#ifdef LATER - CONSTR(FUNC, "H5F_encode_length_unusual"); -#endif /* LATER */ intn i = H5F_SIZEOF_SIZE (f); /* For non-little-endian platforms, encode each byte in memory backwards */ @@ -140,9 +136,6 @@ done: --------------------------------------------------------------------------*/ void H5F_encode_offset_unusual(const hdf5_file_t *f, uint8 **p, uint8 *o) { -#ifdef LATER - CONSTR(FUNC, "H5F_encode_offset_unusual"); -#endif /* LATER */ intn i = H5F_SIZEOF_OFFSET(f); /* For non-little-endian platforms, encode each byte in memory backwards */ @@ -180,24 +173,18 @@ done: Look inside the file record for the atom API and compare the the filenames. --------------------------------------------------------------------------*/ -intn H5F_compare_filename(const VOIDP obj, const VOIDP key) +intn +H5F_compare_filename (const VOIDP _obj, const VOIDP _key) { -#ifdef LATER - CONSTR(FUNC, "H5F_compare_filename"); -#endif /* LATER */ - - -#ifdef LATER -done: - if(ret_value == FALSE) - { /* Error condition cleanup */ - - } /* end if */ -#endif /* LATER */ + const hdf5_file_t *obj = (const hdf5_file_t *)_obj; + const char *key = (const char *)_key; + int ret_value = FALSE; + + FUNC_ENTER (H5F_compare_filename, NULL, FALSE); - /* Normal function cleanup */ + ret_value = !HDstrcmp (obj->filename, key); - return(!HDstrcmp(((const hdf5_file_t *)obj)->filename,(const char *)key)); + FUNC_LEAVE (ret_value); } /* H5F_compare_filename */ /*-------------------------------------------------------------------------- @@ -216,11 +203,10 @@ done: --------------------------------------------------------------------------*/ hatom_t H5Fget_create_template(hatom_t fid) { - CONSTR(FUNC, "H5Fget_create_template"); /* for HERROR */ hdf5_file_t *file=NULL; /* file struct for file to close */ hatom_t ret_value = FAIL; - FUNC_ENTER(H5F_mask, ID_H5Fget_create_template, H5F_init_interface, FAIL); + FUNC_ENTER(H5Fget_create_template, H5F_init_interface, FAIL); /* Clear errors and check args and all the boring stuff. */ H5ECLEAR; @@ -244,7 +230,7 @@ done: /* Normal function cleanup */ - FUNC_LEAVE(H5F_mask, ID_H5Fget_create_template, ret_value); + FUNC_LEAVE(ret_value); } /* end H5Fget_create_template() */ /*-------------------------------------------------------------------------- @@ -262,14 +248,13 @@ done: --------------------------------------------------------------------------*/ hbool_t H5Fis_hdf5(const char *filename) { - CONSTR(FUNC, "H5Fis_hdf5"); /* for HERROR */ hdf_file_t f_handle=H5F_INVALID_FILE; /* file handle */ uint8 temp_buf[HDF5_FILE_SIGNATURE_LEN]; /* temporary buffer for checking file signature */ haddr_t curr_off=0; /* The current offset to check in the file */ size_t file_len=0; /* The length of the file we are checking */ hbool_t ret_value = BFALSE; - FUNC_ENTER(H5F_mask, ID_H5Fis_hdf5, H5F_init_interface, BFAIL); + FUNC_ENTER(H5Fis_hdf5, H5F_init_interface, BFAIL); /* Clear errors and check args and all the boring stuff. */ H5ECLEAR; @@ -317,7 +302,7 @@ done: /* Normal function cleanup */ - FUNC_LEAVE(H5F_mask, ID_H5Fis_hdf5, ret_value); + FUNC_LEAVE(ret_value); } /* end H5Fis_hdf5() */ @@ -419,7 +404,6 @@ H5F_dest (hdf5_file_t *f) --------------------------------------------------------------------------*/ hatom_t H5Fcreate(const char *filename, uintn flags, hatom_t create_temp, hatom_t access_temp) { - CONSTR(FUNC, "H5Fcreate"); /* for HERROR */ hdf5_file_t *new_file=NULL; /* file struct for new file */ hdf_file_t f_handle=H5F_INVALID_FILE; /* file handle */ const file_create_temp_t *f_create_parms; /* pointer to the parameters to use when creating the file */ @@ -427,7 +411,7 @@ hatom_t H5Fcreate(const char *filename, uintn flags, hatom_t create_temp, hatom_ intn file_exists=0; /* flag to indicate that file exists already */ hatom_t ret_value = FAIL; - FUNC_ENTER(H5F_mask, ID_H5Fcreate, H5F_init_interface, FAIL); + FUNC_ENTER(H5Fcreate, H5F_init_interface, FAIL); /* Clear errors and check args and all the boring stuff. */ H5ECLEAR; @@ -542,7 +526,7 @@ done: /* Normal function cleanup */ - FUNC_LEAVE(H5F_mask, ID_H5Fcreate, ret_value); + FUNC_LEAVE(ret_value); } /* end H5Fcreate() */ @@ -575,7 +559,6 @@ done: --------------------------------------------------------------------------*/ hatom_t H5Fopen(const char *filename, uintn flags, hatom_t access_temp) { - CONSTR(FUNC, "H5Fopen"); /* for HERROR */ hdf5_file_t *new_file=NULL; /* file struct for new file */ hdf_file_t f_handle=H5F_INVALID_FILE; /* file handle */ hatom_t create_temp; /* file-creation template ID */ @@ -586,7 +569,7 @@ hatom_t H5Fopen(const char *filename, uintn flags, hatom_t access_temp) hatom_t ret_value = FAIL; size_t variable_size; /*size of the variable part of the bb */ - FUNC_ENTER(H5F_mask, ID_H5Fopen, H5F_init_interface, FAIL); + FUNC_ENTER(H5Fopen, H5F_init_interface, FAIL); /* Clear errors and check args and all the boring stuff. */ H5ECLEAR; @@ -723,7 +706,7 @@ done: /* Normal function cleanup */ - FUNC_LEAVE(H5F_mask, ID_H5Fopen, ret_value); + FUNC_LEAVE(ret_value); } /* end H5Fopen() */ /*-------------------------------------------------------------------------- @@ -747,11 +730,10 @@ done: --------------------------------------------------------------------------*/ herr_t H5Fclose(hatom_t fid) { - CONSTR(FUNC, "H5Fclose"); /* for HERROR */ hdf5_file_t *file=NULL; /* file struct for file to close */ herr_t ret_value = SUCCEED; - FUNC_ENTER(H5F_mask, ID_H5Fclose, H5F_init_interface, FAIL); + FUNC_ENTER(H5Fclose, H5F_init_interface, FAIL); /* Clear errors and check args and all the boring stuff. */ H5ECLEAR; @@ -782,7 +764,7 @@ done: } /* end if */ /* Normal function cleanup */ - FUNC_LEAVE(H5F_mask, ID_H5Fclose, ret_value); + FUNC_LEAVE(ret_value); } /* end H5Fclose() */ @@ -792,9 +774,9 @@ done: * Purpose: Reads some data from a file/server/etc into a buffer. * The data is contiguous. * - * Return: Success: 0 + * Return: Success: SUCCEED * - * Failure: -1 + * Failure: FAIL * * Programmer: Robb Matzke * robb@maya.nuance.com @@ -807,19 +789,19 @@ done: herr_t H5F_block_read (hdf5_file_t *f, haddr_t addr, size_t size, void *buf) { - CONSTR(FUNC, "H5F_block_read"); /* for HERROR */ + FUNC_ENTER (H5F_block_read, NULL, FAIL); - PABLO_TRACE_ON(H5F_mask, ID_H5F_block_read); - - if (0==size) return 0; - addr += f->file_create_parms.userblock_size; + if (0==size) return 0; + addr += f->file_create_parms.userblock_size; - if (H5F_SEEK (f->file_handle, addr)<0) - HRETURN_ERROR(H5F_mask, ID_H5F_block_read, H5E_IO, H5E_SEEKERROR, FAIL); - if (H5F_READ (f->file_handle, buf, size)<0) - HRETURN_ERROR(H5F_mask, ID_H5F_block_read, H5E_IO, H5E_READERROR, FAIL); - PABLO_TRACE_OFF(H5F_mask, ID_H5F_block_read); - return SUCCEED; + if (H5F_SEEK (f->file_handle, addr)<0) { + HRETURN_ERROR (H5E_IO, H5E_SEEKERROR, FAIL); + } + if (H5F_READ (f->file_handle, buf, size)<0) { + HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL); + } + + FUNC_LEAVE (SUCCEED); } @@ -829,9 +811,9 @@ H5F_block_read (hdf5_file_t *f, haddr_t addr, size_t size, void *buf) * Purpose: Writes some data from memory to a file/server/etc. The * data is contiguous. * - * Return: Success: 0 + * Return: Success: SUCCEED * - * Failure: -1 + * Failure: FAIL * * Programmer: Robb Matzke * robb@maya.nuance.com @@ -844,19 +826,19 @@ H5F_block_read (hdf5_file_t *f, haddr_t addr, size_t size, void *buf) herr_t H5F_block_write (hdf5_file_t *f, haddr_t addr, size_t size, void *buf) { - CONSTR(FUNC, "H5F_block_write"); /* for HERROR */ - - PABLO_TRACE_ON(H5F_mask, ID_H5F_block_read); - - if (0==size) return 0; - addr += f->file_create_parms.userblock_size; - - if (H5F_SEEK (f->file_handle, addr)<0) - HRETURN_ERROR(H5F_mask, ID_H5F_block_write, H5E_IO, H5E_SEEKERROR, FAIL); - if (H5F_WRITE (f->file_handle, buf, size)<0) - HRETURN_ERROR(H5F_mask, ID_H5F_block_write, H5E_IO, H5E_WRITEERROR, FAIL); - PABLO_TRACE_OFF(H5F_mask, ID_H5F_block_write); - return SUCCEED; + FUNC_ENTER (H5F_block_write, NULL, FAIL); + + if (0==size) return 0; + addr += f->file_create_parms.userblock_size; + + if (H5F_SEEK (f->file_handle, addr)<0) { + HRETURN_ERROR (H5E_IO, H5E_SEEKERROR, FAIL); + } + if (H5F_WRITE (f->file_handle, buf, size)<0) { + HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL); + } + + FUNC_LEAVE (SUCCEED); } |