h2ph

NAME

h2ph - convert .h C header files to .ph Perl header files

SYNOPSIS

h2ph [-d destination_dir] [-r | -a] [-l] [header_file...]

DESCRIPTION

The h2ph(1) utility converts C header files to the corresponding Perl header-file format. It is most easily run with the current directory set to /usr/include. For example:

cd /usr/include; h2ph * sys/*

or

cd /usr/include; h2ph -r -l .

The output files are placed in the hierarchy rooted at Perl's architecture-dependent library directory. You can specify a different hierarchy with a -d switch.

If run with no arguments, filters standard input to standard output.

OPTIONS

-ddestination_dir
Put the resulting .ph files beneath destination_dir, instead of beneath the default Perl library location (`$Config{'installsitsearch'}').
-r
Run recursively; if any header_file is a directory, then run h2ph on all files in that directory (and its subdirectories, and so forth). The -r and -a options are mutually exclusive.
-a
Run automatically; convert each header_file, as well as any .h files that the header_file includes. This option will search for .h files in all directories which your C compiler ordinarily uses. The -a and -r options are mutually exclusive.
-l
Symbolic links will be replicated in the destination directory. If -l is not specified, links are skipped over.
-h
Put hints in the .ph files that will help in locating problems with h2ph. In those cases when you require a .ph file containing syntax errors, instead of the cryptic

[ error_condition ] at (eval mmm) line nnn

you will see the slightly more helpful

[ error_condition ] at filename.ph line nnn

However, the .ph files almost double in size when they are built using -h.
-D
Include the code from the .h file as a comment in the .ph file. This is primarily used for debugging h2ph.
-Q
Quiet mode; do not print out the names of the files being converted.

ENVIRONMENT

No environment variables are used.

AUTHOR

Larry Wall

DIAGNOSTICS

The h2ph utility produces the usual warnings if it cannot read or write the files involved.

BUGS

The h2ph utility does not construct the %sizeof array for you.

It does not handle all C constructs, but it does attempt to isolate definitions inside eval statements so that you can get at the definitions that it can translate.

It is only intended as a rough tool. You may need to modify the files produced.

It does not run with use strict.

You have to run this program yourself; it is not run as part of the Perl installation.

It does not handle complicated expressions built like this:

enum {
	FIRST_VALUE,
	SECOND_VALUE,
#ifdef ABC
	THIRD_VALUE
#endif
};

It might not locate all of your C compiler's internally defined symbols.