upscaledb  2.2.1
types.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2017 Christoph Rupp (chris@crupp.de).
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * See the file COPYING for License information.
17  */
18 
19 
27 #ifndef UPS_TYPES_H
28 #define UPS_TYPES_H
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /*
35  * Check the operating system and word size
36  */
37 #ifdef WIN32
38 # undef UPS_OS_WIN32
39 # define UPS_OS_WIN32 1
40 # ifdef WIN64
41 # undef UPS_64BIT
42 # define UPS_64BIT 1
43 # elif WIN32
44 # undef UPS_32BIT
45 # define UPS_32BIT 1
46 # else
47 # error "Neither WIN32 nor WIN64 defined!"
48 # endif
49 #else /* posix? */
50 # undef UPS_OS_POSIX
51 # define UPS_OS_POSIX 1
52 # if defined(__LP64__) || defined(__LP64) || __WORDSIZE == 64
53 # undef UPS_64BIT
54 # define UPS_64BIT 1
55 # else
56 # undef UPS_32BIT
57 # define UPS_32BIT 1
58 # endif
59 #endif
60 
61 #if defined(UPS_OS_POSIX) && defined(UPS_OS_WIN32)
62 # error "Unknown arch - neither UPS_OS_POSIX nor UPS_OS_WIN32 defined"
63 #endif
64 
65 /*
66  * improve memory debugging on WIN32 by using crtdbg.h (only MSVC
67  * compiler and debug builds!)
68  *
69  * make sure crtdbg.h is loaded before malloc.h!
70  */
71 #if defined(_MSC_VER) && defined(UPS_OS_WIN32)
72 # if (defined(WIN32) || defined(__WIN32)) && !defined(UNDER_CE)
73 # if defined(DEBUG) || defined(_DEBUG)
74 # ifndef _CRTDBG_MAP_ALLOC
75 # define _CRTDBG_MAP_ALLOC 1
76 # endif
77 # endif
78 # include <crtdbg.h>
79 # include <malloc.h>
80 # endif
81 #endif
82 
83 /*
84  * Create the EXPORT macro for Microsoft Visual C++
85  */
86 #ifndef UPS_EXPORT
87 # ifdef _MSC_VER
88 # define UPS_EXPORT __declspec(dllexport)
89 # else
90 # define UPS_EXPORT extern
91 # endif
92 #endif
93 
94 /*
95  * The default calling convention is cdecl
96  */
97 #ifndef UPS_CALLCONV
98 # define UPS_CALLCONV
99 #endif
100 
101 /*
102  * Common typedefs. Since stdint.h is not available on older versions of
103  * Microsoft Visual Studio, they get declared here.
104  * http://msinttypes.googlecode.com/svn/trunk/stdint.h
105  */
106 #if _MSC_VER
107 # include <ups/msstdint.h>
108 #else
109 # include <stdint.h>
110 #endif
111 
112 /* Deprecated typedefs; used prior to 2.1.10. Please do not use them! */
119 typedef int8_t ups_s8_t;
121 
122 /*
123  * Undefine macros to avoid macro redefinitions
124  */
125 #undef UPS_INVALID_FD
126 #undef UPS_FALSE
127 #undef UPS_TRUE
128 
132 typedef int ups_bool_t;
133 #define UPS_FALSE 0
134 #define UPS_TRUE (!UPS_FALSE)
135 
139 typedef int ups_status_t;
140 
141 
142 #ifdef __cplusplus
143 } // extern "C"
144 #endif
145 
146 #endif /* UPS_TYPES_H */
int16_t ups_s16_t
Definition: types.h:117
int ups_bool_t
Definition: types.h:132
unsigned short uint16_t
Definition: msstdint.h:84
unsigned __int64 uint64_t
Definition: msstdint.h:95
unsigned char uint8_t
Definition: msstdint.h:83
int32_t ups_s32_t
Definition: types.h:115
signed char int8_t
Definition: msstdint.h:80
unsigned int uint32_t
Definition: msstdint.h:85
uint16_t ups_u16_t
Definition: types.h:118
int64_t ups_s64_t
Definition: types.h:113
int8_t ups_s8_t
Definition: types.h:119
signed short int16_t
Definition: msstdint.h:81
uint8_t ups_u8_t
Definition: types.h:120
signed __int64 int64_t
Definition: msstdint.h:94
int ups_status_t
Definition: types.h:139
signed int int32_t
Definition: msstdint.h:82
uint64_t ups_u64_t
Definition: types.h:114
uint32_t ups_u32_t
Definition: types.h:116