Discussion:
[Swig-devel] autodoc and C++ type names
Kris Thielemans
2014-11-18 02:37:53 UTC
Permalink
Hi all

I have a problem with typenames emitted when using

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

In some cases, the C++ typenames are used, which really isn't appropriate
for the target language. However,
Confusingly this doesn't happen all the time. For instance, when generating
Python, I can get for one class

get_exam_info(...)
get_exam_info() -> stir::shared_ptr< stir::ExamInfo >
set_exam_info(...)
set_exam_info(ExamInfo arg2)

In this example, this difference occurs between an argument and a return
value, but this isn't always the case. I've had a look at the code that
generates the autodoc but am not sure how to fix this.

On a possibly related note, the autodoc also (sometimes?) generates C++
types for built-in types like this

set_num_detector_layers(...)
set_num_detector_layers(int const & new_num)

anyone any idea how to fix this? The relevant code always looks like this

Node *nn = classLookup(type);
type_str = nn ? Copy(Getattr(nn, "sym:name")) :
SwigType_str(type, 0);

so, presumably, in some case the classLookup fails.

If need be, I can try to come up with a small example of course.

Kris

PS: I'm using swig 3.0.3. should I check with current master?
Vadim Zeitlin
2014-11-18 13:11:51 UTC
Permalink
On Tue, 18 Nov 2014 02:37:53 -0000 Kris Thielemans <***@gmail.com> wrote:

KT> I have a problem with typenames emitted when using
KT>
KT> % feature("autodoc", "1");

Sorry, I don't have any solution for this...

KT> In this example, this difference occurs between an argument and a return
KT> value, but this isn't always the case. I've had a look at the code that
KT> generates the autodoc but am not sure how to fix this.

... but I just wanted to say that it would be great if any changes to
autodoc handling could be postponed until the doxygen branch merge because
doing them now would almost certainly result in conflicts with the changes
there. Also, I didn't change the handling of autodoc itself much (for my
purposes it's not nearly as useful as Doxygen), but you could still try
the version from https://github.com/swig/swig/pull/170 just in case.

Regards,
VZ

Continue reading on narkive:
Loading...