Skip to content
Snippets Groups Projects
Commit a379f8f5 authored by Simon Marlow's avatar Simon Marlow
Browse files

[project @ 2000-06-08 15:00:21 by simonmar]

Remove out-of-date table that conflicts with the new one in the FFI
documentation.
parent 14f3d572
No related merge requests found
...@@ -1506,109 +1506,26 @@ For example, ...@@ -1506,109 +1506,26 @@ For example,
<Para> <Para>
<ProgramListing> <ProgramListing>
typedef unsigned long *StgForeignObj; #include "HsFFI.h"
typedef long StgInt;
void initialiseEFS (StgInt size); void initialiseEFS (HsInt size);
StgInt terminateEFS (void); HsInt terminateEFS (void);
StgForeignObj emptyEFS(void); HsForeignObj emptyEFS(void);
StgForeignObj updateEFS (StgForeignObj a, StgInt i, StgInt x); HsForeignObj updateEFS (HsForeignObj a, HsInt i, HsInt x);
StgInt lookupEFS (StgForeignObj a, StgInt i); HsInt lookupEFS (HsForeignObj a, HsInt i);
</ProgramListing> </ProgramListing>
</Para>
<Para>
You can find appropriate definitions for <Literal>StgInt</Literal>, <Literal>StgForeignObj</Literal>,
etc using <Command>gcc</Command> on your architecture by consulting
<Filename>ghc/includes/StgTypes.h</Filename>. The following table summarises the
relationship between Haskell types and C types.
</Para> </Para>
<Para> <para>The types <literal>HsInt</literal>,
<literal>HsForeignObj</literal> etc. are described in <xref
<InformalTable> linkend="sec-mapping-table">.</Para>
<TGroup Cols="2">
<ColSpec Align="Left" Colsep="0">
<ColSpec Align="Left" Colsep="0">
<TBody>
<Row>
<Entry><Emphasis>C type name</Emphasis> </Entry>
<Entry> <Emphasis>Haskell Type</Emphasis> </Entry>
</Row>
<Row>
<Entry>
<Literal>StgChar</Literal> </Entry>
<Entry> <Literal>Char&num;</Literal> </Entry>
</Row>
<Row>
<Entry>
<Literal>StgInt</Literal> </Entry>
<Entry> <Literal>Int&num;</Literal> </Entry>
</Row>
<Row>
<Entry>
<Literal>StgWord</Literal> </Entry>
<Entry> <Literal>Word&num;</Literal> </Entry>
</Row>
<Row>
<Entry>
<Literal>StgAddr</Literal> </Entry>
<Entry> <Literal>Addr&num;</Literal> </Entry>
</Row>
<Row>
<Entry>
<Literal>StgFloat</Literal> </Entry>
<Entry> <Literal>Float&num;</Literal> </Entry>
</Row>
<Row>
<Entry>
<Literal>StgDouble</Literal> </Entry>
<Entry> <Literal>Double&num;</Literal> </Entry>
</Row>
<Row>
<Entry>
<Literal>StgArray</Literal> </Entry>
<Entry> <Literal>Array&num;</Literal> </Entry>
</Row>
<Row>
<Entry>
<Literal>StgByteArray</Literal> </Entry>
<Entry> <Literal>ByteArray&num;</Literal> </Entry>
</Row>
<Row>
<Entry>
<Literal>StgArray</Literal> </Entry>
<Entry> <Literal>MutableArray&num;</Literal> </Entry>
</Row>
<Row>
<Entry>
<Literal>StgByteArray</Literal> </Entry>
<Entry> <Literal>MutableByteArray&num;</Literal> </Entry>
</Row>
<Row>
<Entry>
<Literal>StgStablePtr</Literal> </Entry>
<Entry> <Literal>StablePtr&num;</Literal> </Entry>
</Row>
<Row>
<Entry>
<Literal>StgForeignObj</Literal> </Entry>
<Entry> <Literal>ForeignObj&num;</Literal></Entry>
</Row>
</TBody>
</TGroup>
</InformalTable>
</Para>
<Para> <Para>Note that this approach is only
Note that this approach is only <Emphasis>essential</Emphasis> for returning <Emphasis>essential</Emphasis> for returning
<Literal>float</Literal>s (or if <Literal>sizeof(int) != sizeof(int *)</Literal> on your <Literal>float</Literal>s (or if <Literal>sizeof(int) !=
architecture) but is a Good Thing for anyone who cares about writing sizeof(int *)</Literal> on your architecture) but is a Good
solid code. You're crazy not to do it. Thing for anyone who cares about writing solid code. You're
</Para> crazy not to do it.</Para>
</Sect2> </Sect2>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment