home *** CD-ROM | disk | FTP | other *** search
- #ifndef _UTILITIES_H
- #define _UTILITIES_H
- /*
- ** $VER: utilities.h 1.0 (10.3.94, 31.3.94)
- **
- ** Useful definitions and additional library functions for C programs.
- **
- ** (C) Copyright 1994 Rainer Koppler
- */
-
- #include <sys/types.h>
- #include <bool.h>
- #ifndef u_byte
- #define u_byte u_char
- #endif
-
- #include <stdlib.h>
- #include <stdio.h>
-
- #ifdef __GNUC__
- #define EXIT_SUCCESS 0
- #define EXIT_FAILURE 1
- #define SEEK_SET 0
- #define SEEK_CUR 1
- #define SEEK_END 2
- #endif
-
- #define FOREVER for(;;)
- #define NEW(BASETYPE,COUNT) ((BASETYPE *)malloc(sizeof(BASETYPE)*(COUNT)))
- #define CNEW(BASETYPE,COUNT) ((BASETYPE *)calloc((COUNT),sizeof(BASETYPE)))
- #define DELETE(PTR) { free(PTR); (PTR)=NULL; }
- #define CLRMEM(PTR,SIZE) memset(PTR,0,SIZE)
-
- #define KB 1024
- #define MB (KB*KB)
-
- #define MIN(A,B) ((A)<(B)?(A):(B))
- #define MAX(A,B) ((A)>(B)?(A):(B))
-
- #define FatalExit(str) \
- { printf("*** " str " - exiting\n"); exit(EXIT_FAILURE); }
-
-
- #endif /*_UTILITIES_H*/
-