X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fincludes%2FHsFFI.h;h=a96cb95c9147b7870d174deb7cda4e58e8c21a2e;hb=423d477bfecd490de1449c59325c8776f91d7aac;hp=7ae194596e044a856a960fadb5631dc6d8e97989;hpb=133dcbb95ce76179595ccee62c860aab4d5602e4;p=ghc-hetmet.git diff --git a/ghc/includes/HsFFI.h b/ghc/includes/HsFFI.h index 7ae1945..a96cb95 100644 --- a/ghc/includes/HsFFI.h +++ b/ghc/includes/HsFFI.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: HsFFI.h,v 1.9 2000/11/13 17:17:40 simonmar Exp $ + * $Id: HsFFI.h,v 1.20 2004/08/13 13:09:13 simonmar Exp $ * * (c) The GHC Team, 2000 * @@ -13,8 +13,13 @@ #ifndef HSFFI_H #define HSFFI_H +#ifdef __cplusplus +extern "C" { +#endif + /* get types from GHC's runtime system */ -#include "config.h" +#include "ghcconfig.h" +#include "RtsConfig.h" #include "StgTypes.h" /* get limits for integral types */ @@ -32,30 +37,33 @@ #include #endif +#ifdef INT8_MIN +#define __INT8_MIN INT8_MIN +#define __INT16_MIN INT16_MIN +#define __INT32_MIN INT32_MIN +#define __INT64_MIN INT64_MIN +#define __INT8_MAX INT8_MAX +#define __INT16_MAX INT16_MAX +#define __INT32_MAX INT32_MAX +#define __INT64_MAX INT64_MAX +#define __UINT8_MAX UINT8_MAX +#define __UINT16_MAX UINT16_MAX +#define __UINT32_MAX UINT32_MAX +#define __UINT64_MAX UINT64_MAX +#else /* if we had no luck, let's do it for ourselves (assuming 64bit long longs) */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#define INT16_MIN (-32767-1) -#define INT32_MIN (-2147483647-1) -#define INT64_MIN (-9223372036854775807LL-1) -#define INT8_MAX (127) -#define INT16_MAX (32767) -#define INT32_MAX (2147483647) -#define INT64_MAX (9223372036854775807LL) -#define UINT8_MAX (255U) -#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; +#define __INT8_MIN (-128) +#define __INT16_MIN (-32767-1) +#define __INT32_MIN (-2147483647-1) +#define __INT64_MIN (-9223372036854775807LL-1) +#define __INT8_MAX (127) +#define __INT16_MAX (32767) +#define __INT32_MAX (2147483647) +#define __INT64_MAX (9223372036854775807LL) +#define __UINT8_MAX (255U) +#define __UINT16_MAX (65535U) +#define __UINT32_MAX (4294967295U) +#define __UINT64_MAX (18446744073709551615ULL) #endif /* get limits for floating point types */ @@ -75,37 +83,47 @@ typedef StgWord64 HsWord64; typedef StgFloat HsFloat; typedef StgDouble HsDouble; typedef StgBool HsBool; -typedef void* HsAddr; /* this should better match StgAddr */ -typedef void* HsForeignObj; /* ... and this StgForeignPtr */ +typedef void* HsPtr; /* this should better match StgAddr */ +typedef void (*HsFunPtr)(void); /* this should better match StgAddr */ +typedef void* HsForeignPtr; /* ... and this StgForeignPtr */ typedef void* HsStablePtr; +typedef void* HsAddr; /* DEPRECATED */ +typedef void* HsForeignObj; /* DEPRECATED */ /* this should correspond to the type of StgChar in StgTypes.h */ #define HS_CHAR_MIN 0 -#define HS_CHAR_MAX INT32_MAX +#define HS_CHAR_MAX 0x10FFFF + +/* is it true or not? */ +#define HS_BOOL_FALSE 0 +#define HS_BOOL_TRUE 1 + +#define HS_BOOL_MIN HS_BOOL_FALSE +#define HS_BOOL_MAX HS_BOOL_TRUE /* this mirrors the distinction of cases in StgTypes.h */ #if SIZEOF_VOID_P == 8 -#define HS_INT_MIN INT64_MIN -#define HS_INT_MAX INT64_MAX +#define HS_INT_MIN __INT64_MIN +#define HS_INT_MAX __INT64_MAX #elif SIZEOF_VOID_P == 4 -#define HS_INT_MIN INT32_MIN -#define HS_INT_MAX INT32_MAX +#define HS_INT_MIN __INT32_MIN +#define HS_INT_MAX __INT32_MAX #else #error GHC untested on this architecture: sizeof(void *) != 4 or 8 #endif -#define HS_INT8_MIN INT8_MIN -#define HS_INT8_MAX INT8_MAX -#define HS_INT16_MIN INT16_MIN -#define HS_INT16_MAX INT16_MAX -#define HS_INT32_MIN INT32_MIN -#define HS_INT32_MAX INT32_MAX -#define HS_INT64_MIN INT64_MIN -#define HS_INT64_MAX INT64_MAX -#define HS_WORD8_MAX UINT8_MAX -#define HS_WORD16_MAX UINT16_MAX -#define HS_WORD32_MAX UINT32_MAX -#define HS_WORD64_MAX UINT64_MAX +#define HS_INT8_MIN __INT8_MIN +#define HS_INT8_MAX __INT8_MAX +#define HS_INT16_MIN __INT16_MIN +#define HS_INT16_MAX __INT16_MAX +#define HS_INT32_MIN __INT32_MIN +#define HS_INT32_MAX __INT32_MAX +#define HS_INT64_MIN __INT64_MIN +#define HS_INT64_MAX __INT64_MAX +#define HS_WORD8_MAX __UINT8_MAX +#define HS_WORD16_MAX __UINT16_MAX +#define HS_WORD32_MAX __UINT32_MAX +#define HS_WORD64_MAX __UINT64_MAX #define HS_FLOAT_RADIX FLT_RADIX #define HS_FLOAT_ROUNDS FLT_ROUNDS @@ -131,4 +149,20 @@ typedef void* HsStablePtr; #define HS_DOUBLE_MAX_EXP DBL_MAX_EXP #define HS_DOUBLE_MAX_10_EXP DBL_MAX_10_EXP +extern void hs_init (int *argc, char **argv[]); +extern void hs_exit (void); +extern void hs_set_argv (int argc, char *argv[]); +extern void hs_add_root (void (*init_root)(void)); + +extern void hs_perform_gc (void); + +extern void hs_free_stable_ptr (HsStablePtr sp); +extern void hs_free_fun_ptr (HsFunPtr fp); + +/* -------------------------------------------------------------------------- */ + +#ifdef __cplusplus +} +#endif + #endif /* HSFFI_H */