summaryrefslogtreecommitdiffstats
path: root/tools/misc
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2021-02-22 04:05:43 (GMT)
committerGitHub <noreply@github.com>2021-02-22 04:05:43 (GMT)
commitdf1a4af96126682ea4a05c2b26bf6b7c916579ff (patch)
tree993205ed1edde76001a811532f91997138b46744 /tools/misc
parent88960489604861813b3676bc234f49ca8ee937d3 (diff)
downloadhdf5-df1a4af96126682ea4a05c2b26bf6b7c916579ff.zip
hdf5-df1a4af96126682ea4a05c2b26bf6b7c916579ff.tar.gz
hdf5-df1a4af96126682ea4a05c2b26bf6b7c916579ff.tar.bz2
HDF5 1 8 merge of recent changes and tools (#353)
* Update supported platforms * Merge PR#3 changes from develop * # WARNING: head commit changed in the meantime Merge gcc 10 diagnostics option from develop Merge CMake changes from develop Merge warnings from develop Merge #318 OSX changes from develop Merge tools changes from develop Merge test macros from develop * Format updates * Fix missing semicolon and format fix * Format update * Correct actions, remove java option * Update autotools build files * Add testfiles * Fix configure issue with make flags * Init fapls to default * Update generated files and fix h5repack id closure * update format
Diffstat (limited to 'tools/misc')
-rw-r--r--tools/misc/Makefile.in35
-rw-r--r--tools/misc/h5mkgrp.c188
-rw-r--r--tools/misc/h5repart.c2
-rw-r--r--tools/misc/testfiles/h5mkgrp_help.txt1
4 files changed, 111 insertions, 115 deletions
diff --git a/tools/misc/Makefile.in b/tools/misc/Makefile.in
index 31298b7..24e1579 100644
--- a/tools/misc/Makefile.in
+++ b/tools/misc/Makefile.in
@@ -420,19 +420,18 @@ AMTAR = @AMTAR@
# H5_CFLAGS holds flags that should be used when building hdf5,
# but which should not be exported to h5cc for building other programs.
-# AM_CFLAGS is an automake construct which should be used by Makefiles
+# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
# Include src directory
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/tools/lib
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_LDFLAGS = @AM_LDFLAGS@ @H5_LDFLAGS@
-AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
@@ -463,6 +462,7 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
@@ -490,8 +490,6 @@ GREP = @GREP@
H5_CFLAGS = @H5_CFLAGS@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_LDFLAGS = @H5_LDFLAGS@
@@ -670,15 +668,15 @@ LIBH5_HL = $(top_builddir)/hl/src/libhdf5_hl.la
LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
-# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
-# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
-# prepended to the normal and complete install path that it precedes for the
-# purpose of installing in a temporary directory which is useful for building
-# rpms and other packages. The '/' after ${DESTDIR} will be followed by another
-# '/' at the beginning of the normal install path. When DESTDIR is empty the
-# path then begins with '//', which is incorrect and causes problems at least for
-# Cygwin.
+# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
+# has been removed. According to the official description of DESTDIR by Gnu at
+# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
+# prepended to the normal and complete install path that it precedes for the
+# purpose of installing in a temporary directory which is useful for building
+# rpms and other packages. The '/' after ${DESTDIR} will be followed by another
+# '/' at the beginning of the normal install path. When DESTDIR is empty the
+# path then begins with '//', which is incorrect and causes problems at least for
+# Cygwin.
# Scripts used to build examples
# If only shared libraries have been installed, have h5cc build examples with
@@ -728,7 +726,7 @@ LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES) \
PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS) \
$(EXTRA_PROG)
-chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(EXTRA_TEST)
+chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(EXTRA_TEST)
TEST_EXTENSIONS = .sh
SH_LOG_COMPILER = $(SHELL)
AM_SH_LOG_FLAGS =
@@ -1255,8 +1253,9 @@ uninstall-am: uninstall-binPROGRAMS
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/misc/h5mkgrp.c b/tools/misc/h5mkgrp.c
index f3af4ed..7e92c83 100644
--- a/tools/misc/h5mkgrp.c
+++ b/tools/misc/h5mkgrp.c
@@ -28,15 +28,17 @@ static struct long_options l_opts[] = {{"help", no_arg, 'h'}, {"latest", no_a
{"version", no_arg, 'V'}, {NULL, 0, '\0'}};
/* Command line parameter settings */
-typedef struct {
+typedef struct mkgrp_opt_t {
char * fname; /* File name to operate on */
hbool_t latest; /* Whether file should use latest format versions */
hbool_t verbose; /* Whether output should be verbose */
hbool_t parents; /* Whether to create intermediate groups */
size_t ngroups; /* Number of groups to create */
char ** groups; /* Pointer to array of group names */
-} param_t;
-param_t params; /* Command line parameter settings */
+ hid_t fapl_id; /* fapl to use when opening the file */
+} mkgrp_opt_t;
+
+mkgrp_opt_t params_g; /* Command line parameter settings */
/*-------------------------------------------------------------------------
* Function: leave
@@ -54,13 +56,17 @@ leave(int ret)
{
size_t curr_group;
- if (params.fname)
- HDfree(params.fname);
- if (params.ngroups) {
- for (curr_group = 0; curr_group < params.ngroups; curr_group++)
- HDfree(params.groups[curr_group]);
- HDfree(params.groups);
+ if (params_g.fname)
+ HDfree(params_g.fname);
+ if (params_g.ngroups) {
+ for (curr_group = 0; curr_group < params_g.ngroups; curr_group++)
+ HDfree(params_g.groups[curr_group]);
+ HDfree(params_g.groups);
}
+ if (H5I_INVALID_HID != params_g.fapl_id && H5P_DEFAULT != params_g.fapl_id)
+ if (H5Pclose(params_g.fapl_id) < 0)
+ error_msg("Could not close file access property list\n");
+
h5tools_close();
HDexit(ret);
} /* end leave() */
@@ -77,64 +83,68 @@ leave(int ret)
*-------------------------------------------------------------------------
*/
static void
-usage(void)
+usage(const char *prog)
{
- HDfprintf(stdout, "\
-usage: h5mkgrp [OPTIONS] FILE GROUP...\n\
- OPTIONS\n\
- -h, --help Print a usage message and exit\n\
- -l, --latest Use latest version of file format to create groups\n\
- -p, --parents No error if existing, make parent groups as needed\n\
- -v, --verbose Print information about OBJECTS and OPTIONS\n\
- -V, --version Print version number and exit\n");
+ FLUSHSTREAM(rawoutstream);
+ PRINTSTREAM(rawoutstream, "usage: %s [OPTIONS] FILE GROUP...\n", prog);
+ PRINTVALSTREAM(rawoutstream, " OPTIONS\n");
+ PRINTVALSTREAM(rawoutstream, " -h, --help Print a usage message and exit\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -l, --latest Use latest version of file format to create groups\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -p, --parents No error if existing, make parent groups as needed\n");
+ PRINTVALSTREAM(rawoutstream, " -v, --verbose Print information about OBJECTS and OPTIONS\n");
+ PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
} /* end usage() */
/*-------------------------------------------------------------------------
- * Function: parse_command_line
+ * Function: parse_command_line
*
- * Purpose: Parses command line and sets up global variable to control output
+ * Purpose: Parses command line and sets up global variable to control
+ * output
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
* Programmer: Quincey Koziol, 2/13/2007
*
*-------------------------------------------------------------------------
*/
static int
-parse_command_line(int argc, const char *argv[], param_t *parms)
+parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options)
{
int opt; /* Option from command line */
size_t curr_group; /* Current group name to copy */
/* Check for empty command line */
if (argc == 1) {
- usage();
+ usage(h5tools_getprogname());
leave(EXIT_SUCCESS);
- } /* end if */
+ }
/* Parse command line options */
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
switch ((char)opt) {
/* Display 'help' */
case 'h':
- usage();
+ usage(h5tools_getprogname());
leave(EXIT_SUCCESS);
break;
/* Create objects with the latest version of the format */
case 'l':
- parms->latest = TRUE;
+ options->latest = TRUE;
break;
/* Create parent groups */
case 'p':
- parms->parents = TRUE;
+ options->parents = TRUE;
break;
/* Verbose output */
case 'v':
- parms->verbose = TRUE;
+ options->verbose = TRUE;
break;
/* Display version */
@@ -145,7 +155,7 @@ parse_command_line(int argc, const char *argv[], param_t *parms)
/* Bad command line argument */
default:
- usage();
+ usage(h5tools_getprogname());
leave(EXIT_FAILURE);
} /* end switch */
} /* end while */
@@ -153,43 +163,34 @@ parse_command_line(int argc, const char *argv[], param_t *parms)
/* Check for file name to be processed */
if (argc <= opt_ind) {
error_msg("missing file name\n");
- usage();
+ usage(h5tools_getprogname());
leave(EXIT_FAILURE);
- } /* end if */
+ }
/* Retrieve file name */
- parms->fname = HDstrdup(argv[opt_ind]);
+ options->fname = HDstrdup(argv[opt_ind]);
opt_ind++;
/* Check for group(s) to be created */
if (argc <= opt_ind) {
error_msg("missing group name(s)\n");
- usage();
+ usage(h5tools_getprogname());
leave(EXIT_FAILURE);
- } /* end if */
+ }
/* Allocate space for the group name pointers */
- parms->ngroups = (size_t)(argc - opt_ind);
- parms->groups = (char **)HDmalloc(parms->ngroups * sizeof(char *));
+ options->ngroups = (size_t)(argc - opt_ind);
+ options->groups = (char **)HDmalloc(options->ngroups * sizeof(char *));
/* Retrieve the group names */
curr_group = 0;
while (opt_ind < argc) {
- parms->groups[curr_group] = HDstrdup(argv[opt_ind]);
+ options->groups[curr_group] = HDstrdup(argv[opt_ind]);
curr_group++;
opt_ind++;
- } /* end while */
-
-#ifdef QAK
- HDfprintf(stderr, "parms->parents = %t\n", parms->parents);
- HDfprintf(stderr, "parms->verbose = %t\n", parms->verbose);
- HDfprintf(stderr, "parms->fname = '%s'\n", parms->fname);
- HDfprintf(stderr, "parms->ngroups = %Zu\n", parms->ngroups);
- for (curr_group = 0; curr_group < parms->ngroups; curr_group++)
- HDfprintf(stderr, "parms->group[%Zu] = '%s'\n", curr_group, parms->groups[curr_group]);
-#endif /* QAK */
-
- return (0);
+ }
+
+ return 0;
} /* parse_command_line() */
/*-------------------------------------------------------------------------
@@ -204,117 +205,112 @@ parse_command_line(int argc, const char *argv[], param_t *parms)
int
main(int argc, const char *argv[])
{
- hid_t fid; /* HDF5 file ID */
- hid_t fapl_id; /* File access property list ID */
- hid_t lcpl_id; /* Link creation property list ID */
- size_t curr_group; /* Current group to create */
+ hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
+ hid_t lcpl_id = H5I_INVALID_HID; /* Link creation property list ID */
+ size_t curr_group; /* Current group to create */
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
- /* Disable the HDF5 library's error reporting */
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
-
/* Initialize h5tools lib */
h5tools_init();
- /* Parse command line */
- HDmemset(&params, 0, sizeof(params));
- if (parse_command_line(argc, argv, &params) < 0) {
- error_msg("unable to parse command line arguments\n");
- leave(EXIT_FAILURE);
- } /* end if */
+ /* Initialize the parameters */
+ HDmemset(&params_g, 0, sizeof(params_g));
/* Create file access property list */
- if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ if ((params_g.fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
error_msg("Could not create file access property list\n");
leave(EXIT_FAILURE);
- } /* end if */
+ }
+
+ /* Parse command line */
+ if (parse_command_line(argc, argv, &params_g) < 0) {
+ error_msg("unable to parse command line arguments\n");
+ leave(EXIT_FAILURE);
+ }
+
+ /* enable error reporting if command line option */
+ h5tools_error_report();
/* Check for creating groups with new format version */
- if (params.latest) {
+ if (params_g.latest) {
/* Set the "use the latest version of the format" bounds */
- if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
+ if (H5Pset_libver_bounds(params_g.fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
error_msg("Could not set property for using latest version of the format\n");
leave(EXIT_FAILURE);
- } /* end if */
+ }
/* Display some output if requested */
- if (params.verbose)
+ if (params_g.verbose)
HDprintf("%s: Creating groups with latest version of the format\n", h5tools_getprogname());
- } /* end if */
+ }
/* Attempt to open an existing HDF5 file first */
- fid = h5tools_fopen(params.fname, H5F_ACC_RDWR, fapl_id, NULL, NULL, 0);
+ fid = h5tools_fopen(params_g.fname, H5F_ACC_RDWR, params_g.fapl_id, FALSE, NULL, 0);
/* If we couldn't open an existing file, try creating file */
/* (use "EXCL" instead of "TRUNC", so we don't blow away existing non-HDF5 file) */
if (fid < 0)
- fid = H5Fcreate(params.fname, H5F_ACC_EXCL, H5P_DEFAULT, fapl_id);
+ fid = H5Fcreate(params_g.fname, H5F_ACC_EXCL, H5P_DEFAULT, params_g.fapl_id);
/* Test for error in opening file */
if (fid < 0) {
- error_msg("Could not open output file '%s'\n", params.fname);
+ error_msg("Could not open output file '%s'\n", params_g.fname);
leave(EXIT_FAILURE);
- } /* end if */
+ }
/* Create link creation property list */
if ((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) {
error_msg("Could not create link creation property list\n");
leave(EXIT_FAILURE);
- } /* end if */
+ }
/* Check for creating intermediate groups */
- if (params.parents) {
+ if (params_g.parents) {
/* Set the intermediate group creation property */
if (H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) {
error_msg("Could not set property for creating parent groups\n");
leave(EXIT_FAILURE);
- } /* end if */
+ }
/* Display some output if requested */
- if (params.verbose)
+ if (params_g.verbose)
HDprintf("%s: Creating parent groups\n", h5tools_getprogname());
- } /* end if */
+ }
/* Loop over creating requested groups */
- for (curr_group = 0; curr_group < params.ngroups; curr_group++) {
+ for (curr_group = 0; curr_group < params_g.ngroups; curr_group++) {
hid_t gid; /* Group ID */
/* Attempt to create a group */
- if ((gid = H5Gcreate2(fid, params.groups[curr_group], lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
- error_msg("Could not create group '%s'\n", params.groups[curr_group]);
+ if ((gid = H5Gcreate2(fid, params_g.groups[curr_group], lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ error_msg("Could not create group '%s'\n", params_g.groups[curr_group]);
leave(EXIT_FAILURE);
- } /* end if */
+ }
/* Close the group */
if (H5Gclose(gid) < 0) {
- error_msg("Could not close group '%s'??\n", params.groups[curr_group]);
+ error_msg("Could not close group '%s'??\n", params_g.groups[curr_group]);
leave(EXIT_FAILURE);
- } /* end if */
+ }
/* Display some output if requested */
- if (params.verbose)
- HDprintf("%s: created group '%s'\n", h5tools_getprogname(), params.groups[curr_group]);
+ if (params_g.verbose)
+ HDprintf("%s: created group '%s'\n", h5tools_getprogname(), params_g.groups[curr_group]);
} /* end for */
/* Close link creation property list */
if (H5Pclose(lcpl_id) < 0) {
error_msg("Could not close link creation property list\n");
leave(EXIT_FAILURE);
- } /* end if */
+ }
/* Close file */
if (H5Fclose(fid) < 0) {
- error_msg("Could not close output file '%s'??\n", params.fname);
+ error_msg("Could not close output file '%s'??\n", params_g.fname);
leave(EXIT_FAILURE);
- } /* end if */
-
- /* Close file access property list */
- if (H5Pclose(fapl_id) < 0) {
- error_msg("Could not close file access property list\n");
- leave(EXIT_FAILURE);
- } /* end if */
+ }
leave(EXIT_SUCCESS);
} /* end main() */
diff --git a/tools/misc/h5repart.c b/tools/misc/h5repart.c
index f13f801..93b6abf 100644
--- a/tools/misc/h5repart.c
+++ b/tools/misc/h5repart.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Wednesday, May 13, 1998
*
* Purpose: Repartitions a file family. This program can be used to
diff --git a/tools/misc/testfiles/h5mkgrp_help.txt b/tools/misc/testfiles/h5mkgrp_help.txt
index ba130f6..2f67c4b 100644
--- a/tools/misc/testfiles/h5mkgrp_help.txt
+++ b/tools/misc/testfiles/h5mkgrp_help.txt
@@ -5,3 +5,4 @@ usage: h5mkgrp [OPTIONS] FILE GROUP...
-p, --parents No error if existing, make parent groups as needed
-v, --verbose Print information about OBJECTS and OPTIONS
-V, --version Print version number and exit
+