Mercurial > hg > th-libs
annotate th_types.h @ 454:347bfd3e017e
Bump copyright years.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 02 Jan 2018 22:57:02 +0200 |
parents | efd33accdc81 |
children | 1bf886fa9db5 |
rev | line source |
---|---|
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
1 /* |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
2 * Type definations |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
3 * Programmed and designed by Matti 'ccr' Hamalainen |
454 | 4 * (C) Copyright 2002-2018 Tecnic Software productions (TNSP) |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
5 * |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
6 * Please read file 'COPYING' for information on license and distribution. |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
7 */ |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
8 /* If your code uses "config.h", you need to #include |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
9 * it before including this header. |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
10 */ |
392 | 11 #ifndef TH_TYPES_H |
12 #define TH_TYPES_H 1 | |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
13 |
150 | 14 // Check for standard headers |
394
7df5991a0ed3
Handle HAVE_STDINT_H vs HAVE_SYS_TYPES_H somewhat more sanely.
Matti Hamalainen <ccr@tnsp.org>
parents:
393
diff
changeset
|
15 #if defined(HAVE_STDINT_H) |
150 | 16 # include <stdint.h> |
17 # ifndef HAVE_INT_TYPES | |
18 # define HAVE_INT_TYPES 1 | |
19 # endif | |
394
7df5991a0ed3
Handle HAVE_STDINT_H vs HAVE_SYS_TYPES_H somewhat more sanely.
Matti Hamalainen <ccr@tnsp.org>
parents:
393
diff
changeset
|
20 #elif defined(HAVE_SYS_TYPES_H) |
150 | 21 # include <sys/types.h> |
22 # ifndef HAVE_INT_TYPES | |
23 # define HAVE_INT_TYPES 1 | |
24 # endif | |
25 #endif | |
26 | |
453
efd33accdc81
Break backwards compatibility by renaming BOOL, TRUE and FALSE to lowercase.
Matti Hamalainen <ccr@tnsp.org>
parents:
432
diff
changeset
|
27 #ifdef HAVE_STDBOOL_H |
efd33accdc81
Break backwards compatibility by renaming BOOL, TRUE and FALSE to lowercase.
Matti Hamalainen <ccr@tnsp.org>
parents:
432
diff
changeset
|
28 # define HAVE_BOOL 1 |
efd33accdc81
Break backwards compatibility by renaming BOOL, TRUE and FALSE to lowercase.
Matti Hamalainen <ccr@tnsp.org>
parents:
432
diff
changeset
|
29 # include <stdbool.h> |
efd33accdc81
Break backwards compatibility by renaming BOOL, TRUE and FALSE to lowercase.
Matti Hamalainen <ccr@tnsp.org>
parents:
432
diff
changeset
|
30 #endif |
efd33accdc81
Break backwards compatibility by renaming BOOL, TRUE and FALSE to lowercase.
Matti Hamalainen <ccr@tnsp.org>
parents:
432
diff
changeset
|
31 |
391 | 32 #ifdef HAVE_INTTYPES_H |
33 # include <inttypes.h> | |
34 #endif | |
35 | |
36 | |
37 // Check for arch bitness | |
38 #if UINTPTR_MAX == 0xffffffff | |
39 # define TH_ARCH 32 | |
40 #elif UINTPTR_MAX == 0xffffffffffffffff | |
41 # define TH_ARCH 64 | |
42 #endif | |
43 | |
44 | |
150 | 45 #if !defined(TH_ARCH) |
46 # if defined(__LP64__) || defined(_LP64) | |
47 # define TH_ARCH 64 | |
48 # else | |
49 # define TH_ARCH 32 | |
50 # endif | |
51 #endif | |
52 | |
182 | 53 #if !defined(TH_ARCH) && (defined(__WIN64) || defined(_WIN64)) |
54 # define TH_ARCH 64 | |
55 #endif | |
150 | 56 |
57 #if !defined(TH_ARCH) && (defined(__WIN32) || defined(_WIN32)) | |
58 # define TH_ARCH 32 | |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
59 #endif |
150 | 60 |
61 | |
62 // Do we have a valid arch? | |
398 | 63 // If so, set some printf specifiers and other useful things |
150 | 64 #if TH_ARCH == 32 |
65 # define TH_ARCH_32BIT 1 | |
395
bffd3caf2d2c
Rename TH_PRI{u,d,x}* macros to match with standard ISO C99 inttypes.h PRI*.
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
66 # ifndef HAVE_INTTYPES_H |
398 | 67 // If we don't have ISO C99 inttypes.h, define PRI* macros |
395
bffd3caf2d2c
Rename TH_PRI{u,d,x}* macros to match with standard ISO C99 inttypes.h PRI*.
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
68 # define PRIu32 "u" |
bffd3caf2d2c
Rename TH_PRI{u,d,x}* macros to match with standard ISO C99 inttypes.h PRI*.
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
69 # define PRId32 "d" |
bffd3caf2d2c
Rename TH_PRI{u,d,x}* macros to match with standard ISO C99 inttypes.h PRI*.
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
70 # define PRIx32 "x" |
396 | 71 # define PRIi32 "i" |
397 | 72 # define PRIo32 "o" |
395
bffd3caf2d2c
Rename TH_PRI{u,d,x}* macros to match with standard ISO C99 inttypes.h PRI*.
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
73 # define PRIu64 "llu" |
bffd3caf2d2c
Rename TH_PRI{u,d,x}* macros to match with standard ISO C99 inttypes.h PRI*.
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
74 # define PRId64 "lld" |
bffd3caf2d2c
Rename TH_PRI{u,d,x}* macros to match with standard ISO C99 inttypes.h PRI*.
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
75 # define PRIx64 "llx" |
396 | 76 # define PRIi64 "lli" |
397 | 77 # define PRIo64 "llo" |
400
f7919a143fcb
Add some missing types and macros when we do not have inttypes.h or stdint.h
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
78 typedef long long int intmax_t; |
f7919a143fcb
Add some missing types and macros when we do not have inttypes.h or stdint.h
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
79 typedef unsigned long long int uintmax_t; |
395
bffd3caf2d2c
Rename TH_PRI{u,d,x}* macros to match with standard ISO C99 inttypes.h PRI*.
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
80 # endif |
bffd3caf2d2c
Rename TH_PRI{u,d,x}* macros to match with standard ISO C99 inttypes.h PRI*.
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
81 # define PRIu_SIZE_T "u" |
bffd3caf2d2c
Rename TH_PRI{u,d,x}* macros to match with standard ISO C99 inttypes.h PRI*.
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
82 # define PRId_SSIZE_T "d" |
bffd3caf2d2c
Rename TH_PRI{u,d,x}* macros to match with standard ISO C99 inttypes.h PRI*.
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
83 # define PRIx_SIZE_T "x" |
308
0078dc5f6260
Define TH_PTRSIZE and UINTPTR_MAX if not defined already.
Matti Hamalainen <ccr@tnsp.org>
parents:
307
diff
changeset
|
84 # ifndef TH_PTRSIZE |
0078dc5f6260
Define TH_PTRSIZE and UINTPTR_MAX if not defined already.
Matti Hamalainen <ccr@tnsp.org>
parents:
307
diff
changeset
|
85 # define TH_PTRSIZE 32 |
0078dc5f6260
Define TH_PTRSIZE and UINTPTR_MAX if not defined already.
Matti Hamalainen <ccr@tnsp.org>
parents:
307
diff
changeset
|
86 # endif |
400
f7919a143fcb
Add some missing types and macros when we do not have inttypes.h or stdint.h
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
87 # ifndef INTPTR_MIN |
f7919a143fcb
Add some missing types and macros when we do not have inttypes.h or stdint.h
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
88 # define INTPTR_MIN (-0x7fffffffL - 1) |
f7919a143fcb
Add some missing types and macros when we do not have inttypes.h or stdint.h
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
89 # define INTPTR_MAX ( 0x7fffffffL) |
f7919a143fcb
Add some missing types and macros when we do not have inttypes.h or stdint.h
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
90 # define UINTPTR_MAX ( 0xffffffffUL) |
308
0078dc5f6260
Define TH_PTRSIZE and UINTPTR_MAX if not defined already.
Matti Hamalainen <ccr@tnsp.org>
parents:
307
diff
changeset
|
91 # endif |
150 | 92 #elif TH_ARCH == 64 |
93 # define TH_ARCH_64BIT 1 | |
395
bffd3caf2d2c
Rename TH_PRI{u,d,x}* macros to match with standard ISO C99 inttypes.h PRI*.
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
94 # ifndef HAVE_INTTYPES_H |
bffd3caf2d2c
Rename TH_PRI{u,d,x}* macros to match with standard ISO C99 inttypes.h PRI*.
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
95 # define PRIu32 "u" |
bffd3caf2d2c
Rename TH_PRI{u,d,x}* macros to match with standard ISO C99 inttypes.h PRI*.
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
96 # define PRId32 "d" |
bffd3caf2d2c
Rename TH_PRI{u,d,x}* macros to match with standard ISO C99 inttypes.h PRI*.
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
97 # define PRIx32 "x" |
396 | 98 # define PRIi32 "i" |
397 | 99 # define PRIo32 "o" |
395
bffd3caf2d2c
Rename TH_PRI{u,d,x}* macros to match with standard ISO C99 inttypes.h PRI*.
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
100 # define PRIu64 "lu" |
bffd3caf2d2c
Rename TH_PRI{u,d,x}* macros to match with standard ISO C99 inttypes.h PRI*.
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
101 # define PRId64 "ld" |
bffd3caf2d2c
Rename TH_PRI{u,d,x}* macros to match with standard ISO C99 inttypes.h PRI*.
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
102 # define PRIx64 "lx" |
396 | 103 # define PRIi64 "li" |
397 | 104 # define PRIo64 "lo" |
395
bffd3caf2d2c
Rename TH_PRI{u,d,x}* macros to match with standard ISO C99 inttypes.h PRI*.
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
105 # endif |
bffd3caf2d2c
Rename TH_PRI{u,d,x}* macros to match with standard ISO C99 inttypes.h PRI*.
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
106 # define PRIu_SIZE_T "lu" |
bffd3caf2d2c
Rename TH_PRI{u,d,x}* macros to match with standard ISO C99 inttypes.h PRI*.
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
107 # define PRId_SSIZE_T "ld" |
bffd3caf2d2c
Rename TH_PRI{u,d,x}* macros to match with standard ISO C99 inttypes.h PRI*.
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
108 # define PRIx_SIZE_T "lx" |
308
0078dc5f6260
Define TH_PTRSIZE and UINTPTR_MAX if not defined already.
Matti Hamalainen <ccr@tnsp.org>
parents:
307
diff
changeset
|
109 # ifndef TH_PTRSIZE |
0078dc5f6260
Define TH_PTRSIZE and UINTPTR_MAX if not defined already.
Matti Hamalainen <ccr@tnsp.org>
parents:
307
diff
changeset
|
110 # define TH_PTRSIZE 64 |
0078dc5f6260
Define TH_PTRSIZE and UINTPTR_MAX if not defined already.
Matti Hamalainen <ccr@tnsp.org>
parents:
307
diff
changeset
|
111 # endif |
400
f7919a143fcb
Add some missing types and macros when we do not have inttypes.h or stdint.h
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
112 # ifndef INTPTR_MIN |
f7919a143fcb
Add some missing types and macros when we do not have inttypes.h or stdint.h
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
113 # define INTPTR_MIN (-0x7fffffffffffffffL - 1) |
f7919a143fcb
Add some missing types and macros when we do not have inttypes.h or stdint.h
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
114 # define INTPTR_MAX ( 0x7fffffffffffffffL) |
f7919a143fcb
Add some missing types and macros when we do not have inttypes.h or stdint.h
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
115 # define UINTPTR_MAX ( 0xffffffffffffffffUL) |
308
0078dc5f6260
Define TH_PTRSIZE and UINTPTR_MAX if not defined already.
Matti Hamalainen <ccr@tnsp.org>
parents:
307
diff
changeset
|
116 # endif |
150 | 117 #else |
118 # error Could not determine architecture (32/64bit), please define TH_ARCH=32 or 64 | |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
119 #endif |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
120 |
400
f7919a143fcb
Add some missing types and macros when we do not have inttypes.h or stdint.h
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
121 |
129 | 122 // Shorthand types |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
123 typedef unsigned long int ulint_t; |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
124 typedef signed long int lint_t; |
149 | 125 #ifndef HAVE_UINT_T // BOOST defines uint_t at least |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
126 typedef unsigned int uint_t; |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
127 #endif |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
128 |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
129 /* Default assumptions for these types should be ok for most 32bit platforms... |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
130 * feel free to define TH_TYPE_* if necessary to remedy |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
131 */ |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
132 #ifdef TH_TYPE_I8 |
129 | 133 typedef unsigned TH_TYPE_I8 uint8_t; // 8 bits, unsigned |
134 typedef signed TH_TYPE_I8 int8_t; // 8 bits, signed | |
149 | 135 #elif !defined(HAVE_INT_TYPES) |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
136 typedef unsigned char uint8_t; |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
137 typedef signed char int8_t; |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
138 #endif |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
139 |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
140 |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
141 #ifdef TH_TYPE_I16 |
129 | 142 typedef unsigned TH_TYPE_I16 uint16_t; // 16 bits, unsigned == 2 BYTEs |
143 typedef signed TH_TYPE_I16 int16_t; // 16 bits, signed | |
149 | 144 #elif !defined(HAVE_INT_TYPES) |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
145 typedef unsigned short int uint16_t; |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
146 typedef signed short int int16_t; |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
147 #endif |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
148 |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
149 #ifdef TH_TYPE_I32 |
129 | 150 typedef unsigned TH_TYPE_I32 uint32_t; // 32 bits, unsigned == 4 BYTES == 2 WORDs |
151 typedef signed TH_TYPE_I32 int32_t; // 32 bits, signed | |
149 | 152 #elif !defined(HAVE_INT_TYPES) |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
153 typedef unsigned int uint32_t; |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
154 typedef signed int int32_t; |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
155 #endif |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
156 |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
157 #ifdef TH_TYPE_I64 |
129 | 158 typedef unsigned TH_TYPE_I64 uint64_t; // 64 bits, unsigned == 8 BYTES == 2 DWORDs |
159 typedef signed TH_TYPE_I64 int64_t; // 64 bits, signed | |
149 | 160 #elif !defined(HAVE_INT_TYPES) |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
161 typedef unsigned long long uint64_t; |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
162 typedef signed long long int64_t; |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
163 #endif |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
164 |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
165 |
400
f7919a143fcb
Add some missing types and macros when we do not have inttypes.h or stdint.h
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
166 #ifndef HAVE_INT_TYPES |
f7919a143fcb
Add some missing types and macros when we do not have inttypes.h or stdint.h
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
167 #if TH_ARCH == 32 |
f7919a143fcb
Add some missing types and macros when we do not have inttypes.h or stdint.h
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
168 typedef long long int intmax_t; |
f7919a143fcb
Add some missing types and macros when we do not have inttypes.h or stdint.h
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
169 typedef unsigned long long int uintmax_t; |
f7919a143fcb
Add some missing types and macros when we do not have inttypes.h or stdint.h
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
170 #elif TH_ARCH == 64 |
f7919a143fcb
Add some missing types and macros when we do not have inttypes.h or stdint.h
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
171 typedef long int intmax_t; |
f7919a143fcb
Add some missing types and macros when we do not have inttypes.h or stdint.h
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
172 typedef unsigned long int uintmax_t; |
f7919a143fcb
Add some missing types and macros when we do not have inttypes.h or stdint.h
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
173 #endif |
f7919a143fcb
Add some missing types and macros when we do not have inttypes.h or stdint.h
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
174 #endif |
f7919a143fcb
Add some missing types and macros when we do not have inttypes.h or stdint.h
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
175 |
f7919a143fcb
Add some missing types and macros when we do not have inttypes.h or stdint.h
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
176 |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
177 /* This is the character type used in all string-related routines of |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
178 * th_libs. Currently it is set to be equivalent of basetype "char", |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
179 * but under some platforms it may be necessary to use |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
180 * "unsigned char" instead. |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
181 * |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
182 * Also in future this type may be changed to hold 32-bit UNICODE |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
183 */ |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
184 typedef char char_t; |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
185 |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
186 |
453
efd33accdc81
Break backwards compatibility by renaming BOOL, TRUE and FALSE to lowercase.
Matti Hamalainen <ccr@tnsp.org>
parents:
432
diff
changeset
|
187 /* Define a boolean type, if needed |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
188 */ |
453
efd33accdc81
Break backwards compatibility by renaming BOOL, TRUE and FALSE to lowercase.
Matti Hamalainen <ccr@tnsp.org>
parents:
432
diff
changeset
|
189 #ifndef HAVE_BOOL |
efd33accdc81
Break backwards compatibility by renaming BOOL, TRUE and FALSE to lowercase.
Matti Hamalainen <ccr@tnsp.org>
parents:
432
diff
changeset
|
190 # if !defined(false) && !defined(true) && !defined(bool) |
efd33accdc81
Break backwards compatibility by renaming BOOL, TRUE and FALSE to lowercase.
Matti Hamalainen <ccr@tnsp.org>
parents:
432
diff
changeset
|
191 typedef enum { false = 0, true = 1 } bool; |
efd33accdc81
Break backwards compatibility by renaming BOOL, TRUE and FALSE to lowercase.
Matti Hamalainen <ccr@tnsp.org>
parents:
432
diff
changeset
|
192 # endif |
efd33accdc81
Break backwards compatibility by renaming BOOL, TRUE and FALSE to lowercase.
Matti Hamalainen <ccr@tnsp.org>
parents:
432
diff
changeset
|
193 # ifndef bool |
efd33accdc81
Break backwards compatibility by renaming BOOL, TRUE and FALSE to lowercase.
Matti Hamalainen <ccr@tnsp.org>
parents:
432
diff
changeset
|
194 # define bool int |
efd33accdc81
Break backwards compatibility by renaming BOOL, TRUE and FALSE to lowercase.
Matti Hamalainen <ccr@tnsp.org>
parents:
432
diff
changeset
|
195 # endif |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
196 |
453
efd33accdc81
Break backwards compatibility by renaming BOOL, TRUE and FALSE to lowercase.
Matti Hamalainen <ccr@tnsp.org>
parents:
432
diff
changeset
|
197 #endif // !HAVE_BOOL |
efd33accdc81
Break backwards compatibility by renaming BOOL, TRUE and FALSE to lowercase.
Matti Hamalainen <ccr@tnsp.org>
parents:
432
diff
changeset
|
198 |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
199 |
392 | 200 #endif // TH_TYPES_H |