1 | /*
|
---|
2 | ** Copyright 2007 by KVASER AB, SWEDEN
|
---|
3 | ** WWW: http://www.kvaser.com
|
---|
4 | **
|
---|
5 | ** This software is furnished under a license and may be used and copied
|
---|
6 | ** only in accordance with the terms of such license.
|
---|
7 | **
|
---|
8 | ** Description:
|
---|
9 | ** This file removes the differences between BCC and MSC with regards
|
---|
10 | ** to some predefined macros. The other differences remain. Sigh.
|
---|
11 | ** ---------------------------------------------------------------------------
|
---|
12 | */
|
---|
13 |
|
---|
14 | #ifndef _PREDEF_H_
|
---|
15 | #define _PREDEF_H_
|
---|
16 |
|
---|
17 | // 1) Win16: Borland defines _Windows
|
---|
18 | // MSC defines _WINDOWS
|
---|
19 | // We want _WINDOWS (but also _Windows to be sure)
|
---|
20 | #if defined(_Windows) && !defined(_WINDOWS)
|
---|
21 | # define _WINDOWS 1
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #if defined(_WINDOWS) && !defined(_Windows)
|
---|
25 | # define _Windows 1
|
---|
26 | #endif
|
---|
27 |
|
---|
28 |
|
---|
29 | // 2) Win32: Borland defines _Windows and __WIN32__ and _WIN32
|
---|
30 | // MSC defines _WIN32
|
---|
31 | // We want __WIN32__ and _WINDOWS and _Windows and _WIN32
|
---|
32 | #if defined(_WIN32) || defined(__WIN32__)
|
---|
33 | # if !defined(__WIN32__)
|
---|
34 | # define __WIN32__ 1
|
---|
35 | # endif
|
---|
36 | # if !defined(_WINDOWS)
|
---|
37 | # define _WINDOWS 1
|
---|
38 | # endif
|
---|
39 | # if !defined(_Windows)
|
---|
40 | # define _Windows 1
|
---|
41 | # endif
|
---|
42 | #endif
|
---|
43 |
|
---|
44 |
|
---|
45 | // 3) DLL: Borland defines __DLL__
|
---|
46 | // MSC defines _DLL
|
---|
47 | // We want __DLL__
|
---|
48 | #if defined (_DLL) && !defined(__DLL__)
|
---|
49 | # define __DLL__ 1
|
---|
50 | #endif
|
---|
51 |
|
---|
52 |
|
---|
53 |
|
---|
54 |
|
---|
55 | //===========================================================================
|
---|
56 | #ifndef USE_CANLIB39_TYPES
|
---|
57 | // New typedefs for CANLIB 4.0 and beyond, partly to take care about
|
---|
58 | // the 64 bit ints, partly to alleviate pre3.9 mixing of ints and
|
---|
59 | // longs.
|
---|
60 | #if __STDC_VERSION__ >= 199901L
|
---|
61 | #include <stdint.h>
|
---|
62 | #define KVINT32 int32_t
|
---|
63 | #define KVINT64 int64_t
|
---|
64 | #define KVINT32L int32_t
|
---|
65 | #define KVUINT32 uint32_t
|
---|
66 | #define KVUINT64 uint64_t
|
---|
67 | #define KVUINT32L uint32_t
|
---|
68 | #elif defined(__GNUC__)
|
---|
69 | #define KVINT32 int
|
---|
70 | #define KVINT64 long long
|
---|
71 | #define KVINT32L int
|
---|
72 | #define KVUINT32 unsigned int
|
---|
73 | #define KVUINT64 unsigned long long
|
---|
74 | #define KVUINT32L unsigned int
|
---|
75 | #else
|
---|
76 | #define KVINT32 int
|
---|
77 | #define KVINT64 __int64
|
---|
78 | #define KVINT32L int
|
---|
79 | #define KVUINT32 unsigned int
|
---|
80 | #define KVUINT64 unsigned __int64
|
---|
81 | #define KVUINT32L unsigned int
|
---|
82 | #endif
|
---|
83 | #else
|
---|
84 | // Old typedefs for compability with CANLIB 3.9 and older.
|
---|
85 | #ifdef __GNUC__
|
---|
86 | #define KVINT32 int
|
---|
87 | #define KVINT64 long long
|
---|
88 | #define KVINT32L long
|
---|
89 | #define KVUINT32 unsigned int
|
---|
90 | #define KVUINT64 unsigned long long
|
---|
91 | #define KVUINT32L unsigned long
|
---|
92 | #else
|
---|
93 | #define KVINT32 int
|
---|
94 | #define KVINT64 __int64
|
---|
95 | #define KVINT32L long
|
---|
96 | #define KVUINT32 unsigned int
|
---|
97 | #define KVUINT64 unsigned __int64
|
---|
98 | #define KVUINT32L unsigned long
|
---|
99 | #endif
|
---|
100 | #endif
|
---|
101 |
|
---|
102 | #endif
|
---|
103 |
|
---|