From c2be98c23ee9114f1f4d1842222bc1ba3be136ee Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Wed, 14 Sep 2022 20:56:56 +0300 Subject: [PATCH] invent and use a XMP_AMIGA macro. --- src/commands.c | 7 +++---- src/common.h | 5 +++++ src/main.c | 2 +- src/read_config.c | 4 ++-- src/terminal.c | 6 +++--- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/commands.c b/src/commands.c index 75c2553..b875c9c 100644 --- a/src/commands.c +++ b/src/commands.c @@ -10,7 +10,7 @@ #if defined(_WIN32) || defined(__OS2__) || defined(__DJGPP__) || defined(_DOS) #include #endif -#if defined(AMIGA) || defined(__AMIGA__) || defined(__AROS__) +#if defined(XMP_AMIGA) #ifdef __amigaos4__ #define __USE_INLINE__ #endif @@ -22,7 +22,6 @@ #ifdef __CYGWIN__ #include - /* * from daniel åkerud * date Tue, Jul 28, 2009 at 9:59 AM @@ -36,7 +35,7 @@ * typed out when running xmp. I have not investigated why this is * happening, but there is of course a reason why this mode is not * enabled by default. - * + * * 2. Do a select() before read()ing if the platform is Cygwin. * This makes Cygwin builds work out of the box with no fiddling around, * but does impose a neglectible cpu overhead (for Cygwin builds only). @@ -72,7 +71,7 @@ static int read_key(void) key = getch(); ret = 1; } -#elif defined(AMIGA) || defined(__AMIGA__) || defined(__AROS__) +#elif defined(XMP_AMIGA) /* Amiga CLI */ { BPTR in = Input(); diff --git a/src/common.h b/src/common.h index 6bce855..6f8fa88 100644 --- a/src/common.h +++ b/src/common.h @@ -11,6 +11,11 @@ #define getch _getch #endif +#if defined(__MORPHOS__) || defined(__AROS__) || defined(__AMIGA__) \ + || defined(__amigaos__) || defined(__amigaos4__) || defined(AMIGA) +#define XMP_AMIGA 1 +#endif + #define NUM_MODES 13 #define MAX_DRV_PARM 20 diff --git a/src/main.c b/src/main.c index 2e3d7d5..9bb8f18 100644 --- a/src/main.c +++ b/src/main.c @@ -105,7 +105,7 @@ static void sigcont_handler(int sig) } #else foreground_in = foreground_out = 1; - #if defined(AMIGA) || defined(__AMIGA__) || defined(__AROS__) + #if defined(XMP_AMIGA) set_tty(); /* amiga version -- sets stdin to raw mode. */ #endif #endif diff --git a/src/read_config.c b/src/read_config.c index 796c118..e45f931 100644 --- a/src/read_config.c +++ b/src/read_config.c @@ -54,7 +54,7 @@ int read_config(struct options *o) return -1; } } -#elif defined(AMIGA) || defined(__AMIGA__) || defined(__AROS__) +#elif defined(XMP_AMIGA) strncpy(myrc, "PROGDIR:xmp.conf", PATH_MAX); if ((rc = fopen(myrc, "r")) == NULL) @@ -291,7 +291,7 @@ void read_modconf(struct options *o, const unsigned char *md5) snprintf(myrc, PATH_MAX, "%s\\modules.conf", home); parse_modconf(o, "xmp-modules.conf", md5); parse_modconf(o, myrc, md5); -#elif defined(AMIGA) || defined(__AMIGA__) || defined(__AROS__) +#elif defined(XMP_AMIGA) parse_modconf(o, "PROGDIR:modules.conf", md5); #elif defined _WIN32 char myrc[PATH_MAX]; diff --git a/src/terminal.c b/src/terminal.c index 05f23a6..2c0fb4c 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -10,7 +10,7 @@ #include #include "common.h" -#if defined(AMIGA) || defined(__AMIGA__) || defined(__AROS__) +#if defined(XMP_AMIGA) #ifdef __amigaos4__ #define __USE_INLINE__ #endif @@ -29,7 +29,7 @@ static struct termios term; int set_tty(void) { -#if defined(AMIGA) || defined(__AMIGA__) || defined(__AROS__) +#if defined(XMP_AMIGA) SetMode(Input(), MODE_RAW); #elif defined HAVE_TERMIOS_H @@ -53,7 +53,7 @@ int set_tty(void) int reset_tty(void) { -#if defined(AMIGA) || defined(__AMIGA__) || defined(__AROS__) +#if defined(XMP_AMIGA) SetMode(Input(), MODE_NORMAL); #elif defined HAVE_TERMIOS_H