diff options
-rw-r--r-- | MANIFEST | 4 | ||||
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | RELEASE | 16 | ||||
-rwxr-xr-x | bin/checkapi | 35 | ||||
-rwxr-xr-x | bin/checkposix | 2 | ||||
-rwxr-xr-x | bin/debug-ohdr | 26 | ||||
-rwxr-xr-x | bin/errors | 3 | ||||
-rwxr-xr-x | bin/h5vers | 154 | ||||
-rwxr-xr-x | bin/iostats | 40 | ||||
-rw-r--r-- | src/H5public.h | 19 | ||||
-rw-r--r-- | test/.distdep | 60 | ||||
-rw-r--r-- | test/testhdf5.c | 4 | ||||
-rw-r--r-- | tools/h5ls.c | 105 |
13 files changed, 413 insertions, 57 deletions
@@ -11,12 +11,16 @@ ./README ./RELEASE ./acconfig.h +./bin/checkapi ./bin/checkposix ./bin/config.guess ./bin/config.sub +./bin/debug-ohdr ./bin/distdep ./bin/errors +./bin/h5vers ./bin/install-sh +./bin/iostats ./bin/release ./bin/trace ./bin/versinc @@ -1,4 +1,4 @@ -This is hdf5-1.0.23a released on 1998-06-15 18:31 UTC +This is hdf5-1.0.24a released on 1998-06-17 14:14 UTC Please refer to the INSTALL file for installation instructions. ------------------------------------------------------------------------------ @@ -1,5 +1,5 @@ Release information for hdf5-1.0.23a ------------------------------------ +------------------------------------ CHANGES SINCE THE FIRST ALPHA @@ -37,12 +37,12 @@ Release information for hdf5-1.0.23a which correspond to the standard C types like H5T_NATIVE_INT. * More debugging support was added. If tracing is enabled at - configuration time and the HDF5_TRACE environment variable is set to - a file descriptor then all API calls will emit the function name, - argument names and values, and return value on that file number. - There is an html document that describes this. If appropriate - debugging options are enabled at configuration time, some packages - will display performance information on stderr. + configuration time (the default) and the HDF5_TRACE environment + variable is set to a file descriptor then all API calls will emit + the function name, argument names and values, and return value on + that file number. There is an html document that describes this. + If appropriate debugging options are enabled at configuration time, + some packages will display performance information on stderr. * Data types can be stored in the file as independent objects and multiple datasets can share a data type. @@ -60,7 +60,7 @@ Release information for hdf5-1.0.23a HDF5. * Hard and soft (symbolic) links are implemented which allow groups to - share objects. + share objects. Dangling and recursive symbolic links are supported. * User-defined data compression is implemented although we may generalize the interface to allow arbitrary user-defined filters diff --git a/bin/checkapi b/bin/checkapi new file mode 100755 index 0000000..7447b26 --- /dev/null +++ b/bin/checkapi @@ -0,0 +1,35 @@ +#!/usr/bin/perl -w +require 5.003; + +# Purpose: insures that API functions aren't called internally. +# Usage: checkapi H5*.c +my $comment = 0; +while (<>) { + + # Remove comments within the line. + s/\/\*.*?\*\///g; + + # Process comment begin and end tokens on this line. + $comment-- if /\*\//; # count comment ends + next if $comment; # skip line if in comment + $comment++ if /\/\*/; # count comment starts + s/(.*)\/\*.*/$1/; # remove comments that begin on this line + + # Remove character strings + s/\\.//g; # remove escaped characters + s/\".*?\"//g; # remove string constants + + # Disregard the following hits + next if /^H5/; + next if /^\#/; + next if /FUNC_ENTER/; + + next unless /(H5[A-Z]{1,2}[a-z]\w*)/; + print "$ARGV:$.: $1\n"; +} continue { + if (eof) { + print "$ARGV:$.: bad comment nesting\n" if $comment; + $comment = 0; + close ARGV; # reset line number + } +} diff --git a/bin/checkposix b/bin/checkposix index 229a106..ef2951b 100755 --- a/bin/checkposix +++ b/bin/checkposix @@ -35,6 +35,8 @@ while (<>) { # Get rid of string constants if they begin and end on this line. s/([\'\"])([^\1]|\\\1)*?\1/$1$1/g; + # Get rid of preprocessor directives + s/^\#.*//; # Now find all function calls on this line while (($name)=/\b([a-gi-z_A-GI-Z]\w*)\s*\(/) { diff --git a/bin/debug-ohdr b/bin/debug-ohdr new file mode 100755 index 0000000..f176a58 --- /dev/null +++ b/bin/debug-ohdr @@ -0,0 +1,26 @@ +#!/usr/bin/perl +require 5.003; + +# Looks for lines emitted by H5O_open() and H5O_close() and tries to +# determine which objects were not properly closed. + +while (<>) { + next unless /^([<>])(0x[\da-f]+|\d+)$/; + my ($op, $addr) = ($1, $2); + + if ($op eq ">") { + # Open object + $obj{$addr} += 1; + } else { + # Close object + die unless $obj{$addr}>0; + $obj{$addr} -= 1; + delete $obj{$addr} unless $obj{$addr}; + } +} + +for (sort keys %obj) { + printf "%3d %s\n", $obj{$_}, $_; +} + +exit 0; @@ -2,6 +2,9 @@ require 5.003; use Text::Tabs; +# NOTE: THE FORMAT OF HRETURN_ERROR AND HGOTO_ERROR MACROS HAS +# CHANGED. THIS SCRIPT NO LONGER WORKS! --rpm + # Copyright (C) 1997 National Center for Supercomputing Applications. # All rights reserved. # diff --git a/bin/h5vers b/bin/h5vers new file mode 100755 index 0000000..a4ddefc --- /dev/null +++ b/bin/h5vers @@ -0,0 +1,154 @@ +#!/usr/bin/perl -w +require 5.003; + +### Copyright © 1998 NCSA. +# Robb Matzke <matzke@llnl.gov> +# 17 July 1998 + +### Purpose +# Increments the hdf5 version number by changing the value of +# constants in the src/H5public.h file. The new version number is +# printed on the standard output. An alternate source file name can be +# specified as an argument. In any case, the original file is saved +# by appending a tilde `~' to the name. + +### Usage: +# h5vers [OPTIONS] [FILE] + +# Without options this program only displays the current version and +# doesn't modify any files or create backups. The default is to print +# the version number as a dotted triple like `1.0.24' but with the +# `-v' option the version will be printed as `version 1.0 release 24'. +# +# The `-s VERSION' switch will set the version as specified. If the +# string contains a dotted triple then it will be used as the version +# number, otherwise up to three numbers will be read from the end of +# the string and used as the major version, minor version, and release +# number. If any numbers are missing then zero is assumed. This +# allows versions to be specified like `-s "version 2.1 release 8"' or +# `-s hdf5-2.1.8.tar.bz2'. If the new version is less than the old +# version then a warning message is generated on standard error. +# +# The `-i [major|minor|release]' option increments the major, minor, +# or release (the default) number. If the minor number is incremented +# then the release number is set to zero; if the major number is +# incremented then the minor and release numbers are set to zero. +# +# If a file is specified then that file is used instead of +# ./H5public.h or ./src/H5public.h. +############################################################################## + +sub getvers { + local ($_) = @_; + my (@vers); + + ($vers[0]) = /^\#\s*define\s+H5_VERS_MAJOR\s+(\d+)/m; + ($vers[1]) = /^\#\s*define\s+H5_VERS_MINOR\s+(\d+)/m; + ($vers[2]) = /^\#\s*define\s+H5_VERS_RELEASE\s+(\d+)/m; + return @vers; +} + +sub setvers { + my ($contents, @vers) = @_; + $_[0] =~ s/^(\#\s*define\s+H5_VERS_MAJOR\s+)\d+/$1$vers[0]/m; + $_[0] =~ s/^(\#\s*define\s+H5_VERS_MINOR\s+)\d+/$1$vers[1]/m; + $_[0] =~ s/^(\#\s*define\s+H5_VERS_RELEASE\s+)\d+/$1$vers[2]/m; +} + +# Parse arguments +my ($verbose, $set, $inc, $file); +my (@files) = ("H5public.h", "src/H5public.h", "../src/H5public.h"); +while ($_ = shift) { + $_ eq "-s" && do { + die "-s switch needs a version number\n" unless @ARGV; + $set = shift; + next; + }; + + $_ eq "-i" && do { + die "-i switch needs a value\n" unless @ARGV; + $inc = shift; + next; + }; + + $_ eq "-v" && do { + $verbose = 1; + next; + }; + + + /^-/ && die "unrecognized option: $ARGV[0]\n"; + die "only one file name can be specified\n" if $file; + $file = _; +} +die "mutually exclusive options given\n" if $set && $inc; + +# Determine file to use +unless ($file) { + for (@files) { + ($file=$_,last) if -f $_; + } +} +die "unable to read file: $file\n" unless -r $file; + +# Get the current version number. +open FILE, $file or die "unable to open $file: $!\n"; +my ($contents) = join "", <FILE>; +close FILE; +my (@curver) = getvers $contents; + +# Determine the new version number. +if ($set) { + if ($set =~ /(\d+)\.(\d+)\.(\d+)/) { + @newver = ($1, $2, $3); + } elsif ($set =~ /(\d+)\D+(\d+)\D+(\d+)\D*$/) { + @newver = ($1, $2, $3); + } elsif ($set =~ /(\d+)\D+(\d+)\D*$/) { + @newver = ($1, $2, 0); + } elsif ($set =~ /(\d+)\D*$/) { + @newver = ($1, 0, 0); + } else { + die "illegal version number specified: $set\n"; + } +} elsif ($inc && $inc eq "major") { + $newver[0] = $curver[0]+1; + @newver[1,2] = (0,0); +} elsif ($inc && $inc eq "minor") { + $newver[0] = $curver[0]; + $newver[1] = $curver[1]+1; + $newver[2] = 0; +} elsif ($inc && $inc eq "release") { + @newver[0,1] = @curver[0,1]; + $newver[2] = $curver[2]+1; +} elsif ($inc) { + die "unknown increment field: $inc\n"; +} else { + @newver = @curver; +} + +# Print a warning if the version got smaller. +if ($newver[0]*1000000 + $newver[1]*1000 + $newver[2] < + $curver[0]*1000000 + $curver[1]*1000 + $curver[2]) { + printf STDERR "Warning: version decreased from %d.%d.%d to %d.%d.%d\n", + @curver, @newver; +} + +# Update the version number if it changed. +if ($newver[0]!=$curver[0] || + $newver[1]!=$curver[1] || + $newver[2]!=$curver[2]) { + setvers $contents, @newver or die "unable to set version\n"; + rename $file, "$file~" or die "unable to save backup file\n"; + open FILE, ">$file" or die "unable to open $file but backup saved!\n"; + print FILE $contents; + close FILE; +} + +# Print the new version number +if ($verbose) { + printf "version %d.%d release %d\n", @newver; +} else { + printf "%d.%d.%d\n", @newver; +} + +exit 0; diff --git a/bin/iostats b/bin/iostats new file mode 100755 index 0000000..924c273 --- /dev/null +++ b/bin/iostats @@ -0,0 +1,40 @@ +#!/usr/bin/perl + +# Usage: pipe the output of Linux's `strace' program into the stdin of +# this command, and the output of this command into gnuplot. + +$filename = shift || "tstab2.h5"; +$total = 0; + +while (<>) { + if (!defined $fd) { + if (/^open\("(.*?)".*=\s+(\d+)/ && $1 eq $filename) { + $fd = $2; + $pos = 0; + } + } elsif (/^close\((\d+)/ && $1==$fd) { + $fd = undef; + } elsif (/^lseek\((\d+), -?\d+,.*= (\d+)/ && + $1==$fd && $2>=0) { + $pos = $2; + } elsif (/^lseek\((\d+),/ && $1==$fd) { + die $_; + } elsif (/^write\((\d+), ".*?"(\.\.\.)?, \d+\)\s*= (\d+)/ && + $1==$fd && $3>=0) { + my $nbytes = $3; + printf "%d %d\n", $total, $pos; + $pos += $nbytes; + $total += $nbytes; + } elsif (/^write\((\d+),/ && $1==$fd) { + die $_; + } elsif (/^read\((\d+), ".*?"(\.\.\.)?, \d+\)\s*= (\d+)/ && + $1==$fd && $3>=0) { + my $nbytes = $3; + printf "%d %d\n", $total, $pos; + $pos += $nbytes; + $total += $nbytes; + } elsif (/^read\((\d+),/ && $1==$fd) { + die $_; + } +} + diff --git a/src/H5public.h b/src/H5public.h index c13ec17..eb78630 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -27,7 +27,7 @@ /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface changes */ #define H5_VERS_MINOR 0 /* For minor interface changes */ -#define H5_VERS_RELEASE 23 /* For interface tweaks & bug-fixes */ +#define H5_VERS_RELEASE 24 /* For interface tweaks & bug-fixes */ #define H5_VERS_PATCH 0 /* For small groups of bug fixes */ #define H5check() H5vers_check(H5_VERS_MAJOR,H5_VERS_MINOR,\ @@ -41,18 +41,29 @@ * proper way to detect failure is something like: * * if ((dset = H5Dopen (file, name))<0) { - * fprintf (stderr, "unable to open the requested dataset\n"); + * fprintf (stderr, "unable to open the requested dataset\n"); * } */ typedef int herr_t; /* - * Boolean type. + * Boolean type. Successful return values are zero (false) or positive + * (true). The typical true value is 1 but don't bet on it. Boolean + * functions can also fail, returning a negative value as described above. + * The proper way to test for truth is: + * + * if ((retval = H5Tcommitted(type))>0) { + * printf("data type is committed\n"); + * } else if (!retval) { + * printf("data type is not committed\n"); + * } else { + * printf("error determining whether data type is committed\n"); + * } */ typedef int hbool_t; /* - * The sizes of file-objects in hdf5 have there own types defined here. On + * The sizes of file-objects in hdf5 have their own types defined here. On * most systems, these are the same as size_t and ssize_t, but on systems * with small address spaces these are defined to be larger. */ diff --git a/test/.distdep b/test/.distdep index 36186c3..349087e 100644 --- a/test/.distdep +++ b/test/.distdep @@ -344,12 +344,6 @@ bittests.o: \ ../src/H5Gprivate.h \ ../src/H5Gpublic.h \ ../src/H5Bprivate.h -testhdf5.o: \ - testhdf5.c \ - testhdf5.h \ - ../src/H5private.h \ - ../src/H5public.h \ - ../src/H5config.h tattr.o: \ tattr.c \ testhdf5.h \ @@ -374,30 +368,6 @@ tattr.o: \ ../src/H5Ppublic.h \ ../src/H5Zpublic.h \ ../src/H5Spublic.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/H5Fpublic.h \ - ../src/H5Gpublic.h \ - ../src/H5HGpublic.h \ - ../src/H5HLpublic.h \ - ../src/H5MFpublic.h \ - ../src/H5MMpublic.h \ - ../src/H5Opublic.h \ - ../src/H5Ppublic.h \ - ../src/H5Zpublic.h \ - ../src/H5Spublic.h th5s.o: \ th5s.c \ testhdf5.h \ @@ -470,3 +440,33 @@ big.o: \ ../src/H5Spublic.h \ ../src/H5Tpublic.h \ ../src/H5private.h +testhdf5.o: \ + testhdf5.c \ + testhdf5.h \ + ../src/H5private.h \ + ../src/H5public.h \ + ../src/H5config.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/H5Fpublic.h \ + ../src/H5Gpublic.h \ + ../src/H5HGpublic.h \ + ../src/H5HLpublic.h \ + ../src/H5MFpublic.h \ + ../src/H5MMpublic.h \ + ../src/H5Opublic.h \ + ../src/H5Ppublic.h \ + ../src/H5Zpublic.h \ + ../src/H5Spublic.h diff --git a/test/testhdf5.c b/test/testhdf5.c index 0847e4d..bf63046 100644 --- a/test/testhdf5.c +++ b/test/testhdf5.c @@ -175,8 +175,8 @@ main(int argc, char *argv[]) H5version(&major, &minor, &release, &patch); print_func("\nFor help use: testhdf5 -help\n"); - print_func("Linked with hdf5-%u.%u.%u%c\n\n", (unsigned) major, - (unsigned) minor, (unsigned) release, 'a' + patch); + print_func("Linked with hdf5 version %u.%u release %u\n", + (unsigned)major, (unsigned)minor, (unsigned)release); for (CLLoop = 1; CLLoop < argc; CLLoop++) { if ((argc > CLLoop + 1) && ((HDstrcmp(argv[CLLoop], "-verbose") == 0) || (HDstrcmp(argv[CLLoop], "-v") == 0))) { diff --git a/tools/h5ls.c b/tools/h5ls.c index 3e8a378..f6e3de7 100644 --- a/tools/h5ls.c +++ b/tools/h5ls.c @@ -19,13 +19,39 @@ # define __unused__ __attribute__((unused)) #endif +/* Verbosity level */ +static int verbose_g = 0; + + +/*------------------------------------------------------------------------- + * Function: usage + * + * Purpose: Prints a usage message on stderr and then returns. + * + * Return: void + * + * Programmer: Robb Matzke + * Thursday, July 16, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ static void usage (const char *progname) { - fprintf (stderr, "usage: %s FILE [GROUP]\n", progname); - fprintf (stderr, " The file name may contain a printf integer format " - "to open a file family.\n"); - exit (1); + fprintf(stderr, "\ +usage: %s [OPTIONS] FILE [GROUP]\n\ + OPTIONS\n\ + -h, -?, --help Print a usage message and exit\n\ + -v, --verbose Generate more verbose output\n\ + --version Print version number and exit\n\ + FILE\n\ + The file name may include a printf(3C) integer format such as\n\ + \"%%05d\" to open a file family.\n\ + GROUP\n\ + If a group name is not specified then the contents of the root group\n\ + \"/\" are displayed.\n", progname); } @@ -117,11 +143,12 @@ list (hid_t group, const char *name, void __unused__ *op_data) int ndims = H5Sextent_dims(space, size, maxsize); printf ("Dataset {"); for (i=0; i<ndims; i++) { - HDfprintf (stdout, "%s%Hu", i?", ":"", size[i]); - if (maxsize[i]==H5S_UNLIMITED) + HDfprintf (stdout, "%s%Hu", i?", ":"", size[i]); + if (maxsize[i]==H5S_UNLIMITED) { HDfprintf (stdout, "/%s", "Inf"); - else - HDfprintf (stdout, "/%Hu", maxsize[i]); + } else if (maxsize[i]!=size[i] || verbose_g>0) { + HDfprintf(stdout, "/%Hu", maxsize[i]); + } } printf ("}\n"); H5Dclose (space); @@ -174,14 +201,68 @@ main (int argc, char *argv[]) const char *fname = NULL; const char *gname = "/"; const char *progname; + const char *s; + int argno; - /* Arguments */ + /* Name of this program without the path */ if ((progname=strrchr (argv[0], '/'))) progname++; else progname = argv[0]; - if (argc<2 || argc>3) usage (progname); - fname = argv[1]; - if (argc>=3) gname = argv[2]; + + /* Switches come before non-switch arguments */ + for (argno=1; argno<argc && '-'==argv[argno][0]; argno++) { + if (!strcmp(argv[argno], "--")) { + /* Last switch */ + argno++; + break; + } else if (!strcmp(argv[argno], "--help")) { + usage(progname); + exit(0); + } else if (!strcmp(argv[argno], "--verbose")) { + verbose_g++; + } else if (!strcmp(argv[argno], "--version")) { + printf("This is %s version %u.%u release %u\n", + progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); + exit(0); + } else if ('-'!=argv[argno][1]) { + /* Single-letter switches */ + for (s=argv[argno]+1; *s; s++) { + switch (*s) { + case '?': + case 'h': /* --help */ + usage(progname); + exit(0); + case 'v': /* --verbose */ + verbose_g++; + break; + case 'V': /* --version */ + printf("This is %s version %u.%u release %u\n", + progname, H5_VERS_MAJOR, H5_VERS_MINOR, + H5_VERS_RELEASE); + exit(0); + default: + usage(progname); + exit(1); + } + } + } else { + usage(progname); + exit(1); + } + } + /* Non-switch arguments */ + if (argno<argc) { + fname = argv[argno++]; + } else { + usage(progname); + exit(1); + } + if (argno<argc) gname = argv[argno++]; + if (argno<argc) { + usage(progname); + exit(1); + } + /* * Open the file. If the file name contains a `%' then assume that a * file family is being opened. |