Statistics
| Revision:

root / trunk / libraries / libjni-ecwcompress / include / NCSDefs.h @ 1429

History | View | Annotate | Download (5.79 KB)

1
/********************************************************
2
** Copyright 1999 Earth Resource Mapping Pty Ltd.
3
** This document contains unpublished source code of
4
** Earth Resource Mapping Pty Ltd. This notice does
5
** not indicate any intention to publish the source
6
** code contained herein.
7
**
8
** FILE:           NCSDefs.h
9
** CREATED:        Tue Mar 2 09:19:00 WST 1999
10
** AUTHOR:         Simon Cope
11
** PURPOSE:        General NCS defines
12
** EDITS:
13
** [01] sjc 30Apr00 Merged Mac SDK port
14
** [02]  ny 03Nov00 Merge WinCE/PALM SDK changes
15
** [03] tfl 14Jul04 Added radians/degrees conversion factors
16
 *******************************************************/
17

    
18
#ifndef NCSDEFS_H
19
#define NCSDEFS_H
20

    
21
#ifdef __cplusplus
22
extern "C" {
23
#endif
24

    
25
#ifndef NCSTYPES_H
26
#include "NCSTypes.h"
27
#endif
28

    
29
#include <float.h>
30

    
31
#ifdef LINUX
32
#ifndef NULL
33
#define NULL 0
34
#endif
35
#endif
36

    
37
#ifdef HPUX
38
// This should be defined as "inline", but the compiler doenst 
39
// like our "static inline type function()" prototypes, probably 
40
// have to change them all to static type inline function()"
41
// Use the next line when this is sorted.
42
//#define __inline inline
43
#define __inline
44
#endif
45

    
46
#if defined(MACINTOSH)||defined(SOLARIS)||defined(IRIX)||defined(PALM)||defined(HPUX)||defined(MACOSX)
47
#define NCSBO_MSBFIRST
48
#else        // WIN32, LINUX (i386)
49
#define NCSBO_LSBFIRST
50
#endif
51

    
52
#if !defined(_WIN32_WCE)&&!defined(UNALIGNED)
53
#define UNALIGNED
54
#endif        /* !_WIN32_WCE */
55

    
56
#ifdef PALM
57
// FIXME
58
#define NCS_PALM_CREATOR_ID 'NCS1'
59
#endif
60

    
61
#ifdef HPUX
62
// The system headers clash, so use their versions of MAX/MIN instead.
63
#include <sys/param.h>
64

    
65
#else
66

    
67
#ifndef MAX
68
#define MAX(a, b) ((a) > (b) ? (a) : (b))
69
#endif
70
#ifndef MIN
71
#define MIN(a, b) ((a) > (b) ? (b) : (a))
72
#endif
73

    
74
#endif
75

    
76
#ifndef TRUE
77
#define TRUE 1
78
#endif
79
#ifndef FALSE
80
#define FALSE 0
81
#endif
82

    
83
#ifdef WIN32
84

    
85
#ifndef MAXDOUBLE
86
#define MAXDOUBLE   DBL_MAX                        //1.7976931348623158e+308
87
#define NCS_FQNAN        _FPCLASS_QNAN        //0x0002
88
#define NCS_NAN                _FPCLASS_SNAN
89
#endif        /* !MAXDOUBLE */
90

    
91
#if defined(_WIN32_WCE)
92
#define NCS_NO_UNALIGNED_ACCESS
93
#endif // _WIN32_WCE
94

    
95
#elif defined PALM
96

    
97
#define NCS_FQNAN        0x0002
98

    
99
#elif defined MACINTOSH
100

    
101
#define NCS_FQNAN        0x0002
102
#define NCS_NAN                NAN
103
#ifndef MAXDOUBLE
104
#define MAXDOUBLE   DBL_MAX
105
#endif
106

    
107
#elif defined MACOSX
108
//#include <values.h>
109
#include <limits.h>
110
#include <ctype.h>
111

    
112
#define NCS_FQNAN        0x0002
113
#define NCS_NAN                NAN
114
#ifndef MAXDOUBLE
115
#define MAXDOUBLE   DBL_MAX
116
#endif
117

    
118
//FIXME: These should probably be moved somewhere else
119
#define HDC                        CGrafPtr
120
#define LPRECT                Rect *
121
#define RECT                Rect
122
#define HBITMAP                PixMapHandle
123
#define COLORREF        DWORD
124
#define HRGN                RgnHandle
125
#define UINT                UINT32
126
#define HWND                DWORD
127
#define STDMETHOD(x)        virtual INT32 x
128
#define LRESULT        INT32
129
#define HRESULT        long
130
#define WPARAM        UINT32
131
#define LPARAM         INT32
132
#define VARIANT        void *
133
#define HPEN                DWORD
134
#define HBRUSH        DWORD
135
#define BSTR                short *
136
#define BOOL                BOOLEAN
137
#define LPSTR        char *
138
#define HCURSOR        CursHandle
139
#define WORD                UINT16
140
#define STDMETHODIMP        INT32
141
//#define boolean        BOOLEAN
142
#define LOWORD(x)                ((UINT16)((long)(x) & 0xffff))
143
#define HIWORD(x)                ((UINT16)((long)(x) >> 16))
144
#define S_OK     ((LRESULT)0x00000000L)
145
#define S_FALSE  ((LRESULT)0x00000001L)
146
#define SUCCEEDED(Status)         ((Status) >= 0)
147
#define FAILED(Status)                 ((Status)<0)
148
#define MB_OK
149
#define RGB(r,g,b) ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16)))
150
#define GetRValue(rgb)      ((BYTE)(rgb))
151
#define GetGValue(rgb)      ((BYTE)(((WORD)(rgb)) >> 8))
152
#define GetBValue(rgb)      ((BYTE)((rgb)>>16))
153
#define USES_CONVERSION
154
#define MK_LBUTTON        0x0001
155
#define MK_RBUTTON        0x0002
156
#define MK_SHIFT                0x0004
157
#define MK_CONTROL        0x0008
158
#define MK_MBUTTON        0x0010
159
#define VK_SHIFT                0x10
160
#define SetCursor(X) 0; if( X ) SetCursor(*X)
161
#define SetCapture(X)
162
#define ReleaseCapture(X)
163
#define IntersectRect(A, B, C) SectRect(B, C, A)
164
#define         ZeroMemory(DATA, SIZE) memset(DATA, 0, SIZE)
165

    
166
#elif defined SOLARIS || defined LINUX || defined HPUX
167

    
168
#include <values.h>
169
#include <limits.h>
170
#include <ctype.h>
171

    
172
// Solaris can't access types on unaligned addressed
173
#define NCS_NO_UNALIGNED_ACCESS
174

    
175
#if defined(SOLARIS) || defined(HPUX)
176
// SPARC has slow BYTE bit ops
177
#define NCS_SLOW_CPU_BYTE_OPS
178
#endif
179

    
180
#else
181

    
182
#error DEFINE SYSTEM INCLUDES FOR TYPES
183

    
184
#endif        /* WIN32 */
185

    
186
typedef enum {
187
        NCSCS_RAW        = 0,
188
        NCSCS_UTM        = 1,
189
        NCSCS_LL        = 2
190
} NCSCoordSys;
191

    
192
/*Coodinate system defines*/
193
#define NCS_LINEAR_COORD_SYS        "linear"
194
#define        NCS_FEET_FACTOR                        0.30480061
195
/*[03]*/
196
#define NCS_RADIANS_TO_DEGREES        57.29577951L
197
#define NCS_DEGREES_TO_RADIANS        1.745329252E-2L        
198

    
199
#ifdef WIN32
200
#define NCS_EXPORT __declspec(dllexport)
201
#define NCS_IMPORT __declspec(dllimport)
202
#ifdef _WIN32_WCE
203
#define NCS_CALL
204
#else
205
#define NCS_CALL __cdecl
206
#endif
207
#define NCS_CB_CALL __cdecl
208
#else
209
#define NCS_EXPORT
210
#define NCS_IMPORT
211
#define NCS_CALL
212
#define NCS_CB_CALL
213
#endif
214

    
215
#ifndef MAX_PATH
216
#ifdef MACINTOSH
217

    
218
        //        Note: Verify that this is OK for all MAC/OS Platform
219
#define MAX_PATH        256
220

    
221
#elif defined PALM
222

    
223
#define MAX_PATH         1024
224

    
225
#elif defined SOLARIS || defined LINUX || defined HPUX
226

    
227
#define MAX_PATH        PATH_MAX
228

    
229
#elif defined MACOSX
230

    
231
#define MAX_PATH 1024
232

    
233
#else        /* PALM */
234

    
235
#define MAX_PATH        PATHNAMELEN
236

    
237
#endif
238
#endif        /* !MAX_PATH */
239

    
240
#define NCSIsNullString(s) ((s) == (char *)0 || (*(s)) == '\0')
241

    
242
#if        __ICL >= 700
243
#ifdef NCS_VECTOR_CC
244
//Note: need /QaxMiKW /Qvec_report3 /Qrestrict ICC flags to use vectorisation
245
#define NCS_RESTRICT restrict
246
#else
247
#define NCS_RESTRICT
248
#endif
249
#else
250
#define NCS_RESTRICT
251
#endif
252

    
253
#ifdef _OPENMP
254
#define NCS_OPENMP
255
#endif // _OPENMP
256

    
257
#ifdef NCS_OPENMP
258
#define NCS_VECTOR_CC
259
#endif // NCS_OPENMP
260

    
261
#ifndef NCS_INLINE
262
#ifdef WIN32
263
#define NCS_INLINE __forceinline
264
#else // WIN32
265
#define NCS_INLINE __inline
266
#endif // WIN32
267
#endif // NCS_INLINE
268

    
269
#ifndef NCS_FASTCALL
270
#ifdef WIN32
271
#define NCS_FASTCALL __fastcall
272
#else // WIN32
273
#define NCS_FASTCALL
274
#endif // WIN32
275
#endif // NCS_FASTCALL
276

    
277
#ifdef __cplusplus
278
}
279
#endif
280

    
281
#endif /* NCSDEFS_H */