NAME
melange - Translates C headers into Dylan
SYNOPSIS
d2c [-v] [--mindy|--d2c] [-I includedir]... infile [outfile]
WARNING
This man page is intended to supplement the main Gwydion Dylan documentation at http://www.gwydiondylan.org/. It provides an incomplete reference of the available options. For a full reference or a tutorial, please see the web site.
DESCRIPTION
melange parses C headers and emits equivalent Dylan interfaces. The current version can handle some fairly ugly headers, but not everything found on the average Unix system. Melange actually contains a full-fledged C preprocessor and a C parser. Unlike many similar tools, it's not just doing simple pattern matching--it's actually trying to emulate the front end of a C compiler.
Eventually, we want Melange to handle any header which GCC can parse. For the time being, generating interfaces is more of an art, and any large set of headers is virtually gauranteed to find a new bug. Please report every bug you encounter to [email protected], preferably with a short example. We're trying to locate and fix all the problems, and should respond fairly quickly.
IMPORTING HEADERS
To import a header named foo.h, you'll probably want to add a new module to your exports.dylan file. Call it foo-interface. Make sure your library uses melange-support, and that foo-interface uses the module of the same name:
library: my-application
define library my-application
use dylan;
use melange-support;
end library;
define module my-application
use dylan;
use melange-support;
use foo-interface;
end module;
define module foo-interface
use dylan;
use melange-support;
export
/* All the things you want from foo.h. */;
end module;
Next, create a file called foo-intr.intr which appears as follows:
module: foo-interface define interface #include "foo.h"; end interface;
Type melange -v foo-intr.intr foo-intr.dylan to process the header file. Then add foo-intr.dylan to your lid file and recompile your program.
There are many other things which can be added to an interface definition to control imports, rename symbols, express relationships between types and define preprocessor macros. These are described in detail by the Melange manual (which is available through the website).
OPTIONS
- --help
-
Print out a message describing the available options.
- --version
-
Print out the version and copyright.
- -v, --verbose
-
Print out the name of each C declaration as Melange processes it. This should help find where Melange crashed, choked or got confused.
- --d2c, --mindy
-
Only generate code for one environment or the other. The default is to generate code for both.
- -I, --include-dir dir
-
Search dir for C headers.
BUGS
Lots of them. Everywhere. We're fixing them as quickly as we can. (See the bug tracker on the website for an up-to-date list.)
In particular, it would be desirable for melange to search include directories in exactly the fashion as a given platform's C compiler.
SEE ALSO
Much more extensive documentation in various formats is available through the Gwydion Dylan web site at http://www.gwydiondylan.org/.
AUTHORS
The Gwydion Group at CMU and the current Gwydion Dylan maintainers. See the CREDITS file in the Gwydion Dylan distribution for more information.