MISR Toolkit
1.5.1
win64
HDF5_1.8.21
include
h5tools_utils.h
Go to the documentation of this file.
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
14
/*
15
* Programmer: Bill Wendling <wendling@ncsa.uiuc.edu>
16
* Tuesday, 6. March 2001
17
*
18
* Purpose: Support functions for the various tools.
19
*/
20
#ifndef H5TOOLS_UTILS_H__
21
#define H5TOOLS_UTILS_H__
22
23
#include "
hdf5.h
"
24
25
#ifdef __cplusplus
26
extern
"C"
{
27
#endif
28
29
/* ``parallel_print'' information */
30
#define PRINT_DATA_MAX_SIZE 512
31
#define OUTBUFF_SIZE (PRINT_DATA_MAX_SIZE*4)
32
33
H5TOOLS_DLLVAR
int
g_nTasks
;
34
H5TOOLS_DLLVAR
unsigned
char
g_Parallel
;
35
H5TOOLS_DLLVAR
char
outBuff
[];
36
H5TOOLS_DLLVAR
unsigned
outBuffOffset
;
37
H5TOOLS_DLLVAR
FILE *
overflow_file
;
38
39
/* Maximum size used in a call to malloc for a dataset */
40
H5TOOLS_DLLVAR
hsize_t
H5TOOLS_MALLOCSIZE
;
41
/* size of hyperslab buffer when a dataset is bigger than H5TOOLS_MALLOCSIZE */
42
H5TOOLS_DLLVAR
hsize_t
H5TOOLS_BUFSIZE
;
43
/*
44
* begin get_option section
45
*/
46
H5TOOLS_DLLVAR
int
opt_err
;
/* getoption prints errors if this is on */
47
H5TOOLS_DLLVAR
int
opt_ind
;
/* token pointer */
48
H5TOOLS_DLLVAR
const
char
*
opt_arg
;
/* flag argument (or value) */
49
50
enum
{
51
no_arg
= 0,
/* doesn't take an argument */
52
require_arg
,
/* requires an argument */
53
optional_arg
/* argument is optional */
54
};
55
56
/*
57
* get_option determines which options are specified on the command line and
58
* returns a pointer to any arguments possibly associated with the option in
59
* the ``opt_arg'' variable. get_option returns the shortname equivalent of
60
* the option. The long options are specified in the following way:
61
*
62
* struct long_options foo[] = {
63
* { "filename", require_arg, 'f' },
64
* { "append", no_arg, 'a' },
65
* { "width", require_arg, 'w' },
66
* { NULL, 0, 0 }
67
* };
68
*
69
* Long named options can have arguments specified as either:
70
*
71
* ``--param=arg'' or ``--param arg''
72
*
73
* Short named options can have arguments specified as either:
74
*
75
* ``-w80'' or ``-w 80''
76
*
77
* and can have more than one short named option specified at one time:
78
*
79
* -aw80
80
*
81
* in which case those options which expect an argument need to come at the
82
* end.
83
*/
84
typedef
struct
long_options
{
85
const
char
*
name
;
/* name of the long option */
86
int
has_arg
;
/* whether we should look for an arg */
87
char
shortval
;
/* the shortname equivalent of long arg
88
* this gets returned from get_option */
89
}
long_options
;
90
91
H5TOOLS_DLL
int
get_option
(
int
argc,
const
char
**argv,
const
char
*opt,
92
const
struct
long_options
*l_opt);
93
/*
94
* end get_option section
95
*/
96
97
/*struct taken from the dumper. needed in table struct*/
98
typedef
struct
obj_t
{
99
haddr_t
objno
;
100
char
*
objname
;
101
hbool_t
displayed
;
/* Flag to indicate that the object has been displayed */
102
hbool_t
recorded
;
/* Flag for named datatypes to indicate they were found in the group hierarchy */
103
}
obj_t
;
104
105
/*struct for the tables that the find_objs function uses*/
106
typedef
struct
table_t
{
107
size_t
size
;
108
size_t
nobjs
;
109
obj_t
*
objs
;
110
}
table_t
;
111
112
/*this struct stores the information that is passed to the find_objs function*/
113
typedef
struct
find_objs_t
{
114
hid_t
fid
;
115
table_t
*
group_table
;
116
table_t
*
type_table
;
117
table_t
*
dset_table
;
118
}
find_objs_t
;
119
120
H5TOOLS_DLLVAR
unsigned
h5tools_nCols
;
/*max number of columns for outputting */
121
122
/* Definitions of useful routines */
123
H5TOOLS_DLL
void
indentation
(
unsigned
);
124
H5TOOLS_DLL
void
print_version
(
const
char
*progname);
125
H5TOOLS_DLL
void
parallel_print
(
const
char
*
format
, ... );
126
H5TOOLS_DLL
void
error_msg
(
const
char
*fmt, ...);
127
H5TOOLS_DLL
void
warn_msg
(
const
char
*fmt, ...);
128
H5TOOLS_DLL
void
help_ref_msg
(FILE *
output
);
129
H5TOOLS_DLL
void
free_table
(
table_t
*table);
130
#ifdef H5DUMP_DEBUG
131
H5TOOLS_DLL
void
dump_tables(
find_objs_t
*
info
)
132
#endif
/* H5DUMP_DEBUG */
133
H5TOOLS_DLL
herr_t
init_objs
(
hid_t
fid,
find_objs_t
*info,
table_t
**group_table,
134
table_t
**dset_table,
table_t
**type_table);
135
H5TOOLS_DLL
obj_t
*
search_obj
(
table_t
*temp,
haddr_t
objno);
136
#ifndef H5_HAVE_TMPFILE
137
H5TOOLS_DLL
FILE * tmpfile(
void
);
138
#endif
139
140
/*************************************************************
141
*
142
* candidate functions to be public
143
*
144
*************************************************************/
145
146
/* This code is layout for common code among tools */
147
typedef
enum
toolname_t
{
148
TOOL_H5DIFF
,
TOOL_H5LS
,
TOOL__H5DUMP
/* add as necessary */
149
}
h5tool_toolname_t
;
150
151
/* this struct can be used to differntiate among tools */
152
typedef
struct
{
153
h5tool_toolname_t
toolname
;
154
int
msg_mode
;
155
}
h5tool_opt_t
;
156
157
/* obtain link info from H5tools_get_symlink_info() */
158
typedef
struct
{
159
H5O_type_t
trg_type
;
/* OUT: target type */
160
char
*
trg_path
;
/* OUT: target obj path. This must be freed
161
* when used with H5tools_get_symlink_info() */
162
haddr_t
objno
;
/* OUT: target object address */
163
unsigned
long
fileno
;
/* OUT: File number that target object is located in */
164
H5L_info_t
linfo
;
/* OUT: link info */
165
h5tool_opt_t
opt
;
/* IN: options */
166
}
h5tool_link_info_t
;
167
168
169
/* Definitions of routines */
170
H5TOOLS_DLL
int
H5tools_get_symlink_info
(
hid_t
file_id,
const
char
* linkpath,
171
h5tool_link_info_t
*link_info,
hbool_t
get_obj_type);
172
H5TOOLS_DLL
const
char
*
h5tools_getprogname
(
void
);
173
H5TOOLS_DLL
void
h5tools_setprogname
(
const
char
*progname);
174
H5TOOLS_DLL
int
h5tools_getstatus
(
void
);
175
H5TOOLS_DLL
void
h5tools_setstatus
(
int
d_status);
176
H5TOOLS_DLL
int
h5tools_getenv_update_hyperslab_bufsize
(
void
);
177
#ifdef __cplusplus
178
}
179
#endif
180
181
#endif
/* H5TOOLS_UTILS_H__ */
toolname_t
toolname_t
Definition:
h5tools_utils.h:147
get_option
H5TOOLS_DLL int get_option(int argc, const char **argv, const char *opt, const struct long_options *l_opt)
H5TOOLS_BUFSIZE
H5TOOLS_DLLVAR hsize_t H5TOOLS_BUFSIZE
Definition:
h5tools_utils.h:42
H5TOOLS_DLLVAR
#define H5TOOLS_DLLVAR
Definition:
H5api_adpt.h:261
opt_err
H5TOOLS_DLLVAR int opt_err
Definition:
h5tools_utils.h:46
obj_t::objname
char * objname
Definition:
h5tools_utils.h:100
h5tool_toolname_t
enum toolname_t h5tool_toolname_t
info
HDFFCLIBAPI intf * info
Definition:
hproto_fortran.h:737
hbool_t
unsigned int hbool_t
Definition:
H5public.h:142
outBuff
H5TOOLS_DLLVAR char outBuff[]
Definition:
h5tools_utils.h:35
h5tool_link_info_t::trg_type
H5O_type_t trg_type
Definition:
h5tools_utils.h:159
H5TOOLS_DLL
#define H5TOOLS_DLL
Definition:
H5api_adpt.h:260
long_options::shortval
char shortval
Definition:
h5tools_utils.h:87
long_options::has_arg
int has_arg
Definition:
h5tools_utils.h:86
find_objs_t
struct find_objs_t find_objs_t
g_nTasks
H5TOOLS_DLLVAR int g_nTasks
Definition:
h5tools_utils.h:33
h5tools_getprogname
H5TOOLS_DLL const char * h5tools_getprogname(void)
obj_t
struct obj_t obj_t
warn_msg
H5TOOLS_DLL void warn_msg(const char *fmt,...)
herr_t
int herr_t
Definition:
H5public.h:124
h5tool_link_info_t::opt
h5tool_opt_t opt
Definition:
h5tools_utils.h:165
TOOL_H5LS
Definition:
h5tools_utils.h:148
no_arg
Definition:
h5tools_utils.h:51
table_t::size
size_t size
Definition:
h5tools_utils.h:107
h5tool_link_info_t
Definition:
h5tools_utils.h:158
h5tool_opt_t
Definition:
h5tools_utils.h:152
h5tools_getstatus
H5TOOLS_DLL int h5tools_getstatus(void)
table_t
struct table_t table_t
hsize_t
unsigned long long hsize_t
Definition:
H5public.h:169
hdf5.h
TOOL_H5DIFF
Definition:
h5tools_utils.h:148
H5O_type_t
H5O_type_t
Definition:
H5Opublic.h:81
find_objs_t
Definition:
h5tools_utils.h:113
table_t::nobjs
size_t nobjs
Definition:
h5tools_utils.h:108
opt_arg
H5TOOLS_DLLVAR const char * opt_arg
Definition:
h5tools_utils.h:48
h5tool_link_info_t::fileno
unsigned long fileno
Definition:
h5tools_utils.h:163
H5L_info_t
Definition:
H5Lpublic.h:73
obj_t
Definition:
h5tools_utils.h:98
print_version
H5TOOLS_DLL void print_version(const char *progname)
free_table
H5TOOLS_DLL void free_table(table_t *table)
parallel_print
H5TOOLS_DLL void parallel_print(const char *format,...)
find_objs_t::dset_table
table_t * dset_table
Definition:
h5tools_utils.h:117
long_options
struct long_options long_options
h5tools_setstatus
H5TOOLS_DLL void h5tools_setstatus(int d_status)
table_t::objs
obj_t * objs
Definition:
h5tools_utils.h:109
obj_t::recorded
hbool_t recorded
Definition:
h5tools_utils.h:102
obj_t::objno
haddr_t objno
Definition:
h5tools_utils.h:99
haddr_t
uint64_t haddr_t
Definition:
H5public.h:182
find_objs_t::group_table
table_t * group_table
Definition:
h5tools_utils.h:115
find_objs_t::type_table
table_t * type_table
Definition:
h5tools_utils.h:116
h5tool_link_info_t::linfo
H5L_info_t linfo
Definition:
h5tools_utils.h:164
opt_ind
H5TOOLS_DLLVAR int opt_ind
Definition:
h5tools_utils.h:47
hid_t
int hid_t
Definition:
H5Ipublic.h:54
table_t
Definition:
h5tools_utils.h:106
indentation
H5TOOLS_DLL void indentation(unsigned)
h5tool_link_info_t::objno
haddr_t objno
Definition:
h5tools_utils.h:162
outBuffOffset
H5TOOLS_DLLVAR unsigned outBuffOffset
Definition:
h5tools_utils.h:36
H5tools_get_symlink_info
H5TOOLS_DLL int H5tools_get_symlink_info(hid_t file_id, const char *linkpath, h5tool_link_info_t *link_info, hbool_t get_obj_type)
search_obj
H5TOOLS_DLL obj_t * search_obj(table_t *temp, haddr_t objno)
h5tools_nCols
H5TOOLS_DLLVAR unsigned h5tools_nCols
Definition:
h5tools_utils.h:120
h5tools_getenv_update_hyperslab_bufsize
H5TOOLS_DLL int h5tools_getenv_update_hyperslab_bufsize(void)
help_ref_msg
H5TOOLS_DLL void help_ref_msg(FILE *output)
long_options
Definition:
h5tools_utils.h:84
require_arg
Definition:
h5tools_utils.h:52
long_options::name
const char * name
Definition:
h5tools_utils.h:85
overflow_file
H5TOOLS_DLLVAR FILE * overflow_file
Definition:
h5tools_utils.h:37
optional_arg
Definition:
h5tools_utils.h:53
h5tools_setprogname
H5TOOLS_DLL void h5tools_setprogname(const char *progname)
error_msg
H5TOOLS_DLL void error_msg(const char *fmt,...)
g_Parallel
H5TOOLS_DLLVAR unsigned char g_Parallel
Definition:
h5tools_utils.h:34
find_objs_t::fid
hid_t fid
Definition:
h5tools_utils.h:114
h5tool_opt_t::toolname
h5tool_toolname_t toolname
Definition:
h5tools_utils.h:153
obj_t::displayed
hbool_t displayed
Definition:
h5tools_utils.h:101
h5tool_opt_t::msg_mode
int msg_mode
Definition:
h5tools_utils.h:154
TOOL__H5DUMP
Definition:
h5tools_utils.h:148
h5tool_link_info_t::trg_path
char * trg_path
Definition:
h5tools_utils.h:160
H5TOOLS_MALLOCSIZE
H5TOOLS_DLLVAR hsize_t H5TOOLS_MALLOCSIZE
Definition:
h5tools_utils.h:40
format
HDFFCLIBAPI _fcd _fcd format
Definition:
hproto_fortran.h:324
output
#define output(c)
Definition:
lexan.c:10
init_objs
H5TOOLS_DLL herr_t init_objs(hid_t fid, find_objs_t *info, table_t **group_table, table_t **dset_table, table_t **type_table)
MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:53