Parsing C header files with python

Miki Tebeka miki.tebeka at zoran.com
Mon Aug 23 04:55:02 EDT 2004


Hello Ian,

> I've got a header file which lists a whole load of C functions of the form
> 
>   int func1(float *arr, int len, double arg1);
>   int func2(float **arr, float *arr2, int len, double arg1, double arg2);
> 
> It's a numerical library so all functions return an int and accept varying
> combinations of float pointers, ints and doubles. 
> 
> What's the easiest way breaking down this header file into a list of
> functions and their argument using python? Is there something that will
> parse this (Perhaps a protoize.py) ? I don't want (or understand!) a full C
> parser, just this simple case.
There is an ANSI-C parser in ply (http://systems.cs.uchicago.edu/ply/)
which you can use.

Bye.
--
------------------------------------------------------------------------
Miki Tebeka <miki.tebeka at zoran.com>
http://tebeka.spymac.net
The only difference between children and adults is the price of the toys



More information about the Python-list mailing list