[svn-r6952] Purpose:

Code cleanup

Description:
    Move testing routines into their own module, to avoid linking them into
user's applications needlessly.

Platforms tested:
    FreeBSD 4.8 (sleipnir) w/C++
    FreeBSD 4.8 (sleipnir) w/parallel
    h5committested
This commit is contained in:
Quincey Koziol 2003-06-04 10:28:04 -05:00
parent b56429d086
commit d1042619ae
4 changed files with 145 additions and 102 deletions

102
src/H5P.c
View File

@ -12,10 +12,12 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* $Id$ */
/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
*
* Purpose: Generic Property Functions
*/
#define H5P_PACKAGE /*suppress error about including H5Ppkg */
#define H5P_TESTING /*suppress warning about H5P testing funcs*/
/* Private header files */
#include "H5private.h" /* Generic Functions */
@ -30,7 +32,7 @@
/* Pablo mask */
#define PABLO_MASK H5P_mask
/* Is the interface initialized? */
/* Interface initialization */
static int interface_initialize_g = 0;
#define INTERFACE_INIT H5P_init_interface
static herr_t H5P_init_interface(void);
@ -86,7 +88,6 @@ static H5P_genclass_t *H5P_create_class(H5P_genclass_t *par_class,
H5P_cls_create_func_t cls_create, void *create_data,
H5P_cls_copy_func_t cls_copy, void *copy_data,
H5P_cls_close_func_t cls_close, void *close_data);
static herr_t H5P_close_class(void *_pclass);
static herr_t H5P_unregister(H5P_genclass_t *pclass, const char *name);
static H5P_genprop_t *H5P_dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type);
static herr_t H5P_free_prop(H5P_genprop_t *prop);
@ -5337,49 +5338,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value);
} /* H5P_get_class_path() */
/*--------------------------------------------------------------------------
NAME
H5Pget_class_path
PURPOSE
Routine to query the full path of a generic property list class
USAGE
char *H5Pget_class_name(pclass_id)
hid_t pclass_id; IN: Property class to query
RETURNS
Success: Pointer to a malloc'ed string containing the full path of class
Failure: NULL
DESCRIPTION
This routine retrieves the full path name of a generic property list
class, starting with the root of the class hierarchy.
The pointer to the name must be free'd by the user for successful calls.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING H5P_get_class_path()
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
char *
H5P_get_class_path_test(hid_t pclass_id)
{
H5P_genclass_t *pclass; /* Property class to query */
char *ret_value; /* return value */
FUNC_ENTER_NOAPI(H5P_get_class_path_test, NULL);
/* Check arguments. */
if (NULL == (pclass = H5I_object_verify(pclass_id, H5I_GENPROP_CLS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property class");
/* Get the property list class path */
if ((ret_value=H5P_get_class_path(pclass))==NULL)
HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "unable to query full path of class");
done:
FUNC_LEAVE_NOAPI(ret_value);
} /* H5P_get_class_path_test() */
/*--------------------------------------------------------------------------
NAME
@ -5458,54 +5416,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value);
} /* H5P_open_class_path() */
/*--------------------------------------------------------------------------
NAME
H5Popen_class_path
PURPOSE
Routine to open a [copy of] a class with its full path name
USAGE
hid_t H5Popen_class_name(path)
const char *path; IN: Full path name of class to open [copy of]
RETURNS
Success: ID of generic property class
Failure: NULL
DESCRIPTION
This routine opens [a copy] of the class indicated by the full path.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING H5P_open_class_path()
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
hid_t
H5P_open_class_path_test(const char *path)
{
H5P_genclass_t *pclass=NULL;/* Property class to query */
hid_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5P_open_class_path_test, FAIL);
/* Check arguments. */
if (NULL == path || *path=='\0')
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid class path");
/* Open the property list class */
if ((pclass=H5P_open_class_path(path))==NULL)
HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "unable to find class with full path");
/* Get an atom for the class */
if ((ret_value=H5I_register(H5I_GENPROP_CLS, pclass))<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class");
done:
if(ret_value<0 && pclass)
H5P_close_class(pclass);
FUNC_LEAVE_NOAPI(ret_value);
} /* H5P_open_class_path_test() */
/*--------------------------------------------------------------------------
NAME
@ -5612,7 +5522,7 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
herr_t
H5P_close_class(void *_pclass)
{
H5P_genclass_t *pclass=(H5P_genclass_t *)_pclass;

View File

@ -115,6 +115,7 @@ H5_DLL herr_t H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod);
H5_DLL char *H5P_get_class_path(H5P_genclass_t *pclass);
H5_DLL H5P_genclass_t *H5P_open_class_path(const char *path);
H5_DLL int H5P_tbbt_strcmp(const void *k1, const void *k2, int UNUSED cmparg);
H5_DLL herr_t H5P_close_class(void *_pclass);
/* Testing functions */
#ifdef H5P_TESTING

131
src/H5Ptest.c Normal file
View File

