[svn-r971] Changes since 19981214

----------------------

./INSTALL
	Added warning that enabling debugging code can adversely
	affect performance even when the debugging isn't turned on at
	run-time. Performance testing shows that under certain
	circumstances (like data type conversions of compound types)
	the H5_timer functions, although only a few lines each,
	contribute a fairly large percent to the execution time.

./src/H5T.c
./src/H5Tpkg.h
./src/H5Tpublic.h
	Improved the H5Tunregister() function to make unregistering
	more flexible.  It takes the same arguments as H5Tregister()
	but also accepts wild cards.  All conversion functions that
	match the H5Tunregister() search criteria are removed from the
	global type conversion table.

	The H5Tregister_hard() and H5Tregister_soft() were combined
	into a single function called H5Tregister() which is the
	counterpart to H5Tunregister(). A new `persistence' argument
	was added to differentiate between the two types of conversion
	functions.

	The application is allowed to register a hard conversion
	function for the no-op conversion path although the library
	isn't obligated to call it (it usually does). This is mostly
	for completeness, but the application might use it to help
	determine if the raw data pipeline was able to use the
	optimized path for the case when no type conversion is
	necessary. The library doesn't allow this path to be
	unregistered although the application can redefine it as often
	as it likes.

	Fixed the type conversion tables in preparation for MT-safety
	and to fix previosly-known design bugs wrt. unregistering
	conversion functions or changing the C function associated
	with a conversion path. The MT-safety stuff is documented in a
	separate white paper.

	Increased the conversion function debugging name from 9
	characters to 31 characters so the output can be more
	descriptive.

	Moved conversion path statistics from the H5T_cdata_t member
	into the conversion path itself.  This makes H5T_cdata_t
	contain only application-visible data structures.

./src/H5A.c
./src/H5D.c
./src/H5Ofill.c
./src/H5P.c
./src/H5T.c
	Improved the way type conversion functions are called so the
	caller doesn't have to check for data type debugging and
	increment type conversion timers and statistics.

	Changed check for no-op conversion since it is now
	application-definable and there may even be more than one
	definition at a time in a multi-threaded application (one
	thread might be using the no-op conversion path when some
	other thread changes its definition -- the first thread still
	sees the original defintion until it's done with the
	operation).

./doc/html/Datatypes.html
	Updated the user guide to reflect the changes to data type
	conversion registration functions.

./bin/trace
./src/H5.c
	Added tracing support for the new H5T_pers_t data type.

./test/dtypes.c
	Added printf to display alignment value if non-aligned data
	types are being tested.

./test/h5test.c
	Modified the H5Tunregister() calls to use the new
	arguments. All 94 of those calls can be replaced by a single
	call to the new H5Tunregister() function.

./src/H5.c
	Added HAVE_GETTIMEOFDAY around an auto variable and
	initialized the elapsed time to zero when gettimeofday() is
	not available.

./src/H5F.c
./src/H5Fprivate.h
./src/H5P.c
	Added an H5*_init() functions which do the same thing as
	H5*_init_interface() but can be called from other packages and
	don't do anything if the interface is already initialized.
	This fixes a couple memory leaks in applications that
	repeatedly close and open the library with H5close().

./src/H5Tconv.c
	Optimized some data alignment code in the hardware conversion
	functions.

	Hardware conversions accumulate statistics about source and
	destination data alignment and print that information when the
	conversion function is unregistered (usually when the
	application exits) if data type debugging is compiled into the
	library and enabled at run-time.

	The conversion caching was cleaned up for the compound data
	type conversion function. It now caches conversion paths in a
	manner that will be MT-safe and is much simpler than the old
	method. Also cleaned up some array index maps.

./src/H5detect.c
	Fixd mispelling of alingemnt.

./src/H5private.h
	Changed `TRUE' to `1' in assignment to interface_initialize_g
	in FUNC_ENTER macro definition.

./tools/testh5dump.sh
	Completely rewritten to make it shorter, better documented,
	and conforming to most of the other test outputs.

	The comparison of the actual output with the expected output
	is insensitive to differences in white space.  The test now
	passes for the first time on Linux where the output width
	wasn't as expected but the output was otherwise correct.

./tools/testfiles/tall-1.ddl
./tools/testfiles/tall-2.ddl
./tools/testfiles/tall-3.ddl
./tools/testfiles/tattr-1.ddl
./tools/testfiles/tattr-2.ddl
./tools/testfiles/tattr-3.ddl
./tools/testfiles/tattr-4.ddl
./tools/testfiles/tcomp-1.ddl
./tools/testfiles/tcomp-2.ddl
./tools/testfiles/tcomp-3.ddl
./tools/testfiles/tcomp-4.ddl
./tools/testfiles/tdset-1.ddl
./tools/testfiles/tdset-2.ddl
./tools/testfiles/tdset-3.ddl
./tools/testfiles/tdset-4.ddl
./tools/testfiles/tgroup-1.ddl
./tools/testfiles/tgroup-2.ddl
./tools/testfiles/tgroup-3.ddl
./tools/testfiles/tlink-1.ddl
./tools/testfiles/tlink-2.ddl
./tools/testfiles/tlink-3.ddl
./tools/testfiles/tlink-4.ddl
./tools/testfiles/tlink-5.ddl
./tools/testfiles/tslink-1.ddl
./tools/testfiles/tslink-2.ddl
	Changed `../h5dump' to just `h5dump'.

./config/alpha-dec-osf4.0
	Added more warning and optimization switches to the native
	compiler.
This commit is contained in:
Robb Matzke 1998-12-17 14:35:20 -05:00
parent c26c6a4b25
commit 09aaf83332
47 changed files with 1551 additions and 1869 deletions

12
INSTALL
View File

