functions.rb 653 B

1234567891011121314151617181920212223242526
  1. #!/usr/bin/env ruby
  2. require "rtruckboris"
  3. #require File.dirname(__FILE__) + "/../lib/rtruckboris"
  4. parser = Rtruckboris::HeaderParser.new("./test_cpp", ["/usr/include"])
  5. parser.parse
  6. functions = parser.functions()
  7. puts "Functions number : #{functions.size}"
  8. functions.each do |f|
  9. puts "Name : #{f.name}"
  10. puts "Return : #{f.return_type.name}"
  11. params = f.parameters
  12. puts "\t #{params.size.to_s} parameters :"
  13. params.each do |p|
  14. puts "\t\t#{p.type.name} #{p.name}"
  15. if(!p.type.is_canonical)
  16. puts "\t\t\t#{p.type.canonical_type.name}"
  17. end
  18. end
  19. end
  20. functions.each do |f|
  21. puts f.raw(parser.source_manager,parser.lang_opts)
  22. end