1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * Copyright by The HDF Group.                                               *
3  * Copyright by the Board of Trustees of the University of Illinois.         *
4  * All rights reserved.                                                      *
5  *                                                                           *
6  * This file is part of HDF5.  The full HDF5 copyright notice, including     *
7  * terms governing use, modification, and redistribution, is contained in    *
8  * the COPYING file, which can be found at the root of the source code       *
9  * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.  *
10  * If you do not have access to either file, you may request a copy from     *
11  * help@hdfgroup.org.                                                        *
12  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13 #ifndef H5DUMP_H__
14 #define H5DUMP_H__
15 
16 #include "hdf5.h"
17 #include "H5private.h"
18 #include "h5tools.h"
19 #include "h5tools_utils.h"
20 #include "h5tools_ref.h"
21 #include "h5trav.h"
22 #include "h5dump_defines.h"
23 
24 /**
25  **  This is the global dispatch table for the dump functions.
26  **/
27 /* the table of dump functions */
28 typedef struct dump_functions_t {
29     void     (*dump_group_function) (hid_t, const char *);
30     void     (*dump_named_datatype_function) (hid_t, const char *);
31     void     (*dump_dataset_function) (hid_t, const char *, struct subset_t *);
32     void     (*dump_dataspace_function) (hid_t);
33     void     (*dump_datatype_function) (hid_t);
34     herr_t   (*dump_attribute_function) (hid_t, const char *, const H5A_info_t *, void *);
35     void     (*dump_data_function) (hid_t, int, struct subset_t *, int);
36 } dump_functions;
37 
38 /* List of table structures.  There is one table structure for each file */
39 typedef struct h5dump_table_items_t {
40     unsigned long   fileno;         /* File number that these tables refer to */
41     hid_t           oid;            /* ID of an object in this file, held open so fileno is consistent */
42     table_t         *group_table;   /* Table of groups */
43     table_t         *dset_table;    /* Table of datasets */
44     table_t         *type_table;    /* Table of datatypes */
45 } h5dump_table_items_t;
46 typedef struct h5dump_table_list_t {
47     size_t                  nalloc;
48     size_t                  nused;
49     h5dump_table_items_t    *tables;
50 } h5dump_table_list_t;
51 
52 h5dump_table_list_t  table_list = {0, 0, NULL};
53 table_t             *group_table = NULL, *dset_table = NULL, *type_table = NULL;
54 unsigned            dump_indent = 0;              /*how far in to indent the line         */
55 
56 int          unamedtype = 0;     /* shared datatype with no name */
57 hbool_t      hit_elink = FALSE;  /* whether we have traversed an external link */
58 size_t       prefix_len = 1024;
59 char         *prefix = NULL;
60 const char   *fp_format = NULL;
61 
62 /* things to display or which are set via command line parameters */
63 int          display_all       = TRUE;
64 int          display_oid       = FALSE;
65 int          display_data      = TRUE;
66 int          display_attr_data = TRUE;
67 int          display_char      = FALSE; /*print 1-byte numbers as ASCII */
68 int          usingdasho        = FALSE;
69 int          display_bb        = FALSE; /*superblock */
70 int          display_dcpl      = FALSE; /*dcpl */
71 int          display_fi        = FALSE; /*file index */
72 int          display_ai        = TRUE;  /*array index */
73 int          display_escape    = FALSE; /*escape non printable characters */
74 int          display_region    = FALSE; /*print region reference data */
75 int          disable_compact_subset= FALSE; /* disable compact form of subset notation */
76 int          display_packed_bits = FALSE; /*print 1-8 byte numbers as packed bits*/
77 int          include_attrs     = TRUE; /* Display attributes */
78 int          display_vds_first = FALSE; /* vds display to all by default*/
79 int          vds_gap_size       = 0; /* vds skip missing files default is none */
80 
81 #define PACKED_BITS_MAX         8  /* Maximum number of packed-bits to display */
82 #define PACKED_BITS_SIZE_MAX    (8*sizeof(long long))  /* Maximum bits size of integer types of packed-bits */
83 /* mask list for packed bits */
84 unsigned long long packed_mask[PACKED_BITS_MAX];  /* packed bits are restricted to 8*sizeof(llong) bytes */
85 
86 /* packed bits display parameters */
87 unsigned packed_offset[PACKED_BITS_MAX];
88 unsigned packed_length[PACKED_BITS_MAX];
89 
90 /*
91  * The global table is set to either ddl_function_table or
92  * xml_function_table in the initialization.
93  */
94 const dump_functions *dump_function_table;
95 
96 #ifdef __cplusplus
97 "C" {
98 #endif
99 
100 void     add_prefix(char **prfx, size_t *prfx_len, const char *name);
101 hid_t    h5_fileaccess(void);
102 ssize_t  table_list_add(hid_t oid, unsigned long file_no);
103 ssize_t  table_list_visited(unsigned long file_no);
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif  /* !H5DUMP_H__ */
110