@ -68,11 +68,13 @@ Step 2. Configure.
RANLIB Name of the `ranlib' program or `:' if none.
MAKE Name of the `make' program (GNU make is preferred)
* This version of HDF5 is normally built with various debugging
code enabled. To turn it off add the `--disable-debug' switch
to the configure command. Even if debugging support is compiled
into the library one must still enable the code at runtime with
the HDF5_DEBUG environment variable (see Debugging.html).
* This version of HDF5 is normally built with various debugging code
enabled. To turn it off add the `--disable-debug' switch to the
configure command. Even if debugging support is compiled into the
library one must still enable the code at runtime with the HDF5_DEBUG
environment variable (see Debugging.html). Including debugging support
in the library (whether it's enabled or not) may incur a significant
run-time penalty.
* This version of HDF5 is normally built with support for symbolic
debugging with dbx or gdb and without compiler optimization

2
README
View File

@ -1,4 +1,4 @@
This is hdf5-1.1.35 released on Tue Dec 15 04:28:56 CST 1998
This is hdf5-1.1.36 released on Thu Dec 17 13:35:56 CST 1998
Please refer to the INSTALL file for installation instructions.
------------------------------------------------------------------------------

View File

@ -46,6 +46,7 @@ $Source = "";
"H5T_norm_t" => "Tn",
"H5T_order_t" => "To",
"H5T_pad_t" => "Tp",
"H5T_pers_t" => "Te",
"H5T_sign_t" => "Ts",
"H5T_class_t" => "Tt",
"H5T_str_t" => "Tz",

View File

@ -28,11 +28,11 @@ case "X-$CC_BASENAME" in
*)
#CFLAGS="$CFLAGS"
DEBUG_CFLAGS="-g"
DEBUG_CFLAGS="-g -std -verbose -warnprotos"
DEBUG_CPPFLAGS="-DH5F_OPT_SEEK=0 -DH5F_LOW_DFLT=H5F_LOW_SEC2"
PROD_CFLAGS="-g0 -fast -tune host"
PROD_CPPFLAGS=
PROFILE_CFLAGS="-pg"
PROD_CFLAGS="-g0 -verbose -warnprotos -std -O4 -arch host -tune host -ansi_args -fp_reorder -readonly_strings -inline speed"
PROD_CPPFLAGS="-D_INTRINSICS -D_INLINE_INTRINSICS"
PROFILE_CFLAGS="-pg -std -verbose -warnprotos"
PROFILE_CPPFLAGS=
;;
esac

View File

@ -1060,39 +1060,34 @@ hid_t dset4 = H5Dcreate (file, "dset4", t2, space, H5P_DEFAULT);
<p>The library is capable of converting data from one type to
another and does so automatically when reading or writing the
raw data of a dataset. The data type interface does not provide
functions to the application for changing data types directly,
but the user is allowed a certain amount of control over the
conversion process.
raw data of a dataset, attribute data, or fill values. The
application can also change the type of data stored in an array.
<p>In order to insure that data conversion exceeds disk I/O rates,
common data conversion paths can be hand-tuned and optimized for
performance. If a hand-tuned conversion function is not
performance. The library contains very efficient code for
conversions between most native data types and a few non-native
data types, but if a hand-tuned conversion function is not
available, then the library falls back to a slower but more
general conversion function. Although conversion paths include
data space conversion, only data type conversions are described
here. Most applications will not be concerned with data type
conversions since the library will contain hand-tuned conversion
functions for many common conversion paths. In fact, if an
application does define a conversion function which would be of
general interest, we request that the function be submitted to
the HDF5 development team for inclusion in the library (there
might be less overhead involved with calling an internal
conversion functions than calling an application-defined
conversion function).
general conversion function. The application programmer can
define additional conversion functions when the libraries
repertoire is insufficient. In fact, if an application does
define a conversion function which would be of general interest,
we request that the function be submitted to the HDF5
development team for inclusion in the library.
<p><b>Note:</b> The HDF5 library contains a deliberately limited
set of conversion routines. It can convert from one integer
format to another, from one floating point format to another,
and from one struct to another. It can also perform byte
swapping when the source and destination types are otherwise
the same. The library does not contain any functions for
converting data between integer and floating point formats.
It is anticipated that some users will find it necessary to
develop float to integer or integer to float conversion functions
at the application level; if they wish, users are invited to
submit those functions to be considered for inclusion in future
versions of the library.
and from one struct to another. It can also perform byte
swapping when the source and destination types are otherwise the
same. The library does not contain any functions for converting
data between integer and floating point formats. It is
anticipated that some users will find it necessary to develop
float to integer or integer to float conversion functions at the
application level; users are invited to submit those functions
to be considered for inclusion in future versions of the
library.
<p>A conversion path contains a source and destination data type
and each path contains a <em>hard</em> conversion function
@ -1152,24 +1147,25 @@ typedef herr_t (*H5T_conv_t)(hid_t <em>src_type</em>,
<br><br>
<dt><code>H5T_CONV_CONV</code>
<dd>This is the usually command which indicates that
data points should be converted. The conversion function
should initialize the <code>priv</code> field of
<em>cdata</em> if it wasn't initialize during the
<code>H5T_CONV_INIT</code> command and then convert
<em>nelmts</em> instances of the <em>src_type</em> to the
<em>dst_type</em>. The <em>buffer</em> serves as both input
and output. The <em>background</em> buffer is supplied
according to the value of the <code>need_bkg</code> field of
<em>cdata</em> (the values are described below).
<dd>This command indicates that data points should be converted.
The conversion function should initialize the
<code>priv</code> field of <em>cdata</em> if it wasn't
initialize during the <code>H5T_CONV_INIT</code> command and
then convert <em>nelmts</em> instances of the
<em>src_type</em> to the <em>dst_type</em>. The
<em>buffer</em> serves as both input and output. The
<em>background</em> buffer is supplied according to the value
of the <code>need_bkg</code> field of <em>cdata</em> (the
values are described below).
<br><br>
<dt><code>H5T_CONV_FREE</code>
<dd>The conversion function is about to be removed from some
path and the private data (the
<code><em>cdata</em>->priv</code> pointer) should be freed and
set to null. All other pointer arguments are null and the
<em>nelmts</em> argument is zero.
set to null. All other pointer arguments are null, the
<em>src_type</em> and <em>dst_type</em> are invalid
(negative), and the <em>nelmts</em> argument is zero.
<br><br>
<dt><em>Others...</em>
@ -1211,64 +1207,56 @@ typedef herr_t (*H5T_conv_t)(hid_t <em>src_type</em>,
destination.
</dl>
<p>Other fields of <em>cdata</em> can be read or written by
the conversion functions. Many of these contain
performance-measuring fields which can be printed by the
conversion function during the <code>H5T_CONV_FREE</code>
command which is issued whenever the function is removed from a
conversion path.
<dl>
<dt><code>hbool_t recalc</code>
<dd>This field is set by the library when any other data type
conversion function is registered or unregistered. It allows
conversion functions to cache pointers to other conversion
functions and be notified when the cache should be
recalculated.
<br><br>
<dt><code>unsigned long ncalls</code>
<dd>This field contains the number of times the conversion
function was called with the command
<code>H5T_CONV_CONV</code>. It is updated automatically by
the library.
<br><br>
<dt><code>unsigned long nelmts</code>
<dd>This is the total number of data points converted by this
function and is updated automatically by the library.
</dl>
<p>The <code>recalc</code> field of <em>cdata</em> is set when the
conversion path table changes. It can be used by conversion
function that cache other conversion paths so they know when
their cache needs to be recomputed.
<p>Once a conversion function is written it can be registered and
unregistered with these functions:
<dl>
<dt><code>herr_t H5Tregister_hard (const char *<em>name</em>,
hid_t <em>src_type</em>, hid_t <em>dest_type</em>,
H5T_conv_t <em>func</em>)</code>
<dt><code>herr_t H5Tregister(H5T_pers_t <em>pers</em>, const
char *<em>name</em>, hid_t <em>src_type</em>, hid_t
<em>dest_type</em>, H5T_conv_t <em>func</em>)</code>
<dd>Once a conversion function is written, the library must be
notified so it can be used. The function can be registered as a
hard conversion for one or more conversion paths by calling
<code>H5Tregister_hard()</code>, displacing any previous hard
conversion for those paths. The <em>name</em> is used only
for debugging but must be supplied.
notified so it can be used. The function can be registered as
a hard (<code>H5T_PERS_HARD</code>) or soft
(<code>H5T_PERS_SOFT</code>) conversion depending on the value
of <em>pers</em>, displacing any previous conversions for all
applicable paths. The <em>name</em> is used only for
debugging but must be supplied. If <em>pers</em> is
<code>H5T_PERS_SOFT</code> then only the type classes of the
<em>src_type</em> and <em>dst_type</em> are used. For
instance, to register a general soft conversion function that
can be applied to any integer to integer conversion one could
say: <code>H5Tregister(H5T_PERS_SOFT, "i2i", H5T_NATIVE_INT,
H5T_NATIVE_INT, convert_i2i)</code>. One special conversion
path called the "no-op" conversion path is always defined by
the library and used as the conversion function when no data
transformation is necessary. The application can redefine this
path by specifying a new hard conversion function with a
negative value for both the source and destination data types,
but the library might not call the function under certain
circumstances.
<br><br>
<dt><code>herr_t H5Tregister_soft (const char *<em>name</em>,
H5T_class_t <em>src_class</em>, H5T_class_t <em>dest_class</em>,
H5T_conv_t <em>func</em>)</code>
<dd>The function can be registered as a generic function which
will be automatically added to any conversion path for which
it returns an indication that it applies. The name is used
only for debugging but must be supplied.
<br><br>
<dt><code>herr_t H5Tunregister (H5T_conv_t <em>func</em>)</code>
<dd>A function can be removed from the set of known conversion
functions by calling <code>H5Tunregister()</code>. The
function is removed from all conversion paths.
<dt><code>herr_t H5Tunregister (H5T_pers_t <em>pers</em>, const
char *<em>name</em>, hid_t <em>src_type</em>, hid_t
<em>dest_type</em>, H5T_conv_t <em>func</em>)</code>
<dd>Any conversion path or function that matches the critera
specified by a call to this function is removed from the type
conversion table. All fields have the same interpretation as
for <code>H5Tregister()</code> with the added feature that any
(or all) may be wild cards. The
<code>H5T_PERS_DONTCARE</code> constant should be used to
indicate a wild card for the <em>pers</em> argument. The wild
card <em>name</em> is the null pointer or empty string, the
wild card for the <em>src_type</em> and <em>dest_type</em>
arguments is any negative value, and the wild card for the
<em>func</em> argument is the null pointer. The special no-op
conversion path is never removed by this function.
</dl>
<p>
@ -1397,7 +1385,9 @@ typedef herr_t (*H5T_conv_t)(hid_t <em>src_type</em>,
paths it can handle.
<p><code><pre>
H5Tregister_soft ("cus2be", H5T_INTEGER, H5T_INTEGER, cray_ushort2be);
H5Tregister(H5T_PERS_SOFT, "cus2be",
H5T_NATIVE_INT, H5T_NATIVE_INT,
cray_ushort2be);
</pre></code>
<p>This causes it to be consulted for any conversion
@ -1422,22 +1412,15 @@ H5Tregister_soft ("cus2be", H5T_INTEGER, H5T_INTEGER, cray_ushort2be);
conversion path whether that conversion path was actually used
or not.
<!--
<hr>
<address><a href="mailto:matzke@llnl.gov">Robb Matzke</a></address>
<address><a href="mailto:koziol@ncsa.uiuc.edu">Quincey Koziol</a></address>
-->
<address>
<a href="mailto:hdfhelp@ncsa.uiuc.edu">HDF Help Desk</a>
</address>
<!-- Created: Thu Dec 4 14:57:32 EST 1997 -->
<!-- hhmts start -->
Last modified: Wed Nov 25 12:25:49 EST 1998
Last modified: Wed Dec 16 13:04:58 EST 1998
<!-- hhmts end -->
<hr>
<address>
<a href="mailto:hdfhelp@ncsa.uiuc.edu">HDF Help Desk</a>
</address>
Last modified: 27 October 1998
</body>
</html>

View File

@ -98,7 +98,7 @@ H5_init_library(void)
* Initialize interfaces that might not be able to initialize themselves
* soon enough.
*/
if (H5T_init_interface() < 0) {
if (H5T_init()<0) {
HRETURN_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL,
"unable to initialize type interface");
}
@ -931,7 +931,9 @@ H5_timer_begin (H5_timer_t *timer)
#ifdef HAVE_GETRUSAGE
struct rusage rusage;
#endif
#ifdef HAVE_GETTIMEOFDAY
struct timeval etime;
#endif
assert (timer);
@ -947,8 +949,10 @@ H5_timer_begin (H5_timer_t *timer)
#endif
#ifdef HAVE_GETTIMEOFDAY
gettimeofday (&etime, NULL);
#endif
timer->etime = (double)etime.tv_sec + (double)etime.tv_usec/1e6;
#else
timer->etime = 0.0;
#endif
}
@ -2037,6 +2041,32 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
}
break;
case 'e':
if (ptr) {
if (vp) {
fprintf(out, "0x%lx", (unsigned long)vp);
} else {
fprintf(out, "NULL");
}
} else {
H5T_pers_t pers = va_arg(ap, H5T_pers_t);
switch (pers) {
case H5T_PERS_DONTCARE:
fprintf(out, "H5T_PERS_DONTCARE");
break;
case H5T_PERS_SOFT:
fprintf(out, "H5T_PERS_SOFT");
break;
case H5T_PERS_HARD:
fprintf(out, "H5T_PERS_HARD");
break;
default:
fprintf(out, "%ld", (long)pers);
break;
}
}
break;
case 'n':
if (ptr) {
if (vp) {

View File

@ -604,17 +604,13 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, void *buf)
{
uint8_t *tconv_buf = NULL; /* data type conv buffer */
size_t nelmts; /* elements in attribute */
H5T_conv_t tconv_func = NULL; /* conversion function */
H5T_cdata_t *cdata = NULL; /* type conversion data */
H5T_path_t *tpath = NULL; /* conversion information*/
hid_t src_id = -1, dst_id = -1;/* temporary type atoms */
size_t src_type_size; /* size of source type */
size_t dst_type_size; /* size of destination type*/
size_t buf_size; /* desired buffer size */
int idx; /* index of attribute in object header */
herr_t ret_value = FAIL;
#ifdef H5T_DEBUG
H5_timer_t timer;
#endif
FUNC_ENTER(H5A_write, FAIL);
@ -641,11 +637,10 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, void *buf)
/* Convert memory buffer into disk buffer */
/* Set up type conversion function */
if (NULL == (tconv_func = H5T_find(mem_type, attr->dt,
H5T_BKG_NO, &cdata))) {
if (NULL == (tpath = H5T_path_find(mem_type, attr->dt, NULL, NULL))) {
HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL,
"unable to convert between src and dest data types");
} else if (H5T_conv_noop!=tconv_func) {
} else if (!H5T_IS_NOOP(tpath)) {
if ((src_id = H5I_register(H5I_DATATYPE,
H5T_copy(mem_type, H5T_COPY_ALL)))<0 ||
(dst_id = H5I_register(H5I_DATATYPE,
@ -655,18 +650,11 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, void *buf)
}
}
/* Perform data type conversion. */
#ifdef H5T_DEBUG
H5T_timer_begin (&timer, cdata);
#endif
cdata->command = H5T_CONV_CONV;
if ((tconv_func) (src_id, dst_id, cdata, nelmts, tconv_buf, NULL)<0) {
/* Perform data type conversion */
if (H5T_convert(tpath, src_id, dst_id, nelmts, tconv_buf, NULL)<0) {
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL,
"data type conversion failed");
}
#ifdef H5T_DEBUG
H5T_timer_end (&timer, cdata, nelmts);
#endif
/* Free the previous attribute data buffer, if there is one */
if(attr->data)
@ -775,16 +763,12 @@ H5A_read(H5A_t *attr, const H5T_t *mem_type, void *buf)
{
uint8_t *tconv_buf = NULL; /* data type conv buffer*/
size_t nelmts; /* elements in attribute*/
H5T_conv_t tconv_func = NULL; /* conversion function */
H5T_cdata_t *cdata = NULL; /* type conversion data */
H5T_path_t *tpath = NULL; /* type conversion info */
hid_t src_id = -1, dst_id = -1;/* temporary type atoms*/
size_t src_type_size; /* size of source type */
size_t dst_type_size; /* size of destination type */
size_t buf_size; /* desired buffer size */
herr_t ret_value = FAIL;
#ifdef H5T_DEBUG
H5_timer_t timer;
#endif
FUNC_ENTER(H5A_read, FAIL);
@ -811,11 +795,10 @@ H5A_read(H5A_t *attr, const H5T_t *mem_type, void *buf)
/* Convert memory buffer into disk buffer */
/* Set up type conversion function */
if (NULL == (tconv_func = H5T_find(attr->dt, mem_type,
H5T_BKG_NO, &cdata))) {
if (NULL == (tpath = H5T_path_find(attr->dt, mem_type, NULL, NULL))) {
HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL,
"unable to convert between src and dest data types");
} else if (H5T_conv_noop!=tconv_func) {
} else if (!H5T_IS_NOOP(tpath)) {
if ((src_id = H5I_register(H5I_DATATYPE,
H5T_copy(attr->dt, H5T_COPY_ALL)))<0 ||
(dst_id = H5I_register(H5I_DATATYPE,
@ -826,17 +809,10 @@ H5A_read(H5A_t *attr, const H5T_t *mem_type, void *buf)
}
/* Perform data type conversion. */
#ifdef H5T_DEBUG
H5T_timer_begin (&timer, cdata);
#endif
cdata->command = H5T_CONV_CONV;
if ((tconv_func) (src_id, dst_id, cdata, nelmts, tconv_buf, NULL)<0) {
if (H5T_convert(tpath, src_id, dst_id, nelmts, tconv_buf, NULL)<0) {
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL,
"data type conversion failed");
}
#ifdef H5T_DEBUG
H5T_timer_end (&timer, cdata, nelmts);
#endif
/* Copy the converted data into the user's buffer */
HDmemcpy(buf,tconv_buf,dst_type_size*nelmts);

View File

@ -1444,21 +1444,21 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
const H5S_t *file_space, const H5D_xfer_t *xfer_parms,
void *buf/*out*/)
{
hssize_t nelmts; /*number of elements */
hssize_t nelmts; /*number of elements */
size_t smine_start; /*strip mine start loc */
size_t n, smine_nelmts; /*elements per strip */
hid_t tconv_id=FAIL, bkg_id=FAIL; /* Conversion buffer IDs */
hid_t tconv_id=FAIL; /*type conv buffer ID */
hid_t bkg_id=FAIL; /*background buffer ID */
uint8_t *tconv_buf = NULL; /*data type conv buffer */
uint8_t *bkg_buf = NULL; /*background buffer */
H5T_conv_t tconv_func = NULL; /*conversion function */
H5T_path_t *tpath = NULL; /*type conversion info */
hid_t src_id = -1, dst_id = -1;/*temporary type atoms */
H5S_conv_t *sconv=NULL; /*space conversion funcs*/
H5S_sel_iter_t mem_iter; /* mem selection iteration info*/
H5S_sel_iter_t bkg_iter; /*background iteration info*/
H5S_sel_iter_t file_iter; /*file selection iter info*/
H5T_cdata_t *cdata = NULL; /*type conversion data */
herr_t ret_value = FAIL;
herr_t status;
herr_t ret_value = FAIL; /*return value */
herr_t status; /*function return status*/
size_t src_type_size; /*size of source type */
size_t dst_type_size; /*size of destination type*/
size_t target_size; /*desired buffer size */
@ -1522,11 +1522,10 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
"src and dest data spaces have different sizes");
}
if (NULL == (tconv_func = H5T_find(dataset->type, mem_type,
xfer_parms->need_bkg, &cdata))) {
if (NULL==(tpath=H5T_path_find(dataset->type, mem_type, NULL, NULL))) {
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL,
"unable to convert between src and dest data types");
} else if (H5T_conv_noop!=tconv_func) {
} else if (!H5T_IS_NOOP(tpath)) {
if ((src_id=H5I_register(H5I_DATATYPE,
H5T_copy(dataset->type, H5T_COPY_ALL)))<0 ||
(dst_id=H5I_register(H5I_DATATYPE,
@ -1556,7 +1555,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
* If there is no type conversion then try reading directly into the
* application's buffer. This saves at least one mem-to-mem copy.
*/
if (H5T_conv_noop==tconv_func && sconv->read) {
if (H5T_IS_NOOP(tpath) && sconv->read) {
status = (sconv->read)(dataset->ent.file, &(dataset->layout),
&(dataset->create_parms->pline),
&(dataset->create_parms->efl),
@ -1619,8 +1618,8 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
* malloc() is usually less resource-intensive if we allocate/free the
* same size over and over.
*/
if (cdata->need_bkg) {
need_bkg = MAX (cdata->need_bkg, xfer_parms->need_bkg);
if (tpath->cdata.need_bkg) {
need_bkg = MAX(tpath->cdata.need_bkg, xfer_parms->need_bkg);
} else {
need_bkg = H5T_BKG_NO; /*never needed even if app says yes*/
}
@ -1720,16 +1719,8 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
/*
* Perform data type conversion.
*/
#ifdef H5T_DEBUG
H5T_timer_begin (&timer, cdata);
#endif
cdata->command = H5T_CONV_CONV;
status = (tconv_func)(src_id, dst_id, cdata, smine_nelmts, tconv_buf,
bkg_buf);
#ifdef H5T_DEBUG
H5T_timer_end (&timer, cdata, smine_nelmts);
#endif
if (status<0) {
if (H5T_convert(tpath, src_id, dst_id, smine_nelmts, tconv_buf,
bkg_buf)<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
"data type conversion failed");
}
@ -1803,27 +1794,28 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
const H5S_t *file_space, const H5D_xfer_t *xfer_parms,
const void *buf)
{
hssize_t nelmts; /*total number of elmts */
hssize_t nelmts; /*total number of elmts */
size_t smine_start; /*strip mine start loc */
size_t n, smine_nelmts; /*elements per strip */
hid_t tconv_id=FAIL, bkg_id=FAIL; /* Conversion buffer IDs */
hid_t tconv_id=FAIL; /*type conv buffer ID */
hid_t bkg_id=FAIL; /*background buffer ID */
uint8_t *tconv_buf = NULL; /*data type conv buffer */
uint8_t *bkg_buf = NULL; /*background buffer */
H5T_conv_t tconv_func = NULL; /*conversion function */
H5T_path_t *tpath = NULL; /*type conversion info */
hid_t src_id = -1, dst_id = -1;/*temporary type atoms */
H5S_conv_t *sconv=NULL; /*space conversion funcs*/
H5S_sel_iter_t mem_iter; /*memory selection iteration info*/
H5S_sel_iter_t bkg_iter; /*background iteration info*/
H5S_sel_iter_t file_iter; /*file selection iteration info*/
H5T_cdata_t *cdata = NULL; /*type conversion data */
herr_t ret_value = FAIL, status;
herr_t ret_value = FAIL; /*return value */
herr_t status; /*function return status*/
size_t src_type_size; /*size of source type */
size_t dst_type_size; /*size of destination type*/
size_t target_size; /*desired buffer size */
size_t request_nelmts; /*requested strip mine */
H5T_bkg_t need_bkg; /*type of background buf*/
H5S_t *free_this_space=NULL; /*data space to free */
hbool_t must_convert; /*have to xfer the slow way */
hbool_t must_convert; /*have to xfer the slow way*/
#ifdef H5T_DEBUG
H5_timer_t timer;
#endif
@ -1889,11 +1881,10 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
"src and dest data spaces have different sizes");
}
if (NULL == (tconv_func = H5T_find(mem_type, dataset->type,
xfer_parms->need_bkg, &cdata))) {
if (NULL==(tpath=H5T_path_find(mem_type, dataset->type, NULL, NULL))) {
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL,
"unable to convert between src and dest data types");
} else if (H5T_conv_noop!=tconv_func) {
} else if (!H5T_IS_NOOP(tpath)) {
if ((src_id = H5I_register(H5I_DATATYPE,
H5T_copy(mem_type, H5T_COPY_ALL)))<0 ||
(dst_id = H5I_register(H5I_DATATYPE,
@ -1926,7 +1917,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
* If there is no type conversion then try writing directly from
* application buffer to file.
*/
if (H5T_conv_noop==tconv_func && sconv->write) {
if (H5T_IS_NOOP(tpath) && sconv->write) {
status = (sconv->write)(dataset->ent.file, &(dataset->layout),
&(dataset->create_parms->pline),
&(dataset->create_parms->efl),
@ -1990,8 +1981,8 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
* malloc() is usually less resource-intensive if we allocate/free the
* same size over and over.
*/
if (cdata->need_bkg) {
need_bkg = MAX (cdata->need_bkg, xfer_parms->need_bkg);
if (tpath->cdata.need_bkg) {
need_bkg = MAX (tpath->cdata.need_bkg, xfer_parms->need_bkg);
} else {
need_bkg = H5T_BKG_NO; /*never needed even if app says yes*/
}
@ -2088,16 +2079,8 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
/*
* Perform data type conversion.
*/
#ifdef H5T_DEBUG
H5T_timer_begin (&timer, cdata);
#endif
cdata->command = H5T_CONV_CONV;
status = (tconv_func) (src_id, dst_id, cdata, smine_nelmts, tconv_buf,
bkg_buf);
#ifdef H5T_DEBUG
H5T_timer_end (&timer, cdata, smine_nelmts);
#endif
if (status<0) {
if (H5T_convert(tpath, src_id, dst_id, smine_nelmts, tconv_buf,
bkg_buf)<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
"data type conversion failed");
}

View File

@ -100,6 +100,7 @@ const H5F_mprop_t H5F_mount_dflt = {
/* Interface initialization */
static intn interface_initialize_g = 0;
#define INTERFACE_INIT H5F_init_interface
static herr_t H5F_init_interface(void);
/* PRIVATE PROTOTYPES */
static H5F_t *H5F_new(H5F_file_t *shared, const H5F_create_t *fcpl,
@ -110,6 +111,31 @@ static herr_t H5F_locate_signature(H5F_low_t *f_handle,
const H5F_access_t *access_parms,
haddr_t *addr/*out*/);
/*-------------------------------------------------------------------------
* Function: H5F_init
*
* Purpose: Initialize the interface from some other layer.
*
* Return: Success: non-negative
*
* Failure: negative
*
* Programmer: Robb Matzke
* Wednesday, December 16, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
herr_t
H5F_init(void)
{
FUNC_ENTER(H5F_init, FAIL);
/* FUNC_ENTER() does all the work */
FUNC_LEAVE(SUCCEED);
}
/*-------------------------------------------------------------------------
* Function: H5F_init_interface
@ -132,12 +158,11 @@ static herr_t H5F_locate_signature(H5F_low_t *f_handle,
* Added .disp, .btype, .ftype to H5F_access_t.
*-------------------------------------------------------------------------
*/
herr_t
static herr_t
H5F_init_interface(void)
{
herr_t ret_value = SUCCEED;
interface_initialize_g = TRUE;
FUNC_ENTER(H5F_init_interface, FAIL);
#ifdef HAVE_PARALLEL

View File

@ -544,7 +544,7 @@ extern hbool_t H5_mpi_1_metawrite_g;
#endif /* HAVE_PARALLEL */
/* Private functions, not part of the publicly documented API */
herr_t H5F_init_interface(void);
herr_t H5F_init(void);
void H5F_encode_length_unusual(const H5F_t *f, uint8_t **p, uint8_t *l);
H5F_t *H5F_open(const char *name, uintn flags,
const H5F_create_t *create_parms,

View File

@ -308,15 +308,10 @@ H5O_fill_debug(H5F_t __unused__ *f, const void *_mesg, FILE *stream,
herr_t
H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type)
{
H5T_cdata_t *cdata=NULL; /*conversion data */
H5T_conv_t cfunc=NULL; /*conversion function */
H5T_path_t *tpath=NULL; /*type conversion info */
void *buf=NULL, *bkg=NULL; /*conversion buffers */
herr_t status; /*conversion status */
hid_t src_id=-1, dst_id=-1; /*data type identifiers */
herr_t ret_value=FAIL; /*return value */
#ifdef H5T_DEBUG
H5_timer_t timer; /*debugging timer */
#endif
FUNC_ENTER(H5O_fill_convert, FAIL);
assert(fill);
@ -332,7 +327,7 @@ H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type)
/*
* Can we convert between source and destination data types?
*/
if (NULL==(cfunc=H5T_find(fill->type, dset_type, H5T_BKG_NO, &cdata))) {
if (NULL==(tpath=H5T_path_find(fill->type, dset_type, NULL, NULL))) {
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
"unable to convert between src and dst data types");
}
@ -357,22 +352,14 @@ H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type)
}
HDmemcpy(buf, fill->buf, H5T_get_size(fill->type));
}
if (cdata->need_bkg>=H5T_BKG_TEMP &&
if (tpath->cdata.need_bkg>=H5T_BKG_TEMP &&
NULL==(bkg=H5MM_malloc(H5T_get_size(dset_type)))) {
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed for type conversion");
}
/* Do the conversion */
#ifdef H5T_DEBUG
H5T_timer_begin(&timer, cdata);
#endif
cdata->command = H5T_CONV_CONV;
status = (cfunc)(src_id, dst_id, cdata, 1, buf, bkg);
#ifdef H5T_DEBUG
H5T_timer_end(&timer, cdata, 1);
#endif
if (status<0) {
if (H5T_convert(tpath, src_id, dst_id, 1, buf, bkg)<0) {
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
"data type conversion failed");
}

View File

@ -58,7 +58,7 @@ H5P_init_interface(void)
* initialized since this might be done at run-time instead of compile
* time.
*/
if (H5F_init_interface ()<0) {
if (H5F_init()<0) {
HRETURN_ERROR (H5E_INTERNAL, H5E_CANTINIT, FAIL,
"unable to initialize H5F and H5P interfaces");
}
@ -2643,18 +2643,13 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value)
herr_t
H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/)
{
H5D_create_t *plist = NULL;
H5T_t *type = NULL;
H5T_cdata_t *cdata = NULL; /*conversion data */
H5T_conv_t cfunc = NULL; /*conversion function */
H5D_create_t *plist = NULL; /*property list */
H5T_t *type = NULL; /*data type */
H5T_path_t *tpath = NULL; /*type conversion info */
void *buf = NULL; /*conversion buffer */
void *bkg = NULL; /*conversion buffer */
hid_t src_id = -1; /*source data type id */
herr_t status;
herr_t ret_value = FAIL;
#ifdef H5T_DEBUG
H5_timer_t timer; /*conversion timer */
#endif
herr_t ret_value = FAIL; /*return value */
FUNC_ENTER(H5Pget_fill_value, FAIL);
H5TRACE3("e","iix",plist_id,type_id,value);
@ -2686,7 +2681,7 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/)
/*
* Can we convert between the source and destination data types?
*/
if (NULL==(cfunc=H5T_find(plist->fill.type, type, H5T_BKG_NO, &cdata))) {
if (NULL==(tpath=H5T_path_find(plist->fill.type, type, NULL, NULL))) {
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
"unable to convert between src and dst data types");
}
@ -2704,7 +2699,7 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/)
*/
if (H5T_get_size(type)>=H5T_get_size(plist->fill.type)) {
buf = value;
if (cdata->need_bkg>=H5T_BKG_TEMP &&
if (tpath->cdata.need_bkg>=H5T_BKG_TEMP &&
NULL==(bkg=H5MM_malloc(H5T_get_size(type)))) {
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed for type conversion");
@ -2714,20 +2709,12 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed for type conversion");
}
if (cdata->need_bkg>=H5T_BKG_TEMP) bkg = value;
if (tpath->cdata.need_bkg>=H5T_BKG_TEMP) bkg = value;
}
HDmemcpy(buf, plist->fill.buf, H5T_get_size(plist->fill.type));
/* Do the conversion */
#ifdef H5T_DEBUG
H5T_timer_begin(&timer, cdata);
#endif
cdata->command = H5T_CONV_CONV;
status = (cfunc)(src_id, type_id, cdata, 1, buf, bkg);
#ifdef H5T_DEBUG
H5T_timer_end(&timer, cdata, 1);
#endif
if (status<0) {
if (H5T_convert(tpath, src_id, type_id, 1, buf, bkg)<0) {
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
"data type conversion failed");
}

2120
src/H5T.c

File diff suppressed because it is too large Load Diff

View File

@ -17,14 +17,19 @@
/* Conversion data for H5T_conv_struct() */
typedef struct H5T_conv_struct_t {
intn *src2dst; /*mapping from src to dst memb ID */
intn *src2dst; /*mapping from src to dst member num */
hid_t *src_memb_id; /*source member type ID's */
hid_t *dst_memb_id; /*destination member type ID's */
H5T_conv_t *memb_conv; /*array of membr conversion functions*/
H5T_cdata_t **memb_cdata; /*array of member cdata pointers */
H5T_path_t **memb_path; /*conversion path for each member */
size_t *memb_nelmts; /*member element count */
} H5T_conv_struct_t;
/* Conversion data for the hardware conversion functions */
typedef struct H5T_conv_hw_t {
hsize_t s_aligned; /*number source elements aligned */
hsize_t d_aligned; /*number destination elements aligned*/
} H5T_conv_hw_t;
/* Interface initialization */
static intn interface_initialize_g = 0;
#define INTERFACE_INIT NULL
@ -253,33 +258,47 @@ static intn interface_initialize_g = 0;
size_t elmtno; /*element number */ \
ST *src, *s; /*source buffer */ \
DT *dst, *d; /*destination buffer */ \
H5T_t *st, *dt; /*src and dest data types */ \
H5T_t *st, *dt; /*data type descriptors */ \
long_long aligned; /*largest integer type, aligned */ \
hbool_t s_mv, d_mv; /*move data to align it? */ \
size_t dt_size=sizeof(DT); /*needed by CI_END macro */ \
H5T_conv_hw_t *priv = cdata->priv; /*private data */ \
\
switch (cdata->command) { \
case H5T_CONV_INIT: \
cdata->need_bkg = H5T_BKG_NO; \
if (NULL==(st=H5I_object(src_id)) || \
NULL==(dt=H5I_object(dst_id))) { \
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, \
"unable to dereference data type object ID"); \
} \
if (st->size!=sizeof(ST) || dt->size!=sizeof(DT)) { \
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, \
"disagreement about data type size"); \
} \
if (NULL==(cdata->priv=H5MM_calloc(sizeof(H5T_conv_hw_t)))) { \
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, \
"memory allocation failed"); \
} \
break; \
case H5T_CONV_FREE: \
CI_PRINT_STATS(STYPE,DTYPE); \
cdata->priv = H5MM_xfree(cdata->priv); \
break; \
case H5T_CONV_CONV: \
src = (ST*)buf+(STRT); \
dst = (DT*)buf+(STRT); \
st = H5I_object(src_id); \
dt = H5I_object(dst_id); \
assert(st && dt); \
s_mv = H5T_NATIVE_##STYPE##_ALIGN_g>1 && \
((size_t)buf%H5T_NATIVE_##STYPE##_ALIGN_g || \
st->size%H5T_NATIVE_##STYPE##_ALIGN_g); \
sizeof(ST)%H5T_NATIVE_##STYPE##_ALIGN_g); \
d_mv = H5T_NATIVE_##DTYPE##_ALIGN_g>1 && \
((size_t)buf%H5T_NATIVE_##DTYPE##_ALIGN_g || \
dt->size%H5T_NATIVE_##DTYPE##_ALIGN_g); \
CI_DEBUG(s_mv, STYPE, ST); \
CI_DEBUG(d_mv, DTYPE, DT); \
sizeof(DT)%H5T_NATIVE_##DTYPE##_ALIGN_g); \
if (s_mv) priv->s_aligned += nelmts; \
if (d_mv) priv->d_aligned += nelmts; \
for (elmtno=0; elmtno<nelmts; elmtno++, DIR src, DIR dst) { \
if (s_mv) { \
memcpy(&aligned, src, st->size); \
memcpy(&aligned, src, sizeof(ST)); \
s = (ST*)&aligned; \
} else { \
s = src; \
@ -291,7 +310,7 @@ static intn interface_initialize_g = 0;
}
/* ... user-defined stuff here ... */
#define CI_END \
if (d_mv) memcpy(dst, &aligned, dt->size); \
if (d_mv) memcpy(dst, &aligned, dt_size); \
} \
break; \
default: \
@ -300,16 +319,24 @@ static intn interface_initialize_g = 0;
} \
}
/* Print alignment information */
/* Print alignment statistics */
#ifdef H5T_DEBUG
# define CI_DEBUG(MV,HDF_TYPE,C_TYPE) { \
if (MV && H5DEBUG(T)) { \
fprintf(H5DEBUG(T), "<%d-byte alignment for %s>", \
H5T_NATIVE_##HDF_TYPE##_ALIGN_g, #C_TYPE); \
# define CI_PRINT_STATS(STYPE,DTYPE) { \
if (H5DEBUG(T) && priv->s_aligned) { \
HDfprintf(H5DEBUG(T), \
" %Hu src elements aligned on %lu-byte boundaries\n", \
priv->s_aligned, \
(unsigned long)H5T_NATIVE_##STYPE##_ALIGN_g); \
} \
if (H5DEBUG(T) && priv->d_aligned) { \
HDfprintf(H5DEBUG(T), \
" %Hu dst elements aligned on %lu-byte boundaries\n", \
priv->d_aligned, \
(unsigned long)H5T_NATIVE_##DTYPE##_ALIGN_g); \
} \
}
#else
# define CI_DEBUG(MV,HDF_TYPE,C_TYPE) /*void*/
# define CI_PRINT_STATS /*void*/
#endif
/*-------------------------------------------------------------------------
@ -344,7 +371,6 @@ H5T_conv_noop(hid_t __unused__ src_id, hid_t __unused__ dst_id,
break;
case H5T_CONV_FREE:
cdata->stats = H5MM_xfree (cdata->stats);
break;
default:
@ -467,6 +493,16 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* already initialized then the member conversion functions
* are recalculated.
*
* Priv fields are indexed by source member number or
* destination member number depending on whether the field
* contains information about the source data type or the
* destination data type (fields that contains the same
* information for both source and destination are indexed by
* source member number). The src2dst[] priv array maps source
* member numbers to destination member numbers, but if the
* source member doesn't have a corresponding destination member
* then the src2dst[i]=-1.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
@ -488,26 +524,21 @@ H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
if (!priv) {
/*
* Notice: the thing marked with `!' below really is `dst' and not
* `src' because we're only interested in the members of the
* source type that are also in the destination type.
* Allocate private data structure and arrays.
*/
cdata->priv = priv = H5MM_calloc (sizeof(H5T_conv_struct_t));
if (NULL==priv) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
priv->src2dst = H5MM_malloc (src->u.compnd.nmembs * sizeof(intn));
priv->src_memb_id = H5MM_malloc (/*!*/dst->u.compnd.nmembs *
sizeof(hid_t));
priv->dst_memb_id = H5MM_malloc (dst->u.compnd.nmembs *
sizeof(hid_t));
if (NULL==priv->src2dst ||
NULL==priv->src_memb_id ||
NULL==priv->dst_memb_id) {
if (NULL==(priv=cdata->priv=H5MM_calloc(sizeof(H5T_conv_struct_t))) ||
NULL==(priv->src2dst=H5MM_malloc(src->u.compnd.nmembs *
sizeof(intn))) ||
NULL==(priv->src_memb_id=H5MM_malloc(src->u.compnd.nmembs *
sizeof(hid_t))) ||
NULL==(priv->dst_memb_id=H5MM_malloc(dst->u.compnd.nmembs *
sizeof(hid_t))) ||
NULL==(priv->memb_nelmts=H5MM_malloc(src->u.compnd.nmembs *
sizeof(size_t)))) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
src2dst = priv->src2dst;
/*
* Insure that members are sorted.
@ -523,25 +554,25 @@ H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
* member data type conversion functions later.
*/
for (i=0; i<src->u.compnd.nmembs; i++) {
priv->src2dst[i] = -1;
src2dst[i] = -1;
for (j=0; j<dst->u.compnd.nmembs; j++) {
if (!HDstrcmp (src->u.compnd.memb[i].name,
dst->u.compnd.memb[j].name)) {
priv->src2dst[i] = j;
dst->u.compnd.memb[j].name)) {
src2dst[i] = j;
break;
}
}
if (priv->src2dst[i]>=0) {
if (src2dst[i]>=0) {
type = H5T_copy (src->u.compnd.memb[i].type, H5T_COPY_ALL);
tid = H5I_register (H5I_DATATYPE, type);
assert (tid>=0);
priv->src_memb_id[priv->src2dst[i]] = tid;
priv->src_memb_id[i] = tid;
type = H5T_copy (dst->u.compnd.memb[priv->src2dst[i]].type,
type = H5T_copy (dst->u.compnd.memb[src2dst[i]].type,
H5T_COPY_ALL);
tid = H5I_register (H5I_DATATYPE, type);
assert (tid>=0);
priv->dst_memb_id[priv->src2dst[i]] = tid;
priv->dst_memb_id[src2dst[i]] = tid;
}
}
@ -550,9 +581,9 @@ H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
* the same size and shape arrays.
*/
for (i=0; i<src->u.compnd.nmembs; i++) {
if (priv->src2dst[i]>=0) {
if (src2dst[i]>=0) {
H5T_member_t *src_memb = src->u.compnd.memb + i;
H5T_member_t *dst_memb = dst->u.compnd.memb + priv->src2dst[i];
H5T_member_t *dst_memb = dst->u.compnd.memb + src2dst[i];
if (src_memb->ndims != dst_memb->ndims) {
HRETURN_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
"source and dest members have incompatible "
@ -576,7 +607,6 @@ H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
}
/* Calculate number of elements of each member */
priv->memb_nelmts = H5MM_malloc(src->u.compnd.nmembs*sizeof(size_t));
for (i=0; i<src->u.compnd.nmembs; i++) {
priv->memb_nelmts[i] = 1;
for (j=0; j<src->u.compnd.memb[i].ndims; j++) {
@ -589,34 +619,30 @@ H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
* (Re)build the cache of member conversion functions and pointers to
* their cdata entries.
*/
priv->memb_conv = H5MM_xfree (priv->memb_conv);
priv->memb_cdata = H5MM_xfree (priv->memb_cdata);
priv->memb_conv = H5MM_malloc (dst->u.compnd.nmembs *
sizeof(H5T_conv_t));
priv->memb_cdata = H5MM_calloc (dst->u.compnd.nmembs *
sizeof(H5T_cdata_t*));
if (NULL==priv->memb_conv || NULL==priv->memb_cdata) {
src2dst = priv->src2dst;
H5MM_xfree(priv->memb_path);
if (NULL==(priv->memb_path=H5MM_malloc(src->u.compnd.nmembs *
sizeof(H5T_path_t*)))) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
src2dst = priv->src2dst;
for (i=0; i<src->u.compnd.nmembs; i++) {
if (priv->src2dst[i]>=0) {
H5T_conv_t tconv_func;
tconv_func = H5T_find(src->u.compnd.memb[i].type,
if (src2dst[i]>=0) {
H5T_path_t *tpath;
tpath = H5T_path_find(src->u.compnd.memb[i].type,
dst->u.compnd.memb[src2dst[i]].type,
H5T_BKG_NO, priv->memb_cdata+src2dst[i]);
if (!tconv_func) {
H5MM_xfree (priv->src2dst);
H5MM_xfree (priv->src_memb_id);
H5MM_xfree (priv->dst_memb_id);
H5MM_xfree (priv->memb_conv);
NULL, NULL);
if (NULL==(priv->memb_path[i] = tpath)) {
H5MM_xfree(priv->src2dst);
H5MM_xfree(priv->src_memb_id);
H5MM_xfree(priv->dst_memb_id);
H5MM_xfree(priv->memb_path);
H5MM_xfree(priv->memb_nelmts);
cdata->priv = priv = H5MM_xfree (priv);
HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
"unable to convert member data type");
}
priv->memb_conv[src2dst[i]] = tconv_func;
}
}
@ -701,8 +727,7 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
H5MM_xfree(priv->src2dst);
H5MM_xfree(priv->src_memb_id);
H5MM_xfree(priv->dst_memb_id);
H5MM_xfree(priv->memb_conv);
H5MM_xfree(priv->memb_cdata);
H5MM_xfree(priv->memb_path);
H5MM_xfree(priv->memb_nelmts);
cdata->priv = priv = H5MM_xfree (priv);
break;
@ -761,20 +786,21 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
dst_memb = dst->u.compnd.memb + src2dst[i];
if (dst_memb->size <= src_memb->size) {
H5T_conv_t tconv_func = priv->memb_conv[src2dst[i]];
H5T_cdata_t *memb_cdata = priv->memb_cdata[src2dst[i]];
memb_cdata->command = H5T_CONV_CONV;
(tconv_func)(priv->src_memb_id[src2dst[i]],
priv->dst_memb_id[src2dst[i]],
memb_cdata, priv->memb_nelmts[i],
buf + src_memb->offset,
bkg + dst_memb->offset);
HDmemmove (buf + offset, buf + src_memb->offset,
if (H5T_convert(priv->memb_path[i],
priv->src_memb_id[i],
priv->dst_memb_id[src2dst[i]],
priv->memb_nelmts[i],
buf + src_memb->offset,
bkg + dst_memb->offset)<0) {
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
"unable to convert compound data type "
"member");
}
HDmemmove (buf+offset, buf+src_memb->offset,
dst_memb->size);
offset += dst_memb->size;
} else {
HDmemmove (buf + offset, buf + src_memb->offset,
HDmemmove (buf+offset, buf+src_memb->offset,
src_memb->size);
offset += src_memb->size;
}
@ -793,14 +819,16 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
dst_memb = dst->u.compnd.memb + src2dst[i];
if (dst_memb->size > src_memb->size) {
H5T_conv_t tconv_func = priv->memb_conv[src2dst[i]];
H5T_cdata_t *memb_cdata = priv->memb_cdata[src2dst[i]];
offset -= src_memb->size;
memb_cdata->command = H5T_CONV_CONV;
(tconv_func)(priv->src_memb_id[src2dst[i]],
priv->dst_memb_id[src2dst[i]],
memb_cdata, priv->memb_nelmts[i],
buf+offset, bkg+dst_memb->offset);
if (H5T_convert(priv->memb_path[i],
priv->src_memb_id[i],
priv->dst_memb_id[src2dst[i]],
priv->memb_nelmts[i],
buf+offset, bkg+dst_memb->offset)<0) {
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
"unable to convert compound data type "
"member");
}
} else {
offset -= dst_memb->size;
}
@ -4327,44 +4355,57 @@ H5T_conv_float_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
H5T_t *st, *dt; /*type descriptors */
hbool_t src_mv, dst_mv; /*align data? */
double aligned; /*aligned data */
H5T_conv_hw_t *priv = cdata->priv; /*private data */
FUNC_ENTER (H5T_conv_float_double, FAIL);
switch (cdata->command) {
case H5T_CONV_INIT:
cdata->need_bkg = H5T_BKG_NO;
if (NULL==(st=H5I_object(src_id)) ||
NULL==(dt=H5I_object(dst_id))) {
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
"unable to dereference data type object ID");
}
if (st->size!=sizeof(float) || dt->size!=sizeof(double)) {
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
"disagreement about data type size");
}
if (NULL==(cdata->priv=H5MM_calloc(sizeof(H5T_conv_hw_t)))) {
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
break;
case H5T_CONV_FREE:
CI_PRINT_STATS(FLOAT, DOUBLE);
cdata->priv = H5MM_xfree(cdata->priv);
break;
case H5T_CONV_CONV:
src = (float*)buf + nelmts-1;
dst = (double*)buf + nelmts-1;
st = H5I_object(src_id);
dt = H5I_object(dst_id);
assert(st && dt);
/* Need alignment? */
if (H5T_NATIVE_FLOAT_ALIGN_g>1) {
src_mv = ((size_t)buf % H5T_NATIVE_FLOAT_ALIGN_g) ||
(st->size % H5T_NATIVE_FLOAT_ALIGN_g);
(sizeof(float) % H5T_NATIVE_FLOAT_ALIGN_g);
} else {
src_mv = FALSE;
}
if (H5T_NATIVE_DOUBLE_ALIGN_g>1) {
dst_mv = ((size_t)buf % H5T_NATIVE_DOUBLE_ALIGN_g) ||
(dt->size % H5T_NATIVE_DOUBLE_ALIGN_g);
(sizeof(double) % H5T_NATIVE_DOUBLE_ALIGN_g);
} else {
dst_mv = FALSE;
}
CI_DEBUG(src_mv, FLOAT, float);
CI_DEBUG(dst_mv, DOUBLE, double);
if (src_mv) priv->s_aligned += nelmts;
if (dst_mv) priv->d_aligned += nelmts;
for (elmtno=0; elmtno<nelmts; elmtno++, --src, --dst) {
/* Align source and/or destination */
if (src_mv) {
memcpy(&aligned, src, st->size);
memcpy(&aligned, src, sizeof(float));
s = (float*)&aligned;
} else {
s = src;
@ -4376,7 +4417,7 @@ H5T_conv_float_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
*d = *s;
/* Unalign destination */
if (dst_mv) memcpy(dst, &aligned, dt->size);
if (dst_mv) memcpy(dst, &aligned, sizeof(double));
}
break;
@ -4417,44 +4458,57 @@ H5T_conv_double_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
H5T_t *st, *dt; /*type descriptors */
hbool_t src_mv, dst_mv; /*align data? */
double aligned; /*aligned data */
H5T_conv_hw_t *priv = cdata->priv; /*private data */
FUNC_ENTER (H5T_conv_double_float, FAIL);
switch (cdata->command) {
case H5T_CONV_INIT:
cdata->need_bkg = H5T_BKG_NO;
if (NULL==(st=H5I_object(src_id)) ||
NULL==(dt=H5I_object(dst_id))) {
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
"unable to dereference data type object ID");
}
if (st->size!=sizeof(double) || dt->size!=sizeof(float)) {
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
"disagreement about data type size");
}
if (NULL==(cdata->priv=H5MM_calloc(sizeof(H5T_conv_hw_t)))) {
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
break;
case H5T_CONV_FREE:
CI_PRINT_STATS(DOUBLE, FLOAT);
cdata->priv = H5MM_xfree(cdata->priv);
break;
case H5T_CONV_CONV:
src = (double*)buf;
dst = (float*)buf;
st = H5I_object(src_id);
dt = H5I_object(dst_id);
assert(st && dt);
/* Need alignment? */
if (H5T_NATIVE_DOUBLE_ALIGN_g>1) {
src_mv = ((size_t)buf % H5T_NATIVE_DOUBLE_ALIGN_g) ||
(st->size % H5T_NATIVE_DOUBLE_ALIGN_g);
(sizeof(double) % H5T_NATIVE_DOUBLE_ALIGN_g);
} else {
src_mv = FALSE;
}
if (H5T_NATIVE_FLOAT_ALIGN_g>1) {
dst_mv = ((size_t)buf % H5T_NATIVE_FLOAT_ALIGN_g) ||
(dt->size % H5T_NATIVE_FLOAT_ALIGN_g);
(sizeof(float) % H5T_NATIVE_FLOAT_ALIGN_g);
} else {
dst_mv = FALSE;
}
CI_DEBUG(src_mv, DOUBLE, double);
CI_DEBUG(dst_mv, FLOAT, float);
if (src_mv) priv->s_aligned += nelmts;
if (dst_mv) priv->d_aligned += nelmts;
for (elmtno=0; elmtno<nelmts; elmtno++, src++, dst++) {
/* Align source and/or destination */
if (src_mv) {
memcpy(&aligned, src, st->size);
memcpy(&aligned, src, sizeof(double));
s = (double*)&aligned;
} else {
s = src;
@ -4478,7 +4532,7 @@ H5T_conv_double_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
}
/* Unalign destination */
if (dst_mv) memcpy(dst, &aligned, dt->size);
if (dst_mv) memcpy(dst, &aligned, sizeof(float));
}
break;

View File

@ -28,8 +28,6 @@
#include <H5Rpublic.h> /* Publicly accessible reference information needed also */
#include <H5Tprivate.h>
#define H5T_NAMELEN 10 /*length of debugging name buffer */
typedef struct H5T_atomic_t {
H5T_order_t order; /*byte order */
size_t prec; /*precision in bits */
@ -99,16 +97,6 @@ typedef struct H5T_member_t {
struct H5T_t *type; /*type of this member */
} H5T_member_t;
/* The data type conversion database */
typedef struct H5T_path_t {
char name[H5T_NAMELEN]; /*name for debugging only */
H5T_t *src; /*source data type ID */
H5T_t *dst; /*destination data type ID */
H5T_conv_t func; /*data conversion function */
hbool_t is_hard; /*is it a hard function? */
H5T_cdata_t cdata; /*data for this function */
} H5T_path_t;
/* The master list of soft conversion functions */
typedef struct H5T_soft_t {
char name[H5T_NAMELEN]; /*name for debugging only */
@ -126,10 +114,6 @@ typedef enum H5T_sdir_t {
/* The overflow handler */
extern H5T_overflow_t H5T_overflow_g;
/* Function prototypes for H5T package scope */
H5T_path_t *H5T_path_find (const char *name, const H5T_t *src,
const H5T_t *dst, hbool_t create, H5T_conv_t func);
/*
* Alignment information for native types. A value of N indicates that the
* data must be aligned on an address ADDR such that 0 == ADDR mod N. When
@ -151,6 +135,9 @@ extern size_t H5T_NATIVE_DOUBLE_ALIGN_g;
extern size_t H5T_NATIVE_LDOUBLE_ALIGN_g;
/* Conversion functions */
herr_t H5T_conv_noop (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, void *buf, void *bkg);
herr_t H5T_conv_order (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, void *_buf, void *bkg);
herr_t H5T_conv_struct (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,

View File

@ -22,17 +22,10 @@
#include <H5private.h>
#include <H5Gprivate.h> /*for H5G_entry_t */
#define H5T_RESERVED_ATOMS 8
typedef struct H5T_t H5T_t;
#define H5T_RESERVED_ATOMS 8
#define H5T_NAMELEN 32 /*length of debugging name buffer */
/* Statistics about a conversion function */
typedef struct H5T_stats_t {
uintn ncalls; /*num calls to conversion function */
#ifdef H5T_DEBUG
hsize_t nelmts; /*total data points converted */
H5_timer_t timer; /*total time for conversion */
#endif
} H5T_stats_t;
typedef struct H5T_t H5T_t;
/* How to copy a data type */
typedef enum H5T_copy_t {
@ -41,9 +34,35 @@ typedef enum H5T_copy_t {
H5T_COPY_REOPEN
} H5T_copy_t;
/* Statistics about a conversion function */
typedef struct H5T_stats_t {
unsigned ncalls; /*num calls to conversion function */
hsize_t nelmts; /*total data points converted */
H5_timer_t timer; /*total time for conversion */
} H5T_stats_t;
/* The data type conversion database */
typedef struct H5T_path_t {
char name[H5T_NAMELEN]; /*name for debugging only */
H5T_t *src; /*source data type ID */
H5T_t *dst; /*destination data type ID */
H5T_conv_t func; /*data conversion function */
hbool_t is_hard; /*is it a hard function? */
H5T_stats_t stats; /*statistics for the conversion */
H5T_cdata_t cdata; /*data for this function */
} H5T_path_t;
/*
* Is the path the special no-op path? The no-op function can be set by the
* application and there might be more than one no-op path in a
* multi-threaded application if one thread is using the no-op path when some
* other thread changes its definition.
*/
#define H5T_IS_NOOP(P) ((P)->is_hard && 0==H5T_cmp((P)->src, (P)->dst))
/* Private functions */
herr_t H5T_native_open(void);
herr_t H5T_init_interface (void);
herr_t H5T_init(void);
htri_t H5T_isa(H5G_entry_t *ent);
H5T_t *H5T_open (H5G_entry_t *loc, const char *name);
H5T_t *H5T_create (H5T_class_t type, size_t size);
@ -60,16 +79,10 @@ herr_t H5T_insert (H5T_t *parent, const char *name, size_t offset,
herr_t H5T_sort_by_offset (H5T_t *dt);
herr_t H5T_pack (H5T_t *dt);
herr_t H5T_debug (H5T_t *dt, FILE * stream);
H5T_conv_t H5T_find (const H5T_t *src, const H5T_t *dst, H5T_bkg_t need_bkg,
H5T_cdata_t **pcdata/*out*/);
H5G_entry_t *H5T_entof (H5T_t *dt);
void H5T_timer_begin (H5_timer_t *timer, H5T_cdata_t *cdata);
void H5T_timer_end (H5_timer_t *timer, H5T_cdata_t *cdata, size_t nelmts);
H5T_path_t *H5T_path_find (const H5T_t *src, const H5T_t *dst,
const char *name, H5T_conv_t func);
herr_t H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id,
size_t nelmts, void *buf, void *bkg);
/*
* This conversion function is here so we can determine whether a conversion
* is a no-op or not. The other conversion functions can go in H5Tpkg.h
*/
herr_t H5T_conv_noop (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, void *buf, void *bkg);
#endif

View File

@ -145,9 +145,15 @@ typedef struct H5T_cdata_t {
H5T_bkg_t need_bkg;/*is the background buffer needed? */
hbool_t recalc; /*recalculate private data */
void *priv; /*private data */
struct H5T_stats_t *stats; /*statistics for the conversion */
} H5T_cdata_t;
/* Conversion function persistence */
typedef enum H5T_pers_t {
H5T_PERS_DONTCARE = -1, /*wild card */
H5T_PERS_HARD = 0, /*hard conversion function */
H5T_PERS_SOFT = 1 /*soft conversion function */
} H5T_pers_t;
/* All data type conversion functions are... */
typedef herr_t (*H5T_conv_t) (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, void *buf, void *bkg);
@ -433,11 +439,10 @@ herr_t H5Tset_cset (hid_t type_id, H5T_cset_t cset);
herr_t H5Tset_strpad (hid_t type_id, H5T_str_t strpad);
/* Type conversion database */
herr_t H5Tregister_hard (const char *name, hid_t src_id, hid_t dst_id,
H5T_conv_t func);
herr_t H5Tregister_soft (const char *name, H5T_class_t src, H5T_class_t dst,
H5T_conv_t func);
herr_t H5Tunregister (H5T_conv_t func);
herr_t H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id,
hid_t dst_id, H5T_conv_t func);
herr_t H5Tunregister (H5T_pers_t pers, const char *name, hid_t src_id,
hid_t dst_id, H5T_conv_t func);
H5T_conv_t H5Tfind (hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata);
herr_t H5Tconvert (hid_t src_id, hid_t dst_id, size_t nelmts, void *buf,
void *background);

View File

@ -475,7 +475,7 @@ iprint(detected_t *d)
} else if (1==d->align) {
printf(" * Alignment: none\n");
} else {
printf(" * Alignemtn: %lu\n", (unsigned long)(d->align));
printf(" * Alignment: %lu\n", (unsigned long)(d->align));
}
}

View File

@ -850,7 +850,7 @@ extern hbool_t library_initialize_g; /*good thing C's lazy about extern! */
\
/* Initialize this interface or bust */ \
if (!interface_initialize_g) { \
interface_initialize_g = TRUE; \
interface_initialize_g = 1; \
if (interface_init_func && \
((herr_t(*)(void))interface_init_func)()<0) { \
HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err, \

View File

@ -20,14 +20,14 @@
* Offset from alinged memory returned by malloc(). This can be used to test
* that type conversions handle non-aligned buffers correctly.
*/
#define ALIGNMENT 0
#define ALIGNMENT 1
/*
* Define if you want to test alignment code on a machine that doesn't
* normally require alignment. When set, all native data types must be aligned
* on a byte boundary equal to the data size.
*/
#undef TEST_ALIGNMENT
#define TEST_ALIGNMENT
/* Alignment test stuff */
#ifdef TEST_ALIGNMENT
@ -2828,6 +2828,11 @@ main(void)
reset_hdf5();
fapl = h5_fileaccess();
if (ALIGNMENT) {
printf("Testing non-aligned conversions (ALIGNMENT=%d)....\n",
ALIGNMENT);
}
/* Do the tests */
nerrors += test_classes()<0 ? 1 : 0;
nerrors += test_copy()<0 ? 1 : 0;
@ -2836,7 +2841,7 @@ main(void)
nerrors += test_named (fapl)<0 ? 1 : 0;
h5_cleanup (fapl); /*must happen before first reset*/
reset_hdf5();
nerrors += test_conv_str_1()<0 ? 1 : 0;
nerrors += test_conv_str_2()<0 ? 1 : 0;
nerrors += test_conv_int ()<0 ? 1 : 0;

View File

@ -317,106 +317,110 @@ h5_fileaccess(void)
void
h5_no_hwconv(void)
{
H5Tunregister(H5T_conv_schar_uchar);
H5Tunregister(H5T_conv_schar_short);
H5Tunregister(H5T_conv_schar_ushort);
H5Tunregister(H5T_conv_schar_int);
H5Tunregister(H5T_conv_schar_uint);
H5Tunregister(H5T_conv_schar_long);
H5Tunregister(H5T_conv_schar_ulong);
H5Tunregister(H5T_conv_schar_llong);
H5Tunregister(H5T_conv_schar_ullong);
#if 1
H5Tunregister(H5T_PERS_HARD, NULL, -1, -1, NULL);
#else
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_schar_uchar);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_schar_short);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_schar_ushort);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_schar_int);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_schar_uint);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_schar_long);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_schar_ulong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_schar_llong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_schar_ullong);
H5Tunregister(H5T_conv_uchar_schar);
H5Tunregister(H5T_conv_uchar_short);
H5Tunregister(H5T_conv_uchar_ushort);
H5Tunregister(H5T_conv_uchar_int);
H5Tunregister(H5T_conv_uchar_uint);
H5Tunregister(H5T_conv_uchar_long);
H5Tunregister(H5T_conv_uchar_ulong);
H5Tunregister(H5T_conv_uchar_llong);
H5Tunregister(H5T_conv_uchar_ullong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_uchar_schar);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_uchar_short);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_uchar_ushort);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_uchar_int);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_uchar_uint);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_uchar_long);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_uchar_ulong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_uchar_llong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_uchar_ullong);
H5Tunregister(H5T_conv_short_schar);
H5Tunregister(H5T_conv_short_uchar);
H5Tunregister(H5T_conv_short_ushort);
H5Tunregister(H5T_conv_short_int);
H5Tunregister(H5T_conv_short_uint);
H5Tunregister(H5T_conv_short_long);
H5Tunregister(H5T_conv_short_ulong);
H5Tunregister(H5T_conv_short_llong);
H5Tunregister(H5T_conv_short_ullong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_short_schar);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_short_uchar);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_short_ushort);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_short_int);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_short_uint);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_short_long);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_short_ulong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_short_llong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_short_ullong);
H5Tunregister(H5T_conv_ushort_schar);
H5Tunregister(H5T_conv_ushort_uchar);
H5Tunregister(H5T_conv_ushort_short);
H5Tunregister(H5T_conv_ushort_int);
H5Tunregister(H5T_conv_ushort_uint);
H5Tunregister(H5T_conv_ushort_long);
H5Tunregister(H5T_conv_ushort_ulong);
H5Tunregister(H5T_conv_ushort_llong);
H5Tunregister(H5T_conv_ushort_ullong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ushort_schar);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ushort_uchar);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ushort_short);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ushort_int);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ushort_uint);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ushort_long);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ushort_ulong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ushort_llong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ushort_ullong);
H5Tunregister(H5T_conv_int_schar);
H5Tunregister(H5T_conv_int_uchar);
H5Tunregister(H5T_conv_int_short);
H5Tunregister(H5T_conv_int_ushort);
H5Tunregister(H5T_conv_int_uint);
H5Tunregister(H5T_conv_int_long);
H5Tunregister(H5T_conv_int_ulong);
H5Tunregister(H5T_conv_int_llong);
H5Tunregister(H5T_conv_int_ullong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_int_schar);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_int_uchar);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_int_short);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_int_ushort);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_int_uint);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_int_long);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_int_ulong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_int_llong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_int_ullong);
H5Tunregister(H5T_conv_uint_schar);
H5Tunregister(H5T_conv_uint_uchar);
H5Tunregister(H5T_conv_uint_short);
H5Tunregister(H5T_conv_uint_ushort);
H5Tunregister(H5T_conv_uint_int);
H5Tunregister(H5T_conv_uint_long);
H5Tunregister(H5T_conv_uint_ulong);
H5Tunregister(H5T_conv_uint_llong);
H5Tunregister(H5T_conv_uint_ullong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_uint_schar);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_uint_uchar);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_uint_short);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_uint_ushort);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_uint_int);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_uint_long);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_uint_ulong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_uint_llong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_uint_ullong);
H5Tunregister(H5T_conv_long_schar);
H5Tunregister(H5T_conv_long_uchar);
H5Tunregister(H5T_conv_long_short);
H5Tunregister(H5T_conv_long_ushort);
H5Tunregister(H5T_conv_long_int);
H5Tunregister(H5T_conv_long_uint);
H5Tunregister(H5T_conv_long_ulong);
H5Tunregister(H5T_conv_long_llong);
H5Tunregister(H5T_conv_long_ullong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_long_schar);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_long_uchar);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_long_short);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_long_ushort);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_long_int);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_long_uint);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_long_ulong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_long_llong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_long_ullong);
H5Tunregister(H5T_conv_ulong_schar);
H5Tunregister(H5T_conv_ulong_uchar);
H5Tunregister(H5T_conv_ulong_short);
H5Tunregister(H5T_conv_ulong_ushort);
H5Tunregister(H5T_conv_ulong_int);
H5Tunregister(H5T_conv_ulong_uint);
H5Tunregister(H5T_conv_ulong_long);
H5Tunregister(H5T_conv_ulong_llong);
H5Tunregister(H5T_conv_ulong_ullong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ulong_schar);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ulong_uchar);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ulong_short);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ulong_ushort);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ulong_int);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ulong_uint);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ulong_long);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ulong_llong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ulong_ullong);
H5Tunregister(H5T_conv_llong_schar);
H5Tunregister(H5T_conv_llong_uchar);
H5Tunregister(H5T_conv_llong_short);
H5Tunregister(H5T_conv_llong_ushort);
H5Tunregister(H5T_conv_llong_int);
H5Tunregister(H5T_conv_llong_uint);
H5Tunregister(H5T_conv_llong_long);
H5Tunregister(H5T_conv_llong_ulong);
H5Tunregister(H5T_conv_llong_ullong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_llong_schar);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_llong_uchar);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_llong_short);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_llong_ushort);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_llong_int);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_llong_uint);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_llong_long);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_llong_ulong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_llong_ullong);
H5Tunregister(H5T_conv_ullong_schar);
H5Tunregister(H5T_conv_ullong_uchar);
H5Tunregister(H5T_conv_ullong_short);
H5Tunregister(H5T_conv_ullong_ushort);
H5Tunregister(H5T_conv_ullong_int);
H5Tunregister(H5T_conv_ullong_uint);
H5Tunregister(H5T_conv_ullong_long);
H5Tunregister(H5T_conv_ullong_ulong);
H5Tunregister(H5T_conv_ullong_llong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ullong_schar);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ullong_uchar);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ullong_short);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ullong_ushort);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ullong_int);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ullong_uint);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ullong_long);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ullong_ulong);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_ullong_llong);
H5Tunregister(H5T_conv_float_double);
H5Tunregister(H5T_conv_double_float);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_float_double);
H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T_conv_double_float);
#endif
}

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump tall.h5'
Expected output for 'h5dump tall.h5'
#############################
HDF5 "tall.h5" {
GROUP "/" {

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump -header -g /g1/g1.1 -a attr2 tall.h5'
Expected output for 'h5dump -header -g /g1/g1.1 -a attr2 tall.h5'
#############################
HDF5 "tall.h5" {
GROUP "/g1/g1.1" {

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump -d /g2/dset2.1 -l /g1/g1.2/g1.2.1/slink tall.h5'
Expected output for 'h5dump -d /g2/dset2.1 -l /g1/g1.2/g1.2.1/slink tall.h5'
#############################
HDF5 "tall.h5" {
DATASET "/g2/dset2.1" {

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump tattr.h5'
Expected output for 'h5dump tattr.h5'
#############################
HDF5 "tattr.h5" {
GROUP "/" {

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump -a attr1 attr3 tattr.h5'
Expected output for 'h5dump -a attr1 attr3 tattr.h5'
#############################
HDF5 "tattr.h5" {
ATTRIBUTE "attr1" {

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump -header -a attr2 tattr.h5'
Expected output for 'h5dump -header -a attr2 tattr.h5'
#############################
HDF5 "tattr.h5" {
ATTRIBUTE "attr2" {

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump -a attr4 tattr.h5'
Expected output for 'h5dump -a attr4 tattr.h5'
#############################
HDF5 "tattr.h5" {
ATTRIBUTE "attr4" {

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump tcompound.h5'
Expected output for 'h5dump tcompound.h5'
#############################
HDF5 "tcompound.h5" {
GROUP "/" {

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump -t /type1 /type2 /group1/type3 tcompound.h5'
Expected output for 'h5dump -t /type1 /type2 /group1/type3 tcompound.h5'
#############################
HDF5 "tcompound.h5" {
DATATYPE "/type1" {

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump -d /group2/dset5 -g /group1 tcompound.h5'
Expected output for 'h5dump -d /group2/dset5 -g /group1 tcompound.h5'
#############################
HDF5 "tcompound.h5" {
DATASET "/group2/dset5" {

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump -t /#3432:0 -g /group2 tcompound.h5'
Expected output for 'h5dump -t /#3432:0 -g /group2 tcompound.h5'
#############################
HDF5 "tcompound.h5" {
DATATYPE "/#3432:0" {

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump tdset.h5'
Expected output for 'h5dump tdset.h5'
#############################
HDF5 "tdset.h5" {
GROUP "/" {

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump -d dset1 /dset2 tdset.h5'
Expected output for 'h5dump -d dset1 /dset2 tdset.h5'
#############################
HDF5 "tdset.h5" {
DATASET "dset1" {

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump -d /dset1 -header tdset.h5'
Expected output for 'h5dump -d /dset1 -header tdset.h5'
#############################
HDF5 "tdset.h5" {
DATASET "/dset1" {

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump -d dset3 tdset.h5'
Expected output for 'h5dump -d dset3 tdset.h5'
#############################
HDF5 "tdset.h5" {
DATASET "dset3" {

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump tgroup.h5'
Expected output for 'h5dump tgroup.h5'
#############################
HDF5 "tgroup.h5" {
GROUP "/" {

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump -g / tgroup.h5'
Expected output for 'h5dump -g / tgroup.h5'
#############################
HDF5 "tgroup.h5" {
GROUP "/" {

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump -g /g2 /y tgroup.h5'
Expected output for 'h5dump -g /g2 /y tgroup.h5'
#############################
HDF5 "tgroup.h5" {
GROUP "/g2" {

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump thlink.h5'
Expected output for 'h5dump thlink.h5'
#############################
HDF5 "thlink.h5" {
GROUP "/" {

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump -d /g1/link2 /dset /g1/link1/link3 thlink.h5'
Expected output for 'h5dump -d /g1/link2 /dset /g1/link1/link3 thlink.h5'
#############################
HDF5 "thlink.h5" {
DATASET "/g1/link2" {

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump -d /dset /g1/link1/link3 /g1/link2 thlink.h5'
Expected output for 'h5dump -d /dset /g1/link1/link3 /g1/link2 thlink.h5'
#############################
HDF5 "thlink.h5" {
DATASET "/dset" {

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump -g /g1 thlink.h5'
Expected output for 'h5dump -g /g1 thlink.h5'
#############################
HDF5 "thlink.h5" {
GROUP "/g1" {

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump -d /dset -g /g2 -d /g1/link2 thlink.h5'
Expected output for 'h5dump -d /dset -g /g2 -d /g1/link2 thlink.h5'
#############################
HDF5 "thlink.h5" {
DATASET "/dset" {

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump tslink.h5'
Expected output for 'h5dump tslink.h5'
#############################
HDF5 "tslink.h5" {
GROUP "/" {

View File

@ -1,5 +1,5 @@
#############################
Expected output for '../h5dump -l slink2 tslink.h5'
Expected output for 'h5dump -l slink2 tslink.h5'
#############################
HDF5 "tslink.h5" {
SOFTLINK "slink2" {

View File

@ -1,213 +1,103 @@
#! /bin/sh
# Test scripts for h5dump.
# See the USAGE function for command usage.
#!/bin/sh
h5dump=h5dump # a relative name
cmp='cmp -s'
diff='diff -c'
# Definitions of commands and variables
CMD='../h5dump'
RM='rm -f'
DIFF=diff
CMP='cmp -s'
nerrors=0 # number of errors (0)
quitonerr=0 # quit on error (not)
noclean=0 # no cleaning temp. files (yes)
only="" # dumper sub-command to test only
except="" # dumper sub-command to test not
nerrors=0
verbose=yes
# Definitions of functions/shorthands
#
# Print Usage of the command
USAGE()
# Print a line-line message left justified in a field of 70 characters
# beginning with the word "Testing".
TESTING()
{
echo "Usage: $0 [-help] [-noclean] [-quit] [-except <command>] [-only <command>]"
echo " -help: display help information"
echo " -noclean: do not clean away temporary files"
echo " -quit: quit immediately if any test fails"
echo " -except: skip one specific command"
echo " -only: test one specific command"
echo "<command> can be one of {list, dumpsds, dumprig, dumpvd, dumpvg, dumpgr}"
SPACES=" "
echo "Testing $* $SPACES" |cut -c1-70 |tr -d '\n'
}
# Print message with formats according to message level ($1)
MESG()
# Run a test and print PASS or *FAIL*. If a test fails then increment
# the `nerrors' global variable and (if $verbose is set) display the
# difference between the actual output and the expected output. The
# expected output is given as the first argument to this function and
# the actual output file is calculated by replacing the `.ddl' with
# `.out'. The actual output is not removed if $HDF5_NOCLEANUP has a
# non-zero value.
DUMP()
{
level=$1
expect=testfiles/$1
actual="testfiles/`basename $1 .ddl`.out"
shift
case $level in
0)
echo '============================='
echo $*
echo '============================='
;;
3)
echo '-----------------------------'
echo $*
echo '-----------------------------'
;;
6)
echo "*** $* ***"
;;
*)
echo "MESG(): Unknown level ($level)"
exit 1
;;
esac
}
# Run the test to produce an output file which is then
# compared with the expected ($1) output.
# Note that this can be used to produce the expected
# output files by replace "$output" with "$expected"
# in the run-the-test commands.
TEST()
{
# parse the arguments
output=tmp.out
expected=testfiles/$1
shift
# print a id banner
MESG 6 $@
# run the test
(
# Run test.
TESTING $h5dump $@
(
echo "#############################"
echo "Expected output for '$CMD $@'"
echo "Expected output for '$h5dump $@'"
echo "#############################"
cd testfiles
$CMD "$@"
) > $output
$CMP $expected $output
if [ $? -ne 0 ]
then
echo $DIFF $expected $output
$DIFF $expected $output
echo " <<< FAILED >>>"
nerrors=`expr $nerrors + 1`
if [ $quitonerr -gt 0 ];
then
FINISH
fi
fi
# if [ $noclean -eq 0 ]
# then
# $RM $output
# fi
}
../$h5dump "$@" 2>/dev/null
) >$actual
# Results. We normalize the result to account for different output
# widths. That is, the test should succeed if the only
# differences are in white space. We have to do this the hard way
# because diff isn't always smart enough.
tr '\n' ' ' <$actual |tr -s ' \t' |fold >$actual-norm
tr '\n' ' ' <$expect |tr -s ' \t' |fold >$expect-norm
# Report the result and exit
FINISH()
{
if [ $nerrors -eq 0 ]
then
MESG 0 "All h5dump tests passed"
if $cmp $expect-norm $actual-norm; then
echo " PASSED"
else
MESG 0 "h5dump tests failed: $nerrors"
echo "*FAILED*"
echo " Actual result (*.out) differs from expected result (*.ddl)"
nerrors="`expr $nerrors + 1`"
test yes = "$verbose" && $diff $expect $actual |sed 's/^/ /'
fi
# Clean up output file
rm -f $expect-norm $actual-norm
if [ X = ${HDF5_NOCLEANUP:-X} ]; then
rm -f $actual
fi
exit $nerrors
}
#===============
# Main Body
#===============
# parse arguments
while [ $# -gt 0 ]
do
case "$1" in
"-quit")
quitonerr=1
;;
"-noclean")
noclean=1
;;
"-help")
USAGE
exit 0
;;
"-only")
shift
case "$1" in
"h5dump")
only="$1"
;;
*)
echo "Unknown command: $1"
USAGE
exit 1
;;
esac
;;
"-except")
shift
case "$1" in
"h5dump")
except="$1"
;;
*)
echo "Unknown command: $1"
USAGE
exit 1
;;
esac
;;
* )
echo "Unknow option: $1"
USAGE
exit 1
;;
esac
shift
done
##############################################################################
##############################################################################
### T H E T E S T S ###
##############################################################################
##############################################################################
# Print a beginning banner
MESG 0 "Running h5dump tests"
DUMP tgroup-1.ddl tgroup.h5
DUMP tgroup-2.ddl -g / tgroup.h5
DUMP tgroup-3.ddl -g /g2 /y tgroup.h5
# Test command list
TestCmd=h5dump
TestName="Test command $TestCmd"
if [ "$except" != $TestCmd -a \( -z "$only" -o "$only" = $TestCmd \) ]
then
MESG 3 "$TestName"
TEST tgroup-1.ddl tgroup.h5
TEST tgroup-2.ddl -g / tgroup.h5
TEST tgroup-3.ddl -g /g2 /y tgroup.h5
DUMP tdset-1.ddl tdset.h5
DUMP tdset-2.ddl -d dset1 /dset2 tdset.h5
DUMP tdset-3.ddl -d /dset1 -header tdset.h5
DUMP tdset-4.ddl -d dset3 tdset.h5
TEST tdset-1.ddl tdset.h5
TEST tdset-2.ddl -d dset1 /dset2 tdset.h5
TEST tdset-3.ddl -d /dset1 -header tdset.h5
TEST tdset-4.ddl -d dset3 tdset.h5
DUMP tattr-1.ddl tattr.h5
DUMP tattr-2.ddl -a attr1 attr3 tattr.h5
DUMP tattr-3.ddl -header -a attr2 tattr.h5
DUMP tattr-4.ddl -a attr4 tattr.h5
TEST tattr-1.ddl tattr.h5
TEST tattr-2.ddl -a attr1 attr3 tattr.h5
TEST tattr-3.ddl -header -a attr2 tattr.h5
TEST tattr-4.ddl -a attr4 tattr.h5
DUMP tslink-1.ddl tslink.h5
DUMP tslink-2.ddl -l slink2 tslink.h5
TEST tslink-1.ddl tslink.h5
TEST tslink-2.ddl -l slink2 tslink.h5
DUMP thlink-1.ddl thlink.h5
DUMP thlink-2.ddl -d /g1/link2 /dset /g1/link1/link3 thlink.h5
DUMP thlink-3.ddl -d /dset /g1/link1/link3 /g1/link2 thlink.h5
DUMP thlink-4.ddl -g /g1 thlink.h5
DUMP thlink-5.ddl -d /dset -g /g2 -d /g1/link2 thlink.h5
TEST thlink-1.ddl thlink.h5
TEST thlink-2.ddl -d /g1/link2 /dset /g1/link1/link3 thlink.h5
TEST thlink-3.ddl -d /dset /g1/link1/link3 /g1/link2 thlink.h5
TEST thlink-4.ddl -g /g1 thlink.h5
TEST thlink-5.ddl -d /dset -g /g2 -d /g1/link2 thlink.h5
DUMP tcomp-1.ddl tcompound.h5
DUMP tcomp-2.ddl -t /type1 /type2 /group1/type3 tcompound.h5
DUMP tcomp-3.ddl -d /group2/dset5 -g /group1 tcompound.h5
DUMP tcomp-4.ddl -t /#3432:0 -g /group2 tcompound.h5
TEST tcomp-1.ddl tcompound.h5
TEST tcomp-2.ddl -t /type1 /type2 /group1/type3 tcompound.h5
TEST tcomp-3.ddl -d /group2/dset5 -g /group1 tcompound.h5
TEST tcomp-4.ddl -t /#3432:0 -g /group2 tcompound.h5
DUMP tall-1.ddl tall.h5
DUMP tall-2.ddl -header -g /g1/g1.1 -a attr2 tall.h5
DUMP tall-3.ddl -d /g2/dset2.1 -l /g1/g1.2/g1.2.1/slink tall.h5
TEST tall-1.ddl tall.h5
TEST tall-2.ddl -header -g /g1/g1.1 -a attr2 tall.h5
TEST tall-3.ddl -d /g2/dset2.1 -l /g1/g1.2/g1.2.1/slink tall.h5
else
MESG 3 "$TestName <<<SKIPPED>>>"
fi
# End of test
FINISH