home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / developm / source / macraysh.sit / Code / Headers / common.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-10  |  1.7 KB  |  88 lines

  1. /*
  2.  * common.h
  3.  *
  4.  * Copyright (C) 1989, 1991, Craig E. Kolb
  5.  * All rights reserved.
  6.  *
  7.  * This software may be freely copied, modified, and redistributed
  8.  * provided that this copyright notice is preserved on all copies.
  9.  *
  10.  * You may not distribute this software, in whole or in part, as part of
  11.  * any commercial product without the express consent of the authors.
  12.  *
  13.  * There is no warranty or other guarantee of fitness of this software
  14.  * for any purpose.  It is provided solely "as is".
  15.  *
  16.  * $Id: common.h,v 4.0 91/07/17 14:30:18 kolb Exp Locker: kolb $
  17.  *
  18.  * $Log:    common.h,v $
  19.  * Revision 4.0  91/07/17  14:30:18  kolb
  20.  * Initial version.
  21.  * 
  22.  */
  23. #ifndef COMMON_H 
  24. #define COMMON_H
  25.  
  26. #include <stdio.h>
  27. #include <math.h>
  28. #include <stdlib.h>
  29.  
  30. #include "config.h"
  31.  
  32. typedef double Float;
  33.  
  34. typedef void * voidstar;
  35.  
  36. #include "expr.h"
  37. #include "vector.h"
  38. #include "ray.h"
  39. #include "color.h"
  40. #include "transform.h"
  41. #include "error.h"
  42.  
  43. #ifndef TRUE
  44. #define TRUE        1
  45. #endif
  46.  
  47. #ifndef FALSE
  48. #define FALSE        0
  49. #endif
  50.  
  51. /*
  52.  * Various useful constants and macros.
  53.  */
  54. #ifndef PI
  55. #define    PI        3.14159265358979323846
  56. #endif
  57. #define TWOPI        (2. * PI)
  58. #define INV_TWOPI    (1. / TWOPI)
  59. #define deg2rad(x)    (Float)(x * PI/180.)
  60. #define LNHALF        (-.69314718)
  61.  
  62. #ifndef NULL
  63. #    define NULL 0
  64. #endif
  65.  
  66. #define UNSET        -1
  67.  
  68. #define share_malloc(x)        Malloc(x)
  69. #define share_calloc(x,y)    Calloc(x,y)
  70.  
  71. /*
  72.  * Close enough for us.
  73.  */
  74. #define equal(a, b)        (fabs((a) - (b)) < 0.000001)
  75. /*
  76.  * Maximum/Minimum functions
  77.  */
  78. #define max(a, b)        ((a) > (b) ? (a) : (b))
  79. #define min(a, b)        ((a) < (b) ? (a) : (b))
  80.  
  81. extern voidstar Malloc(unsigned bytes) ;
  82. extern voidstar Calloc(unsigned nelem, unsigned elen) ;
  83. extern void Free(voidstar memory) ;
  84.  
  85. extern char    *strsave(char *);
  86.  
  87. #endif /* COMMON_H */
  88.