stddefns.h

Go to the documentation of this file.
00001 /**
00002 *  mi32/stddefns.h - Standard definitions for MicroImages SDK
00003 *
00004 *  \if NODOC
00005 *  Do not add new types/functions/macros/constants to this file without
00006 *  first discussing the proposed change with the programming team.
00007 *  This file should not reference any other header file.
00008 *
00009 *  $Log: stddefns.h_v $
00010 *  Revision 1.321  2005/09/29 21:02:42  mju
00011 *  Add textid/helpid enums.
00012 *
00013 *  Revision 1.320  2005/06/14 14:57:07  dwilliss
00014 *  changed a compiler warning (4508) into an error
00015 *
00016 *  Revision 1.319  2005/04/18 17:11:03  mju
00017 *  No need for nt_intel check.
00018 *
00019 *  Revision 1.318  2005/03/31 16:57:21  fileserver!dwilliss
00020 *  Rename one of our types to MIUNICODE because it conflicted with a Microsoft #define
00021 *
00022 *  Revision 1.317  2005/03/15 21:39:21  mju
00023 *  Include errcodes.h as was previously included by mapproj.
00024 *
00025 *  Revision 1.316  2004/11/24 17:23:00  vdronov
00026 *  changed WIN_32 to WIN32
00027 *
00028 *  Revision 1.315  2004/11/19 20:57:25  dwilliss
00029 *  Added ALIGN8 and ALIGN16 macros
00030 *
00031 *  Revision 1.314  2004/11/15 14:44:37  mju
00032 *  Add fast_truncate.
00033 *  Add documentation regarding accuracy of fast_... functions.
00034 *
00035 *  Revision 1.313  2004/11/11 22:18:49  mju
00036 *  Add FAST_CEIL and FAST_FLOOR inlines.
00037 *  Rename ROUND as FAST_ROUND with #define for legacy usages.
00038 *  Tweak round inline to avoid extra fld/fstp instructions.
00039 *
00040 *  Revision 1.312  2004/07/15 13:56:13  dwilliss
00041 *  Define ERRVALUE even if not C++
00042 *
00043 *  Revision 1.311  2004/06/22 20:54:03  mju
00044 *  Move mdlgShowErrorCode here so available for MFC without including mdlg hdr.
00045 *
00046 *  Revision 1.310  2004/06/17 19:37:36  mju
00047 *  Make compiler warning 4258 an error.
00048 *
00049 *  Revision 1.309  2004/05/10 17:09:30  mju
00050 *  Move MGD::PIXEL typedef here.
00051 *
00052 *  Revision 1.308  2004/05/07 16:35:26  mju
00053 *  Add enum operator ^ for toggle of flag bits.
00054 *
00055 *  Revision 1.307  2004/03/11 22:09:52  scowan
00056 *  4702 downgraded to a warning.
00057 *
00058 *  Revision 1.306  2004/03/11 20:29:30  scowan
00059 *  Make 4702 an error for release builds.
00060 *
00061 *  Revision 1.305  2004/03/11 18:48:06  scowan
00062 *  Added more warnings and made one warnings an error.
00063 *
00064 *  Revision 1.304  2004/03/05 18:41:34  mju
00065 *  Comment out warning re static object init not thread-safe.
00066 *
00067 *  Revision 1.303  2004/03/04 20:34:17  scowan
00068 *  Comment const expr warning./
00069 *
00070 *  Revision 1.302  2004/03/04 20:31:53  scowan
00071 *  Added new warning.
00072 *
00073 *  Revision 1.301  2004/03/04 18:50:04  scowan
00074 *  Comment out another warning.
00075 *
00076 *  Revision 1.300  2004/03/04 18:41:10  scowan
00077 *  Comment out two warnings as are redundant.
00078 *
00079 *  Revision 1.299  2004/03/04 17:59:22  scowan
00080 *  Added more warnings and errors.
00081 *
00082 *  Revision 1.298  2004/02/19 17:00:53  mju
00083 *  Don't define use_mgui if defined already.
00084 *
00085 *  Revision 1.297  2004/02/19 15:49:23  mju
00086 *  Define use_mgui for x_native and win32_mfc.
00087 *
00088 *  Revision 1.296  2004/02/16 18:01:26  mju
00089 *  Add DEPRECATED macro so will generate compiler warnings when use deprecated items.
00090 *
00091 *  Revision 1.295  2004/02/16 16:10:11  mju
00092 *  Remove some legacy namespace stuff.
00093 *
00094 *  Revision 1.294  2003/12/26 17:08:21  scowan
00095 *  Promote new warning to an error.
00096 *
00097 *  Revision 1.293  2003/12/24 20:13:05  scowan
00098 *  Added more vc7 fixes.
00099 *
00100 *  Revision 1.292  2003/12/24 18:43:17  scowan
00101 *  Adjusted for vc7.
00102 *
00103 *  Revision 1.291  2003/12/15 21:18:49  mju
00104 *  If deprecate_all then undef other deprecation constants before redefining.
00105 *
00106 *  Revision 1.290  2003/10/28 18:20:12  mju
00107 *  Turn off 4761 error until determine true meaning.
00108 *
00109 *  Revision 1.289  2003/10/24 13:42:58  mju
00110 *  If DEPRECATE_ALL defined then define other deprecation items.
00111 *
00112 *  Revision 1.288  2003/10/22 20:17:05  mju
00113 *  Make 4761 an error.
00114 *
00115 *  Revision 1.287  2003/10/20 16:41:17  mju
00116 *  Make 4551 an error.
00117 *
00118 *  Revision 1.286  2003/10/17 16:00:45  mju
00119 *  Remove obsolete platform references (alpha, msdos).
00120 *
00121 *  Revision 1.285  2003/10/03 20:13:35  linux32build!build
00122 *  Doxygen
00123 *
00124 *  Revision 1.284  2003/09/25 21:29:07  dwilliss
00125 *  Don't capitalize enum any more. Genitor needed it, doxygen doesn't like it.
00126 *
00127 *  Revision 1.283  2003/09/23 20:07:51  dwilliss
00128 *  undefine some constants before we define them.  Some system include was
00129 *  defining them on the Sun
00130 *
00131 *  Revision 1.282  2003/09/15 13:49:56  fileserver!dwilliss
00132 *  Doxygen
00133 *  \endif
00134 **/
00135 
00136 #ifndef INC_MI32_STDDEFNS_H
00137 #define INC_MI32_STDDEFNS_H
00138 
00139 #if !defined(USE_MGUI) && (defined(X_NATIVE) || defined(WIN32_MFC))
00140 #define  USE_MGUI
00141 #endif
00142 
00143 #ifdef DEPRECATE_ALL
00144 #undef   NO_DEPRECATED
00145 #define  NO_DEPRECATED
00146 #undef   DEPRECATE_GROUPKEY
00147 #define  DEPRECATE_GROUPKEY
00148 #undef   DEPRECATE_OLDHELP
00149 #define  DEPRECATE_OLDHELP
00150 #endif
00151 
00152 // Undefine index macro defined on some Unix platforms
00153 #ifdef index
00154 #undef index
00155 #endif
00156 
00157 #ifndef NO_DEPRECATED
00158 // Define ENUM macro to help Starbase Surveyor to document enumerations.
00159 // \deprecated Doxygen doesn't like this and we don't use Surveyor any more.
00160 #define  ENUM enum
00161 #ifdef WIN32
00162 #pragma deprecated("ENUM")
00163 #endif
00164 #endif
00165 
00166 // Fix certain conflicting Windows macros if used.
00167 #if defined(WIN32)
00168 #include <mi32/winfixup.h>
00169 #endif
00170 
00171 #ifndef INC_MI32_DLLDEFNS_H
00172 #include <mi32/dlldefns.h>
00173 #endif
00174 
00175 #ifndef  INC_MI32_ERRCODES_H
00176 #include <mi32/errcodes.h>
00177 #endif
00178 
00179 /*----------------------------------------------------------------------------*/
00180 /*    Define platform definition for compatiblity with existing code          */
00181 /*----------------------------------------------------------------------------*/
00182 
00183 #if defined(WIN32) && !defined(WINNT)
00184    #define  WINNT
00185 #endif
00186 
00187 /*----------------------------------------------------------------------------*/
00188 /*    Platform-specific byte-order definitions                                */
00189 /*----------------------------------------------------------------------------*/
00190 
00191 #if !defined(BYTEORDER_HiLo) && !defined(BYTEORDER_LoHi)
00192    #if defined(i386) || defined(LINUX_INTEL) || defined(WIN32)
00193       #define  BYTEORDER_LoHi
00194    #else
00195       #define  BYTEORDER_HiLo
00196    #endif
00197 #endif
00198 
00199 #if !defined(BYTEORDER_Intel) && defined(BYTEORDER_LoHi)
00200    #define BYTEORDER_Intel
00201 #endif
00202 
00203 /*----------------------------------------------------------------------------*/
00204 /*    Force compile errors for specific warnings                              */
00205 /*----------------------------------------------------------------------------*/
00206 
00207 #if defined(WIN32)
00208    #define DEPRECATED __declspec(deprecated)
00209    // Microsoft visual C/C++ only
00210    #pragma warning (error:4002)  // too many actual parameters for macro
00211    #pragma warning (error:4003)  // not enough actual parameters for macro
00212    #pragma warning (error:4005)  // Macro defined twice
00213    #pragma warning (error:4013)  // Undefined function (missing prototype)
00214    #pragma warning (error:4028)  // Formal parameter different from declaration
00215    #pragma warning (error:4033)  // Function must return a value
00216    #pragma warning (error:4047)  // Different levels of indirection
00217    #pragma warning (error:4098)  // Void function returning a value
00218    #pragma warning (error:4131)  // Function uses old style declarator
00219    #pragma warning (error:4133)  // Incompatible types - from 'unsigned short *' to 'char *'
00220    #pragma warning (error:4150)  // Deletion of pointer to incomplete type
00221    #pragma warning (error:4152)  // Pointer to function converted to pointer to data
00222    #pragma warning (error:4172)  // Returning address of local or temporary
00223    // Next one commented out due to <xmemory> not compiling with it on
00224 // #pragma warning (error:4217)  // 'operator' : member template functions cannot be used for copy-assignment or copy-construction
00225    #pragma warning (error:4218)  // Function does not have a return type
00226    #pragma warning (error:4258)  // Defintion from for loop is ignored, defintion from enclosing scope is used
00227    #pragma warning (error:4288)  // Loop variable used outside of loop
00228    #pragma warning (error:4305)  // Argument truncation from '...' to '...'
00229    #pragma warning (error:4309)  // Truncation of constant value
00230    #pragma warning (error:4390)  // Empty control statement found, no point for it
00231    #pragma warning (error:4508)  // 'function' : function should return a value; 'void' return type assumed
00232    #pragma warning (error:4545)  // expression before comma evaluates to a function which is missing an argument list
00233    #pragma warning (error:4546)  // function call before comma missing argument list
00234    #pragma warning (error:4547)  // 'operator' : operator before comma has no effect; expected operator with side-effect
00235    #pragma warning (error:4548)  // expression before comma has no effect; expected expression with side-effect
00236    #pragma warning (error:4549)  // 'operator' : operator before comma has no effect; did you intend 'operator'?
00237    #ifdef ALLOW_UNUSED_FUNCTIONS
00238       #pragma warning (3:4505)   // Local function not used
00239    #else
00240       #pragma warning (error:4505) // Local function not used
00241    #endif
00242    #pragma warning (error:4551)  // Function call missing argument list
00243    #pragma warning (error:4552)  // Operator has no effect, expected operator with side effect
00244    #pragma warning (error:4553)  // '==' operator has no effect
00245    #pragma warning (error:4700)  // Local variable used without having been initialized
00246    #pragma warning (error:4715)  // Not all control paths return a value
00247    #pragma warning (error:4717)  // 'method' : recursive on all control paths, function will cause runtime stack overflow.  Not all control paths return a value
00248 // #pragma warning (error:4761)  // Integral size mismatch in argument
00249    #pragma warning (error:4804)  // Unsafe use of type 'bool' in operation
00250    #pragma warning (error:4805)  // Unsafe mix of types for bitwise operation
00251    #pragma warning (error:4806)  // Unsafe operation, no value of type 'bool can equal the given constant
00252    #ifdef WARN_UNREF_PARM
00253       #pragma warning (3:4100)   // Unreferenced formal parameter
00254    #endif
00255 // #pragma warning (3:4127)      // conditional expression is constant
00256    #pragma warning (3:4132)      // 'object' : const object should be initialized
00257    #pragma warning (3:4189)      // Local variable initialized but not referenced
00258    #pragma warning (3:4201)      // Nameless structure / union
00259    #pragma warning (3:4211)      // Redefine extern to static
00260    #pragma warning (3:4212)      // Function declaration uses ellipsis, definition does not
00261    #pragma warning (3:4222)      // 'static' used on member function at file scope
00262    #pragma warning (3:4234)      // Keyword reserved for future use
00263    #pragma warning (3:4235)      // Keyword not supported
00264    #pragma warning (3:4244)      // Conversion results in possible loss of data
00265    #pragma warning (3:4263)      // 'function' : member function does not override any base class virtual member function
00266    #pragma warning (3:4264)      // 'virtual_function' : no override available for virtual member function from base 'class'; function is hidden
00267    #pragma warning (3:4265)      // 'class' : class has virtual functions, but destructor is not virtual
00268    #pragma warning (3:4268)      // 'identifier' : 'const' static/global data initialized with compiler generated default constructor fills the object with zeros
00269    #pragma warning (3:4287)      // 'operator' : unsigned/negative constant mismatch
00270    #pragma warning (3:4295)      // 'array' : array is too small to include a terminating null character
00271    #pragma warning (3:4296)      // 'operator' : expression is always false
00272    #pragma warning (3:4408)      // anonymous union did not declare any data members
00273    #pragma warning (3:4510)      // 'class' : default constructor could not be generated
00274    #pragma warning (3:4515)      // 'namespace' : namespace uses itself
00275    #pragma warning (3:4527)      // instances of type 'class' can never be destroyed - user-defined destructor required
00276    #pragma warning (3:4555)      // expression has no effect; expected expression with side-effect
00277    #pragma warning (3:4610)      // object 'class' can never be instantiated - user-defined constructor required
00278    // Next three commented out due to redundancy with error of actually using a ctor(), copy ctor() or op=()
00279 // #pragma warning (3:4623)      // 'derived class' : default constructor could not be generated because a base class default constructor is inaccessible
00280 // #pragma warning (3:4625)      // 'derived class' : copy constructor could not be generated because a base class copy constructor is inaccessible
00281 // #pragma warning (3:4626)      // 'derived class' : assignment operator could not be generated because a base class assignment operator is inaccessible
00282 // #pragma warning (3:4640)      // 'instance' : construction of local static object is not thread-safe
00283    #pragma warning (3:4701)      // Local variable not initialized
00284    #pragma warning (3:4702)      // Unreachable code
00285    #pragma warning (3:4705)      // Statement has no effect
00286    #pragma warning (3:4706)      // Assignment within conditional expression
00287    #pragma warning (3:4709)      // Comma operator within array brackets
00288    #pragma warning (3:4928)      // illegal copy-initialization; more than one user-defined conversion has been implicitly applied
00289    #pragma warning (3:4946)      // reinterpret_cast used between related classes: 'class1' and 'class2'
00290    #ifdef WARN_NOT_INLINED
00291       #pragma warning (3:4710)      // Function not inlined
00292    #endif
00293    #pragma warning (disable:4284)   // Warning about operator-> with infix notation
00294    #pragma warning (disable:4355)   // 'this' used in base member initializaton list
00295    #pragma warning (disable:4786)   // Browser identifier limit of 255 characters was exceeded, oh well...
00296 #else
00297    #define DEPRECATED
00298 #endif
00299 
00300 /*----------------------------------------------------------------------------*/
00301 /*    Namespace handling macros                                               */
00302 /*----------------------------------------------------------------------------*/
00303 
00304 #if defined(__cplusplus)
00305    #if defined(WIN32)
00306       #define  ALLOW_NAMESPACES
00307       namespace std {}
00308    #endif
00309 #endif
00310 
00311 /*----------------------------------------------------------------------------*/
00312 /*    Platform-independent numeric types                                      */
00313 /*----------------------------------------------------------------------------*/
00314 
00315 typedef signed char              INT8;    // X11/Xmd.h defines it this way too
00316 typedef unsigned char            UINT8;
00317 typedef short                    INT16;
00318 typedef unsigned short           UINT16;
00319 #if defined(WIN32) && defined(_MSC_VER) && (_MSC_VER >= 1200)
00320    // Using Microsoft Visual C/C++ 6.0 or higher
00321    #include <basetsd.h>
00322    #define  INT32_is_int   //!< Indicates that INT32 is same type as "int"
00323    typedef int                   PTRINT;
00324    typedef unsigned int          PTRUINT;
00325 #elif defined(LONGS_ARE_64_BIT)
00326    // Note, longs may be 32 or 64 bit on SGI, so we define LONGS_ARE_64_BIT
00327    // if using the 64-bit compiler.
00328    typedef int                   INT32;
00329    typedef unsigned int          UINT32;
00330    typedef long                  INT64;
00331    typedef unsigned long         UINT64;
00332    #define  INT32_is_int   //!< Indicates that INT32 is same type as "int"
00333    typedef long                  PTRINT;
00334    typedef unsigned long         PTRUINT;
00335 #else
00336    typedef long                  INT32;   //!< Some X headers define it this way so must match
00337    typedef unsigned long         UINT32;
00338    typedef long long             INT64;
00339    typedef unsigned long long    UINT64;
00340    typedef long                  PTRINT;
00341    typedef unsigned long         PTRUINT;
00342 #endif
00343 
00344 typedef unsigned int          COLOR32;
00345 
00346 #if defined(__cplusplus)
00347 
00348 const INT8 INT8_MAX = 127;
00349 const INT8 INT8_MIN = -INT8_MAX-1;
00350 const UINT8 UINT8_MAX = 255;
00351 const UINT8 UINT8_MIN = 0;
00352 
00353 const INT16 INT16_MAX = 32767;
00354 const INT16 INT16_MIN = -INT16_MAX-1;
00355 const UINT16 UINT16_MAX = 65535;
00356 const UINT16 UINT16_MIN = 0;
00357 
00358 const INT32 INT32_MAX = 2147483647;
00359 const INT32 INT32_MIN = -INT32_MAX-1;
00360 const UINT32 UINT32_MAX = 4294967295UL;
00361 const UINT32 UINT32_MIN = 0;
00362 
00363 // There's a system include file on Sun that #define these for us.
00364 #undef INT64_MIN
00365 #undef INT64_MAX
00366 #undef UINT64_MIN
00367 #undef UINT64_MAX
00368 
00369 #if defined(WIN32)
00370 //! Maximum value of a 64-bit signed integer
00371 const INT64 INT64_MAX = 0x7FFFFFFFFFFFFFFF;
00372 //! Maximum value of a 64-bit signed unsigned integer
00373 const UINT64 UINT64_MAX = 0xFFFFFFFFFFFFFFFF;
00374 #else
00375 // G++ complains unless we specify LL or ULL
00376 //! Maximum value of a 64-bit signed integer
00377 const INT64 INT64_MAX = 0x7FFFFFFFFFFFFFFFLL;
00378 //! Maximum value of a 64-bit signed unsigned integer
00379 const UINT64 UINT64_MAX = 0xFFFFFFFFFFFFFFFFULL;
00380 #endif
00381 
00382 //! Minimum value of a 64-bit signed integer
00383 const INT64 INT64_MIN = -INT64_MAX-1;
00384 //! Minimum value of a 64-bit signed unsigned integer
00385 const UINT64 UINT64_MIN = 0;
00386 
00387 //! Create two INT32's to INT64 constants
00388 const UINT64 INT64_MULT = static_cast<UINT64>(UINT32_MAX) + 1;
00389 
00390 namespace MGUI {
00391    // Define generic ID for MGUI which is same size as pointer.
00392    typedef PTRINT ID;
00393    }
00394 
00395 namespace MGD {
00396    //! Pixel value on drawing device.
00397    typedef unsigned long PIXEL;
00398    }
00399 
00400 #else // Not C++
00401 
00402 #define INT8_MAX           127
00403 #define INT8_MIN           (-INT8_MAX-1)
00404 #define UINT8_MAX          255
00405 #define UINT8_MIN          0
00406 
00407 #define INT16_MAX          32767
00408 #define INT16_MIN          (-INT16_MAX-1)
00409 #define UINT16_MAX         65535
00410 #define UINT16_MIN         0
00411 
00412 #define INT32_MAX          2147483647
00413 #define INT32_MIN          (-INT32_MAX-1)
00414 #define UINT32_MAX         4294967295
00415 #define UINT32_MIN         0
00416 
00417 #define INT64_MAX          0x7FFFFFFFFFFFFFFF
00418 #define INT64_MIN          (-INT64_MAX-1)
00419 #define UINT64_MAX         0xFFFFFFFFFFFFFFFF
00420 #define UINT64_MIN         0
00421 
00422 #endif
00423 
00424 #ifdef WIN32
00425 #define ALIGN8(_x) __declspec(align(8)) _x
00426 #define ALIGN16(_x) __declspec(align(16)) _x
00427 #else
00428 #define ALIGN8(_x) _x __attribute((aligned(8)))
00429 #define ALIGN16(_x) _x __attribute((aligned(16)))
00430 #endif
00431 
00432 
00433 
00434 typedef float FLOAT;
00435 typedef double DOUBLE;
00436 typedef unsigned short MIUNICODE;
00437 
00438 /*----------------------------------------------------------------------------*/
00439 /*    Declarations (without definitions) for common classes and structures    */
00440 /*----------------------------------------------------------------------------*/
00441 
00442 #if defined(__cplusplus)
00443 
00444 struct WPOINT2D;                 //!< point.h
00445 struct LPOINT2D;                 //!< point.h
00446 struct FPOINT2D;                 //!< point.h
00447 struct DPOINT2D;                 //!< point.h
00448 struct WPOINT3D;                 //!< point.h
00449 struct LPOINT3D;                 //!< point.h
00450 struct FPOINT3D;                 //!< point.h
00451 struct DPOINT3D;                 //!< point.h
00452 struct FPOINT3DH;                //!< point.h
00453 struct DPOINT3DH;                //!< point.h
00454 
00455 
00456 struct WRECT2D;                  //!< rect.h
00457 struct LRECT2D;                  //!< rect.h
00458 struct DRECT2D;                  //!< rect.h
00459 struct DRECT3D;                  //!< rect.h
00460 
00461 typedef WRECT2D WRECTXY;
00462 typedef LRECT2D LRECTXY;
00463 
00464 struct MAPPROJPARM;              //!< mapproj.h
00465 struct RVCGENINFO;               //!< rvcdefns.h
00466 struct FNAMEINODEUC;             //!< rvcdefns.h
00467 
00468 #endif   // C++
00469 
00470 
00471 /*----------------------------------------------------------------------------*/
00472 /*    Coordinate data type definitions                                        */
00473 /*----------------------------------------------------------------------------*/
00474 
00475 #if defined(__cplusplus)
00476 
00477 struct WPOLYGON { INT32 numpts; WPOINT2D *point; };
00478 struct LPOLYGON { INT32 numpts; LPOINT2D *point; };
00479 struct DPOLYGON { INT32 numpts; DPOINT2D *point; };
00480 
00481 typedef WPOLYGON WPOLYLINE;
00482 typedef LPOLYGON LPOLYLINE;
00483 typedef DPOLYGON DPOLYLINE;
00484 
00485 struct DPOLYLINE3D { INT32 numpts; DPOINT3D *point; };
00486 
00487 struct LSEGMENT2D { INT32 x1, y1, x2, y2; };
00488 
00489 #endif   // C++
00490 
00491 /*----------------------------------------------------------------------------*/
00492 /*    Miscellaneous types                                                     */
00493 /*----------------------------------------------------------------------------*/
00494 
00495 //! Text resource identifier.
00496 enum TEXTID {
00497    TEXTID__None = 0
00498    };
00499 
00500 //! Help text resource identifier.
00501 enum HELPID {
00502    HELPID__None = 0
00503    };
00504 
00505 typedef int ERRVALUE;               //!< Return type value, signifies < 0 is an error
00506 
00507 // NOTE: ERRVALUE must be defined even if not C++.  The freetype13 library,
00508 // when compiled for Mac OS X, has a module we wrote to read resource forks
00509 // This module includes miodefns.h, which uses ERRVALUE.  Freetype13 is not
00510 // a C++ library.  So to whoever put it in the cplusplus only section below...
00511 //   PTHATHATHATHATH!
00512 
00513 #if defined(__cplusplus)
00514 
00515 struct DRANGE { double min, max; };
00516 
00517 typedef UINT32 ICID;          //!< Interface component ID
00518 
00519 typedef INT32 RVCINODENUM;          //!< Type for RVC Object Inode parameter
00520 typedef int (*MfFiltFuncProto) (int, RVCINODENUM, RVCGENINFO*, void*, char*);
00521 typedef int (*MfValidMultiProto) (int, FNAMEINODEUC*, void*, int*, char*);
00522 
00523 typedef struct _WidgetRec *Widget;
00524 
00525 #ifdef WIN32_NATIVE
00526    #if defined(__cplusplus)
00527       class CWnd;
00528       typedef CWnd* MDLGPARENT;
00529    #endif
00530 #else
00531    #ifndef X_NATIVE
00532       #define  X_NATIVE
00533    #endif
00534    typedef Widget MDLGPARENT;
00535    #ifdef WIN32
00536       typedef unsigned long COLORREF;
00537    #else
00538       typedef UINT32 COLORREF;
00539    #endif
00540 #endif
00541 
00542 typedef DOUBLE Mat3x3[3][3];
00543 typedef DOUBLE MAT3X3[3][3];
00544 typedef DOUBLE MAT4X4[4][4];
00545 
00546 typedef void *INIHANDLE;            //!< Ini access handle
00547 typedef void *MXDHANDLE;            //!< Generic dialog handle
00548 typedef unsigned long MPIXEL;       //!< Generic "pixel" value
00549 
00550 
00551 /*----------------------------------------------------------------------------*/
00552 /*    Miscellaneous constants                                                 */
00553 /*----------------------------------------------------------------------------*/
00554 
00555 #ifdef FALSE
00556 #undef FALSE
00557 #endif
00558 #define FALSE  0
00559 #ifdef TRUE
00560 #undef TRUE
00561 #endif
00562 #define TRUE   1
00563 
00564 #ifndef NULL
00565 #define NULL 0
00566 #endif
00567 
00568 #ifdef PI            // LINUX defined this
00569 #undef PI
00570 #endif
00571 #define  PI          (3.14159265358979323846)
00572 #define  RADTODEG    (180.0/PI)
00573 #define  DEGTORAD    (PI/180.0)
00574 #define  RADTODEG64  (64.0*180.0/PI)
00575 #define  DEG64TORAD  (PI/(64.0*180.0))
00576 
00577 #define  FEETTOMETERS   (0.3048)
00578 #define  METERSTOFEET   (3.280839895)
00579 #define  METERSTOINCHES (3.280839895*12.0)
00580 
00581 #if defined(WIN32) && !defined(WIN32_NATIVE)
00582    #ifndef  NeedFunctionPrototypes
00583       #define  NeedFunctionPrototypes  1
00584    #endif
00585    #ifndef  XTSTRINGDEFINES
00586       #define  XTSTRINGDEFINES
00587    #endif
00588    #ifndef  XMSTRINGDEFINES
00589       #define  XMSTRINGDEFINES
00590    #endif
00591    #ifndef  XmHTML_STRINGDEFINES
00592       #define  XmHTML_STRINGDEFINES
00593    #endif
00594 #endif
00595 
00596 /*----------------------------------------------------------------------------*/
00597 /*    Miscellaneous macros                                                    */
00598 /*----------------------------------------------------------------------------*/
00599 
00600 #ifdef MIN
00601 #undef MIN
00602 #endif
00603 #ifdef MAX
00604 #undef MAX
00605 #endif
00606 
00607 #ifndef membersize
00608    #define  membersize(type,name)   sizeof(((type*)0)->name)
00609 #endif
00610 
00611 #define  ARRAYSIZE(a)   (sizeof(a)/sizeof(a[0]))
00612 #define  MIN(i1,i2)     (((i1)<(i2))?(i1):(i2))
00613 #define  MAX(i1,i2)     (((i1)>(i2))?(i1):(i2))
00614 #define  SIGN(d)        (((d)<0) ? -1 : ((d)>0) ? 1 : 0)
00615 #define  SWAP(a,b)      { a-=b; b+=a; a=b-a; }
00616 #define  bound(val,min,max)   (((val)<(min))?(min):(((val)>(max))?(max):(val)))
00617 
00618 #if defined(WIN32) && defined(__cplusplus)
00619 
00620 // On Intel, avoid the _ftol() call implied by the cast to integer.
00621 // ftol() is slow because of the way it casts.  It first has to switch
00622 // the conversion mode of the processor from round to truncate, which
00623 // cuases all pipelines to stall.  Then it converts the number and switches
00624 // back to rounding mode.  That's a lot of work to truncate a number when
00625 // the default would have been to do What We Wanted (W3)
00626 // Accounts for Intel rounding .5 values to nearest -even- integer, corrects for up to +/- 1000000
00627 
00628 //! Fast round of value to nearest integer, with X.5 values rounded up.
00629 //! This function is approximately 3X faster than using static_cast<INT32>(x+.5) on Intel.
00630 //! Accuracy limitations:
00631 //! Values in the range from -1000000 to +1000000 at exactly .5 will be handled correctly.
00632 //! Values outside that range may not always be rounded up.  In addition, values in the
00633 //! range of -1000 to 1000 which are within 1E-10 of .5 may not be correctly rounded down.
00634 //! The FAST_... functions should not be used if exact accuracy is required.
00635 inline INT32 FAST_ROUND (double x) {
00636    static const double d = 1E-10;
00637    INT32 result;
00638    __asm fld x
00639    __asm fadd d
00640    __asm fistp result
00641    return result;
00642    }
00643 
00644 //! Fast return of smallest integer greater than or equal to specified value.
00645 //! This function is at least 5X faster than using static_cast<INT32>(ceil(x)) on Intel.
00646 //! Accuracy limitations:
00647 //! Values in the range from -1000000 to +1000000 at exactly .0 will be handled correctly.
00648 //! Values outside that range may not always be correct.  In addition, values in the
00649 //! range of -1000 to 1000 which are within 1E-10 of .0 may not be correctly rounded.
00650 //! The FAST_... functions should not be used if exact accuracy is required.
00651 inline INT32 FAST_CEIL (double x) {
00652    static const double d = .4999999999;
00653    INT32 result;
00654    __asm fld x
00655    __asm fadd d
00656    __asm fistp result
00657    return result;
00658    }
00659 
00660 //! Fast return of largest integer less than or equal to specified value.
00661 //! This function is at least 5X faster than using static_cast<INT32>(floor(x)) on Intel.
00662 //! Accuracy limitations:
00663 //! Values in the range from -1000000 to +1000000 at exactly .0 will be handled correctly.
00664 //! Values outside that range may not always be correct.  In addition, values in the
00665 //! range of -1000 to 1000 which are within 1E-10 of .0 may not be correctly rounded.
00666 //! The FAST_... functions should not be used if exact accuracy is required.
00667 inline INT32 FAST_FLOOR (double x) {
00668    static const double d = -.4999999999;
00669    INT32 result;
00670    __asm fld x
00671    __asm fadd d
00672    __asm fistp result
00673    return result;
00674    }
00675 
00676 //! Fast return of largest integer less than or equal to specified value.
00677 //! This function is at approximately 3X faster than using static_cast<INT32>(x) on Intel.
00678 //! If values are known to always be positive (or negative) it will be faster to
00679 //! use the FAST_FLOOR (or FAST_CEIL) function as appropriate.
00680 //! Accuracy limitations:
00681 //! Values in the range from -1000000 to +1000000 at exactly .0 will be handled correctly.
00682 //! Values outside that range may not always be correct.  In addition, values in the
00683 //! range of -1000 to 1000 which are within 1E-10 of .0 may not be correctly rounded.
00684 //! The FAST_... functions should not be used if exact accuracy is required.
00685 inline INT32 FAST_TRUNCATE (double x) {
00686    static const double d = .4999999999;
00687    INT32 result;
00688    if (x < 0) {
00689       __asm fld x
00690       __asm fadd d
00691       __asm fistp result
00692       }
00693    else {
00694       __asm fld x
00695       __asm fsub d
00696       __asm fistp result
00697       }
00698    return result;
00699    }
00700 
00701 
00702 #else
00703 
00704 #define  FAST_ROUND(d)     static_cast<INT32>(floor((d)+.5))
00705 #define  FAST_CEIL(d)      static_cast<INT32>(ceil(d))
00706 #define  FAST_FLOOR(d)     static_cast<INT32>(floor(d))
00707 #define  FAST_TRUNCATE(d)  static_cast<INT32>(d)
00708 
00709 #endif
00710 
00711 #define  ROUND FAST_ROUND
00712 
00713 #if defined(__cplusplus)
00714 
00715 //! Compile-time validate size of structure or class
00716 #define  CHECKSIZE(s) \
00717    inline int _checksize () { return (1 / ((sizeof(*this) == (s)) ? 1 : 0)); }
00718 
00719 //! Compile-time validate that public global has a matching prototype.
00720 #if defined(WIN32) && !defined(VC7)    // VC 7 causes ERRVALUE GLOBALFUNC GetLastErrCode() to be interpreted as ERRVALUE::GetLastErrCode()
00721 #define  GLOBALFUNC  ::
00722 #else
00723 #define  GLOBALFUNC        
00724 #endif
00725 
00726 //! Set or clear 'bit' in value based on 'bool'.
00727 //! The type may be an enum if DEFINE_ENUM_OP_BITWISE used on enum.
00728 template <class _CT> inline void SetBitFromBool (
00729    _CT& value,       //!< Value to modify
00730    unsigned bit,     //!< Bit(s) to set or clear.
00731    bool set          //!< 'true' to set, 'false' to clear
00732    ) { if (set) value |= static_cast<_CT>(bit); else value &= static_cast<_CT>(~bit); }
00733 
00734 inline void SetMinMax (double x, double& minx, double& maxx) { if (x < minx) minx = x;  if (x > maxx) maxx = x;}
00735 inline void SetMinMax (INT32 x, INT32& minx, INT32& maxx) { if (x < minx) minx = x;  if (x > maxx) maxx = x;}
00736 inline void SetMinMax (UINT32 x, UINT32& minx, UINT32& maxx) { if (x < minx) minx = x;  if (x > maxx) maxx = x;}
00737 
00738 //! Functions to convert two INT32's to an INT64
00739 inline INT64 INT32ToINT64 (INT32 high, INT32 low) {INT64 retval = high; return ((retval << 32) + low);};
00740 inline UINT64 UINT32ToUINT64 (UINT32 high, UINT32 low) {UINT64 retval = high; return ((retval << 32) + low);};
00741 #if defined(WIN32)
00742 inline void INT64ToINT32 (INT64 value, INT32& high, INT32& low) {low = static_cast<INT32>(value & 0x00000000FFFFFFFF); high = static_cast<INT32>(value >> 32); return;};
00743 inline void UINT64ToUINT32 (UINT64 value, UINT32& high, UINT32& low) {low = static_cast<UINT32>(value & 0x00000000FFFFFFFF); high = static_cast<UINT32>(value >> 32); return;};
00744 #else
00745 inline void INT64ToINT32 (INT64 value, INT32& high, INT32& low) {low = static_cast<INT32>(value & 0x00000000FFFFFFFFLL); high = static_cast<INT32>(value >> 32); return;};
00746 inline void UINT64ToUINT32 (UINT64 value, UINT32& high, UINT32& low) {low = static_cast<UINT32>(value & 0x00000000FFFFFFFFULL); high = static_cast<UINT32>(value >> 32); return;};
00747 #endif
00748 
00749 #ifndef GENERATING_DOXYGEN_OUTPUT
00750 
00751 //! Define bitwise &, |, +, -, ^ operators for enumerations (for use as flags).
00752 #define  DEFINE_ENUM_OP_BITWISE(_CT) \
00753    inline _CT operator| (const _CT& lhs, const _CT& rhs) \
00754       { return (static_cast<_CT>(static_cast<const INT32>(lhs) | static_cast<const INT32>(rhs))); } \
00755    inline _CT& operator|= (_CT& lhs, const _CT& rhs) \
00756       { lhs = (static_cast<_CT>(static_cast<INT32>(lhs) | static_cast<const INT32>(rhs))); return (lhs); } \
00757    inline _CT& operator+= (_CT& lhs, const _CT& rhs) \
00758       { lhs = (static_cast<_CT>(static_cast<INT32>(lhs) | static_cast<const INT32>(rhs))); return (lhs); } \
00759    inline _CT operator& (const _CT& lhs, const _CT& rhs) \
00760       { return (static_cast<_CT>(static_cast<const INT32>(lhs) & static_cast<const INT32>(rhs))); } \
00761    inline _CT& operator&= (_CT& lhs, const _CT& rhs) \
00762       { lhs = (static_cast<_CT>(static_cast<INT32>(lhs) & static_cast<const INT32>(rhs))); return (lhs); } \
00763    inline _CT operator- (const _CT& lhs, const _CT& rhs) \
00764       { return (static_cast<_CT>(static_cast<const INT32>(lhs) & static_cast<const INT32>(~rhs))); } \
00765    inline _CT& operator-= (_CT& lhs, const _CT& rhs) \
00766       { lhs = (static_cast<_CT>(static_cast<INT32>(lhs) & static_cast<const INT32>(~rhs))); return (lhs); } \
00767    inline _CT operator^ (const _CT& lhs, const _CT& rhs) \
00768       { return (static_cast<_CT>(static_cast<const INT32>(lhs) ^ static_cast<const INT32>(rhs))); } \
00769    inline _CT& operator^= (_CT& lhs, const _CT& rhs) \
00770       { lhs = (static_cast<_CT>(static_cast<INT32>(lhs) ^ static_cast<const INT32>(rhs))); return (lhs); }
00771 #define  DEFINE_ENUM_OPERATORS   DEFINE_ENUM_OP_BITWISE
00772 
00773 //! Define increment (++) operator for enumerations.
00774 #define  DEFINE_ENUM_OP_INCREMENT(_CT) \
00775    inline _CT& operator++ (_CT& lhs) { lhs = static_cast<_CT>(lhs+1); return (lhs); }
00776 
00777 #endif // GENERATING_DOXYGEN_OUTPUT
00778 
00779 #else    // not C++
00780 
00781 #define  CHECKSIZE(s)
00782 #define  bool int
00783 
00784 #endif   // C++
00785 
00786 #if defined(USE_AMEMCPY) && defined(WIN32)
00787 //! For testing: If you define USE_AMEMCPY in your makefile, all memcpy
00788 //! calls will be replaced with our accelerated versions (Windows only,
00789 //! other platforms either don't have MMX or I don't know the inline
00790 //! assembler syntax of the compiler),  This may eventually go away
00791 //! in favor of some new method, `cause Mike won't like this.
00792 
00793 #include <memory.h>        //! Make sure we have memcpy prototyped...
00794 #include <mi32/cpuext.h>   //! Define our prototype...
00795 #define memcpy amemcpy     //!< override memcpy with our accelerated version
00796 #endif
00797 
00798 
00799 /*----------------------------------------------------------------------------*/
00800 
00801 #if defined(__cplusplus)
00802 #ifndef GENERATING_DOXYGEN_OUTPUT
00803 
00804 // Macro to prevent use of memset/memcpy/memcmp on pointer to specified type.
00805 #ifdef memcpy
00806 // Assume defined as 'amemcpy' so need definition to match
00807 #define  PREVENT_MEMFUNC(type) \
00808    void memcmp(type *, const type *, int); \
00809    extern void* (*amemcpy)(type *, const type *, int); \
00810    void memset(type *, int, int);
00811 #else
00812 #define  PREVENT_MEMFUNC(type) \
00813    void memcmp(type *, const type *, int); \
00814    void memcpy(type *, const type *, int); \
00815    void memset(type *, int, int);
00816 #endif
00817 
00818 // Macro to prevent use of memcmp on pointer of specified type.
00819 #define  PREVENT_MEMCMP(type) \
00820    void memcmp(type *, const type *, int);
00821 
00822 #endif // GENERATING_DOXYGEN_OUTPUT
00823 #endif   //  __cplusplus 
00824 
00825 /*----------------------------------------------------------------------------*/
00826 
00827 //!\addtogroup mdlg Mdlg functions
00828 //!@{
00829 
00830 //! Display error dialog with text for specified error code.
00831 //! @return error code or EUserCancel.
00832 //! Similar to MdlgShowMessageCode(parent,errcode,MDLG_MESSAGETYPE_Error) except
00833 //! that EUserCancel messages are not displayed.
00834 ERRVALUE MdlgShowErrorCode (
00835    MDLGPARENT parent,                  //!< Parent for dialog, NULL for default
00836    ERRVALUE errcode                    //!< Error code
00837    );
00838 
00839 //!@}
00840 
00841 #endif   // C++
00842 
00843 #endif   // #ifndef INC_MI32_STDDEFNS_H

Generated on Wed May 31 15:27:09 2006 for TNTsdk by  doxygen 1.3.8-20040913