Rdtool and extensions


(Berger, Daniel) #1

Hi all,

Is there a way to use rd style documention within a .c extension? Is there
one of those “hidden” .h files that allows me to do this? Or does the
ruby.h file allow this somehow?

If not, what is the best way to create documentation for an extension? Just
create a separate .rd file to match the .c file? Right now I’m just
manually generating a text & html file, but I’d like to get away from that
if possible.

Regards,

Dan


(Danny van Bruggen) #2

Do you want to do this?

/*
=begin
— CDROM#number
Returns the unit number that was specified in ((<CDROM.new>)).
=end */
static VALUE cdrom_number(VALUE self)
{
return rb_iv_get(self, “@id”);
}

You can run rd2 on .c (even .h) files. The parser will eat it, because it
is just looking for =begin and =end.

I heard rumours that rdoc will support reading C source someday, but how
it will do that is a mystery to me!

Danny

···

On Wed, 5 Jun 2002, Berger, Daniel wrote:

Hi all,

Is there a way to use rd style documention within a .c extension? Is there
one of those “hidden” .h files that allows me to do this? Or does the
ruby.h file allow this somehow?

If not, what is the best way to create documentation for an extension? Just
create a separate .rd file to match the .c file? Right now I’m just
manually generating a text & html file, but I’d like to get away from that
if possible.

Regards,

Dan


(Dave Thomas) #3

Danny van Bruggen danny@froukepc.dhs.org writes:

I heard rumours that rdoc will support reading C source someday, but how
it will do that is a mystery to me!

It does it right now: if you feed the C source code for a Ruby
extension into RDoc it documents the classes, modules, and methods it
finds. It isn’t complete, but it’s getting there.

Dave