author | Christian Taedcke <Christian.Taedcke@ica-traffic.de> |
Fri, 19 Feb 2010 08:19:23 +0100 | |
changeset 640 | e9a4e4c308bb |
parent 637 | c676669ec3c1 |
child 662 | aad111ad0018 |
permissions | -rw-r--r-- |
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
1 |
/* |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
2 |
This file is part of CanFestival, a library implementing CanOpen Stack. |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
3 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
4 |
Copyright (C): Edouard TISSERANT and Francis DUPIN |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
5 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
6 |
See COPYING file for copyrights details. |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
7 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
8 |
This library is free software; you can redistribute it and/or |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
9 |
modify it under the terms of the GNU Lesser General Public |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
10 |
License as published by the Free Software Foundation; either |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
11 |
version 2.1 of the License, or (at your option) any later version. |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
12 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
13 |
This library is distributed in the hope that it will be useful, |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
16 |
Lesser General Public License for more details. |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
17 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
18 |
You should have received a copy of the GNU Lesser General Public |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
19 |
License along with this library; if not, write to the Free Software |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
20 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
21 |
*/ |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
22 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
23 |
#ifndef __APPLICFG_WIN32__ |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
24 |
#define __APPLICFG_WIN32__ |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
25 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
26 |
#include <windows.h> |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
27 |
#include <string.h> |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
28 |
#include <stdio.h> |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
29 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
30 |
// Define the architecture : little_endian or big_endian |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
31 |
// ----------------------------------------------------- |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
32 |
// Test : |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
33 |
// UNS32 v = 0x1234ABCD; |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
34 |
// char *data = &v; |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
35 |
// |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
36 |
// Result for a little_endian architecture : |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
37 |
// data[0] = 0xCD; |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
38 |
// data[1] = 0xAB; |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
39 |
// data[2] = 0x34; |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
40 |
// data[3] = 0x12; |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
41 |
// |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
42 |
// Result for a big_endian architecture : |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
43 |
// data[0] = 0x12; |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
44 |
// data[1] = 0x34; |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
45 |
// data[2] = 0xAB; |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
46 |
// data[3] = 0xCD; |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
47 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
48 |
// Integers |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
49 |
#define INTEGER8 char |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
50 |
#define INTEGER16 short |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
51 |
#define INTEGER24 long |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
52 |
#define INTEGER32 long |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
53 |
#define INTEGER40 long long |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
54 |
#define INTEGER48 long long |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
55 |
#define INTEGER56 long long |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
56 |
#define INTEGER64 long long |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
57 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
58 |
// Unsigned integers |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
59 |
#define UNS8 unsigned char |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
60 |
#define UNS16 unsigned short |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
61 |
#define UNS32 unsigned long |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
62 |
#define UNS24 unsigned long |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
63 |
#define UNS40 unsigned long long |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
64 |
#define UNS48 unsigned long long |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
65 |
#define UNS56 unsigned long long |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
66 |
#define UNS64 unsigned long long |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
67 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
68 |
// Reals |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
69 |
#define REAL32 float |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
70 |
#define REAL64 double |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
71 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
72 |
// Custom integer types sizes |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
73 |
#define sizeof_INTEGER24 3 |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
74 |
#define sizeof_INTEGER40 5 |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
75 |
#define sizeof_INTEGER48 6 |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
76 |
#define sizeof_INTEGER56 7 |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
77 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
78 |
#define sizeof_UNS24 3 |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
79 |
#define sizeof_UNS40 5 |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
80 |
#define sizeof_UNS48 6 |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
81 |
#define sizeof_UNS56 7 |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
82 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
83 |
// Non integral integers conversion macros |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
84 |
#define INT24_2_32(a) (a <= 0x7FFFFF ? a : a|0xFF000000) |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
85 |
#define INT40_2_64(a) (a <= 0x0000007FFFFFFFFF ? a : a|0xFFFFFF0000000000) |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
86 |
#define INT48_2_64(a) (a <= 0x00007FFFFFFFFFFF ? a : a|0xFFFF000000000000) |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
87 |
#define INT56_2_64(a) (a <= 0x007FFFFFFFFFFFFF ? a : a|0xFF00000000000000) |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
88 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
89 |
#define INT32_2_24(a) (a&0x00FFFFFF) |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
90 |
#define INT64_2_40(a) (a&0x000000FFFFFFFFFF) |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
91 |
#define INT64_2_48(a) (a&0x0000FFFFFFFFFFFF) |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
92 |
#define INT64_2_56(a) (a&0x00FFFFFFFFFFFFFF) |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
93 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
94 |
/// Definition of error and warning macros |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
95 |
// -------------------------------------- |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
96 |
|
637
c676669ec3c1
CHANGED: - enabled console debugging for Visual Studio 2003 and below (without __VA_ARGS__).
Christian Taedcke
parents:
407
diff
changeset
|
97 |
#ifndef _MSC_VER |
c676669ec3c1
CHANGED: - enabled console debugging for Visual Studio 2003 and below (without __VA_ARGS__).
Christian Taedcke
parents:
407
diff
changeset
|
98 |
#error This block is for Visual only, please adapt it for your compiler. |
c676669ec3c1
CHANGED: - enabled console debugging for Visual Studio 2003 and below (without __VA_ARGS__).
Christian Taedcke
parents:
407
diff
changeset
|
99 |
#elif (_MSC_VER >= 1400) |
c676669ec3c1
CHANGED: - enabled console debugging for Visual Studio 2003 and below (without __VA_ARGS__).
Christian Taedcke
parents:
407
diff
changeset
|
100 |
//Visual Studio 2005 and above |
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
101 |
#ifdef UNICODE |
396
a43910975547
Fixed debug build on mingw32, was broken due to recent changes in debug macros in print_message
etisserant
parents:
145
diff
changeset
|
102 |
#define MSG(...) \ |
a43910975547
Fixed debug build on mingw32, was broken due to recent changes in debug macros in print_message
etisserant
parents:
145
diff
changeset
|
103 |
do{wchar_t msg[300];\ |
a43910975547
Fixed debug build on mingw32, was broken due to recent changes in debug macros in print_message
etisserant
parents:
145
diff
changeset
|
104 |
swprintf(msg,L##__VA_ARGS__);\ |
a43910975547
Fixed debug build on mingw32, was broken due to recent changes in debug macros in print_message
etisserant
parents:
145
diff
changeset
|
105 |
OutputDebugString(msg);}while(0) |
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
106 |
#else |
396
a43910975547
Fixed debug build on mingw32, was broken due to recent changes in debug macros in print_message
etisserant
parents:
145
diff
changeset
|
107 |
#define MSG(...) \ |
407
384c3cd7afa2
Fixed some win32 stdout related problems. May not worl wit visualstudio debug log anymore.
etisserant
parents:
396
diff
changeset
|
108 |
do{printf(__VA_ARGS__);fflush(stdout);}while(0) |
384c3cd7afa2
Fixed some win32 stdout related problems. May not worl wit visualstudio debug log anymore.
etisserant
parents:
396
diff
changeset
|
109 |
|
384c3cd7afa2
Fixed some win32 stdout related problems. May not worl wit visualstudio debug log anymore.
etisserant
parents:
396
diff
changeset
|
110 |
/*do{char msg[300];\ |
396
a43910975547
Fixed debug build on mingw32, was broken due to recent changes in debug macros in print_message
etisserant
parents:
145
diff
changeset
|
111 |
sprintf(msg,##__VA_ARGS__);\ |
a43910975547
Fixed debug build on mingw32, was broken due to recent changes in debug macros in print_message
etisserant
parents:
145
diff
changeset
|
112 |
OutputDebugString(msg);}while(0) |
407
384c3cd7afa2
Fixed some win32 stdout related problems. May not worl wit visualstudio debug log anymore.
etisserant
parents:
396
diff
changeset
|
113 |
*/ |
637
c676669ec3c1
CHANGED: - enabled console debugging for Visual Studio 2003 and below (without __VA_ARGS__).
Christian Taedcke
parents:
407
diff
changeset
|
114 |
#endif |
c676669ec3c1
CHANGED: - enabled console debugging for Visual Studio 2003 and below (without __VA_ARGS__).
Christian Taedcke
parents:
407
diff
changeset
|
115 |
#else //(_MSC_VER < 1400) |
c676669ec3c1
CHANGED: - enabled console debugging for Visual Studio 2003 and below (without __VA_ARGS__).
Christian Taedcke
parents:
407
diff
changeset
|
116 |
//For Visual Studio 2003 and below, without VA_ARGS |
c676669ec3c1
CHANGED: - enabled console debugging for Visual Studio 2003 and below (without __VA_ARGS__).
Christian Taedcke
parents:
407
diff
changeset
|
117 |
#ifdef UNICODE |
c676669ec3c1
CHANGED: - enabled console debugging for Visual Studio 2003 and below (without __VA_ARGS__).
Christian Taedcke
parents:
407
diff
changeset
|
118 |
#define MSG(text) \ |
c676669ec3c1
CHANGED: - enabled console debugging for Visual Studio 2003 and below (without __VA_ARGS__).
Christian Taedcke
parents:
407
diff
changeset
|
119 |
do{wchar_t msg[300];\ |
c676669ec3c1
CHANGED: - enabled console debugging for Visual Studio 2003 and below (without __VA_ARGS__).
Christian Taedcke
parents:
407
diff
changeset
|
120 |
vswprintf(msg,L##text);\ |
c676669ec3c1
CHANGED: - enabled console debugging for Visual Studio 2003 and below (without __VA_ARGS__).
Christian Taedcke
parents:
407
diff
changeset
|
121 |
OutputDebugString(msg);}while(0) |
c676669ec3c1
CHANGED: - enabled console debugging for Visual Studio 2003 and below (without __VA_ARGS__).
Christian Taedcke
parents:
407
diff
changeset
|
122 |
#else |
c676669ec3c1
CHANGED: - enabled console debugging for Visual Studio 2003 and below (without __VA_ARGS__).
Christian Taedcke
parents:
407
diff
changeset
|
123 |
#define MSG(text) \ |
c676669ec3c1
CHANGED: - enabled console debugging for Visual Studio 2003 and below (without __VA_ARGS__).
Christian Taedcke
parents:
407
diff
changeset
|
124 |
do{printf text;fflush(stdout);}while(0) |
c676669ec3c1
CHANGED: - enabled console debugging for Visual Studio 2003 and below (without __VA_ARGS__).
Christian Taedcke
parents:
407
diff
changeset
|
125 |
#endif |
c676669ec3c1
CHANGED: - enabled console debugging for Visual Studio 2003 and below (without __VA_ARGS__).
Christian Taedcke
parents:
407
diff
changeset
|
126 |
|
c676669ec3c1
CHANGED: - enabled console debugging for Visual Studio 2003 and below (without __VA_ARGS__).
Christian Taedcke
parents:
407
diff
changeset
|
127 |
#endif //_MSC_VER |
c676669ec3c1
CHANGED: - enabled console debugging for Visual Studio 2003 and below (without __VA_ARGS__).
Christian Taedcke
parents:
407
diff
changeset
|
128 |
|
396
a43910975547
Fixed debug build on mingw32, was broken due to recent changes in debug macros in print_message
etisserant
parents:
145
diff
changeset
|
129 |
#define CANFESTIVAL_DEBUG_MSG(num, str, val)\ |
a43910975547
Fixed debug build on mingw32, was broken due to recent changes in debug macros in print_message
etisserant
parents:
145
diff
changeset
|
130 |
{unsigned long value = val;\ |
637
c676669ec3c1
CHANGED: - enabled console debugging for Visual Studio 2003 and below (without __VA_ARGS__).
Christian Taedcke
parents:
407
diff
changeset
|
131 |
MSG(("%s(%d) : 0x%X %s 0x%lX\n",__FILE__, __LINE__,num, str, value)); \ |
396
a43910975547
Fixed debug build on mingw32, was broken due to recent changes in debug macros in print_message
etisserant
parents:
145
diff
changeset
|
132 |
} |
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
133 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
134 |
/// Definition of MSG_WAR |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
135 |
// --------------------- |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
136 |
#ifdef DEBUG_WAR_CONSOLE_ON |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
137 |
#define MSG_WAR(num, str, val) CANFESTIVAL_DEBUG_MSG(num, str, val) |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
138 |
#else |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
139 |
# define MSG_WAR(num, str, val) |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
140 |
#endif |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
141 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
142 |
/// Definition of MSG_ERR |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
143 |
// --------------------- |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
144 |
#ifdef DEBUG_ERR_CONSOLE_ON |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
145 |
# define MSG_ERR(num, str, val) CANFESTIVAL_DEBUG_MSG(num, str, val) |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
146 |
#else |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
147 |
# define MSG_ERR(num, str, val) |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
148 |
#endif |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
149 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
150 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
151 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
152 |
typedef void* CAN_HANDLE; |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
153 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
154 |
typedef void* CAN_PORT; |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
155 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
156 |
#endif // __APPLICFG_WIN32__ |