Re: htopy?

Guido.van.Rossum@cwi.nl
Tue, 03 Jan 1995 11:39:24 +0100

> I remember seeing a reference to "htopy.py" - a tool for generating
> .py files
> from the #defines in a C .h file.
>
> Does such a utility exist? If so, where can I find it?

Have a look at Demo/scripts/h2py.py. From the header:

# Read #define's and translate to Python code.
# Handle #include statements.
# Handle #define macros with one argument.
# Anything that isn't recognized or doesn't translate into valid
# Python is ignored.

# Without filename arguments, acts as a filter.
# If one or more filenames are given, output is written to corresponding
# filenames in the local directory, translated to all uppercase, with
# the extension replaced by ".py".

# By passing one or more options of the form "-i regular_expression"
# you can specify additional strings to be ignored. This is useful
# e.g. to ignore casts to u_long: simply specify "-i '(u_long)'".

--Guido van Rossum, CWI, Amsterdam <mailto:Guido.van.Rossum@cwi.nl>
<http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>