diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/.distdep | 246 | ||||
-rw-r--r-- | src/H5.c | 32 | ||||
-rw-r--r-- | src/H5A.c | 26 | ||||
-rw-r--r-- | src/H5Aprivate.h | 2 | ||||
-rw-r--r-- | src/H5F.c | 103 | ||||
-rw-r--r-- | src/H5Flow.c | 23 | ||||
-rw-r--r-- | src/H5Fpublic.h | 1 |
7 files changed, 288 insertions, 145 deletions
diff --git a/src/.distdep b/src/.distdep index d7abd6d..499fcc6 100644 --- a/src/.distdep +++ b/src/.distdep @@ -1,36 +1,3 @@ -H5A.o: \ - H5A.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Iprivate.h \ - H5Ipublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ - H5Dprivate.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Pprivate.h \ - H5Ppublic.h \ - H5Apkg.h \ - H5Aprivate.h H5E.o: \ H5E.c \ H5private.h \ @@ -39,29 +6,6 @@ H5E.o: \ H5Iprivate.h \ H5Ipublic.h \ H5Eprivate.h -H5F.o: \ - H5F.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Iprivate.h \ - H5Ipublic.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Pprivate.h \ - H5Ppublic.h \ - H5Zpublic.h H5Farray.o: \ H5Farray.c \ H5private.h \ @@ -106,19 +50,6 @@ H5Ffamily.o: \ H5Eprivate.h \ H5Epublic.h \ H5Ipublic.h -H5Flow.o: \ - H5Flow.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ - H5MMprivate.h \ - H5MMpublic.h H5Fmpio.o: \ H5Fmpio.c \ H5private.h \ @@ -771,37 +702,6 @@ H5V.o: \ H5Tpublic.h \ H5Sprivate.h \ H5Spublic.h -H5.o: \ - H5.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Ipublic.h \ - H5Dpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Iprivate.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Pprivate.h \ - H5Ppublic.h \ - H5Zpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h H5AC.o: \ H5AC.c \ H5private.h \ @@ -973,6 +873,61 @@ H5Oefl.o: \ H5Sprivate.h \ H5Spublic.h \ H5Zprivate.h +H5Sselect.o: \ + H5Sselect.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5Ipublic.h \ + H5Iprivate.h \ + H5MMprivate.h \ + H5MMpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Zprivate.h \ + H5Zpublic.h +H5Z.o: \ + H5Z.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5Ipublic.h \ + H5MMprivate.h \ + H5MMpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Zprivate.h \ + H5Zpublic.h H5P.o: \ H5P.c \ H5private.h \ @@ -1024,48 +979,86 @@ H5S.o: \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h -H5Sselect.o: \ - H5Sselect.c \ +H5.o: \ + H5.c \ H5private.h \ H5public.h \ H5config.h \ + H5ACprivate.h \ + H5ACpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Ipublic.h \ + H5Dpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ H5Eprivate.h \ H5Epublic.h \ - H5Ipublic.h \ H5Iprivate.h \ H5MMprivate.h \ H5MMpublic.h \ + H5Pprivate.h \ + H5Ppublic.h \ + H5Zpublic.h \ H5Sprivate.h \ H5Spublic.h \ H5Gprivate.h \ H5Gpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h +H5A.o: \ + H5A.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Iprivate.h \ + H5Ipublic.h \ H5Bprivate.h \ H5Bpublic.h \ H5Fprivate.h \ H5Fpublic.h \ H5Dpublic.h \ + H5Dprivate.h \ + H5Gprivate.h \ + H5Gpublic.h \ H5Oprivate.h \ H5Opublic.h \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ H5Zprivate.h \ - H5Zpublic.h -H5T.o: \ - H5T.c \ + H5Zpublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5MMprivate.h \ + H5MMpublic.h \ + H5Pprivate.h \ + H5Ppublic.h \ + H5Apkg.h \ + H5Aprivate.h +H5F.o: \ + H5F.c \ H5private.h \ H5public.h \ H5config.h \ - H5Dprivate.h \ - H5Dpublic.h \ + H5Aprivate.h \ + H5Apublic.h \ H5Ipublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ H5Gprivate.h \ H5Gpublic.h \ H5Bprivate.h \ H5Bpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Dprivate.h \ H5Oprivate.h \ H5Opublic.h \ H5HGprivate.h \ @@ -1077,28 +1070,41 @@ H5T.o: \ H5Zprivate.h \ H5Zpublic.h \ H5Iprivate.h \ + H5ACprivate.h \ + H5ACpublic.h \ H5Eprivate.h \ H5Epublic.h \ - H5MMprivate.h -H5Z.o: \ - H5Z.c \ + H5MMprivate.h \ + H5MMpublic.h +H5Flow.o: \ + H5Flow.c \ H5private.h \ H5public.h \ H5config.h \ H5Eprivate.h \ H5Epublic.h \ H5Ipublic.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ H5Fprivate.h \ H5Fpublic.h \ H5Dpublic.h \ + H5MMprivate.h \ + H5MMpublic.h +H5T.o: \ + H5T.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Dprivate.h \ + H5Dpublic.h \ + H5Ipublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ H5Gprivate.h \ H5Gpublic.h \ H5Bprivate.h \ H5Bpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ @@ -1106,4 +1112,8 @@ H5Z.o: \ H5Sprivate.h \ H5Spublic.h \ H5Zprivate.h \ - H5Zpublic.h + H5Zpublic.h \ + H5Iprivate.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5MMprivate.h @@ -452,9 +452,7 @@ H5close (void) * prints an `hsize_t' value as a hex number right justified and * zero filled in an 18-character field. * - * The conversion `a' refers to an `haddr_t*' type. Field widths - * and other flags are ignored and the address is printed by - * calling H5F_addr_print(). + * The conversion `a' refers to an `haddr_t*' type. * * Bugs: Return value will be incorrect if `%a' appears in the format * string. @@ -666,8 +664,32 @@ HDfprintf (FILE *stream, const char *fmt, ...) case 'a': if (1) { haddr_t *x = va_arg (ap, haddr_t*); - H5F_addr_print (stream, x); - n = 0; + if (x && H5F_addr_defined(x)) { + sprintf(template, "%%%s%s%s%s%s", + leftjust?"-":"", plussign?"+":"", + ldspace?" ":"", prefix?"#":"", + zerofill?"0":""); + if (fwidth>0) { + sprintf(template+strlen(template), "%d", fwidth); + } + if (sizeof(x->offset)==SIZEOF_INT) { + strcat(template, "d"); + } else if (sizeof(x->offset)==SIZEOF_LONG) { + strcat(template, "ld"); + } else if (sizeof(x->offset)==SIZEOF_LONG_LONG) { + strcat(template, PRINTF_LL_WIDTH); + strcat(template, "d"); + } + n = fprintf(stream, template, x->offset); + } else { + strcpy(template, "%"); + if (leftjust) strcat(template, "-"); + if (fwidth) { + sprintf(template+strlen(template), "%d", fwidth); + } + strcat(template, "s"); + fprintf(stream, template, x?"UNDEF":"NULL"); + } } break; @@ -1494,3 +1494,29 @@ H5A_close(H5A_t *attr) FUNC_LEAVE(SUCCEED); } + +/*------------------------------------------------------------------------- + * Function: H5A_entof + * + * Purpose: Return the symbol table entry for an attribute. It's the + * symbol table entry for the object to which the attribute + * belongs, not the attribute itself. + * + * Return: Success: Ptr to entry + * + * Failure: NULL + * + * Programmer: Robb Matzke + * Thursday, August 6, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +H5G_entry_t * +H5A_entof(H5A_t *attr) +{ + FUNC_ENTER(H5A_entof, NULL); + assert(attr); + FUNC_LEAVE(&(attr->ent)); +} diff --git a/src/H5Aprivate.h b/src/H5Aprivate.h index 9557ddd..a1daf99 100644 --- a/src/H5Aprivate.h +++ b/src/H5Aprivate.h @@ -17,6 +17,7 @@ #define _H5Aprivate_H #include <H5Apublic.h> +#include <H5Gprivate.h> #define H5A_RESERVED_ATOMS 0 typedef struct H5A_t H5A_t; @@ -26,5 +27,6 @@ typedef struct H5A_t H5A_t; /* Functions defined in H5A.c */ H5A_t * H5A_copy(const H5A_t *old_attr); herr_t H5A_close(H5A_t *attr); +H5G_entry_t *H5A_entof(H5A_t *attr); #endif @@ -38,7 +38,9 @@ static char RcsId[] = "@(#)$Revision$"; /* Packages needed by this file... */ #include <H5private.h> /*library functions */ -#include <H5Iprivate.h> /* IDs */ +#include <H5Aprivate.h> /*attributes */ +#include <H5Dprivate.h> /*datasets */ +#include <H5Iprivate.h> /*object IDs */ #include <H5ACprivate.h> /*cache */ #include <H5Eprivate.h> /*error handling */ #include <H5Gprivate.h> /*symbol tables */ @@ -1287,6 +1289,105 @@ H5Fopen (const char *filename, unsigned flags, hid_t access_id) FUNC_LEAVE(ret_value); } + + +/*------------------------------------------------------------------------- + * Function: H5Fflush + * + * Purpose: Flushes all outstanding buffers of a file to disk but does + * not remove them from the cache. The OBJECT_ID can be a file, + * dataset, group, attribute, or named data type. + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Thursday, August 6, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5Fflush (hid_t object_id) +{ + H5F_t *f = NULL; + H5G_t *grp = NULL; + H5T_t *type = NULL; + H5D_t *dset = NULL; + H5A_t *attr = NULL; + H5G_entry_t *ent = NULL; + + FUNC_ENTER(H5Fflush, FAIL); + H5TRACE1("e","i",object_id); + + switch (H5I_group(object_id)) { + case H5_FILE: + if (NULL==(f=H5I_object(object_id))) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "invalid file identifier"); + } + break; + + case H5_GROUP: + if (NULL==(grp=H5I_object(object_id))) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "invalid group identifier"); + } + ent = H5G_entof(grp); + break; + + case H5_DATATYPE: + if (NULL==(type=H5I_object(object_id))) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "invalid type identifier"); + } + ent = H5T_entof(type); + break; + + case H5_DATASET: + if (NULL==(dset=H5I_object(object_id))) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "invalid dataset identifier"); + } + ent = H5D_entof(dset); + break; + + case H5_ATTR: + if (NULL==(attr=H5I_object(object_id))) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "invalid attribute identifier"); + } + ent = H5A_entof(attr); + break; + + default: + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "not a file or file object"); + } + + if (!f) { + if (!ent) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "object is not assocated with a file"); + } + f = ent->file; + } + if (!f) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "object is not associated with a file"); + } + + /* Flush the file */ + if (H5F_flush(f, FALSE)<0) { + HRETURN_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, + "flush failed"); + } + + FUNC_LEAVE(SUCCEED); +} + /*------------------------------------------------------------------------- * Function: H5F_flush diff --git a/src/H5Flow.c b/src/H5Flow.c index 2196341..f929e44 100644 --- a/src/H5Flow.c +++ b/src/H5Flow.c @@ -840,31 +840,12 @@ H5F_addr_decode(H5F_t *f, const uint8 **pp, haddr_t *addr/*out*/) void H5F_addr_print(FILE *stream, const haddr_t *addr) { - haddr_t tmp; - assert(stream); assert(addr); - if (addr_defined(addr)) { - /* - * It would be nice if we could use the `%Lu', `%llu', or `%qu', but - * we don't know which is supported. So we split the address into a - * low 4-bytes and a high 4-bytes. If the high 4-bytes are non-zero - * then we print the address in hexadecimal, otherwise we use decimal. - */ - tmp = *addr; - tmp.offset >>= 32; - if (tmp.offset) { - fprintf(stream, "0x%08lx%08lx", - (unsigned long) (tmp.offset), - (unsigned long) (addr->offset & 0xffffffff)); - } else { - fprintf(stream, "%lu", (unsigned long) (addr->offset)); - } - } else { - fprintf(stream, "UNDEF"); - } + HDfprintf(stream, "%a", addr); } + /*------------------------------------------------------------------------- * Function: H5F_addr_pow2 diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index b0536e7..90efdfa 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -81,6 +81,7 @@ hbool_t H5Fis_hdf5 (const char *filename); hid_t H5Fcreate (const char *filename, unsigned flags, hid_t create_plist, hid_t access_plist); hid_t H5Fopen (const char *filename, unsigned flags, hid_t access_plist); +herr_t H5Fflush(hid_t object_id); herr_t H5Fclose (hid_t file_id); hid_t H5Fget_create_template (hid_t file_id); hid_t H5Fget_access_template (hid_t file_id); |