@ -0,0 +1,131 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
* Saturday May 31, 2003
*
* Purpose: Generic Property Testing Functions
*/
#define H5P_PACKAGE /*suppress error about including H5Ppkg */
#define H5P_TESTING /*suppress warning about H5P testing funcs*/
/* Private header files */
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
#include "H5Ppkg.h" /* Property lists */
/* Pablo mask */
#define PABLO_MASK H5Ptest_mask
/* Interface initialization */
#define INTERFACE_INIT NULL
static int interface_initialize_g = 0;
/* Local variables */
/* Local typedefs */
/*--------------------------------------------------------------------------
NAME
H5P_get_class_path_test
PURPOSE
Routine to query the full path of a generic property list class
USAGE
char *H5P_get_class_name_test(pclass_id)
hid_t pclass_id; IN: Property class to query
RETURNS
Success: Pointer to a malloc'ed string containing the full path of class
Failure: NULL
DESCRIPTION
This routine retrieves the full path name of a generic property list
class, starting with the root of the class hierarchy.
The pointer to the name must be free'd by the user for successful calls.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING H5P_get_class_path()
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
char *
H5P_get_class_path_test(hid_t pclass_id)
{
H5P_genclass_t *pclass; /* Property class to query */
char *ret_value; /* return value */
FUNC_ENTER_NOAPI(H5P_get_class_path_test, NULL);
/* Check arguments. */
if (NULL == (pclass = H5I_object_verify(pclass_id, H5I_GENPROP_CLS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property class");
/* Get the property list class path */
if ((ret_value=H5P_get_class_path(pclass))==NULL)
HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "unable to query full path of class");
done:
FUNC_LEAVE_NOAPI(ret_value);
} /* H5P_get_class_path_test() */
/*--------------------------------------------------------------------------
NAME
H5P_open_class_path_test
PURPOSE
Routine to open a [copy of] a class with its full path name
USAGE
hid_t H5P_open_class_name_test(path)
const char *path; IN: Full path name of class to open [copy of]
RETURNS
Success: ID of generic property class
Failure: NULL
DESCRIPTION
This routine opens [a copy] of the class indicated by the full path.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING H5P_open_class_path()
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
hid_t
H5P_open_class_path_test(const char *path)
{
H5P_genclass_t *pclass=NULL;/* Property class to query */
hid_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5P_open_class_path_test, FAIL);
/* Check arguments. */
if (NULL == path || *path=='\0')
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid class path");
/* Open the property list class */
if ((pclass=H5P_open_class_path(path))==NULL)
HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "unable to find class with full path");
/* Get an atom for the class */
if ((ret_value=H5I_register(H5I_GENPROP_CLS, pclass))<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class");
done:
if(ret_value<0 && pclass)
H5P_close_class(pclass);
FUNC_LEAVE_NOAPI(ret_value);
} /* H5P_open_class_path_test() */

View File

@ -37,12 +37,13 @@ LIB_SRC=H5.c H5A.c H5AC.c H5B.c H5D.c H5Dio.c H5E.c H5F.c H5Fcontig.c \
H5MM.c H5O.c H5Oattr.c H5Obogus.c H5Ocont.c H5Odtype.c H5Oefl.c \
H5Ofill.c H5Olayout.c H5Omtime.c H5Oname.c H5Onull.c H5Opline.c \
H5Osdspace.c H5Oshared.c H5Ostab.c H5P.c H5Pdcpl.c H5Pdxpl.c \
H5Pfapl.c H5Pfcpl.c H5R.c H5RS.c H5S.c H5Sall.c H5Shyper.c H5Smpio.c \
H5Snone.c H5Spoint.c H5Sselect.c H5ST.c H5T.c H5Tarray.c H5Tbit.c \
H5Tcommit.c H5Tcompound.c H5Tconv.c H5Tcset.c H5Tenum.c H5Tfields.c \
H5Tfixed.c H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Topaque.c \
H5Torder.c H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvlen.c H5TB.c H5TS.c \
H5V.c H5Z.c H5Zdeflate.c H5Zfletcher32.c H5Zshuffle.c H5Zszip.c
H5Pfapl.c H5Pfcpl.c H5Ptest.c H5R.c H5RS.c H5S.c H5Sall.c H5Shyper.c \
H5Smpio.c H5Snone.c H5Spoint.c H5Sselect.c H5Stest.c H5ST.c H5T.c \
H5Tarray.c H5Tbit.c H5Tcommit.c H5Tcompound.c H5Tconv.c H5Tcset.c \
H5Tenum.c H5Tfields.c H5Tfixed.c H5Tfloat.c H5Tinit.c H5Tnative.c \
H5Toffset.c H5Topaque.c H5Torder.c H5Tpad.c H5Tprecis.c H5Tstrpad.c \
H5Tvlen.c H5TB.c H5TS.c H5V.c H5Z.c H5Zdeflate.c H5Zfletcher32.c \
H5Zshuffle.c H5Zszip.c
LIB_OBJ=$(LIB_SRC:.c=.lo)