/* compiler specific defines */
/* this file is guaranteed to be included exactly once if you include
   anything at all. all site-dependent or compiler-dependent stuff
   should go here!!!
 */

#ifndef _COMPILER_H
#define _COMPILER_H

/* symbols to identify the type of compiler */
#ifdef SOZOBON
#define __SOZOBON__
#endif

/* general library stuff */
/* __SIZE_TYPEDEF__: 	the type returned by sizeof() */
/* __PTRDIFF_TYPEDEF__: the type of the difference of two pointers */
/* __WCHAR_TYPEDEF__: 	wide character type (i.e. type of L'x') */
/* __EXITING: the type of a function that exits */
/* symbols to report about compiler features */
/* #define __NEED_VOID__	compiler doesn't have a void type */
/* #define __MSHORT__		compiler uses 16 bit integers */
/* (note that gcc and C68 define this automatically when appropriate) */

#ifdef __GNUC__
#define __SIZE_TYPEDEF__ unsigned long
#define __PTRDIFF_TYPEDEF__ long
#define __WCHAR_TYPEDEF__ int
#define __EXITING volatile void
#ifndef __NO_INLINE__
# define __GNUC_INLINE__
#endif
#endif

#ifdef __C68__
#define __SIZE_TYPEDEF__ unsigned long
#define __PTRDIFF_TYPEDEF__ long
#define __WCHAR_TYPEDEF__ char
#define __EXITING void
#endif

#ifdef __SOZOBON__
/*
 * Temporary hacks to overcome 1.33i's short symbol names. Hopefully future
 * versions will allow the extended Sozobon symbol format.
 */
#define _mallocChunkSize _sc_mCS
#define _malloczero _sc_mz
#define _console_read_byte _sc_crb
#define _console_write_byte _sc_cwb

/* Doesn't know (void *) is special (but can handle it); this works better. */
#define __NULL (0L)

#ifdef OLD_SOZOBON
#define void char
#endif

#define __SIZE_TYPEDEF__ unsigned int
#define __PTRDIFF_TYPEDEF__ long
#define __WCHAR_TYPEDEF__ char
#define __EXITING void
#define __MSHORT__
#endif

/* these are common to all compilers on the ST, I think */
#define __VA_LIST__ char *

#ifndef __NULL
#  ifdef __MSHORT__
#    define __NULL ((void *)0)
#  else
     /* avoid complaints about misuse of NULL :-) */
#    define __NULL (0)
#  endif
#endif

#ifdef __cplusplus
# define __EXTERN
# define __PROTO(x) x
#else
# ifdef __STDC__
#  ifndef __NO_PROTO__
#    define __PROTO(x) x
#  endif
#  define __EXTERN
# else
#  define __EXTERN extern
/*
 * fudge non-ANSI compilers to be like ANSI
 */
#  define const
#  define volatile

#  ifdef __NEED_VOID__
typedef char void;	/* so that (void *) is the same as (char *) */
	/* also lets us know that foo() {...} and void foo() {...} are
	   different */
#  endif
# endif /* __STDC__ */
#endif /* __cplusplus */

#ifndef __PROTO
#define __PROTO(x) ()
#endif

/* macros for POSIX support */
#define _UID_T unsigned short
#define _GID_T unsigned short
#define _PID_T int

#endif /* _COMPILER_H */
