Linux command
h2ph 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Convert a C header file to Perl
h2ph [header.h]
Process all system headers recursively
cd /usr/include && h2ph -r -l *.h
Output to a specific directory
h2ph -d [/usr/lib/perl5] [header.h]
Convert a header and all headers it includes
h2ph -a [sys/types.h]
说明
h2ph converts C header files (.h) to Perl header files (.ph). It translates #define macros and constant definitions into Perl equivalents that can be loaded with require. The tool is best run from /usr/include to convert system headers. It wraps definitions inside eval blocks so that you can access the definitions it can translate even if some fail. Output .ph files are placed in Perl's architecture-dependent library directory by default.
参数
- -d _DIR_
- Put resulting .ph files beneath the specified directory instead of the default Perl library location.
- -r
- Run recursively, converting all .h files in specified directories and their subdirectories.
- -a
- Run automagically; convert specified headers as well as any .h files they include.
- -l
- Create symbolic links for duplicate output files instead of separate copies.
- -D _DIR_
- Search the specified directory for included header files.
- -e
- If an error is encountered during conversion, output file names and continue parsing.
- -Q
- Quiet mode. Do not print the names of converted files.
FAQ
What is the h2ph command used for?
h2ph converts C header files (.h) to Perl header files (.ph). It translates #define macros and constant definitions into Perl equivalents that can be loaded with require. The tool is best run from /usr/include to convert system headers. It wraps definitions inside eval blocks so that you can access the definitions it can translate even if some fail. Output .ph files are placed in Perl's architecture-dependent library directory by default.
How do I run a basic h2ph example?
Run `h2ph [header.h]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -d _DIR_ do in h2ph?
Put resulting .ph files beneath the specified directory instead of the default Perl library location.