summaryrefslogtreecommitdiff
path: root/lib/rdoc/parsers/parse_c.rb
diff options
context:
space:
mode:
authordave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-18 21:08:25 +0000
committerdave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-18 21:08:25 +0000
commit84f0b051de55b80211eab0ad2438f500af45e4a5 (patch)
treee1dc66c1eeaa459b2d9578e2b63cb9442f819368 /lib/rdoc/parsers/parse_c.rb
parentf75aff0139347afb89fcb931f6cc78703bb5c36a (diff)
Annotate enum.c. Add pager support, and report on methods in included modules
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/parsers/parse_c.rb')
-rw-r--r--lib/rdoc/parsers/parse_c.rb29
1 files changed, 26 insertions, 3 deletions
diff --git a/lib/rdoc/parsers/parse_c.rb b/lib/rdoc/parsers/parse_c.rb
index 3e8b48da34..39d136089b 100644
--- a/lib/rdoc/parsers/parse_c.rb
+++ b/lib/rdoc/parsers/parse_c.rb
@@ -140,6 +140,7 @@ module RDoc
remove_commented_out_lines
do_classes
do_methods
+ do_includes
@top_level
end
@@ -237,7 +238,8 @@ module RDoc
next if meth_name == "initialize_copy"
class_name = @known_classes[var_name] || var_name
- class_obj = @classes[var_name]
+ class_obj = find_class(var_name, class_name)
+
if class_obj
if meth_name == "initialize"
meth_name = "new"
@@ -297,7 +299,18 @@ module RDoc
end
end
-
+
+ # Look for includes of the form
+ # rb_include_module(rb_cArray, rb_mEnumerable);
+ def do_includes
+ @body.scan(/rb_include_module\(\s*(\w+?),\s*(\w+?)\s*\)/) do |c,m|
+ if cls = @classes[c]
+ m = KNOWN_CLASSES[m] || m
+ cls.add_include(Include.new(m, ""))
+ end
+ end
+ end
+
# Remove the /*'s and leading asterisks from C comments
def mangle_comment(comment)
@@ -306,7 +319,17 @@ module RDoc
comment.gsub!(/^[ \t]*\*/m) { " " * $&.length }
comment
end
-
+
+ def find_class(raw_name, name)
+ unless @classes[name]
+ if raw_name =~ /^rb_m/
+ @classes[name] = @top_level.add_module(NormalModule, name)
+ else
+ @classes[name] = @top_level.add_class(NormalClass, name, nil)
+ end
+ end
+ @classes[name]
+ end
end
end