From 7e63e7e6b78e8d8d719668e568b704eb3e97337f Mon Sep 17 00:00:00 2001 From: panne Date: Sun, 17 Nov 2002 15:27:08 +0000 Subject: [PATCH] [project @ 2002-11-17 15:27:07 by panne] Added RTS entry points as mandated by the FFI addendum to the Haskell 98 report. NOTE: The implementations of hs_init, hs_exit, and hs_set_argv are still missing. --- ghc/includes/HsFFI.h | 11 ++++++++++- ghc/rts/HsFFI.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 ghc/rts/HsFFI.c diff --git a/ghc/includes/HsFFI.h b/ghc/includes/HsFFI.h index 7164007..7010aa1 100644 --- a/ghc/includes/HsFFI.h +++ b/ghc/includes/HsFFI.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: HsFFI.h,v 1.16 2001/11/07 19:11:43 sof Exp $ + * $Id: HsFFI.h,v 1.17 2002/11/17 15:27:07 panne Exp $ * * (c) The GHC Team, 2000 * @@ -148,6 +148,15 @@ typedef void* HsForeignObj; /* DEPRECATED */ #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_perform_gc (void); + +extern void hs_free_stable_ptr (HsStablePtr *sp); +extern void hs_free_fun_ptr (HsFunPtr *fp); + /* -------------------------------------------------------------------------- */ #ifdef __cplusplus diff --git a/ghc/rts/HsFFI.c b/ghc/rts/HsFFI.c new file mode 100644 index 0000000..47a0495 --- /dev/null +++ b/ghc/rts/HsFFI.c @@ -0,0 +1,51 @@ +/* ----------------------------------------------------------------------------- + * $Id: HsFFI.c,v 1.1 2002/11/17 15:27:08 panne Exp $ + * + * (c) The GHC Team, 2002 + * + * RTS entry points as mandated by the FFI addendum to the Haskell 98 report + * + * ---------------------------------------------------------------------------*/ + +#include "HsFFI.h" +#include "Rts.h" + +void +hs_init(int *argc, char **argv[]) +{ + /* ToDo: Implement! */ +} + +void +hs_exit(void) +{ + /* ToDo: Implement! */ +} + +void +hs_set_argv(int argc, char *argv[]) +{ + /* ToDo: Implement! */ +} + +void +hs_perform_gc(void) +{ + /* Hmmm, the FFI spec is a bit vague, but it seems to imply a major GC... */ + performMajorGC(); +} + +void +hs_free_stable_ptr(HsStablePtr *sp) +{ + /* The cast is for clarity only, both HsStablePtr and StgStablePtr are + typedefs for void*. */ + freeStablePtr((StgStablePtr)sp); +} + +void +hs_free_fun_ptr(HsFunPtr *fp) +{ + /* I simply *love* all these similar names... */ + freeHaskellFunctionPtr(fp); +} -- 1.7.10.4