summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README2
-rwxr-xr-xbin/trace32
-rw-r--r--src/H5.c360
-rw-r--r--src/H5Distore.c6
-rw-r--r--src/H5Fistore.c6
-rw-r--r--src/H5Ipublic.h7
-rw-r--r--src/H5P.c4
-rw-r--r--src/H5S.c13
-rw-r--r--src/H5Spublic.h3
-rw-r--r--src/H5T.c2
-rw-r--r--test/.distdep46
-rw-r--r--tools/h5ls.c55
12 files changed, 433 insertions, 103 deletions
diff --git a/README b/README
index 183a6c8..00963af 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-This is hdf5-1.0.24 released on 1998-06-20 15:24 UTC
+This is hdf5-1.0.24 released on 1998-06-21 19:01 UTC
Please refer to the INSTALL file for installation instructions.
------------------------------------------------------------------------------
diff --git a/bin/trace b/bin/trace
index c1a1acc..3ab902e 100755
--- a/bin/trace
+++ b/bin/trace
@@ -80,7 +80,7 @@ sub errmesg ($$@) {
#
sub argstring ($$$) {
my ($file, $func, $atype) = @_;
- my ($ptr, $tstr) = (0,"!");
+ my ($ptr, $tstr, $array) = (0, "!", "");
my ($fq_atype);
# Normalize the data type by removing redundant white space,
@@ -91,8 +91,12 @@ sub argstring ($$$) {
$ptr = length $1 if $atype =~ s/(\*+)//;
$atype =~ s/^\s+//;
$atype =~ s/\s+$//;
+ if ($atype =~ /(.*)\[(.*)\]$/) {
+ ($array, $atype) = ($2, $1);
+ }
$fq_atype = $atype . ('*' x $ptr);
+
if ($ptr>0 && exists $TypeString{$fq_atype}) {
$ptr = 0;
$tstr = $TypeString{$fq_atype};
@@ -104,7 +108,7 @@ sub argstring ($$$) {
} else {
$tstr = $TypeString{$atype};
}
- return ("*" x $ptr) . $tstr;
+ return ("*" x $ptr) . ($array?"[$array]":"") . $tstr;
}
##############################################################################
@@ -129,15 +133,18 @@ sub rewrite_func ($$$$$) {
# comma, then split the arguments on commas.
$args =~ s/(\/\*\s*in),\s*(out\s*\*\/)/$1_$2/g;
my @args = split /,[\s\n]*/, $args;
+ my $argno = 0;
+ my %names;
for $arg (@args) {
unless ($arg=~/^(([a-z_A-Z]\w*\s+)+\**)
- ([a-z_A-Z]\w*)(\[\])?
+ ([a-z_A-Z]\w*)(\[.*?\])?
(\s*\/\*\s*(in|out|in_out)\s*\*\/)?\s*$/x) {
errmesg $file, $name, "unable to parse \`$arg\'";
goto error;
} else {
my ($atype, $aname, $array, $adir) = ($1, $3, $4, $6);
+ $names{$aname} = $argno++;
$adir ||= "in";
$atype =~ s/\s+$//;
push @arg_name, $aname;
@@ -145,7 +152,18 @@ sub rewrite_func ($$$$$) {
if ($adir eq "out") {
push @arg_str, "x";
} else {
- $atype .= "*" if $array;
+ if (defined $array) {
+ $atype .= "*";
+ if ($array =~ /^\[\/\*([a-z_A-Z]\w*)\*\/\]$/) {
+ my $asize = $1;
+ if (exists $names{$asize}) {
+ $atype .= '[a' . $names{$asize} . ']';
+ } else {
+ warn "bad array size: $asize";
+ $atype .= "*";
+ }
+ }
+ }
push @arg_str, argstring $file, $name, $atype;
}
}
@@ -185,7 +203,7 @@ sub rewrite_func ($$$$$) {
error:
- return "\n$type\n$name ($args)$body";
+ return "\n$type\n$name ($args)\n$body";
}
##############################################################################
@@ -203,8 +221,8 @@ for $file (@ARGV) {
my $original = $Source;
my $napi = $Source =~ s/\n([A-Za-z]\w*(\s+[a-z]\w*)*)\s*\n #type
(H5[A-Z]{1,2}[^_A-Z]\w*) #name
- \s*\((.*?)\) #args
- (.*?\n\}[^\n]*) #body
+ \s*\((.*?)\)\s* #args
+ (\{.*?\n\}[^\n]*) #body
/rewrite_func($file,$1,$3,$4,$5)/segx;
$total_api += $napi;
diff --git a/src/H5.c b/src/H5.c
index 3cb6aed..9f0b9a7 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -93,17 +93,6 @@ H5_init_library(void)
{
FUNC_ENTER_INIT(H5_init_library, NULL, FAIL);
-#ifdef H5_DEBUG_API
- {
- /* Turn on tracing? */
- const char *s = getenv ("HDF5_TRACE");
- if (s && isdigit(*s)) {
- int fd = HDstrtol (s, NULL, 0);
- H5_trace_g = HDfdopen (fd, "w");
- }
- }
-#endif
-
/* Install atexit() library cleanup routine */
if (install_atexit_g == TRUE)
if (HDatexit(&H5_term_library) != 0)
@@ -118,6 +107,18 @@ H5_init_library(void)
HRETURN_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL,
"unable to initialize type interface");
}
+
+#ifdef H5_DEBUG_API
+ {
+ /* Turn on tracing? */
+ const char *s = getenv ("HDF5_TRACE");
+ if (s && isdigit(*s)) {
+ int fd = HDstrtol (s, NULL, 0);
+ H5_trace_g = HDfdopen (fd, "w");
+ }
+ }
+#endif
+
FUNC_LEAVE(SUCCEED);
}
@@ -962,9 +963,11 @@ void
H5_trace (hbool_t returning, const char *func, const char *type, ...)
{
va_list ap;
- char buf[64];
+ char buf[64], *rest;
const char *argname;
- intn argno=0, ptr, n;
+ intn argno=0, ptr, n, asize_idx;
+ hssize_t asize[16];
+ hssize_t i;
void *vp = NULL;
FILE *out = H5_trace_g;
@@ -977,10 +980,28 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
fprintf (out, "%s(", func);
}
- while (*type) {
+ /* Clear array sizes */
+ for (i=0; i<NELMTS(asize); i++) asize[i] = -1;
+
+ /* Parse the argument types */
+ for (argno=0; *type; argno++, type+=isupper(*type)?2:1) {
/* Count levels of indirection */
for (ptr=0; '*'==*type; type++) ptr++;
-
+ if ('['==*type) {
+ if ('a'==type[1]) {
+ asize_idx = strtol(type+2, &rest, 10);
+ assert(']'==*rest);
+ type = rest+1;
+ } else {
+ rest = strchr(type, ']');
+ assert(rest);
+ type = rest+1;
+ asize_idx = -1;
+ }
+ } else {
+ asize_idx = -1;
+ }
+
/*
* The argument name. Leave off the `_id' part. If the argument
* name is the null pointer then don't print the argument or the
@@ -994,7 +1015,7 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
buf[MIN((int)sizeof(buf)-1, n)] = '\0';
argname = buf;
}
- fprintf (out, "%s%s=", argno++?", ":"", argname);
+ fprintf (out, "%s%s=", argno?", ":"", argname);
} else {
argname = "";
}
@@ -1004,7 +1025,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
switch (type[0]) {
case 'b':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
hbool_t bool = va_arg (ap, hbool_t);
if (TRUE==bool) fprintf (out, "TRUE");
@@ -1015,7 +1040,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case 'd':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
double dbl = va_arg (ap, double);
fprintf (out, "%g", dbl);
@@ -1026,7 +1055,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
switch (type[1]) {
case 'l':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
H5D_layout_t layout = va_arg (ap, H5D_layout_t);
switch (layout) {
@@ -1051,7 +1084,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case 't':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
H5D_transfer_t transfer = va_arg (ap, H5D_transfer_t);
switch (transfer) {
@@ -1079,7 +1116,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case 'e':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
herr_t status = va_arg (ap, herr_t);
if (SUCCEED==status) fprintf (out, "SUCCEED");
@@ -1092,7 +1133,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
switch (type[1]) {
case 'd':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
H5E_direction_t direction = va_arg (ap, H5E_direction_t);
switch (direction) {
@@ -1111,7 +1156,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case 'e':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
H5E_error_t *error = va_arg (ap, H5E_error_t*);
fprintf (out, "0x%lx", (unsigned long)error);
@@ -1128,7 +1177,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
switch (type[1]) {
case 'd':
if (ptr) {
- fprintf(out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf(out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
H5F_driver_t driver = va_arg(ap, H5F_driver_t);
switch (driver) {
@@ -1170,7 +1223,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
switch (type[1]) {
case 'l':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
H5G_link_t link_type = va_arg (ap, H5G_link_t);
switch (link_type) {
@@ -1192,7 +1249,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case 's':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
H5G_stat_t *statbuf = va_arg (ap, H5G_stat_t*);
fprintf (out, "0x%lx", (unsigned long)statbuf);
@@ -1207,10 +1268,31 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case 'h':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ if (asize_idx>=0 && asize[asize_idx]>=0) {
+ hsize_t *p = (hsize_t*)vp;
+ fprintf(out, " {");
+ for (i=0; i<asize[asize_idx]; i++) {
+ if (H5S_UNLIMITED==p[i]) {
+ HDfprintf(out, "%sH5S_UNLIMITED", i?", ":"");
+ } else {
+ HDfprintf(out, "%s%Hu", i?", ":"", p[i]);
+ }
+ }
+ fprintf(out, "}");
+ }
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
hsize_t hsize = va_arg (ap, hsize_t);
- HDfprintf (out, "%Hu", hsize);
+ if (H5S_UNLIMITED==hsize) {
+ HDfprintf(out, "H5S_UNLIMITED");
+ } else {
+ HDfprintf (out, "%Hu", hsize);
+ asize[argno] = (hssize_t)hsize;
+ }
}
break;
@@ -1218,10 +1300,23 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
switch (type[1]) {
case 's':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ if (asize_idx>=0 && asize[asize_idx]>=0) {
+ hssize_t *p = (hssize_t*)vp;
+ fprintf(out, " {");
+ for (i=0; i<asize[asize_idx]; i++) {
+ HDfprintf(out, "%s%Hd", i?", ":"", p[i]);
+ }
+ fprintf(out, "}");
+ }
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
hssize_t hssize = va_arg (ap, hssize_t);
HDfprintf (out, "%Hd", hssize);
+ asize[argno] = (hssize_t)hssize;
}
break;
@@ -1233,7 +1328,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case 'i':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
hid_t obj = va_arg (ap, hid_t);
if (-2 == obj) {
@@ -1241,12 +1340,12 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
} else if (FAIL==obj) {
fprintf (out, "FAIL");
} else {
- fprintf (out, "%ld", (long)obj);
switch (H5I_group (obj)) {
case BADGROUP:
- fprintf (out, " (error)");
+ fprintf (out, "%ld (error)", (long)obj);
break;
case H5_FILE:
+ fprintf(out, "%ld", (long)obj);
if (strcmp (argname, "file")) {
fprintf (out, " (file)");
}
@@ -1259,36 +1358,71 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case H5_TEMPLATE_5:
case H5_TEMPLATE_6:
case H5_TEMPLATE_7:
+ fprintf(out, "%ld", (long)obj);
if (strcmp (argname, "plist")) {
fprintf (out, " (plist)");
}
break;
case H5_GROUP:
+ fprintf(out, "%ld", (long)obj);
if (strcmp (argname, "group")) {
fprintf (out, " (group)");
}
break;
case H5_DATATYPE:
- if (strcmp (argname, "type")) {
- fprintf (out, " (type)");
+ if (obj==H5T_NATIVE_CHAR_g) {
+ fprintf(out, "H5T_NATIVE_CHAR");
+ } else if (obj==H5T_NATIVE_UCHAR_g) {
+ fprintf(out, "H5T_NATIVE_UCHAR");
+ } else if (obj==H5T_NATIVE_SHORT_g) {
+ fprintf(out, "H5T_NATIVE_SHORT");
+ } else if (obj==H5T_NATIVE_USHORT_g) {
+ fprintf(out, "H5T_NATIVE_USHORT");
+ } else if (obj==H5T_NATIVE_INT_g) {
+ fprintf(out, "H5T_NATIVE_INT");
+ } else if (obj==H5T_NATIVE_UINT_g) {
+ fprintf(out, "H5T_NATIVE_UINT");
+ } else if (obj==H5T_NATIVE_LONG_g) {
+ fprintf(out, "H5T_NATIVE_LONG");
+ } else if (obj==H5T_NATIVE_ULONG_g) {
+ fprintf(out, "H5T_NATIVE_ULONG");
+ } else if (obj==H5T_NATIVE_LLONG_g) {
+ fprintf(out, "H5T_NATIVE_LLONG");
+ } else if (obj==H5T_NATIVE_ULLONG_g) {
+ fprintf(out, "H5T_NATIVE_ULLONG");
+ } else if (obj==H5T_NATIVE_FLOAT_g) {
+ fprintf(out, "H5T_NATIVE_FLOAT");
+ } else if (obj==H5T_NATIVE_DOUBLE_g) {
+ fprintf(out, "H5T_NATIVE_DOUBLE");
+ } else if (obj==H5T_NATIVE_LDOUBLE_g) {
+ fprintf(out, "H5T_NATIVE_LDOUBLE");
+ } else {
+ fprintf(out, "%ld", (long)obj);
+ if (strcmp (argname, "type")) {
+ fprintf (out, " (type)");
+ }
}
break;
case H5_DATASPACE:
+ fprintf(out, "%ld", (long)obj);
if (strcmp (argname, "space")) {
fprintf (out, " (space)");
}
break;
case H5_DATASET:
+ fprintf(out, "%ld", (long)obj);
if (strcmp (argname, "dset")) {
fprintf (out, " (dset)");
}
break;
case H5_ATTR:
+ fprintf(out, "%ld", (long)obj);
if (strcmp (argname, "attr")) {
fprintf (out, " (attr)");
}
break;
default:
+ fprintf(out, "%ld", (long)obj);
fprintf (out, " (unknown class)");
break;
}
@@ -1300,19 +1434,45 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
switch (type[1]) {
case 's':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ if (asize_idx>=0 && asize[asize_idx]>=0) {
+ int *p = (int*)vp;
+ fprintf(out, " {");
+ for (i=0; i<asize[asize_idx]; i++) {
+ fprintf(out, "%s%d", i?", ":"", p[i]);
+ }
+ fprintf(out, "}");
+ }
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
int is = va_arg (ap, int);
fprintf (out, "%d", is);
+ asize[argno] = is;
}
break;
case 'u':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ if (asize_idx>=0 && asize[asize_idx]>=0) {
+ int *p = (int*)vp;
+ fprintf(out, " {");
+ for (i=0; i<asize[asize_idx]; i++) {
+ HDfprintf(out, "%s%Hu", i?", ":"", p[i]);
+ }
+ fprintf(out, "}");
+ }
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
unsigned iu = va_arg (ap, unsigned);
fprintf (out, "%u", iu);
+ asize[argno] = iu;
}
break;
@@ -1326,7 +1486,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
switch (type[1]) {
case 'c':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
#ifdef HAVE_PARALLEL
MPI_Comm comm = va_arg (ap, MPI_Comm);
@@ -1336,7 +1500,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
break;
case 'i':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
#ifdef HAVE_PARALLEL
MPI_Info info = va_arg (ap, MPI_Info);
@@ -1351,7 +1519,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case 'o':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
off_t offset = va_arg (ap, off_t);
fprintf (out, "%ld", (long)offset);
@@ -1360,7 +1532,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case 'p':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
H5P_class_t plist_class = va_arg (ap, H5P_class_t);
switch (plist_class) {
@@ -1390,7 +1566,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
switch (type[1]) {
case 'c':
if (ptr) {
- fprintf(out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf(out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
H5S_class_t cls = va_arg(ap, H5S_class_t);
switch (cls) {
@@ -1415,7 +1595,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case 's':
if (ptr) {
- fprintf(out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf(out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
H5S_seloper_t so = va_arg(ap, H5S_seloper_t);
switch (so) {
@@ -1440,7 +1624,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case 's':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
const char *str = va_arg (ap, const char*);
fprintf (out, "\"%s\"", str);
@@ -1451,7 +1639,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
switch (type[1]) {
case 'c':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
H5T_cset_t cset = va_arg (ap, H5T_cset_t);
switch (cset) {
@@ -1470,7 +1662,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case 'n':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
H5T_norm_t norm = va_arg (ap, H5T_norm_t);
switch (norm) {
@@ -1495,7 +1691,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case 'o':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
H5T_order_t order = va_arg (ap, H5T_order_t);
switch (order) {
@@ -1523,7 +1723,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case 'p':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
H5T_pad_t pad = va_arg (ap, H5T_pad_t);
switch (pad) {
@@ -1548,7 +1752,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case 's':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
H5T_sign_t sign = va_arg (ap, H5T_sign_t);
switch (sign) {
@@ -1570,7 +1778,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case 't':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
H5T_class_t type_class = va_arg (ap, H5T_class_t);
switch (type_class) {
@@ -1607,7 +1819,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case 'z':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
H5T_str_t str = va_arg (ap, H5T_str_t);
switch (str) {
@@ -1635,7 +1851,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case 'x':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
vp = va_arg (ap, void*);
fprintf (out, "0x%lx", (unsigned long)vp);
@@ -1644,10 +1864,23 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case 'z':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ if (asize_idx>=0 && asize[asize_idx]>=0) {
+ size_t *p = (size_t*)vp;
+ fprintf(out, " {");
+ for (i=0; i<asize[asize_idx]; i++) {
+ HDfprintf(out, "%s%Zu", i?", ":"", p[i]);
+ }
+ fprintf(out, "}");
+ }
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
size_t size = va_arg (ap, size_t);
HDfprintf (out, "%Zu", size);
+ asize[argno] = (hssize_t)size;
}
break;
@@ -1655,7 +1888,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
switch (type[1]) {
case 'm':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
H5Z_method_t zmeth = va_arg (ap, H5Z_method_t);
if (zmeth<0) {
@@ -1676,10 +1913,23 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case 's':
if (ptr) {
- fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ if (vp && asize_idx>=0 && asize[asize_idx]>=0) {
+ ssize_t *p = (ssize_t*)vp;
+ fprintf(out, " {");
+ for (i=0; i<asize[asize_idx]; i++) {
+ HDfprintf(out, "%s%Zd", i?", ":"", p[i]);
+ }
+ fprintf(out, "}");
+ }
+ } else {
+ fprintf(out, "NULL");
+ }
} else {
ssize_t ssize = va_arg (ap, ssize_t);
HDfprintf (out, "%Zd", ssize);
+ asize[argno] = (hssize_t)ssize;
}
break;
@@ -1697,8 +1947,6 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
}
goto error;
}
-
- type += isupper(*type)?2:1;
}
error:
diff --git a/src/H5Distore.c b/src/H5Distore.c
index 8c9d22e..262a58f 100644
--- a/src/H5Distore.c
+++ b/src/H5Distore.c
@@ -994,7 +994,8 @@ H5F_istore_lock (H5F_t *f, const H5O_layout_t *layout,
/* First use the hint */
if (idx_hint && *idx_hint>=0 && *idx_hint<rdcc->nused) {
ent = rdcc->slot + *idx_hint;
- if (layout->ndims==ent->layout->ndims) {
+ if (layout->ndims==ent->layout->ndims &&
+ H5F_addr_eq(&(layout->addr), &(ent->layout->addr))) {
for (i=0, found=*idx_hint; found>=0 && i<ent->layout->ndims; i++) {
if (offset[i]!=ent->offset[i]) found = -1;
}
@@ -1004,7 +1005,8 @@ H5F_istore_lock (H5F_t *f, const H5O_layout_t *layout,
/* Then look at all the entries */
for (i=0; found<0 && i<rdcc->nused; i++) {
ent = rdcc->slot + i;
- if (layout->ndims==ent->layout->ndims) {
+ if (layout->ndims==ent->layout->ndims &&
+ H5F_addr_eq(&(layout->addr), &(ent->layout->addr))) {
for (j=0, found=i; found>=0 && j<ent->layout->ndims; j++) {
if (offset[j]!=ent->offset[j]) found = -1;
}
diff --git a/src/H5Fistore.c b/src/H5Fistore.c
index 8c9d22e..262a58f 100644
--- a/src/H5Fistore.c
+++ b/src/H5Fistore.c
@@ -994,7 +994,8 @@ H5F_istore_lock (H5F_t *f, const H5O_layout_t *layout,
/* First use the hint */
if (idx_hint && *idx_hint>=0 && *idx_hint<rdcc->nused) {
ent = rdcc->slot + *idx_hint;
- if (layout->ndims==ent->layout->ndims) {
+ if (layout->ndims==ent->layout->ndims &&
+ H5F_addr_eq(&(layout->addr), &(ent->layout->addr))) {
for (i=0, found=*idx_hint; found>=0 && i<ent->layout->ndims; i++) {
if (offset[i]!=ent->offset[i]) found = -1;
}
@@ -1004,7 +1005,8 @@ H5F_istore_lock (H5F_t *f, const H5O_layout_t *layout,
/* Then look at all the entries */
for (i=0; found<0 && i<rdcc->nused; i++) {
ent = rdcc->slot + i;
- if (layout->ndims==ent->layout->ndims) {
+ if (layout->ndims==ent->layout->ndims &&
+ H5F_addr_eq(&(layout->addr), &(ent->layout->addr))) {
for (j=0, found=i; found>=0 && j<ent->layout->ndims; j++) {
if (offset[j]!=ent->offset[j]) found = -1;
}
diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h
index 74b0bd8..e673734 100644
--- a/src/H5Ipublic.h
+++ b/src/H5Ipublic.h
@@ -20,10 +20,13 @@
/* Public headers needed by this file */
#include <H5public.h>
-/* Group values allowed */
+/*
+ * Group values allowed. Start with `1' instead of `0' because it makes the
+ * tracing output look better when hid_t values are large numbers.
+ */
typedef enum {
BADGROUP = (-1),/*invalid Group */
- H5_FILE = 0, /*group ID for File objects */
+ H5_FILE = 1, /*group ID for File objects */
H5_TEMPLATE_0, /*group ID for Template objects */
H5_TEMPLATE_1, /*group ID for Template objects */
H5_TEMPLATE_2, /*group ID for Template objects */
diff --git a/src/H5P.c b/src/H5P.c
index 459e7d6..c40d7c3 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -1038,13 +1038,13 @@ H5Pget_layout (hid_t tid)
*-------------------------------------------------------------------------
*/
herr_t
-H5Pset_chunk (hid_t tid, int ndims, const hsize_t dim[])
+H5Pset_chunk (hid_t tid, int ndims, const hsize_t dim[/*ndims*/])
{
int i;
H5D_create_t *tmpl = NULL;
FUNC_ENTER(H5Pset_chunk, FAIL);
- H5TRACE3("e","iIs*h",tid,ndims,dim);
+ H5TRACE3("e","iIs*[a1]h",tid,ndims,dim);
/* Check arguments */
if (H5P_DATASET_CREATE != H5P_get_class(tid) ||
diff --git a/src/H5S.c b/src/H5S.c
index 215267b..4905aed 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -1029,14 +1029,14 @@ H5Sis_simple (hid_t sid)
dimension in the array (the slowest) may be unlimited in size.
--------------------------------------------------------------------------*/
herr_t
-H5Sset_extent_simple (hid_t sid, int rank, const hsize_t *dims,
- const hsize_t *max)
+H5Sset_extent_simple (hid_t sid, int rank, const hsize_t dims[/*rank*/],
+ const hsize_t max[/*rank*/])
{
H5S_t *space = NULL; /* dataspace to modify */
intn u; /* local counting variable */
FUNC_ENTER(H5Sset_extent_simple, FAIL);
- H5TRACE4("e","iIs*h*h",sid,rank,dims,max);
+ H5TRACE4("e","iIs*[a1]h*[a1]h",sid,rank,dims,max);
/* Check args */
if ((space = H5I_object(sid)) == NULL) {
@@ -1382,14 +1382,15 @@ H5S_extend (H5S_t *space, const hsize_t *size)
*-------------------------------------------------------------------------
*/
hid_t
-H5Screate_simple (int rank, const hsize_t *dims, const hsize_t *maxdims)
+H5Screate_simple (int rank, const hsize_t dims[/*rank*/],
+ const hsize_t maxdims[/*rank*/])
{
hid_t ret_value = FAIL;
H5S_t *space = NULL;
int i;
- FUNC_ENTER(H5Screate, FAIL);
- H5TRACE3("i","Is*h*h",rank,dims,maxdims);
+ FUNC_ENTER(H5Screate_simple, FAIL);
+ H5TRACE3("i","Is*[a0]h*[a0]h",rank,dims,maxdims);
/* Check arguments */
if (rank<0) {
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index 022f108..68a5fd1 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -45,7 +45,8 @@ extern "C" {
/* Functions in H5S.c */
hid_t H5Screate(H5S_class_t type);
hid_t H5Screate_simple (int rank, const hsize_t dims[], const hsize_t maxdims[]);
-herr_t H5Sset_extent_simple (hid_t sid, int rank, const hsize_t *dims, const hsize_t *max);
+herr_t H5Sset_extent_simple (hid_t sid, int rank, const hsize_t dims[],
+ const hsize_t max[]);
hid_t H5Scopy (hid_t space_id);
herr_t H5Sclose (hid_t space_id);
hsize_t H5Sextent_npoints (hid_t space_id);
diff --git a/src/H5T.c b/src/H5T.c
index 11eef4b..bf0f03b 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -615,7 +615,7 @@ H5T_init_interface(void)
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
"unable to register conversion function");
}
-
+
FUNC_LEAVE(ret_value);
}
diff --git a/test/.distdep b/test/.distdep
index dad6bc8..7088b0b 100644
--- a/test/.distdep
+++ b/test/.distdep
@@ -396,20 +396,17 @@ testhdf5.o: \
../src/H5private.h \
../src/H5public.h \
../src/H5config.h
-tselect.o: \
- tselect.c \
- testhdf5.h \
- ../src/H5private.h \
+dsets.o: \
+ dsets.c \
+ ../src/hdf5.h \
../src/H5public.h \
../src/H5config.h \
- ../src/H5Eprivate.h \
- ../src/H5Epublic.h \
../src/H5Ipublic.h \
- ../src/hdf5.h \
../src/H5Apublic.h \
../src/H5ACpublic.h \
../src/H5Bpublic.h \
../src/H5Dpublic.h \
+ ../src/H5Epublic.h \
../src/H5Fpublic.h \
../src/H5Gpublic.h \
../src/H5HGpublic.h \
@@ -419,9 +416,10 @@ tselect.o: \
../src/H5Opublic.h \
../src/H5Ppublic.h \
../src/H5Zpublic.h \
- ../src/H5Spublic.h
-dsets.o: \
- dsets.c \
+ ../src/H5Spublic.h \
+ ../src/H5Tpublic.h
+dtypes.o: \
+ dtypes.c \
../src/hdf5.h \
../src/H5public.h \
../src/H5config.h \
@@ -441,18 +439,27 @@ dsets.o: \
../src/H5Ppublic.h \
../src/H5Zpublic.h \
../src/H5Spublic.h \
- ../src/H5Tpublic.h
-dtypes.o: \
- dtypes.c \
- ../src/hdf5.h \
+ ../src/H5Tpublic.h \
+ ../src/H5Tpkg.h \
+ ../src/H5HGprivate.h \
+ ../src/H5Fprivate.h \
+ ../src/H5private.h \
+ ../src/H5Tprivate.h \
+ ../src/H5Gprivate.h
+tselect.o: \
+ tselect.c \
+ testhdf5.h \
+ ../src/H5private.h \
../src/H5public.h \
../src/H5config.h \
+ ../src/H5Eprivate.h \
+ ../src/H5Epublic.h \
../src/H5Ipublic.h \
+ ../src/hdf5.h \
../src/H5Apublic.h \
../src/H5ACpublic.h \
../src/H5Bpublic.h \
../src/H5Dpublic.h \
- ../src/H5Epublic.h \
../src/H5Fpublic.h \
../src/H5Gpublic.h \
../src/H5HGpublic.h \
@@ -462,11 +469,4 @@ dtypes.o: \
../src/H5Opublic.h \
../src/H5Ppublic.h \
../src/H5Zpublic.h \
- ../src/H5Spublic.h \
- ../src/H5Tpublic.h \
- ../src/H5Tpkg.h \
- ../src/H5HGprivate.h \
- ../src/H5Fprivate.h \
- ../src/H5private.h \
- ../src/H5Tprivate.h \
- ../src/H5Gprivate.h
+ ../src/H5Spublic.h
diff --git a/tools/h5ls.c b/tools/h5ls.c
index 7a88ac4..18a1636 100644
--- a/tools/h5ls.c
+++ b/tools/h5ls.c
@@ -5,6 +5,7 @@
* Programmer: Robb Matzke <matzke@llnl.gov>
* Monday, March 23, 1998
*/
+#include <ctype.h>
#include <hdf5.h>
#include <stdio.h>
#include <stdlib.h>
@@ -56,6 +57,59 @@ usage: %s [OPTIONS] FILE [GROUP]\n\
/*-------------------------------------------------------------------------
+ * Function: dump_dataset_values
+ *
+ * Purpose: Prints all values of a dataset.
+ *
+ * Return: void
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, July 21, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+dump_dataset_values(hid_t dset)
+{
+ hid_t file_space, mem_space, type;
+ hsize_t start, file_nelmts, mem_nelmts;
+ hssize_t zero = 0;
+ unsigned char buf[1024];
+ hsize_t i;
+
+ file_space = H5Dget_space(dset);
+ type = H5Dget_type(dset);
+
+ if (H5Tequal(type, H5T_NATIVE_CHAR)) {
+ printf("%*svalue = \"", 26, "");
+ file_nelmts = H5Sextent_npoints(file_space);
+ mem_nelmts = sizeof(buf);
+ mem_space = H5Screate_simple(1, &mem_nelmts, NULL);
+ for (start=0; start<file_nelmts; start+=mem_nelmts) {
+ mem_nelmts = MIN(mem_nelmts, file_nelmts-start);
+ H5Sselect_hyperslab(file_space, H5S_SELECT_SET, &start, NULL,
+ &mem_nelmts, NULL);
+ H5Sselect_hyperslab(mem_space, H5S_SELECT_SET, &zero, NULL,
+ &mem_nelmts, NULL);
+ H5Dread(dset, H5T_NATIVE_CHAR, mem_space, file_space, H5P_DEFAULT,
+ buf);
+ for (i=0; i<mem_nelmts; i++) {
+ if (isprint(buf[i])) putchar(buf[i]);
+ else printf("\\%03o", buf[i]);
+ }
+ }
+ H5Sclose(mem_space);
+ printf("\"\n");
+ }
+
+ H5Sclose(file_space);
+ H5Tclose(type);
+}
+
+
+/*-------------------------------------------------------------------------
* Function: list_attr
*
* Purpose: Prints information about attributes.
@@ -153,6 +207,7 @@ list (hid_t group, const char *name, void __unused__ *op_data)
printf ("}\n");
H5Dclose (space);
H5Aiterate (obj, NULL, list_attr, NULL);
+ dump_dataset_values(obj);
H5Dclose (obj);
} else if ((obj=H5Gopen (group, name))>=0) {
printf ("Group\n");