Class: CGccFileProvider
- Inherits:
-
Object
- Object
- CGccFileProvider
- Defined in:
- lib/providers/c_gcc_file_provider.rb
Instance Method Summary collapse
-
#initialize ⇒ CGccFileProvider
constructor
A new instance of CGccFileProvider.
- #parse(node, data) ⇒ Object
Constructor Details
#initialize ⇒ CGccFileProvider
Returns a new instance of CGccFileProvider.
2 3 4 |
# File 'lib/providers/c_gcc_file_provider.rb', line 2 def initialize @current_function = "" end |
Instance Method Details
#parse(node, data) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/providers/c_gcc_file_provider.rb', line 6 def parse(node, data) data.readlines.each do |line| if (line =~ /\A;; Function [^(]*\(([^,)]*).*\Z/) name = $1 @current_function = name node.add_public_function name elsif (@current_function != "" and node.nodes[@current_function]) function = node.nodes[@current_function] if (line =~ /.*(call|symbol_ref).*\"(.*)\"/) node.add_dependency @current_function, $2 end if (line =~ /jump_insn/) function.increase_edges function.increase_edges function.increase_nodes end if (line =~ /code_label/) function.increase_edges function.increase_nodes end if (line =~ /insn/) function.increase_size end end end end |