// pch.h Adapted from GPQUICK-2.1 // W. Langdon cs.ucl.ac.uk 5 May 1994 // Use Park-Miller random numbers // QPQUICK // Standard header files for compilers supporting Pre-Compiled Headers #ifndef _PCH_H #define _PCH_H // Pick your compiler. DOS/ANSI by default, now defined for UNIX #define UNIX #include #include "park-miller.h" #ifdef UNIX #include #include #else #include #include #endif #include #include #include #include #include #include #include #include #include #include #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif ////////// Random number functions cause portability problems. Resolve here. // Define rand_0to1() (random float from 0 to 1) // rnd(x) (random integer from 0 to x-1) // rndomize() (initialize with a time based seed) #ifdef UNIX //////////////////// UNIX stuff #define INT32 int inline int kbhit() {return FALSE;} // remove this MS DOS function //May well work with Turbo C as well extern int gpquick_seed; inline float rand_0to1() { return (float)(intrnd(gpquick_seed)) / 2147483647.0; } inline int rnd(int __num) { return (intrnd(gpquick_seed) % __num); }; inline void rndomize(void) { do { gpquick_seed = (unsigned) time(NULL); } while (gpquick_seed <= 0); } #else //////////////////// DOS/ANSI stuff #define INT32 long #define rand_0to1() (((float)rand())/RAND_MAX) #ifndef __TURBOC__ inline int rnd(int __num) { return(int)(((long)rand()*__num)/(RAND_MAX+1)); } inline void rndomize(void) { srand((unsigned) time(NULL)); } #else //////////////////// Borland C++ stuff #define rnd(x) random(x) #define rndomize() randomize() #endif #endif #endif