home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / internet / netlite / NET / h / GLOBAL < prev    next >
Text File  |  1993-03-15  |  2KB  |  42 lines

  1. /* Global definitions used by every source file.
  2.  * Some may be compiler dependent.
  3.  */
  4.  
  5. /* These two lines assume that your compiler's longs are 32 bits and
  6.  * shorts are 16 bits. It is already assumed that chars are 8 bits,
  7.  * but it doesn't matter if they're signed or unsigned.
  8.  */
  9. typedef int int32;              /* 32-bit signed integer */
  10. typedef unsigned short int16;   /* 16-bit unsigned integer */
  11. #define uchar(x) ((unsigned char)(x))
  12. #define MAXINT16 65535          /* Largest 16-bit integer */
  13.  
  14. /* Define null object pointer in case stdio.h isn't included */
  15. #ifndef NULL
  16. /* General purpose NULL pointer */
  17. #define NULL (void *)0
  18. #endif
  19. #define NULLCHAR (char *)0      /* Null character pointer */
  20. #define NULLFP   (int (*)())0   /* Null pointer to function returning int */
  21. #define NULLVFP  (void (*)())0  /* Null pointer to function returning void */
  22. #define NULLFILE (FILE *)0      /* Null file pointer */
  23.  
  24. /* General purpose function macros */
  25. #define min(x,y)        ((x)<(y)?(x):(y))       /* Lesser of two args */
  26. #define max(x,y)        ((x)>(y)?(x):(y))       /* Greater of two args */
  27.  
  28. /* Extract a short from a long */
  29. #define hiword(x)       ((int16)((x) >> 16))
  30. #define loword(x)       ((int16)(x))
  31.  
  32. /* Extract a byte from a short */
  33. #define hibyte(x)       (((x) >> 8) & 0xff)
  34. #define lobyte(x)       ((x) & 0xff)
  35.  
  36. /* Extract nibbles from a byte */
  37. #define hinibble(x)     (((x) >> 4) & 0xf)
  38. #define lonibble(x)     ((x) & 0xf)
  39.  
  40. char *strdup(char *);           /* In MISC.H */
  41.  
  42.