[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 <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
2000-10-26 03:07:05 +08:00
|
|
|
|
|
|
|
|
|
#include "h5tools.h"
|
|
|
|
|
#include "hdf5.h"
|
|
|
|
|
#include "H5private.h"
|
|
|
|
|
#include "h5dump.h"
|
1999-05-13 23:18:12 +08:00
|
|
|
|
|
2000-08-05 06:17:23 +08:00
|
|
|
|
/* taken from h5dumputil.c */
|
1999-05-13 23:18:12 +08:00
|
|
|
|
|
2000-10-26 03:07:05 +08:00
|
|
|
|
int indent;
|
|
|
|
|
int compound_data;
|
1999-06-04 23:49:55 +08:00
|
|
|
|
int nCols = 80;
|
2000-10-26 03:07:05 +08:00
|
|
|
|
FILE *rawdatastream; /* should initialize to stdout but gcc moans about it */
|
2000-02-15 23:45:35 +08:00
|
|
|
|
|
2000-11-02 12:59:51 +08:00
|
|
|
|
static int h5tools_init_g = 0; /* if h5tools lib has been initialized */
|
|
|
|
|
|
1999-09-25 23:32:04 +08:00
|
|
|
|
int print_data(hid_t oid, hid_t _p_type, int obj_data);
|
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
/*
|
|
|
|
|
* If REPEAT_VERBOSE is defined then character strings will be printed so
|
|
|
|
|
* that repeated character sequences like "AAAAAAAAAA" are displayed as
|
|
|
|
|
*
|
|
|
|
|
* 'A' repeates 9 times
|
|
|
|
|
*
|
|
|
|
|
* Otherwise the format is more Perl-like
|
|
|
|
|
*
|
|
|
|
|
* 'A'*10
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
#define REPEAT_VERBOSE
|
|
|
|
|
|
[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
|
2000-10-26 03:07:05 +08:00
|
|
|
|
#define H5DUMP_BUFSIZE (1024 * 1024)
|
1998-08-21 06:57:35 +08:00
|
|
|
|
#else
|
2000-10-26 03:07:05 +08:00
|
|
|
|
#define H5DUMP_BUFSIZE (1024)
|
1998-08-21 06:57:35 +08:00
|
|
|
|
#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
|
|
|
|
|
2000-10-26 03:07:05 +08:00
|
|
|
|
#define OPT(X,S) ((X) ? (X) : (S))
|
|
|
|
|
#define ALIGN(A,Z) ((((A) + (Z) - 1) / (Z)) * (Z))
|
|
|
|
|
#define START_OF_DATA 0x0001
|
|
|
|
|
#define END_OF_DATA 0x0002
|
1999-04-27 22:47:54 +08:00
|
|
|
|
|
2000-01-07 01:32:16 +08:00
|
|
|
|
/* Special strings embedded in the output */
|
|
|
|
|
#define OPTIONAL_LINE_BREAK "\001"
|
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
/* Variable length string datatype */
|
2000-10-26 03:07:05 +08:00
|
|
|
|
#define STR_INIT_LEN 4096 /*initial length */
|
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
typedef struct h5dump_str_t {
|
2000-10-26 03:07:05 +08:00
|
|
|
|
char *s; /*allocate string */
|
|
|
|
|
size_t len; /*length of actual value */
|
|
|
|
|
size_t nalloc; /*allocated size of string */
|
1999-04-27 22:47:54 +08:00
|
|
|
|
} h5dump_str_t;
|
|
|
|
|
|
|
|
|
|
/* Output variables */
|
|
|
|
|
typedef struct h5dump_context_t {
|
2000-10-26 03:07:05 +08:00
|
|
|
|
size_t cur_column; /*current column for output */
|
|
|
|
|
size_t cur_elmt; /*current element/output line */
|
|
|
|
|
int need_prefix; /*is line prefix needed? */
|
|
|
|
|
int ndims; /*dimensionality */
|
|
|
|
|
hsize_t p_min_idx[H5S_MAX_RANK]; /*min selected index */
|
|
|
|
|
hsize_t p_max_idx[H5S_MAX_RANK]; /*max selected index */
|
|
|
|
|
int prev_multiline; /*was prev datum multiline? */
|
|
|
|
|
size_t prev_prefix_len;/*length of previous prefix */
|
|
|
|
|
int continuation; /*continuation of previous data?*/
|
|
|
|
|
int size_last_dim; /*the size of the last dimension,
|
|
|
|
|
*needed so we can break after each
|
|
|
|
|
*row */
|
|
|
|
|
int indent_level; /*the number of times we need some
|
|
|
|
|
*extra indentation */
|
|
|
|
|
int default_indent_level; /*this is used when the indent
|
|
|
|
|
*level gets changed */
|
1999-04-27 22:47:54 +08:00
|
|
|
|
} h5dump_context_t;
|
2000-01-07 01:32:16 +08:00
|
|
|
|
|
|
|
|
|
typedef herr_t (*H5G_operator_t)(hid_t, const char*, void*);
|
|
|
|
|
|
|
|
|
|
extern void init_prefix(char **temp, int length);
|
|
|
|
|
extern void init_table(table_t **table);
|
|
|
|
|
extern void free_table(table_t **table);
|
|
|
|
|
extern void dump_table(char *name, table_t* table);
|
|
|
|
|
extern herr_t find_objs(hid_t group, const char *name, void *op_data);
|
|
|
|
|
extern int search_obj (table_t *temp, unsigned long *);
|
|
|
|
|
extern int get_table_idx(table_t *table, unsigned long *);
|
|
|
|
|
extern int get_tableflag(table_t*, int);
|
|
|
|
|
extern int set_tableflag(table_t*, int);
|
2000-10-26 03:07:05 +08:00
|
|
|
|
extern char *get_objectname(table_t*, int);
|
|
|
|
|
|
|
|
|
|
/* local functions */
|
|
|
|
|
static int h5dump_vlen_dset(FILE *, const h5dump_t *, hid_t, hid_t, int);
|
2000-06-24 01:52:21 +08:00
|
|
|
|
|
2000-11-02 12:59:51 +08:00
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: h5tools_init
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Initialize the H5 Tools library.
|
|
|
|
|
* This should be called before any other h5tools function is
|
|
|
|
|
* called. Effect of any h5tools function called before this
|
|
|
|
|
* has been called is undetermined.
|
|
|
|
|
*
|
|
|
|
|
* Return: None
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Albert Cheng, 2000-10-31
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
h5tools_init(void)
|
|
|
|
|
{
|
|
|
|
|
if (!h5tools_init_g){
|
|
|
|
|
if (!rawdatastream)
|
|
|
|
|
rawdatastream = stdout;
|
|
|
|
|
h5tools_init_g++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: h5tools_close
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Close the H5 Tools library by closing or releasing resources
|
|
|
|
|
* such as files opened by the library.
|
|
|
|
|
* This should be called after all other h5tools functions have
|
|
|
|
|
* been called. Effect of any h5tools function called after this
|
|
|
|
|
* has been called is undetermined.
|
|
|
|
|
*
|
|
|
|
|
* Return: None
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Albert Cheng, 2000-10-31
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
h5tools_close(void)
|
|
|
|
|
{
|
|
|
|
|
if (h5tools_init_g){
|
|
|
|
|
if (rawdatastream && rawdatastream != stdout){
|
|
|
|
|
if (fclose(rawdatastream))
|
|
|
|
|
perror("closing rawdatastream");
|
|
|
|
|
else
|
|
|
|
|
rawdatastream = NULL;
|
|
|
|
|
}
|
|
|
|
|
h5tools_init_g = 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
|
|
|
|
/*-------------------------------------------------------------------------
|
1999-04-27 22:47:54 +08:00
|
|
|
|
* Function: h5dump_str_close
|
[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-04-27 22:47:54 +08:00
|
|
|
|
* Purpose: Closes a string by releasing it's memory and setting the size
|
|
|
|
|
* information to zero.
|
[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: void
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
1999-04-27 22:47:54 +08:00
|
|
|
|
* Monday, April 26, 1999
|
[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
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static void
|
1999-04-27 22:47:54 +08:00
|
|
|
|
h5dump_str_close(h5dump_str_t *str)
|
|
|
|
|
{
|
|
|
|
|
if (str && str->nalloc) {
|
|
|
|
|
free(str->s);
|
|
|
|
|
memset(str, 0, sizeof(h5dump_str_t));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: h5dump_str_len
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Returns the length of the string, not counting the null
|
|
|
|
|
* terminator.
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: Length of string
|
|
|
|
|
*
|
|
|
|
|
* Failure: 0
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Monday, April 26, 1999
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static size_t
|
|
|
|
|
h5dump_str_len(h5dump_str_t *str)
|
|
|
|
|
{
|
|
|
|
|
return str->len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: h5dump_str_append
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Formats variable arguments according to printf() format
|
|
|
|
|
* string and appends the result to variable length string STR.
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: Pointer to buffer containing result.
|
|
|
|
|
*
|
|
|
|
|
* Failure: NULL
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Monday, April 26, 1999
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static char *
|
|
|
|
|
h5dump_str_append(h5dump_str_t *str/*in,out*/, const char *fmt, ...)
|
|
|
|
|
{
|
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
|
|
va_start(ap, fmt);
|
|
|
|
|
|
|
|
|
|
/* Make sure we have some memory into which to print */
|
2000-10-26 03:07:05 +08:00
|
|
|
|
if (!str->s || str->nalloc <= 0) {
|
1999-04-27 22:47:54 +08:00
|
|
|
|
str->nalloc = STR_INIT_LEN;
|
|
|
|
|
str->s = malloc(str->nalloc);
|
|
|
|
|
assert(str->s);
|
|
|
|
|
str->s[0] = '\0';
|
|
|
|
|
str->len = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
|
size_t avail = str->nalloc - str->len;
|
|
|
|
|
size_t nchars = HDvsnprintf(str->s+str->len, avail, fmt, ap);
|
2000-10-26 03:07:05 +08:00
|
|
|
|
|
|
|
|
|
if (nchars < avail) {
|
1999-04-27 22:47:54 +08:00
|
|
|
|
/* success */
|
|
|
|
|
str->len += nchars;
|
|
|
|
|
break;
|
|
|
|
|
}
|
1999-06-09 00:46:41 +08:00
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
/* Try again with twice as much space */
|
|
|
|
|
str->nalloc *= 2;
|
|
|
|
|
str->s = realloc(str->s, str->nalloc);
|
|
|
|
|
assert(str->s);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
va_end(ap);
|
|
|
|
|
return str->s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: h5dump_str_reset
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Reset the string to the empty value. If no memory is
|
|
|
|
|
* allocated yet then initialize the h5dump_str_t struct.
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: Ptr to the buffer which contains a null
|
|
|
|
|
* character as the first element.
|
|
|
|
|
*
|
|
|
|
|
* Failure: NULL
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Monday, April 26, 1999
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static char *
|
|
|
|
|
h5dump_str_reset(h5dump_str_t *str/*in,out*/)
|
|
|
|
|
{
|
2000-10-26 03:07:05 +08:00
|
|
|
|
if (!str->s || str->nalloc <= 0) {
|
1999-04-27 22:47:54 +08:00
|
|
|
|
str->nalloc = STR_INIT_LEN;
|
|
|
|
|
str->s = malloc(str->nalloc);
|
|
|
|
|
assert(str->s);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
str->s[0] = '\0';
|
|
|
|
|
str->len = 0;
|
|
|
|
|
return str->s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: h5dump_str_trunc
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Truncate a string to be at most SIZE characters.
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: Pointer to the string
|
|
|
|
|
*
|
|
|
|
|
* Failure: NULL
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Monday, April 26, 1999
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static char *
|
|
|
|
|
h5dump_str_trunc(h5dump_str_t *str/*in,out*/, size_t size)
|
|
|
|
|
{
|
2000-10-26 03:07:05 +08:00
|
|
|
|
if (size < str->len) {
|
1999-04-27 22:47:54 +08:00
|
|
|
|
str->len = size;
|
|
|
|
|
str->s[size] = '\0';
|
|
|
|
|
}
|
2000-10-26 03:07:05 +08:00
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
return str->s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: h5dump_str_fmt
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Reformat a string contents beginning at character START
|
|
|
|
|
* according to printf format FMT. FMT should contain no format
|
|
|
|
|
* specifiers except possibly the `%s' variety. For example, if
|
|
|
|
|
* the input string is `hello' and the format is "<<%s>>" then
|
|
|
|
|
* the output value will be "<<hello>>".
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: A pointer to the resulting string.
|
|
|
|
|
*
|
|
|
|
|
* Failure: NULL
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Monday, April 26, 1999
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static char *
|
|
|
|
|
h5dump_str_fmt(h5dump_str_t *str/*in,out*/, size_t start, const char *fmt)
|
|
|
|
|
{
|
2000-10-26 03:07:05 +08:00
|
|
|
|
char _temp[1024], *temp = _temp;
|
1999-04-27 22:47:54 +08:00
|
|
|
|
|
|
|
|
|
/* If the format string is simply "%s" then don't bother doing anything */
|
2000-10-26 03:07:05 +08:00
|
|
|
|
if (!strcmp(fmt, "%s"))
|
|
|
|
|
return str->s;
|
1999-04-27 22:47:54 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Save the input value if there is a `%' anywhere in FMT. Otherwise
|
|
|
|
|
* don't bother because we don't need a temporary copy.
|
|
|
|
|
*/
|
|
|
|
|
if (strchr(fmt, '%')) {
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (str->len - start + 1 > sizeof(_temp)) {
|
2000-10-26 03:07:05 +08:00
|
|
|
|
temp = malloc(str->len-start + 1);
|
1999-04-27 22:47:54 +08:00
|
|
|
|
assert(temp);
|
|
|
|
|
}
|
2000-10-26 03:07:05 +08:00
|
|
|
|
|
|
|
|
|
strcpy(temp, str->s + start);
|
1999-04-27 22:47:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Reset the output string and append a formatted version */
|
|
|
|
|
h5dump_str_trunc(str, start);
|
|
|
|
|
h5dump_str_append(str, fmt, temp);
|
|
|
|
|
|
|
|
|
|
/* Free the temp buffer if we allocated one */
|
2000-10-26 03:07:05 +08:00
|
|
|
|
if (temp != _temp)
|
|
|
|
|
free(temp);
|
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
return str->s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: h5dump_prefix
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Renders the line prefix value into string STR.
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: Pointer to the prefix.
|
|
|
|
|
*
|
|
|
|
|
* Failure: NULL
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Thursday, July 23, 1998
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static char *
|
|
|
|
|
h5dump_prefix(h5dump_str_t *str/*in,out*/, const h5dump_t *info,
|
|
|
|
|
hsize_t elmtno, int ndims, hsize_t min_idx[], hsize_t max_idx[])
|
[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
|
|
|
|
{
|
2000-10-26 03:07:05 +08:00
|
|
|
|
hsize_t p_prod[H5S_MAX_RANK], p_idx[H5S_MAX_RANK];
|
|
|
|
|
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
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
h5dump_str_reset(str);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
2000-10-26 03:07:05 +08:00
|
|
|
|
if (ndims > 0) {
|
1998-10-02 21:31:24 +08:00
|
|
|
|
/*
|
|
|
|
|
* Calculate the number of elements represented by a unit change in a
|
|
|
|
|
* certain index position.
|
|
|
|
|
*/
|
2000-10-26 03:07:05 +08:00
|
|
|
|
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];
|
1998-10-02 21:31:24 +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
|
|
|
|
|
1998-10-02 21:31:24 +08:00
|
|
|
|
/*
|
|
|
|
|
* Calculate the index values from the element number.
|
|
|
|
|
*/
|
2000-10-26 03:07:05 +08:00
|
|
|
|
for (i = 0, n = elmtno; i < (hsize_t)ndims; i++) {
|
1998-10-02 21:31:24 +08:00
|
|
|
|
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.
|
|
|
|
|
*/
|
2000-10-26 03:07:05 +08:00
|
|
|
|
for (i = 0; i < (hsize_t)ndims; i++) {
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (i)
|
|
|
|
|
h5dump_str_append(str, "%s", OPT(info->idx_sep, ","));
|
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
h5dump_str_append(str, OPT(info->idx_n_fmt, "%lu"),
|
|
|
|
|
(unsigned long)p_idx[i]);
|
1998-10-02 21:31:24 +08:00
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
/* Scalar */
|
1999-04-27 22:47:54 +08:00
|
|
|
|
h5dump_str_append(str, 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.
|
|
|
|
|
*/
|
1999-04-27 22:47:54 +08:00
|
|
|
|
return h5dump_str_fmt(str, 0, OPT(info->idx_fmt, "%s: "));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: h5dump_escape
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Changes all "funny" characters in S into standard C escape
|
|
|
|
|
* sequences. If ESCAPE_SPACES is non-zero then spaces are
|
|
|
|
|
* escaped by prepending a backslash.
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: S
|
|
|
|
|
*
|
|
|
|
|
* Failure: NULL if the buffer would overflow. The
|
|
|
|
|
* buffer has as many left-to-right escapes as
|
|
|
|
|
* possible before overflow would have happened.
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Monday, April 26, 1999
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static char *
|
|
|
|
|
h5dump_escape(char *s/*in,out*/, size_t size, int escape_spaces)
|
|
|
|
|
{
|
2000-11-01 00:32:21 +08:00
|
|
|
|
size_t n = strlen(s);
|
|
|
|
|
size_t i;
|
|
|
|
|
const char *escape;
|
|
|
|
|
char octal[8];
|
1999-04-27 22:47:54 +08:00
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
for (i = 0; i < n; i++) {
|
1999-04-27 22:47:54 +08:00
|
|
|
|
switch (s[i]) {
|
|
|
|
|
case '"':
|
|
|
|
|
escape = "\\\"";
|
|
|
|
|
break;
|
|
|
|
|
case '\\':
|
|
|
|
|
escape = "\\\\";
|
|
|
|
|
break;
|
|
|
|
|
case '\b':
|
|
|
|
|
escape = "\\b";
|
|
|
|
|
break;
|
|
|
|
|
case '\f':
|
|
|
|
|
escape = "\\f";
|
|
|
|
|
break;
|
|
|
|
|
case '\n':
|
|
|
|
|
escape = "\\n";
|
|
|
|
|
break;
|
|
|
|
|
case '\r':
|
|
|
|
|
escape = "\\r";
|
|
|
|
|
break;
|
|
|
|
|
case '\t':
|
|
|
|
|
escape = "\\t";
|
|
|
|
|
break;
|
|
|
|
|
case ' ':
|
|
|
|
|
escape = escape_spaces ? "\\ " : NULL;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
1999-09-28 00:09:41 +08:00
|
|
|
|
if (!isprint((int)*s)) {
|
2000-11-01 00:32:21 +08:00
|
|
|
|
sprintf(octal, "\\%03o", (unsigned char)s[i]);
|
1999-04-27 22:47:54 +08:00
|
|
|
|
escape = octal;
|
|
|
|
|
} else {
|
|
|
|
|
escape = NULL;
|
|
|
|
|
}
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (escape) {
|
|
|
|
|
size_t esc_size = strlen(escape);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
|
|
|
|
if (n + esc_size + 1 > size)
|
|
|
|
|
/*would overflow*/
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
memmove(s + i + esc_size, s + i, (n - i) + 1); /*make room*/
|
|
|
|
|
memcpy(s + i, escape, esc_size); /*insert*/
|
1999-04-27 22:47:54 +08:00
|
|
|
|
n += esc_size;
|
|
|
|
|
i += esc_size - 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
return s;
|
[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-06-09 00:46:41 +08:00
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: h5dump_is_zero
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Determines if memory is initialized to all zero bytes.
|
|
|
|
|
*
|
|
|
|
|
* Return: TRUE if all bytes are zero; FALSE otherwise
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Monday, June 7, 1999
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static hbool_t
|
|
|
|
|
h5dump_is_zero(const void *_mem, size_t size)
|
|
|
|
|
{
|
2000-11-01 00:32:21 +08:00
|
|
|
|
const unsigned char *mem = (const unsigned char *)_mem;
|
|
|
|
|
|
|
|
|
|
while (size-- > 0)
|
|
|
|
|
if (mem[size])
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
1999-06-09 00:46:41 +08:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: h5dump_region
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Prints information about a dataspace region by appending
|
|
|
|
|
* the information to the specified string.
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: 0
|
|
|
|
|
*
|
|
|
|
|
* Failure: NULL
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Monday, June 7, 1999
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static int
|
2000-02-18 20:26:59 +08:00
|
|
|
|
h5dump_region(hid_t region, h5dump_str_t *str/*in,out*/, const h5dump_t *info)
|
1999-06-09 00:46:41 +08:00
|
|
|
|
{
|
2000-11-01 00:32:21 +08:00
|
|
|
|
hssize_t nblocks, npoints;
|
1999-06-09 00:46:41 +08:00
|
|
|
|
hsize_t *ptdata;
|
|
|
|
|
int ndims = H5Sget_simple_extent_ndims(region);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* These two functions fail if the region does not have blocks or points,
|
|
|
|
|
* respectively. They do not currently know how to translate from one to
|
|
|
|
|
* the other.
|
|
|
|
|
*/
|
|
|
|
|
H5E_BEGIN_TRY {
|
|
|
|
|
nblocks = H5Sget_select_hyper_nblocks(region);
|
|
|
|
|
npoints = H5Sget_select_elem_npoints(region);
|
|
|
|
|
} H5E_END_TRY;
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
1999-06-09 00:46:41 +08:00
|
|
|
|
h5dump_str_append(str, "{");
|
|
|
|
|
|
|
|
|
|
/* Print block information */
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (nblocks > 0) {
|
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
|
|
ptdata = malloc(nblocks * ndims * 2 * sizeof(ptdata[0]));
|
1999-06-09 00:46:41 +08:00
|
|
|
|
H5Sget_select_hyper_blocklist(region, 0, nblocks, ptdata);
|
2000-02-15 23:45:35 +08:00
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
for (i = 0; i < nblocks; i++) {
|
2000-02-18 02:35:30 +08:00
|
|
|
|
h5dump_str_append(str, info->dset_blockformat_pre,
|
2000-11-01 00:32:21 +08:00
|
|
|
|
i ? "," OPTIONAL_LINE_BREAK " " : "",
|
1999-06-09 00:46:41 +08:00
|
|
|
|
(unsigned long)i);
|
2000-02-15 23:45:35 +08:00
|
|
|
|
|
1999-06-09 00:46:41 +08:00
|
|
|
|
/* Start coordinates and opposite corner */
|
2000-11-01 00:32:21 +08:00
|
|
|
|
for (j = 0; j < ndims; j++)
|
|
|
|
|
h5dump_str_append(str, "%s%lu", j ? "," : "(",
|
|
|
|
|
(unsigned long)ptdata[i * 2 * ndims + j]);
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < ndims; j++)
|
|
|
|
|
h5dump_str_append(str, "%s%lu", j ? "," : ")-(",
|
|
|
|
|
(unsigned long)ptdata[i * 2 * ndims + j + ndims]);
|
|
|
|
|
|
1999-06-09 00:46:41 +08:00
|
|
|
|
h5dump_str_append(str, ")");
|
|
|
|
|
}
|
|
|
|
|
free(ptdata);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Print point information */
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (npoints > 0) {
|
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
|
|
ptdata = malloc(npoints * ndims * sizeof(ptdata[0]));
|
1999-06-09 00:46:41 +08:00
|
|
|
|
H5Sget_select_elem_pointlist(region, 0, npoints, ptdata);
|
2000-02-15 23:45:35 +08:00
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
for (i = 0; i < npoints; i++) {
|
2000-02-18 02:35:30 +08:00
|
|
|
|
h5dump_str_append(str, info->dset_ptformat_pre ,
|
2000-11-01 00:32:21 +08:00
|
|
|
|
i ? "," OPTIONAL_LINE_BREAK " " : "",
|
1999-06-09 00:46:41 +08:00
|
|
|
|
(unsigned long)i);
|
2000-02-15 23:45:35 +08:00
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
for (j = 0; j < ndims; j++)
|
|
|
|
|
h5dump_str_append(str, "%s%lu", j ? "," : "(",
|
|
|
|
|
(unsigned long)(ptdata[i * ndims + j]));
|
|
|
|
|
|
1999-06-09 00:46:41 +08:00
|
|
|
|
h5dump_str_append(str, ")");
|
|
|
|
|
}
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
1999-06-09 00:46:41 +08:00
|
|
|
|
free(ptdata);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
h5dump_str_append(str, "}");
|
|
|
|
|
return 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
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: h5dump_sprint
|
|
|
|
|
*
|
1999-04-27 22:47:54 +08:00
|
|
|
|
* Purpose: Renders the value pointed to by VP of type TYPE into variable
|
|
|
|
|
* length string STR.
|
[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-04-27 22:47:54 +08:00
|
|
|
|
* Return: A pointer to memory containing the result or NULL on error.
|
[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
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Thursday, July 23, 1998
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
1999-04-27 22:47:54 +08:00
|
|
|
|
* Robb Matzke, 1999-04-26
|
|
|
|
|
* Made this function safe from overflow problems by allowing it
|
|
|
|
|
* to reallocate the 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
|
|
|
|
*
|
1999-06-07 23:05:02 +08:00
|
|
|
|
* Robb Matzke, 1999-06-04
|
|
|
|
|
* Added support for object references. The new `container'
|
|
|
|
|
* argument is the dataset where the reference came from.
|
|
|
|
|
*
|
1999-06-07 23:58:05 +08:00
|
|
|
|
* Robb Matzke, 1999-06-07
|
|
|
|
|
* Added support for printing raw data. If info->raw is non-zero
|
|
|
|
|
* then data is printed in hexadecimal format.
|
|
|
|
|
*
|
[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-04-27 22:47:54 +08:00
|
|
|
|
static char *
|
|
|
|
|
h5dump_sprint(h5dump_str_t *str/*in,out*/, const h5dump_t *info,
|
2000-02-15 23:45:35 +08:00
|
|
|
|
hid_t container, hid_t type, void *vp, h5dump_context_t *ctx)
|
[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
|
|
|
|
{
|
2000-11-01 00:32:21 +08:00
|
|
|
|
size_t n, offset, size, dims[H5S_MAX_RANK], nelmts, start;
|
1998-09-22 23:27:26 +08:00
|
|
|
|
char *name, quote='\0';
|
2000-11-01 00:32:21 +08:00
|
|
|
|
unsigned char *ucp_vp = (unsigned char *)vp;
|
|
|
|
|
char *cp_vp = (char *)vp;
|
1999-06-09 00:46:41 +08:00
|
|
|
|
hid_t memb, obj, region;
|
2000-11-01 00:32:21 +08:00
|
|
|
|
int nmembs, ndims, otype;
|
1999-04-27 22:47:54 +08:00
|
|
|
|
static char fmt_llong[8], fmt_ullong[8];
|
1999-06-07 23:58:05 +08:00
|
|
|
|
H5T_str_t pad;
|
1999-06-09 00:46:41 +08:00
|
|
|
|
H5G_stat_t sb;
|
2000-02-23 03:32:48 +08:00
|
|
|
|
|
|
|
|
|
/*some tempvars to store the value before we append it to the string
|
|
|
|
|
to get rid of the memory alignment problem*/
|
|
|
|
|
float tempfloat;
|
|
|
|
|
double tempdouble;
|
|
|
|
|
int tempint;
|
|
|
|
|
unsigned int tempuint;
|
|
|
|
|
short tempshort;
|
|
|
|
|
unsigned short tempushort;
|
|
|
|
|
long templong;
|
|
|
|
|
unsigned long tempulong;
|
|
|
|
|
unsigned long_long tempullong;
|
|
|
|
|
long_long templlong;
|
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
/* Build default formats for long long types */
|
|
|
|
|
if (!fmt_llong[0]) {
|
|
|
|
|
sprintf(fmt_llong, "%%%sd", PRINTF_LL_WIDTH);
|
|
|
|
|
sprintf(fmt_ullong, "%%%su", PRINTF_LL_WIDTH);
|
|
|
|
|
}
|
|
|
|
|
|
1999-06-07 23:58:05 +08:00
|
|
|
|
/* Append value depending on data type */
|
|
|
|
|
start = h5dump_str_len(str);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
1999-06-07 23:58:05 +08:00
|
|
|
|
if (info->raw) {
|
2000-11-01 00:32:21 +08:00
|
|
|
|
unsigned int i;
|
|
|
|
|
|
1999-06-07 23:58:05 +08:00
|
|
|
|
h5dump_str_append(str, "0x");
|
|
|
|
|
n = H5Tget_size(type);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
|
h5dump_str_append(str, OPT(info->fmt_raw, "%02x"), ucp_vp[i]);
|
1999-06-07 23:58:05 +08:00
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_DOUBLE)) {
|
2000-11-01 00:32:21 +08:00
|
|
|
|
memcpy(&tempdouble, vp, sizeof(double));
|
2000-02-23 03:32:48 +08:00
|
|
|
|
h5dump_str_append(str, OPT(info->fmt_double, "%g"), tempdouble);
|
1999-06-07 23:58:05 +08:00
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_FLOAT)) {
|
2000-11-01 00:32:21 +08:00
|
|
|
|
memcpy(&tempfloat, vp, sizeof(float));
|
2000-02-23 03:32:48 +08:00
|
|
|
|
h5dump_str_append(str, OPT(info->fmt_double, "%g"), tempfloat);
|
1999-06-07 23:58:05 +08:00
|
|
|
|
} else if (info->ascii &&
|
|
|
|
|
(H5Tequal(type, H5T_NATIVE_SCHAR) ||
|
1999-05-21 03:09:04 +08:00
|
|
|
|
H5Tequal(type, H5T_NATIVE_UCHAR))) {
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (ESCAPE_HTML == info->str_locale) {
|
|
|
|
|
if (*cp_vp <= ' ' || *cp_vp > '~')
|
|
|
|
|
h5dump_str_append(str, "%%%02X", *ucp_vp);
|
|
|
|
|
else
|
|
|
|
|
h5dump_str_append(str, "%c", *cp_vp);
|
1999-10-01 00:14:14 +08:00
|
|
|
|
} else {
|
2000-11-01 00:32:21 +08:00
|
|
|
|
switch (*cp_vp) {
|
1999-10-01 00:14:14 +08:00
|
|
|
|
case '"':
|
|
|
|
|
h5dump_str_append(str, "\\\"");
|
|
|
|
|
break;
|
|
|
|
|
case '\\':
|
|
|
|
|
h5dump_str_append(str, "\\\\");
|
|
|
|
|
break;
|
|
|
|
|
case '\b':
|
|
|
|
|
h5dump_str_append(str, "\\b");
|
|
|
|
|
break;
|
|
|
|
|
case '\f':
|
|
|
|
|
h5dump_str_append(str, "\\f");
|
|
|
|
|
break;
|
|
|
|
|
case '\n':
|
|
|
|
|
h5dump_str_append(str, "\\n");
|
|
|
|
|
break;
|
|
|
|
|
case '\r':
|
|
|
|
|
h5dump_str_append(str, "\\r");
|
|
|
|
|
break;
|
|
|
|
|
case '\t':
|
|
|
|
|
h5dump_str_append(str, "\\t");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (isprint(*cp_vp)) {
|
|
|
|
|
h5dump_str_append(str, "%c", *cp_vp);
|
1999-10-01 00:14:14 +08:00
|
|
|
|
} else {
|
2000-11-01 00:32:21 +08:00
|
|
|
|
h5dump_str_append(str, "\\%03o", *ucp_vp);
|
1999-10-01 00:14:14 +08:00
|
|
|
|
}
|
|
|
|
|
break;
|
1999-06-07 23:58:05 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
1999-10-01 00:14:14 +08:00
|
|
|
|
|
1999-06-07 23:58:05 +08:00
|
|
|
|
} else if (H5T_STRING==H5Tget_class(type)) {
|
2000-11-01 00:32:21 +08:00
|
|
|
|
unsigned int i;
|
|
|
|
|
|
1999-06-07 23:58:05 +08:00
|
|
|
|
size = H5Tget_size(type);
|
|
|
|
|
quote = '\0';
|
|
|
|
|
pad = H5Tget_strpad(type);
|
2000-02-15 23:45:35 +08:00
|
|
|
|
|
1999-06-07 23:58:05 +08:00
|
|
|
|
for (i=0;
|
2000-11-01 00:32:21 +08:00
|
|
|
|
i < size && ((pad == H5T_STR_NULLPAD) ? 1 : (cp_vp[i] != '\0'));
|
1999-06-07 23:58:05 +08:00
|
|
|
|
i++) {
|
2000-11-01 00:32:21 +08:00
|
|
|
|
int j = 1;
|
2000-02-15 23:45:35 +08:00
|
|
|
|
|
1999-06-07 23:58:05 +08:00
|
|
|
|
/*
|
|
|
|
|
* Count how many times the next character repeats. If the
|
1999-10-01 00:14:14 +08:00
|
|
|
|
* threshold is zero then that means it can repeat any number
|
1999-06-07 23:58:05 +08:00
|
|
|
|
* of times.
|
|
|
|
|
*/
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (info->str_repeat > 0)
|
|
|
|
|
while (i + j < size && cp_vp[i] == cp_vp[i + j])
|
|
|
|
|
j++;
|
1999-06-07 23:58:05 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (info->str_repeat > 0 && j > info->str_repeat) {
|
|
|
|
|
if (quote)
|
|
|
|
|
h5dump_str_append(str, "%c", quote);
|
|
|
|
|
|
1999-06-07 23:58:05 +08:00
|
|
|
|
quote = '\'';
|
2000-11-01 00:32:21 +08:00
|
|
|
|
h5dump_str_append(str, "%s%c", i ? " " : "", quote);
|
1999-06-07 23:58:05 +08:00
|
|
|
|
} else if (!quote) {
|
|
|
|
|
quote = '"';
|
2000-11-01 00:32:21 +08:00
|
|
|
|
h5dump_str_append(str, "%s%c", i ? " " : "", quote);
|
1999-06-07 23:58:05 +08:00
|
|
|
|
}
|
1999-05-13 23:18:12 +08:00
|
|
|
|
|
1999-06-07 23:58:05 +08:00
|
|
|
|
/* Print the character */
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (ESCAPE_HTML == info->str_locale) {
|
|
|
|
|
if (cp_vp[i] <= ' ' || cp_vp[i] > '~') {
|
|
|
|
|
h5dump_str_append(str, "%%%02X", ucp_vp[i]);
|
1999-06-07 23:58:05 +08:00
|
|
|
|
} else {
|
2000-11-01 00:32:21 +08:00
|
|
|
|
h5dump_str_append(str, "%c", cp_vp[i]);
|
1999-10-01 00:14:14 +08:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2000-11-01 00:32:21 +08:00
|
|
|
|
switch (cp_vp[i]) {
|
1999-10-01 00:14:14 +08:00
|
|
|
|
case '"':
|
|
|
|
|
h5dump_str_append(str, "\\\"");
|
|
|
|
|
break;
|
|
|
|
|
case '\\':
|
|
|
|
|
h5dump_str_append(str, "\\\\");
|
|
|
|
|
break;
|
|
|
|
|
case '\b':
|
|
|
|
|
h5dump_str_append(str, "\\b");
|
|
|
|
|
break;
|
|
|
|
|
case '\f':
|
|
|
|
|
h5dump_str_append(str, "\\f");
|
|
|
|
|
break;
|
|
|
|
|
case '\n':
|
|
|
|
|
h5dump_str_append(str, "\\n");
|
|
|
|
|
break;
|
|
|
|
|
case '\r':
|
|
|
|
|
h5dump_str_append(str, "\\r");
|
|
|
|
|
break;
|
|
|
|
|
case '\t':
|
|
|
|
|
h5dump_str_append(str, "\\t");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (isprint(cp_vp[i]))
|
|
|
|
|
h5dump_str_append(str, "%c", cp_vp[i]);
|
|
|
|
|
else
|
|
|
|
|
h5dump_str_append(str, "\\%03o", ucp_vp[i]);
|
|
|
|
|
|
1999-10-01 00:14:14 +08:00
|
|
|
|
break;
|
1999-06-07 23:58:05 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
1999-10-01 00:14:14 +08:00
|
|
|
|
|
1999-06-07 23:58:05 +08:00
|
|
|
|
/* Print the repeat count */
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (info->str_repeat && j > info->str_repeat) {
|
1999-04-27 22:47:54 +08:00
|
|
|
|
#ifdef REPEAT_VERBOSE
|
2000-11-01 00:32:21 +08:00
|
|
|
|
h5dump_str_append(str, "%c repeats %d times", quote, j - 1);
|
1999-04-27 22:47:54 +08:00
|
|
|
|
#else
|
2000-11-01 00:32:21 +08:00
|
|
|
|
h5dump_str_append(str, "%c*%d", quote, j - 1);
|
1999-04-27 22:47:54 +08:00
|
|
|
|
#endif
|
1999-06-07 23:58:05 +08:00
|
|
|
|
quote = '\0';
|
2000-11-01 00:32:21 +08:00
|
|
|
|
i += j - 1;
|
1999-06-07 23:58:05 +08:00
|
|
|
|
}
|
2000-02-15 23:45:35 +08:00
|
|
|
|
|
1999-06-07 23:58:05 +08:00
|
|
|
|
}
|
1999-10-01 00:14:14 +08:00
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (quote)
|
|
|
|
|
h5dump_str_append(str, "%c", quote);
|
|
|
|
|
|
|
|
|
|
if (0 == i)
|
1999-10-01 00:14:14 +08:00
|
|
|
|
h5dump_str_append(str, "\"\""); /*empty string*/
|
1999-06-07 23:58:05 +08:00
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_INT)) {
|
2000-02-23 03:32:48 +08:00
|
|
|
|
memcpy(&tempint, vp, sizeof(int));
|
1999-06-07 23:58:05 +08:00
|
|
|
|
h5dump_str_append(str, OPT(info->fmt_int, "%d"),
|
2000-02-23 03:32:48 +08:00
|
|
|
|
tempint);
|
1999-06-07 23:58:05 +08:00
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_UINT)) {
|
2000-02-23 03:32:48 +08:00
|
|
|
|
memcpy(&tempuint, vp, sizeof(unsigned int));
|
1999-06-07 23:58:05 +08:00
|
|
|
|
h5dump_str_append(str, OPT(info->fmt_uint, "%u"),
|
2000-02-23 03:32:48 +08:00
|
|
|
|
tempuint);
|
1999-06-07 23:58:05 +08:00
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_SCHAR)) {
|
|
|
|
|
h5dump_str_append(str, OPT(info->fmt_schar, "%d"),
|
|
|
|
|
*((signed char*)vp));
|
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_UCHAR)) {
|
|
|
|
|
h5dump_str_append(str, OPT(info->fmt_uchar, "%u"),
|
|
|
|
|
*((unsigned char*)vp));
|
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_SHORT)) {
|
2000-02-23 03:32:48 +08:00
|
|
|
|
memcpy(&tempshort, vp, sizeof(short));
|
1999-06-07 23:58:05 +08:00
|
|
|
|
h5dump_str_append(str, OPT(info->fmt_short, "%d"),
|
2000-02-23 03:32:48 +08:00
|
|
|
|
tempshort);
|
1999-06-07 23:58:05 +08:00
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_USHORT)) {
|
2000-02-23 03:32:48 +08:00
|
|
|
|
memcpy(&tempushort, vp, sizeof(unsigned short));
|
1999-06-07 23:58:05 +08:00
|
|
|
|
h5dump_str_append(str, OPT(info->fmt_ushort, "%u"),
|
2000-02-23 03:32:48 +08:00
|
|
|
|
tempushort);
|
1999-06-07 23:58:05 +08:00
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_LONG)) {
|
2000-02-23 03:32:48 +08:00
|
|
|
|
memcpy(&templong, vp, sizeof(long));
|
1999-06-07 23:58:05 +08:00
|
|
|
|
h5dump_str_append(str, OPT(info->fmt_long, "%ld"),
|
2000-02-23 03:32:48 +08:00
|
|
|
|
templong);
|
1999-06-07 23:58:05 +08:00
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_ULONG)) {
|
2000-02-23 03:32:48 +08:00
|
|
|
|
memcpy(&tempulong, vp, sizeof(unsigned long));
|
1999-06-07 23:58:05 +08:00
|
|
|
|
h5dump_str_append(str, OPT(info->fmt_ulong, "%lu"),
|
2000-02-23 03:32:48 +08:00
|
|
|
|
tempulong);
|
1999-06-07 23:58:05 +08:00
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_LLONG)) {
|
2000-02-23 03:32:48 +08:00
|
|
|
|
memcpy(&templlong, vp, sizeof(long_long));
|
1999-06-07 23:58:05 +08:00
|
|
|
|
h5dump_str_append(str, OPT(info->fmt_llong, fmt_llong),
|
2000-02-23 03:32:48 +08:00
|
|
|
|
templlong);
|
1999-06-07 23:58:05 +08:00
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_ULLONG)) {
|
2000-02-23 03:32:48 +08:00
|
|
|
|
memcpy(&tempullong, vp, sizeof(unsigned long_long));
|
1999-06-07 23:58:05 +08:00
|
|
|
|
h5dump_str_append(str, OPT(info->fmt_ullong, fmt_ullong),
|
2000-02-23 03:32:48 +08:00
|
|
|
|
tempullong);
|
1999-06-07 23:58:05 +08:00
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_HSSIZE)) {
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (sizeof(hssize_t) == sizeof(int)) {
|
2000-02-23 03:32:48 +08:00
|
|
|
|
memcpy(&tempint, vp, sizeof(int));
|
1999-06-07 23:58:05 +08:00
|
|
|
|
h5dump_str_append(str, OPT(info->fmt_int, "%d"),
|
2000-02-23 03:32:48 +08:00
|
|
|
|
tempint);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
} else if (sizeof(hssize_t) == sizeof(long)) {
|
2000-02-23 03:32:48 +08:00
|
|
|
|
memcpy(&templong, vp, sizeof(long));
|
1999-06-07 23:58:05 +08:00
|
|
|
|
h5dump_str_append(str, OPT(info->fmt_long, "%ld"),
|
2000-02-23 03:32:48 +08:00
|
|
|
|
templong);
|
1999-06-07 23:58:05 +08:00
|
|
|
|
} else {
|
2000-02-23 03:32:48 +08:00
|
|
|
|
memcpy(&templlong, vp, sizeof(long_long));
|
1999-06-07 23:58:05 +08:00
|
|
|
|
h5dump_str_append(str, OPT(info->fmt_llong, fmt_llong),
|
2000-02-23 03:32:48 +08:00
|
|
|
|
templlong);
|
1999-06-07 23:58:05 +08:00
|
|
|
|
}
|
1999-05-21 03:09:04 +08:00
|
|
|
|
|
1999-06-07 23:58:05 +08:00
|
|
|
|
} else if (H5Tequal(type, H5T_NATIVE_HSIZE)) {
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (sizeof(hsize_t) == sizeof(int)) {
|
2000-02-23 03:32:48 +08:00
|
|
|
|
memcpy(&tempuint, vp, sizeof(unsigned int));
|
1999-06-07 23:58:05 +08:00
|
|
|
|
h5dump_str_append(str, OPT(info->fmt_uint, "%u"),
|
2000-02-23 03:32:48 +08:00
|
|
|
|
tempuint);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
} else if (sizeof(hsize_t) == sizeof(long)) {
|
2000-02-23 03:32:48 +08:00
|
|
|
|
memcpy(&tempulong, vp, sizeof(long));
|
1999-06-07 23:58:05 +08:00
|
|
|
|
h5dump_str_append(str, OPT(info->fmt_ulong, "%lu"),
|
2000-02-23 03:32:48 +08:00
|
|
|
|
tempulong);
|
1999-06-07 23:58:05 +08:00
|
|
|
|
} else {
|
2000-02-23 03:32:48 +08:00
|
|
|
|
memcpy(&tempullong, vp, sizeof(unsigned long_long));
|
1999-06-07 23:58:05 +08:00
|
|
|
|
h5dump_str_append(str, OPT(info->fmt_ullong, fmt_ullong),
|
2000-02-23 03:32:48 +08:00
|
|
|
|
tempullong);
|
1999-06-07 23:58:05 +08:00
|
|
|
|
}
|
|
|
|
|
} else if (H5T_COMPOUND==H5Tget_class(type)) {
|
2000-11-01 00:32:21 +08:00
|
|
|
|
int j, x;
|
|
|
|
|
|
1999-06-07 23:58:05 +08:00
|
|
|
|
nmembs = H5Tget_nmembers(type);
|
|
|
|
|
h5dump_str_append(str, "%s", OPT(info->cmpd_pre, "{"));
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
|
|
|
|
for (j = 0; j < nmembs; j++) {
|
|
|
|
|
unsigned int i;
|
|
|
|
|
int k;
|
|
|
|
|
|
1999-06-07 23:58:05 +08:00
|
|
|
|
if (j) h5dump_str_append(str, "%s",
|
|
|
|
|
OPT(info->cmpd_sep,
|
|
|
|
|
", " OPTIONAL_LINE_BREAK));
|
2000-02-15 23:45:35 +08:00
|
|
|
|
|
2000-11-01 00:18:45 +08:00
|
|
|
|
/* RPM 2000-10-31
|
|
|
|
|
* If the previous character is a line-feed (which is true when
|
|
|
|
|
* h5dump is running) then insert some white space for
|
|
|
|
|
* indentation. Be warned that column number calculations will be
|
|
|
|
|
* incorrect and that object indices at the beginning of the line
|
|
|
|
|
* will be missing (h5dump doesn't display them anyway). */
|
|
|
|
|
if (ctx->indent_level >= 0 &&
|
|
|
|
|
str->len && '\n'==str->s[str->len-1]) {
|
|
|
|
|
h5dump_str_append(str, OPT(info->line_pre, ""), "");
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
2000-11-01 00:18:45 +08:00
|
|
|
|
for (x=0; x<ctx->indent_level+1; x++) {
|
|
|
|
|
h5dump_str_append(str, "%s", OPT(info->line_indent, ""));
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
1999-06-07 23:58:05 +08:00
|
|
|
|
/* The name */
|
|
|
|
|
name = H5Tget_member_name(type, j);
|
|
|
|
|
h5dump_str_append(str, OPT(info->cmpd_name, ""), name);
|
|
|
|
|
free(name);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
1999-06-07 23:58:05 +08:00
|
|
|
|
/* The value */
|
|
|
|
|
offset = H5Tget_member_offset(type, j);
|
|
|
|
|
memb = H5Tget_member_type(type, j);
|
|
|
|
|
size = H5Tget_size(memb);
|
|
|
|
|
ndims = H5Tget_member_dims(type, j, dims, NULL);
|
|
|
|
|
assert(ndims>=0 && ndims<=H5S_MAX_RANK);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
|
|
|
|
for (k = 0, nelmts = 1; k < ndims; k++)
|
|
|
|
|
nelmts *= dims[k];
|
1999-05-13 23:18:12 +08:00
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (nelmts > 1)
|
1999-06-07 23:58:05 +08:00
|
|
|
|
h5dump_str_append(str, "%s", OPT(info->arr_pre, "["));
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < nelmts; i++) {
|
|
|
|
|
if (i)
|
1999-06-07 23:58:05 +08:00
|
|
|
|
h5dump_str_append(str, "%s",
|
2000-11-01 00:32:21 +08:00
|
|
|
|
OPT(info->arr_sep, "," OPTIONAL_LINE_BREAK));
|
2000-02-15 23:45:35 +08:00
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (ndims > 0 && info->arr_linebreak && i && 0 == i % dims[ndims - 1]) {
|
2000-04-07 23:27:48 +08:00
|
|
|
|
h5dump_str_append(str, "%s", "\n");
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
2000-04-07 23:27:48 +08:00
|
|
|
|
/*need to indent some more here*/
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (ctx->indent_level >= 0)
|
2000-02-15 23:45:35 +08:00
|
|
|
|
h5dump_str_append(str, "%s", OPT(info->line_pre, ""));
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
|
|
|
|
for (x = 0; x < ctx->indent_level + 1; x++)
|
2000-04-07 23:27:48 +08:00
|
|
|
|
h5dump_str_append(str,"%s",OPT(info->line_indent,""));
|
2000-02-15 23:45:35 +08:00
|
|
|
|
}
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
2000-05-26 01:08:45 +08:00
|
|
|
|
ctx->indent_level++;
|
1999-06-07 23:58:05 +08:00
|
|
|
|
h5dump_sprint(str, info, container, memb,
|
2000-11-01 00:32:21 +08:00
|
|
|
|
cp_vp + offset + i * size, ctx);
|
2000-05-26 01:08:45 +08:00
|
|
|
|
ctx->indent_level--;
|
1999-06-07 23:58:05 +08:00
|
|
|
|
}
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
|
|
|
|
if (nelmts > 1)
|
2000-05-26 01:08:45 +08:00
|
|
|
|
h5dump_str_append(str, "%s", OPT(info->arr_suf, "]"));
|
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
H5Tclose(memb);
|
2000-02-15 23:45:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
2000-11-01 00:18:45 +08:00
|
|
|
|
/* RPM 2000-10-31
|
|
|
|
|
* If the previous character is a line feed (which is true when
|
|
|
|
|
* h5dump is running) then insert some white space for indentation.
|
|
|
|
|
* Be warned that column number calculations will be incorrect and
|
|
|
|
|
* that object indices at the beginning of the line will be missing
|
|
|
|
|
* (h5dump doesn't display them anyway). */
|
2000-02-15 23:45:35 +08:00
|
|
|
|
h5dump_str_append(str, "%s", OPT(info->cmpd_end, ""));
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
2000-11-01 00:18:45 +08:00
|
|
|
|
if (ctx->indent_level >= 0 &&
|
|
|
|
|
str->len && '\n'==str->s[str->len-1]) {
|
|
|
|
|
h5dump_str_append(str, OPT(info->line_pre, ""), "");
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
|
|
|
|
for (x = 0; x < ctx->indent_level; x++) {
|
2000-11-01 00:18:45 +08:00
|
|
|
|
h5dump_str_append(str, "%s", OPT(info->line_indent, ""));
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
2000-11-01 00:18:45 +08:00
|
|
|
|
h5dump_str_append(str, "%s", OPT(info->cmpd_suf, "}"));
|
1999-06-07 23:58:05 +08:00
|
|
|
|
} else if (H5T_ENUM==H5Tget_class(type)) {
|
|
|
|
|
char enum_name[1024];
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
|
|
|
|
if (H5Tenum_nameof(type, vp, enum_name, sizeof enum_name) >= 0) {
|
|
|
|
|
h5dump_str_append(str, h5dump_escape(enum_name, sizeof(enum_name),
|
2000-04-07 23:27:48 +08:00
|
|
|
|
TRUE));
|
1999-06-07 23:58:05 +08:00
|
|
|
|
} else {
|
2000-11-01 00:32:21 +08:00
|
|
|
|
unsigned int i;
|
|
|
|
|
|
1999-06-07 23:58:05 +08:00
|
|
|
|
h5dump_str_append(str, "0x");
|
|
|
|
|
n = H5Tget_size(type);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
|
h5dump_str_append(str, "%02x", ucp_vp[i]);
|
1999-06-07 23:58:05 +08:00
|
|
|
|
}
|
|
|
|
|
} else if (H5Tequal(type, H5T_STD_REF_DSETREG)) {
|
|
|
|
|
/*
|
|
|
|
|
* Dataset region reference -- show the type and OID of the referenced
|
1999-06-09 00:46:41 +08:00
|
|
|
|
* object, but we are unable to show the region yet because there
|
|
|
|
|
* isn't enough support in the data space layer. - rpm 19990604
|
1999-06-07 23:58:05 +08:00
|
|
|
|
*/
|
1999-06-09 00:46:41 +08:00
|
|
|
|
if (h5dump_is_zero(vp, H5Tget_size(type))) {
|
|
|
|
|
h5dump_str_append(str, "NULL");
|
|
|
|
|
} else {
|
|
|
|
|
obj = H5Rdereference(container, H5R_DATASET_REGION, vp);
|
|
|
|
|
region = H5Rget_region(container, H5R_DATASET_REGION, vp);
|
|
|
|
|
H5Gget_objinfo(obj, ".", FALSE, &sb);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
|
|
|
|
if (info->dset_hidefileno)
|
2000-04-07 23:27:48 +08:00
|
|
|
|
h5dump_str_append(str, info->dset_format,
|
|
|
|
|
sb.objno[1], sb.objno[0]);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
else
|
2000-04-07 23:27:48 +08:00
|
|
|
|
h5dump_str_append(str, info->dset_format,
|
|
|
|
|
sb.fileno[1], sb.fileno[0],
|
|
|
|
|
sb.objno[1], sb.objno[0]);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
2000-02-18 02:35:30 +08:00
|
|
|
|
h5dump_region(region, str, info);
|
1999-06-09 00:46:41 +08:00
|
|
|
|
H5Sclose(region);
|
1999-06-07 23:58:05 +08:00
|
|
|
|
H5Dclose(obj);
|
|
|
|
|
}
|
1999-06-09 00:46:41 +08:00
|
|
|
|
} else if (H5Tequal(type, H5T_STD_REF_OBJ)) {
|
|
|
|
|
/*
|
|
|
|
|
* Object references -- show the type and OID of the referenced
|
|
|
|
|
* object.
|
|
|
|
|
*/
|
|
|
|
|
if (h5dump_is_zero(vp, H5Tget_size(type))) {
|
|
|
|
|
h5dump_str_append(str, "NULL");
|
|
|
|
|
} else {
|
|
|
|
|
otype = H5Rget_object_type(container, vp);
|
|
|
|
|
obj = H5Rdereference(container, H5R_OBJECT, vp);
|
|
|
|
|
H5Gget_objinfo(obj, ".", FALSE, &sb);
|
|
|
|
|
|
|
|
|
|
/* Print object type and close object */
|
|
|
|
|
switch (otype) {
|
|
|
|
|
case H5G_GROUP:
|
1999-06-16 01:25:30 +08:00
|
|
|
|
h5dump_str_append(str, GROUPNAME);
|
1999-06-09 00:46:41 +08:00
|
|
|
|
H5Gclose(obj);
|
|
|
|
|
break;
|
|
|
|
|
case H5G_DATASET:
|
1999-06-16 01:25:30 +08:00
|
|
|
|
h5dump_str_append(str, DATASET);
|
1999-06-09 00:46:41 +08:00
|
|
|
|
H5Dclose(obj);
|
|
|
|
|
break;
|
|
|
|
|
case H5G_TYPE:
|
1999-06-25 03:01:21 +08:00
|
|
|
|
h5dump_str_append(str, DATATYPE);
|
1999-06-09 00:46:41 +08:00
|
|
|
|
H5Tclose(obj);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2000-04-07 23:27:48 +08:00
|
|
|
|
h5dump_str_append(str, "%u-", otype);
|
|
|
|
|
break;
|
1999-06-09 00:46:41 +08:00
|
|
|
|
}
|
1999-06-08 07:27:44 +08:00
|
|
|
|
|
1999-06-09 00:46:41 +08:00
|
|
|
|
/* Print OID */
|
2000-04-07 23:27:48 +08:00
|
|
|
|
if (info->obj_hidefileno){
|
|
|
|
|
h5dump_str_append(str, info->obj_format,
|
|
|
|
|
sb.objno[1], sb.objno[0]);
|
|
|
|
|
} else {
|
|
|
|
|
h5dump_str_append(str, info->obj_format,
|
|
|
|
|
sb.fileno[1], sb.fileno[0],
|
|
|
|
|
sb.objno[1], sb.objno[0]);
|
|
|
|
|
}
|
1999-06-09 00:46:41 +08:00
|
|
|
|
}
|
1999-06-07 23:58:05 +08:00
|
|
|
|
} else {
|
1999-06-08 04:20:32 +08:00
|
|
|
|
/* All other types get printed as hexadecimal */
|
2000-11-01 00:32:21 +08:00
|
|
|
|
unsigned int i;
|
|
|
|
|
|
1999-06-07 23:58:05 +08:00
|
|
|
|
h5dump_str_append(str, "0x");
|
|
|
|
|
n = H5Tget_size(type);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
|
h5dump_str_append(str, "%02x", ((unsigned char *)vp)[i]);
|
1999-06-07 23:58:05 +08:00
|
|
|
|
}
|
1999-05-21 03:09:04 +08:00
|
|
|
|
|
1999-06-07 23:58:05 +08:00
|
|
|
|
return h5dump_str_fmt(str, start, OPT(info->elmt_fmt, "%s"));
|
1999-04-27 22:47:54 +08:00
|
|
|
|
}
|
1998-09-22 23:27:26 +08:00
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: h5dump_ncols
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Count the number of columns in a string. This is the number
|
|
|
|
|
* of characters in the string not counting line-control
|
|
|
|
|
* characters.
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: Width of string.
|
|
|
|
|
*
|
|
|
|
|
* Failure: 0
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Tuesday, April 27, 1999
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static size_t
|
|
|
|
|
h5dump_ncols(const char *s)
|
|
|
|
|
{
|
2000-11-01 00:32:21 +08:00
|
|
|
|
size_t i;
|
1999-04-27 22:47:54 +08:00
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
for (i = 0; *s; s++)
|
|
|
|
|
if (*s >= ' ')
|
|
|
|
|
i++;
|
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
return 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
|
|
|
|
}
|
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: h5dump_simple_prefix
|
|
|
|
|
*
|
|
|
|
|
* Purpose: If ctx->need_prefix is set then terminate the current line
|
|
|
|
|
* (if applicable), calculate the prefix string, and display it
|
|
|
|
|
* at the start of a line.
|
|
|
|
|
*
|
|
|
|
|
* Return: void
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Monday, April 26, 1999
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
1999-10-01 00:14:14 +08:00
|
|
|
|
* Robb Matzke, 1999-09-29
|
|
|
|
|
* If a new prefix is printed then the current element number is
|
|
|
|
|
* set back to zero.
|
1999-04-27 22:47:54 +08:00
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
h5dump_simple_prefix(FILE *stream, const h5dump_t *info,
|
|
|
|
|
h5dump_context_t *ctx, hsize_t elmtno, int secnum)
|
|
|
|
|
{
|
2000-11-01 00:32:21 +08:00
|
|
|
|
h5dump_str_t prefix;
|
2000-08-05 06:17:23 +08:00
|
|
|
|
size_t templength = 0;
|
|
|
|
|
int i, indentlevel = 0;
|
2000-02-15 23:45:35 +08:00
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
memset(&prefix, 0, sizeof(h5dump_str_t));
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
|
|
|
|
if (!ctx->need_prefix)
|
|
|
|
|
return;
|
1999-04-27 22:47:54 +08:00
|
|
|
|
|
|
|
|
|
/* Terminate previous line, if any */
|
|
|
|
|
if (ctx->cur_column) {
|
|
|
|
|
fputs(OPT(info->line_suf, ""), stream);
|
2000-04-07 23:27:48 +08:00
|
|
|
|
#if 0 /*why?*/
|
|
|
|
|
if (info->line_ncols != ctx->cur_column) {
|
|
|
|
|
putc('\n', stream);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2000-02-17 01:50:11 +08:00
|
|
|
|
putc('\n',stream);
|
1999-04-27 22:47:54 +08:00
|
|
|
|
fputs(OPT(info->line_sep, ""), stream);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Calculate new prefix */
|
|
|
|
|
h5dump_prefix(&prefix, info, elmtno, ctx->ndims,
|
|
|
|
|
ctx->p_min_idx, ctx->p_max_idx);
|
|
|
|
|
|
|
|
|
|
/* Write new prefix to output */
|
2000-04-07 23:27:48 +08:00
|
|
|
|
if (ctx->indent_level >= 0) {
|
|
|
|
|
indentlevel = ctx->indent_level;
|
|
|
|
|
} else {
|
|
|
|
|
/* this is because sometimes we dont print out all the header
|
|
|
|
|
* info for the data(like the tattr-2.ddl example. if that happens
|
|
|
|
|
* the ctx->indent_level a negative so we need to skip the above
|
2000-04-20 02:14:36 +08:00
|
|
|
|
* and just print out the default indent levels. */
|
2000-11-01 00:32:21 +08:00
|
|
|
|
indentlevel = ctx->default_indent_level;
|
2000-04-07 23:27:48 +08:00
|
|
|
|
}
|
2000-04-20 02:14:36 +08:00
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (elmtno == 0 && secnum == 0 && info->line_1st)
|
|
|
|
|
fputs(h5dump_str_fmt(&prefix, 0, info->line_1st), stream);
|
|
|
|
|
else if (secnum && info->line_cont)
|
|
|
|
|
fputs(h5dump_str_fmt(&prefix, 0, info->line_cont), stream);
|
|
|
|
|
else
|
|
|
|
|
fputs(h5dump_str_fmt(&prefix, 0, info->line_pre), stream);
|
|
|
|
|
|
|
|
|
|
templength = h5dump_str_len(&prefix);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < indentlevel; i++){
|
|
|
|
|
fputs(h5dump_str_fmt(&prefix, 0, info->line_indent), stream);
|
|
|
|
|
templength += h5dump_str_len(&prefix);
|
|
|
|
|
}
|
2000-04-20 02:14:36 +08:00
|
|
|
|
|
2000-04-07 23:27:48 +08:00
|
|
|
|
ctx->cur_column = ctx->prev_prefix_len = templength;
|
1999-10-01 00:14:14 +08:00
|
|
|
|
ctx->cur_elmt = 0;
|
1999-04-27 22:47:54 +08:00
|
|
|
|
ctx->need_prefix = 0;
|
|
|
|
|
|
|
|
|
|
/* Free string */
|
|
|
|
|
h5dump_str_close(&prefix);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: h5dump_simple_data
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Prints some (NELMTS) data elements to output STREAM. The
|
|
|
|
|
* elements are stored in _MEM as type TYPE and are printed
|
|
|
|
|
* according to the format described in INFO. The CTX struct
|
|
|
|
|
* contains context information shared between calls to this
|
|
|
|
|
* function. The FLAGS is a bit field that indicates whether
|
|
|
|
|
* the data supplied in this call falls at the beginning or end
|
|
|
|
|
* of the total data to be printed (START_OF_DATA and
|
|
|
|
|
* END_OF_DATA).
|
|
|
|
|
*
|
|
|
|
|
* Return: void
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Monday, April 26, 1999
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
1999-06-07 23:05:02 +08:00
|
|
|
|
* Robb Matzke, 1999-06-04
|
|
|
|
|
* The `container' argument is the optional dataset for
|
|
|
|
|
* reference types.
|
1999-04-27 22:47:54 +08:00
|
|
|
|
*
|
1999-10-01 00:14:14 +08:00
|
|
|
|
* Robb Matzke, 1999-09-29
|
|
|
|
|
* Understands the `per_line' property which indicates that
|
|
|
|
|
* every Nth element should begin a new line.
|
|
|
|
|
*
|
1999-04-27 22:47:54 +08:00
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static void
|
1999-06-07 23:05:02 +08:00
|
|
|
|
h5dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container,
|
1999-04-27 22:47:54 +08:00
|
|
|
|
h5dump_context_t *ctx/*in,out*/, unsigned flags,
|
|
|
|
|
hsize_t nelmts, hid_t type, void *_mem)
|
|
|
|
|
{
|
|
|
|
|
unsigned char *mem = (unsigned char*)_mem;
|
|
|
|
|
hsize_t i; /*element counter */
|
|
|
|
|
char *s, *section; /*a section of output */
|
|
|
|
|
int secnum; /*section sequence number */
|
|
|
|
|
size_t size; /*size of each datum */
|
|
|
|
|
size_t ncols=80; /*available output width */
|
|
|
|
|
h5dump_str_t buffer; /*string into which to render */
|
|
|
|
|
int multiline; /*datum was multiline */
|
2000-04-07 23:27:48 +08:00
|
|
|
|
int elmt_counter=0; /*counts the # elements printed.
|
|
|
|
|
* I (ptl?) needed something that
|
|
|
|
|
* isnt going to get reset when a new
|
|
|
|
|
* line is formed. I'm going to use
|
|
|
|
|
* this var to count elements and
|
|
|
|
|
* break after we see a number equal
|
|
|
|
|
* to the ctx->size_last_dim. */
|
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
/* Setup */
|
|
|
|
|
memset(&buffer, 0, sizeof(h5dump_str_t));
|
|
|
|
|
size = H5Tget_size(type);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
|
|
|
|
if (info->line_ncols > 0)
|
|
|
|
|
ncols = info->line_ncols;
|
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
h5dump_simple_prefix(stream, info, ctx, 0, 0);
|
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
for (i = 0; i < nelmts; i++, ctx->cur_elmt++, elmt_counter++){
|
1999-04-27 22:47:54 +08:00
|
|
|
|
/* Render the element */
|
|
|
|
|
h5dump_str_reset(&buffer);
|
2000-02-15 23:45:35 +08:00
|
|
|
|
h5dump_sprint(&buffer, info, container, type, mem+i*size, ctx);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
|
|
|
|
if (i + 1 < nelmts || 0 == (flags & END_OF_DATA))
|
1999-04-27 22:47:54 +08:00
|
|
|
|
h5dump_str_append(&buffer, "%s", OPT(info->elmt_suf1, ","));
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
s = h5dump_str_fmt(&buffer, 0, "%s");
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* If the element would split on multiple lines if printed at our
|
|
|
|
|
* current location...
|
|
|
|
|
*/
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (info->line_multi_new == 1 &&
|
1999-04-27 22:47:54 +08:00
|
|
|
|
(ctx->cur_column + h5dump_ncols(s) +
|
|
|
|
|
strlen(OPT(info->elmt_suf2, " ")) +
|
2000-02-17 01:50:11 +08:00
|
|
|
|
strlen(OPT(info->line_suf, ""))) > ncols) {
|
1999-04-27 22:47:54 +08:00
|
|
|
|
if (ctx->prev_multiline) {
|
|
|
|
|
/*
|
|
|
|
|
* ... and the previous element also occupied more than one
|
|
|
|
|
* line, then start this element at the beginning of a line.
|
|
|
|
|
*/
|
|
|
|
|
ctx->need_prefix = TRUE;
|
|
|
|
|
} else if ((ctx->prev_prefix_len + h5dump_ncols(s) +
|
|
|
|
|
strlen(OPT(info->elmt_suf2, " ")) +
|
|
|
|
|
strlen(OPT(info->line_suf, ""))) <= ncols) {
|
|
|
|
|
/*
|
|
|
|
|
* ...but *could* fit on one line otherwise, then we
|
|
|
|
|
* should end the current line and start this element on its
|
|
|
|
|
* own line.
|
|
|
|
|
*/
|
|
|
|
|
ctx->need_prefix = TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-04-07 23:27:48 +08:00
|
|
|
|
/* we need to break after each row of a dimension---> we should
|
|
|
|
|
* break at the end of the each last dimension well that is the
|
|
|
|
|
* way the dumper did it before */
|
2000-02-15 23:45:35 +08:00
|
|
|
|
if (info->arr_linebreak && ctx->cur_elmt){
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if ((ctx->cur_elmt % ctx->size_last_dim) == 0)
|
2000-04-07 23:27:48 +08:00
|
|
|
|
ctx->need_prefix = TRUE;
|
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (elmt_counter == ctx->size_last_dim) {
|
2000-04-07 23:27:48 +08:00
|
|
|
|
ctx->need_prefix = TRUE;
|
|
|
|
|
elmt_counter = 0;
|
|
|
|
|
}
|
2000-02-15 23:45:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
/*
|
|
|
|
|
* If the previous element occupied multiple lines and this element
|
|
|
|
|
* is too long to fit on a line then start this element at the
|
|
|
|
|
* beginning of the line.
|
|
|
|
|
*/
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (info->line_multi_new == 1 && ctx->prev_multiline &&
|
1999-04-27 22:47:54 +08:00
|
|
|
|
(ctx->cur_column + h5dump_ncols(s) +
|
|
|
|
|
strlen(OPT(info->elmt_suf2, " ")) +
|
2000-11-01 00:32:21 +08:00
|
|
|
|
strlen(OPT(info->line_suf, ""))) > ncols)
|
1999-04-27 22:47:54 +08:00
|
|
|
|
ctx->need_prefix = TRUE;
|
1999-10-01 00:14:14 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* If too many elements have already been printed then we need to
|
|
|
|
|
* start a new line.
|
|
|
|
|
*/
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (info->line_per_line > 0 && ctx->cur_elmt >= info->line_per_line)
|
1999-10-01 00:14:14 +08:00
|
|
|
|
ctx->need_prefix = TRUE;
|
1999-04-27 22:47:54 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Each OPTIONAL_LINE_BREAK embedded in the rendered string can cause
|
|
|
|
|
* the data to split across multiple lines. We display the sections
|
|
|
|
|
* one-at a time.
|
|
|
|
|
*/
|
2000-11-01 00:32:21 +08:00
|
|
|
|
for (secnum = 0, multiline = 0;
|
|
|
|
|
(section = strtok(secnum ? NULL : s, OPTIONAL_LINE_BREAK));
|
1999-04-27 22:47:54 +08:00
|
|
|
|
secnum++) {
|
|
|
|
|
/*
|
|
|
|
|
* If the current section plus possible suffix and end-of-line
|
|
|
|
|
* information would cause the output to wrap then we need to
|
|
|
|
|
* start a new line.
|
|
|
|
|
*/
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
2000-04-07 23:27:48 +08:00
|
|
|
|
/* added the info->skip_first because the dumper does not want
|
|
|
|
|
* this check to happen for the first line */
|
|
|
|
|
if ((!info->skip_first || i) &&
|
|
|
|
|
(ctx->cur_column + strlen(section) +
|
1999-04-27 22:47:54 +08:00
|
|
|
|
strlen(OPT(info->elmt_suf2, " ")) +
|
2000-11-01 00:32:21 +08:00
|
|
|
|
strlen(OPT(info->line_suf, ""))) > ncols)
|
1999-04-27 22:47:54 +08:00
|
|
|
|
ctx->need_prefix = 1;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Print the prefix or separate the beginning of this element
|
|
|
|
|
* from the previous element.
|
|
|
|
|
*/
|
|
|
|
|
if (ctx->need_prefix) {
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (secnum)
|
|
|
|
|
multiline++;
|
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
h5dump_simple_prefix(stream, info, ctx, i, secnum);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
} else if ((i || ctx->continuation) && secnum == 0) {
|
1999-04-27 22:47:54 +08:00
|
|
|
|
fputs(OPT(info->elmt_suf2, " "), stream);
|
|
|
|
|
ctx->cur_column += strlen(OPT(info->elmt_suf2, " "));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Print the section */
|
|
|
|
|
fputs(section, stream);
|
|
|
|
|
ctx->cur_column += strlen(section);
|
|
|
|
|
}
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
ctx->prev_multiline = multiline;
|
|
|
|
|
}
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
h5dump_str_close(&buffer);
|
|
|
|
|
}
|
|
|
|
|
|
[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-06-07 23:58:05 +08:00
|
|
|
|
* This is a special case of h5dump_dset(). This function only
|
|
|
|
|
* intended for dumping datasets -- it does strip mining and
|
|
|
|
|
* some other things which are unnecessary for smaller objects
|
|
|
|
|
* such as attributes (to print small objects like attributes
|
|
|
|
|
* simply read the attribute and call h5dump_simple_mem()).
|
[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:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
1999-06-08 03:57:10 +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
|
|
|
|
static int
|
1999-01-22 02:33:39 +08:00
|
|
|
|
h5dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset,
|
2000-02-15 23:45:35 +08:00
|
|
|
|
hid_t p_type, int indentlevel)
|
[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 */
|
|
|
|
|
hsize_t elmtno, i; /*counters */
|
|
|
|
|
int carry; /*counter carry value */
|
|
|
|
|
hssize_t zero[8]; /*vector of zeros */
|
1999-04-27 22:47:54 +08:00
|
|
|
|
unsigned flags; /*buffer extent flags */
|
1999-07-15 04:05:13 +08:00
|
|
|
|
hsize_t total_size[H5S_MAX_RANK];/*total size of dataset*/
|
[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 info */
|
1999-04-27 22:47:54 +08:00
|
|
|
|
h5dump_context_t ctx; /*print context */
|
[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 */
|
|
|
|
|
|
|
|
|
|
/* 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 */
|
|
|
|
|
|
2000-04-20 07:11:06 +08:00
|
|
|
|
#if 0
|
1999-06-07 23:58:05 +08:00
|
|
|
|
hsize_t dim_n_size;
|
2000-04-20 07:11:06 +08:00
|
|
|
|
#endif
|
1999-04-27 22:47:54 +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
|
|
|
|
/*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
1999-04-27 22:47:54 +08:00
|
|
|
|
memset(&ctx, 0, sizeof ctx);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
ctx.indent_level = indentlevel;
|
|
|
|
|
ctx.indent_level = indentlevel;
|
1999-04-27 22:47:54 +08:00
|
|
|
|
ctx.need_prefix = 1;
|
1999-07-15 04:05:13 +08:00
|
|
|
|
f_space = H5Dget_space(dset);
|
1999-04-27 22:47:54 +08:00
|
|
|
|
ctx.ndims = H5Sget_simple_extent_ndims(f_space);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
|
|
|
|
if ((size_t)ctx.ndims > NELMTS(sm_size))
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
/* Assume entire data space to be printed */
|
2000-11-01 00:32:21 +08:00
|
|
|
|
for (i = 0; i < (hsize_t)ctx.ndims; i++)
|
|
|
|
|
ctx.p_min_idx[i] = 0;
|
|
|
|
|
|
1999-07-15 04:05:13 +08:00
|
|
|
|
H5Sget_simple_extent_dims(f_space, total_size, NULL);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
|
|
|
|
for (i = 0, p_nelmts = 1; i < (hsize_t)ctx.ndims; i++)
|
1999-07-15 04:05:13 +08:00
|
|
|
|
p_nelmts *= total_size[i];
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
|
|
|
|
if (p_nelmts == 0)
|
|
|
|
|
return 0; /*nothing to print*/
|
|
|
|
|
|
|
|
|
|
ctx.size_last_dim = total_size[ctx.ndims - 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
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* 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);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
|
|
|
|
for (i = ctx.ndims, sm_nbytes = p_type_nbytes; i > 0; --i) {
|
|
|
|
|
sm_size[i - 1] = MIN (total_size[i - 1], H5DUMP_BUFSIZE / sm_nbytes);
|
|
|
|
|
sm_nbytes *= sm_size[i - 1];
|
|
|
|
|
assert(sm_nbytes > 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
|
|
|
|
}
|
2000-11-01 00:32:21 +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
|
|
|
|
sm_buf = malloc(sm_nbytes);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
sm_nelmts = sm_nbytes / p_type_nbytes;
|
[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
|
|
|
|
sm_space = H5Screate_simple(1, &sm_nelmts, NULL);
|
|
|
|
|
|
|
|
|
|
/* The stripmine loop */
|
|
|
|
|
memset(hs_offset, 0, sizeof hs_offset);
|
|
|
|
|
memset(zero, 0, sizeof zero);
|
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_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
|
|
|
|
/* Calculate the hyperslab size */
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (ctx.ndims > 0) {
|
|
|
|
|
for (i = 0, hs_nelmts = 1; i < (hsize_t)ctx.ndims; i++) {
|
1999-07-15 04:05:13 +08:00
|
|
|
|
hs_size[i] = MIN(total_size[i]-hs_offset[i], sm_size[i]);
|
|
|
|
|
ctx.p_max_idx[i] = ctx.p_min_idx[i] + hs_size[i];
|
1998-10-02 21:31:24 +08:00
|
|
|
|
hs_nelmts *= hs_size[i];
|
|
|
|
|
}
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
1998-10-02 21:31:24 +08:00
|
|
|
|
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 */
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0)
|
|
|
|
|
return -1;
|
1999-07-15 04:05:13 +08:00
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
/* Print the data */
|
2000-11-01 00:32:21 +08:00
|
|
|
|
flags = ((elmtno == 0 ? START_OF_DATA : 0) |
|
|
|
|
|
(elmtno + hs_nelmts >= p_nelmts ? END_OF_DATA : 0));
|
2000-04-07 23:27:48 +08:00
|
|
|
|
h5dump_simple_data(stream, info, dset, &ctx, flags, hs_nelmts,
|
|
|
|
|
p_type, sm_buf);
|
2000-02-15 23:45:35 +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
|
|
|
|
/* Calculate the next hyperslab offset */
|
2000-11-01 00:32:21 +08:00
|
|
|
|
for (i = ctx.ndims, carry = 1; i > 0 && carry; --i) {
|
|
|
|
|
ctx.p_min_idx[i - 1] = ctx.p_max_idx[i - 1];
|
|
|
|
|
hs_offset[i - 1] += hs_size[i - 1];
|
|
|
|
|
|
|
|
|
|
if (hs_offset[i - 1] == (hssize_t)total_size[i - 1])
|
1999-07-15 04:05:13 +08:00
|
|
|
|
hs_offset[i-1] = 0;
|
2000-11-01 00:32:21 +08:00
|
|
|
|
else
|
[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
|
|
|
|
carry = 0;
|
|
|
|
|
}
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
1999-07-15 04:05:13 +08:00
|
|
|
|
ctx.continuation++;
|
[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-04-27 22:47:54 +08:00
|
|
|
|
/* Terminate the output */
|
|
|
|
|
if (ctx.cur_column) {
|
[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
|
|
|
|
fputs(OPT(info->line_suf, ""), stream);
|
|
|
|
|
putc('\n', stream);
|
|
|
|
|
fputs(OPT(info->line_sep, ""), stream);
|
|
|
|
|
}
|
2000-11-01 00:32:21 +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
|
|
|
|
H5Sclose(sm_space);
|
|
|
|
|
H5Sclose(f_space);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
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,
|
2000-02-15 23:45:35 +08:00
|
|
|
|
hid_t space, void *mem, int indentlevel)
|
1999-01-22 02:33:39 +08:00
|
|
|
|
{
|
|
|
|
|
hsize_t i; /*counters */
|
1999-04-27 22:47:54 +08:00
|
|
|
|
hsize_t nelmts; /*total selected elmts */
|
2000-06-24 01:52:21 +08:00
|
|
|
|
h5dump_context_t ctx; /*printing context */
|
2000-02-15 23:45:35 +08:00
|
|
|
|
|
1999-01-22 02:33:39 +08:00
|
|
|
|
/*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
2000-11-01 00:32:21 +08:00
|
|
|
|
memset(&ctx, 0, sizeof(ctx));
|
|
|
|
|
ctx.indent_level = indentlevel;
|
1999-04-27 22:47:54 +08:00
|
|
|
|
ctx.need_prefix = 1;
|
|
|
|
|
ctx.ndims = H5Sget_simple_extent_ndims(space);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
|
|
|
|
if ((size_t)ctx.ndims > NELMTS(ctx.p_min_idx))
|
|
|
|
|
return -1;
|
1999-01-22 02:33:39 +08:00
|
|
|
|
|
|
|
|
|
/* Assume entire data space to be printed */
|
2000-11-01 00:32:21 +08:00
|
|
|
|
for (i = 0; i < (hsize_t)ctx.ndims; i++)
|
|
|
|
|
ctx.p_min_idx[i] = 0;
|
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
H5Sget_simple_extent_dims(space, ctx.p_max_idx, NULL);
|
2000-02-15 23:45:35 +08:00
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
for (i = 0, nelmts = 1; ctx.ndims != 0 && i < (hsize_t)ctx.ndims; i++)
|
1999-04-27 22:47:54 +08:00
|
|
|
|
nelmts *= ctx.p_max_idx[i] - ctx.p_min_idx[i];
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
|
|
|
|
if (nelmts == 0)
|
|
|
|
|
return 0; /*nothing to print*/
|
1999-01-22 02:33:39 +08:00
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
ctx.size_last_dim = ctx.p_max_idx[ctx.ndims - 1];
|
2000-04-07 23:27:48 +08:00
|
|
|
|
ctx.indent_level = indentlevel;
|
2000-02-15 23:45:35 +08:00
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
/* Print it */
|
1999-06-07 23:05:02 +08:00
|
|
|
|
h5dump_simple_data(stream, info, -1/*no dataset*/, &ctx,
|
|
|
|
|
START_OF_DATA|END_OF_DATA, nelmts, type, mem);
|
1999-01-22 02:33:39 +08:00
|
|
|
|
|
1999-04-27 22:47:54 +08:00
|
|
|
|
/* Terminate the output */
|
|
|
|
|
if (ctx.cur_column) {
|
1999-01-22 02:33:39 +08:00
|
|
|
|
fputs(OPT(info->line_suf, ""), stream);
|
|
|
|
|
putc('\n', stream);
|
|
|
|
|
fputs(OPT(info->line_sep, ""), stream);
|
|
|
|
|
}
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
1999-01-22 02:33:39 +08:00
|
|
|
|
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-06-07 23:05:02 +08:00
|
|
|
|
* Robb Matzke, 1999-06-04
|
|
|
|
|
* Added support for references.
|
1998-07-24 22:28:32 +08:00
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
1999-06-04 23:49:55 +08:00
|
|
|
|
|
1999-01-22 02:33:39 +08:00
|
|
|
|
hid_t
|
1999-06-04 23:49:55 +08:00
|
|
|
|
h5dump_fixtype(hid_t f_type)
|
1998-07-24 22:28:32 +08:00
|
|
|
|
{
|
1999-06-03 02:11:21 +08:00
|
|
|
|
hid_t m_type = FAIL, f_memb;
|
|
|
|
|
hid_t *memb = NULL;
|
|
|
|
|
char **name = NULL;
|
2000-10-26 03:07:05 +08:00
|
|
|
|
int nmembs = 0, i, *ndims = NULL;
|
1999-06-03 02:11:21 +08:00
|
|
|
|
size_t size, offset, *dims = NULL, nelmts;
|
2000-08-05 04:41:26 +08:00
|
|
|
|
/* H5T_str_t strpad; */
|
1998-07-24 22:28:32 +08:00
|
|
|
|
|
|
|
|
|
size = H5Tget_size(f_type);
|
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
switch (H5Tget_class(f_type)) {
|
1998-07-24 22:28:32 +08:00
|
|
|
|
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.
|
|
|
|
|
*/
|
[svn-r2634] Purpose:
Bug fix
Description:
In the h5dump_fixtype function, when users created a COMPOUND
datatype, the alignment would be off somewhat.
Solution:
The alignment was being set after insertion. I changed this code:
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]);
}
to:
for (i = 0, offset = 0; i < nmembs; i++) {
if (offset)
offset = ALIGN(offset, H5Tget_size(memb[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 += nelmts * H5Tget_size(memb[i]);
}
The alignment is now calculated before the insertion.
Platforms tested:
Solaris, Linux
2000-10-06 00:56:30 +08:00
|
|
|
|
if (size <= sizeof(char)) {
|
1998-11-26 01:21:21 +08:00
|
|
|
|
m_type = H5Tcopy(H5T_NATIVE_SCHAR);
|
[svn-r2634] Purpose:
Bug fix
Description:
In the h5dump_fixtype function, when users created a COMPOUND
datatype, the alignment would be off somewhat.
Solution:
The alignment was being set after insertion. I changed this code:
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]);
}
to:
for (i = 0, offset = 0; i < nmembs; i++) {
if (offset)
offset = ALIGN(offset, H5Tget_size(memb[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 += nelmts * H5Tget_size(memb[i]);
}
The alignment is now calculated before the insertion.
Platforms tested:
Solaris, Linux
2000-10-06 00:56:30 +08:00
|
|
|
|
} else if (size <= sizeof(short)) {
|
1998-07-24 22:28:32 +08:00
|
|
|
|
m_type = H5Tcopy(H5T_NATIVE_SHORT);
|
[svn-r2634] Purpose:
Bug fix
Description:
In the h5dump_fixtype function, when users created a COMPOUND
datatype, the alignment would be off somewhat.
Solution:
The alignment was being set after insertion. I changed this code:
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]);
}
to:
for (i = 0, offset = 0; i < nmembs; i++) {
if (offset)
offset = ALIGN(offset, H5Tget_size(memb[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 += nelmts * H5Tget_size(memb[i]);
}
The alignment is now calculated before the insertion.
Platforms tested:
Solaris, Linux
2000-10-06 00:56:30 +08:00
|
|
|
|
} else if (size <= sizeof(int)) {
|
1998-07-24 22:28:32 +08:00
|
|
|
|
m_type = H5Tcopy(H5T_NATIVE_INT);
|
[svn-r2634] Purpose:
Bug fix
Description:
In the h5dump_fixtype function, when users created a COMPOUND
datatype, the alignment would be off somewhat.
Solution:
The alignment was being set after insertion. I changed this code:
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]);
}
to:
for (i = 0, offset = 0; i < nmembs; i++) {
if (offset)
offset = ALIGN(offset, H5Tget_size(memb[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 += nelmts * H5Tget_size(memb[i]);
}
The alignment is now calculated before the insertion.
Platforms tested:
Solaris, Linux
2000-10-06 00:56:30 +08:00
|
|
|
|
} else if (size <= sizeof(long)) {
|
1998-07-24 22:28:32 +08:00
|
|
|
|
m_type = H5Tcopy(H5T_NATIVE_LONG);
|
|
|
|
|
} else {
|
|
|
|
|
m_type = H5Tcopy(H5T_NATIVE_LLONG);
|
|
|
|
|
}
|
[svn-r2634] Purpose:
Bug fix
Description:
In the h5dump_fixtype function, when users created a COMPOUND
datatype, the alignment would be off somewhat.
Solution:
The alignment was being set after insertion. I changed this code:
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]);
}
to:
for (i = 0, offset = 0; i < nmembs; i++) {
if (offset)
offset = ALIGN(offset, H5Tget_size(memb[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 += nelmts * H5Tget_size(memb[i]);
}
The alignment is now calculated before the insertion.
Platforms tested:
Solaris, Linux
2000-10-06 00:56:30 +08:00
|
|
|
|
|
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.
|
|
|
|
|
*/
|
[svn-r2634] Purpose:
Bug fix
Description:
In the h5dump_fixtype function, when users created a COMPOUND
datatype, the alignment would be off somewhat.
Solution:
The alignment was being set after insertion. I changed this code:
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]);
}
to:
for (i = 0, offset = 0; i < nmembs; i++) {
if (offset)
offset = ALIGN(offset, H5Tget_size(memb[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 += nelmts * H5Tget_size(memb[i]);
}
The alignment is now calculated before the insertion.
Platforms tested:
Solaris, Linux
2000-10-06 00:56:30 +08:00
|
|
|
|
if (size <= sizeof(float)) {
|
1998-07-24 22:28:32 +08:00
|
|
|
|
m_type = H5Tcopy(H5T_NATIVE_FLOAT);
|
[svn-r2634] Purpose:
Bug fix
Description:
In the h5dump_fixtype function, when users created a COMPOUND
datatype, the alignment would be off somewhat.
Solution:
The alignment was being set after insertion. I changed this code:
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]);
}
to:
for (i = 0, offset = 0; i < nmembs; i++) {
if (offset)
offset = ALIGN(offset, H5Tget_size(memb[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 += nelmts * H5Tget_size(memb[i]);
}
The alignment is now calculated before the insertion.
Platforms tested:
Solaris, Linux
2000-10-06 00:56:30 +08:00
|
|
|
|
} else if (size <= sizeof(double)) {
|
1998-07-24 22:28:32 +08:00
|
|
|
|
m_type = H5Tcopy(H5T_NATIVE_DOUBLE);
|
|
|
|
|
} else {
|
|
|
|
|
m_type = H5Tcopy(H5T_NATIVE_LDOUBLE);
|
|
|
|
|
}
|
[svn-r2634] Purpose:
Bug fix
Description:
In the h5dump_fixtype function, when users created a COMPOUND
datatype, the alignment would be off somewhat.
Solution:
The alignment was being set after insertion. I changed this code:
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]);
}
to:
for (i = 0, offset = 0; i < nmembs; i++) {
if (offset)
offset = ALIGN(offset, H5Tget_size(memb[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 += nelmts * H5Tget_size(memb[i]);
}
The alignment is now calculated before the insertion.
Platforms tested:
Solaris, Linux
2000-10-06 00:56:30 +08:00
|
|
|
|
|
1998-07-24 22:28:32 +08:00
|
|
|
|
break;
|
1999-05-13 23:18:12 +08:00
|
|
|
|
|
1998-09-22 23:27:26 +08:00
|
|
|
|
case H5T_STRING:
|
1999-06-07 23:58:05 +08:00
|
|
|
|
/*
|
|
|
|
|
* This is needed because the function in dumputil.c is the case where
|
|
|
|
|
* strDUAction == TRUE. if it is false we will do the original action
|
|
|
|
|
* here.
|
|
|
|
|
*/
|
[svn-r2634] Purpose:
Bug fix
Description:
In the h5dump_fixtype function, when users created a COMPOUND
datatype, the alignment would be off somewhat.
Solution:
The alignment was being set after insertion. I changed this code:
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]);
}
to:
for (i = 0, offset = 0; i < nmembs; i++) {
if (offset)
offset = ALIGN(offset, H5Tget_size(memb[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 += nelmts * H5Tget_size(memb[i]);
}
The alignment is now calculated before the insertion.
Platforms tested:
Solaris, Linux
2000-10-06 00:56:30 +08:00
|
|
|
|
m_type = H5Tcopy(f_type);
|
|
|
|
|
H5Tset_cset(m_type, H5T_CSET_ASCII);
|
1998-09-22 23:27:26 +08:00
|
|
|
|
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));
|
[svn-r2634] Purpose:
Bug fix
Description:
In the h5dump_fixtype function, when users created a COMPOUND
datatype, the alignment would be off somewhat.
Solution:
The alignment was being set after insertion. I changed this code:
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]);
}
to:
for (i = 0, offset = 0; i < nmembs; i++) {
if (offset)
offset = ALIGN(offset, H5Tget_size(memb[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 += nelmts * H5Tget_size(memb[i]);
}
The alignment is now calculated before the insertion.
Platforms tested:
Solaris, Linux
2000-10-06 00:56:30 +08:00
|
|
|
|
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
|
|
|
|
|
[svn-r2634] Purpose:
Bug fix
Description:
In the h5dump_fixtype function, when users created a COMPOUND
datatype, the alignment would be off somewhat.
Solution:
The alignment was being set after insertion. I changed this code:
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]);
}
to:
for (i = 0, offset = 0; i < nmembs; i++) {
if (offset)
offset = ALIGN(offset, H5Tget_size(memb[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 += nelmts * H5Tget_size(memb[i]);
}
The alignment is now calculated before the insertion.
Platforms tested:
Solaris, Linux
2000-10-06 00:56:30 +08:00
|
|
|
|
for (i = 0, size = 0; i < nmembs; i++) {
|
2000-10-26 03:07:05 +08:00
|
|
|
|
int j;
|
|
|
|
|
|
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);
|
1999-06-04 23:49:55 +08:00
|
|
|
|
memb[i] = h5dump_fixtype(f_memb);
|
1998-07-24 22:28:32 +08:00
|
|
|
|
H5Tclose(f_memb);
|
[svn-r2634] Purpose:
Bug fix
Description:
In the h5dump_fixtype function, when users created a COMPOUND
datatype, the alignment would be off somewhat.
Solution:
The alignment was being set after insertion. I changed this code:
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]);
}
to:
for (i = 0, offset = 0; i < nmembs; i++) {
if (offset)
offset = ALIGN(offset, H5Tget_size(memb[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 += nelmts * H5Tget_size(memb[i]);
}
The alignment is now calculated before the insertion.
Platforms tested:
Solaris, Linux
2000-10-06 00:56:30 +08:00
|
|
|
|
|
|
|
|
|
if (memb[i] < 0)
|
2000-11-01 00:32:21 +08:00
|
|
|
|
goto done;
|
1998-07-30 00:43:59 +08:00
|
|
|
|
|
|
|
|
|
/* Get the member dimensions */
|
[svn-r2634] Purpose:
Bug fix
Description:
In the h5dump_fixtype function, when users created a COMPOUND
datatype, the alignment would be off somewhat.
Solution:
The alignment was being set after insertion. I changed this code:
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]);
}
to:
for (i = 0, offset = 0; i < nmembs; i++) {
if (offset)
offset = ALIGN(offset, H5Tget_size(memb[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 += nelmts * H5Tget_size(memb[i]);
}
The alignment is now calculated before the insertion.
Platforms tested:
Solaris, Linux
2000-10-06 00:56:30 +08:00
|
|
|
|
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++)
|
2000-11-01 00:32:21 +08:00
|
|
|
|
nelmts *= dims[i * 4 + j];
|
1998-07-30 00:43:59 +08:00
|
|
|
|
|
|
|
|
|
/* Get the member name */
|
1998-07-24 22:28:32 +08:00
|
|
|
|
name[i] = H5Tget_member_name(f_type, i);
|
[svn-r2634] Purpose:
Bug fix
Description:
In the h5dump_fixtype function, when users created a COMPOUND
datatype, the alignment would be off somewhat.
Solution:
The alignment was being set after insertion. I changed this code:
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]);
}
to:
for (i = 0, offset = 0; i < nmembs; i++) {
if (offset)
offset = ALIGN(offset, H5Tget_size(memb[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 += nelmts * H5Tget_size(memb[i]);
}
The alignment is now calculated before the insertion.
Platforms tested:
Solaris, Linux
2000-10-06 00:56:30 +08:00
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (name[i] == NULL)
|
|
|
|
|
goto done;
|
1998-07-30 00:43:59 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* 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])) +
|
[svn-r2634] Purpose:
Bug fix
Description:
In the h5dump_fixtype function, when users created a COMPOUND
datatype, the alignment would be off somewhat.
Solution:
The alignment was being set after insertion. I changed this code:
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]);
}
to:
for (i = 0, offset = 0; i < nmembs; i++) {
if (offset)
offset = ALIGN(offset, H5Tget_size(memb[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 += nelmts * H5Tget_size(memb[i]);
}
The alignment is now calculated before the insertion.
Platforms tested:
Solaris, Linux
2000-10-06 00:56:30 +08:00
|
|
|
|
nelmts * H5Tget_size(memb[i]);
|
1998-07-24 22:28:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_type = H5Tcreate(H5T_COMPOUND, size);
|
[svn-r2634] Purpose:
Bug fix
Description:
In the h5dump_fixtype function, when users created a COMPOUND
datatype, the alignment would be off somewhat.
Solution:
The alignment was being set after insertion. I changed this code:
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]);
}
to:
for (i = 0, offset = 0; i < nmembs; i++) {
if (offset)
offset = ALIGN(offset, H5Tget_size(memb[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 += nelmts * H5Tget_size(memb[i]);
}
The alignment is now calculated before the insertion.
Platforms tested:
Solaris, Linux
2000-10-06 00:56:30 +08:00
|
|
|
|
|
|
|
|
|
for (i = 0, offset = 0; i < nmembs; i++) {
|
2000-10-26 03:07:05 +08:00
|
|
|
|
int j;
|
|
|
|
|
|
[svn-r2634] Purpose:
Bug fix
Description:
In the h5dump_fixtype function, when users created a COMPOUND
datatype, the alignment would be off somewhat.
Solution:
The alignment was being set after insertion. I changed this code:
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]);
}
to:
for (i = 0, offset = 0; i < nmembs; i++) {
if (offset)
offset = ALIGN(offset, H5Tget_size(memb[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 += nelmts * H5Tget_size(memb[i]);
}
The alignment is now calculated before the insertion.
Platforms tested:
Solaris, Linux
2000-10-06 00:56:30 +08:00
|
|
|
|
if (offset)
|
|
|
|
|
offset = ALIGN(offset, H5Tget_size(memb[i]));
|
|
|
|
|
|
|
|
|
|
H5Tinsert_array(m_type, name[i], offset, ndims[i], dims + i * 4,
|
1998-07-30 00:43:59 +08:00
|
|
|
|
NULL, memb[i]);
|
[svn-r2634] Purpose:
Bug fix
Description:
In the h5dump_fixtype function, when users created a COMPOUND
datatype, the alignment would be off somewhat.
Solution:
The alignment was being set after insertion. I changed this code:
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]);
}
to:
for (i = 0, offset = 0; i < nmembs; i++) {
if (offset)
offset = ALIGN(offset, H5Tget_size(memb[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 += nelmts * H5Tget_size(memb[i]);
}
The alignment is now calculated before the insertion.
Platforms tested:
Solaris, Linux
2000-10-06 00:56:30 +08:00
|
|
|
|
|
|
|
|
|
for (j = 0, nelmts = 1; j < ndims[i]; j++)
|
|
|
|
|
nelmts *= dims[i * 4 + j];
|
|
|
|
|
|
|
|
|
|
offset += nelmts * H5Tget_size(memb[i]);
|
1998-07-24 22:28:32 +08:00
|
|
|
|
}
|
[svn-r2634] Purpose:
Bug fix
Description:
In the h5dump_fixtype function, when users created a COMPOUND
datatype, the alignment would be off somewhat.
Solution:
The alignment was being set after insertion. I changed this code:
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]);
}
to:
for (i = 0, offset = 0; i < nmembs; i++) {
if (offset)
offset = ALIGN(offset, H5Tget_size(memb[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 += nelmts * H5Tget_size(memb[i]);
}
The alignment is now calculated before the insertion.
Platforms tested:
Solaris, Linux
2000-10-06 00:56:30 +08:00
|
|
|
|
|
1998-07-24 22:28:32 +08:00
|
|
|
|
break;
|
|
|
|
|
|
1999-01-07 19:42:27 +08:00
|
|
|
|
case H5T_ENUM:
|
1999-06-07 23:05:02 +08:00
|
|
|
|
case H5T_REFERENCE:
|
1999-06-08 04:20:32 +08:00
|
|
|
|
case H5T_OPAQUE:
|
2000-10-26 03:07:05 +08:00
|
|
|
|
case H5T_VLEN:
|
1999-06-08 04:20:32 +08:00
|
|
|
|
/* Same as file type */
|
1999-01-07 19:42:27 +08:00
|
|
|
|
m_type = H5Tcopy(f_type);
|
|
|
|
|
break;
|
|
|
|
|
|
1998-07-24 22:28:32 +08:00
|
|
|
|
case H5T_BITFIELD:
|
1999-06-08 04:20:32 +08:00
|
|
|
|
/*
|
|
|
|
|
* Same as the file except the offset is set to zero and the byte
|
|
|
|
|
* order is set to little endian.
|
|
|
|
|
*/
|
|
|
|
|
m_type = H5Tcopy(f_type);
|
|
|
|
|
H5Tset_offset(m_type, 0);
|
|
|
|
|
H5Tset_order(m_type, H5T_ORDER_LE);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case H5T_TIME:
|
1998-07-24 22:28:32 +08:00
|
|
|
|
/*
|
|
|
|
|
* 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) {
|
2000-10-26 03:07:05 +08:00
|
|
|
|
int j;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < nmembs; j++) {
|
|
|
|
|
if (memb[j] >= 0)
|
|
|
|
|
H5Tclose(memb[j]);
|
|
|
|
|
|
|
|
|
|
if (name[j])
|
|
|
|
|
free(name[j]);
|
1998-07-24 22:28:32 +08:00
|
|
|
|
}
|
2000-10-26 03:07:05 +08:00
|
|
|
|
|
1998-07-24 22:28:32 +08:00
|
|
|
|
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
|
|
|
|
*
|
1999-06-07 23:58:05 +08:00
|
|
|
|
* Note: This function is intended only for datasets since it does
|
|
|
|
|
* some things like strip mining which are unnecessary for
|
|
|
|
|
* smaller objects such as attributes. The easiest way to print
|
|
|
|
|
* small objects is to read the object into memory and call
|
|
|
|
|
* h5dump_mem().
|
|
|
|
|
*
|
[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:
|
1999-06-07 23:58:05 +08:00
|
|
|
|
* Robb Matzke, 1999-06-07
|
|
|
|
|
* If info->raw is set then the memory datatype will be the same
|
|
|
|
|
* as the file datatype.
|
[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
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
int
|
2000-06-24 01:52:21 +08:00
|
|
|
|
h5dump_dset(FILE *stream, const h5dump_t *info, hid_t dset, hid_t _p_type,
|
|
|
|
|
int indentlevel)
|
[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;
|
2000-10-26 03:07:05 +08:00
|
|
|
|
int status = -1;
|
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 */
|
2000-10-26 03:07:05 +08:00
|
|
|
|
if (!stream)
|
|
|
|
|
stream = stdout;
|
|
|
|
|
|
1998-07-30 00:43:59 +08:00
|
|
|
|
if (!info) {
|
|
|
|
|
memset(&info_dflt, 0, sizeof info_dflt);
|
|
|
|
|
info = &info_dflt;
|
|
|
|
|
}
|
2000-10-26 03:07:05 +08:00
|
|
|
|
|
|
|
|
|
if (p_type < 0) {
|
1998-07-24 22:28:32 +08:00
|
|
|
|
f_type = H5Dget_type(dset);
|
2000-10-26 03:07:05 +08:00
|
|
|
|
|
|
|
|
|
if (info->raw)
|
1999-06-07 23:58:05 +08:00
|
|
|
|
p_type = H5Tcopy(f_type);
|
2000-10-26 03:07:05 +08:00
|
|
|
|
else
|
1999-06-07 23:58:05 +08:00
|
|
|
|
p_type = h5dump_fixtype(f_type);
|
2000-10-26 03:07:05 +08:00
|
|
|
|
|
1998-07-24 22:28:32 +08:00
|
|
|
|
H5Tclose(f_type);
|
2000-10-26 03:07:05 +08:00
|
|
|
|
|
|
|
|
|
if (p_type < 0)
|
|
|
|
|
goto done;
|
1998-07-24 22:28:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
1998-07-30 00:43:59 +08:00
|
|
|
|
/* Check the data space */
|
|
|
|
|
f_space = H5Dget_space(dset);
|
|
|
|
|
|
1998-07-24 22:28:32 +08:00
|
|
|
|
/* Print the data */
|
2000-10-26 03:07:05 +08:00
|
|
|
|
if (H5Sis_simple(f_space) > 0) {
|
|
|
|
|
/* Probably a compound datatype or something... */
|
|
|
|
|
if (H5Tget_class(p_type) == H5T_VLEN) {
|
|
|
|
|
/* Nope...variable length. Try to dump it */
|
|
|
|
|
status = h5dump_vlen_dset(rawdatastream, info, dset, p_type,
|
|
|
|
|
indentlevel);
|
|
|
|
|
} else {
|
|
|
|
|
status = h5dump_simple_dset(rawdatastream, info, dset, p_type,
|
|
|
|
|
indentlevel);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
if (p_type != _p_type)
|
|
|
|
|
H5Tclose(p_type);
|
|
|
|
|
|
1998-07-24 22:28:32 +08:00
|
|
|
|
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
|
|
|
|
|
2000-10-26 03:07:05 +08:00
|
|
|
|
static
|
|
|
|
|
void *vlcustom_alloc(size_t size, void *info)
|
|
|
|
|
{
|
2000-11-01 00:32:21 +08:00
|
|
|
|
void *ret_value = NULL;
|
|
|
|
|
int *mem_used = (int *)info;
|
|
|
|
|
size_t extra = MAX(sizeof(void *), sizeof(size_t));
|
2000-10-26 03:07:05 +08:00
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if ((ret_value = HDmalloc(extra + size)) != NULL) {
|
|
|
|
|
*(size_t *)ret_value = size;
|
|
|
|
|
*mem_used += size;
|
|
|
|
|
}
|
2000-10-26 03:07:05 +08:00
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
ret_value = ((unsigned char *)ret_value) + extra;
|
|
|
|
|
return ret_value;
|
2000-10-26 03:07:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static
|
|
|
|
|
void vlcustom_free(void *_mem, void *info)
|
|
|
|
|
{
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (_mem) {
|
|
|
|
|
int *mem_used = (int *)info;
|
|
|
|
|
size_t extra = MAX(sizeof(void *), sizeof(size_t));
|
|
|
|
|
unsigned char *mem = ((unsigned char *)_mem) - extra;
|
2000-10-26 03:07:05 +08:00
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
*mem_used -= *(size_t *)mem;
|
|
|
|
|
HDfree(mem);
|
|
|
|
|
}
|
2000-10-26 03:07:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
h5dump_vlen_dset(FILE *stream, const h5dump_t *info, hid_t dset,
|
|
|
|
|
hid_t type, int indentlevel)
|
|
|
|
|
{
|
|
|
|
|
hvl_t *rdata = NULL; /*information to read in */
|
|
|
|
|
hid_t base_type; /*the base type of the VL data */
|
|
|
|
|
hid_t xfer_pid; /*dataset transfer property list id */
|
|
|
|
|
hid_t f_space; /*file data space */
|
|
|
|
|
hsize_t dims[H5S_MAX_RANK]; /*size of the dimensions */
|
|
|
|
|
const char *bad_type;
|
2000-11-01 00:32:21 +08:00
|
|
|
|
hsize_t mem_needed;
|
2000-10-26 03:07:05 +08:00
|
|
|
|
size_t ncols = 80;
|
|
|
|
|
herr_t ret;
|
|
|
|
|
|
|
|
|
|
/* Print info */
|
|
|
|
|
size_t size; /*size of memory type */
|
|
|
|
|
hsize_t p_nelmts; /*total selected elmts */
|
|
|
|
|
int mem_used = 0;
|
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
|
|
base_type = H5Tget_super(type);
|
|
|
|
|
xfer_pid = H5Pcreate(H5P_DATA_XFER);
|
|
|
|
|
|
|
|
|
|
if (xfer_pid == FAIL)
|
|
|
|
|
return FAIL;
|
|
|
|
|
|
|
|
|
|
ret = H5Pset_vlen_mem_manager(xfer_pid, vlcustom_alloc, &mem_used,
|
|
|
|
|
vlcustom_free, &mem_used);
|
|
|
|
|
|
|
|
|
|
if (ret == FAIL) {
|
|
|
|
|
H5Pclose(xfer_pid);
|
|
|
|
|
return FAIL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
f_space = H5Dget_space(dset);
|
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if ((size_t)H5Sget_simple_extent_ndims(f_space) > 1) {
|
|
|
|
|
fprintf(stream,
|
|
|
|
|
"Multidimensional variable length datatypes not supported\n");
|
2000-10-26 03:07:05 +08:00
|
|
|
|
ret = FAIL;
|
|
|
|
|
goto done;
|
|
|
|
|
}
|
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
H5Dvlen_get_buf_size(dset, type, f_space, &mem_needed);
|
|
|
|
|
|
2000-10-26 03:07:05 +08:00
|
|
|
|
H5Sget_simple_extent_dims(f_space, dims, NULL);
|
|
|
|
|
rdata = HDmalloc(dims[0] * sizeof(hvl_t));
|
|
|
|
|
|
|
|
|
|
if (!rdata) {
|
|
|
|
|
ret = FAIL;
|
|
|
|
|
goto done;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ret = H5Dread(dset, type, H5S_ALL, H5S_ALL, xfer_pid, rdata);
|
|
|
|
|
|
|
|
|
|
if (info->line_ncols > 0)
|
|
|
|
|
ncols = info->line_ncols;
|
|
|
|
|
|
|
|
|
|
size = H5Tget_size(base_type);
|
|
|
|
|
|
|
|
|
|
recheck:
|
|
|
|
|
switch (H5Tget_class(base_type)) {
|
|
|
|
|
case H5T_INTEGER:
|
|
|
|
|
case H5T_FLOAT:
|
|
|
|
|
/* These are the types we can actually handle */
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case H5T_VLEN: {
|
|
|
|
|
hid_t tmp_type = base_type;
|
|
|
|
|
|
|
|
|
|
base_type = H5Tget_super(base_type);
|
|
|
|
|
H5Tclose(tmp_type);
|
|
|
|
|
goto recheck;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case H5T_STRING:
|
|
|
|
|
bad_type = "H5T_STRING";
|
|
|
|
|
case H5T_COMPOUND:
|
|
|
|
|
if (!bad_type)
|
|
|
|
|
bad_type = "H5T_COMPOUND";
|
|
|
|
|
case H5T_ENUM:
|
|
|
|
|
if (!bad_type)
|
|
|
|
|
bad_type = "H5T_ENUM";
|
|
|
|
|
case H5T_REFERENCE:
|
|
|
|
|
if (!bad_type)
|
|
|
|
|
bad_type = "H5T_REFERENCE";
|
|
|
|
|
case H5T_OPAQUE:
|
|
|
|
|
if (!bad_type)
|
|
|
|
|
bad_type = "H5T_OPAQUE";
|
|
|
|
|
case H5T_BITFIELD:
|
|
|
|
|
if (!bad_type)
|
|
|
|
|
bad_type = "H5T_BITFIELD";
|
|
|
|
|
case H5T_TIME:
|
|
|
|
|
if (!bad_type)
|
|
|
|
|
bad_type = "H5T_TIME";
|
|
|
|
|
default:
|
2000-11-01 00:32:21 +08:00
|
|
|
|
fprintf(stream,
|
|
|
|
|
"Dumper doesn't support %s variable length datatype at this time\n",
|
|
|
|
|
bad_type ? bad_type : "(null)");
|
2000-10-26 03:07:05 +08:00
|
|
|
|
goto done;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < dims[0]; i++) {
|
|
|
|
|
hsize_t j;
|
|
|
|
|
|
|
|
|
|
p_nelmts = rdata[i].len;
|
|
|
|
|
|
|
|
|
|
#define OUTPUT_ELEMENTS(type, fmt) { \
|
|
|
|
|
unsigned char *_data = (unsigned char *)rdata[i].p; \
|
|
|
|
|
\
|
|
|
|
|
indentation(indent + COL); \
|
|
|
|
|
for (j = 0; j < p_nelmts; j++, _data += size) { \
|
|
|
|
|
fprintf(stream, "%" ## fmt ## "%s", *(type *)_data, \
|
|
|
|
|
j == p_nelmts - 1 ? "\n" : ", "); \
|
|
|
|
|
} \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (H5Tget_class(base_type)) {
|
|
|
|
|
case H5T_INTEGER:
|
|
|
|
|
if (H5Tget_sign(base_type) == H5T_SGN_NONE) {
|
|
|
|
|
if (size <= sizeof(unsigned char)) {
|
|
|
|
|
OUTPUT_ELEMENTS(unsigned char, "c");
|
|
|
|
|
} else if (size <= sizeof(unsigned short)) {
|
|
|
|
|
OUTPUT_ELEMENTS(unsigned short, "dhu");
|
|
|
|
|
} else if (size <= sizeof(unsigned int)) {
|
|
|
|
|
OUTPUT_ELEMENTS(unsigned int, "u");
|
|
|
|
|
} else if (size <= sizeof(unsigned long)) {
|
|
|
|
|
OUTPUT_ELEMENTS(unsigned long, "lu");
|
|
|
|
|
} else {
|
|
|
|
|
OUTPUT_ELEMENTS(unsigned long_long, PRINTF_LL_WIDTH "u");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (size <= sizeof(char)) {
|
|
|
|
|
OUTPUT_ELEMENTS(char, "c");
|
|
|
|
|
} else if (size <= sizeof(short)) {
|
|
|
|
|
OUTPUT_ELEMENTS(short, "dh");
|
|
|
|
|
} else if (size <= sizeof(int)) {
|
|
|
|
|
OUTPUT_ELEMENTS(int, "d");
|
|
|
|
|
} else if (size <= sizeof(long)) {
|
|
|
|
|
OUTPUT_ELEMENTS(long, "ld");
|
|
|
|
|
} else {
|
|
|
|
|
OUTPUT_ELEMENTS(long_long, PRINTF_LL_WIDTH "d");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case H5T_FLOAT:
|
|
|
|
|
if (size <= sizeof(float)) {
|
|
|
|
|
OUTPUT_ELEMENTS(float, "e");
|
|
|
|
|
} else if (size <= sizeof(double)) {
|
|
|
|
|
OUTPUT_ELEMENTS(double, "e");
|
|
|
|
|
} else {
|
|
|
|
|
OUTPUT_ELEMENTS(long double, "e");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ret = H5Dvlen_reclaim(type, f_space, xfer_pid, rdata);
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
H5Pclose(xfer_pid);
|
|
|
|
|
H5Sclose(f_space);
|
|
|
|
|
free(rdata);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
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,
|
2000-02-15 23:45:35 +08:00
|
|
|
|
void *mem,int indentlevel)
|
1999-01-22 02:33:39 +08:00
|
|
|
|
{
|
|
|
|
|
h5dump_t info_dflt;
|
|
|
|
|
|
|
|
|
|
/* Use default values */
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (!stream)
|
|
|
|
|
stream = stdout;
|
|
|
|
|
|
1999-01-22 02:33:39 +08:00
|
|
|
|
if (!info) {
|
|
|
|
|
memset(&info_dflt, 0, sizeof info_dflt);
|
|
|
|
|
info = &info_dflt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Check the data space */
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (H5Sis_simple(space) <= 0)
|
|
|
|
|
return -1;
|
|
|
|
|
|
2000-02-15 23:45:35 +08:00
|
|
|
|
return h5dump_simple_mem(stream, info, type, space, mem, indentlevel);
|
1999-01-22 02:33:39 +08:00
|
|
|
|
}
|
1999-05-13 23:18:12 +08:00
|
|
|
|
|
1999-05-21 02:54:08 +08:00
|
|
|
|
/*************************************************************************/
|
|
|
|
|
/*************************************************************************/
|
|
|
|
|
/*************************************************************************/
|
|
|
|
|
/*************************************************************************/
|
1999-05-13 23:18:12 +08:00
|
|
|
|
/*************************************************************************/
|
1999-05-21 02:54:08 +08:00
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
1999-05-13 23:18:12 +08:00
|
|
|
|
/*from h5dumputil.c*/
|
|
|
|
|
|
1999-05-21 02:54:08 +08:00
|
|
|
|
/*************************************************************************/
|
|
|
|
|
/*************************************************************************/
|
|
|
|
|
/*************************************************************************/
|
|
|
|
|
/*************************************************************************/
|
|
|
|
|
/*************************************************************************/
|
|
|
|
|
/*************************************************************************/
|
1999-05-13 23:18:12 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: indentation
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Print spaces for indentation
|
|
|
|
|
*
|
|
|
|
|
* Return: void
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Ruey-Hsia Li
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-----------------------------------------------------------------------*/
|
2000-11-01 00:32:21 +08:00
|
|
|
|
void indentation(int x)
|
|
|
|
|
{
|
|
|
|
|
if (x < nCols) {
|
|
|
|
|
while (x-- > 0)
|
|
|
|
|
printf(" ");
|
|
|
|
|
} else {
|
2000-06-24 01:52:21 +08:00
|
|
|
|
printf("The indentation exceeds the number of cols. Exiting....\n");
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
1999-05-13 23:18:12 +08:00
|
|
|
|
}
|
1999-06-03 02:11:21 +08:00
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: print_version
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Print the program name and the version information which is
|
|
|
|
|
* defined the same as the HDF5 library version.
|
|
|
|
|
*
|
|
|
|
|
* Return: void
|
|
|
|
|
*
|
|
|
|
|
* Programmer: unknown
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-----------------------------------------------------------------------*/
|
2000-04-22 03:28:09 +08:00
|
|
|
|
void
|
2000-05-12 06:18:44 +08:00
|
|
|
|
print_version(const char *program_name)
|
1999-12-11 04:44:04 +08:00
|
|
|
|
{
|
2000-04-22 03:28:09 +08:00
|
|
|
|
printf("%s: Version %u.%u.%u%s%s\n",
|
|
|
|
|
program_name, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE,
|
2000-11-01 00:32:21 +08:00
|
|
|
|
H5_VERS_SUBRELEASE[0] ? "-" : "", H5_VERS_SUBRELEASE);
|
1999-12-11 04:44:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
2000-01-07 01:32:16 +08:00
|
|
|
|
/*
|
2000-11-01 00:32:21 +08:00
|
|
|
|
*
|
|
|
|
|
* THE FUNCTIONS BELOW ARE FROM THE H5FINSHD.C FILE
|
|
|
|
|
*
|
|
|
|
|
*/
|
2000-01-07 01:32:16 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: init_table
|
|
|
|
|
*
|
|
|
|
|
* Purpose: allocate and initialize tables for shared groups, datasets,
|
|
|
|
|
* and committed types
|
|
|
|
|
*
|
|
|
|
|
* Return: void
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Ruey-Hsia Li
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-----------------------------------------------------------------------*/
|
2000-06-24 01:52:21 +08:00
|
|
|
|
void
|
2000-11-01 00:32:21 +08:00
|
|
|
|
init_table(table_t** temp)
|
2000-06-24 01:52:21 +08:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
table_t *table = malloc(sizeof(table_t));
|
2000-01-07 01:32:16 +08:00
|
|
|
|
|
|
|
|
|
table->size = 20;
|
|
|
|
|
table->nobjs = 0;
|
|
|
|
|
table->objs = (obj_t*) malloc(table->size*sizeof(obj_t));
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < table->size; i++) {
|
2000-06-24 01:52:21 +08:00
|
|
|
|
table->objs[i].objno[0] = table->objs[i].objno[1] = 0;
|
|
|
|
|
table->objs[i].displayed = 0;
|
|
|
|
|
table->objs[i].recorded = 0;
|
|
|
|
|
table->objs[i].objflag = 0;
|
2000-01-07 01:32:16 +08:00
|
|
|
|
}
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
2000-06-24 01:52:21 +08:00
|
|
|
|
*temp = table;
|
2000-01-07 01:32:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: init_prefix
|
|
|
|
|
*
|
|
|
|
|
* Purpose: allocate and initialize prefix
|
|
|
|
|
*
|
|
|
|
|
* Return: void
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-----------------------------------------------------------------------*/
|
2000-06-24 01:52:21 +08:00
|
|
|
|
void
|
|
|
|
|
init_prefix(char **prefix, int prefix_len)
|
|
|
|
|
{
|
2000-11-01 00:32:21 +08:00
|
|
|
|
char *temp = malloc(prefix_len);
|
|
|
|
|
|
2000-01-07 01:32:16 +08:00
|
|
|
|
*temp = '\0';
|
2000-06-24 01:52:21 +08:00
|
|
|
|
*prefix = temp;
|
2000-01-07 01:32:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: free_table
|
|
|
|
|
*
|
|
|
|
|
* Purpose: free tables for shared groups, datasets,
|
|
|
|
|
* and committed types
|
|
|
|
|
*
|
|
|
|
|
* Return: void
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Paul Harten
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-----------------------------------------------------------------------*/
|
|
|
|
|
void
|
2000-11-01 00:32:21 +08:00
|
|
|
|
free_table(table_t **table)
|
2000-06-24 01:52:21 +08:00
|
|
|
|
{
|
2000-11-01 00:32:21 +08:00
|
|
|
|
HDfree((*table)->objs);
|
2000-01-07 01:32:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: search_obj
|
|
|
|
|
*
|
|
|
|
|
* Purpose: search the object specified by objno in the table
|
|
|
|
|
*
|
|
|
|
|
* Return: an integer, the location of the object
|
|
|
|
|
* -1 if object is not found
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Ruey-Hsia Li
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-----------------------------------------------------------------------*/
|
|
|
|
|
int
|
2000-11-01 00:32:21 +08:00
|
|
|
|
search_obj(table_t *table, unsigned long *objno)
|
2000-06-24 01:52:21 +08:00
|
|
|
|
{
|
2000-11-01 00:32:21 +08:00
|
|
|
|
int i;
|
2000-01-07 01:32:16 +08:00
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
for (i = 0; i < table->nobjs; i++)
|
|
|
|
|
if (table->objs[i].objno[0] == *objno && table->objs[i].objno[1] == *(objno + 1))
|
|
|
|
|
return i;
|
2000-01-07 01:32:16 +08:00
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
return -1;
|
2000-01-07 01:32:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: add_obj
|
|
|
|
|
*
|
|
|
|
|
* Purpose: add a shared object to the table
|
|
|
|
|
* realloc the table if necessary
|
|
|
|
|
*
|
|
|
|
|
* Return: void
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Ruey-Hsia Li
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-----------------------------------------------------------------------*/
|
2000-08-05 04:41:26 +08:00
|
|
|
|
static void
|
2000-06-24 01:52:21 +08:00
|
|
|
|
add_obj (table_t *table, unsigned long *objno, char *objname)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
2000-01-07 01:32:16 +08:00
|
|
|
|
|
|
|
|
|
if (table->nobjs == table->size) {
|
|
|
|
|
table->size *= 2;
|
2000-11-01 00:32:21 +08:00
|
|
|
|
table->objs = realloc(table->objs, table->size*sizeof(obj_t));
|
|
|
|
|
|
2000-01-07 01:32:16 +08:00
|
|
|
|
for (i = table->nobjs; i < table->size; i++) {
|
2000-06-24 01:52:21 +08:00
|
|
|
|
table->objs[i].objno[0] = table->objs[i].objno[1] = 0;
|
|
|
|
|
table->objs[i].displayed = 0;
|
|
|
|
|
table->objs[i].recorded = 0;
|
|
|
|
|
table->objs[i].objflag = 0;
|
2000-01-07 01:32:16 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
i = table->nobjs++;
|
|
|
|
|
table->objs[i].objno[0] = *objno;
|
2000-11-01 00:32:21 +08:00
|
|
|
|
table->objs[i].objno[1] = *(objno + 1);
|
|
|
|
|
strcpy(table->objs[i].objname, objname);
|
2000-01-07 01:32:16 +08:00
|
|
|
|
}
|
2000-06-24 01:52:21 +08:00
|
|
|
|
|
2000-01-07 01:32:16 +08:00
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: Find_objs
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Find objects, committed types and store them in tables
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: SUCCEED
|
|
|
|
|
*
|
|
|
|
|
* Failure: FAIL
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Ruey-Hsia Li
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-----------------------------------------------------------------------*/
|
2000-06-24 01:52:21 +08:00
|
|
|
|
herr_t
|
|
|
|
|
find_objs(hid_t group, const char *name, void *op_data)
|
2000-01-07 01:32:16 +08:00
|
|
|
|
{
|
2000-06-24 01:52:21 +08:00
|
|
|
|
hid_t obj, type;
|
|
|
|
|
H5G_stat_t statbuf;
|
|
|
|
|
char *tmp;
|
|
|
|
|
int i;
|
|
|
|
|
find_objs_t *info = (find_objs_t*)op_data;
|
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (info->threshold > 1)
|
2000-06-24 01:52:21 +08:00
|
|
|
|
/*will get an infinite loop if greater than 1*/
|
2000-11-01 00:32:21 +08:00
|
|
|
|
return FAIL;
|
2000-01-07 01:32:16 +08:00
|
|
|
|
|
|
|
|
|
H5Gget_objinfo(group, name, TRUE, &statbuf);
|
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
tmp = malloc(strlen(info->prefix) + strlen(name) + 2);
|
2000-01-07 01:32:16 +08:00
|
|
|
|
strcpy(tmp, info->prefix);
|
|
|
|
|
|
|
|
|
|
switch (statbuf.type) {
|
|
|
|
|
case H5G_GROUP:
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if ((obj = H5Gopen(group, name)) >= 0) {
|
|
|
|
|
if (info->prefix_len < (int)(strlen(info->prefix) + strlen(name) + 2)) {
|
2000-01-07 01:32:16 +08:00
|
|
|
|
info->prefix_len *= 2;
|
2000-06-24 01:52:21 +08:00
|
|
|
|
info->prefix = realloc(info->prefix,
|
|
|
|
|
info->prefix_len * sizeof(char));
|
2000-11-01 00:32:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
2000-01-07 01:32:16 +08:00
|
|
|
|
strcat(strcat(info->prefix,"/"), name);
|
|
|
|
|
|
|
|
|
|
if (statbuf.nlink > info->threshold) {
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (search_obj(info->group_table, statbuf.objno) < 0) {
|
|
|
|
|
add_obj(info->group_table, statbuf.objno, info->prefix);
|
|
|
|
|
H5Giterate(obj, ".", NULL, find_objs, (void *)info);
|
2000-01-07 01:32:16 +08:00
|
|
|
|
}
|
2000-11-01 00:32:21 +08:00
|
|
|
|
} else {
|
|
|
|
|
H5Giterate (obj, ".", NULL, find_objs, (void *)info);
|
|
|
|
|
}
|
2000-01-07 01:32:16 +08:00
|
|
|
|
|
|
|
|
|
strcpy(info->prefix, tmp);
|
|
|
|
|
H5Gclose (obj);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
} else {
|
2000-01-07 01:32:16 +08:00
|
|
|
|
info->status = 1;
|
2000-11-01 00:32:21 +08:00
|
|
|
|
}
|
2000-01-07 01:32:16 +08:00
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case H5G_DATASET:
|
|
|
|
|
strcat(tmp,"/");
|
|
|
|
|
strcat(tmp,name); /* absolute name of the data set */
|
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (statbuf.nlink > info->threshold &&
|
|
|
|
|
search_obj(info->dset_table, statbuf.objno) < 0)
|
|
|
|
|
add_obj(info->dset_table, statbuf.objno, tmp);
|
|
|
|
|
|
|
|
|
|
if ((obj = H5Dopen (group, name)) >= 0) {
|
|
|
|
|
type = H5Dget_type(obj);
|
|
|
|
|
|
|
|
|
|
if (H5Tcommitted(type) > 0) {
|
2000-06-24 01:52:21 +08:00
|
|
|
|
H5Gget_objinfo(type, ".", TRUE, &statbuf);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
2000-06-24 01:52:21 +08:00
|
|
|
|
if (search_obj (info->type_table, statbuf.objno) < 0) {
|
2000-11-01 00:32:21 +08:00
|
|
|
|
add_obj(info->type_table, statbuf.objno, tmp);
|
2000-06-24 01:52:21 +08:00
|
|
|
|
info->type_table->objs[info->type_table->nobjs - 1].objflag = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
2000-06-24 01:52:21 +08:00
|
|
|
|
H5Tclose(type);
|
|
|
|
|
H5Dclose (obj);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
} else {
|
2000-06-24 01:52:21 +08:00
|
|
|
|
info->status = 1;
|
2000-11-01 00:32:21 +08:00
|
|
|
|
}
|
2000-01-07 01:32:16 +08:00
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case H5G_TYPE:
|
2000-06-24 01:52:21 +08:00
|
|
|
|
strcat(tmp,"/");
|
|
|
|
|
strcat(tmp,name); /* absolute name of the type */
|
2000-11-01 00:32:21 +08:00
|
|
|
|
i = search_obj(info->type_table, statbuf.objno);
|
|
|
|
|
|
2000-06-24 01:52:21 +08:00
|
|
|
|
if (i < 0) {
|
2000-11-01 00:32:21 +08:00
|
|
|
|
add_obj(info->type_table, statbuf.objno, tmp) ;
|
|
|
|
|
|
2000-06-24 01:52:21 +08:00
|
|
|
|
/* named data type */
|
|
|
|
|
info->type_table->objs[info->type_table->nobjs-1].recorded = 1;
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
2000-06-24 01:52:21 +08:00
|
|
|
|
/* named data type */
|
|
|
|
|
info->type_table->objs[info->type_table->nobjs-1].objflag = 1;
|
|
|
|
|
} else {
|
|
|
|
|
strcpy (info->type_table->objs[i].objname, tmp);
|
|
|
|
|
info->type_table->objs[i].recorded = 1;
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
2000-06-24 01:52:21 +08:00
|
|
|
|
/* named data type */
|
|
|
|
|
info->type_table->objs[info->type_table->nobjs-1].objflag = 1;
|
|
|
|
|
}
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
2000-06-24 01:52:21 +08:00
|
|
|
|
break;
|
2000-01-07 01:32:16 +08:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
free(tmp);
|
2000-01-07 01:32:16 +08:00
|
|
|
|
return SUCCEED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: dump_tables
|
|
|
|
|
*
|
|
|
|
|
* Purpose: display the contents of tables for debugging purposes
|
|
|
|
|
*
|
|
|
|
|
* Return: void
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Ruey-Hsia Li
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-----------------------------------------------------------------------*/
|
|
|
|
|
void
|
2000-06-24 01:52:21 +08:00
|
|
|
|
dump_table(char* tablename, table_t *table)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
2000-01-07 01:32:16 +08:00
|
|
|
|
|
|
|
|
|
printf("%s: # of entries = %d\n", tablename,table->nobjs);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
2000-01-07 01:32:16 +08:00
|
|
|
|
for ( i = 0; i < table->nobjs; i++)
|
2000-11-01 00:32:21 +08:00
|
|
|
|
printf("%lu %lu %s %d\n", table->objs[i].objno[0],
|
|
|
|
|
table->objs[i].objno[1],
|
|
|
|
|
table->objs[i].objname,
|
|
|
|
|
table->objs[i].objflag);
|
2000-01-07 01:32:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: get_table_idx
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Determine if objects are in a link loop
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: table index of object detected to be in loop
|
|
|
|
|
*
|
|
|
|
|
* Failure: FAIL
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Paul Harten
|
|
|
|
|
*
|
|
|
|
|
*-----------------------------------------------------------------------*/
|
|
|
|
|
int
|
|
|
|
|
get_table_idx(table_t *table, unsigned long *objno)
|
|
|
|
|
{
|
2000-11-01 00:32:21 +08:00
|
|
|
|
return search_obj(table, objno);
|
2000-01-07 01:32:16 +08:00
|
|
|
|
|
|
|
|
|
}
|
2000-06-24 01:52:21 +08:00
|
|
|
|
|
2000-01-07 01:32:16 +08:00
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: Get table flag setting
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Keep the structures and variables used private to
|
|
|
|
|
* this file.
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: Boolean setting of the i'th element of the
|
|
|
|
|
* object table flag
|
|
|
|
|
*
|
|
|
|
|
* Failure: FAIL
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Paul Harten
|
|
|
|
|
*
|
|
|
|
|
*-----------------------------------------------------------------------*/
|
|
|
|
|
int
|
|
|
|
|
get_tableflag(table_t *table, int idx)
|
|
|
|
|
{
|
2000-11-01 00:32:21 +08:00
|
|
|
|
return table->objs[idx].objflag;
|
2000-01-07 01:32:16 +08:00
|
|
|
|
}
|
2000-06-24 01:52:21 +08:00
|
|
|
|
|
2000-01-07 01:32:16 +08:00
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: Set table flag setting
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Keep the structures and variables used private to
|
|
|
|
|
* this file.
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: Boolean setting of the i'th element of the
|
|
|
|
|
* object table flag
|
|
|
|
|
*
|
|
|
|
|
* Failure: FAIL
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Paul Harten
|
|
|
|
|
*
|
|
|
|
|
*-----------------------------------------------------------------------*/
|
|
|
|
|
int
|
|
|
|
|
set_tableflag(table_t *table, int idx)
|
|
|
|
|
{
|
|
|
|
|
table->objs[idx].objflag = TRUE;
|
2000-11-01 00:32:21 +08:00
|
|
|
|
return SUCCEED;
|
2000-01-07 01:32:16 +08:00
|
|
|
|
}
|
2000-06-24 01:52:21 +08:00
|
|
|
|
|
2000-01-07 01:32:16 +08:00
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: Get name of i'th object in table
|
|
|
|
|
*
|
|
|
|
|
* Purpose:
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: strdup() of object name character string
|
|
|
|
|
*
|
|
|
|
|
* Failure: NULL
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Paul Harten
|
|
|
|
|
*
|
|
|
|
|
*-----------------------------------------------------------------------*/
|
|
|
|
|
char *
|
|
|
|
|
get_objectname(table_t* table, int idx)
|
|
|
|
|
{
|
2000-11-01 00:32:21 +08:00
|
|
|
|
return strdup(table->objs[idx].objname);
|
2000-01-07 01:32:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
2000-06-07 02:07:20 +08:00
|
|
|
|
/*-------------------------------------------------------------------------
|
2000-06-24 01:52:21 +08:00
|
|
|
|
* Function: opens a file using the list of drivers
|
2000-06-07 02:07:20 +08:00
|
|
|
|
*
|
2000-06-24 01:52:21 +08:00
|
|
|
|
* Purpose: Attempts to open a file with various VFL drivers.
|
2000-06-07 02:07:20 +08:00
|
|
|
|
*
|
2000-06-24 01:52:21 +08:00
|
|
|
|
* Return: Success: a file id for the opened file. If
|
|
|
|
|
* DRIVERNAME is non-null then the first
|
|
|
|
|
* DRIVERNAME_SIZE-1 characters of the driver
|
|
|
|
|
* name are copied into the DRIVERNAME array
|
|
|
|
|
* and null terminated.
|
2000-06-07 02:07:20 +08:00
|
|
|
|
*
|
2000-06-24 01:52:21 +08:00
|
|
|
|
* Failure: -1. If DRIVERNAME is non-null then the
|
|
|
|
|
* first byte is set to the null terminator.
|
2000-06-07 02:07:20 +08:00
|
|
|
|
*
|
2000-06-24 01:52:21 +08:00
|
|
|
|
* Modifications:
|
|
|
|
|
* Robb Matzke, 2000-06-23
|
|
|
|
|
* We only have to initialize driver[] on the first call,
|
|
|
|
|
* thereby preventing memory leaks from repeated calls to
|
|
|
|
|
* H5Pcreate().
|
|
|
|
|
*
|
|
|
|
|
* Robb Matzke, 2000-06-23
|
|
|
|
|
* Added DRIVERNAME_SIZE arg to prevent overflows when
|
|
|
|
|
* writing to DRIVERNAME.
|
|
|
|
|
*
|
|
|
|
|
* Robb Matzke, 2000-06-23
|
|
|
|
|
* Added test to prevent coredump when the file could not be
|
|
|
|
|
* opened by any driver.
|
|
|
|
|
*
|
|
|
|
|
* Robb Matzke, 2000-06-23
|
|
|
|
|
* Changed name from H5ToolsFopen() so it jives better with
|
|
|
|
|
* the names we already have at the top of this source file.
|
2000-09-15 20:05:41 +08:00
|
|
|
|
*
|
|
|
|
|
* Thomas Radke, 2000-09-12
|
|
|
|
|
* Added Stream VFD to the driver[] array.
|
2000-06-07 02:07:20 +08:00
|
|
|
|
*-----------------------------------------------------------------------*/
|
2000-06-24 01:52:21 +08:00
|
|
|
|
hid_t
|
|
|
|
|
h5dump_fopen(const char *fname, char *drivername, size_t drivername_size)
|
|
|
|
|
{
|
|
|
|
|
static struct {
|
|
|
|
|
const char *name;
|
|
|
|
|
hid_t fapl;
|
|
|
|
|
} driver[16];
|
|
|
|
|
static int ndrivers = 0;
|
|
|
|
|
hid_t fid, fapl = H5P_DEFAULT;
|
|
|
|
|
int drivernum;
|
|
|
|
|
|
|
|
|
|
if (!ndrivers) {
|
|
|
|
|
/* Build a list of file access property lists which we should try
|
|
|
|
|
* when opening the file. Eventually we'd like some way for the
|
|
|
|
|
* user to augment/replace this list interactively. */
|
|
|
|
|
driver[ndrivers].name = "sec2";
|
|
|
|
|
driver[ndrivers].fapl = H5P_DEFAULT;
|
|
|
|
|
ndrivers++;
|
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
#ifdef VERSION13
|
2000-06-24 01:52:21 +08:00
|
|
|
|
driver[ndrivers].name = "family";
|
|
|
|
|
driver[ndrivers].fapl = fapl = H5Pcreate(H5P_FILE_ACCESS);
|
|
|
|
|
H5Pset_fapl_family(fapl, 0, H5P_DEFAULT);
|
|
|
|
|
ndrivers++;
|
|
|
|
|
|
|
|
|
|
driver[ndrivers].name = "split";
|
|
|
|
|
driver[ndrivers].fapl = fapl = H5Pcreate(H5P_FILE_ACCESS);
|
|
|
|
|
H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT);
|
|
|
|
|
ndrivers++;
|
|
|
|
|
|
|
|
|
|
driver[ndrivers].name = "multi";
|
|
|
|
|
driver[ndrivers].fapl = fapl = H5Pcreate(H5P_FILE_ACCESS);
|
|
|
|
|
H5Pset_fapl_multi(fapl, NULL, NULL, NULL, NULL, TRUE);
|
|
|
|
|
ndrivers++;
|
2000-09-15 20:05:41 +08:00
|
|
|
|
|
|
|
|
|
#ifdef H5_HAVE_STREAM
|
|
|
|
|
driver[ndrivers].name = "stream";
|
|
|
|
|
driver[ndrivers].fapl = fapl = H5Pcreate(H5P_FILE_ACCESS);
|
|
|
|
|
H5Pset_fapl_stream(fapl, NULL);
|
|
|
|
|
ndrivers++;
|
2000-11-01 00:32:21 +08:00
|
|
|
|
#endif /* H5_HAVE_STREAM */
|
|
|
|
|
#endif /* VERSION13 */
|
2000-06-24 01:52:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Try to open the file using each of the drivers */
|
2000-11-01 00:32:21 +08:00
|
|
|
|
for (drivernum = 0; drivernum < ndrivers; drivernum++) {
|
2000-06-24 01:52:21 +08:00
|
|
|
|
H5E_BEGIN_TRY {
|
|
|
|
|
fid = H5Fopen(fname, H5F_ACC_RDONLY, driver[drivernum].fapl);
|
|
|
|
|
} H5E_END_TRY;
|
2000-11-01 00:32:21 +08:00
|
|
|
|
|
|
|
|
|
if (fid >= 0)
|
|
|
|
|
break;
|
2000-06-24 01:52:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Save the driver name */
|
|
|
|
|
if (drivername && drivername_size){
|
2000-11-01 00:32:21 +08:00
|
|
|
|
if (fid >= 0) {
|
2000-06-24 01:52:21 +08:00
|
|
|
|
strncpy(drivername, driver[drivernum].name, drivername_size);
|
2000-11-01 00:32:21 +08:00
|
|
|
|
drivername[drivername_size - 1] = '\0';
|
2000-06-24 01:52:21 +08:00
|
|
|
|
} else {
|
|
|
|
|
drivername[0] = '\0'; /*no file opened*/
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-01-07 01:32:16 +08:00
|
|
|
|
|
2000-11-01 00:32:21 +08:00
|
|
|
|
return fid;
|
|
|
|
|
}
|