whipcore.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 WHIPCORE_HEADER
00020 #define WHIPCORE_HEADER
00021 
00025 
00027 //
00028 // Recognize the newer DWF Toolkit pre-processor macros
00029 // 
00030 //
00031 #ifdef  DWFTK_STATIC
00032 #ifndef WHIP_STATIC_LIB
00033 #define WHIP_STATIC_LIB
00034 #endif
00035 #endif
00036 
00037 #ifdef  DWFTK_READ_ONLY
00038 #ifdef  CODE_NOT_WANTED
00039 #undef  CODE_NOT_WANTED
00040 #endif
00041 #define CODE_NOT_WANTED             WHIP_OUTPUT
00042 #endif
00043 
00044 #ifdef  DWFTK_EXPORT_API
00045 #undef  WHIPTOOL_CLIENT
00046 #undef  WHIP_STATIC_LIB
00047 #endif
00048 
00049 
00050 
00051 
00052 //
00053 // There are many products now using the Toolkit, however many
00054 // of these products use only a fraction of the code.  The
00055 // following 'defines' allow a product makefile to exclude
00056 // certain types of routines from the build by defining
00057 // the CODE_NOT_WANTED variable.  I know it makes the code a bit
00058 // ugly having a bunch of #if's everywhere, but the Web demands
00059 // small downloads... If you have a better idea, let me know... BPM
00060 //
00061 #ifndef CODE_NOT_WANTED
00062 #   define CODE_NOT_WANTED 0
00063 #endif
00064 #define WHIP_OUTPUT 0x10000000
00065 #define WHIP_INPUT 0x20000000
00066 // DESIRED_CODE is defined in HEIDI's core.h if needed, and is the same as the one here.
00067 #ifndef DESIRED_CODE
00068 #define DESIRED_CODE(bits)  (!((bits) & (CODE_NOT_WANTED)))
00069 #endif
00070 
00071 #if(!DESIRED_CODE(WHIP_INPUT))
00072 #pragma message ("Whip input code disabled")
00073 #endif
00074 #if(!DESIRED_CODE(WHIP_OUTPUT))
00075 #pragma message ("Whip output code disabled")
00076 #endif
00077 
00078 #include <stdlib.h>
00079 
00080 #if   defined   __sgi
00081     #define             WD_SGI_SYSTEM
00082     #define             WD_BIGENDIAN       TRUE
00083 
00084 #elif defined   __linux
00085     #include <endian.h>
00086     #define             WD_LINUX_SYSTEM
00087     #define             WD_BIGENDIAN       (__BYTE_ORDER == __BIG_ENDIAN)
00088 
00089     //
00090     // GNU macros messing with class methods... strange
00091     // for example, matrix.h will complain about minor()
00092     //
00093     #ifdef major
00094         #undef major
00095     #endif
00096 
00097     #ifdef minor
00098         #undef minor
00099     #endif
00100     #define             WD_PREFERRED_RGB32     b, g, r, a      // GDI's preference
00101 
00102 #elif defined (macintosh) || (defined (__MACH__) && defined (__APPLE__))
00103     #define     WD_MAC_SYSTEM
00104     #define     WD_BIGENDIAN        1
00105 
00106     //
00107     // GNU macros messing with class methods... strange
00108     // for example, matrix.h will complain about minor()
00109     //
00110     #ifdef major
00111         #undef major
00112     #endif
00113 
00114     #ifdef minor
00115         #undef minor
00116     #endif
00117 
00118     #define             WD_PREFERRED_RGB32     b, g, r, a      // GDI's preference
00119 
00120 #elif defined   _MSC_VER
00121     #define             WD_WIN32_SYSTEM
00122     #define             WD_BIGENDIAN       FALSE
00123     //#define           WD_PREFERRED_RGB32         r, g, b, a // OpenGL's preference
00124     #define             WD_PREFERRED_RGB32         b, g, r, a // GDI's preference
00125     #define             WD_NEWLINE          "\r\n"
00126 
00127     #ifndef WHIP_STATIC_LIB
00128         #if defined WHIPTOOL_CLIENT
00129             #ifdef WHIPTOOL_CLIENT_NODECLSPEC
00130                   #define         WHIPTK_API
00131             #pragma message ("Whip client (no declspec) ")
00132             #else
00133                   #define         WHIPTK_API  __declspec(dllimport)
00134             #pragma message ("Whip client (dllimport) ")
00135             #endif
00136         #else
00137             #define         WHIPTK_API  __declspec(dllexport)
00138             #pragma message ("Whip server (dllexport) ")
00139         #endif
00140         #define     WHIPTOOL_LOADABLE  extern "C" __declspec(dllexport)
00141     #else
00142         #define WHIPTK_API
00143         #define WHIPTOOL_LOADABLE  extern "C"
00144         #pragma message ("Whip static library ")
00145     #endif
00146 
00147     #define     WHIPTOOL_CALL      __cdecl
00148 
00149     #pragma warning (disable : 4127)  // conditional expression is constant (used in "do {...} while (0)" for macro safety)
00150     #pragma warning (disable : 4251)  // 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
00151 
00152     #if defined (_DEBUG) && defined (_AFXDLL)
00153         #include <afx.h>
00154         #if !defined WHIPTOOL_CLIENT
00155             #define new DEBUG_NEW
00156         #endif
00157     #else
00158         #include <windows.h>
00159     #endif
00160 
00161 #else
00162     #error      "Fatal WHIP! toolkit build error -- Unknown system type"
00163 #endif
00164 
00165 
00166 // default definitions if not set per-system
00167 
00168 #if !defined WD_PREFERRED_RGB32
00169     #define     WD_PREFERRED_RGB32          a, b, g, r
00170 #endif
00171 
00172 #if !defined WD_NEWLINE
00173     #define     WD_NEWLINE                  "\n"
00174 #endif
00175 
00176 #if !defined WD_SET_MEMORY
00177     #include <string.h>
00178     #define     WD_SET_MEMORY(dest, size, value)   memset ((dest), (value), (size))
00179 #endif
00180 
00181 #if !defined WD_COPY_MEMORY
00182     #include <string.h>
00183     #define     WD_COPY_MEMORY(src, count, dest)   memcpy ((dest), (src), (count))
00184 #endif
00185 
00186 #if !defined WHIPTK_API
00187     #define     WHIPTK_API
00188 #endif
00189 
00190 #if !defined WHIPTOOL_LOADABLE
00191     #define     WHIPTOOL_LOADABLE          extern "C"
00192 #endif
00193 
00194 #if !defined WHIPTOOL_CALL
00195     #define     WHIPTOOL_CALL
00196 #endif
00197 
00198 //
00199 // The presence of _DEBUG contraindicates "production" code.
00200 // Control all other debugging flags with this global
00201 // sense of debuggability.
00202 //
00203 #if defined _DEBUG
00204     #define DEBUG_ASSERTIONS    // enables assertions
00205 #endif
00206 
00207 extern WHIPTK_API  void WHIPTOOL_CALL WD_Fail_Assertion (char const *assertion, char const * file, int line);
00208 #if defined DEBUG_ASSERTIONS
00209     #define WD_Complain(reason) WD_Fail_Assertion (reason, __FILE__, __LINE__)
00210     #define WD_Assert(condition) \
00211        for(;;) {if (!(condition)) WD_Complain (#condition); break; }
00212 #else
00213     #define WD_Complain(reason)
00214     #define WD_Assert(condition)
00215 #endif
00216 
00217 #if defined (_DEBUG) && defined (_MSC_VER)
00218     #define CRTDBG_MAP_ALLOC
00219     #include <crtdbg.h>
00220 #endif
00221 
00222 #include "whiptk/typedefs_defines.h"
00223 #include "whiptk/whiperrs.h"
00224 #include "whiptk/rgb.h"
00225 #include "whiptk/logical_point.h"
00226 #include "whiptk/point.h"
00227 #include "whiptk/logical_box.h"
00228 #include "whiptk/transform.h"
00229 #include "whiptk/wtstring.h"
00230 #include "whiptk/opcode_defs.h"
00231 
00232 #endif // WHIPCORE_HEADER
00233 

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