home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume10 / parseargs / useful.h < prev   
C/C++ Source or Header  |  1990-02-16  |  2KB  |  127 lines

  1. /*
  2. **  USEFUL.H -- various definitions of general interest
  3. **
  4. **    $Header: useful.h,v 2.0 89/12/24 00:56:33 eric Exp $
  5. **
  6. **    Author:
  7. **        Eric Allman
  8. **        University of California, Berkeley
  9. */
  10.  
  11. #ifndef _USEFUL_H_
  12. #define _USEFUL_H_
  13.  
  14. #include <stdio.h>
  15.  
  16. /* give a stab at the multiple-language dilemma */
  17. #ifdef __STDC__
  18. #define ARGS(x)        x
  19. #define NOARGS        (void)
  20. #define __ANSI_C__
  21. #else
  22. #if defined(c_plusplus) || defined(__cplusplus)
  23. #define ARGS(x)        x
  24. #define NOARGS        ()
  25. #define __ANSI_C__
  26. #else
  27. #define ARGS(x)        ()
  28. #define NOARGS        ()
  29. #endif
  30. #endif
  31.  
  32. #ifndef VOID
  33. #ifdef __ANSI_C__
  34. #define VOID        void
  35. #else
  36. #define VOID        int
  37. #endif
  38. #endif
  39.  
  40. #ifndef TRUE
  41. #define TRUE        1
  42. #define FALSE        0
  43. #endif
  44.  
  45. #ifndef BOOL
  46. #define BOOL        char
  47. #endif
  48.  
  49. #ifndef STATIC
  50. #ifndef NODEBUG
  51. #define STATIC
  52. #else
  53. #define STATIC        static
  54. #endif
  55. #endif
  56.  
  57. #ifndef EXTERN
  58. #define EXTERN        extern
  59. #endif
  60.  
  61. #ifndef CONST
  62. #ifdef __ANSI_C__
  63. #define CONST        const
  64. #else
  65. #define CONST
  66. #endif
  67. #endif
  68.  
  69. #ifndef NULL
  70. #define NULL        0
  71. #endif
  72.  
  73. #ifndef CHARNULL
  74. #define CHARNULL    ((char *) NULL)
  75. #endif
  76.  
  77. #define FILENULL    ((FILE *) NULL)
  78.  
  79. #ifdef __ANSI_C__
  80. #define ARBPTR        void *
  81. #else
  82. #define ARBPTR        char *
  83. #endif
  84. #define __        (ARBPTR)
  85. #define ARBNULL        (__ NULL)
  86.  
  87. #ifndef TRACESTUFF
  88. #define NODEBUG
  89. #endif
  90.  
  91. #ifndef NODEBUG
  92. #define _TRACE_SIZE    200
  93. extern unsigned char    _TraceVect[_TRACE_SIZE];
  94. #define TRACEF(f, l)    (_TraceVect[f] >= l)
  95. #define TRACE(f, l, m)    (TRACEF(f, l) ? printf m : 0)
  96. #else
  97. #define TRACEF(f, l)    (FALSE)
  98. #define TRACE(f, l, m)
  99. #endif
  100.  
  101. #ifdef lint
  102. #define VERSIONID(v)
  103. #else
  104. #define VERSIONID(v)    static char _Version[] = v;
  105. #endif
  106.  
  107. #define BITSET(b, w)    (((b) & (w)) != 0)
  108.  
  109. #ifdef __STDC__
  110. #include <string.h>
  111. #else
  112. extern char    *strchr ARGS((char *, char));
  113. extern char    *strrchr ARGS((char *, char));
  114. #endif
  115.  
  116. extern ARBPTR    ckalloc ARGS((unsigned int));
  117.  
  118. #define MAXINPUTLINE    200        /* maximum string input line */
  119. #define MAXWORDLEN    100        /* maximum word (token) length */
  120.  
  121. #ifndef BSD
  122. #define bcopy(f,t,l) memcpy(t,f,l)
  123. #define bcmp(s,t,l) memcmp(s,t,l)
  124. #endif
  125.  
  126. #endif /* _USEFUL_H_ */
  127.