summaryrefslogtreecommitdiffstats
path: root/perform/pio_standalone.h
blob: 4a67ba00b8cae8e05bf1713dce771853d22b55e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * 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     *
 * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html.  If you do not have     *
 * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#ifndef PIO_STANDALONE_H__
#define PIO_PERF_H__

/* Header file for building h5perf by standalone mode.
 * Created: Christian Chilan, 2005/5/18.
 */

/** From H5private.h **/

#include "H5public.h"		/* Include Public Definitions		*/


/*
 * Include ANSI-C header files.
 */
#ifdef H5_STDC_HEADERS
#   include <assert.h>
#   include <ctype.h>
#   include <errno.h>
#   include <fcntl.h>
#   include <float.h>
#   include <limits.h>
#   include <math.h>
#   include <signal.h>
#   include <stdarg.h>
#   include <stdio.h>
#   include <stdlib.h>
#   include <string.h>
#endif

/*
 * And now for a couple non-Posix functions...  Watch out for systems that
 * define these in terms of macros.
 */
#ifdef WIN32
#define HDstrdup(S)				   _strdup(S)
#else /* WIN32 */

#if !defined strdup && !defined H5_HAVE_STRDUP
extern char *strdup(const char *s);
#endif

#define HDstrdup(S)				  strdup(S)

#endif /* WIN32 */

#define HDstrcmp(S,T)			  strcmp(S,T)
#define HDstrlen(S)				  strlen(S)
#define HDstrncmp(S,T,L)		  strncmp(S,T,L)
#define HDstrncpy(X,Y,Z)		  strncpy(X,Y,Z)
#define HDstrchr(S,C)			  strchr(S,C)
#define HDfree(M)				  free(M)


#ifdef _O_BINARY
#define HDopen(S,F,M)			  open(S,F|_O_BINARY,M)
#else
#define HDopen(S,F,M)			  open(S,F,M)
#endif
#define HDclose(F)				  close(F)

#ifdef WIN32
     #ifdef __MWERKS__
        #define HDlseek(F,O,W)  lseek(F,O,W)
     #else /*MSVS */
        #define HDlseek(F,O,W)  _lseeki64(F,O,W)
     #endif
#else
#define HDlseek(F,O,W)			 lseek(F,O,W)
#endif

#if defined (__MWERKS__)
/* workaround for a bug in the Metrowerks version 6.0 header file for write
 which is not defined as const void*
 */
#define HDwrite(F,M,Z)		write(F,(void*)M,Z)
#else
#define HDwrite(F,M,Z)		write(F,M,Z)
#endif

#define HDread(F,M,Z)		read(F,M,Z)

#ifdef WIN32
     #ifdef __MWERKS__
     #define HDstat(S,B)   stat(S,B)
     #else /*MSVC*/
     #define HDstat(S,B)		_stati64(S,B)
     #endif
#else
#define HDstat(S,B)  stat(S,B)
#endif

#ifdef WIN32
     #ifdef __MWERKS__
     #define HDfstat(F,B)       fstat(F,B)
     typedef struct stat		h5_stat_t;
     typedef off_t              h5_stat_size_t;
     #else /*MSVC*/
     #define HDfstat(F,B)		_fstati64(F,B)
     typedef struct _stati64	h5_stat_t;
     typedef __int64            h5_stat_size_t;
     #endif
#else
#define HDfstat(F,B)            fstat(F,B)
typedef struct stat				h5_stat_t;
typedef off_t                   h5_stat_size_t;
#endif

/*
 * HDF Boolean type.
 */
#ifndef FALSE
#   define FALSE 0
#endif
#ifndef TRUE
#   define TRUE 1
#endif

/*
 * Although `long long' is part of the revised ANSI-C some compilers don't
 * support it yet.  We define `long_long' as the longest integral integer type
 * supported by the compiler, usually 64 bits.	It must be legal to qualify
 * `long_long' with `unsigned'.
 */
#if H5_SIZEOF_LONG_LONG>0
#   define long_long	long long
#elif H5_SIZEOF___INT64>0
#   define long_long	__int64	/*Win32*/
#   undef H5_SIZEOF_LONG_LONG
#   define H5_SIZEOF_LONG_LONG H5_SIZEOF___INT64
#else
#   define long_long	long int
#   undef H5_SIZEOF_LONG_LONG
#   define H5_SIZEOF_LONG_LONG H5_SIZEOF_LONG
#endif



/** From h5test.h **/

#ifdef H5_HAVE_PARALLEL
extern MPI_Info h5_io_info_g;         /* MPI INFO object for IO */
#endif

#ifdef H5_HAVE_PARALLEL
H5TEST_DLL int h5_set_info_object(void);
H5TEST_DLL void h5_dump_info_object(MPI_Info info);
#endif



/** From h5tools_utils.h **/

extern int         opt_err;     /* getoption prints errors if this is on    */
extern int         opt_ind;     /* token pointer                            */
extern const char *opt_arg;     /* flag argument (or value)                 */


enum {
    no_arg = 0,         /* doesn't take an argument     */
    require_arg,        /* requires an argument	        */
    optional_arg        /* argument is optional         */
};


typedef struct long_options {
    const char  *name;          /* name of the long option              */
    int          has_arg;       /* whether we should look for an arg    */
    char         shortval;      /* the shortname equivalent of long arg
                                 * this gets returned from get_option   */
} long_options;

extern int    get_option(int argc, const char **argv, const char *opt,
                         const struct long_options *l_opt);
#endif