Greetings all,

I have implemented a bunch of libraries that facilitate parsing
and preprocessing C header and source files.  They are available
from:
https://code.launchpad.net/~aghuloum/scheme-libraries/ikarus-c

The libraries should work on all existing R6RS systems, but I've
only tested them on Ikarus, Larceny, PLT, and Ypsilon.

Motivation:  I don't want to hard-code *any* C constant in any
library that I write.  Anything that is already encoded in one
place should not be recoded in another.

Status: Right now, I can expand pretty much any C header file I
have on my computer.  I can also derive the constant values of
all #define'd constants with some minor support for arithmetic
operations.  I have tested that all OpenGL constants are OK by
comparing the derived constants to the ones already in the (gl)
library.  The file "test.ss" contains some rudimentary tests
and examples.

Next, I need to complete the arithmetic operations by properly
handling signed/unsigned numbers of different sizes as well as
adding the missing operations.  Next, I need to write a parser
for the preprocessed C tokens in order to get to the rest of the
C compile-time information, e.g., enum constants, structs and
unions, type definitions, function signatures, etc., etc.  This
will take some time of course.

The code is organized so that it can be useful for writing other
tools as well.  I have organized the libraries such that anything
that can be useful by itself is in its own library.  (e.g., you
can use the CPP parser without having to import the preprocessor)
So, just in case the current plan proves futile, the libraries
may still be used in part of another project.

Just wanted to give a quick summary of what I'm doing, and just
in case someone else has been crazy enough to think about doing
the same.  :-)

Aziz,,,

Reply via email to