00001
00002
00003
00004
00005
00006
00007 #ifndef BALL_COMMON_GLOBAL_H
00008 #define BALL_COMMON_GLOBAL_H
00009
00010 #ifndef BALL_CONFIG_CONFIG_H
00011 # include <BALL/CONFIG/config.h>
00012 #endif
00013
00014 #include <limits.h>
00015 #include <time.h>
00016
00017 #if defined(BALL_LOG_MEMORY) && !defined(BALL_COMMON_MEMORY_H)
00018 # include <BALL/COMMON/memory.h>
00019 #endif
00020
00021 #ifdef BALL_HAS_BASETSD_H
00022 # include <basetsd.h>
00023 #endif
00024
00025
00026
00027 #ifdef BALL_HAS_STDINT_H
00028 # include <stdint.h>
00029 #endif
00030
00031
00032 #ifdef BALL_COMPILER_MSVC
00033 # pragma warning( disable : 4290 )
00034 # pragma warning( disable : 4251 ) // Warnings about DLL interface
00035 # pragma warning( disable : 4275 ) // Warnings about DLL interface (we should do something about them, though)
00036 #endif
00037
00038 #ifdef BALL_COMPILER_MSVC
00039 # ifdef BALL_BUILD_DLL
00040 # define BALL_EXPORT __declspec(dllexport)
00041 # define BALL_EXTERN_VARIABLE __declspec(dllexport) extern
00042 # else
00043 # define BALL_EXPORT __declspec(dllimport)
00044 # define BALL_EXTERN_VARIABLE __declspec(dllimport) extern
00045 # endif
00046 # ifdef BALL_VIEW_BUILD_DLL
00047 # define BALL_VIEW_EXPORT __declspec(dllexport)
00048 # else
00049 # define BALL_VIEW_EXPORT __declspec(dllimport)
00050 # endif
00051 #else
00052 # define BALL_EXPORT
00053 # define BALL_VIEW_EXPORT
00054 # define BALL_EXTERN_VARIABLE extern
00055 #endif
00056
00057
00058
00059
00060 #if defined(BALL_COMPILER_MSVC) && (_MSC_VER >= 1300)
00061 #define BALL_DEPRECATED __declspec(deprecated)
00062 #elif defined(BALL_COMPILER_GXX) && (BALL_COMPILER_VERSION_MAJOR - 0 > 3 || (BALL_COMPILER_VERSION_MAJOR - 0 == 3 && BALL_COMPILER_VERSION_MINOR - 0 >= 2))
00063 #define BALL_DEPRECATED __attribute__((deprecated))
00064 #else
00065 #define BALL_DEPRECATED
00066 #endif
00067
00068 namespace BALL
00069 {
00070
00071 typedef int (*ComparatorType)(const void *, const void *);
00072
00073
00074 #ifndef BALL_HAS_STDINT_H
00075
00082
00089 typedef BALL_INDEX_TYPE Distance;
00090
00099 typedef BALL_SIZE_TYPE Handle;
00100
00108 typedef BALL_INDEX_TYPE Index;
00109
00117 typedef BALL_SIZE_TYPE Size;
00118
00126 typedef BALL_LONG64_TYPE LongIndex;
00127
00128
00136 typedef BALL_ULONG64_TYPE LongSize;
00137
00145 typedef time_t Time;
00146
00153 typedef BALL_SIZE_TYPE HashIndex;
00154
00162 typedef BALL_SIZE_TYPE Position;
00163
00170 typedef float Real;
00171
00178 typedef double DoubleReal;
00179
00187 typedef BALL_SIZE_TYPE Property;
00188
00195 typedef BALL_INDEX_TYPE ErrorCode;
00196
00197
00205 typedef unsigned char Byte;
00206
00214 typedef BALL_ULONG64_TYPE LongSize;
00215
00223 typedef BALL_LONG64_TYPE LongIndex;
00224
00229 typedef BALL_POINTERSIZEUINT_TYPE PointerSizeUInt;
00230 #else
00231
00232 typedef int32_t Distance;
00233 typedef uint32_t Handle;
00234 typedef int32_t Index;
00235 typedef uint32_t Size;
00236 typedef uint64_t LongSize;
00237 typedef int64_t LongIndex;
00238 typedef time_t Time;
00239 typedef uint32_t HashIndex;
00240 typedef uint32_t Position;
00241 typedef float Real;
00242 typedef double DoubleReal;
00243 typedef uint32_t Property;
00244 typedef int32_t ErrorCode;
00245 typedef uint8_t Byte;
00246 typedef uint64_t LongIndex;
00247 typedef int64_t LongSize;
00248
00249 #endif
00250
00252
00253 enum ASCII
00254 {
00255 ASCII__BACKSPACE = '\b',
00256 ASCII__BELL = '\a',
00257 ASCII__CARRIAGE_RETURN = '\r',
00258 ASCII__HORIZONTAL_TAB = '\t',
00259 ASCII__NEWLINE = '\n',
00260 ASCII__RETURN = ASCII__NEWLINE,
00261 ASCII__SPACE = ' ',
00262 ASCII__TAB = ASCII__HORIZONTAL_TAB,
00263 ASCII__VERTICAL_TAB = '\v',
00264
00265 ASCII__COLON = ':',
00266 ASCII__COMMA = ',',
00267 ASCII__EXCLAMATION_MARK = '!',
00268 ASCII__POINT = '.',
00269 ASCII__QUESTION_MARK = '?',
00270 ASCII__SEMICOLON = ';'
00271 };
00272
00273 static const Distance INVALID_DISTANCE = INT_MIN;
00274 static const Distance DISTANCE_MIN = (INT_MIN + 1);
00275 static const Distance DISTANCE_MAX = INT_MAX;
00276
00277 static const Handle INVALID_HANDLE = INT_MAX;
00278 static const Handle HANDLE_MIN = 0 ;
00279 static const Handle HANDLE_MAX = INT_MAX - 1;
00280
00281 static const Index INVALID_INDEX = -1;
00282 static const Index INDEX_MIN = 0;
00283 static const Index INDEX_MAX = INT_MAX;
00284
00285 static const Position INVALID_POSITION = INT_MAX;
00286 static const Position POSITION_MIN = 0;
00287 static const Position POSITION_MAX = INT_MAX - 1;
00288
00289 # undef SIZE_MAX
00290 static const Size INVALID_SIZE = INT_MAX;
00291 static const Size SIZE_MIN = 0;
00292 static const Size SIZE_MAX = INT_MAX - 1;
00293
00294
00295 }
00296
00297 #endif // BALL_COMMON_GLOBAL_H