 /* 
  * UAE - The Un*x Amiga Emulator
  * 
  * cpp magic
  * 
  * Copyright 1995, 1996 Bernd Schmidt, Ed Hanway
  */

typedef enum { KBD_LANG_US, KBD_LANG_DE } KbdLang;

extern int framerate;
extern bool produce_sound;
extern bool dont_want_aspect;
extern bool use_fast_draw;
extern bool use_debugger;
extern bool use_slow_mem;
extern bool use_fast_mem;
extern bool automount_uaedev;
extern KbdLang keyboard_lang;
#ifdef __DOS__
extern bool use_dos_hicolor;
#endif

#undef DEFAULT_NO_ASPECT
#ifdef DEFAULT_WANT_ASPECT
#define DEFAULT_NO_ASPECT false
#else
#define DEFAULT_NO_ASPECT true
#endif

#undef DEFAULT_KBD_LANG
#ifdef DEFAULT_KBD_LANG_DE
#define DEFAULT_KBD_LANG KBD_LANG_DE
#else
#define DEFAULT_KBD_LANG KBD_LANG_US
#endif

#undef DEFAULT_WANT_SLOW_MEM
#ifdef DEFAULT_SLOW_MEM
#define DEFAULT_WANT_SLOW_MEM true
#else
#define DEFAULT_WANT_SLOW_MEM false
#endif

#undef DEFAULT_WANT_FAST_MEM
#ifdef DEFAULT_FAST_MEM
#define DEFAULT_WANT_FAST_MEM true
#else
#define DEFAULT_WANT_FAST_MEM false
#endif

#ifndef DEFAULT_FRAMERATE
#define DEFAULT_FRAMERATE 5
#endif

#undef HAVE_JOYSTICK
#ifdef LINUX_JOYSTICK
#define HAVE_JOYSTICK
#endif

#ifndef __GNUC__
#ifdef __cplusplus
#define __inline__ inline
#else
#define __inline__
#endif
#endif

#ifndef __unix
extern void parse_cmdline(int argc, char **argv);
#endif

#ifdef LOW_BANDWIDTH
#if !defined(X_16BIT_SCREEN) && !defined(X_8BIT_SCREEN)
#error The LOW_BANDWIDTH option requires that either X_16BIT_SCREEN or
#error X_8BIT_SCREEN are set. Please re-edit config.h
#endif
/* Experience tells that SHM isn't likely to work when connected to 
 * a remote X server */
#define DONT_WANT_SHM
#endif

/* Try to figure out whether we can __inline__ DrawPixel() */

#undef INLINE_DRAWPIXEL8
#undef INLINE_DRAWPIXEL16
#undef INLINE_DRAWPIXEL

#ifdef LINUX_SVGALIB

#define INLINE_DRAWPIXEL

#ifdef SVGALIB_8BIT_SCREEN
#define INLINE_DRAWPIXEL8
#else

#ifdef SVGALIB_16BIT_SCREEN
#define INLINE_DRAWPIXEL16
#else
#error You need to define either SVGALIB_8BIT_SCREEN or SVGALIB_16BIT_SCREEN.
#endif

#endif

#else /* not LINUX_SVGALIB */

#ifdef X_8BIT_SCREEN
#define INLINE_DRAWPIXEL8
#define INLINE_DRAWPIXEL
#else
#ifdef X_16BIT_SCREEN
#define INLINE_DRAWPIXEL16
#define INLINE_DRAWPIXEL
#endif
#endif

#endif /* not LINUX_SVGALIB */

#ifdef __mac__
/* Apparently, no memcpy :-/ */
static __inline__ void *memcpy(void *to, void *from, int size)
{
    BlockMove(from, to, size);
}
#endif

/* strdup() may be non-portable if you have a weird system */
static char *my_strdup(const char*s)
{
    char *x = (char*)malloc(strlen(s) + 1);
    strcpy(x, s);
    return x;
}

#undef INT_64BIT
#ifdef __alpha
#define INT_64BIT long int
#endif

#undef REGPARAM
#undef BIG_ALIGNMENT

#if defined(__GNUC_MINOR__)
#if __GNUC__ > 2 || __GNUC_MINOR__ > 6
#define BIG_ALIGNMENT __attribute__((aligned(16)))
#if defined(__i386__) && !defined(USE_PROFILING)
#define REGPARAM __attribute__((regparm(3)))
#endif /* __i386__ */
#endif /* GCC version 2.7 or higher */
#endif /* GCC 2 */

#ifndef REGPARAM
#define REGPARAM
#endif

#ifndef BIG_ALIGNMENT
#define BIG_ALIGNMENT
#endif
