home *** CD-ROM | disk | FTP | other *** search
- /* Global definitions used by every source file.
- * Some may be compiler dependent.
- */
-
- /* These two lines assume that your compiler's longs are 32 bits and
- * shorts are 16 bits. It is already assumed that chars are 8 bits,
- * but it doesn't matter if they're signed or unsigned.
- */
- typedef int int32; /* 32-bit signed integer */
- typedef unsigned short int16; /* 16-bit unsigned integer */
- #define uchar(x) ((unsigned char)(x))
- #define MAXINT16 65535 /* Largest 16-bit integer */
-
- /* Define null object pointer in case stdio.h isn't included */
- #ifndef NULL
- /* General purpose NULL pointer */
- #define NULL (void *)0
- #endif
- #define NULLCHAR (char *)0 /* Null character pointer */
- #define NULLFP (int (*)())0 /* Null pointer to function returning int */
- #define NULLVFP (void (*)())0 /* Null pointer to function returning void */
- #define NULLFILE (FILE *)0 /* Null file pointer */
-
- /* General purpose function macros */
- #define min(x,y) ((x)<(y)?(x):(y)) /* Lesser of two args */
- #define max(x,y) ((x)>(y)?(x):(y)) /* Greater of two args */
-
- /* Extract a short from a long */
- #define hiword(x) ((int16)((x) >> 16))
- #define loword(x) ((int16)(x))
-
- /* Extract a byte from a short */
- #define hibyte(x) (((x) >> 8) & 0xff)
- #define lobyte(x) ((x) & 0xff)
-
- /* Extract nibbles from a byte */
- #define hinibble(x) (((x) >> 4) & 0xf)
- #define lonibble(x) ((x) & 0xf)
-
- char *strdup(char *); /* In MISC.H */
-
-