Mercurial > libpst
comparison src/define.h @ 377:506e266f930d
Vitaliy Didik - fix MSVC build
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 20 Nov 2017 08:19:28 -0800 |
parents | 7a91e30826d8 |
children | ad7b880ad3d1 |
comparison
equal
deleted
inserted
replaced
376:b58ca528f5c9 | 377:506e266f930d |
---|---|
72 #define ftello ftello64 | 72 #define ftello ftello64 |
73 #define fseeko fseeko64 | 73 #define fseeko fseeko64 |
74 #else | 74 #else |
75 #error Only MSC and mingw supported for Windows | 75 #error Only MSC and mingw supported for Windows |
76 #endif | 76 #endif |
77 #ifndef __MINGW32__ | |
78 #define size_t __int64 | |
79 #endif | |
80 #ifndef UINT64_MAX | 77 #ifndef UINT64_MAX |
81 #define UINT64_MAX ((uint64_t)0xffffffffffffffff) | 78 #define UINT64_MAX ((uint64_t)0xffffffffffffffff) |
82 #endif | 79 #endif |
83 #define PRIx64 "I64x" | 80 #ifndef PRIx64 |
81 #define PRIx64 "I64x" | |
82 #endif | |
84 int __cdecl _fseeki64(FILE *, __int64, int); | 83 int __cdecl _fseeki64(FILE *, __int64, int); |
85 __int64 __cdecl _ftelli64(FILE *); | 84 __int64 __cdecl _ftelli64(FILE *); |
86 | 85 |
87 #ifdef __MINGW32__ | 86 #ifdef __MINGW32__ |
88 #include <getopt.h> | 87 #include <getopt.h> |
95 #define ctime_r(tp,tmp) (ctime(tp)?(strcpy((tmp),ctime((tp))),(tmp)):0) | 94 #define ctime_r(tp,tmp) (ctime(tp)?(strcpy((tmp),ctime((tp))),(tmp)):0) |
96 #else | 95 #else |
97 #ifdef __DJGPP__ | 96 #ifdef __DJGPP__ |
98 #define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0) | 97 #define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0) |
99 #define ctime_r(tp,tmp) (ctime(tp)?(strcpy((tmp),ctime((tp))),(tmp)):0) | 98 #define ctime_r(tp,tmp) (ctime(tp)?(strcpy((tmp),ctime((tp))),(tmp)):0) |
100 #define fseeko(stream, offset, whence) fseek(stream, (long)offset, whence) | 99 #define fseeko(stream, offset, whence) fseek(stream, (long)offset, whence) |
101 #define ftello ftell | 100 #define ftello ftell |
102 #endif | 101 #endif |
103 #ifdef HAVE_UNISTD_H | 102 #ifdef HAVE_UNISTD_H |
104 #include <unistd.h> | 103 #include <unistd.h> |
105 #else | 104 #else |
149 #define MESSAGEPRINT1(...) pst_debug(1, __LINE__, __FILE__, __VA_ARGS__) | 148 #define MESSAGEPRINT1(...) pst_debug(1, __LINE__, __FILE__, __VA_ARGS__) |
150 #define MESSAGEPRINT2(...) pst_debug(2, __LINE__, __FILE__, __VA_ARGS__) | 149 #define MESSAGEPRINT2(...) pst_debug(2, __LINE__, __FILE__, __VA_ARGS__) |
151 #define MESSAGEPRINT3(...) pst_debug(3, __LINE__, __FILE__, __VA_ARGS__) | 150 #define MESSAGEPRINT3(...) pst_debug(3, __LINE__, __FILE__, __VA_ARGS__) |
152 | 151 |
153 #define WARN(x) { \ | 152 #define WARN(x) { \ |
154 MESSAGEPRINT3 x; \ | 153 MESSAGEPRINT3 x; \ |
155 pst_debug_lock(); \ | 154 pst_debug_lock(); \ |
156 printf x; \ | 155 printf x; \ |
157 fflush(stdout); \ | 156 fflush(stdout); \ |
158 pst_debug_unlock(); \ | 157 pst_debug_unlock(); \ |
159 } | 158 } |
170 | 169 |
171 | 170 |
172 #define DEBUG_ENT(x) \ | 171 #define DEBUG_ENT(x) \ |
173 { \ | 172 { \ |
174 pst_debug_func(1, x); \ | 173 pst_debug_func(1, x); \ |
175 pst_debug(1, __LINE__, __FILE__, "Entering function\n"); \ | 174 pst_debug(1, __LINE__, __FILE__, "Entering function\n"); \ |
176 } | 175 } |
177 #define DEBUG_RET() \ | 176 #define DEBUG_RET() \ |
178 { \ | 177 { \ |
179 pst_debug(1, __LINE__, __FILE__, "Leaving function\n"); \ | 178 pst_debug(1, __LINE__, __FILE__, "Leaving function\n"); \ |
180 pst_debug_func_ret(1); \ | 179 pst_debug_func_ret(1); \ |
181 } | 180 } |
182 | 181 |
183 #define DEBUG_INIT(fname,mutex) {pst_debug_init(fname,mutex);} | 182 #define DEBUG_INIT(fname,mutex) {pst_debug_init(fname,mutex);} |
184 #define DEBUG_CLOSE() {pst_debug_close();} | 183 #define DEBUG_CLOSE() {pst_debug_close();} |
185 #define RET_DERROR(res, ret_val, x) if (res) { DIE(x);} | 184 #define RET_DERROR(res, ret_val, x) if (res) { DIE(x);} |
243 (int32_t)((((uint8_t const *)(p))[0] << 0) | \ | 242 (int32_t)((((uint8_t const *)(p))[0] << 0) | \ |
244 (((uint8_t const *)(p))[1] << 8) | \ | 243 (((uint8_t const *)(p))[1] << 8) | \ |
245 (((uint8_t const *)(p))[2] << 16) | \ | 244 (((uint8_t const *)(p))[2] << 16) | \ |
246 (((uint8_t const *)(p))[3] << 24)) | 245 (((uint8_t const *)(p))[3] << 24)) |
247 | 246 |
248 #define PST_LE_GET_UINT16(p) \ | 247 #define PST_LE_GET_UINT16(p) \ |
249 (uint16_t)((((uint8_t const *)(p))[0] << 0) | \ | 248 (uint16_t)((((uint8_t const *)(p))[0] << 0) | \ |
250 (((uint8_t const *)(p))[1] << 8)) | 249 (((uint8_t const *)(p))[1] << 8)) |
251 | 250 |
252 #define PST_LE_GET_INT16(p) \ | 251 #define PST_LE_GET_INT16(p) \ |
253 (int16_t)((((uint8_t const *)(p))[0] << 0) | \ | 252 (int16_t)((((uint8_t const *)(p))[0] << 0) | \ |
254 (((uint8_t const *)(p))[1] << 8)) | 253 (((uint8_t const *)(p))[1] << 8)) |
255 | 254 |
256 #define PST_LE_GET_UINT8(p) (*(uint8_t const *)(p)) | 255 #define PST_LE_GET_UINT8(p) (*(uint8_t const *)(p)) |
257 | 256 |