How to detect C Function block using python

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Mar 9 15:56:24 EST 2010


En Tue, 09 Mar 2010 04:51:57 -0300, Faheem <faheem_imt at yahoo.com> escribió:

> I'm new in this community. I am writing a static analyzer for validating  
> C Code using python and for that I'm looking for a python module/API  
> that will detect Function block of a given C-File. I know simple  
> function can be detected using push "{" and poping it if character "}"  
> is found. This solution is actually done already, I want a robust API  
> that can do more then that like detecting Function name parameters its  
> return types etc.

Take a look at ctypeslib [1]; it uses gccxml [2] to parse .h header files  
and generate equivalent Python declarations.

[1] http://svn.python.org/view/ctypes/trunk/ctypeslib/
[2] http://www.gccxml.org/

-- 
Gabriel Genellina




More information about the Python-list mailing list