ffigen-website/www/index.html

136 lines
4.4 KiB
HTML
Raw Normal View History

<HTML>
<HEAD>
<TITLE>FFIGEN Home Page</TITLE>
<LINK REV="made" HREF="mailto:lth@acm.org">
</HEAD>
<BODY>
<H1>FFIGEN</H1>
"A good foreign function interface is 25% code and 75% policy."
<HR>
<P>
FFIGEN (Foreign Function Interface GENerator) is a program suite that
facilitates the writing of translators from C header files to foreign
function interfaces for particular language implementations.
2023-05-19 03:28:13 -04:00
<P>
<img src="../ball.red.gif" alt="*">
2023-05-19 03:28:13 -04:00
FFIGEN Manifesto and Overview
<A href="manifesto.html">(HTML)</a> <A href="manifesto.ps.gz">(ps.gz, 26 KB)</A>
<BR>
<img src="../ball.red.gif" alt="*">
FFIGEN User's Manual
<a href="userman.html">(HTML)</a> <A href="userman.ps.gz">(ps.gz, 30 KB)</A>
<BR>
<img src="../ball.red.gif" alt="*">
FFIGEN Back-end for Chez Scheme Version 5
2023-05-19 03:28:13 -04:00
<A href="chez.ps.gz">(ps.gz, 52 KB)</A>
<P>
There are three motivating observations behind FFIGEN. The first is
that C header files are hard to parse because of the preprocessor,
general syntactic grunge, and the problem of getting the data layouts
right. The second is that foreign function interfaces differ widely and
that translations to different FFIs can't be the same, yet should share
work as much as possible. The third is that not all translations are
suitable for all purposes; there may be multiple valid translations -
each of which serves a different need - for any given language's FFI.
<P>
For these reasons, a translator from C header syntax to an FFI should
have two parts: one target-independent front-end that translates from
the header file into a rational intermediate form and which can be used
with all translators, and a target-dependent back-end that translates
from the intermediate form to an FFI for the target system, using a
translation policy to guide the translation. This design nicely
facilitates writing back-ends for multiple languages, multiple FFIs per
language, and multiple policies per FFI.
<P>
FFIGEN is a system that implements the split-translation philosophy.
<UL>
<LI>The FFIGEN front-end is based on the front-end of the freely
2023-05-19 03:28:13 -04:00
available, production quality, ANSI C compiler <em>lcc</em>. Using
<em>lcc</em> makes
the FFIGEN front end portable, complete, and extensible for special
purposes.
<P>
<LI>The FFIGEN back-ends can be small (a back-end for Chez Scheme that
handles nearly all of C is 350 lines of Scheme code, for example), and
can be written in any language. Scheme is the preferred language for
back-ends right now, because the output syntax of the front-end,
although easily changeable, is that of S-expressions, and because a
back-end written in Scheme is already available for new back-ends to
build on.
</UL>
<P>
The current version of FFIGEN is available as a set of modifications to
2023-05-19 03:28:13 -04:00
<em>lcc</em> version 3.4b; you also need to get the <em>lcc</em> sources.
The FFIGEN
distribution includes documentation on how to write back-ends and a
documented example back-end for the FFI of Chez Scheme version 5.
<P>
2023-05-19 03:28:13 -04:00
<B> This is a preliminary release of FFIGEN. It works, but
is neither complete nor polished.</B>
<P>
<img src="../ball.red.gif" alt="*">
2023-05-19 03:28:13 -04:00
Click <A href="ffigen.tar.gz">here</A> to download the
full FFIGEN distribution. (148 KB)
<BR>
This archive has not been updated with the fixes in the bug fix file (below).
<P>
<img src="../ball.red.gif" alt="*">
Click <A href="960213.tar.gz">here</A> to download bug fixes up to February 13, 1996. (29 KB) <BR>
Fixes to chez.sch to handle structs/unions that are declared but not
defined; function pointers; and unsigned shorts (a typo). Also a minor fix
to policy.sch to remove gratuitous non-standard-ness (use of reverse! rather
than reverse). Also included generated standard libraries for Chez Scheme
2023-05-19 03:28:13 -04:00
back-end (unknowingly left out of distribution). Unpack in <em>lcc</em> main
directory.
<P>
<img src="../ball.red.gif" alt="*">
2023-05-19 03:28:13 -04:00
Click <A href="chez-policy.sch">here</A> to download an example of a Chez
Scheme policy file, left out of distribution.
<P>
<img src="../ball.red.gif" alt="*">
2023-05-19 03:28:13 -04:00
Click <A href="lcc-3.4b.tar.gz">here</A> to download the <em>lcc</em>
3.4b distribution.
(965 KB)
<P>
<HR>
<P>
Related systems:
<UL>
<LI> Kenneth Russell's <A href="http://www-white.media.mit.edu/~kbrussel/Header2Scheme">Header2Scheme</A>.
<LI> David Beazley's <A href="http://www.cs.utah.edu/~beazley/SWIG/">SWIG</A> system.
</UL>
<P>
<HR>
<P>
The <A HREF="todo.html">FFIGEN to-do list</A>.
<P>
<A HREF="mailto:lth@acm.org"><I>lth@acm.org</I></A><BR>
24 May 2000
</BODY>
</HTML>