From 4956cd61f380951b70887281971e0f91687eabeb Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 8 Apr 2003 21:16:17 -0500 Subject: [svn-r6608] Purpose: New feature Description: Added new internal API function: H5S_create_simple() for creating simple dataspaces inside the library. Solution: Platforms tested: FreeBSD 4.8 (sleipnir) w/szip Linux 2.4 (sleipnir) w/szip Solaris 2.7 (arabica) w/FORTRAN IRIX64 6.5 (modi4) w/szip, FORTRAN & parallel Misc. update: --- src/H5S.c | 47 +++++++++++++++++++++++++++++++++++++++++++---- src/H5Sprivate.h | 2 ++ 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/src/H5S.c b/src/H5S.c index d18a259..d5eb588 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -1780,14 +1780,12 @@ H5Screate_simple(int rank, const hsize_t dims[/*rank*/], } /* Create the space and set the extent */ - if(NULL==(space=H5S_create(H5S_SIMPLE))) + if(NULL==(space=H5S_create_simple(rank,dims,maxdims))) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace"); - if(H5S_set_extent_simple(space,(unsigned)rank,dims,maxdims)<0) - HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set dimensions"); /* Atomize */ if ((ret_value=H5I_register (H5I_DATASPACE, space))<0) - HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register data space atom"); + HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID"); done: if (ret_value<0) { @@ -1800,6 +1798,47 @@ done: /*------------------------------------------------------------------------- + * Function: H5S_create_simple + * + * Purpose: Internal function to create simple dataspace + * + * Return: Success: The ID for the new simple data space object. + * Failure: Negative + * + * Errors: + * + * Programmer: Quincey Koziol + * Thursday, April 3, 2003 + * + * Modifications: + * Extracted from H5Screate_simple + * Quincey Koziol, Thursday, April 3, 2003 + * + *------------------------------------------------------------------------- + */ +H5S_t * +H5S_create_simple(int rank, const hsize_t dims[/*rank*/], + const hsize_t maxdims[/*rank*/]) +{ + H5S_t *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5S_create_simple, NULL); + + /* Check arguments */ + assert(rank>=0 && rank <=H5S_MAX_RANK); + + /* Create the space and set the extent */ + if(NULL==(ret_value=H5S_create(H5S_SIMPLE))) + HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCREATE, NULL, "can't create simple dataspace"); + if(H5S_set_extent_simple(ret_value,(unsigned)rank,dims,maxdims)<0) + HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, NULL, "can't set dimensions"); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5S_create_simple() */ + + +/*------------------------------------------------------------------------- * Function: H5S_get_simple_extent_type * * Purpose: Internal function for retrieving the type of extent for a dataspace object diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 31a0d9f..e6619a4 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -161,6 +161,8 @@ H5_DLL htri_t H5S_is_simple(const H5S_t *sdim); H5_DLL herr_t H5S_extent_release(H5S_t *space); H5_DLL int H5S_extend(H5S_t *space, const hsize_t *size); H5_DLL int H5S_set_extent(H5S_t *space, const hsize_t *size); +H5_DLL H5S_t *H5S_create_simple(int rank, const hsize_t dims[/*rank*/], + const hsize_t maxdims[/*rank*/]); H5_DLL herr_t H5S_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream, int indent, int fwidth); -- cgit v0.12