hdf5/bin/errors

141 lines
4.7 KiB
Plaintext
Raw Normal View History

#!/usr/local/bin/perl -w
require 5.003;
use Text::Tabs;
[svn-r514] Changes since 19980715 ---------------------- ./src/H5Flow.c ./src/H5Fprivate.h ./src/H5Fsplit.c Changed the allocation size request from `size_t' to `hsize_t' because it was overflowing for the `big' test. ./src/H5detect.c If `long double' and `double' are the same size then we define H5T_NATIVE_LDOUBLE to be the same as H5T_NATIVE_DOUBLE. Similarly for `long' vs. `long long' and `unsigned long' vs. `unsigned long long'. ./test/Makefile.in Added `big' to the list of tests to normally run. ./test/big.c Added a check to see if the file system supports holes and if it doesn't then the test is skipped. ./RELEASE Added a couple minor details details about API tracing and symbolic links. ./src/H5public.h Added comments about the use of hbool_t. Fixed a comment spelling error. ./test/testhdf5.h Changed the way the version number is printed. The old method was `hdf5-1.2.3d' and the new method is `hdf5 version 1.2 release 3' ./tools/h5ls.c Only prints the max dimension if it differs from the current dimension or if verbose mode is enabled. Added switches `-?', `-h', and `--help' to print a usage message. Added switches `-v' and `--verbose' to generate more verbose output. Added switches `-V' and `--version' to print the version number and exit. The version number is printed like: This is h5ls version 1.0 release 24' ./bin/h5vers [NEW] This script prints, sets, and/or increments the hdf5 version number. It can be run from the top directory or any of the child directories like src, tools, test, etc. Some examples: $ h5vers # Display current version 1.0.24 $ h5vers -v version 1.0 release 24 # Display current version. $ h5vers -s 5.2.8 # Set version and display 5.2.8 $ h5vers -s 2.1 2.1.0 $ h5vers -s hdf5-1.0.24a.tar.bz2 1.0.24 $ h5vers -s 'version 2.0 release 8' 2.0.8 $ h5vers -s 'junk 22 junk 33 more junk 66 and 99 junk' 33.66.99 $ h5vers -i major # Increment from 1.0.24 2.0.0 $ h5vers -i minor # Increment from 1.0.24 1.1.0 $ h5vers -i release # Increment from 1.0.24 1.0.25 $ h5vers ~/hdf5/src/H5public.h # Use an alternate file 1.0.24 ./bin/checkapi [NEW] Run from the src directory with arguments H5[A-Z]*.c and it will print the locations of each place where an API function was called from within the library. Use it as the compile or grep command under Emacs and you can C-x ` through the list. ./bin/debug-ohdr [NEW] Keeps track of H5O_open() and H5O_close() debugging messages and lists the file addresses of the object headers that are opened but never closed. You must enable the `o' debugging at configuration time and pipe stderr into this script. ./bin/errors Added a note to indicate that this script no longer works because of changes in the HRETURN_ERROR() and HGOTO_ERROR() macros. ./bin/iostats [NEW] Watches output from the Linux strace program and accumulates statistics about low-level access to an hdf5 file. The output is a list of 2d data points which can be plotted by gnuplot to show file seeking behavior. ./MANIFEST Added new files.
1998-07-18 03:03:43 +08:00
# NOTE: THE FORMAT OF HRETURN_ERROR AND HGOTO_ERROR MACROS HAS
# CHANGED. THIS SCRIPT NO LONGER WORKS! --rpm
# Copyright by The HDF Group.
# Copyright by the Board of Trustees of the University of Illinois.
# All rights reserved.
#
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the files COPYING and Copyright.html. COPYING can be found at the root
# of the source code distribution tree; Copyright.html can be found at the
# root level of an installed copy of the electronic HDF5 document set and
# is linked from the top-level documents page. It can also be found at
# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
# access to either file, you may request a copy from help@hdfgroup.org.
#
# Robb Matzke, matzke@llnl.gov
# 30 Aug 1997
#
# Purpose: This script will read standard input which should be a
# function prologue followed by a C function and will emit
# on standard output the same source code with the function
# prologue containing documentation for the various errors
# that occur in the function.
#
# Errors are raised by calling HGOTO_ERROR() or
# HRETURN_ERROR(). The reason for the error message is a
# comment which appears immediately after the error macro
# call and is contained entirely on one line:
#
# HRETURN_ERROR (...); /*entry not found*/
#
# If such a comment doesn't exist, then the previous comment
# is used, subject to the constraint that raising an error
# clears the previous comment.
#
# /* Entry not found */
# HGOTO_ERROR (...);
#
# Emacs users can use this script interactively with the
# c-mark-function and shell-command-on-region functions which
# are normally bound to M-C-h and M-|.
# Split STDIN into the prolog and the function body. Preserve leading
# white space.
$_ = join "", <STDIN>;
my ($head, $prolog, $body) = (/^(\s*)(\/\*(.*?)\*\/)?(.*)/s)[0,2,3];
$prolog = "" unless $prolog;
# Find each error and the comment that goes with it.
for ($_=$body,$comment=""; /\/\*|H(RETURN|GOTO)_ERROR/s;) {
$_ = $&.$';
if (/^H(RETURN|GOTO)_ERROR\s*\(\s*H5E_(\w+)\s*,\s*H5E_(\w+)\s*,/s) {
($major, $minor, $_) = ($2, $3, $');
$comment=$1 if /^.*?\)\s*;\s*\/\*\s*(.*?)\s*\*\//;
$comment =~ s/^\s*\*+\s*/ /mg; # leading asterisks.
$comment =~ s/^\s+//s; # leading white space.
$comment =~ s/\s+$//s; # trailing white space.
$comment =~ s/(\w)$/$1./s; # punctuation.
$comment ||= "***NO COMMENT***";
$errors{"$major\000$minor\000\u$comment"} = 1;
$comment = "";
} else {
($comment) = /^\/\*\s*(.*?)\s*\*\//s;
$_ = $';
}
}
# Format an error so it isn't too wide.
sub fmt_error ($) {
local ($_) = @_;
my ($prefix,$space,$err) = /^((.*?)([A-Z_0-9]+\s+[A-Z_0-9]+\s+))/;
$_ = $';
tr/\n / /s;
my $w = 70 - length expand $prefix;
s/(.{$w}\S+)\s+(\S)/$1."\n".$space.' 'x(length $err).$2/eg;
return $prefix . $_."\n";
}
# Sort the errors by major, then minor, then comment. Duplicate
# triplets have already been removed.
sub by_triplet {
my ($a_maj, $a_min, $a_com) = split /\000/, $a;
my ($b_maj, $b_min, $b_com) = split /\000/, $b;
$a_maj cmp $b_maj || $a_min cmp $b_min || $a_com cmp $b_com;
}
@errors = map {sprintf "%-9s %-13s %s\n", split /\000/}
sort by_triplet keys %errors;
# Add the list of errors to the prologue depending on the type of
# prolog.
if (($front, $back) = $prolog=~/^(.*?Errors:\s*?(?=\n)).*?\n\s*\*\s*\n(.*)/s) {
#| * Errors: |#
#| * __list_of_error_messages__ (zero or more lines) |#
#| * |#
print $head, "/*", $front, "\n";
map {print fmt_error " *\t\t".$_} @errors;
print " *\n", $back, "*/", $body;
} elsif (($front,$back) = $prolog =~
/(.*?\n\s*ERRORS:?\s*?(?=\n)).*?\n\s*\n(.*)/s) {
#| ERRORS |#
#| __list_of_error_messages__ (zero or more lines) |#
#| |#
print $head, "/*", $front, "\n";
map {print fmt_error " ".$_} @errors;
print "\n", $back, "*/", $body;
} elsif ($prolog eq "") {
# No prolog present.
print $head;
print " \n/*", "-"x73, "\n * Function:\t\n *\n * Purpose:\t\n *\n";
print " * Errors:\n";
map {print fmt_error " *\t\t".$_} @errors;
print " *\n * Return:\tSuccess:\t\n *\n *\t\tFailure:\t\n *\n";
print " * Programmer:\t\n *\n * Modifications:\n *\n *", '-'x73, "\n";
print " */\n", $body;
} else {
# Prolog format not recognized.
print $head, "/*", $prolog, "*/\n\n";
print "/*\n * Errors returned by this function...\n";
map {print fmt_error " *\t".$_} @errors;
print " */\n", $body;
}