home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / games / volume4 / xconq5 / part17 / misc.h < prev    next >
C/C++ Source or Header  |  1988-07-01  |  1KB  |  44 lines

  1. /* Copyright (c) 1987, 1988  Stanley T. Shebs, University of Utah. */
  2. /* This program may be used, copied, modified, and redistributed freely */
  3. /* for noncommercial purposes, so long as this notice remains intact. */
  4.  
  5. /* RCS $Header: misc.h,v 1.1 88/06/21 12:29:43 shebs Exp $ */
  6.  
  7. /* Random definitions useful for nearly any C program. */
  8.  
  9. typedef unsigned char unchar;
  10. typedef unsigned short unshort;
  11.  
  12. #define bool int
  13. #define TRUE (1)
  14. #define FALSE (0)
  15.  
  16. #define abs(x) (((x) < 0) ? (0 - (x)) : (x))
  17.  
  18. #define min(x,y) (((x) < (y)) ? (x) : (y))
  19.  
  20. #define max(x,y) (((x) > (y)) ? (x) : (y))
  21.  
  22. #define between(lo,n,hi) ((lo) <= (n) && (n) <= (hi))
  23.  
  24. #define flip_coin() (random(257) % 2)
  25.  
  26. #define avg(a,b) (((a) + (b)) / 2)
  27.  
  28. #define iswhite(c) ((c) == ' ' || (c) == '\n' || (c) == '\t')
  29.  
  30. #define lowercase(c) (isupper(c) ? tolower(c) : (c))
  31.  
  32. #define uppercase(c) (islower(c) ? toupper(c) : (c))
  33.  
  34. /* Miscellaneous declarations. */
  35.  
  36. extern bool Debug, Build, Freeze;
  37.  
  38. extern char spbuf[], tmpbuf[], version[];
  39. extern char *plural_form(), *copy_string(), *read_line();
  40. #ifdef UNIX
  41. extern char *getenv();
  42. #endif UNIX
  43.  
  44.