Stimfit @PACKAGE_VERSION@
Loading...
Searching...
No Matches
axodefn.h
Go to the documentation of this file.
1/************************************************************************************************
2**
3** Copyright (c) 1993-1997 Axon Instruments.
4** All rights reserved.
5**
6*************************************************************************************************
7** HEADER: AXODEFN.H
8** PURPOSE: Contains standard Axon definitions and prototypes.
9** AUTHOR: BHI Oct 1993
10** NOTES: * The following compilers are supported:
11** - Microsoft C/C++ (COMPILER = "Mircosoft")
12** - Borland C/C++ (COMPILER = "Borland")
13** * The following platforms are supported:
14** - MSDOS (if _DOS #defined)
15** - WIN32 (if _WIN32 #defined)
16*/
17
18#ifndef INC_AXODEFN_H
19#define INC_AXODEFN_H
20
21#ifdef __cplusplus
22 extern "C" {
23#endif /* __cplusplus */
24
25#undef COMPILER
26
27/*==============================================================================================
28** Microsoft C compiler
29*/
30#ifdef _MSC_VER
31#ifndef __STF__
32#define COMPILER "Microsoft"
33
34/* Pragmas to cutdown on MSVC warnings. */
35#pragma warning(disable:4001) // warning C4001: nonstandard extension 'single line comment' was used
36#pragma warning(disable:4100) // warning C4100: 'lParam' : unreferenced formal parameter
37#pragma warning(disable:4206) // warning C4206: nonstandard extension used : translation unit is empty
38#pragma warning(disable:4505) // warning C4505: 'GetFont' : unreferenced local function has been removed
39#pragma warning(disable:4704) // warning C4704: 'AXODBG_WriteProtectSelector' : in-line assembler precludes global optimizations
40#pragma warning(disable:4705) // warning C4705: statement has no effect
41#pragma warning(disable:4710) // warning C4710: function 'FunctionName(void)' not expanded
42
43#if !defined(_M_IX86) && defined(_M_I86)
44 #define _M_IX86 _M_I86 // Define the MSVC2x _M_IX86 symbol.
45#endif
46#if !defined(_M_I86) && defined(_M_IX86)
47 #define _M_I86 _M_IX86 // Define the MSVC1x _M_I86 symbol.
48#endif
49#if !defined(_M_I86LM) && !defined(_WIN32)
50 #error "ERROR: Large memory model must be used for 16 bit compiles."
51#endif
52#endif
53#endif /* _MSC_VER */
54
55/*===============================================================================================
56** Borland C/C++ compiler.
57*/
58
59#ifdef __BORLANDC__
60#define COMPILER "Borland"
61
62// Compatibility #defines for Borland C/C++ to behave like MSVC.
63#define _M_I86 // Assume that Borland ONLY targets 80X86 processors.
64#define _M_IX86 300 // Assume that Borland ONLY targets 80X86 processors.
65
66#ifdef _Windows
67 #define _WINDOWS
68#endif
69
70#ifdef __WIN32__
71 #define _WIN32
72#elif !defined(__LARGE__)
73 #error "ERROR: Large memory model must be used for 16 bit compiles."
74#endif
75
76#ifdef __DLL__
77 #ifdef _WINDOWS
78 #define _WINDLL
79 #else
80 #define _DLL
81 #endif
82#endif
83
84#endif /* __BORLANDC__ */
85
86/*===============================================================================================
87** Microsoft Resource Compiler
88*/
89
90#ifdef RC_INVOKED
91#define COMPILER "Resource Compiler"
92#define _WINDOWS
93#endif /* RC_INVOKED */
94
95/*===============================================================================================
96** Add other compiler dependant code HERE!
97** Treat everything else as gcc
98*/
99
100#ifndef COMPILER
101#define COMPILER "gcc"
102
103#include "unix.h"
104
105
106#endif
107
108//===============================================================================================
109//
110// If compiler is unknown, abort with an error.
111//
112
113#ifndef COMPILER
114 #error "Compiler not recognised... check AXODEFN.H"
115#endif
116
117//===============================================================================================
118// AXOAPI should be used in the declaration of all cross platform API functions.
119// e.g. void AXOAPI ABF_Initialize(void);
120#ifdef _WINDOWS
121#define AXOAPI WINAPI
122#else
123#define AXOAPI PASCAL
124#endif
125
126//===============================================================================================
127// MACRO: ELEMENTS_IN
128// PURPOSE: Returns the count of the elements in an array.
129// NOTES: *only* use this on an array.
130// Do not use this on a pointer or it will not return the correct value.
131//
132#ifndef ELEMENTS_IN
133#define ELEMENTS_IN(p) (sizeof(p)/sizeof((p)[0]))
134#endif
135
136//===============================================================================================
137//
138// 16/32 bit compatibility #defines
139//
140
141#if defined(_WIN32)
142#ifndef __STF__
143#ifndef PLATFORM
144 #define PLATFORM "Win32"
145#endif
146 #ifndef _WINDOWS
147 #define _WINDOWS
148 #endif
149 #ifndef __MINGW32__
150 #include "unix.h"
151 #endif
152#endif
153#elif defined(_DOS)
154#ifndef PLATFORM
155 #define PLATFORM "DOS"
156#endif
157 #include "..\Common\msdos.h"
158#elif defined(_WINDOWS)
159 #error "ERROR: WIN16 is not supported any more."
160#elif defined(__linux__)
161#ifndef PLATFORM
162 #define PLATFORM "Unix"
163#endif
164#elif defined(__APPLE__)
165#ifndef PLATFORM
166 #define PLATFORM "Mac"
167#endif
168#else
169 // Treat everything else as Unix
170#ifndef PLATFORM
171 #define PLATFORM "Unix"
172#endif
173#endif
174
175//=======================================================================================
176// Macros used to stringize an argument.
177//
178
179// Helper macro for the stringize macro.
180// Sometimes a nested call is necessary to get correct expansion by the preprocessor.
181#ifndef AX_STRINGIZE_HELPER
182#define AX_STRINGIZE_HELPER(a) #a
183#endif
184
185#ifndef AX_STRINGIZE
186#define AX_STRINGIZE(a) AX_STRINGIZE_HELPER(a)
187#endif
188
189// This macro formats the module and line number to prefix the message in the way that
190// MSVC likes so that you can simply double click on the line to go to the location.
191#ifndef AX_FILELINEMSG
192#define AX_FILELINEMSG(msg) __FILE__ "(" AX_STRINGIZE(__LINE__) ") : " msg
193#endif
194
195// Usage:
196// #pragma message( __FILE__ "(" AX_STRINGIZE(__LINE__) ") : warning - MFC version change.")
197// or
198// #pragma message( AX_FILELINEMSG("warning - MFC version change.") )
199//
200
201//=======================================================================================
202// Macros to declare and use string constants based on a symbol.
203#if !defined(DECLARE_STR) && !defined(USE_STR)
204#define DECLARE_STR(Name) static const char s__sz##Name[] = #Name
205#define USE_STR(Name) s__sz##Name
206#endif
207
208#ifdef __cplusplus
209}
210#endif /* __cplusplus */
211
212#endif /* __AXODEFN_H__ */