2017-02-27 22:23:06 +00:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 2014-2017 Carsten Sonne Larsen <cs@innolan.net>
|
2015-03-08 22:14:50 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
2017-02-27 22:31:21 +00:00
|
|
|
* Project homepage:
|
|
|
|
* http://amath.innolan.net
|
|
|
|
*
|
2015-03-08 22:14:50 +00:00
|
|
|
*/
|
|
|
|
|
2017-02-27 22:23:06 +00:00
|
|
|
#ifndef AMATH_H
|
|
|
|
#define AMATH_H
|
|
|
|
/******************************************************************************/
|
2015-04-01 12:43:50 +00:00
|
|
|
#ifdef __AMIGA__
|
2015-04-07 16:51:26 +00:00
|
|
|
# ifndef AOS3
|
|
|
|
# define AOS3
|
|
|
|
# endif
|
2015-04-01 12:43:50 +00:00
|
|
|
#endif
|
2017-02-27 22:23:06 +00:00
|
|
|
/******************************************************************************/
|
2015-04-01 12:43:50 +00:00
|
|
|
#ifdef __AROS__
|
2015-04-07 16:51:26 +00:00
|
|
|
# ifndef AROS
|
|
|
|
# define AROS
|
|
|
|
# endif
|
2015-04-01 12:43:50 +00:00
|
|
|
#endif
|
2017-02-27 22:23:06 +00:00
|
|
|
/******************************************************************************/
|
2015-04-01 12:43:50 +00:00
|
|
|
#ifdef __MORPHOS__
|
2015-04-07 16:51:26 +00:00
|
|
|
# ifndef MORPHOS
|
|
|
|
# define MORPHOS
|
|
|
|
# endif
|
2015-04-01 12:43:50 +00:00
|
|
|
#endif
|
2017-02-27 22:23:06 +00:00
|
|
|
/******************************************************************************/
|
2015-04-01 12:43:50 +00:00
|
|
|
#ifdef __amigaos4__
|
2015-04-07 16:51:26 +00:00
|
|
|
# ifndef AOS4
|
|
|
|
# define AOS4
|
|
|
|
# endif
|
2015-04-01 12:43:50 +00:00
|
|
|
#endif
|
2017-02-27 22:23:06 +00:00
|
|
|
/******************************************************************************/
|
2017-02-02 21:56:33 +00:00
|
|
|
#ifdef __HAIKU__
|
|
|
|
# ifndef HAIKU
|
|
|
|
# define HAIKU
|
|
|
|
# endif
|
|
|
|
#endif
|
2017-02-27 22:23:06 +00:00
|
|
|
/******************************************************************************/
|
2017-04-12 22:50:51 +00:00
|
|
|
#ifdef __APPLE__
|
|
|
|
# ifndef APPLE
|
|
|
|
# define APPLE
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
/******************************************************************************/
|
|
|
|
#if defined(_WIN32) || defined(_WIN64)
|
2017-03-24 19:09:05 +00:00
|
|
|
# ifndef WINDOWS
|
|
|
|
# define WINDOWS
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
/******************************************************************************/
|
2015-04-01 12:43:50 +00:00
|
|
|
#if defined(AOS3) || defined(AOS4) || defined(AROS) || defined (MORPHOS)
|
2015-04-07 16:51:26 +00:00
|
|
|
# ifndef AMIGA
|
2017-02-02 21:56:33 +00:00
|
|
|
# define AMIGA
|
|
|
|
# endif
|
|
|
|
#endif
|
2017-02-27 22:23:06 +00:00
|
|
|
/******************************************************************************/
|
2017-02-02 21:56:33 +00:00
|
|
|
#if defined(unix) || defined(__unix__) || defined(__unix)
|
|
|
|
# ifndef UNIX
|
|
|
|
# define UNIX
|
2015-04-07 16:51:26 +00:00
|
|
|
# endif
|
2017-02-02 21:56:33 +00:00
|
|
|
#endif
|
2017-02-27 22:23:06 +00:00
|
|
|
/******************************************************************************/
|
2017-04-12 22:50:51 +00:00
|
|
|
#if defined(HAIKU) || defined(UNIX) || defined(APPLE) || defined(_POSIX_VERSION)
|
2017-03-24 19:09:05 +00:00
|
|
|
# ifndef POSIX
|
|
|
|
# define POSIX
|
2015-04-07 19:18:39 +00:00
|
|
|
# endif
|
2017-02-02 21:56:33 +00:00
|
|
|
#endif
|
2017-02-27 22:23:06 +00:00
|
|
|
/******************************************************************************/
|
2017-03-24 19:09:05 +00:00
|
|
|
#if !defined(AMIGA) && !defined(POSIX) && !defined(WINDOWS)
|
|
|
|
# ifndef STDC_CONSOLE
|
|
|
|
# define STDC_CONSOLE
|
|
|
|
# endif
|
2017-02-02 21:56:33 +00:00
|
|
|
#endif
|
2017-02-27 22:23:06 +00:00
|
|
|
/******************************************************************************/
|
2017-03-24 19:09:05 +00:00
|
|
|
#if defined(POSIX)
|
2017-02-04 13:41:34 +00:00
|
|
|
# include <stdint.h>
|
2015-04-07 16:51:26 +00:00
|
|
|
# include <unistd.h>
|
2015-04-07 17:57:28 +00:00
|
|
|
# include <dirent.h>
|
2015-04-01 12:43:50 +00:00
|
|
|
#endif
|
2017-02-27 22:23:06 +00:00
|
|
|
/******************************************************************************/
|
2017-03-24 19:09:05 +00:00
|
|
|
#if defined(WINDOWS)
|
2015-04-07 16:51:26 +00:00
|
|
|
# include <stdint.h>
|
2017-02-02 21:56:33 +00:00
|
|
|
#endif
|
2017-02-27 22:23:06 +00:00
|
|
|
/******************************************************************************/
|
2017-03-24 19:09:05 +00:00
|
|
|
#if defined(AOS3)
|
2017-02-02 21:56:33 +00:00
|
|
|
# include <sys/types.h>
|
2017-03-11 22:37:45 +00:00
|
|
|
# define IPTR LONG*
|
|
|
|
# define uintptr_t uint32_t
|
|
|
|
typedef u_int8_t uint8_t;
|
|
|
|
typedef u_int16_t uint16_t;
|
|
|
|
typedef u_int32_t uint32_t;
|
|
|
|
typedef u_int64_t uint64_t;
|
2015-04-14 12:00:01 +00:00
|
|
|
#endif
|
2017-02-27 22:23:06 +00:00
|
|
|
/******************************************************************************/
|
2017-04-12 22:50:51 +00:00
|
|
|
#if defined(AROS) || defined(MORPHOS) || defined(AOS4) || defined(APPLE)
|
2017-02-27 22:23:06 +00:00
|
|
|
# include <stdint.h>
|
|
|
|
# include <sys/types.h>
|
2017-02-10 21:29:49 +00:00
|
|
|
#endif
|
2017-02-27 22:23:06 +00:00
|
|
|
/******************************************************************************/
|
2017-03-24 19:09:05 +00:00
|
|
|
#if (__cplusplus <= 199711L && !defined(WINDOWS)) || !defined(__cplusplus)
|
2017-04-12 22:50:51 +00:00
|
|
|
#ifndef nullptr
|
2017-02-27 22:23:06 +00:00
|
|
|
#define nullptr 0
|
2017-04-12 22:50:51 +00:00
|
|
|
#endif
|
2017-03-24 19:09:05 +00:00
|
|
|
#elif (__cplusplus <= 199711L) && (defined(__GNUC__) || defined(__GNUG__))
|
2017-04-12 22:50:51 +00:00
|
|
|
#ifndef nullptr
|
2017-02-27 22:23:06 +00:00
|
|
|
#define nullptr 0
|
|
|
|
#endif
|
2017-04-12 22:50:51 +00:00
|
|
|
#endif
|
|
|
|
/******************************************************************************/
|
|
|
|
#define assert(x)
|
2017-02-27 22:23:06 +00:00
|
|
|
/******************************************************************************/
|
2017-02-02 21:56:33 +00:00
|
|
|
/* Compilers*/
|
2017-01-10 19:58:47 +00:00
|
|
|
#if defined(__clang__)
|
|
|
|
/* Clang */
|
|
|
|
# if defined(__apple_build_version__)
|
|
|
|
# define COMP_NAME "XCode Clang"
|
|
|
|
# else
|
|
|
|
# define COMP_NAME "Clang/LLVM"
|
|
|
|
# endif
|
|
|
|
# define str(x) #x
|
|
|
|
# define CL_VER_STR(x) str(x)
|
|
|
|
# ifdef __clang_patchlevel__
|
|
|
|
# define COMP_VERS CL_VER_STR(__clang_major__) DOT \
|
|
|
|
CL_VER_STR(__clang_minor__) DOT \
|
|
|
|
CL_VER_STR(__clang_patchlevel__)
|
|
|
|
# else
|
|
|
|
# define COMP_VERS CL_VER_STR(__clang_major__) DOT \
|
|
|
|
CL_VER_STR(__clang_minor__)
|
|
|
|
# endif
|
2017-02-02 21:56:33 +00:00
|
|
|
|
2017-01-10 19:58:47 +00:00
|
|
|
/* Intel ICC/ICPC */
|
|
|
|
#elif defined(__ECC) || defined(__ICC) || defined(__INTEL_COMPILER)
|
|
|
|
# define COMP_NAME "Intel ICC/ICPC"
|
|
|
|
# define COMP_VERS __VERSION__
|
2017-02-02 21:56:33 +00:00
|
|
|
|
2017-01-10 19:58:47 +00:00
|
|
|
/* IBM XL C/C++ */
|
|
|
|
#elif defined(__IBMC__) || defined(__IBMCPP__)
|
|
|
|
# define COMP_NAME "IBM XL"
|
|
|
|
# define COMP_VERS __xlc__
|
2017-02-02 21:56:33 +00:00
|
|
|
|
2017-01-10 19:58:47 +00:00
|
|
|
/* Microsoft Visual Studio */
|
|
|
|
#elif defined(_MSC_VER)
|
2017-01-11 19:13:41 +00:00
|
|
|
# define COMP_NAME "MSVC++"
|
|
|
|
# if (_MSC_VER == 1100)
|
|
|
|
# define COMP_VERS "5.0"
|
|
|
|
# elif (_MSC_VER == 1200)
|
|
|
|
# define COMP_VERS "6.0"
|
|
|
|
# elif (_MSC_VER == 1300)
|
|
|
|
# define COMP_VERS "7.0"
|
|
|
|
# elif (_MSC_VER == 1310)
|
|
|
|
# define COMP_VERS "7.1"
|
|
|
|
# elif (_MSC_VER == 1400)
|
|
|
|
# define COMP_VERS "8.0"
|
|
|
|
# elif (_MSC_VER == 1500)
|
|
|
|
# define COMP_VERS "9.0"
|
|
|
|
# elif (_MSC_VER == 1600)
|
|
|
|
# define COMP_VERS "10.0"
|
|
|
|
# elif (_MSC_VER == 1700)
|
|
|
|
# define COMP_VERS "11.0"
|
|
|
|
# elif (_MSC_VER == 1800)
|
|
|
|
# define COMP_VERS "12.0"
|
|
|
|
# elif (_MSC_VER == 1900)
|
|
|
|
# define COMP_VERS "14.0"
|
|
|
|
# elif (_MSC_VER > 1900)
|
|
|
|
# define COMP_VERS "15.0+"
|
|
|
|
# else
|
|
|
|
# define str(x) #x
|
|
|
|
# define MSC_VER_STR(x) str(x)
|
|
|
|
# define COMP_VERS MSC_VER_STR(_MSC_VER)
|
|
|
|
# endif
|
2017-02-02 21:56:33 +00:00
|
|
|
|
2017-01-10 19:58:47 +00:00
|
|
|
/* Portland Group PGCC/PGCPP */
|
|
|
|
#elif defined(__PGI)
|
|
|
|
# define COMP_NAME "PGCC/PGCPP"
|
|
|
|
# define str(x) #x
|
|
|
|
# define PGCC_VER_STR(x) str(x)
|
|
|
|
# ifdef __PGIC_PATCHLEVEL__
|
|
|
|
# define COMP_VERS PGCC_VER_STR(__PGIC__) DOT \
|
|
|
|
PGCC_VER_STR(__PGIC_MINOR) DOT \
|
|
|
|
PGCC_VER_STR(__PGIC_PATCHLEVEL__)
|
|
|
|
# else
|
|
|
|
# define COMP_VERS PGCC_VER_STR(__PGIC__) DOT \
|
|
|
|
PGCC_VER_STR(__PGIC_MINOR)
|
|
|
|
# endif
|
2017-02-02 21:56:33 +00:00
|
|
|
|
2017-01-10 19:58:47 +00:00
|
|
|
/* GNU GCC/G++ */
|
|
|
|
#elif defined(__GNUC__) || defined(__GNUG__)
|
|
|
|
# define COMP_NAME "GCC"
|
|
|
|
# define str(x) #x
|
|
|
|
# define GCC_VER_STR(x) str(x)
|
|
|
|
# ifdef __GNUC_PATCHLEVEL__
|
|
|
|
# define COMP_VERS GCC_VER_STR(__GNUC__) DOT GCC_VER_STR(__GNUC_MINOR__) DOT \
|
|
|
|
GCC_VER_STR(__GNUC_PATCHLEVEL__)
|
|
|
|
# else
|
|
|
|
# define COMP_VERS GCC_VER_STR(__GNUC__) DOT GCC_VER_STR(__GNUC_MINOR__)
|
|
|
|
# endif
|
|
|
|
#endif
|
2017-02-27 22:23:06 +00:00
|
|
|
/******************************************************************************/
|
|
|
|
#define EMPTYSTRING ""
|
|
|
|
#define SPACE " "
|
|
|
|
#define DOT "."
|
|
|
|
/******************************************************************************/
|
2017-04-12 22:50:51 +00:00
|
|
|
#if defined(WINDOWS)
|
2017-02-27 22:23:06 +00:00
|
|
|
#define NEWLINE "\r\n"
|
2017-04-12 22:50:51 +00:00
|
|
|
#elif defined(APPLE)
|
|
|
|
#define NEWLINE "\r"
|
2017-02-27 22:23:06 +00:00
|
|
|
#else
|
|
|
|
#define NEWLINE "\n"
|
|
|
|
#endif
|
|
|
|
/******************************************************************************/
|
|
|
|
#ifndef __cplusplus
|
|
|
|
typedef int bool;
|
|
|
|
#define true 1
|
|
|
|
#define false 0
|
|
|
|
#endif
|
|
|
|
/******************************************************************************/
|
|
|
|
#define LONG_BIT 32
|
|
|
|
#define wsize sizeof(unsigned int)
|
|
|
|
#define wmask (wsize - 1)
|
|
|
|
/******************************************************************************/
|
|
|
|
#if defined(INTELCPU) || defined(i386) || defined(i486) || \
|
|
|
|
defined(intel) || defined(x86) || defined(i86pc) || \
|
|
|
|
defined(__i386__) || defined(_M_IX86)
|
|
|
|
# ifdef TXTCPU
|
|
|
|
# undef TXTCPU
|
|
|
|
# endif
|
|
|
|
# define TXTCPU "i386"
|
|
|
|
#endif
|
|
|
|
#if defined(__x86_64__) || defined(_M_AMD64)
|
|
|
|
# define TXTCPU "amd64"
|
|
|
|
#endif
|
|
|
|
/******************************************************************************/
|
|
|
|
#if defined(__powerpc__) || defined(__powerpc64__)
|
|
|
|
# define TXTCPU "PowerPC"
|
|
|
|
#endif
|
|
|
|
/******************************************************************************/
|
|
|
|
#if defined(__arm__) || defined(_M_ARM) || defined(__ARM_ARCH_6__)
|
|
|
|
# define TXTCPU "arm"
|
|
|
|
#endif
|
|
|
|
#if defined(__aarch64__) || defined(_M_ARM64)
|
|
|
|
# define TXTCPU "arm64"
|
|
|
|
#endif
|
|
|
|
/******************************************************************************/
|
|
|
|
#if defined(m68060) || defined(mc68060)
|
|
|
|
# define TXTCPU "68060"
|
|
|
|
#elif defined(m68040) || defined(mc68040)
|
|
|
|
# define TXTCPU "68040"
|
|
|
|
#elif defined(m68030) || defined(mc68030)
|
|
|
|
# define TXTCPU "68030"
|
|
|
|
#elif defined(m68020) || defined(mc68020)
|
|
|
|
# define TXTCPU "68020"
|
|
|
|
#elif defined(m68010) || defined(mc68010)
|
|
|
|
# define TXTCPU "68010"
|
|
|
|
#elif defined(m68000) || defined(mc68000)
|
|
|
|
# define TXTCPU "68000+"
|
|
|
|
#endif
|
|
|
|
/******************************************************************************/
|
|
|
|
#ifndef TXTCPU
|
|
|
|
//#error what cpu is this ?!
|
|
|
|
# define TXTCPU EMPTYSTRING
|
|
|
|
#endif
|
|
|
|
/******************************************************************************/
|
|
|
|
#if defined(TXTCPU) && defined(__HAVE_68881__)
|
|
|
|
# define TXTFPU SPACE "FPU"
|
|
|
|
#else
|
|
|
|
# define TXTFPU EMPTYSTRING
|
|
|
|
#endif
|
|
|
|
/******************************************************************************/
|
|
|
|
#define TXTARCH TXTCPU TXTFPU
|
2017-04-12 22:50:51 +00:00
|
|
|
#define RELDATESTAMP "(13-04-2017)"
|
|
|
|
#define TXTDOSVERSION "\0$VER: amath 1.80" SPACE RELDATESTAMP SPACE TXTARCH
|
|
|
|
#define TXTTITLE "amath version 1.8.0"
|
2017-02-27 22:23:06 +00:00
|
|
|
#define TXTCOPYRIGHT "(c) 2017 Carsten Sonne Larsen"
|
|
|
|
#define TXTSTARTMSG TXTTITLE SPACE TXTCOPYRIGHT
|
|
|
|
/******************************************************************************/
|
|
|
|
#define TXTVERSMSG TXTTITLE SPACE RELDATESTAMP SPACE TXTARCH
|
2017-04-12 22:50:51 +00:00
|
|
|
#define TXTCOMPMSG "Compiled with " COMP_NAME SPACE COMP_VERS
|
2017-02-27 22:23:06 +00:00
|
|
|
/******************************************************************************/
|
|
|
|
#define CPROCNAME "amath_console"
|
|
|
|
/******************************************************************************/
|
|
|
|
#if defined(AMIGA)
|
|
|
|
#define AMIGADOS_NAME "dos.library"
|
|
|
|
#define AMIGADOS_REV 33L
|
|
|
|
#define INTUITION_REV 37L
|
|
|
|
#define INTUITION_NAME "intuition.library"
|
|
|
|
#define GRAPHICS_REV 37L
|
|
|
|
#define GRAPHICS_NAME "graphics.library"
|
|
|
|
#define LOCALE_REV 38L
|
|
|
|
#define LOCALE_NAME "locale.library"
|
|
|
|
#define DEVCONSOLE "console.device"
|
|
|
|
#define PORTCR "RKM.console.read"
|
|
|
|
#define PORTCW "RKM.console.write"
|
|
|
|
#define CATALOG_HELP "amath-help.catalog"
|
|
|
|
#define CATALOG_IDEN "amath-ident.catalog"
|
|
|
|
#define CATALOG_TEXT "amath-text.catalog"
|
|
|
|
#define CATALOG_KEYW "amath-keyword.catalog"
|
|
|
|
#define CATALOG_DEF OC_BuiltInLanguage, "english"
|
|
|
|
#endif
|
|
|
|
/******************************************************************************/
|
|
|
|
#endif
|