annotate th_types.h @ 394:7df5991a0ed3

Handle HAVE_STDINT_H vs HAVE_SYS_TYPES_H somewhat more sanely.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 03 Mar 2016 14:11:57 +0200
parents 10dea9ca67a0
children bffd3caf2d2c
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
393
10dea9ca67a0 Bump copyright.
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
4 * (C) Copyright 2002-2016 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
6e6c8c4fc210 Buildsystem improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 308
diff changeset
33 #if UINTPTR_MAX == 0xffffffff
6e6c8c4fc210 Buildsystem improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 308
diff changeset
34 # define TH_ARCH 32
6e6c8c4fc210 Buildsystem improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 308
diff changeset
35 #elif UINTPTR_MAX == 0xffffffffffffffff
6e6c8c4fc210 Buildsystem improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 308
diff changeset
36 # define TH_ARCH 64
6e6c8c4fc210 Buildsystem improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 308
diff changeset
37 #endif
6e6c8c4fc210 Buildsystem improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 308
diff changeset
38
6e6c8c4fc210 Buildsystem improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 308
diff changeset
39
150
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
40 #if !defined(TH_ARCH)
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
41 # if defined(__LP64__) || defined(_LP64)
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
42 # define TH_ARCH 64
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
43 # else
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
44 # define TH_ARCH 32
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
45 # endif
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
46 #endif
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
47
182
d560371c85c0 Add checks for WIN64.
Matti Hamalainen <ccr@tnsp.org>
parents: 150
diff changeset
48 #if !defined(TH_ARCH) && (defined(__WIN64) || defined(_WIN64))
d560371c85c0 Add checks for WIN64.
Matti Hamalainen <ccr@tnsp.org>
parents: 150
diff changeset
49 # define TH_ARCH 64
d560371c85c0 Add checks for WIN64.
Matti Hamalainen <ccr@tnsp.org>
parents: 150
diff changeset
50 #endif
150
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
51
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
52 #if !defined(TH_ARCH) && (defined(__WIN32) || defined(_WIN32))
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
53 # define TH_ARCH 32
0
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 #endif
150
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
55
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
56
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
57 // Do we have a valid arch?
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
58 // If so, set some printf specifiers
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
59 #if TH_ARCH == 32
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
60 # define TH_ARCH_32BIT 1
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
61 # define TH_PRIu32 "u"
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
62 # define TH_PRId32 "d"
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
63 # define TH_PRIx32 "x"
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
64 # define TH_PRIu64 "llu"
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
65 # define TH_PRId64 "lld"
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
66 # define TH_PRIx64 "llx"
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
67 # define TH_PRIu_SIZE_T "u"
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
68 # define TH_PRId_SSIZE_T "d"
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
69 # define TH_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
70 # ifndef TH_PTRSIZE
0078dc5f6260 Define TH_PTRSIZE and UINTPTR_MAX if not defined already.
Matti Hamalainen <ccr@tnsp.org>
parents: 307
diff changeset
71 # define TH_PTRSIZE 32
0078dc5f6260 Define TH_PTRSIZE and UINTPTR_MAX if not defined already.
Matti Hamalainen <ccr@tnsp.org>
parents: 307
diff changeset
72 # endif
0078dc5f6260 Define TH_PTRSIZE and UINTPTR_MAX if not defined already.
Matti Hamalainen <ccr@tnsp.org>
parents: 307
diff changeset
73 # ifndef UINTPTR_MAX
0078dc5f6260 Define TH_PTRSIZE and UINTPTR_MAX if not defined already.
Matti Hamalainen <ccr@tnsp.org>
parents: 307
diff changeset
74 # define UINTPTR_MAX 0xffffffff
0078dc5f6260 Define TH_PTRSIZE and UINTPTR_MAX if not defined already.
Matti Hamalainen <ccr@tnsp.org>
parents: 307
diff changeset
75 # endif
150
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
76 #elif TH_ARCH == 64
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
77 # define TH_ARCH_64BIT 1
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
78 # define TH_PRIu32 "u"
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
79 # define TH_PRId32 "d"
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
80 # define TH_PRIx32 "x"
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
81 # define TH_PRIu64 "lu"
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
82 # define TH_PRId64 "ld"
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
83 # define TH_PRIx64 "lx"
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
84 # define TH_PRIu_SIZE_T "lu"
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
85 # define TH_PRId_SSIZE_T "ld"
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
86 # define TH_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
87 # ifndef TH_PTRSIZE
0078dc5f6260 Define TH_PTRSIZE and UINTPTR_MAX if not defined already.
Matti Hamalainen <ccr@tnsp.org>
parents: 307
diff changeset
88 # define TH_PTRSIZE 64
0078dc5f6260 Define TH_PTRSIZE and UINTPTR_MAX if not defined already.
Matti Hamalainen <ccr@tnsp.org>
parents: 307
diff changeset
89 # endif
0078dc5f6260 Define TH_PTRSIZE and UINTPTR_MAX if not defined already.
Matti Hamalainen <ccr@tnsp.org>
parents: 307
diff changeset
90 # ifndef UINTPTR_MAX
0078dc5f6260 Define TH_PTRSIZE and UINTPTR_MAX if not defined already.
Matti Hamalainen <ccr@tnsp.org>
parents: 307
diff changeset
91 # define UINTPTR_MAX 0xffffffffffffffff
0078dc5f6260 Define TH_PTRSIZE and UINTPTR_MAX if not defined already.
Matti Hamalainen <ccr@tnsp.org>
parents: 307
diff changeset
92 # endif
150
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
93 #else
9bc7f60f3013 More portability stuff. :|
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
94 # 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
95 #endif
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96
129
aa2d608fb3f3 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
97 // Shorthand types
0
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98 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
99 typedef signed long int lint_t;
149
6a0e9980b76b Mostly cosmetic changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
100 #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
101 typedef unsigned int uint_t;
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102 #endif
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
103
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
104 /* 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
105 * 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
106 */
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
107 #ifdef TH_TYPE_I8
129
aa2d608fb3f3 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
108 typedef unsigned TH_TYPE_I8 uint8_t; // 8 bits, unsigned
aa2d608fb3f3 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
109 typedef signed TH_TYPE_I8 int8_t; // 8 bits, signed
149
6a0e9980b76b Mostly cosmetic changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
110 #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
111 typedef unsigned char uint8_t;
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
112 typedef signed char int8_t;
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
113 #endif
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
114
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
115
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
116 #ifdef TH_TYPE_I16
129
aa2d608fb3f3 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
117 typedef unsigned TH_TYPE_I16 uint16_t; // 16 bits, unsigned == 2 BYTEs
aa2d608fb3f3 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
118 typedef signed TH_TYPE_I16 int16_t; // 16 bits, signed
149
6a0e9980b76b Mostly cosmetic changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
119 #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
120 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
121 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
122 #endif
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
123
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
124 #ifdef TH_TYPE_I32
129
aa2d608fb3f3 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
125 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
126 typedef signed TH_TYPE_I32 int32_t; // 32 bits, signed
149
6a0e9980b76b Mostly cosmetic changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
127 #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
128 typedef unsigned int uint32_t;
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
129 typedef signed int int32_t;
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
130 #endif
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_I64
129
aa2d608fb3f3 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
133 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
134 typedef signed TH_TYPE_I64 int64_t; // 64 bits, signed
149
6a0e9980b76b Mostly cosmetic changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
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 long long uint64_t;
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
137 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
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 /* 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
142 * 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
143 * 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
144 * "unsigned char" instead.
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145 *
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
146 * 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
147 */
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
148 typedef char char_t;
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
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151 /* Define a boolean type
bd61a80a6c54 Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
152 */
12
83f7c71e4772 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
153 #if !defined(FALSE) && !defined(TRUE) && !defined(BOOL)
83f7c71e4772 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
154 typedef enum { FALSE = 0, TRUE = 1 } BOOL;
0
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 #ifndef BOOL
307
fa6113e556c5 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
158 # ifdef bool
fa6113e556c5 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
159 # define BOOL bool
fa6113e556c5 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
160 # else
fa6113e556c5 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
161 # define BOOL int
fa6113e556c5 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
162 # endif
0
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
392
851468fda833 s/_TH_TYPES_H/TH_TYPES_H/g
Matti Hamalainen <ccr@tnsp.org>
parents: 391
diff changeset
165 #endif // TH_TYPES_H