RDoc and SWIG

G

Gennady Bystritksy

Hi, rubyists

I use SWIG to wrap C++ classes into Ruby. Is there any way to use RDoc
comments in the original C++ classes to generate documentation for ruby
API? From what I can see, RDoc looks for rb_define_class() and
rb_define_method() to extract classes and methods to be documented,
however those are generated by SWIG in the build phase.

RDoc understands "Document-class" and "Document-metnod" directives,
however those seem to be taken into account only after a class or a
method is extracted from rb_define_class()/rb_define_method().

Are there any directives (or any plans to add them) that would allow to
directly specify that the RDoc comment is for a particular class or a
particular class/instance method?

Thank you,
Gennady Bystritsky.
 
S

Sam Roberts

Quoting (e-mail address removed), on Tue, May 24, 2005 at 03:17:01AM +0900:
Hi, rubyists

I use SWIG to wrap C++ classes into Ruby. Is there any way to use RDoc
comments in the original C++ classes to generate documentation for ruby
API? From what I can see, RDoc looks for rb_define_class() and
rb_define_method() to extract classes and methods to be documented,
however those are generated by SWIG in the build phase.

I would be surprised if this works, but you might get lucky.

If you don't get lucky, a DDJ article of a few months back described a
way of using doxygen with visual basic, that might apply to documenting
c++ with rdoc. Basically, run a script converting the C++ to something
that looks like ruby. It doesn't have to be ruby, you can remove all the
code inside methods, for example, but enough like ruby that rdoc will
process the file and generate API docs.

Sam
 
G

Gennady Bystritsky

Quoting (e-mail address removed), on Tue, May 24, 2005 at 03:17:01AM +0900:

I would be surprised if this works, but you might get lucky.

If you don't get lucky, a DDJ article of a few months back described a
way of using doxygen with visual basic, that might apply to documenting
c++ with rdoc. Basically, run a script converting the C++ to something
that looks like ruby. It doesn't have to be ruby, you can remove all
the
code inside methods, for example, but enough like ruby that rdoc will
process the file and generate API docs.

Sam

Interesting. However, it sounds like a lot of hassle. I took another
approach, though. I need some pure Ruby methods in my wrapped classes
anyways, so even for the methods implemented in C++, I add a pure Ruby
method (honoring ruby name conventions, otherwise achieved by SWIG
%rename directive), from where I simply delegate to my corresponding
C++ methods, witch I make private. This gives me the opportunity to
document the methods naturally, for the cost of extra redirection.

Thanks, Sam.
Gennady.
 
L

Lothar Scholz

Hello Gennady,

GB> Hi, rubyists

GB> I use SWIG to wrap C++ classes into Ruby. Is there any way to use RDoc

When using SWIG and Ruby do the that FXRuby does. Generate a complete
stub set of ruby files only for the purpose of generating RDOC
documentation. This duplicates information but is still the best way.
 
G

Gennady Bystritksy

Lothar said:
Hello Gennady,

GB> Hi, rubyists

GB> I use SWIG to wrap C++ classes into Ruby. Is there any way to use RDoc

When using SWIG and Ruby do the that FXRuby does. Generate a complete
stub set of ruby files only for the purpose of generating RDOC
documentation. This duplicates information but is still the best way.
That's, actually, what I ended up with, on my own ;-). Thanks.

Gennady.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,172
Messages
2,570,934
Members
47,477
Latest member
ColumbusMa

Latest Threads

Top