home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / utilities / print / pspager.lha / psp / include / utilities.h < prev   
Encoding:
C/C++ Source or Header  |  1994-04-15  |  1014 b   |  45 lines

  1. #ifndef _UTILITIES_H
  2. #define _UTILITIES_H
  3. /*
  4. **      $VER: utilities.h 1.0 (10.3.94, 31.3.94)
  5. **
  6. **      Useful definitions and additional library functions for C programs.
  7. **
  8. **      (C) Copyright 1994 Rainer Koppler
  9. */
  10.  
  11. #include <sys/types.h>
  12. #include <bool.h>
  13. #ifndef u_byte
  14. #define u_byte  u_char
  15. #endif
  16.  
  17. #include <stdlib.h>
  18. #include <stdio.h>
  19.  
  20. #ifdef __GNUC__
  21. #define EXIT_SUCCESS 0
  22. #define EXIT_FAILURE 1
  23. #define SEEK_SET 0
  24. #define SEEK_CUR 1
  25. #define SEEK_END 2
  26. #endif
  27.  
  28. #define FOREVER               for(;;)
  29. #define NEW(BASETYPE,COUNT)   ((BASETYPE *)malloc(sizeof(BASETYPE)*(COUNT)))
  30. #define CNEW(BASETYPE,COUNT)  ((BASETYPE *)calloc((COUNT),sizeof(BASETYPE)))
  31. #define DELETE(PTR)           { free(PTR); (PTR)=NULL; }                    
  32. #define CLRMEM(PTR,SIZE)      memset(PTR,0,SIZE)
  33.  
  34. #define KB 1024
  35. #define MB (KB*KB)
  36.  
  37. #define MIN(A,B) ((A)<(B)?(A):(B))
  38. #define MAX(A,B) ((A)>(B)?(A):(B))
  39.  
  40. #define FatalExit(str) \
  41.   { printf("*** " str " - exiting\n"); exit(EXIT_FAILURE); }
  42.  
  43.  
  44. #endif /*_UTILITIES_H*/
  45.