extracting constants from headers

Ralf Juengling <[email protected]> Sat, 25 Jul 2009 18:02:43 -0700 (PDT)
Newsgroups gmane.lisp.lush.devel
Message-ID <[email protected]>
So, some interfaces like ffmpeg or opengl have some
source files that reproduce constant definitions from
header files. The file packages/opengl/glenums.lsh for
example starts like this (in lush 1.2):


(libload "libc/constants")


;;; Constants extracted from gl.h
(progn
   (defconstant "GL_VERSION_1_1" 1)
   (defconstant "GL_VERSION_1_2" 1)
   (defconstant "GL_FALSE" 0)
   (defconstant "GL_TRUE" 1)
   (defconstant "GL_BYTE" 5120)
...


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?

ralf



------------------------------------------------------------------------------