Re: extracting constants from headers

Ralf Juengling <[email protected]> Sat, 1 Aug 2009 08:55:33 -0700 (PDT)
Newsgroups gmane.lisp.lush.devel
Message-ID <[email protected]>
On Sat, 25 Jul 2009, Ralf Juengling wrote:

> [...]
>
> This long (progn  ...)-expression was generated
> automatically by code in libc/cparser and copied into
> glenums.lsh.  Ok. But the definitions in glenums.lsh
> could become out of sync with what's actually in the
> header file gl.h (in fact, glenum.lsh was incomplete
> (and maybe out-of-sync) when I checked a couple days ago).
>
> What's wrong with extracting the constants from gl.h & co
> on the spot, when glenums.lsh is loaded?

I made this change in the update of the opengl interface
I submitted yesterday.  glenum.lsh now reads like this:

(libload "libc/cparse")
(libload "opengl/opengl-config")

(eval (cparse-extract-constants opengl-gl-h))
(eval (cparse-extract-constants opengl-glext-h))
(eval (cparse-extract-constants opengl-glu-h))

Let me know if you find there's a problem with loading
glenum.lsh or with missing constants.

If this works well, then we I think we should do more of
this. There are other situations where you wish lush could
parse C or C++ code to help you with creating interfaces.
We should look into using one of the open C/C++ parsers
(like Elsa, clang, or Sparse).

That would be a really cool project... if someone here
is looking for something to work on. ;)

ralf

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july