00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #ifndef INC_MI32_STDDEFNS_H
00044 #define INC_MI32_STDDEFNS_H
00045
00046 #ifdef DEPRECATE_ALL
00047 #undef NO_DEPRECATED
00048 #define NO_DEPRECATED
00049 #undef DEPRECATE_GROUPKEY
00050 #define DEPRECATE_GROUPKEY
00051 #undef DEPRECATE_OLDHELP
00052 #define DEPRECATE_OLDHELP
00053 #endif
00054
00055
00056 #ifdef index
00057 #undef index
00058 #endif
00059
00060 #ifndef NO_DEPRECATED
00061
00062
00063 #define ENUM enum
00064 #endif
00065
00066
00067 #if defined(WIN32)
00068 #include <mi32/winfixup.h>
00069 #endif
00070
00071 #ifndef INC_MI32_DLLDEFNS_H
00072 #include <mi32/dlldefns.h>
00073 #endif
00074
00075
00076
00077
00078
00079 #if defined(WIN32) && !defined(WINNT)
00080 #define WINNT
00081 #endif
00082
00083
00084
00085
00086
00087 #if !defined(BYTEORDER_HiLo) && !defined(BYTEORDER_LoHi)
00088 #if defined(i386) || defined(LINUX_INTEL) || defined(NT_INTEL) || defined(WIN32)
00089 #define BYTEORDER_LoHi
00090 #else
00091 #define BYTEORDER_HiLo
00092 #endif
00093 #endif
00094
00095 #if !defined(BYTEORDER_Intel) && defined(BYTEORDER_LoHi)
00096 #define BYTEORDER_Intel
00097 #endif
00098
00099
00100
00101
00102
00103 #if defined(WIN32)
00104
00105 #pragma warning (error:4002) // too many actual parameters for macro
00106 #pragma warning (error:4003) // not enough actual parameters for macro
00107 #pragma warning (error:4553) // '==' operator has no effect
00108 #pragma warning (error:4390) // Empty control statement found, no point for it
00109 #pragma warning (error:4005) // Macro defined twice
00110 #pragma warning (error:4013) // Undefined function (missing prototype)
00111 #pragma warning (error:4028) // Formal parameter different from declaration
00112 #pragma warning (error:4033) // Function must return a value
00113 #pragma warning (error:4047) // Different levels of indirection
00114 #pragma warning (error:4098) // Void function returning a value
00115 #pragma warning (error:4131) // Function uses old style declarator
00116 #pragma warning (error:4133) // Incompatible types - from 'unsigned short *' to 'char *'
00117 #pragma warning (error:4150) // Deletion of pointer to incomplete type
00118 #pragma warning (error:4172) // Returning address of local or temporary
00119 #pragma warning (error:4152) // Pointer to function converted to pointer to data
00120 #pragma warning (error:4218) // Function does not have a return type
00121 #pragma warning (error:4305) // Argument truncation from '...' to '...'
00122 #pragma warning (error:4309) // Truncation of constant value
00123 #ifdef ALLOW_UNUSED_FUNCTIONS
00124 #pragma warning (3:4505) // Local function not used
00125 #else
00126 #pragma warning (error:4505) // Local function not used
00127 #endif
00128 #pragma warning (error:4551) // Function call missing argument list
00129 #pragma warning (error:4552) // Operator has no effect, expected operator with side effect
00130 #pragma warning (error:4700) // Local variable used without having been initialized
00131 #pragma warning (error:4715) // Not all control paths return a value
00132
00133 #pragma warning (error:4804) // Unsafe use of type 'bool' in operation
00134 #pragma warning (error:4805) // Unsafe mix of types for bitwise operation
00135 #pragma warning (error:4806) // Unsafe operation, no value of type 'bool can equal the given constant
00136 #ifdef WARN_UNREF_PARM
00137 #pragma warning (3:4100) // Unreferenced formal parameter
00138 #endif
00139 #pragma warning (3:4189) // Local variable initialized but not referenced
00140 #pragma warning (3:4201) // Nameless structure / union
00141 #pragma warning (3:4211) // Redefine extern to static
00142 #pragma warning (3:4212) // Function declaration uses ellipsis, definition does not
00143 #pragma warning (3:4222) // 'static' used on member function at file scope
00144 #pragma warning (3:4234) // Keyword reserved for future use
00145 #pragma warning (3:4235) // Keyword not supported
00146 #pragma warning (3:4244) // Conversion results in possible loss of data
00147 #pragma warning (3:4701) // Local variable not initialized
00148 #pragma warning (3:4705) // Statement has no effect
00149 #pragma warning (3:4706) // Assignment within conditional expression
00150 #pragma warning (3:4709) // Comma operator within array brackets
00151 #ifdef WARN_NOT_INLINED
00152 #pragma warning (3:4710) // Function not inlined
00153 #endif
00154 #pragma warning (disable:4284) // Warning about operator-> with infix notation
00155 #pragma warning (disable:4355) // 'this' used in base member initializaton list
00156 #pragma warning (disable:4786) // Browser identifier limit of 255 characters was exceeded, oh well...
00157 #endif
00158
00159
00160
00161
00162
00163 #if defined(__cplusplus)
00164 #if defined(WIN32) || defined(MAC_NATIVE)
00165 #define ALLOW_NAMESPACES
00166 namespace std {}
00167 #define USING_NAMESPACE_STD using namespace std;
00168 #else
00169 #define USING_NAMESPACE_STD
00170 #endif
00171
00172 #ifdef MAC_NATIVE
00173 using namespace std;
00174 #endif
00175 #endif
00176
00177
00178
00179
00180
00181 typedef signed char INT8;
00182 typedef unsigned char UINT8;
00183 typedef short INT16;
00184 typedef unsigned short UINT16;
00185 #if defined(WIN32) && defined(_MSC_VER) && (_MSC_VER >= 1200)
00186
00187 #include <basetsd.h>
00188 #define INT32_is_int
00189 typedef int PTRINT;
00190 typedef unsigned int PTRUINT;
00191 #elif defined(LONGS_ARE_64_BIT)
00192
00193
00194 typedef int INT32;
00195 typedef unsigned int UINT32;
00196 typedef long INT64;
00197 typedef unsigned long UINT64;
00198 #define INT32_is_int
00199 typedef long PTRINT;
00200 typedef unsigned long PTRUINT;
00201 #else
00202 typedef long INT32;
00203 typedef unsigned long UINT32;
00204 typedef long long INT64;
00205 typedef unsigned long long UINT64;
00206 typedef long PTRINT;
00207 typedef unsigned long PTRUINT;
00208 #endif
00209
00210 typedef unsigned int COLOR32;
00211
00212 #if defined(__cplusplus)
00213
00214 const INT8 INT8_MAX = 127;
00215 const INT8 INT8_MIN = -INT8_MAX-1;
00216 const UINT8 UINT8_MAX = 255;
00217 const UINT8 UINT8_MIN = 0;
00218
00219 const INT16 INT16_MAX = 32767;
00220 const INT16 INT16_MIN = -INT16_MAX-1;
00221 const UINT16 UINT16_MAX = 65535;
00222 const UINT16 UINT16_MIN = 0;
00223
00224 const INT32 INT32_MAX = 2147483647;
00225 const INT32 INT32_MIN = -INT32_MAX-1;
00226 const UINT32 UINT32_MAX = 4294967295UL;
00227 const UINT32 UINT32_MIN = 0;
00228
00229
00230 #undef INT64_MIN
00231 #undef INT64_MAX
00232 #undef UINT64_MIN
00233 #undef UINT64_MAX
00234
00235 #if defined(WIN32)
00236
00237 const INT64 INT64_MAX = 0x7FFFFFFFFFFFFFFF;
00238
00239 const UINT64 UINT64_MAX = 0xFFFFFFFFFFFFFFFF;
00240 #else
00241
00242
00243 const INT64 INT64_MAX = 0x7FFFFFFFFFFFFFFFLL;
00244
00245 const UINT64 UINT64_MAX = 0xFFFFFFFFFFFFFFFFULL;
00246 #endif
00247
00248
00249 const INT64 INT64_MIN = -INT64_MAX-1;
00250
00251 const UINT64 UINT64_MIN = 0;
00252
00253
00254 const UINT64 INT64_MULT = static_cast<UINT64>(UINT32_MAX) + 1;
00255
00256 namespace MGUI {
00257
00258 typedef PTRINT ID;
00259 }
00260
00261 #else // Not C++
00262
00263 #define INT8_MAX 127
00264 #define INT8_MIN (-INT8_MAX-1)
00265 #define UINT8_MAX 255
00266 #define UINT8_MIN 0
00267
00268 #define INT16_MAX 32767
00269 #define INT16_MIN (-INT16_MAX-1)
00270 #define UINT16_MAX 65535
00271 #define UINT16_MIN 0
00272
00273 #define INT32_MAX 2147483647
00274 #define INT32_MIN (-INT32_MAX-1)
00275 #define UINT32_MAX 4294967295
00276 #define UINT32_MIN 0
00277
00278 #define INT64_MAX 0x7FFFFFFFFFFFFFFF
00279 #define INT64_MIN (-INT64_MAX-1)
00280 #define UINT64_MAX 0xFFFFFFFFFFFFFFFF
00281 #define UINT64_MIN 0
00282
00283 #endif
00284
00285 typedef float FLOAT;
00286 typedef double DOUBLE;
00287 typedef unsigned short UNICODE;
00288
00289
00290
00291
00292
00293 #if defined(__cplusplus)
00294
00295 struct WPOINT2D;
00296 struct LPOINT2D;
00297 struct FPOINT2D;
00298 struct DPOINT2D;
00299 struct WPOINT3D;
00300 struct LPOINT3D;
00301 struct FPOINT3D;
00302 struct DPOINT3D;
00303 struct FPOINT3DH;
00304 struct DPOINT3DH;
00305
00306
00307 struct WRECT2D;
00308 struct LRECT2D;
00309 struct DRECT2D;
00310 struct DRECT3D;
00311
00312 typedef WRECT2D WRECTXY;
00313 typedef LRECT2D LRECTXY;
00314
00315 struct MAPPROJPARM;
00316 struct RVCGENINFO;
00317 struct FNAMEINODEUC;
00318
00319 #endif // C++
00320
00321
00322
00323
00324
00325
00326 #if defined(__cplusplus)
00327
00328 struct WPOLYGON { INT32 numpts; WPOINT2D *point; };
00329 struct LPOLYGON { INT32 numpts; LPOINT2D *point; };
00330 struct DPOLYGON { INT32 numpts; DPOINT2D *point; };
00331
00332 typedef WPOLYGON WPOLYLINE;
00333 typedef LPOLYGON LPOLYLINE;
00334 typedef DPOLYGON DPOLYLINE;
00335
00336 struct DPOLYLINE3D { INT32 numpts; DPOINT3D *point; };
00337
00338 struct LSEGMENT2D { INT32 x1, y1, x2, y2; };
00339
00340 #endif // C++
00341
00342
00343
00344
00345
00346 #if defined(__cplusplus)
00347
00348 struct DRANGE { double min, max; };
00349
00350 typedef UINT32 ICID;
00351
00352 typedef INT32 RVCINODENUM;
00353 typedef int (*MfFiltFuncProto) (int, RVCINODENUM, RVCGENINFO*, void*, char*);
00354 typedef int (*MfValidMultiProto) (int, FNAMEINODEUC*, void*, int*, char*);
00355
00356 typedef struct _WidgetRec *Widget;
00357
00358 #ifdef WIN32_NATIVE
00359 #if defined(__cplusplus)
00360 class CWnd;
00361 typedef CWnd* MDLGPARENT;
00362 #endif
00363 #else
00364 #ifndef X_NATIVE
00365 #define X_NATIVE
00366 #endif
00367 typedef Widget MDLGPARENT;
00368 #ifdef WIN32
00369 typedef unsigned long COLORREF;
00370 #else
00371 typedef UINT32 COLORREF;
00372 #endif
00373 #endif
00374
00375
00376 #endif // C++
00377
00378 typedef DOUBLE Mat3x3[3][3];
00379 typedef DOUBLE MAT3X3[3][3];
00380 typedef DOUBLE MAT4X4[4][4];
00381
00382 typedef void *INIHANDLE;
00383 typedef void *MXDHANDLE;
00384 typedef unsigned long MPIXEL;
00385 typedef int ERRVALUE;
00386
00387
00388
00389
00390
00391 #ifdef FALSE
00392 #undef FALSE
00393 #endif
00394 #define FALSE 0
00395 #ifdef TRUE
00396 #undef TRUE
00397 #endif
00398 #define TRUE 1
00399
00400 #ifndef NULL
00401 #define NULL 0
00402 #endif
00403
00404 #ifdef PI // LINUX defined this
00405 #undef PI
00406 #endif
00407 #define PI (3.14159265358979323846)
00408 #define RADTODEG (180.0/PI)
00409 #define DEGTORAD (PI/180.0)
00410 #define RADTODEG64 (64.0*180.0/PI)
00411 #define DEG64TORAD (PI/(64.0*180.0))
00412
00413 #define FEETTOMETERS (0.3048)
00414 #define METERSTOFEET (3.280839895)
00415 #define METERSTOINCHES (3.280839895*12.0)
00416
00417 #if defined(WIN32) && !defined(WIN32_NATIVE)
00418 #ifndef NeedFunctionPrototypes
00419 #define NeedFunctionPrototypes 1
00420 #endif
00421 #ifndef XTSTRINGDEFINES
00422 #define XTSTRINGDEFINES
00423 #endif
00424 #ifndef XMSTRINGDEFINES
00425 #define XMSTRINGDEFINES
00426 #endif
00427 #ifndef XmHTML_STRINGDEFINES
00428 #define XmHTML_STRINGDEFINES
00429 #endif
00430 #endif
00431
00432
00433
00434
00435
00436 #ifdef MIN
00437 #undef MIN
00438 #endif
00439 #ifdef MAX
00440 #undef MAX
00441 #endif
00442
00443 #ifndef membersize
00444 #define membersize(type,name) sizeof(((type*)0)->name)
00445 #endif
00446
00447 #define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
00448 #define MIN(i1,i2) (((i1)<(i2))?(i1):(i2))
00449 #define MAX(i1,i2) (((i1)>(i2))?(i1):(i2))
00450 #define SIGN(d) (((d)<0) ? -1 : ((d)>0) ? 1 : 0)
00451 #define SWAP(a,b) { a-=b; b+=a; a=b-a; }
00452 #define bound(val,min,max) (((val)<(min))?(min):(((val)>(max))?(max):(val)))
00453
00454 #if defined(WIN32) && defined(__cplusplus)
00455
00456
00457
00458
00459
00460
00461
00462 inline INT32 ROUND(double x) {
00463 x += 1E-10;
00464 INT32 result;
00465 __asm fld x
00466 __asm fistp result
00467 return result;
00468 }
00469
00470 #else
00471
00472 #define ROUND(d) static_cast<INT32>(floor((d)+.5))
00473
00474 #endif
00475
00476 #if defined(__cplusplus)
00477
00478
00479 #define CHECKSIZE(s) \
00480 inline int _checksize () { return (1 / (sizeof(*this) == (s))); }
00481
00482
00483 #ifdef WIN32
00484 #define GLOBALFUNC ::
00485 #else
00486 #define GLOBALFUNC
00487 #endif
00488
00489
00490
00491 template <class _CT> inline void SetBitFromBool (
00492 _CT& value,
00493 unsigned bit,
00494 bool set
00495 ) { if (set) value |= static_cast<_CT>(bit); else value &= static_cast<_CT>(~bit); }
00496
00497 inline void SetMinMax (double x, double& minx, double& maxx) { if (x < minx) minx = x; if (x > maxx) maxx = x;}
00498 inline void SetMinMax (INT32 x, INT32& minx, INT32& maxx) { if (x < minx) minx = x; if (x > maxx) maxx = x;}
00499 inline void SetMinMax (UINT32 x, UINT32& minx, UINT32& maxx) { if (x < minx) minx = x; if (x > maxx) maxx = x;}
00500
00501
00502 inline INT64 INT32ToINT64 (INT32 high, INT32 low) {INT64 retval = high; return ((retval << 32) + low);};
00503 inline UINT64 UINT32ToUINT64 (UINT32 high, UINT32 low) {UINT64 retval = high; return ((retval << 32) + low);};
00504 #if defined(WIN32)
00505 inline void INT64ToINT32 (INT64 value, INT32& high, INT32& low) {low = static_cast<INT32>(value & 0x00000000FFFFFFFF); high = static_cast<INT32>(value >> 32); return;};
00506 inline void UINT64ToUINT32 (UINT64 value, UINT32& high, UINT32& low) {low = static_cast<UINT32>(value & 0x00000000FFFFFFFF); high = static_cast<UINT32>(value >> 32); return;};
00507 #else
00508 inline void INT64ToINT32 (INT64 value, INT32& high, INT32& low) {low = static_cast<INT32>(value & 0x00000000FFFFFFFFLL); high = static_cast<INT32>(value >> 32); return;};
00509 inline void UINT64ToUINT32 (UINT64 value, UINT32& high, UINT32& low) {low = static_cast<UINT32>(value & 0x00000000FFFFFFFFULL); high = static_cast<UINT32>(value >> 32); return;};
00510 #endif
00511
00512 #ifndef GENERATING_DOXYGEN_OUTPUT
00513
00514
00515 #define DEFINE_ENUM_OP_BITWISE(_CT) \
00516 inline _CT operator| (const _CT& lhs, const _CT& rhs) \
00517 { return (static_cast<_CT>(static_cast<const INT32>(lhs) | static_cast<const INT32>(rhs))); } \
00518 inline _CT& operator|= (_CT& lhs, const _CT& rhs) \
00519 { lhs = (static_cast<_CT>(static_cast<INT32>(lhs) | static_cast<const INT32>(rhs))); return (lhs); } \
00520 inline _CT& operator+= (_CT& lhs, const _CT& rhs) \
00521 { lhs = (static_cast<_CT>(static_cast<INT32>(lhs) | static_cast<const INT32>(rhs))); return (lhs); } \
00522 inline _CT operator& (const _CT& lhs, const _CT& rhs) \
00523 { return (static_cast<_CT>(static_cast<const INT32>(lhs) & static_cast<const INT32>(rhs))); } \
00524 inline _CT& operator&= (_CT& lhs, const _CT& rhs) \
00525 { lhs = (static_cast<_CT>(static_cast<INT32>(lhs) & static_cast<const INT32>(rhs))); return (lhs); } \
00526 inline _CT operator- (const _CT& lhs, const _CT& rhs) \
00527 { return (static_cast<_CT>(static_cast<const INT32>(lhs) & static_cast<const INT32>(~rhs))); } \
00528 inline _CT& operator-= (_CT& lhs, const _CT& rhs) \
00529 { lhs = (static_cast<_CT>(static_cast<INT32>(lhs) & static_cast<const INT32>(~rhs))); return (lhs); }
00530 #define DEFINE_ENUM_OPERATORS DEFINE_ENUM_OP_BITWISE
00531
00532
00533 #define DEFINE_ENUM_OP_INCREMENT(_CT) \
00534 inline _CT& operator++ (_CT& lhs) { lhs = static_cast<_CT>(lhs+1); return (lhs); }
00535
00536 #endif // GENERATING_DOXYGEN_OUTPUT
00537
00538 #else // not C++
00539
00540 #define CHECKSIZE(s)
00541 #define bool int
00542
00543 #endif // C++
00544
00545 #if defined(USE_AMEMCPY) && defined(WIN32)
00546
00547
00548
00549
00550
00551
00552 #include <memory.h>
00553 #include <mi32/cpuext.h>
00554 #define memcpy amemcpy
00555 #endif
00556
00557
00558
00559
00560 #if defined(__cplusplus)
00561 #ifndef GENERATING_DOXYGEN_OUTPUT
00562
00563
00564 #ifdef memcpy
00565
00566 #define PREVENT_MEMFUNC(type) \
00567 void memcmp(type *, const type *, int); \
00568 extern void* (*amemcpy)(type *, const type *, int); \
00569 void memset(type *, int, int);
00570 #else
00571 #define PREVENT_MEMFUNC(type) \
00572 void memcmp(type *, const type *, int); \
00573 void memcpy(type *, const type *, int); \
00574 void memset(type *, int, int);
00575 #endif
00576
00577
00578 #define PREVENT_MEMCMP(type) \
00579 void memcmp(type *, const type *, int);
00580
00581 #endif // GENERATING_DOXYGEN_OUTPUT
00582 #endif // __cplusplus
00583
00584
00585
00586 #endif // #ifndef INC_MI32_STDDEFNS_H