1H2PH(1) Perl Programmers Reference Guide H2PH(1)
2
3
4
6 h2ph - convert .h C header files to .ph Perl header files
7
9 h2ph [-d destination directory] [-r | -a] [-l] [headerfiles]
10
12 h2ph converts any C header files specified to the corresponding Perl
13 header file format. It is most easily run while in /usr/include:
14
15 cd /usr/include; h2ph * sys/*
16
17 or
18
19 cd /usr/include; h2ph * sys/* arpa/* netinet/*
20
21 or
22
23 cd /usr/include; h2ph -r -l .
24
25 The output files are placed in the hierarchy rooted at Perl's
26 architecture dependent library directory. You can specify a different
27 hierarchy with a -d switch.
28
29 If run with no arguments, filters standard input to standard output.
30
32 -d destination_dir
33 Put the resulting .ph files beneath destination_dir, instead of
34 beneath the default Perl library location
35 ($Config{'installsitearch'}).
36
37 -r Run recursively; if any of headerfiles are directories, then run
38 h2ph on all files in those directories (and their subdirectories,
39 etc.). -r and -a are mutually exclusive.
40
41 -a Run automagically; convert headerfiles, as well as any .h files
42 which they include. This option will search for .h files in all
43 directories which your C compiler ordinarily uses. -a and -r are
44 mutually exclusive.
45
46 -l Symbolic links will be replicated in the destination directory. If
47 -l is not specified, then links are skipped over.
48
49 -h Put ``hints'' in the .ph files which will help in locating problems
50 with h2ph. In those cases when you require a .ph file containing
51 syntax errors, instead of the cryptic
52
53 [ some error condition ] at (eval mmm) line nnn
54
55 you will see the slightly more helpful
56
57 [ some error condition ] at filename.ph line nnn
58
59 However, the .ph files almost double in size when built using -h.
60
61 -D Include the code from the .h file as a comment in the .ph file.
62 This is primarily used for debugging h2ph.
63
64 -Q ``Quiet'' mode; don't print out the names of the files being
65 converted.
66
68 No environment variables are used.
69
71 /usr/include/*.h
72 /usr/include/sys/*.h
73
74 etc.
75
77 Larry Wall
78
80 perl(1)
81
83 The usual warnings if it can't read or write the files involved.
84
86 Doesn't construct the %sizeof array for you.
87
88 It doesn't handle all C constructs, but it does attempt to isolate
89 definitions inside evals so that you can get at the definitions that it
90 can translate.
91
92 It's only intended as a rough tool. You may need to dicker with the
93 files produced.
94
95 You have to run this program by hand; it's not run as part of the Perl
96 installation.
97
98 Doesn't handle complicated expressions built piecemeal, a la:
99
100 enum {
101 FIRST_VALUE,
102 SECOND_VALUE,
103 #ifdef ABC
104 THIRD_VALUE
105 #endif
106 };
107
108 Doesn't necessarily locate all of your C compiler's internally-defined
109 symbols.
110
111
112
113perl v5.10.1 2017-03-22 H2PH(1)