home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / wps / games / spl / src / general.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1993-08-10  |  1.5 KB  |  57 lines

  1. /* general.hpp:  Headers for general interest routines
  2.  
  3.     Copyright (C) 1993 John-Marc Chandonia
  4.  
  5.     This program is free software; you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by
  7.     the Free Software Foundation; either version 2 of the License, or
  8.     (at your option) any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19.  
  20. #ifndef _GENERAL_HPP
  21. #define _GENERAL_HPP
  22.  
  23. /* error handlers */
  24. void fatal(char *fmt, ...);
  25. void error(char *fmt, ...);
  26. void warning(char *fmt, ...);
  27.  
  28. /* memory allocation */
  29. void *chkcalloc(size_t nitems, size_t size);
  30.  
  31. /* string functions for unix system */
  32. char *upstr(char *str);
  33. char *lowstr(char *str);
  34.  
  35. /* general stuff */
  36. typedef enum boolean {false,true} boolean;
  37. #define forever while (true)
  38.  
  39. #ifndef max
  40. #define max(x,y) ((x)>(y)?(x):(y))
  41. #endif
  42.  
  43. #ifndef min
  44. #define min(x,y) ((x)<(y)?(x):(y))
  45. #endif
  46.  
  47. #ifndef sqr
  48. #define sqr(x) ((x)*(x))
  49. #endif
  50.  
  51. #ifndef abs
  52. #define abs(x) ((x)>0.0 ? (x) : 0.0-(x))
  53. #endif
  54.  
  55. #endif
  56.  
  57.