typedefs_defines.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 1996-2006 by Autodesk, Inc.
00003 //
00004 //  By using this code, you are agreeing to the terms and conditions of
00005 //  the License Agreement included in the documentation for this code.
00006 //
00007 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE CORRECTNESS
00008 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00009 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00010 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00011 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00012 //
00013 //  Use, duplication, or disclosure by the U.S. Government is subject to
00014 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00015 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00016 //  Data and Computer Software), as applicable.
00017 //
00018 
00019 #if !defined TYPEDEF_DEFINES_HEADER
00020 #define TYPEDEF_DEFINES_HEADER
00021 
00025 
00026 // basic types & definitions
00027 
00030 typedef char WT_Boolean;
00031 
00034 typedef long WT_Integer32;
00035 
00038 typedef short WT_Integer16;
00039 
00042 typedef unsigned long WT_Unsigned_Integer32;
00043 
00046 typedef unsigned short WT_Unsigned_Integer16;
00047 
00050 typedef unsigned char WT_Byte;
00051 
00054 typedef WT_Integer32 WT_Color_Index;
00055 
00058 
00059 class WD_GUID
00060 {
00061   public:
00062     WD_GUID()
00063       : Data1(0)
00064       , Data2(0)
00065       , Data3(0)
00066     { Data4[0] = Data4[1] = Data4[2] = Data4[3] = Data4[4] = Data4[5] = Data4[6] = Data4[7] = 0; }
00067 
00068   WT_Unsigned_Integer32  Data1; 
00069   WT_Unsigned_Integer16 Data2;  
00070   WT_Unsigned_Integer16 Data3; 
00071   WT_Byte  Data4[8]; 
00072 };
00073 
00076 typedef WD_GUID WD_UUID;
00077 
00078 #define WD_NO_COLOR_INDEX       -1
00079 #define WD_Null                 NULL
00080 #define WD_False                (static_cast<WT_Boolean>(0))
00081 #define WD_True                 (static_cast<WT_Boolean>(-1))
00082 #define WD_stack
00083 #define WD_Opaque               255
00084 #define WD_Clear                0
00085 
00086 #define TWO_PI                  6.283185308
00087 #define WD_90_DEGREES_AS_SHORT  (0x00010000 / 4)
00088 
00089 #define WD_HEAP_LOCK
00090 #define WD_HEAP_UNLOCK
00091 
00092 inline WT_Boolean WD_fits_in_short(long x)
00093 {
00094     return  x <= 32767 && x >= -32768;
00095 }
00096 
00097 // Note: use macro instead of inline since we need to return from the caller, not just the check.
00098 //       macro is considered "safe" for side effects as its argument is only referenced once.
00099 #define WD_CHECK(x) do {                                    \
00100                         WT_Result       result = (x);       \
00101                         if (result != WT_Result::Success)   \
00102                             return result;                  \
00103                     } while (0)                            //
00104 
00105 
00106 inline WT_Boolean WU_is_whitespace(WT_Byte byte)
00107 {
00108     switch (byte)
00109     {
00110     case (0x00):  // Null character -- ignore
00111     case (0x09):  // white space (Tab) -- ignore
00112     case (0x0A):  // white space (Line Feed) --ignore
00113     case (0x0D):  // white space (Carriage Return) -- ignore
00114     case (0x20):  // white space (space) -- ignore
00115         return WD_True;
00116     default:
00117       return WD_False;
00118     } // switch
00119 }
00120 
00121 #define BINARYSIZEOFGUID                                                                    \
00122     (WT_Integer32) (sizeof(WT_Integer32) + sizeof(WT_Unsigned_Integer16) +                  \
00123     sizeof(WT_Unsigned_Integer32) + sizeof(WT_Unsigned_Integer16) +                         \
00124     sizeof(WT_Unsigned_Integer16) + (8 * sizeof(WT_Byte)) + (2 * sizeof(WT_Byte)))          //
00125 
00126 
00127 #define WD_MIN(first, second)    (first < second ? first : second);
00128 #define WD_MAX(first, second)    (first > second ? first : second);
00129 
00130 #endif // TYPEDEF_DEFINES_HEADER

Generated on Tue Jan 6 22:41:13 2009 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.5