fcml
1.3.0
Toggle main menu visibility
Loading...
Searching...
No Matches
fcml_types.h
Go to the documentation of this file.
1
/*
2
* FCML - Free Code Manipulation Library.
3
* Copyright (C) 2010-2020 Slawomir Wojtasiak
4
*
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2.1 of the License, or (at your option) any later version.
9
*
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
14
*
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this library; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
*/
19
26
27
#ifndef FCML_TYPES_H_
28
#define FCML_TYPES_H_
29
30
/* If config.h is available, we depend on it; otherwise we give
31
* the responsibility to handle headers appropriately to the compiler runtime.
32
**/
33
#ifdef HAVE_CONFIG_H
34
#include <config.h>
35
#ifdef HAVE_STDDEF_H
36
#include <stddef.h>
37
#endif
38
#if HAVE_STDINT_H
39
#include <stdint.h>
40
#endif
41
#if HAVE_INTTYPES_H
42
#include <inttypes.h>
43
#endif
44
#else
45
#if defined(_MSC_VER) && defined(_WIN32)
46
#include <windows.h>
47
#define FCML_MSCC
48
/* Disable unit specific lexer features. */
49
#define YY_NO_INPUT 1
50
#define YY_NO_UNISTD_H 1
51
#else
52
#include <stddef.h>
53
#include <stdint.h>
54
#include <inttypes.h>
55
#endif
56
#endif
57
58
#include "
fcml_lib_export.h
"
59
61
#define FCML_TEXT(x) x
62
#define _FT(x) FCML_TEXT(x)
63
64
#ifdef FCML_MSCC
65
66
#define FCML_PRI_INT8_DEC "%d"
67
#define FCML_PRI_INT16_DEC "%d"
68
#define FCML_PRI_INT32_DEC "%d"
69
#define FCML_PRI_INT64_DEC "%lld"
70
71
#define FCML_PRI_UINT8_DEC "%u"
72
#define FCML_PRI_UINT16_DEC "%u"
73
#define FCML_PRI_UINT32_DEC "%u"
74
#define FCML_PRI_UINT64_DEC "%llu"
75
76
#define FCML_PRI_INT8_HEX "%02x"
77
#define FCML_PRI_INT16_HEX "%04x"
78
#define FCML_PRI_INT32_HEX "%08x"
79
#define FCML_PRI_INT64_HEX "%016llx"
80
81
#define FCML_PRI_INT8_HEX_NO_ZEROS "%x"
82
#define FCML_PRI_INT16_HEX_NO_ZEROS "%x"
83
#define FCML_PRI_INT32_HEX_NO_ZEROS "%x"
84
#define FCML_PRI_INT64_HEX_NO_ZEROS "%llx"
85
86
typedef
int
fcml_int;
87
typedef
int
fcml_bool;
88
typedef
__int8 fcml_int8_t;
89
typedef
unsigned
__int8 fcml_uint8_t;
90
typedef
__int16 fcml_int16_t;
91
typedef
unsigned
__int16 fcml_uint16_t;
92
typedef
__int32 fcml_int32_t;
93
typedef
unsigned
__int32 fcml_uint32_t;
94
typedef
__int64 fcml_int64_t;
95
typedef
unsigned
__int64 fcml_uint64_t;
96
97
/* Signed integers. */
98
#define FCML_INT64_MAX _I64_MAX
99
#define FCML_INT64_MIN _I64_MIN
100
#define FCML_INT32_MAX INT_MAX
101
#define FCML_INT32_MIN INT_MIN
102
#define FCML_INT16_MAX SHRT_MAX
103
#define FCML_INT16_MIN SHRT_MIN
104
#define FCML_INT8_MAX SCHAR_MAX
105
#define FCML_INT8_MIN SCHAR_MIN
106
107
/* Unsigned integers. */
108
#define FCML_UINT8_MAX UCHAR_MAX
109
#define FCML_UINT16_MAX USHRT_MAX
110
#define FCML_UINT32_MAX UINT_MAX
111
#define FCML_UINT64_MAX _UI64_MAX
112
113
#else
114
115
#ifdef PRId8
116
#define FCML_PRI_INT8_DEC "%" PRId8
117
#endif
118
#ifdef PRId16
119
#define FCML_PRI_INT16_DEC "%" PRId16
120
#endif
121
#ifdef PRId32
122
#define FCML_PRI_INT32_DEC "%" PRId32
123
#endif
124
#ifdef PRId64
125
#define FCML_PRI_INT64_DEC "%" PRId64
126
#endif
127
128
#ifdef PRIu8
129
#define FCML_PRI_UINT8_DEC "%" PRIu8
130
#endif
131
#ifdef PRIu16
132
#define FCML_PRI_UINT16_DEC "%" PRIu16
133
#endif
134
#ifdef PRIu32
135
#define FCML_PRI_UINT32_DEC "%" PRIu32
136
#endif
137
#ifdef PRIu64
138
#define FCML_PRI_UINT64_DEC "%" PRIu64
139
#endif
140
141
#ifdef PRIx8
142
#define FCML_PRI_INT8_HEX "%02" PRIx8
143
#endif
144
#ifdef PRIx16
145
#define FCML_PRI_INT16_HEX "%04" PRIx16
146
#endif
147
#ifdef PRIx32
148
#define FCML_PRI_INT32_HEX "%08" PRIx32
149
#endif
150
#ifdef PRIx64
151
#define FCML_PRI_INT64_HEX "%016" PRIx64
152
#endif
153
154
#ifdef PRIx8
155
#define FCML_PRI_INT8_HEX_NO_ZEROS "%" PRIx8
156
#endif
157
#ifdef PRIx16
158
#define FCML_PRI_INT16_HEX_NO_ZEROS "%" PRIx16
159
#endif
160
#ifdef PRIx32
161
#define FCML_PRI_INT32_HEX_NO_ZEROS "%" PRIx32
162
#endif
163
#ifdef PRIx64
164
#define FCML_PRI_INT64_HEX_NO_ZEROS "%" PRIx64
165
#endif
166
167
typedef
int
fcml_int;
168
typedef
unsigned
int
fcml_uint;
169
typedef
int
fcml_bool;
170
typedef
int8_t fcml_int8_t;
171
typedef
uint8_t fcml_uint8_t;
172
typedef
int16_t fcml_int16_t;
173
typedef
uint16_t fcml_uint16_t;
174
typedef
int32_t fcml_int32_t;
175
typedef
uint32_t fcml_uint32_t;
176
typedef
int64_t fcml_int64_t;
177
typedef
uint64_t fcml_uint64_t;
178
179
/* Signed integers. */
180
#define FCML_INT64_MAX INT64_MAX
181
#define FCML_INT64_MIN INT64_MIN
182
#define FCML_INT32_MAX INT32_MAX
183
#define FCML_INT32_MIN INT32_MIN
184
#define FCML_INT16_MAX INT16_MAX
185
#define FCML_INT16_MIN INT16_MIN
186
#define FCML_INT8_MAX INT8_MAX
187
#define FCML_INT8_MIN INT8_MIN
188
189
/* Unsigned integers. */
190
#define FCML_UINT8_MAX UINT8_MAX
191
#define FCML_UINT16_MAX UINT16_MAX
192
#define FCML_UINT32_MAX UINT32_MAX
193
#define FCML_UINT64_MAX UINT64_MAX
194
195
#endif
196
197
typedef
char
fcml_char;
198
#define fcml_string char*
199
typedef
float
fcml_float;
200
typedef
void
* fcml_ptr;
201
typedef
fcml_uint32_t fcml_flags;
202
203
typedef
fcml_uint32_t fcml_usize;
204
typedef
fcml_int32_t fcml_size;
205
206
#define FCML_TRUE 1
207
#define FCML_FALSE 0
208
209
/* Macro for bit manipulations. */
210
211
#define FCML_TP_SET_BIT(x,y) ( ( x ) | ( 0x01 << ( y ) ) )
212
#define FCML_TP_GET_BIT(x,y) ( ( x >> y ) & 0x01 )
213
#define FCML_TP_CLEAR_BIT(x,y) ( ( x ) &= ~( 1 << ( y ) ) )
214
215
/* Nulleable types. */
216
217
typedef
struct
fcml_nuint8_t
{
218
fcml_uint8_t value;
219
fcml_bool is_not_null;
220
}
fcml_nuint8_t
;
221
222
typedef
struct
fcml_nuint16_t
{
223
fcml_uint16_t value;
224
fcml_bool is_not_null;
225
}
fcml_nuint16_t
;
226
227
typedef
struct
fcml_nuint32_t
{
228
fcml_uint32_t value;
229
fcml_bool is_not_null;
230
}
fcml_nuint32_t
;
231
232
typedef
struct
fcml_nuint64_t
{
233
fcml_uint64_t value;
234
fcml_bool is_not_null;
235
}
fcml_nuint64_t
;
236
237
typedef
struct
fcml_nint8_t
{
238
fcml_int8_t value;
239
fcml_bool is_not_null;
240
}
fcml_nint8_t
;
241
242
typedef
struct
fcml_nint16_t
{
243
fcml_int16_t value;
244
fcml_bool is_not_null;
245
}
fcml_nint16_t
;
246
247
typedef
struct
fcml_nint32_t
{
248
fcml_int32_t value;
249
fcml_bool is_not_null;
250
}
fcml_nint32_t
;
251
252
typedef
struct
fcml_nint64_t
{
253
fcml_int64_t value;
254
fcml_bool is_not_null;
255
}
fcml_nint64_t
;
256
257
typedef
struct
fcml_st_integer
{
258
fcml_usize size;
259
fcml_bool is_signed;
260
// Data fields.
261
fcml_int8_t int8;
262
fcml_int16_t int16;
263
fcml_int32_t int32;
264
fcml_int64_t int64;
265
}
fcml_st_integer
;
266
267
#define FCML_SET_VALUE(x, y) x.value = y; x.is_not_null = FCML_TRUE;
268
#define FCML_SET_NULL(x) x.value = 0; x.is_not_null = FCML_FALSE;
269
#define FCML_IS_NULL(x) ((x).is_not_null == FCML_FALSE)
270
271
#endif
/* FCML_TYPES_H_ */
fcml_lib_export.h
Handles Win32 DLL symbols importing/exporting.
fcml_nint16_t
Definition
fcml_types.h:242
fcml_nint32_t
Definition
fcml_types.h:247
fcml_nint64_t
Definition
fcml_types.h:252
fcml_nint8_t
Definition
fcml_types.h:237
fcml_nuint16_t
Definition
fcml_types.h:222
fcml_nuint32_t
Definition
fcml_types.h:227
fcml_nuint64_t
Definition
fcml_types.h:232
fcml_nuint8_t
Definition
fcml_types.h:217
fcml_st_integer
Definition
fcml_types.h:257
include
fcml_types.h
Generated by
1.17.0