[project @ 2003-09-12 16:16:43 by sof]
[ghc-hetmet.git] / ghc / rts / RtsAPI.c
index 529135e..3236d1e 100644 (file)
@@ -1,5 +1,5 @@
 /* ----------------------------------------------------------------------------
- * $Id: RtsAPI.c,v 1.42 2003/02/06 10:04:57 simonmar Exp $
+ * $Id: RtsAPI.c,v 1.45 2003/08/28 16:33:42 simonmar Exp $
  *
  * (c) The GHC Team, 1998-2001
  *
@@ -29,7 +29,7 @@ rts_mkChar (HsChar c)
 {
   StgClosure *p = (StgClosure *)allocate(CONSTR_sizeW(0,1));
   SET_HDR(p, Czh_con_info, CCS_SYSTEM);
-  p->payload[0]  = (StgClosure *)(StgChar)c;
+  p->payload[0]  = (StgClosure *)(StgWord)(StgChar)c;
   return p;
 }
 
@@ -179,7 +179,6 @@ rts_mkFunPtr (HsFunPtr a)
   return p;
 }
 
-#ifdef COMPILER /* GHC has em, Hugs doesn't */
 HaskellObj
 rts_mkBool (HsBool b)
 {
@@ -195,7 +194,6 @@ rts_mkString (char *s)
 {
   return rts_apply((StgClosure *)unpackCString_closure, rts_mkPtr(s));
 }
-#endif /* COMPILER */
 
 HaskellObj
 rts_apply (HaskellObj f, HaskellObj arg)
@@ -260,7 +258,7 @@ rts_getInt32 (HaskellObj p)
     // See comment above:
     // ASSERT(p->header.info == I32zh_con_info ||
     //        p->header.info == I32zh_static_info);
-    return (HsInt32)(p->payload[0]);
+    return (HsInt32)(HsInt)(p->payload[0]);
 }
 
 HsInt64
@@ -306,7 +304,7 @@ rts_getWord32 (HaskellObj p)
     // See comment above:
     // ASSERT(p->header.info == W32zh_con_info ||
     //        p->header.info == W32zh_static_info);
-    return (HsWord32)(p->payload[0]);
+    return (HsWord32)(HsWord)(p->payload[0]);
 }
 
 
@@ -366,7 +364,6 @@ rts_getFunPtr (HaskellObj p)
     return (void *)(p->payload[0]);
 }
 
-#ifdef COMPILER /* GHC has em, Hugs doesn't */
 HsBool
 rts_getBool (HaskellObj p)
 {
@@ -378,7 +375,6 @@ rts_getBool (HaskellObj p)
     barf("rts_getBool: not a Bool");
   }
 }
-#endif /* COMPILER */
 
 /* ----------------------------------------------------------------------------
    Evaluating Haskell expressions
@@ -415,16 +411,16 @@ rts_evalIO (HaskellObj p, /*out*/HaskellObj *ret)
 }
 
 /*
- * Identical to rts_evalIO(), but won't create a new task/OS thread
+ * Identical to rts_evalLazyIO(), but won't create a new task/OS thread
  * to evaluate the Haskell thread. Used by main() only. Hack.
  */
  
 SchedulerStatus
-rts_mainEvalIO(HaskellObj p, /*out*/HaskellObj *ret)
+rts_mainLazyIO(HaskellObj p, /*out*/HaskellObj *ret)
 {
     StgTSO* tso;
     
-    tso = createStrictIOThread(RtsFlags.GcFlags.initialStkSize, p);
+    tso = createIOThread(RtsFlags.GcFlags.initialStkSize, p);
     scheduleThread(tso);
     return waitThread(tso, ret);
 }