2003-04-01 02:10:51 +08:00
|
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
2007-02-07 22:56:24 +08:00
|
|
|
|
* Copyright by The HDF Group. *
|
2003-04-01 02:10:51 +08:00
|
|
|
|
* Copyright by the Board of Trustees of the University of Illinois. *
|
|
|
|
|
* All rights reserved. *
|
|
|
|
|
* *
|
|
|
|
|
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
|
|
|
|
* terms governing use, modification, and redistribution, is contained in *
|
|
|
|
|
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
|
|
|
|
* of the source code distribution tree; Copyright.html can be found at the *
|
|
|
|
|
* root level of an installed copy of the electronic HDF5 document set and *
|
|
|
|
|
* is linked from the top-level documents page. It can also be found at *
|
2007-02-07 22:56:24 +08:00
|
|
|
|
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
|
|
|
|
|
* access to either file, you may request a copy from help@hdfgroup.org. *
|
2003-04-01 02:10:51 +08:00
|
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
|
|
2001-03-09 04:18:42 +08:00
|
|
|
|
/*
|
|
|
|
|
* Programmer: Bill Wendling <wendling@ncsa.uiuc.edu>
|
|
|
|
|
* Tuesday, 6. March 2001
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Portions of this work are derived from _Obfuscated C and Other Mysteries_,
|
|
|
|
|
* by Don Libes, copyright (c) 1993 by John Wiley & Sons, Inc.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
|
|
#include "h5tools_utils.h"
|
|
|
|
|
#include "H5private.h"
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
|
#include "h5trav.h"
|
2001-03-09 04:18:42 +08:00
|
|
|
|
|
|
|
|
|
/* global variables */
|
2012-02-18 05:41:58 +08:00
|
|
|
|
int h5tools_nCols = 80;
|
2001-03-09 04:18:42 +08:00
|
|
|
|
/* ``get_option'' variables */
|
|
|
|
|
int opt_err = 1; /*get_option prints errors if this is on */
|
|
|
|
|
int opt_ind = 1; /*token pointer */
|
|
|
|
|
const char *opt_arg; /*flag argument (or value) */
|
2010-05-15 05:54:59 +08:00
|
|
|
|
static int h5tools_d_status = 0;
|
|
|
|
|
static const char *h5tools_progname = "h5tools";
|
2001-03-09 04:18:42 +08:00
|
|
|
|
|
2011-10-15 06:44:11 +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).
|
|
|
|
|
*/
|
|
|
|
|
/* Maximum size used in a call to malloc for a dataset */
|
|
|
|
|
hsize_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024);
|
|
|
|
|
/* size of hyperslab buffer when a dataset is bigger than H5TOOLS_MALLOCSIZE */
|
|
|
|
|
hsize_t H5TOOLS_BUFSIZE = (1024 * 1024);
|
|
|
|
|
|
|
|
|
|
|
2010-08-20 03:55:48 +08:00
|
|
|
|
/* ``parallel_print'' variables */
|
|
|
|
|
unsigned char g_Parallel = 0; /*0 for serial, 1 for parallel */
|
|
|
|
|
char outBuff[OUTBUFF_SIZE];
|
|
|
|
|
int outBuffOffset;
|
|
|
|
|
FILE* overflow_file = NULL;
|
|
|
|
|
|
2001-03-09 04:18:42 +08:00
|
|
|
|
/* local functions */
|
2005-08-26 04:16:40 +08:00
|
|
|
|
static void init_table(table_t **tbl);
|
|
|
|
|
#ifdef H5DUMP_DEBUG
|
|
|
|
|
static void dump_table(char* tablename, table_t *table);
|
|
|
|
|
#endif /* H5DUMP_DEBUG */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
|
static void add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t recorded);
|
2001-03-09 04:18:42 +08:00
|
|
|
|
|
2010-08-20 03:55:48 +08:00
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: parallel_print
|
|
|
|
|
*
|
|
|
|
|
* Purpose: wrapper for printf for use in parallel mode.
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Leon Arber
|
|
|
|
|
*
|
|
|
|
|
* Date: December 1, 2004
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
void parallel_print(const char* format, ...)
|
|
|
|
|
{
|
2012-02-23 05:58:50 +08:00
|
|
|
|
int bytes_written;
|
|
|
|
|
va_list ap;
|
2010-08-20 03:55:48 +08:00
|
|
|
|
|
2012-02-23 05:58:50 +08:00
|
|
|
|
HDva_start(ap, format);
|
2010-08-20 03:55:48 +08:00
|
|
|
|
|
2012-02-23 05:58:50 +08:00
|
|
|
|
if(!g_Parallel)
|
|
|
|
|
HDvprintf(format, ap);
|
|
|
|
|
else {
|
|
|
|
|
if(overflow_file == NULL) /*no overflow has occurred yet */ {
|
2010-08-20 03:55:48 +08:00
|
|
|
|
#if 0
|
2012-02-23 05:58:50 +08:00
|
|
|
|
printf("calling HDvsnprintf: OUTBUFF_SIZE=%ld, outBuffOffset=%ld, ", (long)OUTBUFF_SIZE, (long)outBuffOffset);
|
2010-08-20 03:55:48 +08:00
|
|
|
|
#endif
|
2012-02-23 05:58:50 +08:00
|
|
|
|
bytes_written = HDvsnprintf(outBuff+outBuffOffset, OUTBUFF_SIZE-outBuffOffset, format, ap);
|
2010-08-20 03:55:48 +08:00
|
|
|
|
#if 0
|
2012-02-23 05:58:50 +08:00
|
|
|
|
printf("bytes_written=%ld\n", (long)bytes_written);
|
2010-08-20 03:55:48 +08:00
|
|
|
|
#endif
|
2012-02-23 05:58:50 +08:00
|
|
|
|
HDva_end(ap);
|
|
|
|
|
HDva_start(ap, format);
|
2010-08-20 03:55:48 +08:00
|
|
|
|
|
|
|
|
|
#if 0
|
2012-02-23 05:58:50 +08:00
|
|
|
|
printf("Result: bytes_written=%ld, OUTBUFF_SIZE-outBuffOffset=%ld\n", (long)bytes_written, (long)OUTBUFF_SIZE-outBuffOffset);
|
2010-08-20 03:55:48 +08:00
|
|
|
|
#endif
|
|
|
|
|
|
2012-02-23 05:58:50 +08:00
|
|
|
|
if ((bytes_written < 0) ||
|
2010-08-20 03:55:48 +08:00
|
|
|
|
#ifdef H5_VSNPRINTF_WORKS
|
2012-02-23 05:58:50 +08:00
|
|
|
|
(bytes_written >= (OUTBUFF_SIZE-outBuffOffset))
|
2010-08-20 03:55:48 +08:00
|
|
|
|
#else
|
2012-02-23 05:58:50 +08:00
|
|
|
|
((bytes_written+1) == (OUTBUFF_SIZE-outBuffOffset))
|
2010-08-20 03:55:48 +08:00
|
|
|
|
#endif
|
2012-02-23 05:58:50 +08:00
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
/* Terminate the outbuff at the end of the previous output */
|
|
|
|
|
outBuff[outBuffOffset] = '\0';
|
|
|
|
|
|
|
|
|
|
overflow_file = HDtmpfile();
|
|
|
|
|
if(overflow_file == NULL)
|
|
|
|
|
HDfprintf(stderr, "warning: could not create overflow file. Output may be truncated.\n");
|
|
|
|
|
else
|
|
|
|
|
bytes_written = HDvfprintf(overflow_file, format, ap);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
outBuffOffset += bytes_written;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
bytes_written = HDvfprintf(overflow_file, format, ap);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
HDva_end(ap);
|
2010-08-20 03:55:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
2001-03-09 04:18:42 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2006-12-07 05:14:39 +08:00
|
|
|
|
* Function: error_msg
|
2001-03-09 04:18:42 +08:00
|
|
|
|
*
|
2006-12-07 05:14:39 +08:00
|
|
|
|
* Purpose: Print a nicely formatted error message to stderr flushing the
|
2001-03-09 04:18:42 +08:00
|
|
|
|
* stdout stream first.
|
|
|
|
|
*
|
2006-12-07 05:14:39 +08:00
|
|
|
|
* Return: Nothing
|
2001-03-09 04:18:42 +08:00
|
|
|
|
*
|
2006-12-07 05:14:39 +08:00
|
|
|
|
* Programmer: Bill Wendling
|
2001-03-09 04:18:42 +08:00
|
|
|
|
* Tuesday, 20. February 2001
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
void
|
2010-05-12 04:10:25 +08:00
|
|
|
|
error_msg(const char *fmt, ...)
|
2001-03-09 04:18:42 +08:00
|
|
|
|
{
|
|
|
|
|
va_list ap;
|
|
|
|
|
|
2012-02-23 05:58:50 +08:00
|
|
|
|
HDva_start(ap, fmt);
|
2001-06-19 04:22:10 +08:00
|
|
|
|
HDfflush(stdout);
|
2010-05-12 04:10:25 +08:00
|
|
|
|
HDfprintf(stderr, "%s error: ", h5tools_getprogname());
|
2001-06-19 04:22:10 +08:00
|
|
|
|
HDvfprintf(stderr, fmt, ap);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2012-02-23 05:58:50 +08:00
|
|
|
|
HDva_end(ap);
|
2001-03-09 04:18:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2006-12-07 05:14:39 +08:00
|
|
|
|
* Function: warn_msg
|
2001-03-09 04:18:42 +08:00
|
|
|
|
*
|
2006-12-07 05:14:39 +08:00
|
|
|
|
* Purpose: Print a nicely formatted warning message to stderr flushing
|
2001-03-09 04:18:42 +08:00
|
|
|
|
* the stdout stream first.
|
|
|
|
|
*
|
2006-12-07 05:14:39 +08:00
|
|
|
|
* Return: Nothing
|
2001-03-09 04:18:42 +08:00
|
|
|
|
*
|
2006-12-07 05:14:39 +08:00
|
|
|
|
* Programmer: Bill Wendling
|
2001-03-09 04:18:42 +08:00
|
|
|
|
* Tuesday, 20. February 2001
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
void
|
2010-05-12 04:10:25 +08:00
|
|
|
|
warn_msg(const char *fmt, ...)
|
2001-03-09 04:18:42 +08:00
|
|
|
|
{
|
|
|
|
|
va_list ap;
|
|
|
|
|
|
2012-02-23 05:58:50 +08:00
|
|
|
|
HDva_start(ap, fmt);
|
2001-06-19 04:22:10 +08:00
|
|
|
|
HDfflush(stdout);
|
2010-05-12 04:10:25 +08:00
|
|
|
|
HDfprintf(stderr, "%s warning: ", h5tools_getprogname());
|
2001-06-19 04:22:10 +08:00
|
|
|
|
HDvfprintf(stderr, fmt, ap);
|
2012-02-23 05:58:50 +08:00
|
|
|
|
HDva_end(ap);
|
2001-03-09 04:18:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
2011-08-17 04:41:47 +08:00
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: help_ref_msg
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Print a message to refer help page
|
|
|
|
|
*
|
|
|
|
|
* Return: Nothing
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
help_ref_msg(FILE *output)
|
|
|
|
|
{
|
|
|
|
|
HDfprintf(output, "Try '-h' or '--help' for more information or ");
|
|
|
|
|
HDfprintf(output, "see the <%s> entry in the 'HDF5 Reference Manual'.\n",h5tools_getprogname());
|
|
|
|
|
}
|
|
|
|
|
|
2001-03-09 04:18:42 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2006-12-07 05:14:39 +08:00
|
|
|
|
* Function: get_option
|
2001-03-09 04:18:42 +08:00
|
|
|
|
*
|
2006-12-07 05:14:39 +08:00
|
|
|
|
* Purpose: Determine the command-line options a user specified. We can
|
|
|
|
|
* accept both short and long type command-lines.
|
2001-03-09 04:18:42 +08:00
|
|
|
|
*
|
2006-12-07 05:14:39 +08:00
|
|
|
|
* Return: Success: The short valued "name" of the command line
|
|
|
|
|
* parameter or EOF if there are no more
|
|
|
|
|
* parameters to process.
|
2001-03-09 04:18:42 +08:00
|
|
|
|
*
|
2006-12-07 05:14:39 +08:00
|
|
|
|
* Failure: A question mark.
|
2001-03-09 04:18:42 +08:00
|
|
|
|
*
|
2006-12-07 05:14:39 +08:00
|
|
|
|
* Programmer: Bill Wendling
|
2001-03-09 04:18:42 +08:00
|
|
|
|
* Friday, 5. January 2001
|
|
|
|
|
*
|
2008-10-30 04:11:51 +08:00
|
|
|
|
* Modifications: Pedro Vicente
|
|
|
|
|
* October, 27 2008
|
|
|
|
|
* Wilcard "*" argument type
|
2001-03-09 04:18:42 +08:00
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
get_option(int argc, const char **argv, const char *opts, const struct long_options *l_opts)
|
|
|
|
|
{
|
|
|
|
|
static int sp = 1; /* character index in current token */
|
|
|
|
|
int opt_opt = '?'; /* option character passed back to user */
|
|
|
|
|
|
|
|
|
|
if (sp == 1) {
|
|
|
|
|
/* check for more flag-like tokens */
|
|
|
|
|
if (opt_ind >= argc || argv[opt_ind][0] != '-' || argv[opt_ind][1] == '\0') {
|
|
|
|
|
return EOF;
|
2012-02-23 05:58:50 +08:00
|
|
|
|
}
|
|
|
|
|
else if (HDstrcmp(argv[opt_ind], "--") == 0) {
|
2001-03-09 04:18:42 +08:00
|
|
|
|
opt_ind++;
|
|
|
|
|
return EOF;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sp == 1 && argv[opt_ind][0] == '-' && argv[opt_ind][1] == '-') {
|
|
|
|
|
/* long command line option */
|
|
|
|
|
const char *arg = &argv[opt_ind][2];
|
2001-06-19 04:22:10 +08:00
|
|
|
|
int i;
|
2001-03-09 04:18:42 +08:00
|
|
|
|
|
|
|
|
|
for (i = 0; l_opts && l_opts[i].name; i++) {
|
2001-06-19 04:22:10 +08:00
|
|
|
|
size_t len = HDstrlen(l_opts[i].name);
|
2001-03-09 04:18:42 +08:00
|
|
|
|
|
2001-06-19 04:22:10 +08:00
|
|
|
|
if (HDstrncmp(arg, l_opts[i].name, len) == 0) {
|
2001-03-09 04:18:42 +08:00
|
|
|
|
/* we've found a matching long command line flag */
|
|
|
|
|
opt_opt = l_opts[i].shortval;
|
|
|
|
|
|
|
|
|
|
if (l_opts[i].has_arg != no_arg) {
|
|
|
|
|
if (arg[len] == '=') {
|
|
|
|
|
opt_arg = &arg[len + 1];
|
2011-03-22 23:47:07 +08:00
|
|
|
|
}
|
|
|
|
|
else if (l_opts[i].has_arg != optional_arg) {
|
|
|
|
|
if (opt_ind < (argc - 1))
|
|
|
|
|
if (argv[opt_ind + 1][0] != '-')
|
|
|
|
|
opt_arg = argv[++opt_ind];
|
2012-02-23 05:58:50 +08:00
|
|
|
|
}
|
|
|
|
|
else if (l_opts[i].has_arg == require_arg) {
|
2001-03-09 04:18:42 +08:00
|
|
|
|
if (opt_err)
|
2001-06-19 04:22:10 +08:00
|
|
|
|
HDfprintf(stderr,
|
2001-03-09 04:18:42 +08:00
|
|
|
|
"%s: option required for \"--%s\" flag\n",
|
|
|
|
|
argv[0], arg);
|
|
|
|
|
|
|
|
|
|
opt_opt = '?';
|
|
|
|
|
}
|
2012-02-23 05:58:50 +08:00
|
|
|
|
}
|
|
|
|
|
else {
|
2001-03-09 04:18:42 +08:00
|
|
|
|
if (arg[len] == '=') {
|
|
|
|
|
if (opt_err)
|
2001-06-19 04:22:10 +08:00
|
|
|
|
HDfprintf(stderr,
|
2001-03-09 04:18:42 +08:00
|
|
|
|
"%s: no option required for \"%s\" flag\n",
|
|
|
|
|
argv[0], arg);
|
|
|
|
|
|
|
|
|
|
opt_opt = '?';
|
|
|
|
|
}
|
|
|
|
|
opt_arg = NULL;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (l_opts[i].name == NULL) {
|
|
|
|
|
/* exhausted all of the l_opts we have and still didn't match */
|
|
|
|
|
if (opt_err)
|
2001-06-19 04:22:10 +08:00
|
|
|
|
HDfprintf(stderr, "%s: unknown option \"%s\"\n", argv[0], arg);
|
2001-03-09 04:18:42 +08:00
|
|
|
|
|
|
|
|
|
opt_opt = '?';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
opt_ind++;
|
|
|
|
|
sp = 1;
|
2012-02-23 05:58:50 +08:00
|
|
|
|
}
|
|
|
|
|
else {
|
2001-03-09 04:18:42 +08:00
|
|
|
|
register char *cp; /* pointer into current token */
|
|
|
|
|
|
|
|
|
|
/* short command line option */
|
|
|
|
|
opt_opt = argv[opt_ind][sp];
|
|
|
|
|
|
2012-02-23 05:58:50 +08:00
|
|
|
|
if (opt_opt == ':' || (cp = HDstrchr(opts, opt_opt)) == 0) {
|
2001-03-09 04:18:42 +08:00
|
|
|
|
if (opt_err)
|
2001-06-19 04:22:10 +08:00
|
|
|
|
HDfprintf(stderr, "%s: unknown option \"%c\"\n",
|
2001-03-09 04:18:42 +08:00
|
|
|
|
argv[0], opt_opt);
|
|
|
|
|
|
|
|
|
|
/* if no chars left in this token, move to next token */
|
|
|
|
|
if (argv[opt_ind][++sp] == '\0') {
|
|
|
|
|
opt_ind++;
|
|
|
|
|
sp = 1;
|
|
|
|
|
}
|
|
|
|
|
return '?';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (*++cp == ':') {
|
|
|
|
|
/* if a value is expected, get it */
|
|
|
|
|
if (argv[opt_ind][sp + 1] != '\0') {
|
|
|
|
|
/* flag value is rest of current token */
|
|
|
|
|
opt_arg = &argv[opt_ind++][sp + 1];
|
2012-02-23 05:58:50 +08:00
|
|
|
|
}
|
|
|
|
|
else if (++opt_ind >= argc) {
|
2001-03-09 04:18:42 +08:00
|
|
|
|
if (opt_err)
|
2001-06-19 04:22:10 +08:00
|
|
|
|
HDfprintf(stderr,
|
2001-03-09 04:18:42 +08:00
|
|
|
|
"%s: value expected for option \"%c\"\n",
|
|
|
|
|
argv[0], opt_opt);
|
|
|
|
|
|
|
|
|
|
opt_opt = '?';
|
2012-02-23 05:58:50 +08:00
|
|
|
|
}
|
|
|
|
|
else {
|
2001-03-09 04:18:42 +08:00
|
|
|
|
/* flag value is next token */
|
|
|
|
|
opt_arg = argv[opt_ind++];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sp = 1;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
}
|
2008-10-30 04:11:51 +08:00
|
|
|
|
/* wildcard argument */
|
2012-02-23 05:58:50 +08:00
|
|
|
|
else if (*cp == '*') {
|
2008-10-30 04:11:51 +08:00
|
|
|
|
/* check the next argument */
|
|
|
|
|
opt_ind++;
|
|
|
|
|
/* we do have an extra argument, check if not last */
|
2012-02-23 05:58:50 +08:00
|
|
|
|
if ( argv[opt_ind][0] != '-' && (opt_ind+1) < argc ) {
|
2008-10-30 04:11:51 +08:00
|
|
|
|
opt_arg = argv[opt_ind++];
|
|
|
|
|
}
|
2012-02-23 05:58:50 +08:00
|
|
|
|
else {
|
2008-10-30 04:11:51 +08:00
|
|
|
|
opt_arg = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-02-23 05:58:50 +08:00
|
|
|
|
else {
|
2001-03-09 04:18:42 +08:00
|
|
|
|
/* set up to look at next char in token, next time */
|
|
|
|
|
if (argv[opt_ind][++sp] == '\0') {
|
|
|
|
|
/* no more in current token, so setup next token */
|
|
|
|
|
opt_ind++;
|
|
|
|
|
sp = 1;
|
|
|
|
|
}
|
|
|
|
|
opt_arg = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* return the current flag character found */
|
|
|
|
|
return opt_opt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: indentation
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Print spaces for indentation
|
|
|
|
|
*
|
|
|
|
|
* Return: void
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Ruey-Hsia Li
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
indentation(int x)
|
|
|
|
|
{
|
2012-02-18 05:41:58 +08:00
|
|
|
|
if (x < h5tools_nCols) {
|
2001-03-09 04:18:42 +08:00
|
|
|
|
while (x-- > 0)
|
|
|
|
|
printf(" ");
|
2012-02-23 05:58:50 +08:00
|
|
|
|
}
|
|
|
|
|
else {
|
2001-06-19 04:22:10 +08:00
|
|
|
|
HDfprintf(stderr, "error: the indentation exceeds the number of cols.\n");
|
2012-02-24 23:45:54 +08:00
|
|
|
|
HDexit(1);
|
2001-03-09 04:18:42 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: print_version
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Print the program name and the version information which is
|
2006-12-07 05:14:39 +08:00
|
|
|
|
* defined the same as the HDF5 library version.
|
2001-03-09 04:18:42 +08:00
|
|
|
|
*
|
|
|
|
|
* Return: void
|
|
|
|
|
*
|
|
|
|
|
* Programmer: unknown
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
print_version(const char *progname)
|
|
|
|
|
{
|
|
|
|
|
printf("%s: Version %u.%u.%u%s%s\n",
|
|
|
|
|
progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE,
|
2010-04-13 10:09:48 +08:00
|
|
|
|
((char *)H5_VERS_SUBRELEASE)[0] ? "-" : "", H5_VERS_SUBRELEASE);
|
2001-03-09 04:18:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: init_table
|
|
|
|
|
*
|
2005-08-14 04:53:35 +08:00
|
|
|
|
* Purpose: allocate and initialize tables for shared groups, datasets,
|
2001-03-09 04:18:42 +08:00
|
|
|
|
* and committed types
|
|
|
|
|
*
|
|
|
|
|
* Return: void
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Ruey-Hsia Li
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
2005-08-26 04:16:40 +08:00
|
|
|
|
static void
|
2001-03-09 04:18:42 +08:00
|
|
|
|
init_table(table_t **tbl)
|
|
|
|
|
{
|
2010-07-30 03:07:26 +08:00
|
|
|
|
table_t *table = (table_t *)HDmalloc(sizeof(table_t));
|
2001-03-09 04:18:42 +08:00
|
|
|
|
|
|
|
|
|
table->size = 20;
|
|
|
|
|
table->nobjs = 0;
|
2010-07-30 03:07:26 +08:00
|
|
|
|
table->objs = (obj_t *)HDmalloc(table->size * sizeof(obj_t));
|
2001-03-09 04:18:42 +08:00
|
|
|
|
|
|
|
|
|
*tbl = table;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2005-08-26 04:16:40 +08:00
|
|
|
|
* Function: free_table
|
2001-03-09 04:18:42 +08:00
|
|
|
|
*
|
2005-08-26 04:16:40 +08:00
|
|
|
|
* Purpose: free tables for shared groups, datasets,
|
|
|
|
|
* and committed types
|
2001-03-09 04:18:42 +08:00
|
|
|
|
*
|
|
|
|
|
* Return: void
|
|
|
|
|
*
|
2005-08-26 04:16:40 +08:00
|
|
|
|
* Programmer: Paul Harten
|
|
|
|
|
*
|
2001-03-09 04:18:42 +08:00
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
void
|
2005-08-26 04:16:40 +08:00
|
|
|
|
free_table(table_t *table)
|
2001-03-09 04:18:42 +08:00
|
|
|
|
{
|
2005-08-26 04:16:40 +08:00
|
|
|
|
unsigned u; /* Local index value */
|
|
|
|
|
|
|
|
|
|
/* Free the names for the objects in the table */
|
|
|
|
|
for(u = 0; u < table->nobjs; u++)
|
|
|
|
|
if(table->objs[u].objname)
|
|
|
|
|
HDfree(table->objs[u].objname);
|
|
|
|
|
|
|
|
|
|
HDfree(table->objs);
|
2001-03-09 04:18:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
2005-08-26 04:16:40 +08:00
|
|
|
|
#ifdef H5DUMP_DEBUG
|
2001-03-09 04:18:42 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2005-08-26 04:16:40 +08:00
|
|
|
|
* Function: dump_table
|
2001-03-09 04:18:42 +08:00
|
|
|
|
*
|
2005-08-26 04:16:40 +08:00
|
|
|
|
* Purpose: display the contents of tables for debugging purposes
|
2001-03-09 04:18:42 +08:00
|
|
|
|
*
|
|
|
|
|
* Return: void
|
|
|
|
|
*
|
2005-08-26 04:16:40 +08:00
|
|
|
|
* Programmer: Ruey-Hsia Li
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
dump_table(char* tablename, table_t *table)
|
|
|
|
|
{
|
|
|
|
|
unsigned u;
|
|
|
|
|
|
|
|
|
|
printf("%s: # of entries = %d\n", tablename,table->nobjs);
|
|
|
|
|
for (u = 0; u < table->nobjs; u++)
|
2006-12-07 05:14:39 +08:00
|
|
|
|
HDfprintf(stdout,"%a %s %d %d\n", table->objs[u].objno,
|
|
|
|
|
table->objs[u].objname,
|
|
|
|
|
table->objs[u].displayed, table->objs[u].recorded);
|
2005-08-26 04:16:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: dump_tables
|
|
|
|
|
*
|
|
|
|
|
* Purpose: display the contents of tables for debugging purposes
|
|
|
|
|
*
|
|
|
|
|
* Return: void
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Ruey-Hsia Li
|
2001-03-09 04:18:42 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
void
|
2005-08-26 04:16:40 +08:00
|
|
|
|
dump_tables(find_objs_t *info)
|
2001-03-09 04:18:42 +08:00
|
|
|
|
{
|
2005-08-26 04:16:40 +08:00
|
|
|
|
dump_table("group_table", info->group_table);
|
|
|
|
|
dump_table("dset_table", info->dset_table);
|
|
|
|
|
dump_table("type_table", info->type_table);
|
2001-03-09 04:18:42 +08:00
|
|
|
|
}
|
2005-08-26 04:16:40 +08:00
|
|
|
|
#endif /* H5DUMP_DEBUG */
|
2001-03-09 04:18:42 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: search_obj
|
|
|
|
|
*
|
|
|
|
|
* Purpose: search the object specified by objno in the table
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: an integer, the location of the object
|
|
|
|
|
*
|
|
|
|
|
* Failure: FAIL if object is not found
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Ruey-Hsia Li
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
2005-08-26 04:16:40 +08:00
|
|
|
|
obj_t *
|
2003-08-09 03:39:10 +08:00
|
|
|
|
search_obj(table_t *table, haddr_t objno)
|
2001-03-09 04:18:42 +08:00
|
|
|
|
{
|
2005-08-26 04:16:40 +08:00
|
|
|
|
unsigned u;
|
2001-03-09 04:18:42 +08:00
|
|
|
|
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
|
for(u = 0; u < table->nobjs; u++)
|
|
|
|
|
if(table->objs[u].objno == objno)
|
|
|
|
|
return &(table->objs[u]);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2005-08-26 04:16:40 +08:00
|
|
|
|
return NULL;
|
2001-03-09 04:18:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
2005-08-26 04:16:40 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: find_objs_cb
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Callback to find objects, committed types and store them in tables
|
2001-03-09 04:18:42 +08:00
|
|
|
|
*
|
|
|
|
|
* Return: Success: SUCCEED
|
|
|
|
|
*
|
|
|
|
|
* Failure: FAIL
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Ruey-Hsia Li
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
2005-08-26 04:16:40 +08:00
|
|
|
|
static herr_t
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
|
find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen,
|
|
|
|
|
void *op_data)
|
2001-03-09 04:18:42 +08:00
|
|
|
|
{
|
|
|
|
|
find_objs_t *info = (find_objs_t*)op_data;
|
2005-08-26 04:16:40 +08:00
|
|
|
|
herr_t ret_value = 0;
|
2001-03-09 04:18:42 +08:00
|
|
|
|
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
|
switch(oinfo->type) {
|
|
|
|
|
case H5O_TYPE_GROUP:
|
|
|
|
|
if(NULL == already_seen)
|
|
|
|
|
add_obj(info->group_table, oinfo->addr, name, TRUE);
|
|
|
|
|
break;
|
2005-08-26 04:16:40 +08:00
|
|
|
|
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
|
case H5O_TYPE_DATASET:
|
|
|
|
|
if(NULL == already_seen) {
|
|
|
|
|
hid_t dset;
|
2001-03-09 04:18:42 +08:00
|
|
|
|
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
|
/* Add the dataset to the list of objects */
|
|
|
|
|
add_obj(info->dset_table, oinfo->addr, name, TRUE);
|
2001-03-09 04:18:42 +08:00
|
|
|
|
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
|
/* Check for a dataset that uses a named datatype */
|
|
|
|
|
if((dset = H5Dopen2(info->fid, name, H5P_DEFAULT)) >= 0) {
|
|
|
|
|
hid_t type = H5Dget_type(dset);
|
2001-03-09 04:18:42 +08:00
|
|
|
|
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
|
if(H5Tcommitted(type) > 0) {
|
|
|
|
|
H5O_info_t type_oinfo;
|
2001-03-09 04:18:42 +08:00
|
|
|
|
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
|
H5Oget_info(type, &type_oinfo);
|
|
|
|
|
if(search_obj(info->type_table, type_oinfo.addr) == NULL)
|
|
|
|
|
add_obj(info->type_table, type_oinfo.addr, name, FALSE);
|
2007-09-13 23:44:56 +08:00
|
|
|
|
} /* end if */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
|
H5Tclose(type);
|
|
|
|
|
H5Dclose(dset);
|
|
|
|
|
} /* end if */
|
|
|
|
|
else
|
|
|
|
|
ret_value = FAIL;
|
|
|
|
|
} /* end if */
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case H5O_TYPE_NAMED_DATATYPE:
|
2008-10-16 11:52:16 +08:00
|
|
|
|
if(NULL == already_seen) {
|
|
|
|
|
obj_t *found_obj;
|
|
|
|
|
|
|
|
|
|
if((found_obj = search_obj(info->type_table, oinfo->addr)) == NULL)
|
|
|
|
|
add_obj(info->type_table, oinfo->addr, name, TRUE);
|
|
|
|
|
else {
|
|
|
|
|
/* Use latest version of name */
|
|
|
|
|
HDfree(found_obj->objname);
|
|
|
|
|
found_obj->objname = HDstrdup(name);
|
|
|
|
|
|
|
|
|
|
/* Mark named datatype as having valid name */
|
|
|
|
|
found_obj->recorded = TRUE;
|
|
|
|
|
} /* end else */
|
|
|
|
|
} /* end if */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
} /* end switch */
|
2001-03-09 04:18:42 +08:00
|
|
|
|
|
2005-08-26 04:16:40 +08:00
|
|
|
|
return ret_value;
|
2001-03-09 04:18:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2005-08-26 04:16:40 +08:00
|
|
|
|
* Function: init_objs
|
2001-03-09 04:18:42 +08:00
|
|
|
|
*
|
2005-08-26 04:16:40 +08:00
|
|
|
|
* Purpose: Initialize tables for groups, datasets & named datatypes
|
2001-03-09 04:18:42 +08:00
|
|
|
|
*
|
|
|
|
|
* Return: Success: SUCCEED
|
|
|
|
|
*
|
2005-08-26 04:16:40 +08:00
|
|
|
|
* Failure: FAIL
|
2001-03-09 04:18:42 +08:00
|
|
|
|
*
|
2005-08-26 04:16:40 +08:00
|
|
|
|
* Programmer: Ruey-Hsia Li
|
2001-03-09 04:18:42 +08:00
|
|
|
|
*
|
2005-08-26 04:16:40 +08:00
|
|
|
|
* Modifications:
|
2001-03-09 04:18:42 +08:00
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
2005-08-26 04:16:40 +08:00
|
|
|
|
herr_t
|
|
|
|
|
init_objs(hid_t fid, find_objs_t *info, table_t **group_table,
|
|
|
|
|
table_t **dset_table, table_t **type_table)
|
2001-03-09 04:18:42 +08:00
|
|
|
|
{
|
2005-08-26 04:16:40 +08:00
|
|
|
|
/* Initialize the tables */
|
|
|
|
|
init_table(group_table);
|
|
|
|
|
init_table(dset_table);
|
|
|
|
|
init_table(type_table);
|
|
|
|
|
|
|
|
|
|
/* Init the find_objs_t */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
|
info->fid = fid;
|
2005-08-26 04:16:40 +08:00
|
|
|
|
info->group_table = *group_table;
|
|
|
|
|
info->type_table = *type_table;
|
|
|
|
|
info->dset_table = *dset_table;
|
|
|
|
|
|
|
|
|
|
/* Find all shared objects */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
|
return(h5trav_visit(fid, "/", TRUE, TRUE, find_objs_cb, NULL, info));
|
2001-03-09 04:18:42 +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:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static void
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
|
add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t record)
|
2001-03-09 04:18:42 +08:00
|
|
|
|
{
|
2005-08-26 04:16:40 +08:00
|
|
|
|
unsigned u;
|
2001-03-09 04:18:42 +08:00
|
|
|
|
|
2005-08-26 04:16:40 +08:00
|
|
|
|
/* See if we need to make table larger */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
|
if(table->nobjs == table->size) {
|
2001-03-09 04:18:42 +08:00
|
|
|
|
table->size *= 2;
|
2010-08-20 03:55:48 +08:00
|
|
|
|
table->objs = (struct obj_t *)HDrealloc(table->objs, table->size * sizeof(table->objs[0]));
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
|
} /* end if */
|
2001-03-09 04:18:42 +08:00
|
|
|
|
|
2005-08-26 04:16:40 +08:00
|
|
|
|
/* Increment number of objects in table */
|
|
|
|
|
u = table->nobjs++;
|
|
|
|
|
|
|
|
|
|
/* Set information about object */
|
|
|
|
|
table->objs[u].objno = objno;
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
|
table->objs[u].objname = HDstrdup(objname);
|
2005-08-26 04:16:40 +08:00
|
|
|
|
table->objs[u].recorded = record;
|
|
|
|
|
table->objs[u].displayed = 0;
|
2001-03-09 04:18:42 +08:00
|
|
|
|
}
|
2005-02-09 04:55:17 +08:00
|
|
|
|
|
2005-08-10 00:53:43 +08:00
|
|
|
|
|
|
|
|
|
#ifndef H5_HAVE_TMPFILE
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: tmpfile
|
|
|
|
|
*
|
|
|
|
|
* Purpose: provide tmpfile() function when it is not supported by the
|
|
|
|
|
* system. Always return NULL for now.
|
|
|
|
|
*
|
|
|
|
|
* Return: a stream description when succeeds.
|
|
|
|
|
* NULL if fails.
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Albert Cheng, 2005/8/9
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
FILE *
|
|
|
|
|
tmpfile(void)
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
2010-04-23 02:17:35 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2010-09-17 01:48:06 +08:00
|
|
|
|
* Function: H5tools_get_symlink_info
|
2010-04-23 02:17:35 +08:00
|
|
|
|
*
|
2010-09-17 01:48:06 +08:00
|
|
|
|
* Purpose: Get symbolic link (soft, external) info and its target object type
|
2010-04-23 02:17:35 +08:00
|
|
|
|
(dataset, group, named datatype) and path, if exist
|
|
|
|
|
*
|
|
|
|
|
* Patameters:
|
|
|
|
|
* - [IN] fileid : link file id
|
|
|
|
|
* - [IN] linkpath : link path
|
|
|
|
|
* - [OUT] link_info: returning target object info (h5tool_link_info_t)
|
|
|
|
|
*
|
|
|
|
|
* Return:
|
|
|
|
|
* 2 : given pathname is object
|
|
|
|
|
* 1 : Succed to get link info.
|
|
|
|
|
* 0 : Detected as a dangling link
|
|
|
|
|
* -1 : H5 API failed.
|
|
|
|
|
*
|
|
|
|
|
* NOTE:
|
|
|
|
|
* link_info->trg_path must be freed out of this function
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Jonathan Kim
|
|
|
|
|
*
|
|
|
|
|
* Date: Feb 8, 2010
|
|
|
|
|
*-------------------------------------------------------------------------*/
|
2010-07-30 03:07:26 +08:00
|
|
|
|
int
|
2010-09-17 01:48:06 +08:00
|
|
|
|
H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_t *link_info,
|
[svn-r19292] Description:
Merge r19290 & r19291 from 1.8 branch to trunk:
r19290:
Correct another error in metadata accumulator dirty region calculations
(this time with a corner case when freeing data in the file).
r19291:
Avoid getting object information for soft/external links if we aren't
going to traverse across the link itself.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
Mac OS X/32 10.6.4 (amazon) in debug mode
Mac OS X/32 10.6.4 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Mac OS X/32 10.6.4 (amazon) w/parallel, in debug mode
2010-08-25 05:03:32 +08:00
|
|
|
|
hbool_t get_obj_type)
|
2010-04-23 02:17:35 +08:00
|
|
|
|
{
|
|
|
|
|
htri_t l_ret;
|
|
|
|
|
H5O_info_t trg_oinfo;
|
2010-07-30 03:07:26 +08:00
|
|
|
|
hid_t fapl = H5P_DEFAULT;
|
2010-04-23 02:17:35 +08:00
|
|
|
|
hid_t lapl = H5P_DEFAULT;
|
2010-07-30 03:07:26 +08:00
|
|
|
|
int ret = -1; /* init to fail */
|
2010-04-23 02:17:35 +08:00
|
|
|
|
|
|
|
|
|
/* init */
|
|
|
|
|
link_info->trg_type = H5O_TYPE_UNKNOWN;
|
|
|
|
|
|
2010-09-17 01:48:06 +08:00
|
|
|
|
/* if path is root, return group type */
|
|
|
|
|
if(!HDstrcmp(linkpath,"/"))
|
|
|
|
|
{
|
|
|
|
|
link_info->trg_type = H5O_TYPE_GROUP;
|
|
|
|
|
ret = 2;
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
2010-04-23 02:17:35 +08:00
|
|
|
|
/* check if link itself exist */
|
2010-07-30 03:07:26 +08:00
|
|
|
|
if(H5Lexists(file_id, linkpath, H5P_DEFAULT) <= 0) {
|
|
|
|
|
if(link_info->opt.msg_mode == 1)
|
2010-04-23 02:17:35 +08:00
|
|
|
|
parallel_print("Warning: link <%s> doesn't exist \n",linkpath);
|
|
|
|
|
goto out;
|
2010-07-30 03:07:26 +08:00
|
|
|
|
} /* end if */
|
2010-04-23 02:17:35 +08:00
|
|
|
|
|
|
|
|
|
/* get info from link */
|
2010-07-30 03:07:26 +08:00
|
|
|
|
if(H5Lget_info(file_id, linkpath, &(link_info->linfo), H5P_DEFAULT) < 0) {
|
|
|
|
|
if(link_info->opt.msg_mode == 1)
|
2010-04-23 02:17:35 +08:00
|
|
|
|
parallel_print("Warning: unable to get link info from <%s>\n",linkpath);
|
|
|
|
|
goto out;
|
2010-07-30 03:07:26 +08:00
|
|
|
|
} /* end if */
|
2010-04-23 02:17:35 +08:00
|
|
|
|
|
|
|
|
|
/* given path is hard link (object) */
|
2010-07-30 03:07:26 +08:00
|
|
|
|
if(link_info->linfo.type == H5L_TYPE_HARD) {
|
2010-07-08 02:52:04 +08:00
|
|
|
|
ret = 2;
|
2010-04-23 02:17:35 +08:00
|
|
|
|
goto out;
|
2010-07-30 03:07:26 +08:00
|
|
|
|
} /* end if */
|
2010-04-23 02:17:35 +08:00
|
|
|
|
|
|
|
|
|
/* trg_path must be freed out of this function when finished using */
|
|
|
|
|
link_info->trg_path = (char*)HDcalloc(link_info->linfo.u.val_size, sizeof(char));
|
|
|
|
|
HDassert(link_info->trg_path);
|
|
|
|
|
|
|
|
|
|
/* get link value */
|
2010-08-20 03:55:48 +08:00
|
|
|
|
if(H5Lget_val(file_id, linkpath, (void *)link_info->trg_path, link_info->linfo.u.val_size, H5P_DEFAULT) < 0) {
|
2010-07-30 03:07:26 +08:00
|
|
|
|
if(link_info->opt.msg_mode == 1)
|
2010-04-23 02:17:35 +08:00
|
|
|
|
parallel_print("Warning: unable to get link value from <%s>\n",linkpath);
|
|
|
|
|
goto out;
|
2010-07-30 03:07:26 +08:00
|
|
|
|
} /* end if */
|
2010-04-23 02:17:35 +08:00
|
|
|
|
|
|
|
|
|
/*-----------------------------------------------------
|
|
|
|
|
* if link type is external link use different lapl to
|
|
|
|
|
* follow object in other file
|
|
|
|
|
*/
|
2010-07-30 03:07:26 +08:00
|
|
|
|
if(link_info->linfo.type == H5L_TYPE_EXTERNAL) {
|
2011-05-21 06:04:03 +08:00
|
|
|
|
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
|
|
|
|
|
goto out;
|
[svn-r20536] Description:
Clean up various warnings & code formatting issues.
Bring changes from Coverity branch to trunk:
r20085:
Purpose: Fix coverity issue 793
Description: Modified H5S_hyper_project_simple_higher() to free the entire span
list in new_space on failure.
r20091:
This is a fix for coverity bug #1683.
Changed the two printfs to use %lu (unsigned long) for printing "dset_size".
r20162:
Purpose: Fix coverity issue 785
Description: Modified H5T_enum_nameof() to free "name" on failure if it was
allocated. Also clarified some code in H5S_hyper_rebuild_helper().
r20189:
Addressed coverity defect 783.
H5SL_new_node() in H5SL.c was failing to free space allocated in its
first alloc if the second alloc failed. Added a call to H5FL_FREE
to address this issue.
This is purely to keep coverity happy -- if this code is ever triggered,
we have much larger problems.
Note that this fix will trigger an unused return value complaint
from coverity next week.
r20190:
Fixed Coverity issues 1561 1565 and 1678 (UNUSED_VALUES) by moving checks of return values to after the function call.
r20191:
Fixed coverity issues 643 644 and 1678 (CHECKED_RETURN).
r20232:
Addressed coverity issues 923-925. Replaced calls to sprintf with calls
to HDsnprintf.
r20233:
Fix coverity issue 662. Don't try to sort 0 attributes in H5Aint.c.
r20234:
Fix coverity issue 664. Check for NULL before dereferencing in H5Gdeprec.c.
r20271:
Purpose: Fix coverity issue 784
Description: Modified H5_debug_mask() to keep a list of files opened for use as
a debugging output stream, and modified H5_term_library to close these files on
exit.
r20272:
addressed coverity issues 838 & 955. Issue was use of strcpy() -- existing
code was safe, but modified to use strncpy() to keep coverity happy.
r20273:
Addresed coverity issues 1388 and 1389.
Initialized sel_iter->type to NULL in H5S_select_iter_init.
r20275:
Purpose: Fix valgrind issue in mf.c
Description: Fixed bug (incomplete if statement) in test_mf_fs_alloc_free() so
the retrieved node gets freed.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
2011-04-18 02:57:07 +08:00
|
|
|
|
if(H5Pset_fapl_sec2(fapl) < 0)
|
|
|
|
|
goto out;
|
2011-05-21 06:04:03 +08:00
|
|
|
|
if((lapl = H5Pcreate(H5P_LINK_ACCESS)) < 0)
|
|
|
|
|
goto out;
|
[svn-r20536] Description:
Clean up various warnings & code formatting issues.
Bring changes from Coverity branch to trunk:
r20085:
Purpose: Fix coverity issue 793
Description: Modified H5S_hyper_project_simple_higher() to free the entire span
list in new_space on failure.
r20091:
This is a fix for coverity bug #1683.
Changed the two printfs to use %lu (unsigned long) for printing "dset_size".
r20162:
Purpose: Fix coverity issue 785
Description: Modified H5T_enum_nameof() to free "name" on failure if it was
allocated. Also clarified some code in H5S_hyper_rebuild_helper().
r20189:
Addressed coverity defect 783.
H5SL_new_node() in H5SL.c was failing to free space allocated in its
first alloc if the second alloc failed. Added a call to H5FL_FREE
to address this issue.
This is purely to keep coverity happy -- if this code is ever triggered,
we have much larger problems.
Note that this fix will trigger an unused return value complaint
from coverity next week.
r20190:
Fixed Coverity issues 1561 1565 and 1678 (UNUSED_VALUES) by moving checks of return values to after the function call.
r20191:
Fixed coverity issues 643 644 and 1678 (CHECKED_RETURN).
r20232:
Addressed coverity issues 923-925. Replaced calls to sprintf with calls
to HDsnprintf.
r20233:
Fix coverity issue 662. Don't try to sort 0 attributes in H5Aint.c.
r20234:
Fix coverity issue 664. Check for NULL before dereferencing in H5Gdeprec.c.
r20271:
Purpose: Fix coverity issue 784
Description: Modified H5_debug_mask() to keep a list of files opened for use as
a debugging output stream, and modified H5_term_library to close these files on
exit.
r20272:
addressed coverity issues 838 & 955. Issue was use of strcpy() -- existing
code was safe, but modified to use strncpy() to keep coverity happy.
r20273:
Addresed coverity issues 1388 and 1389.
Initialized sel_iter->type to NULL in H5S_select_iter_init.
r20275:
Purpose: Fix valgrind issue in mf.c
Description: Fixed bug (incomplete if statement) in test_mf_fs_alloc_free() so
the retrieved node gets freed.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
2011-04-18 02:57:07 +08:00
|
|
|
|
if(H5Pset_elink_fapl(lapl, fapl) < 0)
|
|
|
|
|
goto out;
|
2010-07-30 03:07:26 +08:00
|
|
|
|
} /* end if */
|
2010-04-23 02:17:35 +08:00
|
|
|
|
|
[svn-r19292] Description:
Merge r19290 & r19291 from 1.8 branch to trunk:
r19290:
Correct another error in metadata accumulator dirty region calculations
(this time with a corner case when freeing data in the file).
r19291:
Avoid getting object information for soft/external links if we aren't
going to traverse across the link itself.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
Mac OS X/32 10.6.4 (amazon) in debug mode
Mac OS X/32 10.6.4 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Mac OS X/32 10.6.4 (amazon) w/parallel, in debug mode
2010-08-25 05:03:32 +08:00
|
|
|
|
/* Check for retrieving object info */
|
|
|
|
|
if(get_obj_type) {
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
|
* if link's target object exist, get type
|
|
|
|
|
*/
|
|
|
|
|
/* check if target object exist */
|
|
|
|
|
l_ret = H5Oexists_by_name(file_id, linkpath, lapl);
|
|
|
|
|
|
|
|
|
|
/* detect dangling link */
|
|
|
|
|
if(l_ret == FALSE) {
|
|
|
|
|
ret = 0;
|
|
|
|
|
goto out;
|
|
|
|
|
} /* end if */
|
|
|
|
|
/* function failed */
|
|
|
|
|
else if(l_ret < 0)
|
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
|
|
/* get target object info */
|
|
|
|
|
if(H5Oget_info_by_name(file_id, linkpath, &trg_oinfo, lapl) < 0) {
|
|
|
|
|
if(link_info->opt.msg_mode == 1)
|
|
|
|
|
parallel_print("Warning: unable to get object information for <%s>\n", linkpath);
|
|
|
|
|
goto out;
|
|
|
|
|
} /* end if */
|
|
|
|
|
|
|
|
|
|
/* check unknown type */
|
|
|
|
|
if(trg_oinfo.type < H5O_TYPE_GROUP || trg_oinfo.type >=H5O_TYPE_NTYPES) {
|
|
|
|
|
if(link_info->opt.msg_mode == 1)
|
|
|
|
|
parallel_print("Warning: target object of <%s> is unknown type\n", linkpath);
|
|
|
|
|
goto out;
|
|
|
|
|
} /* end if */
|
|
|
|
|
|
|
|
|
|
/* set target obj type to return */
|
|
|
|
|
link_info->trg_type = trg_oinfo.type;
|
2010-07-30 03:07:26 +08:00
|
|
|
|
} /* end if */
|
[svn-r19292] Description:
Merge r19290 & r19291 from 1.8 branch to trunk:
r19290:
Correct another error in metadata accumulator dirty region calculations
(this time with a corner case when freeing data in the file).
r19291:
Avoid getting object information for soft/external links if we aren't
going to traverse across the link itself.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
Mac OS X/32 10.6.4 (amazon) in debug mode
Mac OS X/32 10.6.4 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Mac OS X/32 10.6.4 (amazon) w/parallel, in debug mode
2010-08-25 05:03:32 +08:00
|
|
|
|
else
|
|
|
|
|
link_info->trg_type = H5O_TYPE_UNKNOWN;
|
2010-04-23 02:17:35 +08:00
|
|
|
|
|
|
|
|
|
/* succeed */
|
2010-07-08 02:52:04 +08:00
|
|
|
|
ret = 1;
|
2010-07-30 03:07:26 +08:00
|
|
|
|
|
2010-04-23 02:17:35 +08:00
|
|
|
|
out:
|
2010-07-30 03:07:26 +08:00
|
|
|
|
if(fapl != H5P_DEFAULT)
|
2010-04-23 02:17:35 +08:00
|
|
|
|
H5Pclose(fapl);
|
2010-07-30 03:07:26 +08:00
|
|
|
|
if(lapl != H5P_DEFAULT)
|
2010-04-23 02:17:35 +08:00
|
|
|
|
H5Pclose(lapl);
|
|
|
|
|
|
2010-07-08 02:52:04 +08:00
|
|
|
|
return ret;
|
2010-09-17 01:48:06 +08:00
|
|
|
|
} /* end H5tools_get_symlink_info() */
|
2010-05-15 05:54:59 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Audience: Public
|
|
|
|
|
* Chapter: H5Tools Library
|
|
|
|
|
* Purpose: Initialize the name and operation status of the H5 Tools library
|
|
|
|
|
* Description:
|
|
|
|
|
* These are utility functions to set/get the program name and operation status.
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
void h5tools_setprogname(const char *Progname)
|
|
|
|
|
{
|
|
|
|
|
h5tools_progname = Progname;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void h5tools_setstatus(int D_status)
|
|
|
|
|
{
|
|
|
|
|
h5tools_d_status = D_status;
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-20 03:55:48 +08:00
|
|
|
|
const char*h5tools_getprogname(void)
|
2010-05-15 05:54:59 +08:00
|
|
|
|
{
|
|
|
|
|
return h5tools_progname;
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-20 03:55:48 +08:00
|
|
|
|
int h5tools_getstatus(void)
|
2010-05-15 05:54:59 +08:00
|
|
|
|
{
|
|
|
|
|
return h5tools_d_status;
|
|
|
|
|
}
|
2011-10-15 06:44:11 +08:00
|
|
|
|
|
|
|
|
|
/*-----------------------------------------------------------
|
|
|
|
|
* PURPOSE :
|
|
|
|
|
* if environment variable H5TOOLS_BUFSIZE is set,
|
|
|
|
|
* update H5TOOLS_BUFSIZE and H5TOOLS_MALLOCSIZE from the env
|
|
|
|
|
* This can be called from each tools main() as part of initial act.
|
|
|
|
|
* Note: this is more of debugging purpose for now.
|
|
|
|
|
*/
|
|
|
|
|
int h5tools_getenv_update_hyperslab_bufsize(void)
|
|
|
|
|
{
|
|
|
|
|
const char *env_str = NULL;
|
|
|
|
|
long hyperslab_bufsize_mb;
|
|
|
|
|
|
|
|
|
|
/* check if environment variable is set for the hyperslab buffer size */
|
|
|
|
|
if (NULL != (env_str = HDgetenv ("H5TOOLS_BUFSIZE")))
|
|
|
|
|
{
|
|
|
|
|
errno = 0;
|
|
|
|
|
hyperslab_bufsize_mb = HDstrtol(env_str, (char**)NULL, 10);
|
|
|
|
|
if (errno != 0 || hyperslab_bufsize_mb <= 0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/* TODO: later when pubilshed
|
|
|
|
|
printf("Error: Invalid environment variable \"H5TOOLS_BUFSIZE\" : %s\n", env_str);
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* convert MB to byte */
|
|
|
|
|
H5TOOLS_BUFSIZE = hyperslab_bufsize_mb * 1024 * 1024;
|
|
|
|
|
|
|
|
|
|
H5TOOLS_MALLOCSIZE = MAX(H5TOOLS_BUFSIZE, H5TOOLS_MALLOCSIZE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (1);
|
|
|
|
|
error:
|
|
|
|
|
return (-1);
|
|
|
|
|
}
|