1 /******************************************************************************* 2 * configbackend.h 3 * 4 * This header file defines all types that can be configured by platform 5 * specific code for backend use. It further allows insertion of platform 6 * specific function prototypes making use of those types. 7 * 8 * --------------------------------------------------------------------------- 9 * Persistence of Vision Ray Tracer ('POV-Ray') version 3.7. 10 * Copyright 1991-2013 Persistence of Vision Raytracer Pty. Ltd. 11 * 12 * POV-Ray is free software: you can redistribute it and/or modify 13 * it under the terms of the GNU Affero General Public License as 14 * published by the Free Software Foundation, either version 3 of the 15 * License, or (at your option) any later version. 16 * 17 * POV-Ray is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU Affero General Public License for more details. 21 * 22 * You should have received a copy of the GNU Affero General Public License 23 * along with this program. If not, see <http://www.gnu.org/licenses/>. 24 * --------------------------------------------------------------------------- 25 * POV-Ray is based on the popular DKB raytracer version 2.12. 26 * DKBTrace was originally written by David K. Buck. 27 * DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins. 28 * --------------------------------------------------------------------------- 29 * $File: //depot/public/povray/3.x/source/backend/configbackend.h $ 30 * $Revision: #1 $ 31 * $Change: 6069 $ 32 * $DateTime: 2013/11/06 11:59:40 $ 33 * $Author: chrisc $ 34 *******************************************************************************/ 35 36 #ifndef CONFIGBACKEND_H 37 #define CONFIGBACKEND_H 38 39 #include "syspovconfigbackend.h" 40 41 /* 42 * Platform name default. 43 */ 44 #ifndef POVRAY_PLATFORM_NAME 45 #define POVRAY_PLATFORM_NAME "Unknown Platform" 46 #endif 47 48 /* 49 * These functions define macros which do checking for memory allocation, 50 * and can also do other things. Check existing code before you change them, 51 * since they aren't simply replacements for malloc, calloc, realloc, and free. 52 */ 53 #ifndef POV_MALLOC 54 #define POV_MALLOC(size,msg) pov_malloc ((size), __FILE__, __LINE__, (msg)) 55 #endif 56 57 #ifndef POV_CALLOC 58 #define POV_CALLOC(nitems,size,msg) pov_calloc ((nitems), (size), __FILE__, __LINE__, (msg)) 59 #endif 60 61 #ifndef POV_REALLOC 62 #define POV_REALLOC(ptr,size,msg) pov_realloc ((ptr), (size), __FILE__, __LINE__, (msg)) 63 #endif 64 65 #ifndef POV_FREE 66 #define POV_FREE(ptr) do { pov_free (static_cast<void *>(ptr), __FILE__, __LINE__); (ptr) = NULL; } while(false) 67 #endif 68 69 #ifndef POV_MEM_INIT 70 #define POV_MEM_INIT() mem_init() 71 #endif 72 73 #ifndef POV_MEM_RELEASE_ALL 74 #define POV_MEM_RELEASE_ALL() mem_release_all() 75 #endif 76 77 #ifndef POV_STRDUP 78 #define POV_STRDUP(str) pov_strdup(str) 79 #endif 80 81 // For those systems that don't have memmove, this can also be pov_memmove 82 #ifndef POV_MEMMOVE 83 #define POV_MEMMOVE(dst,src,len) pov_memmove((dst),(src),(len)) 84 #endif 85 86 #ifndef POV_MEMCPY 87 #define POV_MEMCPY(dst,src,len) memcpy((dst),(src),(len)) 88 #endif 89 90 #ifndef POV_MEM_STATS 91 #define POV_MEM_STATS 0 92 #define POV_GLOBAL_MEM_STATS(a,f,c,p,s,l) (false) 93 #define POV_THREAD_MEM_STATS(a,f,c,p,s,l) (false) 94 #define POV_MEM_STATS_RENDER_BEGIN() 95 #define POV_MEM_STATS_RENDER_END() 96 #define POV_MEM_STATS_COOKIE void * 97 #endif 98 99 /* 100 * To allow GUI platforms like the Mac to access a command line and provide 101 * a command line only interface (for debugging) a different call to an 102 * internal function of the standard library is required. This macro takes 103 * both argc and argv and is expected to return argc. 104 */ 105 #ifndef GETCOMMANDLINE 106 #define GETCOMMANDLINE(ac,av) ac 107 #endif 108 109 #ifndef CONFIG_MATH // Macro for setting up any special FP options 110 #define CONFIG_MATH 111 #endif 112 113 /* Specify number of source file lines printed before error line, their maximum length and 114 * the error marker text that is appended to mark the error 115 */ 116 #ifndef POV_NUM_ECHO_LINES 117 #define POV_NUM_ECHO_LINES 5 118 #endif 119 120 #ifndef POV_ERROR_MARKER_TEXT 121 #define POV_ERROR_MARKER_TEXT " <----ERROR\n" 122 #endif 123 124 #ifndef POV_WHERE_ERROR 125 #define POV_WHERE_ERROR(fn,ln,cl,ts) 126 #endif 127 128 // Default for Max_Trace_Level 129 #ifndef MAX_TRACE_LEVEL_DEFAULT 130 #define MAX_TRACE_LEVEL_DEFAULT 5 131 #endif 132 133 // Upper bound for max_trace_level specified by the user 134 #ifndef MAX_TRACE_LEVEL_LIMIT 135 #define MAX_TRACE_LEVEL_LIMIT 256 136 #endif 137 138 // Various numerical constants that are used in the calculations 139 #ifndef EPSILON // A small value used to see if a value is nearly zero 140 #define EPSILON 1.0e-10 141 #endif 142 143 #ifndef HUGE_VAL // A very large value, can be considered infinity 144 #define HUGE_VAL 1.0e+17 145 #endif 146 147 /* 148 * If the width of a bounding box in one dimension is greater than 149 * the critical length, the bounding box should be set to infinite. 150 */ 151 152 #ifndef CRITICAL_LENGTH 153 #define CRITICAL_LENGTH 1.0e+6 154 #endif 155 156 #ifndef BOUND_HUGE // Maximum lengths of a bounding box. 157 #define BOUND_HUGE 2.0e+10 158 #endif 159 160 /* 161 * These values determine the minimum and maximum distances 162 * that qualify as ray-object intersections. 163 */ 164 165 //#define SMALL_TOLERANCE 1.0e-6 // TODO FIXME #define SMALL_TOLERANCE 0.001 166 //#define MAX_DISTANCE 1.0e+10 // TODO FIXME #define MAX_DISTANCE 1.0e7 167 #define SMALL_TOLERANCE 0.001 168 #define MAX_DISTANCE 1.0e7 169 170 #define MIN_ISECT_DEPTH 1.0e-4 171 172 #ifndef DBL_FORMAT_STRING 173 #define DBL_FORMAT_STRING "%lf" 174 #endif 175 176 // Some implementations of scanf return 0 on failure rather than EOF 177 #ifndef SCANF_EOF 178 #define SCANF_EOF EOF 179 #endif 180 181 // Adjust to match floating-point parameter(s) of functions in math.h/cmath 182 #ifndef SYS_MATH_PARAM 183 #define SYS_MATH_PARAM double 184 #endif 185 186 // Adjust to match floating-point return value of functions in math.h/cmath 187 #ifndef SYS_MATH_RETURN 188 #define SYS_MATH_RETURN double 189 #endif 190 191 // Function that executes functions, the parameter is the function index 192 #ifndef POVFPU_Run 193 #define POVFPU_Run(ctx, fn) POVFPU_RunDefault(ctx, fn) 194 #endif 195 196 // Adjust to add system specific handling of functions like just-in-time compilation 197 #if (SYS_FUNCTIONS == 0) 198 199 // Note that if SYS_FUNCTIONS is 1, it will enable the field dblstack 200 // in FPUContext_Struct and corresponding calculations in POVFPU_SetLocal 201 // as well as POVFPU_NewContext. 202 #define SYS_FUNCTIONS 0 203 204 // Called after a function has been added, parameter is the function index 205 #define SYS_ADD_FUNCTION(fe) 206 // Called before a function is deleted, parameter is a pointer to the FunctionEntry_Struct 207 #define SYS_DELETE_FUNCTION(fe) 208 // Called inside POVFPU_Init after everything else has been inited 209 #define SYS_INIT_FUNCTIONS() 210 // Called inside POVFPU_Terminate before anything else is deleted 211 #define SYS_TERM_FUNCTIONS() 212 // Called inside POVFPU_Reset before anything else is reset 213 #define SYS_RESET_FUNCTIONS() 214 215 // Adjust to add system specific fields to FunctionEntry_Struct 216 #define SYS_FUNCTION_ENTRY 217 218 #endif // SYS_FUNCTIONS 219 220 #ifndef POV_SYS_THREAD_STARTUP 221 #define POV_SYS_THREAD_STARTUP 222 #endif 223 224 #ifndef POV_SYS_THREAD_CLEANUP 225 #define POV_SYS_THREAD_CLEANUP 226 #endif 227 228 #ifndef CDECL 229 #define CDECL 230 #endif 231 232 #ifndef ALIGN16 233 #define ALIGN16 234 #endif 235 236 #ifndef FORCEINLINE 237 #define FORCEINLINE inline 238 #endif 239 240 #ifndef INLINE_NOISE 241 #define INLINE_NOISE 242 #endif 243 244 #ifndef USE_FASTER_NOISE 245 #define USE_FASTER_NOISE 0 246 #endif 247 248 #ifndef NEW_LINE_STRING 249 #define NEW_LINE_STRING "\n" 250 #endif 251 252 // If compiler version is undefined, then make it 'u' for unknown 253 #ifndef COMPILER_VER 254 #define COMPILER_VER ".u" 255 #endif 256 257 #ifndef QSORT 258 #define QSORT(a,b,c,d) qsort((a),(b),(c),(d)) 259 #endif 260 261 #ifndef POV_PARSE_PATH_STRING 262 #error "A valid POV_PARSE_PATH_STRING macro is required!" 263 #endif 264 265 266 /* 267 * Font related macros [trf] 268 */ 269 #ifndef POV_CONVERT_TEXT_TO_UCS2 270 #define POV_CONVERT_TEXT_TO_UCS2(ts, tsl, as) (NULL) 271 #endif 272 273 #ifndef POV_ALLOW_FILE_READ 274 #define POV_ALLOW_FILE_READ(f,t) (1) 275 #endif 276 277 #ifndef POV_ALLOW_FILE_WRITE 278 #define POV_ALLOW_FILE_WRITE(f,t) (1) 279 #endif 280 281 /// @def POV_THREAD_STACK_SIZE 282 /// Default thread stack size. 283 /// 284 #ifndef POV_THREAD_STACK_SIZE 285 #define POV_THREAD_STACK_SIZE (2 * 1024 * 1024) 286 #endif 287 288 /// @def HAVE_BOOST_THREAD_ATTRIBUTES 289 /// Whether boost::thread::attributes is available (and can be used to set a thread's stack size). 290 /// 291 #if BOOST_VERSION >= 105000 292 #define HAVE_BOOST_THREAD_ATTRIBUTES 1 293 #else 294 #define HAVE_BOOST_THREAD_ATTRIBUTES 0 295 #endif 296 297 #include "syspovprotobackend.h" 298 299 #endif 300