1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308
|
/*******************************************************************************
* syspovconfig.h
*
* This file contains most Windows specific defines for compiling the VFE.
*
* Author: Christopher J. Cason
*
* ---------------------------------------------------------------------------
* Persistence of Vision Ray Tracer ('POV-Ray') version 3.7.
* Copyright 1991-2013 Persistence of Vision Raytracer Pty. Ltd.
*
* POV-Ray is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* POV-Ray is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ---------------------------------------------------------------------------
* POV-Ray is based on the popular DKB raytracer version 2.12.
* DKBTrace was originally written by David K. Buck.
* DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
* ---------------------------------------------------------------------------
* $File: //depot/povray/smp/vfe/win/syspovconfig.h $
* $Revision: #40 $
* $Change: 6131 $
* $DateTime: 2013/11/25 11:38:15 $
* $Author: clipka $
*******************************************************************************/
#ifndef __SYSPOVCONFIG_H__
#define __SYSPOVCONFIG_H__
#ifdef BUILDING_AMD64
#if !defined(_M_AMD64) && !defined(_M_X64)
#error you are compiling the x64 project using a 32-bit compiler
#endif
#else
#if defined(_M_AMD64) || defined(_M_X64)
#error you are compiling the 32-bit project using a 64-bit compiler
#endif
#endif
// _CONSOLE must be defined when building the console version of POVWIN.
// failure to do so will lead to link errors.
// #define _CONSOLE
#include <math.h>
#ifndef STD_TYPES_DECLARED
#define STD_TYPES_DECLARED
// the following types are used extensively throughout the POV source and hence are
// included and named here for reasons of clarity and convenience.
#include <exception>
#include <stdexcept>
#include <string>
#include <vector>
#include <list>
#include <boost/shared_ptr.hpp>
// when we say 'string' we mean std::string
using std::string;
// and vector is a std::vector
using std::vector;
// yup, list too
using std::list;
// runtime_error is the base of our Exception class, plus is referred
// to in a few other places.
using std::runtime_error;
// C++0x has a shared_ptr, but we currently use the boost one. alas, Visual Studio 2010
// pulls in the std::tr1::shared_ptr in some headers (particularly <memory>), and we thus
// have to either specifically nominate boost::shared_ptr wherever we use it, or typedef
// it. C++ doesn't [currently] support template typedefs but we could use the struct rebind
// workaround. for the moment it's being left unfixed.
using boost::shared_ptr;
#endif // STD_POV_TYPES_DECLARED
// the build command-line is expected to declare WIN32_LEAN_AND_MEAN, which will
// prevent Window's objidl.h from being pulled in (which dupes IStream)
// #include <windows.h>
//#define PROFILE_CALLS
#ifdef _WIN64
#define POVRAY_PLATFORM_NAME "win64"
#else
#define POVRAY_PLATFORM_NAME "win32"
#endif
#define ReturnAddress() NULL
#include "../vfeconf.h"
#if defined(__MINGW32__) /* MinGW GCC */
#include "compilers/mingw32.h"
#elif defined(__WATCOMC__) /* Watcom C/C++ C32 */
#include "compilers/watcom.h"
#elif defined(__BORLANDC__) /* Borland C/C++ */
#include "compilers/borland.h"
#elif defined(_MSC_VER) /* Microsoft and Intel C++ */
#include "compilers/msvc.h"
#else
#error unknown compiler configuration
#endif
#ifdef BUILD_SSE2
#define SSE2_INCLUDED "-sse2"
#else
#define SSE2_INCLUDED ""
#endif
/////////////////////////////////////////////////////////////
#ifndef MAX
#define MAX(a,b) ((a>b)?a:b)
#endif
#ifndef MIN
#define MIN(a,b) ((a>b)?b:a)
#endif
#ifndef HEAPSHRINK
#define HEAPSHRINK
#endif
#ifndef NAN
#define NAN (10E100)
#endif
#ifndef __GENDEFS
#define __GENDEFS
typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned __int64 uint64;
typedef __int64 int64;
#endif
#include <stdarg.h>
#include <stdlib.h>
#include <io.h>
#include <fcntl.h>
#ifdef __INTEL_COMPILER
// Intel C++ whines about the lack of a return on RDTSC() for each and every file
// it is included in. VC++ is smarter (or dumber, depending on your point of view).
#pragma warning(push)
#pragma warning(disable : 1011)
#endif
namespace povwin
{
void WIN_Debug_Log(unsigned int from, const char *msg) ;
void WIN32_DEBUG_OUTPUT(const char *format,...) ;
void WIN32_DEBUG_FILE_OUTPUT(const char *format,...) ;
#ifndef _CONSOLE
void *win_malloc(size_t size);
void *win_malloc(size_t size, const void *ptr, int line);
void *win_calloc(size_t nelem, size_t size);
void *win_calloc(size_t nelem, size_t size, const void *ptr, int line);
void *win_realloc(void *p, size_t size);
void *win_realloc(void *p, size_t size, const void *ptr, int line);
void win_free(void *p);
void win_free(void *p, const void *ptr, int line);
char *win_strdup(const char *s);
char *win_strdup(const char *s, const void *ptr, int line);
bool WinMemReport(bool global, uint64& allocs, uint64& frees, int64& current, uint64& peak, uint64& smallest, uint64& largest);
void WinMemStage(bool BeginRender, void *cookie = NULL);
#endif
#ifndef _WIN64
inline void DebugBreak() { _asm _emit 0cch } // rather than use the windows one
inline POV_LONG RDTSC(){ _asm _emit 0Fh _asm _emit 31h }
#define READ_PROFILE_TIMER RDTSC()
#else
inline void DebugBreak() {}
#define READ_PROFILE_TIMER 0
#endif
}
#ifdef __INTEL_COMPILER
#pragma warning(pop)
#endif
#define lseek64(handle,offset,whence) _lseeki64(handle,offset,whence)
namespace pov_base
{
// declare these to avoid warnings in image.cpp, rather than turn off the deprecation warnings.
static inline int open(const char *name, int flags, int mode) { return _open(name, flags|_O_BINARY, mode); }
static inline int close(int handle) { return _close(handle); }
static inline int write(int handle, const void *data, int count) { return _write(handle, data, count); }
static inline int read(int handle, void *data, int count) { return _read(handle, data, count); }
}
#define S_IRUSR _S_IREAD
#define S_IWUSR _S_IWRITE
#define ALTMAIN
#define LITTLE_ENDIAN
#define FILENAME_SEPARATOR '\\'
#define POV_FILE_SEPARATOR '\\'
#define POV_FILE_SEPARATOR_2 '/'
#define DEFAULT_OUTPUT_FORMAT kPOVList_FileType_PNG
#define POV_IS1 ".bmp"
#define POV_IS2 ".BMP"
#define DEFAULT_DISPLAY_GAMMA_TYPE kPOVList_GammaType_SRGB
#define DEFAULT_DISPLAY_GAMMA 2.2
#define DEFAULT_FILE_GAMMA_TYPE kPOVList_GammaType_SRGB
#define DEFAULT_FILE_GAMMA 2.2
#define RENAME_FILE(orig,new) rename(orig,new)
#define DELETE_FILE(name) _unlink(name)
#define NEW_LINE_STRING "\r\n"
#define TEXTSTREAM_CRLF 1
#define POV_SYS_FILE_EXTENSION ".bmp"
#define SYS_TO_STANDARD BMP
#define vsnprintf _vsnprintf
#define snprintf _snprintf
#define FILE_NAME_LENGTH _MAX_PATH
#define POV_NAME_MAX _MAX_FNAME
#define IFF_SWITCH_CAST (long)
#define USE_OFFICIAL_BOOST 1
#define POV_MEMMOVE(dst,src,len) memmove((dst),(src),(len))
#define POV_MEMCPY(dst,src,len) memcpy((dst),(src),(len))
#ifdef _CONSOLE
#define POV_MALLOC(size,msg) malloc (size)
#define POV_CALLOC(nitems,size,msg) calloc ((nitems), (size))
#define POV_REALLOC(ptr,size,msg) realloc ((ptr), (size))
#define POV_FREE(ptr) do { free (static_cast<void *>(ptr)); (ptr) = NULL; } while(false)
#define POV_STRDUP(str) strdup(str)
#define NO_RTR 1
#define MEM_STATS 0
#else // not _CONSOLE
#define MEM_STATS 0
#define POV_MEM_STATS 0
#define WIN_MEM_TRACKING 0
#ifdef _DEBUG
#define POV_MALLOC(size,msg) povwin::win_malloc ((size), __FILE__, __LINE__)
#define POV_CALLOC(nitems,size,msg) povwin::win_calloc ((nitems), (size), __FILE__, __LINE__)
#define POV_REALLOC(ptr,size,msg) povwin::win_realloc ((ptr), (size), __FILE__, __LINE__)
#define POV_FREE(ptr) do { povwin::win_free (static_cast<void *>(ptr), __FILE__, __LINE__); (ptr) = NULL; } while(false)
#define POV_STRDUP(str) povwin::win_strdup(str, __FILE__, __LINE__)
#else
#define POV_MALLOC(size,msg) povwin::win_malloc (size)
#define POV_CALLOC(nitems,size,msg) povwin::win_calloc ((nitems), (size))
#define POV_REALLOC(ptr,size,msg) povwin::win_realloc ((ptr), (size))
#define POV_FREE(ptr) do { povwin::win_free (static_cast<void *>(ptr)); (ptr) = NULL; } while(false)
#define POV_STRDUP(str) povwin::win_strdup(str)
#endif
#define POV_GLOBAL_MEM_STATS(a,f,c,p,s,l) povwin::WinMemReport(true, a, f, c, p, s, l)
#define POV_THREAD_MEM_STATS(a,f,c,p,s,l) povwin::WinMemReport(false, a, f, c, p, s, l)
#define POV_MEM_STATS_RENDER_BEGIN() povwin::WinMemStage(true)
#define POV_MEM_STATS_RENDER_END() povwin::WinMemStage(false)
#define POV_MEM_STATS_COOKIE void *
#define POV_IMPLEMENT_RTR 1
#define SYS_IMAGE_HEADER "syspovimage.h"
#define POV_VIDCAP_IMPL pov::VideoCaptureImpl
namespace pov
{
class VideoCaptureImpl;
}
#endif // end of not _CONSOLE
// see RLP comment in 3.6 windows config.h
#undef HUGE_VAL
// use a larger buffer for more efficient parsing
#define DEFAULT_ITEXTSTREAM_BUFFER_SIZE 65536
// this adds some useful debugging information to each POV-Ray SDL object
#if defined _DEBUG
#define OBJECT_DEBUG_HELPER
#endif
#ifndef MAX_PATH
#define MAX_PATH _MAX_PATH
#endif
#define NEED_INVHYP
#ifndef NO_RTR
#define RTR_HACK
#define RTR_SUPPORT
#endif
#endif // __SYSPOVCONFIG_H__
|