有没有很好的方法来生成swig接口文档? [英] Is there a good way to produce documentation for swig interfaces?

查看:97
本文介绍了有没有很好的方法来生成swig接口文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有任何好的方法可以在界面上构造/维护
文档。

I'd like to know if there are any good techniques for constructing/maintaining documentation on the interface.

我正在从以下位置构建界面使用swig的python的c ++代码;大部分我只是
%,包括c ++头文件。我正在处理至少几十个
类和100多个函数,因此首选自动化工具。

I'm building an interface from c++ code to python using swig; mostly I'm just %including the c++ header files. I'm dealing with at least dozens of classes and 100's of functions, so automated tools are preferred.

理想情况下,我想使用doxygen在c ++标头中格式化为
的注释会填充python类/方法中的文档字符串。

Ideally, I'd like to use the doxygen formatted comments in the c++ headers to populate the docstrings in the python classes/methods.

或者,生成单独的文档(使用ascii,html ...)
也会有用。似乎在swig的早期版本(1.3和更早版本)中支持
这类功能,但是我看不到用2.0来实现
的方法。

Alternately, generating separate documentation (in ascii, html...) would also be useful. It looks like this kind of functionality was supported in earlier versions of swig (1.3 and earlier) but I don't see a way to do it with 2.0.

是否有任何有用的(自动化)技术来记录接口?

Are there any useful (automated) techniques for documenting the interface?

推荐答案

%feature( autodoc) 使用SWIG 2.0,我认为目前为止。

There's some mileage in %feature("autodoc") with SWIG 2.0, which I think is as far is it goes currently.

例如:

%module test

%feature("autodoc", "3");

void foo (int *a, void *bar, double epsilon);

由于要插入一些模糊不清的文档。

causes some vaguely sane documentation to be inserted.

如果这还不够,我认为下一步最简单的方法是使用 %pythonprepend 来制作一个足够独特的标记 sed 或类似标记可用于将文档插入界面在SWIG自动运行之后:

If that isn't sufficient I think the next easiest step would be to use %pythonprepend to make a marker that's unique enough sed or similar can be used to insert documentation into the interface after SWIG has run automatically:

%pythonprepend foo "MARKER"

,然后:

sed -ei 's/MARKER/some documentation' test.py

在哪里可以找到%的函数pythonprepend ,方法是使用(Python?)脚本查看Doxygen输出,以生成标记并在运行SWIG之后替换它们。

Where you could find the functions to %pythonprepend by looking over the Doxygen output using a (Python?) script to generate the markers and substitute them after running SWIG.

这篇关于有没有很好的方法来生成swig接口文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