From b07755773426daadc49f10e36ce10bf0453eeda8 Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Sat, 3 Aug 2019 20:51:19 +0300 Subject: [PATCH] fix c89 support --- C/SYSTEM.h | 22 +++++++++++++--------- C/_windows.h | 6 +++--- make.sh | 4 ++-- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/C/SYSTEM.h b/C/SYSTEM.h index 183da76..f0d6a9f 100644 --- a/C/SYSTEM.h +++ b/C/SYSTEM.h @@ -10,7 +10,7 @@ bh 20.12.1999 */ -#pragma warning(disable:4101) // disable "unreferenced variable" warning +#pragma warning(disable:4101) /* disable "unreferenced variable" warning */ #ifdef __GNUC__ # include @@ -18,7 +18,7 @@ bh 20.12.1999 #include #include -// extern char *memcpy(); +/* extern char *memcpy(); */ #define export #define import extern @@ -31,10 +31,10 @@ typedef signed char BYTE; typedef short SHORTINT; typedef int INTEGER; #if !defined(_WIN64) && ((__SIZEOF_POINTER__ == 8) || defined (_LP64) || defined(__LP64__)) - typedef long LONGINT; // LP64 + typedef long LONGINT; /* LP64 */ typedef unsigned long __U_LONGINT; #else - typedef long long LONGINT; // ILP32 or LLP64 + typedef long long LONGINT; /* ILP32 or LLP64 */ typedef unsigned long long __U_LONGINT; #endif typedef float SHORTREAL; @@ -250,10 +250,12 @@ extern void Kernel_Trap(INTEGER n); #define __MOVE(s, d, n) memcpy((char*)(d),(char*)(s),n) /* std procs and operator mappings */ -// #define __SHORT(x, y) ((int)((unsigned)(x)+(y)<(y)+(y)?(x):(__HALT(-8),0))) -// #define __SHORTF(x, y) ((int)(__RF((x)+(y),(y)+(y))-(y))) -// #define __CHR(x) ((CHAR)__R(x, 256)) -// #define __CHRF(x) ((CHAR)__RF(x, 256)) +/* +#define __SHORT(x, y) ((int)((unsigned)(x)+(y)<(y)+(y)?(x):(__HALT(-8),0))) +#define __SHORTF(x, y) ((int)(__RF((x)+(y),(y)+(y))-(y))) +#define __CHR(x) ((CHAR)__R(x, 256)) +#define __CHRF(x) ((CHAR)__RF(x, 256)) +*/ #define __DIV(x, y) ((x)>=0?(x)/(y):~(~(x)/(y))) #define __DIVF(x, y) SYSTEM_DIV(x,y) #define __DIVFL(x, y) SYSTEM_DIVL(x,y) @@ -328,7 +330,9 @@ extern void Kernel_Trap(INTEGER n); /* runtime checks */ #define __X(i, ub) (((unsigned)(i)<(unsigned)(ub))?i:(__HALT(-7),0)) #define __XF(i, ub) SYSTEM_XCHK((INTEGER)(i), (INTEGER)(ub)) -// #define __RETCHK __retchk: __HALT(-3) +/* +#define __RETCHK __retchk: __HALT(-3) +*/ #define __RETCHK __HALT(-3) #define __CASECHK __HALT(-2) #define __GUARDP(p, typ, level) ((typ*)(__ISP(p,typ,level)?p:(__HALT(-4),p))) diff --git a/C/_windows.h b/C/_windows.h index 74a04c3..dee2e3e 100644 --- a/C/_windows.h +++ b/C/_windows.h @@ -1,12 +1,12 @@ -// windows.h wrapper -// Includes windows.h while avoiding conflicts with Component Pascal types. +/* windows.h wrapper */ +/* Includes windows.h while avoiding conflicts with Component Pascal types. */ #define BOOLEAN _BOOLEAN #define BYTE _BYTE #define CHAR _CHAR #undef _WIN32_WINNT -// 0x0501 is for Windows XP (no service pack) +/* 0x0501 is for Windows XP (no service pack) */ #define _WIN32_WINNT 0x0501 #include diff --git a/make.sh b/make.sh index 2c0c53b..2b50553 100755 --- a/make.sh +++ b/make.sh @@ -123,7 +123,7 @@ cpfront_link() { done local _cc_cflags= case "$CC" in - *gcc) _cc_cflags="-g -Wno-int-conversion -Wno-int-to-pointer-cast -Wno-incompatible-pointer-types -Wno-implicit-function-declaration" ;; + *gcc) _cc_cflags="-std=c89 -Wno-int-conversion -Wno-int-to-pointer-cast -Wno-incompatible-pointer-types -Wno-implicit-function-declaration" ;; *) _cc_cflags="" ;; esac local _cpu_cflags= @@ -137,7 +137,7 @@ cpfront_link() { cygwin) _system_cflags="-liconv" ;; *) _system_cflags="" ;; esac - "$CC" $_cc_cflags $_cpu_cflags $CFLAGS -o "${_main}" -I "$_this/C" "$_this/C/SYSTEM.c" $_list -lm -ldl -lffi $_system_cflags + "$CC" -g -D_XOPEN_SOURCE=700 $_cc_cflags $_cpu_cflags $CFLAGS -o "${_main}" -I "$_this/C" "$_this/C/SYSTEM.c" $_list -lm -ldl -lffi $_system_cflags fi } -- 2.29.2