[89] | 1 | /*
|
---|
| 2 | ** Copyright 1995,1996 by KVASER AB
|
---|
| 3 | ** P.O Box 4076 S-51104 KINNAHULT, SWEDEN. Tel. +46 320 15287
|
---|
| 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 | */
|
---|
| 9 |
|
---|
| 10 | #pragma message("This file is obsolete")
|
---|
| 11 |
|
---|
| 12 |
|
---|
| 13 |
|
---|
| 14 | #ifndef _STD_H_
|
---|
| 15 | #define _STD_H_
|
---|
| 16 |
|
---|
| 17 | #define ARGUSED(x) (void)(x)
|
---|
| 18 | #define PRIVATE static
|
---|
| 19 | #define PUBLIC
|
---|
| 20 |
|
---|
| 21 | #define COUNTOF(x) ((signed int)(sizeof(x)/sizeof(x[0])))
|
---|
| 22 |
|
---|
| 23 | #include "predef.h"
|
---|
| 24 |
|
---|
| 25 |
|
---|
| 26 | #ifdef _WINDOWS
|
---|
| 27 | //
|
---|
| 28 | // Building Windows (16/32) version
|
---|
| 29 | //
|
---|
| 30 | # include <windows.h>
|
---|
| 31 | #else
|
---|
| 32 | //
|
---|
| 33 | // Building DOS version
|
---|
| 34 | //
|
---|
| 35 | # define TRUE 1
|
---|
| 36 | # define FALSE 0
|
---|
| 37 | # define BOOL int
|
---|
| 38 |
|
---|
| 39 | # define WM_USER 0x0400
|
---|
| 40 |
|
---|
| 41 | typedef unsigned char BYTE;
|
---|
| 42 | typedef unsigned short WORD;
|
---|
| 43 | typedef unsigned long DWORD;
|
---|
| 44 |
|
---|
| 45 | typedef WORD WPARAM;
|
---|
| 46 | typedef DWORD LPARAM;
|
---|
| 47 |
|
---|
| 48 | typedef void (*HWND)(WPARAM aMsg, WPARAM aHandle, LPARAM aLparam);
|
---|
| 49 |
|
---|
| 50 | #endif
|
---|
| 51 |
|
---|
| 52 |
|
---|
| 53 |
|
---|
| 54 | typedef unsigned long ulong;
|
---|
| 55 | typedef unsigned short ushort;
|
---|
| 56 | typedef unsigned char uchar;
|
---|
| 57 | typedef unsigned int uint;
|
---|
| 58 |
|
---|
| 59 |
|
---|
| 60 | /*
|
---|
| 61 | ** Define macros for direct port I/O. (not for Win32)
|
---|
| 62 | */
|
---|
| 63 | #if !defined(__WIN32__)
|
---|
| 64 | # if defined(__BORLANDC__)
|
---|
| 65 | # define WRITE_PORT_UCHAR(PORT, VALUE) outportb((unsigned int)(PORT), (VALUE))
|
---|
| 66 | # define READ_PORT_UCHAR(PORT) inportb((unsigned int)(PORT))
|
---|
| 67 | # define DISABLE_INTERRUPTS _disable()
|
---|
| 68 | # define ENABLE_INTERRUPTS _enable()
|
---|
| 69 | # endif /* __BORLANDC__ */
|
---|
| 70 |
|
---|
| 71 | # if defined(_MSC_VER)
|
---|
| 72 | /*Prototypes from conio.h, MSVC1.52*/
|
---|
| 73 | int __cdecl _inp(unsigned);
|
---|
| 74 | int __cdecl _outp(unsigned, int);
|
---|
| 75 | # define WRITE_PORT_UCHAR(PORT, VALUE) _outp((unsigned int)(PORT), (int)(VALUE))
|
---|
| 76 | # define READ_PORT_UCHAR(PORT) (unsigned char)_inp((unsigned int)(PORT))
|
---|
| 77 | # define DISABLE_INTERRUPTS _disable()
|
---|
| 78 | # define ENABLE_INTERRUPTS _enable()
|
---|
| 79 | # endif /* __MSC */
|
---|
| 80 | #endif /*!defined(__WIN32__)*/
|
---|
| 81 |
|
---|
| 82 | /*
|
---|
| 83 | ** Used to convert a major.minor type version number to a 16-bit word.
|
---|
| 84 | */
|
---|
| 85 | #define VERSION_NUMBER(x,y) (((x)<<8) + (y))
|
---|
| 86 |
|
---|
| 87 | /*
|
---|
| 88 | ** A macro for notifying the caller when messages arrives (or something
|
---|
| 89 | ** else happens.) If we are running under Windows, we use the standard
|
---|
| 90 | ** message passing routine PostMessage. In DOS, we fake messaging by
|
---|
| 91 | ** calling a user-supplied routine instead - note that it will be called at
|
---|
| 92 | ** interrupt level.
|
---|
| 93 | */
|
---|
| 94 | #if defined(_Windows) || defined(__WIN32__)
|
---|
| 95 | /* Win16/32 version */
|
---|
| 96 | # define NOTIFY(hWnd, msg, handle, status) \
|
---|
| 97 | (void)PostMessage((hWnd), WM__CANLIB, \
|
---|
| 98 | ((WPARAM)(handle)), \
|
---|
| 99 | ((LPARAM)(((long)(status))<<16) + (msg)))
|
---|
| 100 |
|
---|
| 101 | #else
|
---|
| 102 | /* DOS version */
|
---|
| 103 | # define NOTIFY(hWnd, msg, handle, status) \
|
---|
| 104 | if (hWnd) \
|
---|
| 105 | (*(hWnd))(WM__CANLIB, \
|
---|
| 106 | ((WPARAM)(handle)), \
|
---|
| 107 | ((LPARAM)(((long)(status))<<16) + (msg)))
|
---|
| 108 | #endif
|
---|
| 109 |
|
---|
| 110 |
|
---|
| 111 | #if defined(__cplusplus) && defined(__BORLANDC__) && (__BORLANDC__ < 0x460)
|
---|
| 112 | // These templates are defined in Borland C++ 4.52
|
---|
| 113 | template <class T> inline const T min(const T& a, const T& b) {
|
---|
| 114 | if (a < b)
|
---|
| 115 | return a;
|
---|
| 116 | else
|
---|
| 117 | return b;
|
---|
| 118 | }
|
---|
| 119 | template <class T> inline const T max(const T& a, const T& b) {
|
---|
| 120 | if (a > b)
|
---|
| 121 | return a;
|
---|
| 122 | else
|
---|
| 123 | return b;
|
---|
| 124 | }
|
---|
| 125 | #endif
|
---|
| 126 |
|
---|
| 127 | #define minmax(n, a, b) max(a, min(b, n))
|
---|
| 128 |
|
---|
| 129 | #ifndef CompilerAssert
|
---|
| 130 | // An assert that is evaluated during compilation.
|
---|
| 131 | // If the expression is zero, the compiler will warn that the vector
|
---|
| 132 | // _Dummy[] has zero elements, otherwise it is silent.
|
---|
| 133 | //
|
---|
| 134 | // Lint warning 506 is "Constant value Boolean",
|
---|
| 135 | // 762 is "Redundantly declared ... previously declared at line ..."
|
---|
| 136 | #define CompilerAssert(e) \
|
---|
| 137 | /*lint -save -e506 -e762 */ \
|
---|
| 138 | extern char _Dummy[(e)?1:0] \
|
---|
| 139 | /*lint -restore */
|
---|
| 140 | #endif
|
---|
| 141 |
|
---|
| 142 |
|
---|
| 143 | #endif
|
---|