Tilman Sauerbeck | 1 Aug 2004 10:30
Picon
Favicon

[PATCH] parse_c.rb: allow whitespace after function names

Hi,
here's a patch for rdoc (as shipped with ruby 1.8.1) that allows the
use of whitespace between a function name and the opening parenthesis,
like this:

rb_define_class_under (mFoo, "Bar", rb_cObject);
                     ^
Without the patch, rdoc wouldn't recognize the class definition because
it expects the opening parenthesis to appear just after the function
name.

I know omitting the space before the parenthesis is "ruby style", but
IMHO it makes sense to allow it for C code.

Please comment.

--

-- 
Regards,
Tilman
diff -aur ruby-1.8.1.orig/lib/rdoc/parsers/parse_c.rb ruby-1.8.1/lib/rdoc/parsers/parse_c.rb
--- ruby-1.8.1.orig/lib/rdoc/parsers/parse_c.rb	2003-12-24 05:30:35.000000000 +0100
+++ ruby-1.8.1/lib/rdoc/parsers/parse_c.rb	2004-08-01 09:57:06.431256936 +0200
 <at>  <at>  -194,13 +194,13  <at>  <at> 
     end

     def do_classes
-       <at> body.scan(/(\w+)\s* = \s*rb_define_module\(\s*"(\w+)"\s*\)/mx) do 
+       <at> body.scan(/(\w+)\s* = \s*rb_define_module\s*\(\s*"(\w+)"\s*\)/mx) do 
(Continue reading)

Tilman Sauerbeck | 1 Aug 2004 10:51
Picon
Favicon

class definitions split across several files

Hi,
my Ruby extension consists of a bunch of classes which are split across
several files, one file for each class.

When I run rdoc on the C code, I get messages like the following:

foo.c: Enclosing class/module "bar" for class Foo not known

oThis is due to the fact that for each input file a new C_Parser is
instantiated, which stores the known classes in  <at> classes.

Is there a workaround for this problem?

What I did was to turn  <at> classes into a class variable; this works for my
projects but in some cases this behaviour might be undesirable.

--

-- 
Regards,
Tilman

Tilman Sauerbeck | 9 Aug 2004 14:57
Picon
Favicon

[PATCH] simple bug in find_module

Hi,
here's a patch for a simple bug in code_objects.rb::find_module.

--

-- 
Regards,
Tilman
diff -aur ruby-1.8.1.orig/lib/rdoc/code_objects.rb ruby-1.8.1/lib/rdoc/code_objects.rb
--- ruby-1.8.1.orig/lib/rdoc/code_objects.rb	2003-12-24 05:30:35.000000000 +0100
+++ ruby-1.8.1/lib/rdoc/code_objects.rb	2004-08-07 13:02:38.365632552 +0200
 <at>  <at>  -316,6 +316,7  <at>  <at> 
           if result
             modules.each do |module_name|
               result = result.find_module_named(module_name)
+              break unless result
             end
           end
         end
Peter McMaster | 27 Aug 2004 19:46
Picon
Picon

RDoc problems

Hello!

