typedefs.h
Go to the documentation of this file.
1 /*
2 ** Copyright 2014-2016 The Earlham Institute
3 **
4 ** Licensed under the Apache License, Version 2.0 (the "License");
5 ** you may not use this file except in compliance with the License.
6 ** You may obtain a copy of the License at
7 **
8 ** http://www.apache.org/licenses/LICENSE-2.0
9 **
10 ** Unless required by applicable law or agreed to in writing, software
11 ** distributed under the License is distributed on an "AS IS" BASIS,
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ** See the License for the specific language governing permissions and
14 ** limitations under the License.
15 */
16 
21 /*
22  * typedefs.h
23  *
24  * Created on: 7 Jun 2015
25  * Author: billy
26  */
27 #ifndef TYPEDEFS_H
28 #define TYPEDEFS_H
29 
30 #ifdef HAVE_STDBOOL_H
31  #include <stdbool.h>
32 #elif !defined __bool_true_false_are_defined
33 
34  #ifndef DOXYGEN_SHOULD_SKIP_THIS
35  #ifndef HAVE__BOOL
36  #ifdef __cplusplus
37  typedef bool _Bool;
38  #else
39  #define _Bool signed char
40  #endif
41  #endif
42  #define bool _Bool
43  #endif /* #ifndef DOXYGEN_SHOULD_SKIP_THIS */
44 
46  #define false (0)
47 
49  #define true (1)
50 
51  #ifndef DOXYGEN_SHOULD_SKIP_THIS
52  #define __bool_true_false_are_defined 1
53  #endif
54 
55 #endif
56 
57 
58 /* the datatypes that we will use */
59 #ifdef UNIX
60  #include <inttypes.h>
61 
62  typedef uint32_t uint32;
63  typedef int32_t int32;
64  typedef uint64_t uint64;
65  typedef int64_t int64;
66  typedef double double64;
67  typedef uint8_t uint8;
68  typedef int8_t int8;
69  typedef int16_t int16;
70  typedef uint16_t uint16;
71 
73  #define UINT32_FMT_IDENT "u"
74 
76  #define INT32_FMT_IDENT "d"
77 
79  #define DOUBLE64_FMT_IDENT "lf"
80 
82  #define UINT8_FMT_IDENT "cu"
83 
85  #define INT8_FMT_IDENT "c"
86 
88  #define UINT16_FMT_IDENT "hu"
89 
91  #define INT16_FMT_IDENT "hd"
92 
94  #define SIZET_FMT_IDENT "lu"
95 
96 
98  #define INT64_FMT_IDENT "ld"
99 #endif
100 
102 #define UINT32_FMT "%" UINT32_FMT_IDENT
103 
105 #define INT32_FMT "%" INT32_FMT_IDENT
106 
108 #define DOUBLE64_FMT "%" DOUBLE64_FMT_IDENT
109 
111 #define UINT8_FMT "%" UINT8_FMT_IDENT
112 
114 #define INT8_FMT "%" INT8_FMT_IDENT
115 
117 #define SIZET_FMT "%" SIZET_FMT_IDENT
118 
120 #define INT64_FMT "%" INT64_FMT_IDENT
121 
122 
123 
129 typedef enum FileLocation
130 {
133 
136 
137 
138  FILE_LOCATION_IRODS,
139 
142 } FileLocation;
143 
144 
145 /*
146  * These next definitions are applying the technique in the fantastic article on how
147  * to suppress unused parameter warnings by Julio Merino at
148  * http://julipedia.meroh.net/2015/02/unused-parameters-in-c-and-c.html.
149  * Thanks Julio!
150  */
151 #ifndef UNUSED_PARAM
152 
153 #ifdef __GNUC__
154  #define ATTR_UNUSED __attribute__((unused))
155 #else
156  #define ATTR_UNUSED(x) x
157 #endif
158 
159 #define UNUSED_PARAM(name) unused_ ## name ATTR_UNUSED
160 
161 #endif /* #ifndef UNUSED_PARAM */
162 
163 #endif /* #ifndef TYPEDEFS_H */
The file location is unknown.
Definition: typedefs.h:141
The file is on a remote filesystem.
Definition: typedefs.h:135
FileLocation
An enum specifying whether a file is located on a local or remote filesystem.
Definition: typedefs.h:129
The file is on a local filesystem.
Definition: typedefs.h:132