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