Class: Silhouette::ASCIIConverterLong

Inherits:
ASCIIConverter show all
Defined in:
lib/silhouette/converter.rb

Instance Method Summary collapse

Methods inherited from ASCIIConverter

#close, #process_end, #process_start

Methods inherited from Processor

#process_end, #process_start, #run

Constructor Details

#initialize(file) ⇒ ASCIIConverterLong

Returns a new instance of ASCIIConverterLong.



49
50
51
52
53
54
55
56
# File 'lib/silhouette/converter.rb', line 49

def initialize(file)
    @methods = Hash.new
    @files = Hash.new
    @last_method = nil
    @last_series = nil
    @skip_return = false
    super(file)
end

Instance Method Details

#process_call(thread, meth, file, line, clock) ⇒ Object



65
66
67
# File 'lib/silhouette/converter.rb', line 65

def process_call(thread, meth, file, line, clock)
    @io.puts "c #{thread} #{@methods[meth]} #{@files[file]} #{line} #{clock}"
end

#process_call_rep(thread, meth, file, line, clock) ⇒ Object



77
78
79
80
81
82
83
84
85
86
# File 'lib/silhouette/converter.rb', line 77

def process_call_rep(thread, meth, file, line, clock)
    if @last_method == [thread, meth, file, line] and @last_series
        @last_series += 1
        @skip_return = true
    else
        @io.puts "cal #{thread} #{@methods[meth]} #{meth} #{@files[file]} #{line} #{clock}"
    end
    
    @last_method = [thread, meth, file, line]
end

#process_file(idx, file) ⇒ Object



61
62
63
# File 'lib/silhouette/converter.rb', line 61

def process_file(idx, file)
    @files[idx] = file
end

#process_line(thread, meth, file, line, clock) ⇒ Object



73
74
75
# File 'lib/silhouette/converter.rb', line 73

def process_line(thread, meth, file, line, clock)
  @io.puts "l #{thread} #{@files[file]} #{line} #{clock}"
end

#process_method(idx, klass, kind, meth) ⇒ Object



57
58
59
# File 'lib/silhouette/converter.rb', line 57

def process_method(idx, klass, kind, meth)
    @methods[idx] = [klass, kind, meth].to_s
end

#process_return(thread, meth, file, line, clock) ⇒ Object



69
70
71
# File 'lib/silhouette/converter.rb', line 69

def process_return(thread, meth, file, line, clock)
    @io.puts "r #{thread} #{@methods[meth]} #{clock}"
end

#process_return_rep(thread, meth, file, line, clock) ⇒ Object



88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/silhouette/converter.rb', line 88

def process_return_rep(thread, meth, file, line, clock)
    if @last_method == [thread, meth, file, line]
        @last_series = 1 unless @last_series
    elsif @last_series
        p [thread, meth, @methods[meth]]
        p @last_method
        @io.puts "rep #{@last_series}"
        @last_series = nil
        @skip_return = false
    end
    return if @skip_return
    @io.puts "ret #{thread} #{@methods[meth]} #{clock}"
end