home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / POV-Ray 3.0.2 / src / MacSource / Config.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-04-13  |  12.8 KB  |  360 lines  |  [TEXT/CWIE]

  1. /*==============================================================================
  2. Project:    POV-Ray
  3.  
  4. Version:    3.0
  5.  
  6. File:    Config.h -- Macintosh version
  7.  
  8. Description:
  9.     This file contains Macintosh-specific defines, types, etc for the following
  10.     environments:
  11.     Symantec Think C 7 & 8
  12.     MPW 3.3x
  13.     Metrowerks 6+
  14. ------------------------------------------------------------------------------
  15. Authors:
  16.     Thomas Okken, David Lichtman, Glenn Sugden
  17.     Jim Nitchals, Eduard [esp] Schwan
  18. ------------------------------------------------------------------------------
  19.     from Persistence of Vision(tm) Ray Tracer
  20.     Copyright 1996 Persistence of Vision Team
  21. ------------------------------------------------------------------------------
  22.     NOTICE: This source code file is provided so that users may experiment
  23.     with enhancements to POV-Ray and to port the software to platforms other 
  24.     than those supported by the POV-Ray Team.  There are strict rules under
  25.     which you are permitted to use this file.  The rules are in the file
  26.     named POVLEGAL.DOC which should be distributed with this file. If 
  27.     POVLEGAL.DOC is not available or for more info please contact the POV-Ray
  28.     Team Coordinator by leaving a message in CompuServe's Graphics Developer's
  29.     Forum.  The latest version of POV-Ray may be found there as well.
  30.  
  31.     This program is based on the popular DKB raytracer version 2.12.
  32.     DKBTrace was originally written by David K. Buck.
  33.     DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
  34. ------------------------------------------------------------------------------
  35. Change History:
  36.     920815    [jln]    version 1.0 Mac released.
  37.     921105    [esp]    version 1.1 beta Mac
  38.     930902    [esp]    version 1.9 beta Mac
  39.     931001    [esp]    version 2.0 finished (Released on 10/4/93)
  40.     931119    [djh]    2.0.1 source conditionally compiles for PPC machines, keyword __powerc
  41.     940430    [esp]    Preliminary 3.0a1 work
  42.     940520    [esp]    2.2+ updated for Metrowerks DR/3 release
  43.     940604    [esp]    3.0a2
  44.     940807    [esp]    3.0a5
  45.     940905    [esp]    3.0a7 moved all compiler options (NEEDS_XXX) in here
  46.     941209    [esp]    3.0a12d tweaks for new FINISH_POVRAY requirement
  47.     960204    [esp]    3.0b4j Tweak EPSILON for PPC, added moew POV-Ray #defines from FRAME.H
  48.     960428    [esp]    3.0b7 Work on adding Symantec 8 support in, and prepost stuff.
  49.     961007    [esp]    added Think C NEEDS_FPU per Steven Cartier (jewels@qnet.com)
  50. ==============================================================================*/
  51.  
  52. #if !defined(CONFIG_H)
  53. #define CONFIG_H
  54.  
  55. // ---------------------------------------------------------------
  56. // If we're not doing precompiled headers, then declare these here!
  57. // Note that these settings should happen BEFORE any Mac headers are read!
  58. // ---------------------------------------------------------------
  59. #if !defined(POVMACHEADERS_PCH)
  60.     #if !defined(SystemSixOrLater)
  61.         #define SystemSixOrLater    true
  62.     #endif // SystemSixOrLater
  63.     #if !defined(SystemSevenOrLater)
  64.         #define SystemSevenOrLater    true
  65.     #endif // SystemSevenOrLater
  66.     // Use new Universal header style
  67.     #define OLDROUTINENAMES            false
  68.     #define OLDROUTINELOCATIONS        false
  69. #endif
  70.  
  71.  
  72. // ---------------------------------------------------------------
  73. // If Metrowerks, ignore the old K&R style function declarations in the code,
  74. // since some horrible CW8 parse errors occur otherwise!
  75. // (NOTE: This pragma doesn't really do anything here, just a reminder.)
  76. // ---------------------------------------------------------------
  77. #if defined (__MWERKS__)
  78. #pragma ignore_oldstyle on
  79. #endif // CodeWarrior
  80.  
  81.  
  82. // ---------------------------------------------------------------
  83. //    FRAME.H Overrides
  84. // ---------------------------------------------------------------
  85.  
  86. //        Identifier                Mac Value        .. Default Value
  87. //        ----------                ---------        -- -------------
  88. #define POV_NAME_MAX            (31-3)          //  8
  89. #define FILE_NAME_LENGTH        255                //    150
  90. #define    FILENAME_SEPARATOR        ':'                //    '/'
  91. #define DRIVE_SEPARATOR            ':'
  92. #define DELETE_FILE(name)        remove(name)    // unlink
  93. #define RENAME_FILE(orig,new)    rename(orig,new)
  94.  
  95. #if defined (powerc) || defined (__powerc)
  96.  #define EPSILON                1.0e-7            //    1.0e-10
  97.  #if !defined(HUGE_VAL)
  98. //  #define HUGE_VAL                1.0e+15            //    1.0e+17
  99.  #endif
  100. #else
  101.  #define EPSILON                1.0e-10            //    1.0e-10
  102.  #if !defined(HUGE_VAL)
  103. //  #define HUGE_VAL                1.0e+20            //    1.0e+17
  104.  #endif
  105. #endif
  106.  
  107. #define BOUND_HUGE                2.0e+10            //    2.0e10
  108.  
  109. #define    exit(n)                catch_exit(n)
  110.  
  111.  
  112. // ---------------------------------------------------------------
  113. // turn on/off USE_LONG_DBL to use long float or regular float
  114. // NOTE: MPW C 68k compiler treats long double as extended, the native type,
  115. // so supposedly there would be less converting happening.
  116. // ---------------------------------------------------------------
  117.  
  118. #if !defined (powerc) && !defined (__powerc)
  119. #define USE_LONG_DBL            1
  120. #endif
  121.  
  122. #if defined(USE_LONG_DBL)
  123. #define DBL                        long double
  124. #define DBL_FORMAT_STRING        "%Lf"
  125. #else
  126. #define DBL                        double
  127. #define DBL_FORMAT_STRING        "%lf"
  128. #endif // USE_LONG_DBL
  129.  
  130. #define ALTMAIN                    1                //    0 (1 makes main() into a subroutine)
  131. #define MAIN_RETURN_TYPE        int                //    main() return type
  132. #define MAIN_RETURN_STATEMENT    return 0;        //    main() return statement
  133. #define ANSIFUNC                1                //  Yes, we are ANSI prototype compliant!
  134. #define DEFAULT_OUTPUT_FORMAT    't'                //  targa
  135. #define DEFAULT_DISPLAY_GAMMA    1.8                //  2.2
  136. #define DEFAULT_ASSUMED_GAMMA   1.0                //  1.0
  137. #define SNGL                    float
  138. #define COLC                    float
  139. #define CONST                    const
  140. // #define const
  141. #define IFF_SWITCH_CAST            (long)
  142. #define QSORT_FUNCT_RET            int
  143. #define QSORT_FUNCT_PARAM        const void *
  144.  
  145.  
  146. // ---------------------------------------------------------------
  147. //    ZLIB and PNG stuff
  148. // ---------------------------------------------------------------
  149. #if !defined(MACOS)
  150. // ---- ZLib stuff
  151. #define MACOS
  152. #define STDC
  153. #define HAVE_MEMCPY
  154. #define MY_ZCALLOC
  155. #define Z_PREFIX
  156. // ---- PNG Stuff
  157. #define PNG_INTERNAL
  158. #endif
  159.  
  160.  
  161. // ---------------------------------------------------------------
  162. //    pre/post-processing routines that can be called
  163. // ---------------------------------------------------------------
  164.  
  165. // Called at the beginning of POV-Ray engine main
  166. #define STARTUP_POVRAY
  167.  
  168.  
  169. // FINISH_POVRAY is called on normal OR abnormal termination,
  170. // only call exit() if ABNORMAL on the Mac.
  171. #define FINISH_POVRAY(ev)        {if (ev) exit(ev);}        // called before exiting engine
  172.  
  173. // between  render shell-out command processing, not used for now on Mac
  174. #define POV_SHELLOUT(shell_t)    Mac_Shellout(shell_t)
  175. #define POV_SYSTEM(cmdstr)        Mac_SystemCall(cmdstr)
  176. #define POV_MAX_CMD_LENGTH        100                // 250 (size of cmdstr)
  177.  
  178. #define POV_PRE_RENDER            Mac_PreRender();
  179. #define POV_PRE_SHUTDOWN        Mac_PreShutdown();
  180. #define POV_POST_SHUTDOWN        Mac_PostShutdown();
  181.  
  182. // READ_ENV_VAR is supposed to be the name of the default "POVRAY.INI" file,
  183. // but the Mac reads the default file name from the resource file, as an
  184. // indexed string (STR#) instead.  See PREPOST.C, Mac_Process_Povray_Ini().
  185. #define READ_ENV_VAR
  186. // Read and process any INI (configuration) file on each render
  187. #define PROCESS_POVRAY_INI        Mac_Process_Povray_Ini();
  188. // called after normal write-ini-file call
  189. #define ALT_WRITE_INI_FILE
  190.  
  191. // before aa applied
  192. #define POV_PRE_PIXEL(x,y,c)
  193. // after aa applied
  194. #define POV_POST_PIXEL(x,y,c)
  195.  
  196.  
  197. // ---------------------------------------------------------------
  198. #define RADSTATS    1            // turn on Radiosity statistics display
  199.  
  200. // time statistics routines
  201. #define MAC_TICKS                LMGetTicks()        // toolbox call
  202. #define START_TIME                tstart = MAC_TICKS;
  203. #define STOP_TIME                tstop = MAC_TICKS; 
  204. #define TIME_ELAPSED            ((tstop - tstart) / 60L);
  205.  
  206. // multitasking support, sort of :-)
  207. #define TEST_ABORT                Cooperate(false);    // moderately high-level
  208. #define COOPERATE_0                Cooperate(false);    // high-level, not called often
  209. #define COOPERATE_1                Cooperate(false);    // deeper, called inside tighter loops
  210.  
  211. // Note that credits-printing is done once at Mac startup, not each call to POV-Ray
  212. #define PRINT_CREDITS            // called directly in Pov.c
  213. #define PRINT_OTHER_CREDITS        // called directly in Pov.c
  214.  
  215. // Machine-specific plot routines, see ImageWindow.C
  216. #define POV_DISPLAY_INIT(w,h)            POV_Mac_Display_Init((w),(h))
  217. #define POV_DISPLAY_CLOSE                POV_Mac_Display_Close();
  218. #define POV_DISPLAY_FINISHED            POV_Mac_Display_Finished();
  219. #define POV_DISPLAY_PLOT(x,y,r,g,b,a)    POV_Mac_Display_Plot((x),(y),(r),(g),(b),(a))
  220. #define POV_DISPLAY_PLOT_RECT(x1,x2,y1,y2,r,g,b,a) POV_Mac_Display_Plot_Rect((x1),(x2),(y1),(y2),(r),(g),(b),(a))
  221.  
  222. // Machine-specific image_map file routines (PICT for the Mac, sysMacPict.c)
  223. #define GET_SYS_FILE_HANDLE()    0 // Get_MacPICT_File_Handle()
  224. #define READ_SYS_IMAGE(i,n)        0 // Read_MacPICT_Image((i),(n))
  225. #define SYS_DEF_EXT                ".pict"
  226.  
  227. // Turn ON to use histogram timer routines
  228. // (Not yet implemented on the Mac)
  229. #define PRECISION_TIMER_AVAILABLE 0
  230. #if PRECISION_TIMER_AVAILABLE
  231.   #define PRECISION_TIMER_INIT                Mac_PTimerInit();
  232.   #define PRECISION_TIMER_START               Mac_PTimerOn();
  233.   #define PRECISION_TIMER_STOP                Mac_PTimerOff();
  234.   #define PRECISION_TIMER_COUNT               Mac_PTimerCount();
  235.   void Mac_PTimerInit();
  236.   void Mac_PTimerOn();
  237.   void Mac_PTimerOff();
  238.   unsigned long Mac_PTimerCount();
  239. #endif
  240.  
  241.  
  242. // ---------------------------------------------------------------
  243. // #define WAIT_FOR_KEYPRESS
  244. // #define POV_RAND()            POV_Std_rand()
  245. // #define POV_SRAND(i)            POV_Std_srand(i)
  246. // #define POV_BANNER(s)        POV_Std_Banner(s)
  247. // #define POV_WARNING(s)        POV_Std_Warning(s)
  248. // #define POV_RENDER_INFO(s)    POV_Std_Render_Info(s)
  249. // #define POV_STATUS_INFO(s)    POV_Std_Status_Info(s)
  250. // #define POV_DEBUG_INFO(s)    POV_Std_Debug_Info(s)
  251. // #define POV_FATAL(s)            POV_Std_Fatal(s)
  252. // #define POV_STATISTICS(s)    POV_Std_Statistics(s)
  253.  
  254.  
  255. // ---------------------------------------------------------------
  256. // MEMIO.C - uncomment appropriate flags to turn on certain functionality
  257. #define MEM_RECLAIM            // Enables garbage collection
  258. // #define MEM_TAG                // Enables memory tag debugging
  259. // #define MEM_TRACE            // Enables garbage collection (MEM_RECLAIM) and memory tracing (MEM_TAG)
  260. #define MEM_STATS    1        // Enables tracking of memory statistics
  261.  
  262.  
  263. /*---------------------------------------------------------------------------
  264.     Flags to enable certain Macintosh compile-time functionality
  265. ---------------------------------------------------------------------------*/
  266.  
  267. #define PROJECT_POVRAY            // tell Generic routines which project this is
  268.  
  269. // POV.C - uncomment appropriate flags to turn on certain compiler options.
  270. // These flags assume that the project is being built with similar flags set
  271. // for the compiler... please make sure they match!!!
  272. #if !defined(applec)
  273. // NOTE : MPW sets these flags in the Make file, not here.
  274. #define NEEDS_68020            1    // turn on to force 68020 or better CPU code
  275. #define NEEDS_COLORQD        1    // turn on to force Color Quickdraw ROM Support
  276. #define NEEDS_32BITQD        1    // turn on to force 32Bit Quickdraw ROM Support
  277. #if (defined(__MWERKS__) && (__MC68881__)) || defined(THINK_C)
  278. #define NEEDS_FPU            1    // turn on to force 68881 FPU calls
  279. #endif
  280. // #define NEEDS_DEBUG        1    // turn on to add more internal debug stmts
  281. // #define NEEDS_PROF        1    // turn on to do profiling
  282. #endif
  283.  
  284.  
  285. // ---------------------------------------------------------------
  286. // What compiler are we using?
  287. // ---------------------------------------------------------------
  288.  
  289. #if defined (applec) && !defined (THINK_C)
  290. // Apple's Macintosh Programmer's Workshop
  291. #define COMPILER_VER    ".MacMPW"
  292. #endif // applec && !THINK_C
  293.  
  294. #if defined (THINK_C)
  295. // Symantec Think Project Mgr 7, 68K
  296. #define COMPILER_VER    ".MacThink"
  297. #endif // THINK_C
  298.  
  299. #if defined (__SC__)
  300. // Symantec Project Mgr 8, 68K/PPC
  301. #define COMPILER_VER    ".MacSymantec"
  302. #endif // THINK_C
  303.  
  304. #if defined (gcc)
  305. // Gnu CC
  306. #define COMPILER_VER    ".MacGNU"
  307. #endif // gcc
  308.  
  309. #if defined (__MWERKS__)
  310. // Metrowerks CodeWarrior
  311. #define COMPILER_VER    ".MacCodeWarrior"
  312. #endif // CodeWarrior
  313.  
  314. // >>> Add new compilers here! <<<
  315.  
  316. #if defined(__MRC__)
  317. // MrC (New MPW/ETO PowerPC Compiler)
  318. #define COMPILER_VER    ".MacMrC"
  319. #endif // COMPILER_VER
  320.  
  321. #if !defined(COMPILER_VER)
  322. // Unknown
  323. #define COMPILER_VER    ".Mac???"
  324. #endif // COMPILER_VER
  325.  
  326.  
  327. // ---------------------------------------------------------------
  328. // Some standard C headers
  329. // ---------------------------------------------------------------
  330. #include <stdio.h>
  331. #include <stdarg.h>
  332. #include <stdlib.h>
  333.  
  334. // Since math.h is hard-included  BEFORE config.h in the FRAME.H header,
  335. // we cannot just go include fp.h here, sad but true
  336. // #include <fp.h>                // new superset of math.h
  337.  
  338. // #include <math.h>                // no smart headers, have to use it
  339.  
  340. #if defined(_PI)
  341. #define M_PI                    pi
  342. #define M_PI_2                    (pi/2.0)
  343. #define TWO_M_PI                (pi*2.0)
  344. #define M_PI_180                (pi/180.0)
  345. #define M_PI_360                (pi/360.0)
  346. #endif
  347.  
  348. // ---------------------------------------------------------------
  349. // essential prototypes for some MACROS above
  350. // ---------------------------------------------------------------
  351.  
  352. #include "PovMacProto.h"
  353. #include "ImageWindow.h"
  354. #include "PrePost.h"    // prototypes for Mac_Process_Povray_Ini() etc.
  355. #include "Stdio_p2w.h"
  356.  
  357.  
  358.  
  359. #endif /* CONFIG_H */
  360.