Is there a good way to produce documentation for swig interfaces?

前端 未结 2 1904
梦毁少年i
梦毁少年i 2021-01-04 19:12

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

I\'m building an interface from c++ code to python us

2条回答
  •  青春惊慌失措
    2021-01-04 20:00

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

    For example:

    %module test
    
    %feature("autodoc", "3");
    
    void foo (int *a, void *bar, double epsilon);
    

    causes some vaguely sane documentation to be inserted.

    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"
    

    and then:

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

    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.

提交回复
热议问题