2003-04-01 02:06:44 +08:00
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
2007-02-07 22:56:24 +08:00
|
|
|
* Copyright by The HDF Group. *
|
2003-04-01 02:06:44 +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 *
|
2017-04-15 00:54:16 +08:00
|
|
|
* the COPYING file, which can be found at the root of the source code *
|
|
|
|
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
|
|
|
|
* If you do not have access to either file, you may request a copy from *
|
|
|
|
* help@hdfgroup.org. *
|
2003-04-01 02:06:44 +08:00
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
|
2003-01-24 06:08:51 +08:00
|
|
|
#ifndef H5TRAV_H__
|
|
|
|
#define H5TRAV_H__
|
|
|
|
|
2003-10-23 05:30:19 +08:00
|
|
|
#include "hdf5.h"
|
2003-01-24 06:08:51 +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
|
|
|
/* Typedefs for visiting objects */
|
|
|
|
typedef herr_t (*h5trav_obj_func_t)(const char *path_name, const H5O_info_t *oinfo,
|
|
|
|
const char *first_seen, void *udata);
|
|
|
|
typedef herr_t (*h5trav_lnk_func_t)(const char *path_name, const H5L_info_t *linfo,
|
|
|
|
void *udata);
|
|
|
|
|
2003-10-23 05:30:19 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2007-09-13 23:44:56 +08:00
|
|
|
* public enum to specify type of an object
|
2005-08-14 04:53:35 +08:00
|
|
|
* the TYPE can be:
|
2007-09-13 23:44:56 +08:00
|
|
|
* H5TRAV_TYPE_UNKNOWN = -1,
|
|
|
|
* H5TRAV_TYPE_GROUP, Object is a group
|
|
|
|
* H5TRAV_TYPE_DATASET, Object is a dataset
|
|
|
|
* H5TRAV_TYPE_TYPE, Object is a named datatype
|
|
|
|
* H5TRAV_TYPE_LINK, Object is a symbolic link
|
|
|
|
* H5TRAV_TYPE_UDLINK, Object is a user-defined link
|
2003-10-23 05:30:19 +08:00
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2007-09-13 23:44:56 +08:00
|
|
|
typedef enum {
|
2010-09-17 01:48:06 +08:00
|
|
|
H5TRAV_TYPE_UNKNOWN = -1, /* Unknown object type */
|
2007-09-13 23:44:56 +08:00
|
|
|
H5TRAV_TYPE_GROUP, /* Object is a group */
|
|
|
|
H5TRAV_TYPE_DATASET, /* Object is a dataset */
|
|
|
|
H5TRAV_TYPE_NAMED_DATATYPE, /* Object is a named datatype */
|
|
|
|
H5TRAV_TYPE_LINK, /* Object is a symbolic link */
|
|
|
|
H5TRAV_TYPE_UDLINK /* Object is a user-defined link */
|
|
|
|
} h5trav_type_t;
|
2003-01-24 06:08:51 +08:00
|
|
|
|
2007-09-13 23:44:56 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* public struct to store name and type of an object
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2010-09-17 01:48:06 +08:00
|
|
|
/* Struct to keep track of symbolic link targets visited.
|
|
|
|
* Functions: symlink_visit_add() and symlink_is_visited()
|
|
|
|
*/
|
2014-03-16 12:44:13 +08:00
|
|
|
typedef struct symlink_trav_path_t {
|
|
|
|
H5L_type_t type;
|
|
|
|
char *file;
|
|
|
|
char *path;
|
|
|
|
} symlink_trav_path_t;
|
|
|
|
|
2010-09-17 01:48:06 +08:00
|
|
|
typedef struct symlink_trav_t {
|
|
|
|
size_t nalloc;
|
|
|
|
size_t nused;
|
2014-03-16 12:44:13 +08:00
|
|
|
symlink_trav_path_t *objs;
|
2010-09-17 01:48:06 +08:00
|
|
|
hbool_t dangle_link;
|
|
|
|
} symlink_trav_t;
|
|
|
|
|
2007-09-06 23:54:22 +08:00
|
|
|
typedef struct trav_path_t {
|
|
|
|
char *path;
|
2007-09-13 23:44:56 +08:00
|
|
|
h5trav_type_t type;
|
2011-05-07 06:02:24 +08:00
|
|
|
haddr_t objno; /* object address */
|
|
|
|
unsigned long fileno; /* File number that object is located in */
|
2007-09-06 23:54:22 +08:00
|
|
|
} trav_path_t;
|
|
|
|
|
|
|
|
typedef struct trav_info_t {
|
|
|
|
size_t nalloc;
|
|
|
|
size_t nused;
|
2010-09-17 01:48:06 +08:00
|
|
|
const char *fname;
|
|
|
|
hid_t fid; /* File ID */
|
2007-09-06 23:54:22 +08:00
|
|
|
trav_path_t *paths;
|
2010-09-17 01:48:06 +08:00
|
|
|
symlink_trav_t symlink_visited; /* already visited symbolic links */
|
|
|
|
void * opts; /* optional data passing */
|
2003-10-29 01:40:05 +08:00
|
|
|
} trav_info_t;
|
2003-01-24 06:08:51 +08:00
|
|
|
|
2003-10-23 05:30:19 +08:00
|
|
|
|
2003-12-19 00:18:09 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* keep record of hard link information
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
typedef struct trav_link_t {
|
2006-11-17 04:38:05 +08:00
|
|
|
char *new_name;
|
2003-12-19 00:18:09 +08:00
|
|
|
} trav_link_t;
|
|
|
|
|
|
|
|
|
2003-10-23 05:30:19 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2003-10-29 01:40:05 +08:00
|
|
|
* struct to store basic info needed for the h5trav table traversal algorythm
|
2003-10-23 05:30:19 +08:00
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2003-10-29 01:40:05 +08:00
|
|
|
typedef struct trav_obj_t {
|
2007-09-13 23:44:56 +08:00
|
|
|
haddr_t objno; /* object address */
|
2003-12-19 00:18:09 +08:00
|
|
|
unsigned flags[2]; /* h5diff.object is present or not in both files*/
|
2011-05-07 06:02:24 +08:00
|
|
|
hbool_t is_same_trgobj; /* same target object? no need to compare */
|
2003-12-19 00:18:09 +08:00
|
|
|
char *name; /* name */
|
2007-09-13 23:44:56 +08:00
|
|
|
h5trav_type_t type; /* type of object */
|
2003-12-19 00:18:09 +08:00
|
|
|
trav_link_t *links; /* array of possible link names */
|
2007-09-06 23:54:22 +08:00
|
|
|
size_t sizelinks; /* size of links array */
|
|
|
|
size_t nlinks; /* number of links */
|
2003-10-29 01:40:05 +08:00
|
|
|
} trav_obj_t;
|
2003-01-24 06:08:51 +08:00
|
|
|
|
2003-10-23 05:30:19 +08:00
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2003-10-29 01:40:05 +08:00
|
|
|
* private struct that stores all objects
|
2003-10-23 05:30:19 +08:00
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2003-10-29 01:40:05 +08:00
|
|
|
typedef struct trav_table_t {
|
2007-09-06 23:54:22 +08:00
|
|
|
size_t size;
|
|
|
|
size_t nobjs;
|
2006-11-17 04:38:05 +08:00
|
|
|
trav_obj_t *objs;
|
2003-10-29 01:40:05 +08:00
|
|
|
} trav_table_t;
|
2003-01-24 06:08:51 +08:00
|
|
|
|
|
|
|
|
2003-10-23 05:30:19 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2003-12-19 04:25:11 +08:00
|
|
|
* public functions
|
2003-10-23 05:30:19 +08:00
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
[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
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* "h5trav general" public functions
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2012-07-12 23:38:44 +08:00
|
|
|
H5TOOLS_DLL void h5trav_set_index(H5_index_t print_index_by, H5_iter_order_t print_index_order);
|
2010-09-17 01:48:06 +08:00
|
|
|
H5TOOLS_DLL int h5trav_visit(hid_t file_id, const char *grp_name,
|
|
|
|
hbool_t visit_start, hbool_t recurse, h5trav_obj_func_t visit_obj,
|
|
|
|
h5trav_lnk_func_t visit_lnk, void *udata);
|
|
|
|
H5TOOLS_DLL herr_t symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, const char *path);
|
|
|
|
H5TOOLS_DLL hbool_t symlink_is_visited(symlink_trav_t *visited, H5L_type_t type, const char *file, const char *path);
|
[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
|
|
|
|
2003-12-19 04:25:11 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* "h5trav info" public functions
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2010-05-12 04:10:25 +08:00
|
|
|
H5TOOLS_DLL int h5trav_getinfo(hid_t file_id, trav_info_t *info);
|
|
|
|
H5TOOLS_DLL ssize_t h5trav_getindex(const trav_info_t *info, const char *obj);
|
2010-09-17 01:48:06 +08:00
|
|
|
H5TOOLS_DLL int trav_info_visit_obj (const char *path, const H5O_info_t *oinfo, const char *already_visited, void *udata);
|
|
|
|
H5TOOLS_DLL int trav_info_visit_lnk (const char *path, const H5L_info_t *linfo, void *udata);
|
2003-12-17 22:07:41 +08:00
|
|
|
|
2003-12-19 04:25:11 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* "h5trav table" public functions
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2010-05-12 04:10:25 +08:00
|
|
|
H5TOOLS_DLL int h5trav_gettable(hid_t fid, trav_table_t *travt);
|
|
|
|
H5TOOLS_DLL int h5trav_getindext(const char *obj, const trav_table_t *travt);
|
2007-09-06 23:54:22 +08:00
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* "h5trav print" public functions
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2012-07-12 23:38:44 +08:00
|
|
|
H5TOOLS_DLL int h5trav_print(hid_t fid);
|
2012-07-13 04:30:30 +08:00
|
|
|
H5TOOLS_DLL void h5trav_set_verbose(int print_verbose);
|
2003-10-23 05:30:19 +08:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-09-06 23:54:22 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* info private functions
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2010-09-17 01:48:06 +08:00
|
|
|
H5TOOLS_DLL void trav_info_init(const char *filename, hid_t fileid, trav_info_t **info);
|
2007-09-06 23:54:22 +08:00
|
|
|
|
2010-05-12 04:10:25 +08:00
|
|
|
H5TOOLS_DLL void trav_info_free(trav_info_t *info);
|
2007-09-06 23:54:22 +08:00
|
|
|
|
2010-09-17 01:48:06 +08:00
|
|
|
H5TOOLS_DLL void trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type);
|
|
|
|
|
2012-08-04 04:11:36 +08:00
|
|
|
H5TOOLS_DLL void trav_fileinfo_add(trav_info_t *info, hid_t loc_id);
|
|
|
|
|
2003-10-23 05:30:19 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* table private functions
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2003-05-19 13:09:08 +08:00
|
|
|
|
2010-05-12 04:10:25 +08:00
|
|
|
H5TOOLS_DLL void trav_table_init(trav_table_t **table);
|
2003-12-03 23:35:32 +08:00
|
|
|
|
2010-05-12 04:10:25 +08:00
|
|
|
H5TOOLS_DLL void trav_table_free(trav_table_t *table);
|
2003-12-03 23:35:32 +08:00
|
|
|
|
2010-05-12 04:10:25 +08:00
|
|
|
H5TOOLS_DLL void trav_table_addflags(unsigned *flags,
|
2005-08-14 04:53:35 +08:00
|
|
|
char *objname,
|
2007-09-13 23:44:56 +08:00
|
|
|
h5trav_type_t type,
|
2003-12-03 23:35:32 +08:00
|
|
|
trav_table_t *table);
|
2003-05-19 13:09:08 +08:00
|
|
|
|
2003-01-24 06:08:51 +08:00
|
|
|
#endif /* H5TRAV_H__ */
|
2007-03-06 00:26:50 +08:00
|
|
|
|