/* 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

/* symbol to identify the library itself. this should _always_ be defined */
#ifndef __MINT__
#define __MINT__
#endif

/* 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__
#define void char
	/* sozobon knows about void, but void * confuses it a bit */
#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 *
#ifdef __MSHORT__
#define __NULL ((void *)0)
#else
/* avoid complaints about misuse of NULL by silly programmers */
#define __NULL (0)
#endif

#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__ */

#ifndef __PROTO
#define __PROTO(x) ()
#endif

#endif /* _COMPILER_H */
