Documentation/translations/zh_CN/doc-guide/parse-headers.rst

Source file repositories/reference/linux-study-clean/Documentation/translations/zh_CN/doc-guide/parse-headers.rst

File Facts

System
Linux kernel
Corpus path
Documentation/translations/zh_CN/doc-guide/parse-headers.rst
Extension
.rst
Size
4199 bytes
Lines
188
Domain
Support Tooling And Documentation
Bucket
Documentation
Inferred role
Support Tooling And Documentation: documentation
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

.. SPDX-License-Identifier: GPL-2.0

.. include:: ../disclaimer-zh_CN.rst

:Original: Documentation/doc-guide/parse-headers.rst

:译者: 吴想成 Wu XiangCheng <bobwxc@email.cn>

=====================
包含用户空间API头文件
=====================

有时,为了描述用户空间API并在代码和文档之间生成交叉引用,需要包含头文件和示例
C代码。为用户空间API文件添加交叉引用还有一个好处:如果在文档中找不到相应符号,
Sphinx将生成警告。这有助于保持用户空间API文档与内核更改同步。
:ref:`parse_headers.py <parse_headers_zh>` 提供了生成此类交叉引用的一种方法。
在构建文档时,必须通过Makefile调用它。有关如何在内核树中使用它的示例,请参阅
``Documentation/userspace-api/media/Makefile`` 。

.. _parse_headers_zh:

parse_headers.py
----------------

脚本名称
~~~~~~~~


parse_headers.py——解析一个C文件,识别函数、结构体、枚举、定义并对Sphinx文档
创建交叉引用。


用法概要
~~~~~~~~


\ **parse_headers.py**\  [<选项>] <C文件> <输出文件> [<例外文件>]

<选项> 可以是: --debug, --help 或 --usage 。


选项
~~~~



\ **--debug**\

 开启脚本详细模式,在调试时很有用。


\ **--usage**\

 打印简短的帮助信息并退出。



\ **--help**\

 打印更详细的帮助信息并退出。


说明
~~~~

通过C头文件或源文件(<C文件>)中为描述API的文档编写的带交叉引用的 ..预格式化
文本 块将文件转换成重构文本(RST)。它接受一个可选的<例外文件>,其中描述了
哪些元素将被忽略或指向非默认引用。

输出被写入到<输出文件>。

Annotation

Implementation Notes