structures.rb 686 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. structures = parser.structures()
  7. puts "Structures number : #{structures.size}"
  8. structures.each do |s|
  9. puts "Structure Name : #{s.name}"
  10. puts "\thas name for linkage ? #{s.has_name_for_linkage}"
  11. puts "\thas linkage ? #{s.has_linkage}"
  12. puts "\ttypedef name: #{s.typedef_name}"
  13. fields = s.fields
  14. puts "\tfield number: #{fields.size}"
  15. fields.each do |f|
  16. puts "\t\t #{f.type.name} #{f.name}"
  17. end
  18. end
  19. structures.each do |s|
  20. puts s.raw(parser.source_manager,parser.lang_opts)
  21. end