Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
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 LINUX
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 INT64_FMT_IDENT "ld"
74 
75 #elif defined MAC
76  #include <inttypes.h>
77 
78  typedef uint32_t uint32;
79  typedef int32_t int32;
80  typedef uint64_t uint64;
81  typedef int64_t int64;
82  typedef double double64;
83  typedef uint8_t uint8;
84  typedef int8_t int8;
85  typedef int16_t int16;
86  typedef uint16_t uint16;
87 
89  #define INT64_FMT_IDENT "ld"
90 
91 #elif defined WINDOWS
92  #include <stdint.h>
93 
94  typedef uint32_t uint32;
95  typedef int32_t int32;
96  typedef uint64_t uint64;
97  typedef int64_t int64;
98  typedef double double64;
99  typedef uint8_t uint8;
100  typedef int8_t int8;
101  typedef int16_t int16;
102  typedef uint16_t uint16;
103 
105  #define INT64_FMT_IDENT "lld"
106 
107 #endif
108 
109 
111 #define UINT32_FMT_IDENT "u"
112 
114 #define INT32_FMT_IDENT "d"
115 
117 #define DOUBLE64_FMT_IDENT "lf"
118 
120 #define UINT8_FMT_IDENT "cu"
121 
123 #define INT8_FMT_IDENT "c"
124 
126 #define UINT16_FMT_IDENT "hu"
127 
129 #define INT16_FMT_IDENT "hd"
130 
132 #define SIZET_FMT_IDENT "u"
133 
134 
135 
136 
138 #define UINT32_FMT "%" UINT32_FMT_IDENT
139 
141 #define INT32_FMT "%" INT32_FMT_IDENT
142 
144 #define DOUBLE64_FMT "%" DOUBLE64_FMT_IDENT
145 
147 #define UINT8_FMT "%" UINT8_FMT_IDENT
148 
150 #define INT8_FMT "%" INT8_FMT_IDENT
151 
153 #define SIZET_FMT "%" SIZET_FMT_IDENT
154 
156 #define INT64_FMT "%" INT64_FMT_IDENT
157 
158 
159 
165 typedef enum FileLocation
166 {
169 
172 
173 
175 
178 } FileLocation;
179 
180 
181 /*
182  * These next definitions are applying the technique in the fantastic article on how
183  * to suppress unused parameter warnings by Julio Merino at
184  * http://julipedia.meroh.net/2015/02/unused-parameters-in-c-and-c.html.
185  * Thanks Julio!
186  */
187 #ifndef UNUSED_PARAM
188 
189  #ifdef __GNUC__
190  #define ATTR_UNUSED __attribute__((unused))
191  #define UNUSED_PARAM(name) unused_ ## name ATTR_UNUSED
192  #else
193  #define UNUSED_PARAM(x) x
194  #endif
195 
196 #endif /* #ifndef UNUSED_PARAM */
197 
198 
199 #endif /* #ifndef TYPEDEFS_H */
FILE_LOCATION_UNKNOWN
The file location is unknown.
Definition: typedefs.h:177
FILE_LOCATION_LOCAL
The file is on a local filesystem.
Definition: typedefs.h:168
FileLocation
FileLocation
An enum specifying whether a file is located on a local or remote filesystem.
Definition: typedefs.h:165
FILE_LOCATION_REMOTE
The file is on a remote filesystem.
Definition: typedefs.h:171
FILE_LOCATION_IRODS
Definition: typedefs.h:174