extract c/cpp include file with regular expression

Nick Craig-Wood nick at craig-wood.com
Thu Jul 23 15:29:57 EDT 2009


tiefeng wu <icebergwtf at gmail.com> wrote:
>  I need to parse c/cpp source files, one requirement is to extract
>  included header file name.

If you are serious about parsing C code then you'll want to
investigate gcc-xml

http://www.gccxml.org/HTML/Index.html

This runs the gcc frontend over the code but instead of producing an
object file, it produces a machine readable xml file describing the
source.

It is used by h2xml.py / xml2py.py to make ctypes header file
automatically.

-- 
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick



More information about the Python-list mailing list