From 00158241beb76e3c33756447caa7077c400d1163 Mon Sep 17 00:00:00 2001 From: Sami Vaarala Date: Wed, 23 Feb 2022 15:29:57 +0200 Subject: [PATCH] Add DJGPP platform support * Add DUK_F_DJGPP.h.in to detect and provide DJGPP convenience defines. * Add a separate platform for MSDOS, now supporting DJGPP only. * Add DJGPP identification to compiler_gcc.h.in. --- config/compilers/compiler_gcc.h.in | 2 ++ config/helper-snippets/DUK_F_DJGPP.h.in | 12 ++++++++++++ config/helper-snippets/DUK_F_MSDOS.h.in | 3 +++ config/platforms.yaml | 4 ++++ config/platforms/platform_msdos.h.in | 19 +++++++++++++++++++ releases/releases.yaml | 1 + 6 files changed, 41 insertions(+) create mode 100644 config/helper-snippets/DUK_F_DJGPP.h.in create mode 100644 config/helper-snippets/DUK_F_MSDOS.h.in create mode 100644 config/platforms/platform_msdos.h.in diff --git a/config/compilers/compiler_gcc.h.in b/config/compilers/compiler_gcc.h.in index 7750f462..c0a86abf 100644 --- a/config/compilers/compiler_gcc.h.in +++ b/config/compilers/compiler_gcc.h.in @@ -55,6 +55,8 @@ #else #define DUK_USE_COMPILER_STRING "mingw" #endif +#elif defined(DUK_F_DJGPP) +#define DUK_USE_COMPILER_STRING "djgpp" #else #if defined(DUK_F_CPP) #define DUK_USE_COMPILER_STRING "g++" diff --git a/config/helper-snippets/DUK_F_DJGPP.h.in b/config/helper-snippets/DUK_F_DJGPP.h.in new file mode 100644 index 00000000..83630339 --- /dev/null +++ b/config/helper-snippets/DUK_F_DJGPP.h.in @@ -0,0 +1,12 @@ +/* DJGPP (MSDOS), see https://sourceforge.net/p/predef/wiki/Compilers/ */ +#if defined(__DJGPP__) +#define DUK_F_DJGPP +#define DUK_F_DJGPP_MAJOR __DJGPP__ +#if defined(__DJGPP_MINOR__) +#define DUK_F_DJGPP_MINOR __DJGPP_MINOR__ +#else +#define DUK_F_DJGPP_MINOR 0 +#endif +#define DUK_F_DJGPP_PATCH 0 +#define DUK_F_DJGPP_VERSION (DUK_F_DJGPP_MAJOR * 10000L + DUK_F_DJGPP_MINOR * 100L + DUK_F_DJGPP_PATCH) +#endif diff --git a/config/helper-snippets/DUK_F_MSDOS.h.in b/config/helper-snippets/DUK_F_MSDOS.h.in new file mode 100644 index 00000000..ad7f702b --- /dev/null +++ b/config/helper-snippets/DUK_F_MSDOS.h.in @@ -0,0 +1,3 @@ +#if defined(__MSDOS__) || defined(__MSDOS) || defined(MSDOS) +#define DUK_F_MSDOS +#endif diff --git a/config/platforms.yaml b/config/platforms.yaml index d8a39b42..56278089 100644 --- a/config/platforms.yaml +++ b/config/platforms.yaml @@ -11,6 +11,10 @@ autodetect: name: Orbis check: DUK_F_ORBIS include: platform_orbis.h.in + - + name: MS-DOS + check: DUK_F_MSDOS + include: platform_msdos.h.in - name: OpenBSD check: DUK_F_OPENBSD diff --git a/config/platforms/platform_msdos.h.in b/config/platforms/platform_msdos.h.in new file mode 100644 index 00000000..8aee377a --- /dev/null +++ b/config/platforms/platform_msdos.h.in @@ -0,0 +1,19 @@ +#if defined(DUK_F_DJGPP) +/* These are for DJGPP, add #ifdefs for other MS-DOS compilers as needed. */ +#define DUK_USE_DATE_NOW_GETTIMEOFDAY +#define DUK_USE_DATE_TZO_GMTIME_R +#undef DUK_USE_DATE_PRS_STRPTIME /* Not supported, see: https://github.com/svaarala/duktape/issues/2472 */ +#define DUK_USE_DATE_FMT_STRFTIME +#include +#include +#else +/* Placeholder, unlikely to work outside of DJGPP. */ +#define DUK_USE_DATE_NOW_GETTIMEOFDAY +#define DUK_USE_DATE_TZO_GMTIME_R +#undef DUK_USE_DATE_PRS_STRPTIME +#define DUK_USE_DATE_FMT_STRFTIME +#include +#include +#endif + +#define DUK_USE_OS_STRING "msdos" diff --git a/releases/releases.yaml b/releases/releases.yaml index 3b79495e..b3de95f9 100644 --- a/releases/releases.yaml +++ b/releases/releases.yaml @@ -1394,3 +1394,4 @@ duktape_releases: - "Use wasm for dukweb.js compilation (including duktape.org site), fix async loading of emcc-compiled code in dukweb.html (GH-2244)" - "Improve DUK_USE_OS_STRING for macOS, iOS, watchOS, and tvOS (GH-2288)" - "Fix JSON.stringify() handling of Array 'replacer' duplicates (e.g. JSON.stringify({foo: 123}, [\"foo\", \"foo\"])); previously incorrectly serialized multiple times, now only once (GH-2379)" + - "Add support for DJGPP (MSDOS) platform (GH-2472, GH-2473)"