From 3e7902302adba05d926ff9210026e19cd0b5a106 Mon Sep 17 00:00:00 2001 From: qrczak Date: Tue, 29 Aug 2000 13:34:21 +0000 Subject: [PATCH] [project @ 2000-08-29 13:34:21 by qrczak] Don't use a typedef called int64 in RtsAPI. It conflicts with e.g. OCaml's headers. It should be cleaned better... --- ghc/includes/Assembler.h | 4 ++-- ghc/includes/HsFFI.h | 17 +++++++++++++++-- ghc/includes/RtsAPI.h | 22 ++++++++++++---------- ghc/rts/RtsAPI.c | 6 +++--- 4 files changed, 32 insertions(+), 17 deletions(-) diff --git a/ghc/includes/Assembler.h b/ghc/includes/Assembler.h index 22244f6..bd40d0a 100644 --- a/ghc/includes/Assembler.h +++ b/ghc/includes/Assembler.h @@ -1,6 +1,6 @@ /* ----------------------------------------------------------------------------- - * $Id: Assembler.h,v 1.16 2000/06/27 09:18:04 sewardj Exp $ + * $Id: Assembler.h,v 1.17 2000/08/29 13:34:21 qrczak Exp $ * * (c) The GHC Team 1994-1998. * @@ -29,7 +29,7 @@ extern void DEBUG_LoadSymbols( char *name ); typedef unsigned char AsmNat8; typedef unsigned int AsmNat; typedef signed int AsmInt; -typedef int64 AsmInt64; +typedef HsInt64_ AsmInt64; typedef unsigned int AsmWord; typedef void* AsmAddr; typedef unsigned char AsmChar; diff --git a/ghc/includes/HsFFI.h b/ghc/includes/HsFFI.h index f51d41a..9a349b7 100644 --- a/ghc/includes/HsFFI.h +++ b/ghc/includes/HsFFI.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: HsFFI.h,v 1.5 2000/08/18 18:08:48 qrczak Exp $ + * $Id: HsFFI.h,v 1.6 2000/08/29 13:34:21 qrczak Exp $ * * (c) The GHC Team, 2000 * @@ -19,7 +19,10 @@ /* get limits for integral types */ #ifdef HAVE_STDINT_H -/* ISO C 99 requires this */ +/* ISO C 99 says: + * "C++ implementations should define these macros only when + * __STDC_LIMIT_MACROS is defined before is included." + */ #define __STDC_LIMIT_MACROS #include #else @@ -41,6 +44,16 @@ #define UINT16_MAX (65535U) #define UINT32_MAX (4294967295U) #define UINT64_MAX (18446744073709551615ULL) +/* Define these types too. Some C 99 code may assume that if INT8_MIN + is defined then int8_t is also present. */ +typedef StgInt8 int8_t; +typedef StgInt16 int16_t; +typedef StgInt32 int32_t; +typedef StgInt64 int64_t; +typedef StgWord8 uint8_t; +typedef StgWord16 uint16_t; +typedef StgWord32 uint32_t; +typedef StgWord64 uint64_t; #endif /* get limits for floating point types */ diff --git a/ghc/includes/RtsAPI.h b/ghc/includes/RtsAPI.h index bddb06e..348e57a 100644 --- a/ghc/includes/RtsAPI.h +++ b/ghc/includes/RtsAPI.h @@ -1,5 +1,5 @@ /* ---------------------------------------------------------------------------- - * $Id: RtsAPI.h,v 1.16 2000/08/07 23:37:23 qrczak Exp $ + * $Id: RtsAPI.h,v 1.17 2000/08/29 13:34:21 qrczak Exp $ * * (c) The GHC Team, 1998-1999 * @@ -25,15 +25,17 @@ typedef StgClosure *HaskellObj; /* Make this compilable with Visual C++. We can't just use StgInt64 here, - because this file should be compilable without reference to the rest - of the RTS machinery. -*/ + * because this file should be compilable without reference to the rest + * of the RTS machinery. These are absolutely non-standard types, but + * I don't know what alternatives are safe if we don't #include anything + * here. + */ #if defined(__MSVC__) -typedef __int64 int64; -typedef unsigned __int64 nat64; +typedef __int64 HsInt64_; +typedef unsigned __int64 HsWord64_; #else -typedef long long int64; -typedef unsigned long long nat64; +typedef long long HsInt64_; +typedef unsigned long long HsWord64_; #endif /* ---------------------------------------------------------------------------- @@ -57,8 +59,8 @@ HaskellObj rts_mkWord ( unsigned int w ); HaskellObj rts_mkWord8 ( unsigned int w ); HaskellObj rts_mkWord16 ( unsigned int w ); HaskellObj rts_mkWord32 ( unsigned int w ); -HaskellObj rts_mkInt64 ( int64 i ); -HaskellObj rts_mkWord64 ( nat64 w ); +HaskellObj rts_mkInt64 ( HsInt64_ i ); +HaskellObj rts_mkWord64 ( HsWord64_ w ); HaskellObj rts_mkFloat ( float f ); HaskellObj rts_mkDouble ( double f ); HaskellObj rts_mkStablePtr ( StgStablePtr s ); diff --git a/ghc/rts/RtsAPI.c b/ghc/rts/RtsAPI.c index 5bc4008..de6de62 100644 --- a/ghc/rts/RtsAPI.c +++ b/ghc/rts/RtsAPI.c @@ -1,5 +1,5 @@ /* ---------------------------------------------------------------------------- - * $Id: RtsAPI.c,v 1.19 2000/08/15 11:48:06 simonmar Exp $ + * $Id: RtsAPI.c,v 1.20 2000/08/29 13:34:21 qrczak Exp $ * * (c) The GHC Team, 1998-2000 * @@ -75,7 +75,7 @@ rts_mkInt32 (int i) } HaskellObj -rts_mkInt64 (long long int i) +rts_mkInt64 (HsInt64_ i) { long long *tmp; StgClosure *p = (StgClosure *)allocate(CONSTR_sizeW(0,2)); @@ -126,7 +126,7 @@ rts_mkWord32 (unsigned int w) } HaskellObj -rts_mkWord64 (unsigned long long w) +rts_mkWord64 (HsWord64_ w) { unsigned long long *tmp; -- 1.7.10.4