| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "H2PH 1" |
| 58 |
.TH H2PH 1 2026-04-10 "perl v5.40.1" "Perl Programmers Reference Guide" |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
h2ph \- convert .h C header files to .ph Perl header files |
| 65 |
.SH SYNOPSIS |
| 66 |
.IX Header "SYNOPSIS" |
| 67 |
\&\fBh2ph [\-d destination directory] [\-r | \-a] [\-l] [\-h] [\-e] [\-D] [\-Q] |
| 68 |
[headerfiles]\fR |
| 69 |
.SH DESCRIPTION |
| 70 |
.IX Header "DESCRIPTION" |
| 71 |
\&\fIh2ph\fR |
| 72 |
converts any C header files specified to the corresponding Perl header file |
| 73 |
format. |
| 74 |
It is most easily run while in /usr/include: |
| 75 |
.PP |
| 76 |
.Vb 1 |
| 77 |
\& cd /usr/include; h2ph * sys/* |
| 78 |
.Ve |
| 79 |
.PP |
| 80 |
or |
| 81 |
.PP |
| 82 |
.Vb 1 |
| 83 |
\& cd /usr/include; h2ph * sys/* arpa/* netinet/* |
| 84 |
.Ve |
| 85 |
.PP |
| 86 |
or |
| 87 |
.PP |
| 88 |
.Vb 1 |
| 89 |
\& cd /usr/include; h2ph \-r \-l . |
| 90 |
.Ve |
| 91 |
.PP |
| 92 |
The output files are placed in the hierarchy rooted at Perl's |
| 93 |
architecture dependent library directory. You can specify a different |
| 94 |
hierarchy with a \fB\-d\fR switch. |
| 95 |
.PP |
| 96 |
If run with no arguments, filters standard input to standard output. |
| 97 |
.SH OPTIONS |
| 98 |
.IX Header "OPTIONS" |
| 99 |
.IP "\-d destination_dir" 4 |
| 100 |
.IX Item "-d destination_dir" |
| 101 |
Put the resulting \fB.ph\fR files beneath \fBdestination_dir\fR, instead of |
| 102 |
beneath the default Perl library location (\f(CW$Config{\*(Aqinstallsitearch\*(Aq}\fR). |
| 103 |
.IP \-r 4 |
| 104 |
.IX Item "-r" |
| 105 |
Run recursively; if any of \fBheaderfiles\fR are directories, then run \fIh2ph\fR |
| 106 |
on all files in those directories (and their subdirectories, etc.). \fB\-r\fR |
| 107 |
and \fB\-a\fR are mutually exclusive. |
| 108 |
.IP \-a 4 |
| 109 |
.IX Item "-a" |
| 110 |
Run automagically; convert \fBheaderfiles\fR, as well as any \fB.h\fR files |
| 111 |
which they include. This option will search for \fB.h\fR files in all |
| 112 |
directories which your C compiler ordinarily uses. \fB\-a\fR and \fB\-r\fR are |
| 113 |
mutually exclusive. |
| 114 |
.IP \-l 4 |
| 115 |
.IX Item "-l" |
| 116 |
Symbolic links will be replicated in the destination directory. If \fB\-l\fR |
| 117 |
is not specified, then links are skipped over. |
| 118 |
.IP \-h 4 |
| 119 |
.IX Item "-h" |
| 120 |
Put 'hints' in the .ph files which will help in locating problems with |
| 121 |
\&\fIh2ph\fR. In those cases when you \fBrequire\fR a \fB.ph\fR file containing syntax |
| 122 |
errors, instead of the cryptic |
| 123 |
.Sp |
| 124 |
.Vb 1 |
| 125 |
\& [ some error condition ] at (eval mmm) line nnn |
| 126 |
.Ve |
| 127 |
.Sp |
| 128 |
you will see the slightly more helpful |
| 129 |
.Sp |
| 130 |
.Vb 1 |
| 131 |
\& [ some error condition ] at filename.ph line nnn |
| 132 |
.Ve |
| 133 |
.Sp |
| 134 |
However, the \fB.ph\fR files almost double in size when built using \fB\-h\fR. |
| 135 |
.IP \-e 4 |
| 136 |
.IX Item "-e" |
| 137 |
If an error is encountered during conversion, output file will be removed and |
| 138 |
a warning emitted instead of terminating the conversion immediately. |
| 139 |
.IP \-D 4 |
| 140 |
.IX Item "-D" |
| 141 |
Include the code from the \fB.h\fR file as a comment in the \fB.ph\fR file. |
| 142 |
This is primarily used for debugging \fIh2ph\fR. |
| 143 |
.IP \-Q 4 |
| 144 |
.IX Item "-Q" |
| 145 |
\&'Quiet' mode; don't print out the names of the files being converted. |
| 146 |
.SH ENVIRONMENT |
| 147 |
.IX Header "ENVIRONMENT" |
| 148 |
No environment variables are used. |
| 149 |
.SH FILES |
| 150 |
.IX Header "FILES" |
| 151 |
.Vb 2 |
| 152 |
\& /usr/include/*.h |
| 153 |
\& /usr/include/sys/*.h |
| 154 |
.Ve |
| 155 |
.PP |
| 156 |
etc. |
| 157 |
.SH AUTHOR |
| 158 |
.IX Header "AUTHOR" |
| 159 |
Larry Wall |
| 160 |
.SH "SEE ALSO" |
| 161 |
.IX Header "SEE ALSO" |
| 162 |
\&\fBperl\fR\|(1) |
| 163 |
.SH DIAGNOSTICS |
| 164 |
.IX Header "DIAGNOSTICS" |
| 165 |
The usual warnings if it can't read or write the files involved. |
| 166 |
.SH BUGS |
| 167 |
.IX Header "BUGS" |
| 168 |
Doesn't construct the \f(CW%sizeof\fR array for you. |
| 169 |
.PP |
| 170 |
It doesn't handle all C constructs, but it does attempt to isolate |
| 171 |
definitions inside evals so that you can get at the definitions |
| 172 |
that it can translate. |
| 173 |
.PP |
| 174 |
It's only intended as a rough tool. |
| 175 |
You may need to dicker with the files produced. |
| 176 |
.PP |
| 177 |
You have to run this program by hand; it's not run as part of the Perl |
| 178 |
installation. |
| 179 |
.PP |
| 180 |
Doesn't handle complicated expressions built piecemeal, a la: |
| 181 |
.PP |
| 182 |
.Vb 7 |
| 183 |
\& enum { |
| 184 |
\& FIRST_VALUE, |
| 185 |
\& SECOND_VALUE, |
| 186 |
\& #ifdef ABC |
| 187 |
\& THIRD_VALUE |
| 188 |
\& #endif |
| 189 |
\& }; |
| 190 |
.Ve |
| 191 |
.PP |
| 192 |
Doesn't necessarily locate all of your C compiler's internally-defined |
| 193 |
symbols. |