hdf5/tools/h5import.c
Robb Matzke eb5e01d37c [svn-r620] Changes since 19980825
----------------------

./MANIFEST
./src/H5R.c		[NEW]
./src/H5Rprivate.h	[NEW]
./src/H5Rpublic.h	[NEW]
./src/Makefile.in
./src/hdf5.h
./test/ragged.c		[NEW]
	Preliminary support for 2d ragged arrays for Mark Miller and
	Jim Reus.  Not fully implemented yet. The test is not actually
	part of `make test' because we still have some memory problems.

./src/H5E.c
./src/H5Epublic.h
	Added H5E_RAGGED as a major error number.

./bin/release
	Checks the MANIFEST file against `svf ls' on systems that have
	it.

./bin/trace
	Fixed a bug that caused arguments of type `void *x[]' to not
	be handled.

./src/H5.c
	Removed unused variables and changed a couple types to
	fix compiler warnings.

	Added tracing support for ragged array object ID's and arrays
	of pointers.

./src/H5D.c
	H5Dcreate() will complain if either of the property lists are
	invalid (instead of using the default).

./src/H5D.c
./src/H5Dprivate.h
	Split H5Dget_space() into an API and internal function so it
	can be called from the new ragged array layer.

./src/H5Fistore.c
	Fixed warnings about unsigned vs. signed comparisons.

./src/H5Flow.c
	Fixed a warning about a variable being shadowed in the MPI-IO
	stuff.

./src/H5Iprivate.h
./src/H5Ipublic.h
	Added the H5_RAGGED atom group.

./src/H5Shyper.c
	Fixed some freeing-free-memory errors that resulted when
	certain arrays were freed but the pointers were left in the
	data structures.  I simply set the pointers to null after they
	were freed.

./src/H5Sprivate.h
./src/H5Sselect.c
	Split the H5Sselect_hyperslab() function into an API and a
	private function so it could be called from the ragged array
	layer.

	Added H5S_SEL_ERROR and H5S_SEL_N to the switch statements to
	get rid or compiler warnings.

./src/H5Tconv.c
	Removed a misleading comment.

./test/bittests.c
	Fixed a warning about a printf().

./test/cmpd_dset.c
	Fixed warnings about unused variables because of test #11
	being commented out.

./bin/trace
	Shortened the right margin for the output to allow room for
	the `);' at the end of the TRACE() macros.
1998-08-27 11:48:50 -05:00

126 lines
2.6 KiB
C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* Copyright (C) 1998 NCSA
* All rights reserved.
*
* Programmer: Robb Matzke <matzke@llnl.gov>
* Thursday, June 11, 1998
*
* Purpose: Create an hdf5 file with a 1d dataset of uint8.
*/
#include <fcntl.h>
#include <hdf5.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/stat.h>
/*-------------------------------------------------------------------------
* Function: usage
*
* Purpose: Print a usage message and exit with non-zero status
*
* Return: never returns
*
* Programmer: Robb Matzke
* Thursday, June 11, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static void
usage (const char *argv0)
{
fprintf (stderr, "Usage: %s -f HDF5-FILE FILES...\n", argv0);
exit (1);
}
/*-------------------------------------------------------------------------
* Function: main
*
* Purpose:
*
* Return: Success: 0
*
* Failure: 1
*
* Programmer: Robb Matzke
* Thursday, June 11, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
int
main (int argc, char *argv[])
{
hid_t file, space=-1, dset=-1;
const char *output_name, *dset_name;
int argno, fd=-1;
hsize_t size[1];
struct stat sb;
/* Parse arguments */
if (argc<4) usage (argv[0]);
if (strcmp (argv[1], "-f")) usage (argv[0]);
output_name = argv[2];
/* create the file */
H5E_BEGIN_TRY {
if ((file = H5Fcreate (output_name, H5F_ACC_EXCL,
H5P_DEFAULT, H5P_DEFAULT))<0 &&
(file = H5Fopen (output_name, H5F_ACC_RDWR, H5P_DEFAULT)<0)) {
fprintf (stderr, "%s: unable to create or open hdf5 file\n",
output_name);
exit (1);
}
} H5E_END_TRY;
/* process files from command-line */
for (argno=3; argno<argc; argno++) {
/* Open the file */
if ((dset_name=strrchr (argv[argno], '/'))) dset_name++;
else dset_name = argv[argno];
fprintf (stderr, "%s\n", dset_name);
if ((fd=open (argv[argno], O_RDONLY))<0) {
perror (argv[argno]);
goto next;
}
if (fstat (fd, &sb)<0) {
perror (argv[argno]);
goto next;
}
/* Data space */
size[0] = sb.st_size;
if ((space = H5Screate_simple (1, size, size))<0) goto next;
/* Dataset */
if ((dset=H5Dcreate (file, dset_name, H5T_NATIVE_CHAR,
space, H5P_DEFAULT))<0) goto next;
next:
if (fd>=0) close (fd);
fd = -1;
H5E_BEGIN_TRY {
if (space>=0) {
H5Sclose (space);
space = -1;
}
if (dset>=0) {
H5Dclose (dset);
dset = -1;
}
} H5E_END_TRY;
}
/* Close the file */
H5Fclose (file);
return 0;
}