annotate th_types.h @ 553:3a852e9f70a6

Bump copyright years.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 03 Jan 2020 10:53:55 +0200
parents 30c57a9ea3be
children 7c0aa6bf484a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
553
3a852e9f70a6 Bump copyright years.
Matti Hamalainen <ccr@tnsp.org>
parents: 495
diff changeset
4 * (C) Copyright 2002-2020 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
851468fda833 s/_TH_TYPES_H/TH_TYPES_H/g
Matti Hamalainen <ccr@tnsp.org>
parents: 391
diff changeset
11 #ifndef TH_TYPES_H
851468fda833 s/_TH_TYPES_H/TH_TYPES_H/g
Matti Hamalainen <ccr@tnsp.org>
parents: 391
diff changeset
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
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
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
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
16 # include <stdint.h>
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
17 # ifndef HAVE_INT_TYPES
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
18 # define HAVE_INT_TYPES 1
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
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
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
21 # include <sys/types.h>
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
22 # ifndef HAVE_INT_TYPES
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
23 # define HAVE_INT_TYPES 1
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
24 # endif
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
25 #endif
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
26
391
6e6c8c4fc210 Buildsystem improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 308
diff changeset
27 #ifdef HAVE_INTTYPES_H
6e6c8c4fc210 Buildsystem improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 308
diff changeset
28 # include <inttypes.h>
6e6c8c4fc210 Buildsystem improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 308
diff changeset
29 #endif
6e6c8c4fc210 Buildsystem improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 308
diff changeset
30
6e6c8c4fc210 Buildsystem improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 308
diff changeset
31
6e6c8c4fc210 Buildsystem improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 308
diff changeset
32 // Check for arch bitness
495
30c57a9ea3be Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 494
diff changeset
33 #if !defined(TH_ARCH)
30c57a9ea3be Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 494
diff changeset
34 # if UINTPTR_MAX == 0xffffffff
30c57a9ea3be Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 494
diff changeset
35 # define TH_ARCH 32
30c57a9ea3be Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 494
diff changeset
36 # elif UINTPTR_MAX == 0xffffffffffffffff
30c57a9ea3be Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 494
diff changeset
37 # define TH_ARCH 64
30c57a9ea3be Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 494
diff changeset
38 # endif
391
6e6c8c4fc210 Buildsystem improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 308
diff changeset
39 #endif
6e6c8c4fc210 Buildsystem improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 308
diff changeset
40
6e6c8c4fc210 Buildsystem improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 308
diff changeset
41
150
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
42 #if !defined(TH_ARCH)
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
43 # if defined(__LP64__) || defined(_LP64)
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
44 # define TH_ARCH 64
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
45 # else
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
46 # define TH_ARCH 32
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
47 # endif
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
48 #endif
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
49
182
d560371c85c0 Add checks for WIN64.
Matti Hamalainen <ccr@tnsp.org>
parents: 150
diff changeset
50 #if !defined(TH_ARCH) && (defined(__WIN64) || defined(_WIN64))
d560371c85c0 Add checks for WIN64.
Matti Hamalainen <ccr@tnsp.org>
parents: 150
diff changeset
51 # define TH_ARCH 64
d560371c85c0 Add checks for WIN64.
Matti Hamalainen <ccr@tnsp.org>
parents: 150
diff changeset
52 #endif
150
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
53
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
54 #if !defined(TH_ARCH) && (defined(__WIN32) || defined(_WIN32))
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
55 # define TH_ARCH 32
0
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56 #endif
150
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
57
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
58
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
59 // Do we have a valid arch?
398
9db5d3f6098d Comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 397
diff changeset
60 // If so, set some printf specifiers and other useful things
150
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
61 #if TH_ARCH == 32
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
62 # ifndef HAVE_INTTYPES_H
398
9db5d3f6098d Comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 397
diff changeset
63 // 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
64 # 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
65 # 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
66 # define PRIx32 "x"
396
337f224b99fd Add PRIi{32,64} macros.
Matti Hamalainen <ccr@tnsp.org>
parents: 395
diff changeset
67 # define PRIi32 "i"
397
dd95ea5901da Add PRIo{32,64} macros.
Matti Hamalainen <ccr@tnsp.org>
parents: 396
diff changeset
68 # 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
69 # 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
70 # 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
71 # define PRIx64 "llx"
396
337f224b99fd Add PRIi{32,64} macros.
Matti Hamalainen <ccr@tnsp.org>
parents: 395
diff changeset
72 # define PRIi64 "lli"
397
dd95ea5901da Add PRIo{32,64} macros.
Matti Hamalainen <ccr@tnsp.org>
parents: 396
diff changeset
73 # define PRIo64 "llo"
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
74 # 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
75 # 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
76 # 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
77 # 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
78 # ifndef TH_PTRSIZE
0078dc5f6260 Define TH_PTRSIZE and UINTPTR_MAX if not defined already.
Matti Hamalainen <ccr@tnsp.org>
parents: 307
diff changeset
79 # define TH_PTRSIZE 32
0078dc5f6260 Define TH_PTRSIZE and UINTPTR_MAX if not defined already.
Matti Hamalainen <ccr@tnsp.org>
parents: 307
diff changeset
80 # 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
81 # 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
82 # 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
83 # 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
84 # 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
85 # endif
150
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
86 #elif TH_ARCH == 64
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
87 # 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
88 # 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
89 # 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
90 # define PRIx32 "x"
396
337f224b99fd Add PRIi{32,64} macros.
Matti Hamalainen <ccr@tnsp.org>
parents: 395
diff changeset
91 # define PRIi32 "i"
397
dd95ea5901da Add PRIo{32,64} macros.
Matti Hamalainen <ccr@tnsp.org>
parents: 396
diff changeset
92 # 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
93 # 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
94 # 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
95 # define PRIx64 "lx"
396
337f224b99fd Add PRIi{32,64} macros.
Matti Hamalainen <ccr@tnsp.org>
parents: 395
diff changeset
96 # define PRIi64 "li"
397
dd95ea5901da Add PRIo{32,64} macros.
Matti Hamalainen <ccr@tnsp.org>
parents: 396
diff changeset
97 # 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
98 # 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
99 # 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
100 # 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
101 # 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
102 # ifndef TH_PTRSIZE
0078dc5f6260 Define TH_PTRSIZE and UINTPTR_MAX if not defined already.
Matti Hamalainen <ccr@tnsp.org>
parents: 307
diff changeset
103 # define TH_PTRSIZE 64
0078dc5f6260 Define TH_PTRSIZE and UINTPTR_MAX if not defined already.
Matti Hamalainen <ccr@tnsp.org>
parents: 307
diff changeset
104 # 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
105 # 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
106 # 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
107 # 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
108 # 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
109 # endif
150
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
110 #else
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
111 # 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
112 #endif
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
113
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
114
129
aa2d608fb3f3 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
115 // Shorthand types
0
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
116 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
117 typedef signed long int lint_t;
149
6a0e9980b76b Mostly cosmetic changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
118 #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
119 typedef unsigned int uint_t;
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
120 #endif
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
121
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
122 /* 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
123 * 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
124 */
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
125 #ifdef TH_TYPE_I8
129
aa2d608fb3f3 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
126 typedef unsigned TH_TYPE_I8 uint8_t; // 8 bits, unsigned
aa2d608fb3f3 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
127 typedef signed TH_TYPE_I8 int8_t; // 8 bits, signed
149
6a0e9980b76b Mostly cosmetic changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
128 #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
129 typedef unsigned char uint8_t;
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
130 typedef signed char int8_t;
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
131 #endif
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
132
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
133
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
134 #ifdef TH_TYPE_I16
129
aa2d608fb3f3 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
135 typedef unsigned TH_TYPE_I16 uint16_t; // 16 bits, unsigned == 2 BYTEs
aa2d608fb3f3 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
136 typedef signed TH_TYPE_I16 int16_t; // 16 bits, signed
149
6a0e9980b76b Mostly cosmetic changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
137 #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
138 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
139 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
140 #endif
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
141
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
142 #ifdef TH_TYPE_I32
129
aa2d608fb3f3 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
143 typedef unsigned TH_TYPE_I32 uint32_t; // 32 bits, unsigned == 4 BYTES == 2 WORDs
aa2d608fb3f3 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
144 typedef signed TH_TYPE_I32 int32_t; // 32 bits, signed
149
6a0e9980b76b Mostly cosmetic changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
145 #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
146 typedef unsigned int uint32_t;
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
147 typedef signed int int32_t;
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
148 #endif
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
149
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
150 #ifdef TH_TYPE_I64
129
aa2d608fb3f3 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
151 typedef unsigned TH_TYPE_I64 uint64_t; // 64 bits, unsigned == 8 BYTES == 2 DWORDs
aa2d608fb3f3 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
152 typedef signed TH_TYPE_I64 int64_t; // 64 bits, signed
149
6a0e9980b76b Mostly cosmetic changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
153 #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
154 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
155 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
156 #endif
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
157
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
158
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
159 #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
160 #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
161 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
162 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
163 #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
164 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
165 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
166 #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
167 #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
168
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
453
efd33accdc81 Break backwards compatibility by renaming BOOL, TRUE and FALSE to lowercase.
Matti Hamalainen <ccr@tnsp.org>
parents: 432
diff changeset
170 /* 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
171 */
457
85fa3d333556 Actually, revert the boolean changes .. meh.
Matti Hamalainen <ccr@tnsp.org>
parents: 456
diff changeset
172 #if !defined(FALSE) && !defined(TRUE) && !defined(BOOL)
85fa3d333556 Actually, revert the boolean changes .. meh.
Matti Hamalainen <ccr@tnsp.org>
parents: 456
diff changeset
173 typedef enum { FALSE = 0, TRUE = 1 } BOOL;
85fa3d333556 Actually, revert the boolean changes .. meh.
Matti Hamalainen <ccr@tnsp.org>
parents: 456
diff changeset
174 #endif
0
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
175
457
85fa3d333556 Actually, revert the boolean changes .. meh.
Matti Hamalainen <ccr@tnsp.org>
parents: 456
diff changeset
176 #ifndef BOOL
85fa3d333556 Actually, revert the boolean changes .. meh.
Matti Hamalainen <ccr@tnsp.org>
parents: 456
diff changeset
177 # ifdef bool
85fa3d333556 Actually, revert the boolean changes .. meh.
Matti Hamalainen <ccr@tnsp.org>
parents: 456
diff changeset
178 # define BOOL bool
85fa3d333556 Actually, revert the boolean changes .. meh.
Matti Hamalainen <ccr@tnsp.org>
parents: 456
diff changeset
179 # else
85fa3d333556 Actually, revert the boolean changes .. meh.
Matti Hamalainen <ccr@tnsp.org>
parents: 456
diff changeset
180 # define BOOL int
85fa3d333556 Actually, revert the boolean changes .. meh.
Matti Hamalainen <ccr@tnsp.org>
parents: 456
diff changeset
181 # endif
85fa3d333556 Actually, revert the boolean changes .. meh.
Matti Hamalainen <ccr@tnsp.org>
parents: 456
diff changeset
182 #endif
0
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
183
392
851468fda833 s/_TH_TYPES_H/TH_TYPES_H/g
Matti Hamalainen <ccr@tnsp.org>
parents: 391
diff changeset
184 #endif // TH_TYPES_H