Category : Printer + Display Graphics
Archive   : RAYSH386.ZIP
Filename : COMMON.H

 
Output of file : COMMON.H contained in archive : RAYSH386.ZIP
/*
* common.h
*
* Copyright (C) 1989, 1991, Craig E. Kolb
* All rights reserved.
*
* This software may be freely copied, modified, and redistributed
* provided that this copyright notice is preserved on all copies.
*
* You may not distribute this software, in whole or in part, as part of
* any commercial product without the express consent of the authors.
*
* There is no warranty or other guarantee of fitness of this software
* for any purpose. It is provided solely "as is".
*
* $Id: common.h,v 4.0.1.1 91/11/26 21:34:27 cek Exp Locker: cek $
*
* $Log: common.h,v $
* Revision 4.0.1.1 91/11/26 21:34:27 cek
* patch3: Added EPSILON definition, redefine equal() macro.
*
* Revision 4.0 91/07/17 14:30:18 kolb
* Initial version.
*
*/
#ifndef COMMON_H
#define COMMON_H

#include
#include
#ifdef I_STDLIB
#include
#endif

#if defined(__WATCOMC__) || defined(__BORLANDC__)
#ifndef HUGE
#define HUGE HUGE_VAL
#endif
#include
#endif

#include "config.h"

typedef double Float;

#if (VOIDFLAGS & 8) == 8
typedef void * voidstar;
#else
typedef char * voidstar;
#endif

#include "expr.h"
#include "vector.h"
#include "ray.h"
#include "color.h"
#include "transform.h"
#include "error.h"

#ifndef TRUE
#define TRUE 1
#endif

#ifndef FALSE
#define FALSE 0
#endif

/*
* Various useful constants and macros.
*/

/*
* Minimum vector length & fp value.
* Modify depending upon Float typedef.
*/
#define EPSILON (Float)0.00001

#ifndef PI
#define PI 3.14159265358979323846
#endif
#define TWOPI (2. * PI)
#define INV_TWOPI (1. / TWOPI)
#define deg2rad(x) (Float)(x * PI/180.)
#define LNHALF (-.69314718)

#ifndef NULL
# define NULL 0
#endif

#define UNSET -1

/*
* Some systems, such as the RS6000, have fast fabs already defined.
*/
#ifndef fabs
extern Float RSabstmp;
#define fabs(x) ((RSabstmp=x) < 0 ? -RSabstmp : RSabstmp)
#endif

#ifdef MULTIMAX
/*
* On the multimax, allocate large pieces of memory as shared memory.
*/
extern char *share_malloc(), *share_calloc();
#else
/*
* Otherwise, malloc is malloc, etc.
*/
#define share_malloc(x) RayMalloc(x)
#define share_calloc(x,y) Calloc(x,y)
#endif

/*
* Close enough for us.
*/
#define equal(a, b) (fabs((a) - (b)) < EPSILON)
/*
* Maximum/Minimum functions
*/

#if !defined(__WATCOMC__) && !defined(__BORLANDC__)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif

extern voidstar RayMalloc(), Calloc();
extern char *strsave();

#ifndef __WATCOMC__
extern double drand48(); /* just in case */
#endif

#endif /* COMMON_H */


  3 Responses to “Category : Printer + Display Graphics
Archive   : RAYSH386.ZIP
Filename : COMMON.H

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/