[project @ 2000-04-06 13:41:16 by panne]
[ghc-hetmet.git] / ghc / includes / StgTypes.h
index 91f13b0..2e165df 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: StgTypes.h,v 1.4 1999/02/05 16:02:30 simonm Exp $
+ * $Id: StgTypes.h,v 1.10 2000/04/06 13:41:16 panne Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -7,8 +7,8 @@
 
  * Specifically:
 
-       StgInt8, 16, 32, 64
-       StgNat8, 16, 32, 64
+       StgInt8,  16, 32, 64
+       StgWord8, 16, 32, 64
        StgChar, StgFloat, StgDouble
 
        ***** All the same size: *****
@@ -17,7 +17,7 @@
        StgInt                  Signed version of StgWord
        StgAddr                 Generic address type
        
-
+ * WARNING: Keep this file and HsFFI.h in synch!
  *
  * ---------------------------------------------------------------------------*/
 
 /*
  * First, platform-dependent definitions of size-specific integers.
  * Assume for now that the int type is 32 bits.
+ * NOTE: Synch the following definitions with MachDeps.h!
  * ToDo: move these into a platform-dependent file.
  */
 
 typedef signed   char            StgInt8;
-typedef unsigned char            StgNat8;
+typedef unsigned char            StgWord8;
 
 typedef signed   short           StgInt16;
-typedef unsigned short           StgNat16;
+typedef unsigned short           StgWord16;
 
 
 #if SIZEOF_UNSIGNED_INT == 4
 typedef signed   int             StgInt32;
-typedef unsigned int             StgNat32;
+typedef unsigned int             StgWord32;
 #else
-#error GHC untested on this architecture: sizeof(unisgned int) != 4
+#error GHC untested on this architecture: sizeof(unsigned int) != 4
 #endif
 
 /* This #define controls whether we need to support long longs on a particular
@@ -55,11 +56,11 @@ typedef unsigned int             StgNat32;
 
 #ifdef SUPPORT_LONG_LONGS
 /* assume long long is 64 bits */
-typedef unsigned long long int StgNat64;
+typedef unsigned long long int StgWord64;
 typedef signed long long int   StgInt64;
 #elif SIZEOF_LONG == 8
 typedef signed   long          StgInt64;
-typedef unsigned long          StgNat64;
+typedef unsigned long          StgWord64;
 #else
 #error GHC untested on this architecture: sizeof(void *) < 8 and no long longs.
 #endif
@@ -72,11 +73,11 @@ typedef unsigned long          StgNat64;
 
 #if SIZEOF_VOID_P == 8
 typedef StgInt64           StgInt;
-typedef StgNat64           StgWord;
+typedef StgWord64          StgWord;
 #else
 #if SIZEOF_VOID_P == 4
 typedef StgInt32           StgInt; 
-typedef StgNat32           StgWord;
+typedef StgWord32          StgWord;
 #else
 #error GHC untested on this architecture: sizeof(void *) != 4 or 8
 #endif
@@ -88,8 +89,8 @@ typedef void*              StgAddr;
  * Other commonly-used STG datatypes.
  */
 
-typedef StgNat8            StgChar;
-
+typedef StgWord8           StgChar;
+typedef int                StgBool;
 /*
  * If a double fits in an StgWord, don't bother using floats.
  */
@@ -117,14 +118,14 @@ typedef StgInt             StgStackOffset;   /* offset in words! */
 
 typedef StgWord*           StgStackPtr;
 
-typedef StgNat8           StgCode;         /* close enough */
+typedef StgWord8          StgCode;         /* close enough */
 typedef StgCode*          StgCodePtr;  
 
 typedef StgPtr*            StgArray;        /* the goods of an Array# */
 typedef char*             StgByteArray;    /* the goods of a ByteArray# */
 
 typedef StgInt64              LI_;
-typedef StgNat64              LW_;
+typedef StgWord64             LW_;
 
 /* Stable Pointers:  A stable pointer is represented as an index into
  * the stable pointer table in the low 24 bits with a weight in the
@@ -132,7 +133,7 @@ typedef StgNat64           LW_;
  */
 typedef StgWord            StgStablePtr;
 
-#define STABLEPTR_WEIGHT_MASK   (0xff << ((sizeof(StgWord)-1) * BITS_PER_BYTE))
+#define STABLEPTR_WEIGHT_MASK   ((StgWord)0xff << ((sizeof(StgWord)-1) * BITS_PER_BYTE))
 #define STABLEPTR_WEIGHT_SHIFT  (BITS_IN(StgWord) - 8)
 
 /*
@@ -193,5 +194,4 @@ typedef StgClosurePtr   L_;
 
 #define stgCast(ty,e) ((ty)(e))
 
-#endif STGTYPES_H
-
+#endif /* STGTYPES_H */