summaryrefslogtreecommitdiffstats
path: root/src/H5T.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1997-12-11 21:35:46 (GMT)
committerRobb Matzke <matzke@llnl.gov>1997-12-11 21:35:46 (GMT)
commitfaca6fbaa8c557b18d6b264841fc8717d1e73816 (patch)
tree2123e6290a24e6ad94c776e45283800cc6917f92 /src/H5T.c
parent3c16901751f40fcbbf36878fe13b0237a3753bc9 (diff)
downloadhdf5-faca6fbaa8c557b18d6b264841fc8717d1e73816.zip
hdf5-faca6fbaa8c557b18d6b264841fc8717d1e73816.tar.gz
hdf5-faca6fbaa8c557b18d6b264841fc8717d1e73816.tar.bz2
[svn-r145] ./src/H5Osdtyp.c -> H5Odtype.c
./src/H5Osdim.c -> H5Osdspace.c ./src/Makefile.in Changed the names of these files to better reflect what they actually do. ./src/H5.c ./src/H5AC.c ./src/H5B.c ./src/H5C.c ./src/H5D.c ./src/H5E.c ./src/H5Eprivate.h ./src/H5Epublic.h ./src/H5F.c ./src/H5Fcore.c ./src/H5Ffamily.c ./src/H5Fistore.c ./src/H5Flow.c ./src/H5Fsec2.c ./src/H5Fsplit.c ./src/H5Fstdio.c ./src/H5G.c ./src/H5Gent.c ./src/H5Gnode.c ./src/H5Gshad.c ./src/H5Gstab.c ./src/H5H.c ./src/H5M.c ./src/H5MF.c ./src/H5O.c ./src/H5Osdtyp.c (./src/H5Odtype.c) ./src/H5P.c ./src/H5T.c ./src/H5detect.c ./src/H5private.h Added an argument to the HRETURN_ERROR(), HGOTO_ERROR(), and HERROR() macros which is a string error message. This allows us to give extra information which can't be represented by the major and minor error numbers. This information was previously in comments just before or after the macro call. The string isn't currently used, but I'm planning to change the test files so they print an error trace when something fails. This should make debugging a little faster since it's often obvious what's wrong if we could just see the error stack without even having to start a debugger.
Diffstat (limited to 'src/H5T.c')
-rw-r--r--src/H5T.c61
1 files changed, 31 insertions, 30 deletions
diff --git a/src/H5T.c b/src/H5T.c
index cc19d1a..2618f14 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -120,18 +120,18 @@ H5Tcreate (H5T_class_t type, size_t size)
/* check args */
if (size<=0) {
- HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL); /*invalid size*/
+ HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid size");
}
/* create the type */
if (NULL==(dt=H5T_create (type, size))) {
- HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL);/*can't create type*/
+ HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't create type");
}
/* Make it an atom */
if ((ret_value=H5Aregister_atom (H5_DATATYPE, dt))<0) {
- /* Can't register data type atom */
- HRETURN_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, FAIL);
+ HRETURN_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, FAIL,
+ "can't register data type atom");
}
FUNC_LEAVE (ret_value);
@@ -169,16 +169,16 @@ H5T_create (H5T_class_t type, size_t size)
case H5T_FIXED:
/* Default type is a native `int' */
if (NULL==(dt=H5T_copy (H5Aatom_object (H5T_NATIVE_INT)))) {
- /* Can't derive type from native int */
- HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, NULL);
+ HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, NULL,
+ "can't derive type from native int");
}
break;
case H5T_FLOAT:
/* Default type is a native `double' */
if (NULL==(dt=H5T_copy (H5Aatom_object (H5T_NATIVE_DOUBLE)))) {
- /* Can't derive type from native double */
- HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, NULL);
+ HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, NULL,
+ "can't derive type from native double");
}
break;
@@ -187,7 +187,8 @@ H5T_create (H5T_class_t type, size_t size)
case H5T_BITFIELD:
case H5T_OPAQUE:
assert ("not implemented yet" && 0);
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, NULL);
+ HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, NULL,
+ "not implemented yet");
case H5T_COMPOUND:
dt = H5MM_xcalloc (1, sizeof(H5T_t));
@@ -195,8 +196,8 @@ H5T_create (H5T_class_t type, size_t size)
break;
default:
- /* Unknown data type class */
- HRETURN_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, NULL);
+ HRETURN_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, NULL,
+ "unknown data type class");
}
dt->size = size;
@@ -236,7 +237,7 @@ H5Tget_num_members (hid_t type_id)
if (H5_DATATYPE!=H5Aatom_group (type_id) ||
NULL==(dt=H5Aatom_object (type_id)) ||
H5T_COMPOUND!=dt->type) {
- HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a compound data type*/
+ HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound data type");
}
FUNC_LEAVE (dt->u.compnd.nmembs);
@@ -271,7 +272,7 @@ H5Tget_class (hid_t type_id)
/* Check args */
if (H5_DATATYPE!=H5Aatom_group (type_id) ||
NULL==(dt=H5Aatom_object (type_id))) {
- HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a data type*/
+ HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
}
FUNC_LEAVE (dt->type);
@@ -309,7 +310,7 @@ H5Tget_size (hid_t type_id)
/* Check args */
if (H5_DATATYPE!=H5Aatom_group (type_id) ||
NULL==(dt=H5Aatom_object (type_id))) {
- HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a data type*/
+ HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
}
/* size */
@@ -391,23 +392,23 @@ H5Tinsert_member (hid_t parent_id, const char *name, off_t offset,
if (H5_DATATYPE!=H5Aatom_group (parent_id) ||
NULL==(parent=H5Aatom_object (parent_id)) ||
H5T_COMPOUND!=parent->type) {
- HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a compound data type*/
+ HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound data type");
}
if (parent->locked) {
- HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL); /*parent is locked*/
+ HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "parent is locked");
}
if (!name || !*name) {
- HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL); /*no member name*/
+ HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no member name");
}
if (H5_DATATYPE!=H5Aatom_group (member_id) ||
NULL==(member=H5Aatom_object (member_id)) ||
H5T_COMPOUND==member->type) {
- HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not an atomic data type*/
+ HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type");
}
if (H5T_insert_member (parent, name, offset, member)<0) {
- /* Can't insert member. */
- HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINSERT, FAIL);
+ HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINSERT, FAIL,
+ "can't insert member");
}
FUNC_LEAVE (SUCCEED);
@@ -451,8 +452,8 @@ H5T_insert_member (H5T_t *parent, const char *name, off_t offset,
/* Does NAME already exist in PARENT? */
for (i=0; i<parent->u.compnd.nmembs; i++) {
if (!HDstrcmp (parent->u.compnd.memb[i].name, name)) {
- /* Member name is not unique */
- HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINSERT, FAIL);
+ HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINSERT, FAIL,
+ "member name is not unique");
}
}
@@ -507,19 +508,19 @@ H5Tcopy (hid_t type_id)
/* check args */
if (H5_DATATYPE!=H5Aatom_group (type_id) ||
NULL==(dt=H5Aatom_object (type_id))) {
- HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a data type*/
+ HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
}
/* copy */
if (NULL==(new_dt = H5T_copy (dt))) {
- HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL); /*can't copy*/
+ HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't copy");
}
/* atomize result */
if ((ret_value=H5Aregister_atom (H5_DATATYPE, new_dt))<0) {
H5T_close (new_dt);
- /* Can't register data type atom */
- HRETURN_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, FAIL);
+ HRETURN_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, FAIL,
+ "can't register data type atom");
}
FUNC_LEAVE (ret_value);
@@ -602,15 +603,15 @@ H5Tclose (hid_t type_id)
/* check args */
if (H5_DATATYPE!=H5Aatom_group (type_id) ||
NULL==(dt=H5Aatom_object (type_id))) {
- HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a data type*/
+ HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
}
if (dt->locked) {
- HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL); /*predefined data type*/
+ HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "predefined data type");
}
/* When the reference count reaches zero the resources are freed */
if (H5A_dec_ref (type_id)<0) {
- HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, FAIL); /*problem freeing id*/
+ HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, FAIL, "problem freeing id");
}
FUNC_LEAVE (SUCCEED);
@@ -691,7 +692,7 @@ H5Tequal (hid_t type1_id, hid_t type2_id)
NULL==(dt1=H5Aatom_object (type1_id)) ||
H5_DATATYPE!=H5Aatom_group (type2_id) ||
NULL==(dt2=H5Aatom_object (type2_id))) {
- HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a data type*/
+ HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
}
ret_value = (0==H5T_cmp (dt1, dt2));