/* ----------------------------------------------------------------------------
- * $Id: RtsAPI.c,v 1.40 2003/01/27 11:08:16 wolfgang Exp $
+ * $Id: RtsAPI.c,v 1.45 2003/08/28 16:33:42 simonmar Exp $
*
* (c) The GHC Team, 1998-2001
*
{
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;
}
return p;
}
-#ifdef COMPILER /* GHC has em, Hugs doesn't */
+HaskellObj
+rts_mkFunPtr (HsFunPtr a)
+{
+ StgClosure *p = (StgClosure *)allocate(sizeofW(StgHeader)+1);
+ SET_HDR(p, FunPtr_con_info, CCS_SYSTEM);
+ p->payload[0] = (StgClosure *)a;
+ return p;
+}
+
HaskellObj
rts_mkBool (HsBool b)
{
{
return rts_apply((StgClosure *)unpackCString_closure, rts_mkPtr(s));
}
-#endif /* COMPILER */
HaskellObj
rts_apply (HaskellObj f, HaskellObj arg)
// 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
// 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]);
}
return (void *)(p->payload[0]);
}
-#ifdef COMPILER /* GHC has em, Hugs doesn't */
+HsFunPtr
+rts_getFunPtr (HaskellObj p)
+{
+ // See comment above:
+ // ASSERT(p->header.info == FunPtr_con_info ||
+ // p->header.info == FunPtr_static_info);
+ return (void *)(p->payload[0]);
+}
+
HsBool
rts_getBool (HaskellObj p)
{
barf("rts_getBool: not a Bool");
}
}
-#endif /* COMPILER */
/* ----------------------------------------------------------------------------
Evaluating Haskell expressions
}
/*
- * 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);
}