diff options
author | sewardj <unknown> | 1999-10-15 11:03:10 +0000 |
---|---|---|
committer | sewardj <unknown> | 1999-10-15 11:03:10 +0000 |
commit | dfb12323d9fd0c8fb717b8e548592f20163b4ed0 (patch) | |
tree | 7900eb0f51b03a254425cd3f978eb1e245071e11 /ghc/interpreter/static.c | |
parent | f5fd4677bc522dba98447c6b3451441e8ab8e33e (diff) | |
download | haskell-dfb12323d9fd0c8fb717b8e548592f20163b4ed0.tar.gz |
[project @ 1999-10-15 11:02:06 by sewardj]
Added basic support for foreign export dynamic.
Many aspects of it are still broken:
* Only supports x86-linux.
* The range of allowable types is small: Char Int Float Double
Addr and Word.
* Adjustor thunks are never freed.
* Returning Doubles or Floats doesn't work at all.
I expect to fix some of these shortly. foreign import also
needs redoing, so it can accept any number of arguments of
any type.
Also:
* Fixed setRtsFlags in Evaluator.c to make it endian-independent.
* Fixed raisePrim in Evaluator.c so things like division by zero,
array index errors, etc, throw an exception instead of
terminating StgHugs. raisePrim is renamed makeErrorCall.
Diffstat (limited to 'ghc/interpreter/static.c')
-rw-r--r-- | ghc/interpreter/static.c | 60 |
1 files changed, 2 insertions, 58 deletions
diff --git a/ghc/interpreter/static.c b/ghc/interpreter/static.c index c6f9a7ebbc..38e179da88 100644 --- a/ghc/interpreter/static.c +++ b/ghc/interpreter/static.c @@ -8,8 +8,8 @@ * in the distribution for details. * * $RCSfile: static.c,v $ - * $Revision: 1.8 $ - * $Date: 1999/07/06 15:24:41 $ + * $Revision: 1.9 $ + * $Date: 1999/10/15 11:02:22 $ * ------------------------------------------------------------------------*/ #include "prelude.h" @@ -2789,7 +2789,6 @@ static Void local checkDefaultDefns() { /* check that default types are */ } -/*-- from STG --*/ /* -------------------------------------------------------------------------- * Foreign import declarations are Hugs' equivalent of GHC's ccall mechanism. * They are used to "import" C functions into a module. @@ -2869,61 +2868,6 @@ Name p; { - -#if 0 -/*-- from 98 --*/ -/* -------------------------------------------------------------------------- - * Primitive definitions are usually only included in the first script - * file read - the prelude. A primitive definition associates a variable - * name with a string (which identifies a built-in primitive) and a type. - * ------------------------------------------------------------------------*/ - -Void primDefn(line,prims,type) /* Handle primitive definitions */ -Cell line; -List prims; -Cell type; { - primDefns = cons(triple(line,prims,type),primDefns); -} - -static List local checkPrimDefn(pd) /* Check primitive definition */ -Triple pd; { - Int line = intOf(fst3(pd)); - List prims = snd3(pd); - Type type = thd3(pd); - emptySubstitution(); - type = checkSigType(line,"primitive definition",fst(hd(prims)),type); - for (; nonNull(prims); prims=tl(prims)) { - Cell p = hd(prims); - Bool same = isVar(p); - Text pt = textOf(same ? p : fst(p)); - String pr = textToStr(textOf(same ? p : snd(p))); - hd(prims) = addNewPrim(line,pt,pr,type); - } - return snd3(pd); -} - -static Name local addNewPrim(l,vn,s,t) /* make binding of variable vn to */ -Int l; /* primitive function referred */ -Text vn; /* to by s, with given type t */ -String s; -Cell t;{ - Name n = findName(vn); - - if (isNull(n)) { - n = newName(vn,NIL); - } else if (name(n).defn!=PREDEFINED) { - duplicateError(l,name(n).mod,vn,"primitive"); - } - - addPrim(l,n,s,t); - return n; -} -#endif - - - - - /* -------------------------------------------------------------------------- * Static analysis of patterns: * |