Possibly a dumb question, but any idea why running rdoc in 
/opt/local/lib/ruby (where it's all at) produces the following:

Generating HTML...
/opt/local/lib/ruby/1.8/rdoc/generators/html_generator.rb:419:in 
`build_method_detail_list': undefined method `as_href' for nil:NilClass 
(NoMethodError)
         from 
/opt/local/lib/ruby/1.8/rdoc/generators/html_generator.rb:416:in `map'
         from 
/opt/local/lib/ruby/1.8/rdoc/generators/html_generator.rb:416:in 
`build_method_detail_list'
         from 
/opt/local/lib/ruby/1.8/rdoc/generators/html_generator.rb:401:in `each'
         from 
/opt/local/lib/ruby/1.8/rdoc/generators/html_generator.rb:401:in 
`build_method_detail_list'
         from 
/opt/local/lib/ruby/1.8/rdoc/generators/html_generator.rb:399:in `each'
         from 
/opt/local/lib/ruby/1.8/rdoc/generators/html_generator.rb:399:in 
`build_method_detail_list'
         from 
/opt/local/lib/ruby/1.8/rdoc/generators/html_generator.rb:398:in `each'
         from 
/opt/local/lib/ruby/1.8/rdoc/generators/html_generator.rb:398:in 
`build_method_detail_list'
          ... 7 levels...
(Continue reading)

jbritt | 27 Aug 2004 22:14
Favicon

Re: RDoc problems

Peter McMaster wrote:
> Hello!
> 
> Possibly a dumb question, but any idea why running rdoc in 
> /opt/local/lib/ruby (where it's all at) produces the following:
> 
> Generating HTML...
> /opt/local/lib/ruby/1.8/rdoc/generators/html_generator.rb:419:in 
> `build_method_detail_list': undefined method `as_href' for nil:NilClass 

This looks similar to this

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/84835
and
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/88969

Not sure if they will answer the problem.

I believe, though, you need to run rdoc in the ruby/lib dir.

I tried searching around for more info, as I know this sort of thing 
comes up every so often.  Maybe the first entry for a ruby-doc FAQ?

If you can't get an answer here, then you may want to post to ruby-talk, 
or contact Dave Thomas directly.  He maintains rdoc but does not,  as 
far as I know, follow this mailing list.

James

(Continue reading)

Peter McMaster | 28 Aug 2004 02:01
Picon
Picon

Re: RDoc problems

Aah! Thanks for the pointer, should have thought to check.

A google ( 
http://www.google.com/search?q=site:blade.nagaokaut.ac.jp+rdoc ) 
produces lots of relates stuff, so hopefully I'll be able to figure out 
what's unhappy, and why.

Thanks again,

  - Peter

On 27 Aug 2004, at 21:14, jbritt wrote:

> Peter McMaster wrote:
>> Hello!
>> Possibly a dumb question, but any idea why running rdoc in 
>> /opt/local/lib/ruby (where it's all at) produces the following:
>> Generating HTML...
>> /opt/local/lib/ruby/1.8/rdoc/generators/html_generator.rb:419:in 
>> `build_method_detail_list': undefined method `as_href' for 
>> nil:NilClass
>
>
> This looks similar to this
>
> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/84835
> and
> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/88969
>
> Not sure if they will answer the problem.
(Continue reading)

jbritt | 28 Aug 2004 02:28
Favicon

Re: RDoc problems

Peter McMaster wrote:
> Aah! Thanks for the pointer, should have thought to check.
> 
> A google ( 
> http://www.google.com/search?q=site:blade.nagaokaut.ac.jp+rdoc ) 
> produces lots of relates stuff, so hopefully I'll be able to figure out 
> what's unhappy, and why.
> 
> Thanks again,
> 
>  - Peter
> 

Glad to help.  If you do figure out the problem, could you drop a line 
here?  I'd like to write  up something on running rdoc on the Ruby 
source or installation tree; I do it so infrequently I can never recall 
exactly what to do.

Thanks,

James

Peter McMaster | 28 Aug 2004 03:39
Picon
Picon

Re: RDoc problems

I think that possibly one of the things which makes it more complex is 
that I have ruby installed via the darwinports ( 
darwinports.opendarwin.org/ ) system.

Basically 'port install ruby' installs v1.8.1 of ruby, puts it in a 
sensible place for an OS X system, and sets paths etc. so it all works. 
Great way of installing things (partly because 'port uninstall 
whatever' works like one would hope!), but not so helpful when it comes 
to working out problems like this.

   port fetch ruby
   port expand ruby

...puts the 1.8.1 source files in a work directory (these are 
sub-stages which usually are completed by 'port install ...'). After 
reading through 
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/89061 I ran 
the following in the freshly fetched ruby source dir:

   rdoc --ri *.c lib/*.rb

...which apparently worked fine. (This didn't work in 
/opt/local/lib/ruby/) Interestingly, it seemed to fail to pick up 
anything from any of the .c files, so for example you get:

   ~> ri 'Array.flatten!'
   Nothing known about Array.flatten!

...possibly missing something obvious there?

(Continue reading)

jbritt | 28 Aug 2004 05:28
Favicon

Re: RDoc problems

Peter McMaster wrote:
> I think that possibly one of the things which makes it more complex is 
> that I have ruby installed via the darwinports ( 
> darwinports.opendarwin.org/ ) system.
> 
> Basically 'port install ruby' installs v1.8.1 of ruby, puts it in a 
> sensible place for an OS X system, and sets paths etc. so it all works. 
> Great way of installing things (partly because 'port uninstall whatever' 
> works like one would hope!), but not so helpful when it comes to working 
> out problems like this.
> 
>   port fetch ruby
>   port expand ruby
> 
> ...puts the 1.8.1 source files in a work directory (these are sub-stages 
> which usually are completed by 'port install ...'). After reading 
> through 
> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/89061 I ran 
> the following in the freshly fetched ruby source dir:
> 
>   rdoc --ri *.c lib/*.rb
> 
> ...which apparently worked fine. (This didn't work in 
> /opt/local/lib/ruby/) Interestingly, it seemed to fail to pick up 
> anything from any of the .c files, so for example you get:
> 
>   ~> ri 'Array.flatten!'
>   Nothing known about Array.flatten!
> 
> ...possibly missing something obvious there?
(Continue reading)

Mehr, Assaph (Assaph | 30 Aug 2004 06:11
Favicon

[BUG?] docomentation for Module::included

Hi,
 
Running ri Module#included returns:
 
-------------------------------------------------------- Module#included
     singleton_method_undefined(symbol)
------------------------------------------------------------------------
     Document-method: singleton-method-undefined
I.E. the documentation for a differenct method. Seems like a bug in the docos.

Cheers,
Assaph

Assaph Mehr
Email: assaph <at> avaya.com
Phone: +61-2-9352 9247
Fax: +61-2-9352 9247

Auslabs (Avaya Labs Australia)
Level 3, 123 Epping Rd, North Ryde, NSW 2113
Web: http://www.avaya.com

 

Gmane