home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / MAWK113.ZIP / mawk113 / config / Idefault.h < prev    next >
C/C++ Source or Header  |  1993-01-14  |  5KB  |  282 lines

  1.  
  2. /********************************************
  3. Idefault.h
  4. copyright 1991, 1992.  Michael D. Brennan
  5.  
  6. This is a source file for mawk, an implementation of
  7. the AWK programming language.
  8.  
  9. Mawk is distributed without warranty under the terms of
  10. the GNU General Public License, version 2, 1991.
  11. ********************************************/
  12.  
  13.  
  14. /* $Log: Idefault.h,v $
  15.  * Revision 3.18.1.1  1993/01/15  03:33:52  mike
  16.  * patch3: safer double to int conversion
  17.  *
  18.  * Revision 3.18  1992/12/17  02:48:01  mike
  19.  * 1.1.2d changes for DOS
  20.  *
  21.  * Revision 3.17  1992/11/26  15:35:52  mike
  22.  * don't assume __STDC__ implies HAVE_STRERROR
  23.  *
  24.  * Revision 3.16  1992/11/22  19:00:43  mike
  25.  * allow STDC assumptions to be overridden
  26.  *
  27.  * Revision 3.15  1992/07/08  16:16:08  brennan
  28.  * don't attempt any #def or #undef with __STDC__
  29.  *
  30. */
  31.  
  32.  
  33. #ifdef __STDC__
  34. #if   __STDC__  
  35.  
  36. #undef  HAVE_PROTOS
  37. #define HAVE_PROTOS        1
  38. #undef  HAVE_VOID_PTR
  39. #define HAVE_VOID_PTR        1
  40.  
  41. /* these can be overidden */
  42.  
  43. #ifndef  HAVE_STDARG_H
  44. #define HAVE_STDARG_H        1
  45. #endif
  46.  
  47. #ifndef  HAVE_STRING_H
  48. #define HAVE_STRING_H        1
  49. #endif
  50.  
  51. #ifndef  HAVE_STDLIB_H
  52. #define HAVE_STDLIB_H        1
  53. #endif
  54.  
  55. #endif  
  56. #endif
  57.  
  58. #ifdef    MSDOS
  59.  
  60. #ifndef  HAVE_REARGV
  61. #define  HAVE_REARGV    0
  62. #endif
  63.  
  64. #if HAVE_REARGV
  65. #define  SET_PROGNAME()  reargv(&argc,&argv) ; progname = argv[0]
  66. #else
  67. #define  SET_PROGNAME()  progname = "mawk"
  68. #endif
  69.  
  70. #define  MAX__INT    0x7fff
  71.  
  72. #if  HAVE_SMALL_MEMORY==0
  73. #define  LM_DOS        1
  74. #else
  75. #define  LM_DOS        0
  76. #endif
  77.  
  78. #define   SM_DOS    (!LM_DOS)
  79.  
  80. #define HAVE_REAL_PIPES        0
  81. #define HAVE_FAKE_PIPES        1
  82.  
  83. #else /* not defined MSDOS */
  84. #define   MSDOS        0
  85. #define   LM_DOS    0
  86. #define   SM_DOS    0
  87.  
  88. #endif /* MSDOS */
  89.  
  90.  
  91. /* The most common configuration is defined here:
  92.  
  93.    no function prototypes
  94.    have void*
  95.    have matherr(), strtod(), fmod()
  96.    uses <varargs.h>
  97.  
  98.    fpe_traps default to off
  99.    and nan comparison is done correctly
  100.  
  101.    memory is not small
  102.  
  103.    OS is some flavor of Unix
  104.  
  105. */
  106.  
  107. /* WARNING:  To port to a new configuration, don't make changes
  108.    here.  This file is included at the end of your new 
  109.    config.h 
  110.  
  111.    Read the file   mawk/INSTALL
  112. */
  113.  
  114.  
  115. /*------------- compiler ----------------------------*/
  116. /* do not have function prototypes */
  117.  
  118. #ifndef  HAVE_PROTOS
  119. #define  HAVE_PROTOS        0
  120. #endif
  121.  
  122. /* have type   void *    */
  123. #ifndef  HAVE_VOID_PTR
  124. #define  HAVE_VOID_PTR        1
  125. #endif
  126.  
  127. /* logical test of double is OK */
  128. #ifndef D2BOOL
  129. #define D2BOOL(x)        (x)
  130. #endif
  131.  
  132. /*---------------- library ----------------------*/
  133.  
  134.  
  135. #ifndef  HAVE_MATHERR
  136. #define  HAVE_MATHERR        1
  137. #endif
  138.  
  139. #ifndef  HAVE_STRTOD
  140. #define  HAVE_STRTOD        1
  141. #endif
  142.  
  143. #ifndef  HAVE_FMOD
  144. #define  HAVE_FMOD        1
  145. #endif
  146.  
  147. #ifndef  HAVE_STRERROR
  148. #define  HAVE_STRERROR        0
  149. #endif
  150.  
  151. /* uses <varargs.h> instead of <stdarg.h> */
  152. #ifndef  HAVE_STDARG_H    
  153. #define  HAVE_STDARG_H        0
  154. #endif
  155.  
  156. /* has <string.h>, 
  157.    doesn't have <stdlib.h>  
  158.    has <fcntl.h>
  159. */
  160.  
  161. #ifndef  HAVE_STRING_H
  162. #define  HAVE_STRING_H        1
  163. #endif
  164.  
  165. #ifndef  HAVE_STDLIB_H
  166. #define  HAVE_STDLIB_H        0
  167. #endif
  168.  
  169. #ifndef  HAVE_FCNTL_H
  170. #define  HAVE_FCNTL_H        1
  171. #endif
  172.  
  173. /* have pipes */
  174. #ifndef  HAVE_REAL_PIPES
  175. #define  HAVE_REAL_PIPES    1
  176. #endif
  177.  
  178. #ifndef  HAVE_FAKE_PIPES    
  179. #define  HAVE_FAKE_PIPES    0
  180. #endif
  181.  
  182. /* don't have strerror() */
  183. #ifndef  HAVE_STRERROR
  184. #define  HAVE_STRERROR        0
  185. #endif
  186.  
  187. #ifndef  SET_PROGNAME
  188. #define  SET_PROGNAME()        { char *strrchr() , *p ;\
  189.                                   p = strrchr(argv[0],'/') ;\
  190.                   progname = p ? p+1 : argv[0] ; }
  191. #endif
  192.                   
  193.                   
  194.  
  195. /*------------- machine ------------------------*/
  196.  
  197. /* ints are 32bits, two complement */
  198. #ifndef  MAX__INT     
  199. #define  MAX__INT    0x7fffffff
  200. #define  INT_FMT    "%d"
  201. #endif
  202.  
  203. #ifndef  MAX__LONG
  204. #define  MAX__LONG    0x7fffffff
  205. #endif
  206.  
  207. #if  MAX__INT <= 0x7fff
  208. #define  SHORT_INTS
  209. #define  INT_FMT    "%ld"
  210. #endif
  211.  
  212.  
  213. /* default is IEEE754 and data space is not scarce */
  214.  
  215. #ifndef  FPE_TRAPS_ON
  216. #define  FPE_TRAPS_ON        0
  217. #endif
  218.  
  219. #ifndef   NOINFO_SIGFPE
  220. #define   NOINFO_SIGFPE        0
  221. #endif
  222.  
  223. #if   ! FPE_TRAPS_ON
  224. #undef   NOINFO_SIGFPE  
  225. #define  NOINFO_SIGFPE          0 /* make sure no one does
  226.                      something stupid */
  227. #endif
  228.  
  229.  
  230. #if      NOINFO_SIGFPE
  231. #define  CHECK_DIVZERO(x)    if( (x) == 0.0 )rt_error(dz_msg);else
  232. #endif
  233.  
  234. /* SW_FP_CHECK is specific to V7 and XNX23A
  235.     (1) is part of STDC_MATHERR def.
  236.     (2) enables calls to XENIX-68K 2.3A clrerr(), iserr()
  237.  */
  238. #ifndef  SW_FP_CHECK
  239. #define  SW_FP_CHECK        0
  240. #endif
  241.  
  242. #ifndef  TURN_OFF_FPE_TRAPS
  243. #define  TURN_OFF_FPE_TRAPS()    /* nothing */
  244. #endif
  245.  
  246. #ifndef  TURN_ON_FPE_TRAPS
  247. #define  TURN_ON_FPE_TRAPS()    /* nothing */
  248. #endif
  249.  
  250. #ifndef  HAVE_SMALL_MEMORY
  251. #define  HAVE_SMALL_MEMORY    0
  252. #endif
  253.  
  254.  
  255. /*------------------------------------------------*/
  256.  
  257.  
  258.  
  259.  
  260. /* the painfull case: we need to catch fpe's and look at errno
  261.    after lib calls */
  262.  
  263. #define  STDC_MATHERR    ((SW_FP_CHECK || FPE_TRAPS_ON) && HAVE_MATHERR==0)
  264.  
  265.  
  266.  
  267. #if  HAVE_PROTOS
  268. #define  PROTO(name, args)  name  args
  269. #else
  270. #define  PROTO(name, args)  name()
  271. #endif
  272.  
  273.  
  274. /* for Think C on the Macintosh, sizeof(size_t) != sizeof(unsigned
  275.  * Rather than unilaterally imposing size_t, when not all compilers would
  276.  * necessarily have it defined, we use the SIZE_T() macro where appropriate
  277.  * to typecast function arguments
  278.  */
  279. #ifndef SIZE_T
  280. #define SIZE_T(x) (x)
  281. #endif
  282.