[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
/*
|
|
|
|
|
* Copyright <EFBFBD> 1998 NCSA
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke <matzke@llnl.gov>
|
|
|
|
|
* Thursday, July 23, 1998
|
|
|
|
|
*
|
|
|
|
|
* Purpose: A library for displaying the values of a dataset in a human
|
|
|
|
|
* readable format.
|
|
|
|
|
*/
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
#include <ctype.h>
|
|
|
|
|
#include <h5tools.h>
|
|
|
|
|
#include <hdf5.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
1998-11-11 02:19:11 +08:00
|
|
|
|
#include <H5private.h>
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
/*
|
|
|
|
|
* The output functions need a temporary buffer to hold a piece of the
|
|
|
|
|
* dataset while it's being printed. This constant sets the limit on the
|
|
|
|
|
* size of that temporary buffer in bytes. For efficiency's sake, choose the
|
|
|
|
|
* largest value suitable for your machine (for testing use a small value).
|
|
|
|
|
*/
|
[svn-r876] Changes since 19981102
----------------------
./bin/snapshot
Made same fix as for the release script yesterday.
./src/H5D.c
./src/H5Dprivate.h
./src/H5G.c
./src/H5Gprivate.h
./src/H5Gpublic.h
./src/H5O.c
./src/H5Oprivate.h
./src/H5RA.c
./src/H5RAprivate.h
./src/H5T.c
./src/H5Tprivate.h
Improved object type checking. Instead of determining the
object type by trying to open each of the possible types, we
keep a table of associations between object type number (like
H5G_GROUP, H5G_DATASET, H5D_TYPE, and H5D_RAGGED) and an `isa'
function that returns true if the object header has the right
messages to make the object a particular type. This mechanism
also allows specialization of object types by permitting an
object to satisfy more than one `isa' function.
Added `isa' functions for groups, datasets, ragged arrays, and
committed data types.
./src/H5config.h.in
Added HAVE_STAT_ST_BLOCKS. I thought this had already been
added, but apparently not.
./tools/h5ls.c
Removed system include files since they're already included by
H5private.h and since I wasn't including them portably anyway.
By default, 1-byte integer types are printed as integer values
instead of ASCII characters. However, the `-s' or `--string'
command-line switch causes the data to be interpretted as
ASCII. String data types are always printed as character
data.
Ragged arrays are now identified as ragged arrays and h5ls
doesn't descend into the group automatically. This uses the
new object type specialization stuff.
./tools/h5tools.c
./tools/h5tools.h
Added the ability to print 1-byte integer types as either
ASCII or numeric data instead of always ASCII. The default is
to print as numeric data.
1998-11-06 04:28:34 +08:00
|
|
|
|
#if 1
|
1998-07-30 00:43:59 +08:00
|
|
|
|
#define H5DUMP_BUFSIZE (1024*1024)
|
1998-08-21 06:57:35 +08:00
|
|
|
|
#else
|
|
|
|
|
#define H5DUMP_BUFSIZE (1024)
|
|
|
|
|
#endif
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
|
|
|
|
|
#define OPT(X,S) ((X)?(X):(S))
|
1998-07-24 22:28:32 +08:00
|
|
|
|
#define ALIGN(A,Z) ((((A)+(Z)-1)/(Z))*(Z))
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: h5dump_prefix
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Prints the prefix to show up at the begining of the line.
|
|
|
|
|
*
|
|
|
|
|
* Return: void
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Thursday, July 23, 1998
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
h5dump_prefix(char *s/*out*/, const h5dump_t *info, hsize_t elmtno, int ndims,
|
|
|
|
|
hsize_t min_idx[], hsize_t max_idx[])
|
|
|
|
|
{
|
1998-10-27 03:55:54 +08:00
|
|
|
|
hsize_t p_prod[H5S_MAX_RANK], p_idx[H5S_MAX_RANK];
|
1998-11-03 01:58:28 +08:00
|
|
|
|
hsize_t n, i=0;
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
char temp[1024];
|
|
|
|
|
|
1998-10-02 21:31:24 +08:00
|
|
|
|
if (ndims>0) {
|
|
|
|
|
/*
|
|
|
|
|
* Calculate the number of elements represented by a unit change in a
|
|
|
|
|
* certain index position.
|
|
|
|
|
*/
|
|
|
|
|
for (i=ndims-1, p_prod[ndims-1]=1; i>0; --i) {
|
|
|
|
|
p_prod[i-1] = (max_idx[i]-min_idx[i]) * p_prod[i];
|
|
|
|
|
}
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
|
1998-10-02 21:31:24 +08:00
|
|
|
|
/*
|
|
|
|
|
* Calculate the index values from the element number.
|
|
|
|
|
*/
|
|
|
|
|
for (i=0, n=elmtno; i<(hsize_t)ndims; i++) {
|
|
|
|
|
p_idx[i] = n / p_prod[i] + min_idx[i];
|
|
|
|
|
n %= p_prod[i];
|
|
|
|
|
}
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
|
1998-10-02 21:31:24 +08:00
|
|
|
|
/*
|
|
|
|
|
* Print the index values.
|
|
|
|
|
*/
|
|
|
|
|
*temp = '\0';
|
|
|
|
|
for (i=0; i<(hsize_t)ndims; i++) {
|
|
|
|
|
if (i) strcat(temp, OPT(info->idx_sep, ","));
|
|
|
|
|
sprintf(temp+strlen(temp), OPT(info->idx_n_fmt, "%lu"),
|
|
|
|
|
(unsigned long)p_idx[i]);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
/* Scalar */
|
|
|
|
|
sprintf(temp, OPT(info->idx_n_fmt, "%lu"), (unsigned long)0);
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Add prefix and suffix to the index.
|
|
|
|
|
*/
|
|
|
|
|
sprintf(s, OPT(info->idx_fmt, "%s: "), temp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: h5dump_sprint
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Prints the value pointed to by VP into the string S assuming
|
|
|
|
|
* the data type of VP is TYPE.
|
|
|
|
|
*
|
|
|
|
|
* Return: void
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Thursday, July 23, 1998
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
h5dump_sprint(char *s/*out*/, const h5dump_t *info, hid_t type, void *vp)
|
|
|
|
|
{
|
1998-10-27 03:55:54 +08:00
|
|
|
|
size_t i, n, offset, size, dims[H5S_MAX_RANK], nelmts;
|
1999-03-20 04:09:50 +08:00
|
|
|
|
#ifndef NDEBUG
|
1998-09-22 23:27:26 +08:00
|
|
|
|
unsigned overflow = 0xaaaaaaaa;
|
1999-03-20 04:09:50 +08:00
|
|
|
|
#endif
|
1998-09-22 23:27:26 +08:00
|
|
|
|
char temp[8192];
|
|
|
|
|
char *name, quote='\0';
|
1998-07-24 22:28:32 +08:00
|
|
|
|
hid_t memb;
|
1998-07-30 00:43:59 +08:00
|
|
|
|
int nmembs, j, k, ndims;
|
1998-09-22 23:27:26 +08:00
|
|
|
|
const int repeat_threshold = 8;
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
|
|
|
|
|
if (H5Tequal(type, H5T_NATIVE_DOUBLE)) {
|
|
|
|
|
sprintf(temp, "%g", *((double*)vp));
|
1998-09-22 23:27:26 +08:00
|
|
|
|
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_FLOAT)) {
|
|
|
|
|
sprintf(temp, "%g", *((float*)vp));
|
1998-09-22 23:27:26 +08:00
|
|
|
|
|
[svn-r876] Changes since 19981102
----------------------
./bin/snapshot
Made same fix as for the release script yesterday.
./src/H5D.c
./src/H5Dprivate.h
./src/H5G.c
./src/H5Gprivate.h
./src/H5Gpublic.h
./src/H5O.c
./src/H5Oprivate.h
./src/H5RA.c
./src/H5RAprivate.h
./src/H5T.c
./src/H5Tprivate.h
Improved object type checking. Instead of determining the
object type by trying to open each of the possible types, we
keep a table of associations between object type number (like
H5G_GROUP, H5G_DATASET, H5D_TYPE, and H5D_RAGGED) and an `isa'
function that returns true if the object header has the right
messages to make the object a particular type. This mechanism
also allows specialization of object types by permitting an
object to satisfy more than one `isa' function.
Added `isa' functions for groups, datasets, ragged arrays, and
committed data types.
./src/H5config.h.in
Added HAVE_STAT_ST_BLOCKS. I thought this had already been
added, but apparently not.
./tools/h5ls.c
Removed system include files since they're already included by
H5private.h and since I wasn't including them portably anyway.
By default, 1-byte integer types are printed as integer values
instead of ASCII characters. However, the `-s' or `--string'
command-line switch causes the data to be interpretted as
ASCII. String data types are always printed as character
data.
Ragged arrays are now identified as ragged arrays and h5ls
doesn't descend into the group automatically. This uses the
new object type specialization stuff.
./tools/h5tools.c
./tools/h5tools.h
Added the ability to print 1-byte integer types as either
ASCII or numeric data instead of always ASCII. The default is
to print as numeric data.
1998-11-06 04:28:34 +08:00
|
|
|
|
} else if (info->ascii &&
|
1998-11-26 01:21:21 +08:00
|
|
|
|
(H5Tequal(type, H5T_NATIVE_SCHAR) ||
|
[svn-r876] Changes since 19981102
----------------------
./bin/snapshot
Made same fix as for the release script yesterday.
./src/H5D.c
./src/H5Dprivate.h
./src/H5G.c
./src/H5Gprivate.h
./src/H5Gpublic.h
./src/H5O.c
./src/H5Oprivate.h
./src/H5RA.c
./src/H5RAprivate.h
./src/H5T.c
./src/H5Tprivate.h
Improved object type checking. Instead of determining the
object type by trying to open each of the possible types, we
keep a table of associations between object type number (like
H5G_GROUP, H5G_DATASET, H5D_TYPE, and H5D_RAGGED) and an `isa'
function that returns true if the object header has the right
messages to make the object a particular type. This mechanism
also allows specialization of object types by permitting an
object to satisfy more than one `isa' function.
Added `isa' functions for groups, datasets, ragged arrays, and
committed data types.
./src/H5config.h.in
Added HAVE_STAT_ST_BLOCKS. I thought this had already been
added, but apparently not.
./tools/h5ls.c
Removed system include files since they're already included by
H5private.h and since I wasn't including them portably anyway.
By default, 1-byte integer types are printed as integer values
instead of ASCII characters. However, the `-s' or `--string'
command-line switch causes the data to be interpretted as
ASCII. String data types are always printed as character
data.
Ragged arrays are now identified as ragged arrays and h5ls
doesn't descend into the group automatically. This uses the
new object type specialization stuff.
./tools/h5tools.c
./tools/h5tools.h
Added the ability to print 1-byte integer types as either
ASCII or numeric data instead of always ASCII. The default is
to print as numeric data.
1998-11-06 04:28:34 +08:00
|
|
|
|
H5Tequal(type, H5T_NATIVE_UCHAR))) {
|
1998-07-24 22:28:32 +08:00
|
|
|
|
switch (*((char*)vp)) {
|
1998-07-30 00:43:59 +08:00
|
|
|
|
case '"':
|
|
|
|
|
strcpy(temp, "\\\"");
|
|
|
|
|
break;
|
1998-07-24 22:28:32 +08:00
|
|
|
|
case '\\':
|
|
|
|
|
strcpy(temp, "\\\\");
|
|
|
|
|
break;
|
|
|
|
|
case '\b':
|
|
|
|
|
strcpy(temp, "\\b");
|
|
|
|
|
break;
|
|
|
|
|
case '\f':
|
|
|
|
|
strcpy(temp, "\\f");
|
|
|
|
|
break;
|
|
|
|
|
case '\n':
|
|
|
|
|
strcpy(temp, "\\n");
|
|
|
|
|
break;
|
|
|
|
|
case '\r':
|
|
|
|
|
strcpy(temp, "\\r");
|
|
|
|
|
break;
|
|
|
|
|
case '\t':
|
|
|
|
|
strcpy(temp, "\\t");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
if (isprint(*((char*)vp))) sprintf(temp, "%c", *((char*)vp));
|
|
|
|
|
else sprintf(temp, "\\%03o", *((unsigned char*)vp));
|
|
|
|
|
break;
|
|
|
|
|
}
|
1998-09-22 23:27:26 +08:00
|
|
|
|
|
|
|
|
|
} else if (H5T_STRING==H5Tget_class(type)) {
|
|
|
|
|
size = H5Tget_size(type);
|
|
|
|
|
temp[0] = '\0';
|
|
|
|
|
quote = '\0';
|
|
|
|
|
|
|
|
|
|
for (i=0; i<size; i++) {
|
|
|
|
|
|
|
|
|
|
/* Count how many times the next character repeats */
|
|
|
|
|
j=1;
|
|
|
|
|
while (i+j<size && ((char*)vp)[i]==((char*)vp)[i+j]) j++;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Print the opening quote. If the repeat count is high enough
|
|
|
|
|
* to warrant printing the number of repeats instead of
|
|
|
|
|
* enumerating the characters, then make sure the character to be
|
|
|
|
|
* repeated is in it's own quote.
|
|
|
|
|
*/
|
|
|
|
|
if (j>repeat_threshold) {
|
|
|
|
|
if (quote) sprintf(temp+strlen(temp), "%c", quote);
|
|
|
|
|
quote = '\'';
|
|
|
|
|
sprintf(temp+strlen(temp), "%s%c", i?" ":"", quote);
|
|
|
|
|
} else if (!quote) {
|
|
|
|
|
quote = '"';
|
|
|
|
|
sprintf(temp+strlen(temp), "%s%c", i?" ":"", quote);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Print the character */
|
|
|
|
|
switch (((char*)vp)[i]) {
|
|
|
|
|
case '"':
|
|
|
|
|
strcat(temp, "\\\"");
|
|
|
|
|
break;
|
|
|
|
|
case '\\':
|
|
|
|
|
strcat(temp, "\\\\");
|
|
|
|
|
break;
|
|
|
|
|
case '\b':
|
|
|
|
|
strcat(temp, "\\b");
|
|
|
|
|
break;
|
|
|
|
|
case '\f':
|
|
|
|
|
strcat(temp, "\\f");
|
|
|
|
|
break;
|
|
|
|
|
case '\n':
|
|
|
|
|
strcat(temp, "\\n");
|
|
|
|
|
break;
|
|
|
|
|
case '\r':
|
|
|
|
|
strcat(temp, "\\r");
|
|
|
|
|
break;
|
|
|
|
|
case '\t':
|
|
|
|
|
strcat(temp, "\\t");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
if (isprint(((char*)vp)[i])) {
|
|
|
|
|
sprintf(temp+strlen(temp), "%c", ((char*)vp)[i]);
|
|
|
|
|
} else {
|
|
|
|
|
sprintf(temp+strlen(temp), "\\%03o",
|
|
|
|
|
((unsigned char*)vp)[i]);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Print the repeat count */
|
|
|
|
|
if (j>repeat_threshold) {
|
|
|
|
|
sprintf(temp+strlen(temp), "%c repeats %d times", quote, j-1);
|
|
|
|
|
quote = '\0';
|
|
|
|
|
i += j-1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (quote) sprintf(temp+strlen(temp), "%c", quote);
|
[svn-r876] Changes since 19981102
----------------------
./bin/snapshot
Made same fix as for the release script yesterday.
./src/H5D.c
./src/H5Dprivate.h
./src/H5G.c
./src/H5Gprivate.h
./src/H5Gpublic.h
./src/H5O.c
./src/H5Oprivate.h
./src/H5RA.c
./src/H5RAprivate.h
./src/H5T.c
./src/H5Tprivate.h
Improved object type checking. Instead of determining the
object type by trying to open each of the possible types, we
keep a table of associations between object type number (like
H5G_GROUP, H5G_DATASET, H5D_TYPE, and H5D_RAGGED) and an `isa'
function that returns true if the object header has the right
messages to make the object a particular type. This mechanism
also allows specialization of object types by permitting an
object to satisfy more than one `isa' function.
Added `isa' functions for groups, datasets, ragged arrays, and
committed data types.
./src/H5config.h.in
Added HAVE_STAT_ST_BLOCKS. I thought this had already been
added, but apparently not.
./tools/h5ls.c
Removed system include files since they're already included by
H5private.h and since I wasn't including them portably anyway.
By default, 1-byte integer types are printed as integer values
instead of ASCII characters. However, the `-s' or `--string'
command-line switch causes the data to be interpretted as
ASCII. String data types are always printed as character
data.
Ragged arrays are now identified as ragged arrays and h5ls
doesn't descend into the group automatically. This uses the
new object type specialization stuff.
./tools/h5tools.c
./tools/h5tools.h
Added the ability to print 1-byte integer types as either
ASCII or numeric data instead of always ASCII. The default is
to print as numeric data.
1998-11-06 04:28:34 +08:00
|
|
|
|
|
1998-11-26 01:21:21 +08:00
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_SCHAR)) {
|
[svn-r876] Changes since 19981102
----------------------
./bin/snapshot
Made same fix as for the release script yesterday.
./src/H5D.c
./src/H5Dprivate.h
./src/H5G.c
./src/H5Gprivate.h
./src/H5Gpublic.h
./src/H5O.c
./src/H5Oprivate.h
./src/H5RA.c
./src/H5RAprivate.h
./src/H5T.c
./src/H5Tprivate.h
Improved object type checking. Instead of determining the
object type by trying to open each of the possible types, we
keep a table of associations between object type number (like
H5G_GROUP, H5G_DATASET, H5D_TYPE, and H5D_RAGGED) and an `isa'
function that returns true if the object header has the right
messages to make the object a particular type. This mechanism
also allows specialization of object types by permitting an
object to satisfy more than one `isa' function.
Added `isa' functions for groups, datasets, ragged arrays, and
committed data types.
./src/H5config.h.in
Added HAVE_STAT_ST_BLOCKS. I thought this had already been
added, but apparently not.
./tools/h5ls.c
Removed system include files since they're already included by
H5private.h and since I wasn't including them portably anyway.
By default, 1-byte integer types are printed as integer values
instead of ASCII characters. However, the `-s' or `--string'
command-line switch causes the data to be interpretted as
ASCII. String data types are always printed as character
data.
Ragged arrays are now identified as ragged arrays and h5ls
doesn't descend into the group automatically. This uses the
new object type specialization stuff.
./tools/h5tools.c
./tools/h5tools.h
Added the ability to print 1-byte integer types as either
ASCII or numeric data instead of always ASCII. The default is
to print as numeric data.
1998-11-06 04:28:34 +08:00
|
|
|
|
sprintf(temp, "%d", *((signed char*)vp));
|
|
|
|
|
|
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_UCHAR)) {
|
|
|
|
|
sprintf(temp, "%u", *((unsigned char*)vp));
|
|
|
|
|
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_SHORT)) {
|
|
|
|
|
sprintf(temp, "%d", *((short*)vp));
|
1998-09-22 23:27:26 +08:00
|
|
|
|
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_USHORT)) {
|
|
|
|
|
sprintf(temp, "%u", *((unsigned short*)vp));
|
1998-09-22 23:27:26 +08:00
|
|
|
|
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_INT)) {
|
|
|
|
|
sprintf(temp, "%d", *((int*)vp));
|
1998-09-22 23:27:26 +08:00
|
|
|
|
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_UINT)) {
|
|
|
|
|
sprintf(temp, "%u", *((unsigned*)vp));
|
1998-09-22 23:27:26 +08:00
|
|
|
|
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_LONG)) {
|
|
|
|
|
sprintf(temp, "%ld", *((long*)vp));
|
1998-09-22 23:27:26 +08:00
|
|
|
|
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_ULONG)) {
|
|
|
|
|
sprintf(temp, "%lu", *((unsigned long*)vp));
|
1998-09-22 23:27:26 +08:00
|
|
|
|
|
1998-08-28 00:48:50 +08:00
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_HSSIZE)) {
|
1998-11-12 00:33:33 +08:00
|
|
|
|
if (sizeof(hssize_t)==sizeof(int)) {
|
|
|
|
|
sprintf(temp, "%d", *((int*)vp));
|
|
|
|
|
} else if (sizeof(hssize_t)==sizeof(long)) {
|
1998-08-28 00:48:50 +08:00
|
|
|
|
sprintf(temp, "%ld", *((long*)vp));
|
|
|
|
|
} else {
|
|
|
|
|
char fmt[8];
|
|
|
|
|
strcpy(fmt, "%");
|
|
|
|
|
strcat(fmt, PRINTF_LL_WIDTH);
|
|
|
|
|
strcat(fmt, "d");
|
1998-11-19 02:40:09 +08:00
|
|
|
|
sprintf(temp, fmt, *((int64_t*)vp));
|
1998-08-28 00:48:50 +08:00
|
|
|
|
}
|
1998-09-22 23:27:26 +08:00
|
|
|
|
|
1998-08-28 00:48:50 +08:00
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_HSIZE)) {
|
1998-11-12 00:33:33 +08:00
|
|
|
|
if (sizeof(hsize_t)==sizeof(int)) {
|
|
|
|
|
sprintf(temp, "%u", *((unsigned*)vp));
|
|
|
|
|
} else if (sizeof(hsize_t)==sizeof(long)) {
|
1998-08-28 00:48:50 +08:00
|
|
|
|
sprintf(temp, "%lu", *((unsigned long*)vp));
|
|
|
|
|
} else {
|
|
|
|
|
char fmt[8];
|
|
|
|
|
strcpy(fmt, "%");
|
|
|
|
|
strcat(fmt, PRINTF_LL_WIDTH);
|
|
|
|
|
strcat(fmt, "u");
|
1998-11-19 02:40:09 +08:00
|
|
|
|
sprintf(temp, fmt, *((uint64_t*)vp));
|
1998-08-28 00:48:50 +08:00
|
|
|
|
}
|
1998-09-22 23:27:26 +08:00
|
|
|
|
|
1998-07-24 22:28:32 +08:00
|
|
|
|
} else if (H5T_COMPOUND==H5Tget_class(type)) {
|
|
|
|
|
nmembs = H5Tget_nmembers(type);
|
|
|
|
|
strcpy(temp, OPT(info->cmpd_pre, "{"));
|
|
|
|
|
for (j=0; j<nmembs; j++) {
|
|
|
|
|
if (j) strcat(temp, OPT(info->cmpd_sep, ","));
|
|
|
|
|
|
|
|
|
|
/* The name */
|
|
|
|
|
name = H5Tget_member_name(type, j);
|
|
|
|
|
sprintf(temp+strlen(temp), OPT(info->cmpd_name, ""), name);
|
|
|
|
|
free(name);
|
|
|
|
|
|
|
|
|
|
/* The value */
|
|
|
|
|
offset = H5Tget_member_offset(type, j);
|
|
|
|
|
memb = H5Tget_member_type(type, j);
|
1998-07-30 00:43:59 +08:00
|
|
|
|
size = H5Tget_size(memb);
|
|
|
|
|
ndims = H5Tget_member_dims(type, j, dims, NULL);
|
1998-10-27 03:55:54 +08:00
|
|
|
|
assert(ndims>=0 && ndims<=H5S_MAX_RANK);
|
1998-07-30 00:43:59 +08:00
|
|
|
|
for (k=0, nelmts=1; k<ndims; k++) nelmts *= dims[k];
|
|
|
|
|
|
|
|
|
|
if (nelmts>1) strcat(temp, OPT(info->arr_pre, "["));
|
|
|
|
|
for (i=0; i<nelmts; i++) {
|
|
|
|
|
if (i) strcat(temp, OPT(info->arr_sep, ","));
|
|
|
|
|
h5dump_sprint(temp+strlen(temp), info, memb,
|
|
|
|
|
(char*)vp+offset+i*size);
|
|
|
|
|
}
|
|
|
|
|
if (nelmts>1) strcat(temp, OPT(info->arr_suf, "]"));
|
1998-07-24 22:28:32 +08:00
|
|
|
|
H5Tclose(memb);
|
|
|
|
|
}
|
|
|
|
|
strcat(temp, OPT(info->cmpd_suf, "}"));
|
1998-09-22 23:27:26 +08:00
|
|
|
|
|
1999-01-07 19:42:27 +08:00
|
|
|
|
} else if (H5T_ENUM==H5Tget_class(type)) {
|
|
|
|
|
if (H5Tenum_nameof(type, vp, temp, sizeof temp)<0) {
|
|
|
|
|
strcpy(temp, "0x");
|
|
|
|
|
n = H5Tget_size(type);
|
|
|
|
|
for (i=0; i<n; i++) {
|
|
|
|
|
sprintf(temp+strlen(temp), "%02x", ((unsigned char*)vp)[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
} else {
|
|
|
|
|
strcpy(temp, "0x");
|
|
|
|
|
n = H5Tget_size(type);
|
|
|
|
|
for (i=0; i<n; i++) {
|
|
|
|
|
sprintf(temp+strlen(temp), "%02x", ((unsigned char*)vp)[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sprintf(s, OPT(info->elmt_fmt, "%s"), temp);
|
1998-09-22 23:27:26 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* We should really fix this so it's not possible to overflow the `temp'
|
|
|
|
|
* buffer.
|
|
|
|
|
*/
|
|
|
|
|
assert(overflow==0xaaaaaaaa);
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1999-01-22 02:33:39 +08:00
|
|
|
|
* Function: h5dump_simple_dset
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
*
|
|
|
|
|
* Purpose: Print some values from a dataset with a simple data space.
|
1999-01-22 02:33:39 +08:00
|
|
|
|
* This is a special case of h5dump_dset().
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
*
|
|
|
|
|
* Return: Success: 0
|
|
|
|
|
*
|
|
|
|
|
* Failure: -1
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Thursday, July 23, 1998
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static int
|
1999-01-22 02:33:39 +08:00
|
|
|
|
h5dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset,
|
|
|
|
|
hid_t p_type)
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
{
|
|
|
|
|
hid_t f_space; /*file data space */
|
|
|
|
|
int ndims; /*dimensionality */
|
|
|
|
|
hsize_t elmtno, i; /*counters */
|
|
|
|
|
int carry; /*counter carry value */
|
|
|
|
|
hssize_t zero[8]; /*vector of zeros */
|
|
|
|
|
int need_prefix=1; /*indices need printing */
|
|
|
|
|
|
|
|
|
|
/* Print info */
|
1998-10-27 03:55:54 +08:00
|
|
|
|
hsize_t p_min_idx[H5S_MAX_RANK];/*min selected index */
|
|
|
|
|
hsize_t p_max_idx[H5S_MAX_RANK];/*max selected index */
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
size_t p_type_nbytes; /*size of memory type */
|
|
|
|
|
hsize_t p_nelmts; /*total selected elmts */
|
1998-09-22 23:27:26 +08:00
|
|
|
|
char p_buf[8192]; /*output string */
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
size_t p_column=0; /*output column */
|
|
|
|
|
size_t p_ncolumns=80; /*default num columns */
|
|
|
|
|
char p_prefix[1024]; /*line prefix string */
|
|
|
|
|
|
|
|
|
|
/* Stripmine info */
|
1998-10-27 03:55:54 +08:00
|
|
|
|
hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
hsize_t sm_nbytes; /*bytes per stripmine */
|
|
|
|
|
hsize_t sm_nelmts; /*elements per stripmine*/
|
1999-01-07 19:42:27 +08:00
|
|
|
|
unsigned char *sm_buf=NULL; /*buffer for raw data */
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
hid_t sm_space; /*stripmine data space */
|
|
|
|
|
|
|
|
|
|
/* Hyperslab info */
|
1998-10-27 03:55:54 +08:00
|
|
|
|
hssize_t hs_offset[H5S_MAX_RANK];/*starting offset */
|
|
|
|
|
hsize_t hs_size[H5S_MAX_RANK]; /*size this pass */
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
hsize_t hs_nelmts; /*elements in request */
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Check that everything looks okay. The dimensionality must not be too
|
|
|
|
|
* great and the dimensionality of the items selected for printing must
|
|
|
|
|
* match the dimensionality of the dataset.
|
|
|
|
|
*/
|
|
|
|
|
f_space = H5Dget_space(dset);
|
1998-09-01 11:35:23 +08:00
|
|
|
|
ndims = H5Sget_simple_extent_ndims(f_space);
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
if ((size_t)ndims>NELMTS(sm_size)) return -1;
|
|
|
|
|
|
|
|
|
|
/* Assume entire data space to be printed */
|
|
|
|
|
for (i=0; i<(hsize_t)ndims; i++) p_min_idx[i] = 0;
|
1998-09-01 11:35:23 +08:00
|
|
|
|
H5Sget_simple_extent_dims(f_space, p_max_idx, NULL);
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
for (i=0, p_nelmts=1; i<(hsize_t)ndims; i++) {
|
|
|
|
|
p_nelmts *= p_max_idx[i]-p_min_idx[i];
|
|
|
|
|
}
|
1998-08-21 06:57:35 +08:00
|
|
|
|
if (0==p_nelmts) return 0; /*nothing to print*/
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Determine the strip mine size and allocate a buffer. The strip mine is
|
|
|
|
|
* a hyperslab whose size is manageable.
|
|
|
|
|
*/
|
|
|
|
|
p_type_nbytes = H5Tget_size(p_type);
|
|
|
|
|
for (i=ndims, sm_nbytes=p_type_nbytes; i>0; --i) {
|
|
|
|
|
sm_size[i-1] = MIN (p_max_idx[i-1]-p_min_idx[i-1],
|
|
|
|
|
H5DUMP_BUFSIZE/sm_nbytes);
|
|
|
|
|
sm_nbytes *= sm_size[i-1];
|
|
|
|
|
assert(sm_nbytes>0);
|
|
|
|
|
}
|
|
|
|
|
sm_buf = malloc(sm_nbytes);
|
|
|
|
|
sm_nelmts = sm_nbytes/p_type_nbytes;
|
|
|
|
|
sm_space = H5Screate_simple(1, &sm_nelmts, NULL);
|
|
|
|
|
|
|
|
|
|
/* Local things */
|
|
|
|
|
if (info->line_ncols>0) p_ncolumns = info->line_ncols;
|
|
|
|
|
|
|
|
|
|
/* The stripmine loop */
|
|
|
|
|
memset(hs_offset, 0, sizeof hs_offset);
|
|
|
|
|
memset(zero, 0, sizeof zero);
|
|
|
|
|
for (elmtno=0; elmtno<p_nelmts; elmtno+=hs_nelmts) {
|
|
|
|
|
|
|
|
|
|
/* Calculate the hyperslab size */
|
1998-10-02 21:31:24 +08:00
|
|
|
|
if (ndims>0) {
|
|
|
|
|
for (i=0, hs_nelmts=1; i<(hsize_t)ndims; i++) {
|
|
|
|
|
hs_size[i] = MIN(sm_size[i], p_max_idx[i]-hs_offset[i]);
|
|
|
|
|
hs_nelmts *= hs_size[i];
|
|
|
|
|
}
|
|
|
|
|
H5Sselect_hyperslab(f_space, H5S_SELECT_SET, hs_offset, NULL,
|
|
|
|
|
hs_size, NULL);
|
|
|
|
|
H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL,
|
|
|
|
|
&hs_nelmts, NULL);
|
|
|
|
|
} else {
|
|
|
|
|
H5Sselect_all(f_space);
|
|
|
|
|
H5Sselect_all(sm_space);
|
|
|
|
|
hs_nelmts = 1;
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Read the data */
|
1998-08-06 06:22:59 +08:00
|
|
|
|
if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf)<0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
/* Print the data */
|
|
|
|
|
for (i=0; i<hs_nelmts; i++) {
|
|
|
|
|
/* Render the element */
|
|
|
|
|
h5dump_sprint(p_buf, info, p_type, sm_buf+i*p_type_nbytes);
|
1998-07-24 22:28:32 +08:00
|
|
|
|
if (elmtno+i+1<p_nelmts) {
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
strcat(p_buf, OPT(info->elmt_suf1, ","));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Print the prefix */
|
|
|
|
|
if ((p_column +
|
|
|
|
|
strlen(p_buf) +
|
|
|
|
|
strlen(OPT(info->elmt_suf2, " ")) +
|
|
|
|
|
strlen(OPT(info->line_suf, ""))) > p_ncolumns) {
|
|
|
|
|
need_prefix = 1;
|
|
|
|
|
}
|
|
|
|
|
if (need_prefix) {
|
|
|
|
|
h5dump_prefix(p_prefix, info, elmtno+i, ndims,
|
|
|
|
|
p_min_idx, p_max_idx);
|
|
|
|
|
if (p_column) {
|
|
|
|
|
fputs(OPT(info->line_suf, ""), stream);
|
|
|
|
|
putc('\n', stream);
|
|
|
|
|
fputs(OPT(info->line_sep, ""), stream);
|
|
|
|
|
}
|
|
|
|
|
fputs(p_prefix, stream);
|
|
|
|
|
p_column = strlen(p_prefix);
|
|
|
|
|
need_prefix = 0;
|
|
|
|
|
} else {
|
|
|
|
|
fputs(OPT(info->elmt_suf2, " "), stream);
|
|
|
|
|
p_column += strlen(OPT(info->elmt_suf2, " "));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fputs(p_buf, stream);
|
|
|
|
|
p_column += strlen(p_buf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Calculate the next hyperslab offset */
|
|
|
|
|
for (i=ndims, carry=1; i>0 && carry; --i) {
|
|
|
|
|
hs_offset[i-1] += hs_size[i-1];
|
|
|
|
|
if (hs_offset[i-1]==(hssize_t)p_max_idx[i-1]) {
|
|
|
|
|
hs_offset[i-1] = p_min_idx[i-1];
|
|
|
|
|
} else {
|
|
|
|
|
carry = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (p_column) {
|
|
|
|
|
fputs(OPT(info->line_suf, ""), stream);
|
|
|
|
|
putc('\n', stream);
|
|
|
|
|
fputs(OPT(info->line_sep, ""), stream);
|
|
|
|
|
}
|
|
|
|
|
H5Sclose(sm_space);
|
|
|
|
|
H5Sclose(f_space);
|
1999-01-07 19:42:27 +08:00
|
|
|
|
if (sm_buf) free(sm_buf);
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
1999-01-22 02:33:39 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: h5dump_simple_mem
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Print some values from memory with a simple data space.
|
|
|
|
|
* This is a special case of h5dump_mem().
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: 0
|
|
|
|
|
*
|
|
|
|
|
* Failure: -1
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Thursday, July 23, 1998
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static int
|
|
|
|
|
h5dump_simple_mem(FILE *stream, const h5dump_t *info, hid_t type,
|
|
|
|
|
hid_t space, void *_mem)
|
|
|
|
|
{
|
|
|
|
|
unsigned char *mem = (unsigned char*)_mem;
|
|
|
|
|
int ndims; /*dimensionality */
|
|
|
|
|
hsize_t i; /*counters */
|
|
|
|
|
int need_prefix=1; /*indices need printing */
|
|
|
|
|
|
|
|
|
|
/* Print info */
|
|
|
|
|
hsize_t p_min_idx[H5S_MAX_RANK];/*min selected index */
|
|
|
|
|
hsize_t p_max_idx[H5S_MAX_RANK];/*max selected index */
|
|
|
|
|
size_t p_type_nbytes; /*size of memory type */
|
|
|
|
|
hsize_t p_nelmts; /*total selected elmts */
|
|
|
|
|
char p_buf[8192]; /*output string */
|
|
|
|
|
size_t p_column=0; /*output column */
|
|
|
|
|
size_t p_ncolumns=80; /*default num columns */
|
|
|
|
|
char p_prefix[1024]; /*line prefix string */
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Check that everything looks okay. The dimensionality must not be too
|
|
|
|
|
* great and the dimensionality of the items selected for printing must
|
|
|
|
|
* match the dimensionality of the dataset.
|
|
|
|
|
*/
|
|
|
|
|
ndims = H5Sget_simple_extent_ndims(space);
|
|
|
|
|
if ((size_t)ndims>NELMTS(p_min_idx)) return -1;
|
|
|
|
|
|
|
|
|
|
/* Assume entire data space to be printed */
|
|
|
|
|
for (i=0; i<(hsize_t)ndims; i++) p_min_idx[i] = 0;
|
|
|
|
|
H5Sget_simple_extent_dims(space, p_max_idx, NULL);
|
|
|
|
|
for (i=0, p_nelmts=1; i<(hsize_t)ndims; i++) {
|
|
|
|
|
p_nelmts *= p_max_idx[i]-p_min_idx[i];
|
|
|
|
|
}
|
|
|
|
|
if (0==p_nelmts) return 0; /*nothing to print*/
|
|
|
|
|
p_type_nbytes = H5Tget_size(type);
|
|
|
|
|
|
|
|
|
|
/* Local things */
|
|
|
|
|
if (info->line_ncols>0) p_ncolumns = info->line_ncols;
|
|
|
|
|
|
|
|
|
|
for (i=0; i<p_nelmts; i++) {
|
|
|
|
|
/* Render the element */
|
|
|
|
|
h5dump_sprint(p_buf, info, type, mem+i*p_type_nbytes);
|
|
|
|
|
if (i+1<p_nelmts) {
|
|
|
|
|
strcat(p_buf, OPT(info->elmt_suf1, ","));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Print the prefix */
|
|
|
|
|
if ((p_column +
|
|
|
|
|
strlen(p_buf) +
|
|
|
|
|
strlen(OPT(info->elmt_suf2, " ")) +
|
|
|
|
|
strlen(OPT(info->line_suf, ""))) > p_ncolumns) {
|
|
|
|
|
need_prefix = 1;
|
|
|
|
|
}
|
|
|
|
|
if (need_prefix) {
|
|
|
|
|
h5dump_prefix(p_prefix, info, i, ndims, p_min_idx, p_max_idx);
|
|
|
|
|
if (p_column) {
|
|
|
|
|
fputs(OPT(info->line_suf, ""), stream);
|
|
|
|
|
putc('\n', stream);
|
|
|
|
|
fputs(OPT(info->line_sep, ""), stream);
|
|
|
|
|
}
|
|
|
|
|
fputs(p_prefix, stream);
|
|
|
|
|
p_column = strlen(p_prefix);
|
|
|
|
|
need_prefix = 0;
|
|
|
|
|
} else {
|
|
|
|
|
fputs(OPT(info->elmt_suf2, " "), stream);
|
|
|
|
|
p_column += strlen(OPT(info->elmt_suf2, " "));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fputs(p_buf, stream);
|
|
|
|
|
p_column += strlen(p_buf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (p_column) {
|
|
|
|
|
fputs(OPT(info->line_suf, ""), stream);
|
|
|
|
|
putc('\n', stream);
|
|
|
|
|
fputs(OPT(info->line_sep, ""), stream);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
1998-07-24 22:28:32 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: h5dump_fixtype
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Given a file data type choose a memory data type which is
|
|
|
|
|
* appropriate for printing the data.
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: Memory data type
|
|
|
|
|
*
|
|
|
|
|
* Failure: FAIL
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Thursday, July 23, 1998
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
1999-01-22 02:33:39 +08:00
|
|
|
|
hid_t
|
1998-07-24 22:28:32 +08:00
|
|
|
|
h5dump_fixtype(hid_t f_type)
|
|
|
|
|
{
|
|
|
|
|
hid_t m_type=-1, f_memb;
|
|
|
|
|
hid_t *memb=NULL;
|
|
|
|
|
char **name=NULL;
|
1998-08-06 06:22:59 +08:00
|
|
|
|
int nmembs=0, i, j, *ndims=NULL;
|
1998-07-30 00:43:59 +08:00
|
|
|
|
size_t size, offset, *dims=NULL, nelmts;
|
1998-07-24 22:28:32 +08:00
|
|
|
|
|
|
|
|
|
size = H5Tget_size(f_type);
|
|
|
|
|
switch (H5Tget_class(f_type)) {
|
|
|
|
|
|
|
|
|
|
case H5T_INTEGER:
|
|
|
|
|
/*
|
|
|
|
|
* Use the smallest native integer type of the same sign as the file
|
|
|
|
|
* such that the memory type is at least as large as the file type.
|
|
|
|
|
* If there is no memory type large enough then use the largest
|
|
|
|
|
* memory type available.
|
|
|
|
|
*/
|
|
|
|
|
if (size<=sizeof(char)) {
|
1998-11-26 01:21:21 +08:00
|
|
|
|
m_type = H5Tcopy(H5T_NATIVE_SCHAR);
|
1998-07-24 22:28:32 +08:00
|
|
|
|
} else if (size<=sizeof(short)) {
|
|
|
|
|
m_type = H5Tcopy(H5T_NATIVE_SHORT);
|
|
|
|
|
} else if (size<=sizeof(int)) {
|
|
|
|
|
m_type = H5Tcopy(H5T_NATIVE_INT);
|
|
|
|
|
} else if (size<=sizeof(long)) {
|
|
|
|
|
m_type = H5Tcopy(H5T_NATIVE_LONG);
|
|
|
|
|
} else {
|
|
|
|
|
m_type = H5Tcopy(H5T_NATIVE_LLONG);
|
|
|
|
|
}
|
1998-07-30 00:43:59 +08:00
|
|
|
|
H5Tset_sign(m_type, H5Tget_sign(f_type));
|
1998-07-24 22:28:32 +08:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case H5T_FLOAT:
|
|
|
|
|
/*
|
|
|
|
|
* Use the smallest native floating point type available such that
|
|
|
|
|
* its size is at least as large as the file type. If there is not
|
|
|
|
|
* native type large enough then use the largest native type.
|
|
|
|
|
*/
|
|
|
|
|
if (size<=sizeof(float)) {
|
|
|
|
|
m_type = H5Tcopy(H5T_NATIVE_FLOAT);
|
|
|
|
|
} else if (size<=sizeof(double)) {
|
|
|
|
|
m_type = H5Tcopy(H5T_NATIVE_DOUBLE);
|
|
|
|
|
} else {
|
|
|
|
|
m_type = H5Tcopy(H5T_NATIVE_LDOUBLE);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
1998-09-22 23:27:26 +08:00
|
|
|
|
case H5T_STRING:
|
|
|
|
|
m_type = H5Tcopy(f_type);
|
|
|
|
|
H5Tset_cset(m_type, H5T_CSET_ASCII);
|
|
|
|
|
break;
|
|
|
|
|
|
1998-07-24 22:28:32 +08:00
|
|
|
|
case H5T_COMPOUND:
|
1998-07-30 00:43:59 +08:00
|
|
|
|
/*
|
|
|
|
|
* We have to do this in two steps. The first step scans the file
|
|
|
|
|
* type and converts the members to native types and remembers all
|
|
|
|
|
* their names and sizes, computing the size of the memory compound
|
|
|
|
|
* type at the same time. Then we create the memory compound type
|
|
|
|
|
* and add the members.
|
|
|
|
|
*/
|
1998-07-24 22:28:32 +08:00
|
|
|
|
nmembs = H5Tget_nmembers(f_type);
|
|
|
|
|
memb = calloc(nmembs, sizeof(hid_t));
|
|
|
|
|
name = calloc(nmembs, sizeof(char*));
|
1998-07-30 00:43:59 +08:00
|
|
|
|
ndims = calloc(nmembs, sizeof(int));
|
|
|
|
|
dims = calloc(nmembs*4, sizeof(size_t));
|
1998-07-24 22:28:32 +08:00
|
|
|
|
|
|
|
|
|
for (i=0, size=0; i<nmembs; i++) {
|
1998-07-30 00:43:59 +08:00
|
|
|
|
|
|
|
|
|
/* Get the member type and fix it */
|
1998-07-24 22:28:32 +08:00
|
|
|
|
f_memb = H5Tget_member_type(f_type, i);
|
|
|
|
|
memb[i] = h5dump_fixtype(f_memb);
|
|
|
|
|
H5Tclose(f_memb);
|
1998-07-30 00:43:59 +08:00
|
|
|
|
if (memb[i]<0) goto done;
|
|
|
|
|
|
|
|
|
|
/* Get the member dimensions */
|
|
|
|
|
ndims[i] = H5Tget_member_dims(f_type, i, dims+i*4, NULL);
|
|
|
|
|
assert(ndims[i]>=0 && ndims[i]<=4);
|
|
|
|
|
for (j=0, nelmts=1; j<ndims[i]; j++) nelmts *= dims[i*4+j];
|
|
|
|
|
|
|
|
|
|
/* Get the member name */
|
1998-07-24 22:28:32 +08:00
|
|
|
|
name[i] = H5Tget_member_name(f_type, i);
|
1998-07-30 00:43:59 +08:00
|
|
|
|
if (NULL==name[i]) goto done;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Compute the new offset so each member is aligned on a byte
|
|
|
|
|
* boundary which is the same as the member size.
|
|
|
|
|
*/
|
|
|
|
|
size = ALIGN(size, H5Tget_size(memb[i])) +
|
|
|
|
|
nelmts * H5Tget_size(memb[i]);
|
1998-07-24 22:28:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_type = H5Tcreate(H5T_COMPOUND, size);
|
1998-07-30 00:43:59 +08:00
|
|
|
|
for (i=0, offset=0; i<nmembs; i++) {
|
|
|
|
|
H5Tinsert_array(m_type, name[i], offset, ndims[i], dims+i*4,
|
|
|
|
|
NULL, memb[i]);
|
|
|
|
|
for (j=0, nelmts=1; j<ndims[i]; j++) nelmts *= dims[i*4+j];
|
|
|
|
|
offset = ALIGN(offset, H5Tget_size(memb[i])) +
|
|
|
|
|
nelmts * H5Tget_size(memb[i]);
|
1998-07-24 22:28:32 +08:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
1999-01-07 19:42:27 +08:00
|
|
|
|
case H5T_ENUM:
|
|
|
|
|
m_type = H5Tcopy(f_type);
|
|
|
|
|
break;
|
|
|
|
|
|
1998-07-24 22:28:32 +08:00
|
|
|
|
case H5T_TIME:
|
|
|
|
|
case H5T_BITFIELD:
|
|
|
|
|
case H5T_OPAQUE:
|
|
|
|
|
/*
|
|
|
|
|
* These type classes are not implemented yet.
|
|
|
|
|
*/
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
/* What the heck? */
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
/* Clean up temp buffers */
|
1998-07-30 00:43:59 +08:00
|
|
|
|
if (memb && name && ndims && dims) {
|
1998-07-24 22:28:32 +08:00
|
|
|
|
for (i=0; i<nmembs; i++) {
|
|
|
|
|
if (memb[i]>=0) H5Tclose(memb[i]);
|
|
|
|
|
if (name[i]) free(name[i]);
|
|
|
|
|
}
|
|
|
|
|
free(memb);
|
|
|
|
|
free(name);
|
1998-07-30 00:43:59 +08:00
|
|
|
|
free(ndims);
|
|
|
|
|
free(dims);
|
1998-07-24 22:28:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return m_type;
|
|
|
|
|
}
|
|
|
|
|
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1999-01-22 02:33:39 +08:00
|
|
|
|
* Function: h5dump_dset
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
*
|
1998-07-30 00:43:59 +08:00
|
|
|
|
* Purpose: Print some values from a dataset DSET to the file STREAM
|
|
|
|
|
* after converting all types to P_TYPE (which should be a
|
|
|
|
|
* native type). If P_TYPE is a negative value then it will be
|
|
|
|
|
* computed from the dataset type using only native types.
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
*
|
|
|
|
|
* Return: Success: 0
|
|
|
|
|
*
|
|
|
|
|
* Failure: -1
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Thursday, July 23, 1998
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
int
|
1999-01-22 02:33:39 +08:00
|
|
|
|
h5dump_dset(FILE *stream, const h5dump_t *info, hid_t dset, hid_t _p_type)
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
{
|
|
|
|
|
hid_t f_space;
|
1998-07-24 22:28:32 +08:00
|
|
|
|
hid_t p_type = _p_type;
|
|
|
|
|
hid_t f_type;
|
|
|
|
|
int status;
|
1998-07-30 00:43:59 +08:00
|
|
|
|
h5dump_t info_dflt;
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
|
1998-07-30 00:43:59 +08:00
|
|
|
|
/* Use default values */
|
|
|
|
|
if (!stream) stream = stdout;
|
|
|
|
|
if (!info) {
|
|
|
|
|
memset(&info_dflt, 0, sizeof info_dflt);
|
|
|
|
|
info = &info_dflt;
|
|
|
|
|
}
|
1998-07-24 22:28:32 +08:00
|
|
|
|
if (p_type<0) {
|
|
|
|
|
f_type = H5Dget_type(dset);
|
|
|
|
|
p_type = h5dump_fixtype(f_type);
|
|
|
|
|
H5Tclose(f_type);
|
|
|
|
|
if (p_type<0) return -1;
|
|
|
|
|
}
|
|
|
|
|
|
1998-07-30 00:43:59 +08:00
|
|
|
|
/* Check the data space */
|
|
|
|
|
f_space = H5Dget_space(dset);
|
|
|
|
|
if (H5Sis_simple(f_space)<=0) return -1;
|
|
|
|
|
H5Sclose(f_space);
|
|
|
|
|
|
1998-07-24 22:28:32 +08:00
|
|
|
|
/* Print the data */
|
1999-01-22 02:33:39 +08:00
|
|
|
|
status = h5dump_simple_dset(stream, info, dset, p_type);
|
1998-07-24 22:28:32 +08:00
|
|
|
|
if (p_type!=_p_type) H5Tclose(p_type);
|
|
|
|
|
return status;
|
[svn-r537] Changes since 19980722
----------------------
./src/H5A.c
./src/H5Apublic.h
./test/tattr.c
Switched the order of the second and third argument of
H5Aget_name() to make it consistent with other functions that
take buffers and buffer sizes.
./src/H5G.c
./src/H5Gpublic.h
./src/H5Gprivate.h
The H5Gget_comment() function returns the size of the comment
including the null terminator. If the object has no comment
then zero is returned. If an error occurs then a negative
value is returned.
./MANIFEST
./tools/Makefile.in
./tools/h5tools.h [NEW]
./tools/h5dump.c [NEW]
Created a library for printing values of datasets in a way
that looks nice. It's not done yet, but I needed it for
debugging the contents of files from Jim Reus.
./tools/h5ls.c
Added the `-d' and `--dump' options which cause the contents
of a dataset to be printed. Added `-w N' and `--width=N'
options to control how wide the raw data output should be. If
you want single-column output then say `-w1'.
Printing dataset values can now handle datasets of any integer
or floating point atomic type. As a special case, integers
which are one byte wide are treated a character strings for
now.
Sample output:
$ h5ls --dump --width=60 banana.hdf
ARCHIVE 0:0:0:744 Dataset {52/Inf}
Data:
(0) "U struct complex { double R; double I; };\012V"
(43) " double;\012"
U 0:0:0:2500 Dataset {256/512}
Data: printing of compound data types is not implemented yet
V 0:0:0:3928 Dataset {256/512}
Data:
(0) 0, 0.015625, 0.03125, 0.046875, 0.0625,
(5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625,
(10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875,
(15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875,
...
1998-07-24 05:19:17 +08:00
|
|
|
|
}
|
1999-01-22 02:33:39 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: h5dump_mem
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Displays the data contained in MEM. MEM must have the
|
|
|
|
|
* specified data TYPE and SPACE. Currently only simple data
|
|
|
|
|
* spaces are allowed and only the `all' selection.
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: 0
|
|
|
|
|
*
|
|
|
|
|
* Failure: -1
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Wednesday, January 20, 1999
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
h5dump_mem(FILE *stream, const h5dump_t *info, hid_t type, hid_t space,
|
|
|
|
|
void *mem)
|
|
|
|
|
{
|
|
|
|
|
h5dump_t info_dflt;
|
|
|
|
|
|
|
|
|
|
/* Use default values */
|
|
|
|
|
if (!stream) stream = stdout;
|
|
|
|
|
if (!info) {
|
|
|
|
|
memset(&info_dflt, 0, sizeof info_dflt);
|
|
|
|
|
info = &info_dflt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Check the data space */
|
|
|
|
|
if (H5Sis_simple(space)<=0) return -1;
|
|
|
|
|
return h5dump_simple_mem(stream, info, type, space, mem);
|
|
|
|
|
}
|