class RDoc::Parser::C

def do_methods

def do_methods
  @content.scan(%r%rb_define_
                 (
                    singleton_method |
                    method           |
                    module_function  |
                    private_method
                 )
                 \s*\(\s*([\w\.]+),
                   \s*"([^"]+)",
                   \s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\(|\(METHOD\))?(\w+)\)?,
                   \s*(-?\w+)\s*\)
                 (?:;\s*/[*/]\s+in\s+(\w+?\.(?:cpp|c|y)))?
               %xm) do |type, var_name, meth_name, function, param_count, source_file|
    # Ignore top-object and weird struct.c dynamic stuff
    next if var_name == "ruby_top_self"
    next if var_name == "nstr"
    var_name = "rb_cObject" if var_name == "rb_mKernel"
    handle_method(type, var_name, meth_name, function, param_count,
                  source_file)
  end
  @content.scan(%r%rb_define_global_function\s*\(
                           \s*"([^"]+)",
                           \s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\()?(\w+)\)?,
                           \s*(-?\w+)\s*\)
              (?:;\s*/[*/]\s+in\s+(\w+?\.[cy]))?
              %xm) do |meth_name, function, param_count, source_file|
    handle_method("method", "rb_mKernel", meth_name, function, param_count,
                  source_file)
  end
  @content.scan(/define_filetest_function\s*\(
                   \s*"([^"]+)",
                   \s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\()?(\w+)\)?,
                   \s*(-?\w+)\s*\)/xm) do |meth_name, function, param_count|
    handle_method("method", "rb_mFileTest", meth_name, function, param_count)
    handle_method("singleton_method", "rb_cFile", meth_name, function,
                  param_count)
  end
end