diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 1997-08-28 17:14:35 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 1997-08-28 17:14:35 (GMT) |
commit | a39e0ef324c57105c09e84f4aee878595a320a41 (patch) | |
tree | 401eaf34c9864657784d486b79c2cae1da1b0614 | |
parent | e8d5c25431dd926d04f35cc06ab2027db86869cf (diff) | |
download | hdf5-a39e0ef324c57105c09e84f4aee878595a320a41.zip hdf5-a39e0ef324c57105c09e84f4aee878595a320a41.tar.gz hdf5-a39e0ef324c57105c09e84f4aee878595a320a41.tar.bz2 |
[svn-r47] Finished flashing out the H5M* functions calls. Cleaned up non-compiling
source. Finished adding in remainder of H5Osdtyp.c functions.
-rw-r--r-- | src/H5D.c | 17 | ||||
-rw-r--r-- | src/H5G.c | 8 | ||||
-rw-r--r-- | src/H5Gnode.c | 10 | ||||
-rw-r--r-- | src/H5Gprivate.h | 8 | ||||
-rw-r--r-- | src/H5M.c | 407 | ||||
-rw-r--r-- | src/H5Mpublic.h | 9 | ||||
-rw-r--r-- | src/H5Osdim.c | 111 | ||||
-rw-r--r-- | src/H5Osdtyp.c | 18 | ||||
-rw-r--r-- | src/Makefile | 253 | ||||
-rw-r--r-- | src/Makefile.in | 2 |
10 files changed, 664 insertions, 179 deletions
@@ -34,6 +34,9 @@ static char RcsId[] = "@(#)$Revision$"; #include <H5private.h> /* Generic Functions */ #include <H5Aprivate.h> /* Atoms */ +#include <H5Gprivate.h> /* Groups */ +#include <H5Oprivate.h> /* Object Headers */ +#include <H5Mprivate.h> /* Meta-Object API */ #include <H5Dprivate.h> /* Dataset functions */ #include <H5Eprivate.h> /* Error handling */ #include <H5Mprivate.h> /* Meta data */ @@ -299,21 +302,9 @@ herr_t H5D_flush(hatom_t oid) if(dset_parent!=H5_FILE || (dset_parent==H5_FILE && root_type==H5F_ROOT_DIRECTORY)) { - uintn namelen; /* length of parent directory's name */ - char *name; /* pointer to parent directory's name */ - - /* Get the name of the parent directory */ - if((namelen=H5Mname_len(dataset->parent))==UFAIL) - HGOTO_ERROR(H5E_DIRECTORY, H5E_BADVALUE, FAIL); - if((name=HDmalloc(namelen+1))==NULL); - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL); - if(H5Mget_name(dataset->parent,name)==FAIL) - HGOTO_ERROR(H5E_DIRECTORY, H5E_NOTFOUND, FAIL); - /* Insert the dataset into the parent directory */ - if(H5G_insert (file, NULL, name, dataset->name, &d_sym)==FAIL) + if(H5G_insert (file, NULL, NULL, dataset->name, &d_sym)==FAIL) HGOTO_ERROR(H5E_DIRECTORY, H5E_CANTINSERT, FAIL); - HDfree(name); } /* end if */ else /* insert dataset as root-object, or into root-directory */ { @@ -1117,7 +1117,9 @@ H5G_decode (hdf5_file_t *f, uint8 **pp, H5G_entry_t *ent) break; case H5G_CACHED_SDATA: - UINT32DECODE (*pp, ent->cache.sdata.nt); + ent->cache.sdata.nt.length= *(*pp)++; + ent->cache.sdata.nt.arch= *(*pp)++; + UINT16DECODE (*pp, ent->cache.sdata.nt.type); UINT32DECODE (*pp, ent->cache.sdata.ndim); UINT32DECODE (*pp, ent->cache.sdata.dim[0]); UINT32DECODE (*pp, ent->cache.sdata.dim[1]); @@ -1228,7 +1230,9 @@ H5G_encode (hdf5_file_t *f, uint8 **pp, H5G_entry_t *ent) break; case H5G_CACHED_SDATA: - UINT32ENCODE (*pp, ent->cache.sdata.nt); + *(*pp)++= ent->cache.sdata.nt.length; + *(*pp)++= ent->cache.sdata.nt.arch; + UINT16ENCODE (*pp, ent->cache.sdata.nt.type); UINT32ENCODE (*pp, ent->cache.sdata.ndim); UINT32ENCODE (*pp, ent->cache.sdata.dim[0]); UINT32ENCODE (*pp, ent->cache.sdata.dim[1]); diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 797eb5c..dd3e832 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -926,8 +926,14 @@ H5G_node_debug (hdf5_file_t *f, haddr_t addr, FILE *stream, intn indent, case H5G_CACHED_SDATA: fprintf (stream, "S-data\n"); fprintf (stream, "%*s%-*s %u\n", indent, "", fwidth, - "Number type:", - (unsigned)(sn->entry[i].cache.sdata.nt)); + "Number type length:", + (unsigned)(sn->entry[i].cache.sdata.nt.length)); + fprintf (stream, "%*s%-*s %u\n", indent, "", fwidth, + "Number type architecture:", + (unsigned)(sn->entry[i].cache.sdata.nt.arch)); + fprintf (stream, "%*s%-*s %u\n", indent, "", fwidth, + "Number type type:", + (unsigned)(sn->entry[i].cache.sdata.nt.type)); fprintf (stream, "%*s%-*s %u\n", indent, "", fwidth, "Dimensionality:", (unsigned)(sn->entry[i].cache.sdata.ndim)); diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index e0794b0..945291e 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -35,6 +35,7 @@ 4 + /*entry type */ \ 24) /*scratch pad space */ +#define H5G_DEFAULT_ROOT_SIZE 32 /* * Various types of object header information can be cached in a symbol @@ -61,7 +62,11 @@ typedef struct H5G_entry_t { union { struct { - uint32 nt; /*number type */ + struct { + uint8 length; + uint8 arch; + uint16 type; + }nt ; /*number type */ uint32 ndim; /*number of dimensions */ uint32 dim[4]; /*dimension sizes */ } sdata; @@ -143,6 +148,7 @@ herr_t H5G_insert (hdf5_file_t *f, H5G_entry_t *cwd, H5G_entry_t *dir_ent, const char *name, H5G_entry_t *ent); herr_t H5G_modify (hdf5_file_t *f, H5G_entry_t *cwd, H5G_entry_t *dir_ent, const char *name, H5G_entry_t *ent); +herr_t H5G_set_root (hdf5_file_t *f, const char *name, H5G_entry_t *ent); /* functions that understand symbol tables */ haddr_t H5G_stab_new (hdf5_file_t *f, H5G_entry_t *self, size_t init); @@ -24,8 +24,18 @@ static char RcsId[] = "@(#)$Revision$"; EXPORTED ROUTINES H5Mcreate -- Create an object + H5Maccess -- Start access to an existing object H5Mcopy -- Copy an object + H5Mfind_name -- Find an object by name + H5Mname_len -- Get the length of an object's name + H5Mget_name -- Get an object's name + H5Mset_name -- Set an object's name + H5Msearch -- Wildcard search for an object by name + H5Mindex -- Get an object by index + H5Mflush -- Flush an object out to disk + H5Mdelete -- Delete an object from disk H5Mget_file -- Get the file ID for an object + H5Mget_file -- Get the parent ID for an object H5Mrelease -- Release access to an object LIBRARY-SCOPED ROUTINES @@ -236,6 +246,48 @@ done: FUNC_LEAVE(ret_value); } /* end H5Mcreate() */ +/*-------------------------------------------------------------------------- + NAME + H5Maccess + PURPOSE + Start access to an existing HDF5 object. + USAGE + hatom_t H5Maccess(owner_id) + hatom_t oid; IN: OID of the object to access. + RETURNS + Returns ID (atom) on success, FAIL on failure + DESCRIPTION + This function re-directs the object's access into the appropriate + interface, as defined by the function pointers in hdf5fptr.h +--------------------------------------------------------------------------*/ +hatom_t H5Maccess(hatom_t oid) +{ + group_t group=H5Aatom_group(oid); /* Atom group for incoming object */ + intn i; /* local counting variable */ + hatom_t ret_value = SUCCEED; + + FUNC_ENTER(H5Maccess, H5M_init_interface, FAIL); + + /* Clear errors and check args and all the boring stuff. */ + H5ECLEAR; + if(group<=BADGROUP || group>=MAXGROUP) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); + + i=H5M_find_type(group); + if(meta_func_arr[i].access==NULL) + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + ret_value=meta_func_arr[i].access(oid); + +done: + if(ret_value == FAIL) + { /* Error condition cleanup */ + + } /* end if */ + + /* Normal function cleanup */ + + FUNC_LEAVE(ret_value); +} /* end H5Maccess() */ /*-------------------------------------------------------------------------- NAME @@ -282,11 +334,277 @@ done: /*-------------------------------------------------------------------------- NAME + H5Mfind_name + PURPOSE + Find an HDF5 object by name. + USAGE + hatom_t H5Mfind_name(owner_id, type, name) + hatom_t owner_id; IN: Group/file in which to search + hobjtype_t type; IN: Type of object to search names of + const char *name; IN: Name of the object to search for + RETURNS + Returns ID (atom) on success, FAIL on failure + DESCRIPTION + This function re-directs the object's "find name" into the appropriate + interface, as defined by the function pointers in hdf5fptr.h +--------------------------------------------------------------------------*/ +hatom_t H5Mfind_name(hatom_t owner_id, hobjtype_t type, const char *name) +{ + group_t group=H5Aatom_group(owner_id); /* Atom group for incoming object */ + intn i; /* local counting variable */ + hatom_t ret_value = SUCCEED; + + FUNC_ENTER(H5Mfind_name, H5M_init_interface, FAIL); + + /* Clear errors and check args and all the boring stuff. */ + H5ECLEAR; + if(group<=BADGROUP || group>=MAXGROUP) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); + + i=H5M_find_type(group); + if(meta_func_arr[i].find_name==NULL) + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + ret_value=meta_func_arr[i].find_name(owner_id,type,name); + +done: + if(ret_value == FAIL) + { /* Error condition cleanup */ + + } /* end if */ + + /* Normal function cleanup */ + + FUNC_LEAVE(ret_value); +} /* end H5Mfind_name() */ + +/*-------------------------------------------------------------------------- + NAME + H5Mname_len + PURPOSE + Determine the length of the name of an HDF5 object. + USAGE + uint32 H5Mname_len(oid) + hatom_t oid; IN: Object to get name's length + RETURNS + SUCCEED/FAIL + DESCRIPTION + This function re-directs the object's "name length" into the appropriate + interface, as defined by the function pointers in hdf5fptr.h +--------------------------------------------------------------------------*/ +uint32 H5Mname_len(hatom_t oid) +{ + group_t group=H5Aatom_group(oid); /* Atom group for incoming object */ + intn i; /* local counting variable */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER(H5Mname_len, H5M_init_interface, FAIL); + + /* Clear errors and check args and all the boring stuff. */ + H5ECLEAR; + if(group<=BADGROUP || group>=MAXGROUP) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); + + i=H5M_find_type(group); + if(meta_func_arr[i].name_len==NULL) + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + ret_value=meta_func_arr[i].name_len(oid); + +done: + if(ret_value == FAIL) + { /* Error condition cleanup */ + + } /* end if */ + + /* Normal function cleanup */ + + FUNC_LEAVE(ret_value); +} /* end H5Mname_len() */ + +/*-------------------------------------------------------------------------- + NAME + H5Mget_name + PURPOSE + Get the name of an HDF5 object. + USAGE + herr_t H5Mget_name(oid, name) + hatom_t oid; IN: Object to retreive name of + char *name; OUT: Buffer to place object's name in + RETURNS + SUCCEED/FAIL + DESCRIPTION + This function re-directs the object's "get name" into the appropriate + interface, as defined by the function pointers in hdf5fptr.h +--------------------------------------------------------------------------*/ +herr_t H5Mget_name(hatom_t oid, char *name) +{ + group_t group=H5Aatom_group(oid); /* Atom group for incoming object */ + intn i; /* local counting variable */ + hatom_t ret_value = SUCCEED; + + FUNC_ENTER(H5Mget_name, H5M_init_interface, FAIL); + + /* Clear errors and check args and all the boring stuff. */ + H5ECLEAR; + if(group<=BADGROUP || group>=MAXGROUP) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); + + i=H5M_find_type(group); + if(meta_func_arr[i].get_name==NULL) + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + ret_value=meta_func_arr[i].get_name(oid,name); + +done: + if(ret_value == FAIL) + { /* Error condition cleanup */ + + } /* end if */ + + /* Normal function cleanup */ + + FUNC_LEAVE(ret_value); +} /* end H5Mget_name() */ + +/*-------------------------------------------------------------------------- + NAME + H5Mset_name + PURPOSE + Set the name of an HDF5 object. + USAGE + herr_t H5Mget_name(oid, name) + hatom_t oid; IN: Object to set name of + const char *name; IN: Name to use for object + RETURNS + SUCCEED/FAIL + DESCRIPTION + This function re-directs the object's "set name" into the appropriate + interface, as defined by the function pointers in hdf5fptr.h +--------------------------------------------------------------------------*/ +herr_t H5Mset_name(hatom_t oid, const char *name) +{ + group_t group=H5Aatom_group(oid); /* Atom group for incoming object */ + intn i; /* local counting variable */ + hatom_t ret_value = SUCCEED; + + FUNC_ENTER(H5Mset_name, H5M_init_interface, FAIL); + + /* Clear errors and check args and all the boring stuff. */ + H5ECLEAR; + if(group<=BADGROUP || group>=MAXGROUP) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); + + i=H5M_find_type(group); + if(meta_func_arr[i].set_name==NULL) + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + ret_value=meta_func_arr[i].set_name(oid,name); + +done: + if(ret_value == FAIL) + { /* Error condition cleanup */ + + } /* end if */ + + /* Normal function cleanup */ + + FUNC_LEAVE(ret_value); +} /* end H5Mset_name() */ + +/*-------------------------------------------------------------------------- + NAME + H5Msearch + PURPOSE + Wildcard search for an HDF5 object by name. + USAGE + hatom_t H5Mfind_name(owner_id, type, name) + hatom_t owner_id; IN: Group/file in which to search + hobjtype_t type; IN: Type of object to search names of + const char *name; IN: Name of the object to search for + RETURNS + Returns ID (atom) on success, FAIL on failure + DESCRIPTION + This function re-directs the object's "search" into the appropriate + interface, as defined by the function pointers in hdf5fptr.h +--------------------------------------------------------------------------*/ +hatom_t H5Msearch(hatom_t oid, hobjtype_t type, const char *name) +{ + group_t group=H5Aatom_group(oid); /* Atom group for incoming object */ + intn i; /* local counting variable */ + hatom_t ret_value = SUCCEED; + + FUNC_ENTER(H5Msearch, H5M_init_interface, FAIL); + + /* Clear errors and check args and all the boring stuff. */ + H5ECLEAR; + if(group<=BADGROUP || group>=MAXGROUP) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); + + i=H5M_find_type(group); + if(meta_func_arr[i].search==NULL) + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + ret_value=meta_func_arr[i].search(oid,type,name); + +done: + if(ret_value == FAIL) + { /* Error condition cleanup */ + + } /* end if */ + + /* Normal function cleanup */ + + FUNC_LEAVE(ret_value); +} /* end H5Msearch() */ + +/*-------------------------------------------------------------------------- + NAME + H5Mindex + PURPOSE + Get an HDF5 object by index. + USAGE + hatom_t H5Mindex(oid, type, idx) + hatom_t oid; IN: Group/file in which to find items + hobjtype_t type; IN: Type of object to get + uint32 idx; IN: Index of the object to get + RETURNS + Returns ID (atom) on success, FAIL on failure + DESCRIPTION + This function re-directs the object's "index" into the appropriate + interface, as defined by the function pointers in hdf5fptr.h +--------------------------------------------------------------------------*/ +hatom_t H5Mindex(hatom_t oid, hobjtype_t type, uint32 idx) +{ + group_t group=H5Aatom_group(oid); /* Atom group for incoming object */ + intn i; /* local counting variable */ + hatom_t ret_value = SUCCEED; + + FUNC_ENTER(H5Mindex, H5M_init_interface, FAIL); + + /* Clear errors and check args and all the boring stuff. */ + H5ECLEAR; + if(group<=BADGROUP || group>=MAXGROUP) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); + + i=H5M_find_type(group); + if(meta_func_arr[i].index==NULL) + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + ret_value=meta_func_arr[i].index(oid,type,idx); + +done: + if(ret_value == FAIL) + { /* Error condition cleanup */ + + } /* end if */ + + /* Normal function cleanup */ + + FUNC_LEAVE(ret_value); +} /* end H5Mindex() */ + +/*-------------------------------------------------------------------------- + NAME H5Mflush PURPOSE Flush an HDF5 object out to a file. USAGE - hatom_t H5Mget_file(oid) + hatom_t H5Mflush(oid) hatom_t oid; IN: Object to flush RETURNS SUCCEED/FAIL @@ -325,6 +643,93 @@ done: /*-------------------------------------------------------------------------- NAME + H5Mdelete + PURPOSE + Delete an HDF5 object from a file. + USAGE + herr_t H5Mdelete(oid) + hatom_t oid; IN: Object to delete + RETURNS + SUCCEED/FAIL + DESCRIPTION + This function re-directs the object's delete into the appropriate + interface, as defined by the function pointers in hdf5fptr.h. Deleting + an object implicitly ends access to it. +--------------------------------------------------------------------------*/ +herr_t H5Mdelete(hatom_t oid) +{ + group_t group=H5Aatom_group(oid); /* Atom group for incoming object */ + intn i; /* local counting variable */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER(H5Mdelete, H5M_init_interface, FAIL); + + /* Clear errors and check args and all the boring stuff. */ + H5ECLEAR; + if(group<=BADGROUP || group>=MAXGROUP) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); + + i=H5M_find_type(group); + if(meta_func_arr[i].delete==NULL) + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + ret_value=meta_func_arr[i].delete(oid); + +done: + if(ret_value == FAIL) + { /* Error condition cleanup */ + + } /* end if */ + + /* Normal function cleanup */ + + FUNC_LEAVE(ret_value); +} /* end H5Mdelete() */ + +/*-------------------------------------------------------------------------- + NAME + H5Mget_parent + PURPOSE + Get the parent ID an HDF5 object. + USAGE + hatom_t H5Mget_parent(oid) + hatom_t oid; IN: Object to query + RETURNS + SUCCEED/FAIL + DESCRIPTION + This function re-directs the object's query into the appropriate + interface, as defined by the function pointers in hdf5fptr.h +--------------------------------------------------------------------------*/ +hatom_t H5Mget_parent(hatom_t oid) +{ + group_t group=H5Aatom_group(oid); /* Atom group for incoming object */ + intn i; /* local counting variable */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER(H5Mget_parent, H5M_init_interface, FAIL); + + /* Clear errors and check args and all the boring stuff. */ + H5ECLEAR; + if(group<=BADGROUP || group>=MAXGROUP) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); + + i=H5M_find_type(group); + if(meta_func_arr[i].get_parent==NULL) + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + ret_value=meta_func_arr[i].get_parent(oid); + +done: + if(ret_value == FAIL) + { /* Error condition cleanup */ + + } /* end if */ + + /* Normal function cleanup */ + + FUNC_LEAVE(ret_value); +} /* end H5Mget_parent() */ + +/*-------------------------------------------------------------------------- + NAME H5Mget_file PURPOSE Get the file ID an HDF5 object. diff --git a/src/H5Mpublic.h b/src/H5Mpublic.h index b542ce5..466236d 100644 --- a/src/H5Mpublic.h +++ b/src/H5Mpublic.h @@ -30,9 +30,18 @@ extern "C" { /* Functions in H5M.c */ hatom_t H5Mcreate(hatom_t owner_id, hobjtype_t type, const char *name); +hatom_t H5Maccess(hatom_t oid); hatom_t H5Mcopy(hatom_t oid); +hatom_t H5Mfind_name(hatom_t oid, hobjtype_t type, const char *name); +uint32 H5Mname_len(hatom_t oid); +herr_t H5Mget_name(hatom_t oid, char *name); +herr_t H5Mset_name(hatom_t oid, const char *name); +hatom_t H5Msearch(hatom_t oid, hobjtype_t type, const char *name); +hatom_t H5Mindex(hatom_t oid, hobjtype_t type, uint32 idx); hatom_t H5Mflush(hatom_t oid); +herr_t H5Mdelete(hatom_t oid); hatom_t H5Mget_file(hatom_t oid); +hatom_t H5Mget_parent(hatom_t oid); herr_t H5Mrelease(hatom_t oid); #ifdef __cplusplus diff --git a/src/H5Osdim.c b/src/H5Osdim.c index 9a624c7..816443b 100644 --- a/src/H5Osdim.c +++ b/src/H5Osdim.c @@ -122,7 +122,9 @@ H5O_sim_dim_decode (hdf5_file_t *f, size_t raw_size, const uint8 *p) } /* end if */ } /* end if */ +#ifdef LATER done: +#endif /* LATER */ if(sdim == NULL) { /* Error condition cleanup */ @@ -162,7 +164,7 @@ H5O_sim_dim_encode (hdf5_file_t *f, size_t raw_size, uint8 *p, const void *mesg) assert (f); assert (raw_size >= 8); /* at least the rank & flags must be present */ assert (p); - assert (sdtype); + assert (sdim); /* encode */ UINT32ENCODE(p,sdim->rank); @@ -221,7 +223,7 @@ H5O_sim_dim_fast (const H5G_entry_t *ent, void *mesg) if (!sdim) if((sdim = H5MM_xcalloc (1, sizeof(H5O_sim_dim_t)))!=NULL) { - p=&(uint8 *)ent->cache.sdata.ndim; + p=(const uint8 *)&ent->cache.sdata.ndim; UINT32DECODE(p,sdim->rank); sdim->dim_flags=0; /* cached dimensions never have max. dims or permutation vectors */ sdim->size=H5MM_xmalloc(sizeof(uint32)*sdim->rank); @@ -256,16 +258,16 @@ H5O_sim_dim_fast (const H5G_entry_t *ent, void *mesg) static hbool_t H5O_sim_dim_cache (H5G_entry_t *ent, const void *mesg) { - const H5O_sim_dim_t *sdtype = (const H5O_sim_dim_t *)mesg; + const H5O_sim_dim_t *sdim = (const H5O_sim_dim_t *)mesg; uintn u; /* Local counting variable */ - const uint8 *p; + uint8 *p; hbool_t modified = BFALSE; FUNC_ENTER (H5O_sim_dim_cache, NULL, BFAIL); /* check args */ assert (ent); - assert (sdtype); + assert (sdim); /* * We do this in two steps so Purify doesn't complain about @@ -283,10 +285,10 @@ H5O_sim_dim_cache (H5G_entry_t *ent, const void *mesg) } /* end if */ else { - if(ent->cache.sdata.rank= sdim->rank) + if(ent->cache.sdata.ndim!= sdim->rank) { modified = BTRUE; - ent->cache.sdata.rank = sdim->rank; + ent->cache.sdata.ndim = sdim->rank; } /* end if */ /* Check each dimension */ @@ -299,73 +301,82 @@ H5O_sim_dim_cache (H5G_entry_t *ent, const void *mesg) } /* end else */ FUNC_LEAVE (modified); -} /* end H5O_sim_dtype_cache() */ +} /* end H5O_sim_dim_cache() */ /*-------------------------------------------------------------------------- NAME - H5O_sim_dtype_copy + H5O_sim_dim_copy PURPOSE Copies a message from MESG to DEST, allocating DEST if necessary. USAGE - void *H5O_sim_dtype_copy(mesg, dest) - const void *mesg; IN: Pointer to the source simple datatype struct - const void *dest; IN: Pointer to the destination simple datatype struct + void *H5O_sim_dim_copy(mesg, dest) + const void *mesg; IN: Pointer to the source simple dimensionality struct + const void *dest; IN: Pointer to the destination simple dimensionality struct RETURNS Pointer to DEST on success, NULL on failure DESCRIPTION - This function copies a native (memory) simple datatype message, + This function copies a native (memory) simple dimensionality message, allocating the destination structure if necessary. --------------------------------------------------------------------------*/ static void * -H5O_sim_dtype_copy (const void *mesg, void *dest) +H5O_sim_dim_copy (const void *mesg, void *dest) { - const H5O_sim_dtype_t *src = (const H5O_sim_dtype_t *)mesg; - H5O_sim_dtype_t *dst = (H5O_sim_dtype_t *)dest; + const H5O_sim_dim_t *src = (const H5O_sim_dim_t *)mesg; + H5O_sim_dim_t *dst = (H5O_sim_dim_t *)dest; - FUNC_ENTER (H5O_sim_dtype_copy, NULL, NULL); + FUNC_ENTER (H5O_sim_dim_copy, NULL, NULL); /* check args */ assert (src); - if (!dst) dst = H5MM_xcalloc (1, sizeof(H5O_sim_dtype_t)); + if (!dst) + dst = H5MM_xcalloc (1, sizeof(H5O_sim_dim_t)); /* copy */ - HDmempcy(dst,src,sizeof(H5O_sim_dtype_t)); + HDmemcpy(dst,src,sizeof(H5O_sim_dim_t)); FUNC_LEAVE ((void*)dst); -} /* end H5O_sim_dtype_copy() */ +} /* end H5O_sim_dim_copy() */ /*-------------------------------------------------------------------------- NAME - H5O_sim_dtype_size + H5O_sim_dim_size PURPOSE Return the raw message size in bytes USAGE - void *H5O_sim_dtype_copy(f, mesg) + void *H5O_sim_dim_copy(f, mesg) hdf5_file_t *f; IN: pointer to the HDF5 file struct - const void *mesg; IN: Pointer to the source simple datatype struct + const void *mesg; IN: Pointer to the source simple dimensionality struct RETURNS Size of message on success, FAIL on failure DESCRIPTION - This function returns the size of the raw simple datatype message on + This function returns the size of the raw simple dimensionality message on success. (Not counting the message type or size fields, only the data portion of the message). It doesn't take into account alignment. --------------------------------------------------------------------------*/ static size_t -H5O_sim_dtype_size (hdf5_file_t *f, const void *mesg) +H5O_sim_dim_size (hdf5_file_t *f, const void *mesg) { + const H5O_sim_dim_t *sdim = (const H5O_sim_dim_t *)mesg; + size_t ret_value=8; /* all dimensionality messages are at least 8 bytes long (rank and flags) */ + FUNC_ENTER (H5O_sim_dtype_size, NULL, FAIL); - FUNC_LEAVE (4); -} /* end H5O_sim_dtype_size() */ + + ret_value+=sdim->rank*4; /* add in the dimension sizes */ + ret_value+=((sdim->dim_flags&0x01)>0)*sdim->rank*4; /* add in the space for the maximum dimensions, if they are present */ + ret_value+=((sdim->dim_flags&0x02)>0)*sdim->rank*4; /* add in the space for the dimension permutations, if they are present */ + + FUNC_LEAVE (ret_value); +} /* end H5O_sim_dim_size() */ /*-------------------------------------------------------------------------- NAME - H5O_sim_dtype_debug + H5O_sim_dim_debug PURPOSE - Prints debugging information for a simple datatype message + Prints debugging information for a simple dimensionality message USAGE - void *H5O_sim_dtype_debug(f, mesg, stream, indent, fwidth) + void *H5O_sim_dim_debug(f, mesg, stream, indent, fwidth) hdf5_file_t *f; IN: pointer to the HDF5 file struct - const void *mesg; IN: Pointer to the source simple datatype struct + const void *mesg; IN: Pointer to the source simple dimensionality struct FILE *stream; IN: Pointer to the stream for output data intn indent; IN: Amount to indent information by intn fwidth; IN: Field width (?) @@ -376,30 +387,42 @@ H5O_sim_dtype_size (hdf5_file_t *f, const void *mesg) parameter. --------------------------------------------------------------------------*/ static herr_t -H5O_sim_dtype_debug (hdf5_file_t *f, const void *mesg, FILE *stream, +H5O_sim_dim_debug (hdf5_file_t *f, const void *mesg, FILE *stream, intn indent, intn fwidth) { - const H5O_sim_dtype_t *sdtype = (const H5O_sim_dtype_t *)mesg; + const H5O_sim_dim_t *sdim = (const H5O_sim_dim_t *)mesg; + uintn u; /* local counting variable */ - FUNC_ENTER (H5O_sim_dtype_debug, NULL, FAIL); + FUNC_ENTER (H5O_sim_dim_debug, NULL, FAIL); /* check args */ assert (f); - assert (sdtype); + assert (sdim); assert (stream); assert (indent>=0); assert (fwidth>=0); fprintf (stream, "%*s%-*s %lu\n", indent, "", fwidth, - "Length:", - (unsigned long)(sdtype->length)); - fprintf (stream, "%*s%-*s %lu\n", indent, "", fwidth, - "Architecture:", - (unsigned long)(sdtype->arch)); - fprintf (stream, "%*s%-*s %lu\n", indent, "", fwidth, - "Data-Type:", - (unsigned long)(sdtype->type)); + "Rank:", + (unsigned long)(sdim->rank)); + fprintf (stream, "%*s%-*s %lx\n", indent, "", fwidth, + "Flags:", + (unsigned long)(sdim->dim_flags)); + for(u=0; u<sdim->rank; u++) + fprintf (stream, "%*s%-*s %lx\n", indent, "", fwidth, + "Dim Size:", + (unsigned long)(sdim->size[u])); + if(sdim->dim_flags&0x01) + for(u=0; u<sdim->rank; u++) + fprintf (stream, "%*s%-*s %lx\n", indent, "", fwidth, + "Dim Max:", + (unsigned long)(sdim->max[u])); + if(sdim->dim_flags&0x02) + for(u=0; u<sdim->rank; u++) + fprintf (stream, "%*s%-*s %lx\n", indent, "", fwidth, + "Dim Perm:", + (unsigned long)(sdim->perm[u])); FUNC_LEAVE (SUCCEED); -} /* end H5O_sim_dtype_debug() */ +} /* end H5O_sim_dim_debug() */ diff --git a/src/H5Osdtyp.c b/src/H5Osdtyp.c index 3c881a1..79e3db2 100644 --- a/src/H5Osdtyp.c +++ b/src/H5Osdtyp.c @@ -179,7 +179,7 @@ H5O_sim_dtype_fast (const H5G_entry_t *ent, void *mesg) if (!sdtype) if((sdtype = H5MM_xcalloc (1, sizeof(H5O_sim_dtype_t)))!=NULL) { - p=&(uint8 *)ent->cache.sdata.nt; + p=(const uint8 *)&ent->cache.sdata.nt; sdtype->length=*p++; sdtype->arch=*p++; UINT16DECODE(p,sdtype->type); @@ -213,7 +213,7 @@ static hbool_t H5O_sim_dtype_cache (H5G_entry_t *ent, const void *mesg) { const H5O_sim_dtype_t *sdtype = (const H5O_sim_dtype_t *)mesg; - const uint8 *p; + uint8 *p; hbool_t modified = BFALSE; FUNC_ENTER (H5O_sim_dtype_cache, NULL, BFAIL); @@ -238,22 +238,22 @@ H5O_sim_dtype_cache (H5G_entry_t *ent, const void *mesg) } /* end if */ else { - if(ent->cache.sdata.length= sdtype->length) + if(ent->cache.sdata.nt.length != sdtype->length) { modified = BTRUE; - ent->cache.sdata.length = sdtype->length; + ent->cache.sdata.nt.length = sdtype->length; } /* end if */ - if (ent->cache.sdata.arch != sdtype->arch) + if (ent->cache.sdata.nt.arch != sdtype->arch) { modified = BTRUE; - ent->cache.sdata.arch = sdtype->arch; + ent->cache.sdata.nt.arch = sdtype->arch; } /* end if */ - if (ent->cache.sdata.type != sdtype->type) + if (ent->cache.sdata.nt.type != sdtype->type) { modified = BTRUE; - ent->cache.sdata.type = sdtype->type; + ent->cache.sdata.nt.type = sdtype->type; } /* end if */ } /* end else */ @@ -288,7 +288,7 @@ H5O_sim_dtype_copy (const void *mesg, void *dest) if (!dst) dst = H5MM_xcalloc (1, sizeof(H5O_sim_dtype_t)); /* copy */ - HDmempcy(dst,src,sizeof(H5O_sim_dtype_t)); + HDmemcpy(dst,src,sizeof(H5O_sim_dtype_t)); FUNC_LEAVE ((void*)dst); } /* end H5O_sim_dtype_copy() */ diff --git a/src/Makefile b/src/Makefile index 93c3414..7286596 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,117 +1,158 @@ -### Name of target -TARGET = libhdf5.a - +# Generated automatically from Makefile.in by configure. +# HDF5 Library Makefile(.in) -*- makefile -*- # -# PART 2: various choices +# Copyright (C) 1997 National Center for Supercomputing Applications. +# All rights reserved. # - -### -DDEBUG Debugging options on -DEFS = - +# + +#------------------------------------------------------------- -*- makefile -*- +# The following section of this makefile comes from the +# `./config/commence' file which was generated with config.status +# from `./config/commence.in'. +#------------------------------------------------------------------------------ + +# Things that Make needs +.SUFFIXES: +.SUFFIXES: .c .o + + +# Programs +SHELL=/bin/sh +CC=gcc +CFLAGS=-g -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs +CPPFLAGS= +LIBS= +AR=ar +RANLIB=ranlib +RM=rm -f +INSTALL=/usr/bin/install -c +INSTALL_PROGRAM=${INSTALL} +INSTALL_DATA=${INSTALL} -m 644 + +# Installation points +prefix=/usr/local +exec_prefix=${prefix} +bindir=${exec_prefix}/bin +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +#------------------------------------------------------------------------------ +# The following section of this makefile comes from the middle of `Makefile.in' +# from this directory. It was generated by running `config.status'. +#------------------------------------------------------------------------------ + +# Add `-I.' to the C preprocessor flags. +CPPFLAGS=-I. + +# These are our main targets: +LIB=libhdf5.a +PROGS=debug + +# Source and object files for the library (lexicographically)... +LIB_SRC=H5.c H5A.c H5AC.c H5B.c H5C.c H5D.c H5E.c H5F.c H5G.c H5Gnode.c \ + H5H.c H5M.c H5MF.c H5MM.c H5O.c H5Ocont.c H5Oname.c H5Onull.c \ + H5Ostab.c H5Osdtyp.c H5Osdim.c H5P.c H5T.c +LIB_OBJ=$(LIB_SRC:.c=.o) + +# Source and object files for programs... +PROG_SRC=debug.c +PROG_OBJ=$(PROG_SRC:.c=.o) + +# Public header files (to be installed)... +PUB_HDR=H5public.h H5Apublic.h H5ACpublic.h H5Bpublic.h H5Cpublic.h \ + H5Dpublic.h H5Epublic.h H5Fpublic.h H5Gpublic.h H5Hpublic.h \ + H5Mpublic.h H5MFpublic.h H5MMpublic.h H5Opublic.h H5Ppublic.h \ + H5Tpublic.h H5config.h hdf5.h + +# Other header files (not to be installed)... +PRIVATE_HDR=H5private.h H5Aprivate.h H5ACprivate.h H5Bprivate.h \ + H5Cprivate.h H5Dprivate.h H5Eprivate.h H5Fprivate.h H5Gprivate.h \ + H5Hprivate.h H5Mprivate.h H5MFprivate.h H5MMprivate.h \ + H5Oprivate.h H5Pprivate.h H5Tprivate.h + +# How to build the programs... +debug: debug.o $(LIB) + $(CC) $(CFLAGS) -o $@ debug.o $(LIB) + + +#------------------------------------------------------------- -*- makefile -*- +# The following section of this makefile comes from the +# `./config/conclude' file which was generated with config.status +# from `./config/conclude.in'. +#------------------------------------------------------------------------------ + +# The default is to build the library and programs. +all: $(LIB) $(PROGS) +lib: $(LIB) + +# This is the target for the library described in the main body of the +# makefile. # -# PART 3: hardware dependend +$(LIB) __no_library__: $(LIB_OBJ) + $(AR) -rc $@ $(LIB_OBJ) + $(RANLIB) $@ + +# Build a tags file in this directory. +TAGS: $(LIB_SRC) + $(RM) $@ + -etags $(LIB_SRC) + +# Install the library, the public header files, and programs. +install: $(LIB) $(PUB_HDR) $(PROGS) + @if test -n "$(LIB)"; then \ + (set -x; $(INSTALL_DATA) $(LIB) $(libdir) || exit 1); \ + fi + @if test -n "$(PUB_HDR)"; then \ + (set -x; $(INSTALL_DATA) $(PUB_HDR) $(includedir) || exit 1); \ + fi + @if test -n "$(PROGS)"; then \ + (set -x; $(INSTALL_PROGRAM) $(PROGS) $(bindir) || exit 1); \ + fi + +# Removes those things that `make install' (would have) installed. +uninstall: + $(RM) $(libdir)/$(LIB) + $(RM) $(includedir)/$(PUB_HDR) + $(RM) $(bindir)/$(PROGS) + +# Removes temporary files without removing the final target files. That is, +# remove things like object files but not libraries or executables. # +mostlyclean: + $(RM) $(LIB_OBJ) $(PROG_OBJ) -### CC entry: name and arguments for the compiler (also for linking) -### MACHINE entry: defines used for compiling (not for linking) -### LIBS: defines used for linking -MACHINE = -CC=gcc -O -LIBS = - -################################################ -## no changes required below this line ## -################################################ - -CFLAGS = -c $(MACHINE) $(DEFS) - -INCL = hdf5.h - -OBJ = H5.o H5E.o H5A.o H5F.o H5C.o H5M.o H5AC.o H5B.o H5MM.o H5MF.o H5T.o \ - H5Gnode.o H5H.o H5G.o H5P.o H5D.o H5O.o H5Onull.o H5Ocont.o H5Ostab.o \ - H5Oname.o - -$(TARGET): $(OBJ) - $(AR) $(ARFLAGS) $(TARGET) $(OBJ) - $(RANLIB) $(TARGET) - -all test: $(TARGET) debug_hdf5 - -debug: $(OBJ) - $(AR) $(ARFLAGS) $(TARGET) $(OBJ) - $(RANLIB) $(TARGET) - -clean: - -rm -f *.o core debug $(TARGET) - -rm -f *.bak - -########################################################################### - -debug_hdf5: $(TARGET) debug.o - $(CC) -o debug debug.o -L. -lhdf5 - -debug.o: debug.c $(INCL) - $(CC) $(CFLAGS) debug.c - -H5.o: H5.c $(INCL) H5private.h H5proto.h - $(CC) $(CFLAGS) H5.c - -H5E.o: H5E.c $(INCL) H5Eprivate.h H5Eproto.h - $(CC) $(CFLAGS) H5E.c - -H5F.o: H5F.c $(INCL) H5Fprivate.h H5Fproto.h - $(CC) $(CFLAGS) H5F.c - -H5C.o: H5C.c $(INCL) H5Cprivate.h H5Cproto.h - $(CC) $(CFLAGS) H5C.c - -H5M.o: H5M.c $(INCL) H5Mprivate.h H5Mproto.h - $(CC) $(CFLAGS) H5M.c - -H5A.o: H5A.c $(INCL) H5Aprivate.h H5Aproto.h - $(CC) $(CFLAGS) H5A.c - -H5AC.o: H5AC.c $(INCL) H5ACprivate.h H5ACproto.h - $(CC) $(CFLAGS) H5AC.c - -H5B.o: H5B.c $(INCL) H5Bprivate.h H5Bproto.h - $(CC) $(CFLAGS) H5B.c - -H5MM.o: H5MM.c $(INCL) H5MMprivate.h H5MMproto.h - $(CC) $(CFLAGS) H5MM.c - -H5MF.o: H5MF.c $(INCL) H5MFprivate.h H5MFproto.h - $(CC) $(CFLAGS) H5MF.c - -H5T.o: H5T.c $(INCL) H5Tprivate.h H5Tproto.h - $(CC) $(CFLAGS) H5T.c - -H5Gnode.o: H5Gnode.c $(INCL) H5Gprivate.h H5Gproto.h - $(CC) $(CFLAGS) H5Gnode.c - -H5H.o: H5H.c $(INCL) H5Hprivate.h H5Hproto.h - $(CC) $(CFLAGS) H5H.c - -H5G.o: H5G.c $(INCL) H5Gprivate.h H5Gproto.h - $(CC) $(CFLAGS) H5G.c - -H5P.o: H5P.c $(INCL) H5Pprivate.h H5Pproto.h - $(CC) $(CFLAGS) H5P.c +# Like `mostlyclean' except it also removes the final targets: things like +# libraries and executables. This target doesn't remove any file that +# is part of the HDF5 distribution. +# +clean: mostlyclean + $(RM) $(LIB) $(PROGS) -H5D.o: H5D.c $(INCL) H5Dprivate.h H5Dproto.h - $(CC) $(CFLAGS) H5D.c +# Like `clean' except it also removes files that were created by running +# configure. If you've unpacked the source and built HDF5 without creating +# any other files, then `make distclean' will leave only the files that were +# in the distribution. +# +distclean: clean + $(RM) .depend TAGS + @if test -f Makefile.in; then \ + (set -x; $(RM) Makefile); \ + fi + +# Like `distclean' except it deletes all files that can be regenerated from +# the makefile, including those generated from autoheader and autoconf. +# +maintainer-clean: distclean -H5O.o: H5O.c $(INCL) H5Oprivate.h H5Oproto.h - $(CC) $(CFLAGS) H5O.c -H5Onull.o: H5Onull.c $(INCL) H5Oprivate.h H5Oproto.h - $(CC) $(CFLAGS) H5Onull.c +# Implicit rules +.c.a: + $(CC) $(CFLAGS) $(CPPFLAGS) -c $< + $(AR) -rc $@ $*.o + $(RM) $*.o -H5Ocont.o: H5Ocont.c $(INCL) H5Oprivate.h H5Oproto.h - $(CC) $(CFLAGS) H5Ocont.c +.c.o: + $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -H5Ostab.o: H5Ostab.c $(INCL) H5Oprivate.h H5Oproto.h - $(CC) $(CFLAGS) H5Ostab.c -H5Oname.o: H5Oname.c $(INCL) H5Oprivate.h H5Oproto.h - $(CC) $(CFLAGS) H5Oname.c diff --git a/src/Makefile.in b/src/Makefile.in index 98e609f..126ad40 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -16,7 +16,7 @@ PROGS=debug # Source and object files for the library (lexicographically)... LIB_SRC=H5.c H5A.c H5AC.c H5B.c H5C.c H5D.c H5E.c H5F.c H5G.c H5Gnode.c \ H5H.c H5M.c H5MF.c H5MM.c H5O.c H5Ocont.c H5Oname.c H5Onull.c \ - H5Ostab.c H5P.c H5T.c + H5Ostab.c H5Osdtyp.c H5Osdim.c H5P.c H5T.c LIB_OBJ=$(LIB_SRC:.c=.o) # Source and object files for programs... |