On Wed, 1 Aug 2001, Jerrold Beckman wrote:
> I have a header file that contains a lot of:
> const ULONG Variable_name = Makeval( Type, 0x2);
>
> variables that I need access to in perl. The Makeval is a macro that is
> defined in the header file. Does anybody know of a way to do this?
>
> I would just declare them in the .pm file with the value, but I have
> something like 40 to 50 that I need.
Ok, so you need the C pre-processor to have its way with the header file
first in order to get those macros correctly expanded, correct? Maybe
something like:
gcc -E -Isome_directories_maybe yourfile.h > expanded.h
Then, try h2ph on 'expanded.h'. If that makes a mess of it, you may have
to write your own little parser (usually a Perl one-liner) to properly
crunch it. I've had to do this from time to time, particularly if the
source has enum types you need to scarf up.
Give a yell if this doesn't get you going.
Steve