Detect system name

This commit is contained in:
Carsten Sonne Larsen 2018-08-12 23:22:44 +02:00
parent 49b36ce2a3
commit aeb7f2e92c
2 changed files with 64 additions and 5 deletions

View File

@ -31,42 +31,91 @@
#define AMATH_H #define AMATH_H
/******************************************************************************/ /******************************************************************************/
#ifdef __AMIGA__ #ifdef __AMIGA__
# define SYS_NAME "AmigaOS 3"
# ifndef AOS3 # ifndef AOS3
# define AOS3 # define AOS3
# endif # endif
#endif #endif
/******************************************************************************/ /******************************************************************************/
#ifdef __AROS__ #ifdef __AROS__
# define SYS_NAME "Aros"
# ifndef AROS # ifndef AROS
# define AROS # define AROS
# endif # endif
#endif #endif
/******************************************************************************/ /******************************************************************************/
#ifdef __MORPHOS__ #ifdef __MORPHOS__
# define SYS_NAME "MorphOS"
# ifndef MORPHOS # ifndef MORPHOS
# define MORPHOS # define MORPHOS
# endif # endif
#endif #endif
/******************************************************************************/ /******************************************************************************/
#ifdef __amigaos4__ #ifdef __amigaos4__
# define SYS_NAME "AmigaOS 4"
# ifndef AOS4 # ifndef AOS4
# define AOS4 # define AOS4
# endif # endif
#endif #endif
/******************************************************************************/ /******************************************************************************/
#ifdef __HAIKU__ #ifdef __HAIKU__
# define SYS_NAME "Haiku"
# ifndef HAIKU # ifndef HAIKU
# define HAIKU # define HAIKU
# endif # endif
#endif #endif
/******************************************************************************/ /******************************************************************************/
#ifdef __APPLE__ #ifdef __APPLE__
# define SYS_NAME "Apple"
# ifndef APPLE # ifndef APPLE
# define APPLE # define APPLE
# endif # endif
#endif #endif
/******************************************************************************/ /******************************************************************************/
#if defined(_WIN32) || defined(_WIN64) #ifdef __FreeBSD__
# define SYS_NAME "FreeBSD"
# ifndef FREEBSD
# define FREEBSD
# endif
#endif
/******************************************************************************/
#ifdef __NetBSD__
# define SYS_NAME "NetBSD"
# ifndef NETBSD
# define NETBSD
# endif
#endif
/******************************************************************************/
#ifdef __OpenBSD__
# define SYS_NAME "OpenBSD"
# ifndef OPENBSD
# define OPENBSD
# endif
#endif
/******************************************************************************/
#ifdef __DragonFly__
# define SYS_NAME "DragonFly BSD"
# ifndef DRAGONFLY
# define DRAGONFLY
# endif
#endif
/******************************************************************************/
#ifdef __linux__
# define SYS_NAME "Linux"
# ifndef LINUX
# define LINUX
# endif
#endif
/******************************************************************************/
#ifdef _WIN32
# define SYS_NAME "Windows"
# ifndef WINDOWS
# define WINDOWS
# endif
#endif
/******************************************************************************/
#ifdef _WIN64
# define SYS_NAME "Windows 64 bit"
# ifndef WINDOWS # ifndef WINDOWS
# define WINDOWS # define WINDOWS
# endif # endif
@ -82,6 +131,9 @@
# ifndef UNIX # ifndef UNIX
# define UNIX # define UNIX
# endif # endif
# ifndef SYS_NAME
# define SYS_NAME "Unix variant"
# endif
#endif #endif
/******************************************************************************/ /******************************************************************************/
#if defined(HAIKU) || defined(UNIX) || defined(APPLE) #if defined(HAIKU) || defined(UNIX) || defined(APPLE)
@ -290,6 +342,13 @@ typedef int bool;
#define TXTVERSMSG TXTTITLE SPACE RELDATESTAMP SPACE TXTARCH #define TXTVERSMSG TXTTITLE SPACE RELDATESTAMP SPACE TXTARCH
#define TXTCOMPMSG "Compiled with " COMP_NAME SPACE COMP_VERS #define TXTCOMPMSG "Compiled with " COMP_NAME SPACE COMP_VERS
/******************************************************************************/ /******************************************************************************/
#ifdef SYS_NAME
# define TXTSYSMSG TXTCOMPMSG " for " SYS_NAME
# define SYSKNOWN 1
#else
# define TXTSYSMSG TXTCOMPMSG
#endif
/******************************************************************************/
#define CPROCNAME "amath_console" #define CPROCNAME "amath_console"
/******************************************************************************/ /******************************************************************************/
#if defined(AMIGA) #if defined(AMIGA)

View File

@ -34,7 +34,7 @@
#include "loc/text.h" #include "loc/text.h"
static const char *version = TXTVERSMSG; static const char *version = TXTVERSMSG;
static const char *compiler = TXTCOMPMSG; static const char *systemName = TXTSYSMSG;
static const char *about = NEWLINE NEWLINE static const char *about = NEWLINE NEWLINE
"amath features a case sensitive command line interface, internal IEEE 754" NEWLINE "amath features a case sensitive command line interface, internal IEEE 754" NEWLINE
"calculations with 15 significant digits, calculations with real and complex" NEWLINE "calculations with 15 significant digits, calculations with real and complex" NEWLINE
@ -94,7 +94,7 @@ const char * ConsoleBase::GetVersionText()
const char *ConsoleBase::GetCompilerText() const char *ConsoleBase::GetCompilerText()
{ {
return compiler; return systemName;
} }
bool ConsoleBase::Open() bool ConsoleBase::Open()
@ -166,7 +166,7 @@ void ConsoleBase::ShowVersion()
WriteString(version); WriteString(version);
ResetConsole(); ResetConsole();
WriteString(NEWLINE); WriteString(NEWLINE);
WriteString(compiler); WriteString(systemName);
WriteString(NEWLINE); WriteString(NEWLINE);
ResetConsole(); ResetConsole();
} }
@ -177,7 +177,7 @@ void ConsoleBase::ShowAbout()
WriteString(version); WriteString(version);
ResetConsole(); ResetConsole();
WriteString(NEWLINE); WriteString(NEWLINE);
WriteString(compiler); WriteString(systemName);
ResetConsole(); ResetConsole();
WriteString(about); WriteString(about);
ResetConsole(); ResetConsole();