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
/******************************************************************************/
#ifdef __AMIGA__
# define SYS_NAME "AmigaOS 3"
# ifndef AOS3
# define AOS3
# endif
#endif
/******************************************************************************/
#ifdef __AROS__
# define SYS_NAME "Aros"
# ifndef AROS
# define AROS
# endif
#endif
/******************************************************************************/
#ifdef __MORPHOS__
# define SYS_NAME "MorphOS"
# ifndef MORPHOS
# define MORPHOS
# endif
#endif
/******************************************************************************/
#ifdef __amigaos4__
# define SYS_NAME "AmigaOS 4"
# ifndef AOS4
# define AOS4
# endif
#endif
/******************************************************************************/
#ifdef __HAIKU__
# define SYS_NAME "Haiku"
# ifndef HAIKU
# define HAIKU
# endif
#endif
/******************************************************************************/
#ifdef __APPLE__
# define SYS_NAME "Apple"
# ifndef APPLE
# define APPLE
# 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
# define WINDOWS
# endif
@ -82,6 +131,9 @@
# ifndef UNIX
# define UNIX
# endif
# ifndef SYS_NAME
# define SYS_NAME "Unix variant"
# endif
#endif
/******************************************************************************/
#if defined(HAIKU) || defined(UNIX) || defined(APPLE)
@ -290,6 +342,13 @@ typedef int bool;
#define TXTVERSMSG TXTTITLE SPACE RELDATESTAMP SPACE TXTARCH
#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"
/******************************************************************************/
#if defined(AMIGA)

View File

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