diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-09-02 15:04:36 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-09-02 15:04:36 (GMT) |
commit | 32a666f65243a0583be867935b892dd4ae13d1f4 (patch) | |
tree | 0378b28295a0eb21d6199ae84d4d023646d44fa2 /src | |
parent | 38d6179b319519ece95e6af9da1720cd63b0e4ac (diff) | |
download | hdf5-32a666f65243a0583be867935b892dd4ae13d1f4.zip hdf5-32a666f65243a0583be867935b892dd4ae13d1f4.tar.gz hdf5-32a666f65243a0583be867935b892dd4ae13d1f4.tar.bz2 |
[svn-r7438] Purpose:
Code cleanup
Description:
More de-linting...
Platforms tested:
FreeBSD 4.9 (sleipnir)
too small to need h5committest
Diffstat (limited to 'src')
-rw-r--r-- | src/H5T.c | 96 | ||||
-rw-r--r-- | src/H5Tcset.c | 16 | ||||
-rw-r--r-- | src/H5Tnative.c | 2 | ||||
-rw-r--r-- | src/H5Toffset.c | 7 | ||||
-rw-r--r-- | src/H5Torder.c | 10 | ||||
-rw-r--r-- | src/H5Tpad.c | 10 | ||||
-rw-r--r-- | src/H5Tpkg.h | 43 | ||||
-rw-r--r-- | src/H5Tprecis.c | 89 | ||||
-rw-r--r-- | src/H5Tprivate.h | 3 | ||||
-rw-r--r-- | src/H5Tpublic.h | 22 | ||||
-rw-r--r-- | src/H5Tstrpad.c | 52 | ||||
-rw-r--r-- | src/H5Tvlen.c | 16 | ||||
-rwxr-xr-x | src/hdf5.lnt | 2 |
13 files changed, 149 insertions, 219 deletions
@@ -2541,7 +2541,7 @@ H5Tis_variable_str(hid_t dtype_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); /* Set return value */ - ret_value=H5T_is_variable_str(dt); + ret_value=H5T_IS_VL_STRING(dt); done: FUNC_LEAVE_API(ret_value); @@ -2549,48 +2549,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5T_is_variable_str - * - * Purpose: Private function of H5Tis_variable_str. - * Check whether a datatype is a variable-length string - * - * - * Return: TRUE (1) or FALSE (0) on success/Negative on failure - * - * Programmer: Raymond Lu - * November 4, 2002 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -htri_t -H5T_is_variable_str(H5T_t *dt) -{ - htri_t ret_value=FALSE; /* Return value */ - - FUNC_ENTER_NOAPI(H5T_is_variable_str, FAIL); - - assert(dt); - - if(H5T_VLEN == dt->type && H5T_VLEN_STRING == dt->u.vlen.type) - ret_value = TRUE; - -done: - FUNC_LEAVE_NOAPI(ret_value); -} - - -/*------------------------------------------------------------------------- * Function: H5Tget_size * - * Purpose: Determines the total size of a data type in bytes. + * Purpose: Determines the total size of a datatype in bytes. * - * Return: Success: Size of the data type in bytes. The size of - * data type is the size of an instance of that - * data type. + * Return: Success: Size of the datatype in bytes. The size of + * datatype is the size of an instance of that + * datatype. * - * Failure: 0 (valid data types are never zero size) + * Failure: 0 (valid datatypes are never zero size) * * Programmer: Robb Matzke * Monday, December 8, 1997 @@ -2610,7 +2577,7 @@ H5Tget_size(hid_t type_id) /* Check args */ if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a data type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype"); /* size */ ret_value = H5T_get_size(dt); @@ -2623,12 +2590,12 @@ done: /*------------------------------------------------------------------------- * Function: H5Tset_size * - * Purpose: Sets the total size in bytes for a data type (this operation - * is not permitted on reference data types). If the size is - * decreased so that the significant bits of the data type + * Purpose: Sets the total size in bytes for a datatype (this operation + * is not permitted on reference datatypes). If the size is + * decreased so that the significant bits of the datatype * extend beyond the edge of the new size, then the `offset' * property is decreased toward zero. If the `offset' becomes - * zero and the significant bits of the data type still hang + * zero and the significant bits of the datatype still hang * over the edge of the new size, then the number of significant * bits is decreased. * @@ -3911,41 +3878,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5T_is_atomic - * - * Purpose: Determines if a data type is an atomic type. - * - * Return: Success: TRUE, FALSE - * - * Failure: Negative - * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -htri_t -H5T_is_atomic(const H5T_t *dt) -{ - htri_t ret_value; - - FUNC_ENTER_NOAPI(H5T_is_atomic, FAIL); - - assert(dt); - - if (!H5T_IS_COMPLEX(dt->type) && H5T_OPAQUE!=dt->type) - ret_value = TRUE; - else - ret_value = FALSE; - -done: - FUNC_LEAVE_NOAPI(ret_value); -} - - -/*------------------------------------------------------------------------- * Function: H5T_set_size * * Purpose: Sets the total size in bytes for a data type (this operation @@ -4000,7 +3932,7 @@ H5T_set_size(H5T_t *dt, size_t size) else if(dt->type!=H5T_VLEN) dt->size = dt->parent->size; } else { - if (H5T_is_atomic(dt)) { + if (H5T_IS_ATOMIC(dt)) { offset = dt->u.atomic.offset; prec = dt->u.atomic.prec; @@ -4093,7 +4025,7 @@ H5T_set_size(H5T_t *dt, size_t size) /* Commit (if we didn't convert this type to a VL string) */ if(dt->type!=H5T_VLEN) { dt->size = size; - if (H5T_is_atomic(dt)) { + if (H5T_IS_ATOMIC(dt)) { dt->u.atomic.offset = offset; dt->u.atomic.prec = prec; } @@ -5394,7 +5326,7 @@ H5T_debug(const H5T_t *dt, FILE *stream) fprintf(stream, "%s%s {nbytes=%lu", s1, s2, (unsigned long)(dt->size)); - if (H5T_is_atomic(dt)) { + if (H5T_IS_ATOMIC(dt)) { switch (dt->u.atomic.order) { case H5T_ORDER_BE: s1 = "BE"; diff --git a/src/H5Tcset.c b/src/H5Tcset.c index 6814b9b..ec51af8 100644 --- a/src/H5Tcset.c +++ b/src/H5Tcset.c @@ -89,15 +89,13 @@ H5Tget_cset(hid_t type_id) while (dt->parent && !H5T_IS_STRING(dt)) dt = dt->parent; /*defer to parent*/ if (!H5T_IS_STRING(dt)) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5T_CSET_ERROR, "operation not defined for data type class"); + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_CSET_ERROR, "operation not defined for data type class"); /* result */ - if(H5T_STRING == dt->type) + if(H5T_IS_FIXED_STRING(dt)) ret_value = dt->u.atomic.u.s.cset; - else if(H5T_VLEN == dt->type && H5T_VLEN_STRING == dt->u.vlen.type) + else ret_value = dt->u.vlen.cset; - else - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, H5T_CSET_ERROR, "can't get cset info"); done: FUNC_LEAVE_API(ret_value); @@ -141,15 +139,13 @@ H5Tset_cset(hid_t type_id, H5T_cset_t cset) while (dt->parent && !H5T_IS_STRING(dt)) dt = dt->parent; /*defer to parent*/ if (!H5T_IS_STRING(dt)) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for data type class"); + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for data type class"); /* Commit */ - if(H5T_STRING == dt->type) + if(H5T_IS_FIXED_STRING(dt)) dt->u.atomic.u.s.cset = cset; - else if(H5T_VLEN == dt->type && H5T_VLEN_STRING == dt->u.vlen.type) + else dt->u.vlen.cset = cset; - else - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "can't set cset info"); done: FUNC_LEAVE_API(ret_value); diff --git a/src/H5Tnative.c b/src/H5Tnative.c index 17e2ef8..a5005d4 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -198,7 +198,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig if((ret_value=H5T_copy(dtype, H5T_COPY_TRANSIENT))==NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type"); - if(H5T_is_variable_str(dtype)) { + if(H5T_IS_VL_STRING(dtype)) { /* Update size, offset and compound alignment for parent. */ if(H5T_cmp_offset(comp_size, offset, sizeof(char *), 1, H5T_POINTER_COMP_ALIGN_g, struct_align)<0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset"); diff --git a/src/H5Toffset.c b/src/H5Toffset.c index bd54e5c..36a806d 100644 --- a/src/H5Toffset.c +++ b/src/H5Toffset.c @@ -105,11 +105,10 @@ H5Tget_offset(hid_t type_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type"); while (dt->parent) dt = dt->parent; /*defer to parent*/ - if (H5T_COMPOUND==dt->type || H5T_OPAQUE==dt->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for specified data type"); + if (!H5T_IS_ATOMIC(dt)) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type"); /* Offset */ - assert(H5T_is_atomic(dt)); ret_value = (int)dt->u.atomic.offset; done: @@ -175,7 +174,7 @@ H5Tset_offset(hid_t type_id, size_t offset) if (H5T_ENUM==dt->type && dt->u.enumer.nmembs>0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined"); if (H5T_COMPOUND==dt->type || H5T_REFERENCE==dt->type || H5T_OPAQUE==dt->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for this datatype"); + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for this datatype"); /* Do the real work */ if (H5T_set_offset(dt, offset)<0) diff --git a/src/H5Torder.c b/src/H5Torder.c index 214466c..2f39816 100644 --- a/src/H5Torder.c +++ b/src/H5Torder.c @@ -86,11 +86,10 @@ H5Tget_order(hid_t type_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_ORDER_ERROR, "not a data type"); while (dt->parent) dt = dt->parent; /*defer to parent*/ - if (H5T_COMPOUND==dt->type || H5T_OPAQUE==dt->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5T_ORDER_ERROR, "operation not defined for specified data type"); + if (!H5T_IS_ATOMIC(dt)) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_ORDER_ERROR, "operation not defined for specified data type"); /* Order */ - assert(H5T_is_atomic(dt)); ret_value = dt->u.atomic.order; done: @@ -134,11 +133,10 @@ H5Tset_order(hid_t type_id, H5T_order_t order) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined"); while (dt->parent) dt = dt->parent; /*defer to parent*/ - if (H5T_COMPOUND==dt->type || H5T_OPAQUE==dt->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5T_ORDER_ERROR, "operation not defined for specified data type"); + if (!H5T_IS_ATOMIC(dt)) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_ORDER_ERROR, "operation not defined for specified data type"); /* Commit */ - assert(H5T_is_atomic(dt)); dt->u.atomic.order = order; done: diff --git a/src/H5Tpad.c b/src/H5Tpad.c index 532a920..3da45e7 100644 --- a/src/H5Tpad.c +++ b/src/H5Tpad.c @@ -86,11 +86,10 @@ H5Tget_pad(hid_t type_id, H5T_pad_t *lsb/*out*/, H5T_pad_t *msb/*out*/) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); while (dt->parent) dt = dt->parent; /*defer to parent*/ - if (H5T_COMPOUND==dt->type || H5T_OPAQUE==dt->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for specified data type"); + if (!H5T_IS_ATOMIC(dt)) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type"); /* Get values */ - assert(H5T_is_atomic(dt)); if (lsb) *lsb = dt->u.atomic.lsb_pad; if (msb) @@ -137,11 +136,10 @@ H5Tset_pad(hid_t type_id, H5T_pad_t lsb, H5T_pad_t msb) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined"); while (dt->parent) dt = dt->parent; /*defer to parent*/ - if (H5T_COMPOUND==dt->type || H5T_OPAQUE==dt->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for specified data type"); + if (!H5T_IS_ATOMIC(dt)) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type"); /* Commit */ - assert(H5T_is_atomic(dt)); dt->u.atomic.lsb_pad = lsb; dt->u.atomic.msb_pad = msb; diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index fab832b..49a1ca8 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -50,10 +50,19 @@ #define H5T_NAMELEN 32 /* Macro to ease detecting "complex" datatypes (i.e. those with base types or fields) */ -#define H5T_IS_COMPLEX(t) ((t)==H5T_COMPOUND || (t)==H5T_ENUM || (t)==H5T_VLEN || (t)==H5T_ARRAY) +#define H5T_IS_COMPLEX(t) ((t)==H5T_COMPOUND || (t)==H5T_ENUM || (t)==H5T_VLEN || (t)==H5T_ARRAY) + +/* Macro to ease detecting fixed "string" datatypes */ +#define H5T_IS_FIXED_STRING(dt) (H5T_STRING == (dt)->type) + +/* Macro to ease detecting variable-length "string" datatypes */ +#define H5T_IS_VL_STRING(dt) (H5T_VLEN == (dt)->type && H5T_VLEN_STRING == (dt)->u.vlen.type) /* Macro to ease detecting fixed or variable-length "string" datatypes */ -#define H5T_IS_STRING(dt) (H5T_STRING == (dt)->type || (H5T_VLEN == (dt)->type && H5T_VLEN_STRING == (dt)->u.vlen.type)) +#define H5T_IS_STRING(dt) (H5T_IS_FIXED_STRING(dt) || H5T_IS_VL_STRING(dt)) + +/* Macro to ease detecting atomic datatypes */ +#define H5T_IS_ATOMIC(dt) (!(H5T_IS_COMPLEX((dt)->type) || (dt)->type==H5T_OPAQUE)) /* Statistics about a conversion function */ struct H5T_stats_t { @@ -62,11 +71,11 @@ struct H5T_stats_t { H5_timer_t timer; /*total time for conversion */ }; -/* The data type conversion database */ +/* The datatype conversion database */ struct H5T_path_t { char name[H5T_NAMELEN]; /*name for debugging only */ - H5T_t *src; /*source data type ID */ - H5T_t *dst; /*destination data type ID */ + H5T_t *src; /*source datatype ID */ + H5T_t *dst; /*destination datatype ID */ H5T_conv_t func; /*data conversion function */ hbool_t is_hard; /*is it a hard function? */ H5T_stats_t stats; /*statistics for the conversion */ @@ -107,14 +116,14 @@ typedef struct H5T_atomic_t { } u; } H5T_atomic_t; -/* How members are sorted for compound or enum data types */ +/* How members are sorted for compound or enum datatypes */ typedef enum H5T_sort_t { H5T_SORT_NONE = 0, /*not sorted */ H5T_SORT_NAME = 1, /*sorted by member name */ H5T_SORT_VALUE = 2 /*sorted by memb offset or enum value*/ } H5T_sort_t; -/* A compound data type */ +/* A compound datatype */ typedef struct H5T_compnd_t { int nalloc; /*num entries allocated in MEMB array*/ int nmembs; /*number of members defined in struct*/ @@ -122,7 +131,7 @@ typedef struct H5T_compnd_t { struct H5T_cmemb_t *memb; /*array of struct members */ } H5T_compnd_t; -/* An enumeration data type */ +/* An enumeration datatype */ typedef struct H5T_enum_t { int nalloc; /*num entries allocated */ int nmembs; /*number of members defined in enum */ @@ -157,7 +166,7 @@ typedef struct H5T_vlen_t { H5T_vlen_writefunc_t write; /* Function to write VL sequence from buffer */ } H5T_vlen_t; -/* An opaque data type */ +/* An opaque datatype */ typedef struct H5T_opaque_t { char *tag; /*short type description string */ } H5T_opaque_t; @@ -185,18 +194,18 @@ struct H5T_t { H5T_class_t type; /*which class of type is this? */ size_t size; /*total size of an instance of this type */ hbool_t force_conv;/* Set if this type always needs to be converted and H5T_conv_noop cannot be called */ - struct H5T_t *parent;/*parent type for derived data types */ + struct H5T_t *parent;/*parent type for derived datatypes */ union { - H5T_atomic_t atomic; /* an atomic data type */ - H5T_compnd_t compnd; /* a compound data type (struct) */ + H5T_atomic_t atomic; /* an atomic datatype */ + H5T_compnd_t compnd; /* a compound datatype (struct) */ H5T_enum_t enumer; /* an enumeration type (enum) */ H5T_vlen_t vlen; /* a variable-length datatype */ - H5T_opaque_t opaque; /* an opaque data type */ + H5T_opaque_t opaque; /* an opaque datatype */ H5T_array_t array; /* an array datatype */ } u; }; -/* A compound data type member */ +/* A compound datatype member */ typedef struct H5T_cmemb_t { char *name; /*name of this member */ size_t offset; /*offset from beginning of struct */ @@ -207,8 +216,8 @@ typedef struct H5T_cmemb_t { /* The master list of soft conversion functions */ typedef struct H5T_soft_t { char name[H5T_NAMELEN]; /*name for debugging only */ - H5T_class_t src; /*source data type class */ - H5T_class_t dst; /*destination data type class */ + H5T_class_t src; /*source datatype class */ + H5T_class_t dst; /*destination datatype class */ H5T_conv_t func; /*the conversion function */ } H5T_soft_t; @@ -301,8 +310,6 @@ H5_DLL char *H5T_get_member_name(H5T_t *dt, int membno); H5_DLL herr_t H5T_get_member_value(H5T_t *dt, int membno, void *value); H5_DLL H5T_t *H5T_get_member_type(H5T_t *dt, int membno); H5_DLL int H5T_get_nmembers(const H5T_t *dt); -H5_DLL htri_t H5T_is_variable_str(H5T_t *dt); -H5_DLL htri_t H5T_is_atomic(const H5T_t *dt); H5_DLL herr_t H5T_insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member); H5_DLL H5T_t *H5T_enum_create(H5T_t *parent); diff --git a/src/H5Tprecis.c b/src/H5Tprecis.c index 9f7f471..9cc10f6 100644 --- a/src/H5Tprecis.c +++ b/src/H5Tprecis.c @@ -19,13 +19,15 @@ #define H5T_PACKAGE /*suppress error about including H5Tpkg */ -#include "H5private.h" /*generic functions */ -#include "H5Eprivate.h" /*error handling */ -#include "H5Iprivate.h" /*ID functions */ -#include "H5Tpkg.h" /*data-type functions */ - +/* Pablo information */ +/* (Put before include files to avoid problems with inline functions) */ #define PABLO_MASK H5Tprecis_mask +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Tpkg.h" /* Datatypes */ + /* Interface initialization */ static int interface_initialize_g = 0; #define INTERFACE_INIT H5T_init_precis_interface @@ -51,16 +53,16 @@ DESCRIPTION static herr_t H5T_init_precis_interface(void) { - FUNC_ENTER_NOINIT(H5T_init_precis_interface); + FUNC_ENTER_NOINIT(H5T_init_precis_interface) - FUNC_LEAVE_NOAPI(H5T_init()); + FUNC_LEAVE_NOAPI(H5T_init()) } /* H5T_init_precis_interface() */ /*------------------------------------------------------------------------- * Function: H5Tget_precision * - * Purpose: Gets the precision of a data type. The precision is + * Purpose: Gets the precision of a datatype. The precision is * the number of significant bits which, unless padding is * present, is 8 times larger than the value returned by * H5Tget_size(). @@ -75,7 +77,7 @@ H5T_init_precis_interface(void) * * Modifications: * Robb Matzke, 22 Dec 1998 - * Also works for derived data types. + * Also works for derived datatypes. * *------------------------------------------------------------------------- */ @@ -85,37 +87,36 @@ H5Tget_precision(hid_t type_id) H5T_t *dt = NULL; size_t ret_value; - FUNC_ENTER_API(H5Tget_precision, 0); + FUNC_ENTER_API(H5Tget_precision, 0) H5TRACE1("z","i",type_id); /* Check args */ if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a data type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype") while (dt->parent) dt = dt->parent; /*defer to parent*/ - if (H5T_COMPOUND==dt->type || H5T_OPAQUE==dt->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, 0, "operation not defined for specified data type"); + if (!H5T_IS_ATOMIC(dt)) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, 0, "operation not defined for specified datatype") /* Precision */ - assert(H5T_is_atomic(dt)); ret_value = dt->u.atomic.prec; done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /*------------------------------------------------------------------------- * Function: H5Tset_precision * - * Purpose: Sets the precision of a data type. The precision is + * Purpose: Sets the precision of a datatype. The precision is * the number of significant bits which, unless padding is * present, is 8 times larger than the value returned by * H5Tget_size(). * * If the precision is increased then the offset is decreased * and then the size is increased to insure that significant - * bits do not "hang over" the edge of the data type. + * bits do not "hang over" the edge of the datatype. * * The precision property of strings is read-only. * @@ -140,43 +141,43 @@ H5Tset_precision(hid_t type_id, size_t prec) H5T_t *dt = NULL; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Tset_precision, FAIL); + FUNC_ENTER_API(H5Tset_precision, FAIL) H5TRACE2("e","iz",type_id,prec); /* Check args */ if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if (H5T_STATE_TRANSIENT!=dt->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only"); - if (prec <= 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "precision must be positive"); + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is read-only") + if (prec == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "precision must be positive") if (H5T_ENUM==dt->type && dt->u.enumer.nmembs>0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "operation not allowed after members are defined") if (H5T_STRING==dt->type) - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "precision for this type is read-only"); + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "precision for this type is read-only") if (H5T_COMPOUND==dt->type || H5T_OPAQUE==dt->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for specified data type"); + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified datatype") /* Do the work */ if (H5T_set_precision(dt, prec)<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set precision"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set precision") done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /*------------------------------------------------------------------------- * Function: H5T_set_precision * - * Purpose: Sets the precision of a data type. The precision is + * Purpose: Sets the precision of a datatype. The precision is * the number of significant bits which, unless padding is * present, is 8 times larger than the value returned by * H5Tget_size(). * * If the precision is increased then the offset is decreased * and then the size is increased to insure that significant - * bits do not "hang over" the edge of the data type. + * bits do not "hang over" the edge of the datatype. * * The precision property of strings is read-only. * @@ -191,7 +192,7 @@ done: * * Modifications: * Robb Matzke, 22 Dec 1998 - * Also works for derived data types. + * Also works for derived datatypes. * *------------------------------------------------------------------------- */ @@ -201,7 +202,7 @@ H5T_set_precision(H5T_t *dt, size_t prec) size_t offset, size; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_set_precision, FAIL); + FUNC_ENTER_NOAPI(H5T_set_precision, FAIL) /* Check args */ assert(dt); @@ -213,7 +214,7 @@ H5T_set_precision(H5T_t *dt, size_t prec) if (dt->parent) { if (H5T_set_precision(dt->parent, prec)<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set precision for base type"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set precision for base type") /* Adjust size of datatype appropriately */ if(dt->type==H5T_ARRAY) @@ -221,7 +222,7 @@ H5T_set_precision(H5T_t *dt, size_t prec) else if(dt->type!=H5T_VLEN) dt->size = dt->parent->size; } else { - if (H5T_is_atomic(dt)) { + if (H5T_IS_ATOMIC(dt)) { /* Adjust the offset and size */ offset = dt->u.atomic.offset; size = dt->size; @@ -248,27 +249,25 @@ H5T_set_precision(H5T_t *dt, size_t prec) */ if (dt->u.atomic.u.f.sign >= prec || dt->u.atomic.u.f.epos + dt->u.atomic.u.f.esize > prec || - dt->u.atomic.u.f.mpos + dt->u.atomic.u.f.msize > prec) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjust sign, mantissa, and exponent fields first"); - } + dt->u.atomic.u.f.mpos + dt->u.atomic.u.f.msize > prec) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjust sign, mantissa, and exponent fields first") break; default: assert("not implemented yet" && 0); - } + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "operation not defined for datatype class") + } /* end switch */ /* Commit */ dt->size = size; - if (H5T_is_atomic(dt)) { - dt->u.atomic.offset = offset; - dt->u.atomic.prec = prec; - } - } + dt->u.atomic.offset = offset; + dt->u.atomic.prec = prec; + } /* end if */ else - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for specified datatype"); - } + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for specified datatype") + } /* end else */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 4fd78e6..1897dbf 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -18,6 +18,7 @@ #ifndef _H5Tprivate_H #define _H5Tprivate_H +/* Get package's public header */ #include "H5Tpublic.h" /* Private headers needed by this file */ @@ -30,7 +31,7 @@ typedef struct H5T_t H5T_t; typedef struct H5T_stats_t H5T_stats_t; typedef struct H5T_path_t H5T_path_t; -/* How to copy a data type */ +/* How to copy a datatype */ typedef enum H5T_copy_t { H5T_COPY_TRANSIENT, H5T_COPY_ALL, diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h index 6842b63..1c0084e 100644 --- a/src/H5Tpublic.h +++ b/src/H5Tpublic.h @@ -24,7 +24,7 @@ #define HOFFSET(S,M) (offsetof(S,M)) -/* These are the various classes of data types */ +/* These are the various classes of datatypes */ /* If this goes over 16 types (0-15), the file format will need to change) */ typedef enum H5T_class_t { H5T_NO_CLASS = -1, /*error */ @@ -134,7 +134,7 @@ typedef enum H5T_pad_t { /* Commands sent to conversion functions */ typedef enum H5T_cmd_t { H5T_CONV_INIT = 0, /*query and/or initialize private data */ - H5T_CONV_CONV = 1, /*convert data from source to dest data type */ + H5T_CONV_CONV = 1, /*convert data from source to dest datatype */ H5T_CONV_FREE = 2 /*function is being removed from path */ } H5T_cmd_t; @@ -181,15 +181,15 @@ typedef struct { extern "C" { #endif -/* All data type conversion functions are... */ +/* All datatype conversion functions are... */ typedef herr_t (*H5T_conv_t) (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg, hid_t dset_xfer_plist); /* - * If an error occurs during a data type conversion then the function + * If an error occurs during a datatype conversion then the function * registered with H5Tset_overflow() is called. It's arguments are the - * source and destination data types, a buffer which has the source value, + * source and destination datatypes, a buffer which has the source value, * and a buffer to receive an optional result for the overflow conversion. * If the overflow handler chooses a value for the result it should return * non-negative; otherwise the hdf5 library will choose an appropriate @@ -468,7 +468,7 @@ H5_DLLVAR hid_t H5T_NATIVE_UINT_LEAST64_g; H5_DLLVAR hid_t H5T_NATIVE_INT_FAST64_g; H5_DLLVAR hid_t H5T_NATIVE_UINT_FAST64_g; -/* Operations defined on all data types */ +/* Operations defined on all datatypes */ H5_DLL hid_t H5Topen(hid_t loc_id, const char *name); H5_DLL hid_t H5Tcreate(H5T_class_t type, size_t size); H5_DLL hid_t H5Tcopy(hid_t type_id); @@ -478,12 +478,12 @@ H5_DLL herr_t H5Tlock(hid_t type_id); H5_DLL herr_t H5Tcommit(hid_t loc_id, const char *name, hid_t type_id); H5_DLL htri_t H5Tcommitted(hid_t type_id); -/* Operations defined on compound data types */ +/* Operations defined on compound datatypes */ H5_DLL herr_t H5Tinsert(hid_t parent_id, const char *name, size_t offset, hid_t member_id); H5_DLL herr_t H5Tpack(hid_t type_id); -/* Operations defined on enumeration data types */ +/* Operations defined on enumeration datatypes */ H5_DLL hid_t H5Tenum_create(hid_t base_id); H5_DLL herr_t H5Tenum_insert(hid_t type, const char *name, void *value); H5_DLL herr_t H5Tenum_nameof(hid_t type, void *value, char *name/*out*/, @@ -491,16 +491,16 @@ H5_DLL herr_t H5Tenum_nameof(hid_t type, void *value, char *name/*out*/, H5_DLL herr_t H5Tenum_valueof(hid_t type, const char *name, void *value/*out*/); -/* Operations defined on variable-length data types */ +/* Operations defined on variable-length datatypes */ H5_DLL hid_t H5Tvlen_create(hid_t base_id); -/* Operations defined on array data types */ +/* Operations defined on array datatypes */ H5_DLL hid_t H5Tarray_create(hid_t base_id, int ndims, const hsize_t dim[/* ndims */], const int perm[/* ndims */]); H5_DLL int H5Tget_array_ndims(hid_t type_id); H5_DLL int H5Tget_array_dims(hid_t type_id, hsize_t dims[], int perm[]); -/* Operations defined on opaque data types */ +/* Operations defined on opaque datatypes */ H5_DLL herr_t H5Tset_tag(hid_t type, const char *tag); H5_DLL char *H5Tget_tag(hid_t type); diff --git a/src/H5Tstrpad.c b/src/H5Tstrpad.c index c9e23f4..6848298 100644 --- a/src/H5Tstrpad.c +++ b/src/H5Tstrpad.c @@ -19,13 +19,15 @@ #define H5T_PACKAGE /*suppress error about including H5Tpkg */ -#include "H5private.h" /*generic functions */ -#include "H5Eprivate.h" /*error handling */ -#include "H5Iprivate.h" /*ID functions */ -#include "H5Tpkg.h" /*data-type functions */ - +/* Pablo information */ +/* (Put before include files to avoid problems with inline functions) */ #define PABLO_MASK H5Tstrpad_mask +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Tpkg.h" /* Datatypes */ + /* Interface initialization */ static int interface_initialize_g = 0; #define INTERFACE_INIT H5T_init_strpad_interface @@ -48,9 +50,9 @@ DESCRIPTION static herr_t H5T_init_strpad_interface(void) { - FUNC_ENTER_NOINIT(H5T_init_strpad_interface); + FUNC_ENTER_NOINIT(H5T_init_strpad_interface) - FUNC_LEAVE_NOAPI(H5T_init()); + FUNC_LEAVE_NOAPI(H5T_init()) } /* H5T_init_strpad_interface() */ @@ -71,7 +73,7 @@ H5T_init_strpad_interface(void) * * Modifications: * Robb Matzke, 22 Dec 1998 - * Also works for derived data types. + * Also works for derived datatypes. * *------------------------------------------------------------------------- */ @@ -81,27 +83,25 @@ H5Tget_strpad(hid_t type_id) H5T_t *dt = NULL; H5T_str_t ret_value; - FUNC_ENTER_API(H5Tget_strpad, H5T_STR_ERROR); + FUNC_ENTER_API(H5Tget_strpad, H5T_STR_ERROR) H5TRACE1("Tz","i",type_id); /* Check args */ if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_STR_ERROR, "not a data type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_STR_ERROR, "not a datatype") while (dt->parent && !H5T_IS_STRING(dt)) dt = dt->parent; /*defer to parent*/ if (!H5T_IS_STRING(dt)) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5T_STR_ERROR, "operation not defined for data type class"); + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_STR_ERROR, "operation not defined for datatype class") /* result */ - if(H5T_STRING == dt->type) + if(H5T_IS_FIXED_STRING(dt)) ret_value = dt->u.atomic.u.s.pad; - else if(H5T_VLEN == dt->type && H5T_VLEN_STRING == dt->u.vlen.type) - ret_value = dt->u.vlen.pad; else - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, H5T_STR_ERROR, "can't get strpad info"); + ret_value = dt->u.vlen.pad; done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } @@ -130,7 +130,7 @@ done: * * Modifications: * Robb Matzke, 22 Dec 1998 - * Also works for derived data types. + * Also works for derived datatypes. * *------------------------------------------------------------------------- */ @@ -140,30 +140,28 @@ H5Tset_strpad(hid_t type_id, H5T_str_t strpad) H5T_t *dt = NULL; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Tset_strpad, FAIL); + FUNC_ENTER_API(H5Tset_strpad, FAIL) H5TRACE2("e","iTz",type_id,strpad); /* Check args */ if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if (H5T_STATE_TRANSIENT!=dt->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only"); + HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only") if (strpad < 0 || strpad >= H5T_NSTR) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal string pad type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal string pad type") while (dt->parent && !H5T_IS_STRING(dt)) dt = dt->parent; /*defer to parent*/ if (!H5T_IS_STRING(dt)) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for data type class"); + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for datatype class") /* Commit */ - if(H5T_STRING == dt->type) + if(H5T_IS_FIXED_STRING(dt)) dt->u.atomic.u.s.pad = strpad; - else if(H5T_VLEN == dt->type && H5T_VLEN_STRING == dt->u.vlen.type) - dt->u.vlen.pad = strpad; else - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, H5T_STR_ERROR, "can't set strpad info"); + dt->u.vlen.pad = strpad; done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index 5cc738a..e74bca7 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -70,10 +70,10 @@ H5T_init_vlen_interface(void) /*------------------------------------------------------------------------- * Function: H5Tvlen_create * - * Purpose: Create a new variable-length data type based on the specified + * Purpose: Create a new variable-length datatype based on the specified * BASE_TYPE. * - * Return: Success: ID of new VL data type + * Return: Success: ID of new VL datatype * * Failure: Negative * @@ -87,8 +87,8 @@ H5T_init_vlen_interface(void) hid_t H5Tvlen_create(hid_t base_id) { - H5T_t *base = NULL; /*base data type */ - H5T_t *dt = NULL; /*new data type */ + H5T_t *base = NULL; /*base datatype */ + H5T_t *dt = NULL; /*new datatype */ hid_t ret_value; /*return value */ FUNC_ENTER_API(H5Tvlen_create, FAIL) @@ -114,10 +114,10 @@ done: /*------------------------------------------------------------------------- * Function: H5T_vlen_create * - * Purpose: Create a new variable-length data type based on the specified + * Purpose: Create a new variable-length datatype based on the specified * BASE_TYPE. * - * Return: Success: new VL data type + * Return: Success: new VL datatype * * Failure: NULL * @@ -131,7 +131,7 @@ done: H5T_t * H5T_vlen_create(const H5T_t *base) { - H5T_t *dt = NULL; /*new VL data type */ + H5T_t *dt = NULL; /*new VL datatype */ H5T_t *ret_value; /*return value */ FUNC_ENTER_NOINIT(H5T_vlen_create) @@ -843,7 +843,7 @@ H5T_vlen_reclaim(void *elem, hid_t type_id, hsize_t UNUSED ndim, hssize_t UNUSED /* Check args */ if (NULL==(dt=H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Get the free func & information */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) diff --git a/src/hdf5.lnt b/src/hdf5.lnt index 7be2fa1..e135ce5 100755 --- a/src/hdf5.lnt +++ b/src/hdf5.lnt @@ -91,6 +91,8 @@ H5FL.c H5FO.c + H5Tprecis.c + H5Tstrpad.c H5Tvlen.c H5V.c H5Z.c |