diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2007-11-24 16:49:36 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2007-11-24 16:49:36 (GMT) |
commit | 2f36ea99d4ad1b036d377719e49eaab2dec64444 (patch) | |
tree | 63be7c282767004339c49aa0e738e6a62630c280 /src/H5SL.c | |
parent | 083357dad3334473507a97e17593a9d68e42d69f (diff) | |
download | hdf5-2f36ea99d4ad1b036d377719e49eaab2dec64444.zip hdf5-2f36ea99d4ad1b036d377719e49eaab2dec64444.tar.gz hdf5-2f36ea99d4ad1b036d377719e49eaab2dec64444.tar.bz2 |
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'src/H5SL.c')
-rw-r--r-- | src/H5SL.c | 42 |
1 files changed, 37 insertions, 5 deletions
@@ -99,19 +99,27 @@ /* Define a code template for comparing scalar keys for the "CMP" in the H5SL_LOCATE macro */ #define H5SL_LOCATE_SCALAR_CMP(TYPE,PKEY1,PKEY2) \ - (*(TYPE *)PKEY1<*(TYPE *)PKEY2) + (*(TYPE *)PKEY1 < *(TYPE *)PKEY2) /* Define a code template for comparing string keys for the "CMP" in the H5SL_LOCATE macro */ #define H5SL_LOCATE_STRING_CMP(TYPE,PKEY1,PKEY2) \ - (HDstrcmp(PKEY1,PKEY2)<0) + (HDstrcmp(PKEY1, PKEY2) < 0) + +/* Define a code template for comparing H5_obj_t keys for the "CMP" in the H5SL_LOCATE macro */ +#define H5SL_LOCATE_OBJ_CMP(TYPE,PKEY1,PKEY2) \ + ((((TYPE *)PKEY1)->fileno < ((TYPE *)PKEY2)->fileno) ? TRUE : (((TYPE *)PKEY1)->addr < ((TYPE *)PKEY2)->addr)) /* Define a code template for comparing scalar keys for the "EQ" in the H5SL_LOCATE macro */ #define H5SL_LOCATE_SCALAR_EQ(TYPE,PKEY1,PKEY2) \ - (*(TYPE *)PKEY1==*(TYPE *)PKEY2) + (*(TYPE *)PKEY1 == *(TYPE *)PKEY2) /* Define a code template for comparing string keys for the "EQ" in the H5SL_LOCATE macro */ #define H5SL_LOCATE_STRING_EQ(TYPE,PKEY1,PKEY2) \ - (HDstrcmp(PKEY1,PKEY2)==0) + (HDstrcmp(PKEY1, PKEY2) == 0) + +/* Define a code template for comparing H5_obj_ keys for the "EQ" in the H5SL_LOCATE macro */ +#define H5SL_LOCATE_OBJ_EQ(TYPE,PKEY1,PKEY2) \ + ((((TYPE *)PKEY1)->fileno == ((TYPE *)PKEY2)->fileno) && (((TYPE *)PKEY1)->addr == ((TYPE *)PKEY2)->addr)) /* Macro used to find node for operation */ #define H5SL_LOCATE(OP,DOUPDATE,CMP,SLIST,X,UPDATE,I,TYPE,KEY,CHECKED) \ @@ -378,6 +386,10 @@ H5SL_insert_common(H5SL_t *slist, void *item, const void *key) case H5SL_TYPE_SIZE: H5SL_INSERT(SCALAR, slist, x, update, i, const size_t, key, checked) break; + + case H5SL_TYPE_OBJ: + H5SL_INSERT(OBJ, slist, x, update, i, const H5_obj_t, key, checked) + break; } /* end switch */ /* 'key' must not have been found in existing list, if we get here */ @@ -571,7 +583,7 @@ H5SL_create(H5SL_type_t type, double p, size_t max_level) /* Check args */ HDassert(p>0.0 && p<1.0); HDassert(max_level>0 && max_level<=H5SL_LEVEL_MAX); - HDassert(type>=H5SL_TYPE_INT && type<=H5SL_TYPE_SIZE); + HDassert(type>=H5SL_TYPE_INT && type<=H5SL_TYPE_OBJ); /* Allocate skip list structure */ if((new_slist=H5FL_MALLOC(H5SL_t))==NULL) @@ -808,6 +820,10 @@ H5SL_remove(H5SL_t *slist, const void *key) case H5SL_TYPE_SIZE: H5SL_REMOVE(SCALAR, slist, x, update, i, const size_t, key, checked) break; + + case H5SL_TYPE_OBJ: + H5SL_REMOVE(OBJ, slist, x, update, i, const H5_obj_t, key, checked) + break; } /* end switch */ done: @@ -955,6 +971,10 @@ H5SL_search(H5SL_t *slist, const void *key) case H5SL_TYPE_SIZE: H5SL_SEARCH(SCALAR, slist, x, -, i, const size_t, key, checked) break; + + case H5SL_TYPE_OBJ: + H5SL_SEARCH(OBJ, slist, x, -, i, const H5_obj_t, key, checked) + break; } /* end switch */ /* 'key' must not have been found in list, if we get here */ @@ -1034,6 +1054,10 @@ H5SL_less(H5SL_t *slist, const void *key) case H5SL_TYPE_SIZE: H5SL_SEARCH(SCALAR, slist, x, -, i, const size_t, key, checked) break; + + case H5SL_TYPE_OBJ: + H5SL_SEARCH(OBJ, slist, x, -, i, const H5_obj_t, key, checked) + break; } /* end switch */ /* An exact match for 'key' must not have been found in list, if we get here */ @@ -1126,6 +1150,10 @@ H5SL_greater(H5SL_t *slist, const void *key) case H5SL_TYPE_SIZE: H5SL_SEARCH(SCALAR, slist, x, -, i, const size_t, key, checked) break; + + case H5SL_TYPE_OBJ: + H5SL_SEARCH(OBJ, slist, x, -, i, const H5_obj_t, key, checked) + break; } /* end switch */ /* An exact match for 'key' must not have been found in list, if we get here */ @@ -1208,6 +1236,10 @@ H5SL_find(H5SL_t *slist, const void *key) case H5SL_TYPE_SIZE: H5SL_FIND(SCALAR, slist, x, -, i, const size_t, key, checked) break; + + case H5SL_TYPE_OBJ: + H5SL_FIND(OBJ, slist, x, -, i, const H5_obj_t, key, checked) + break; } /* end switch */ /* 'key' must not have been found in list, if we get here */ |