Method: FunctionGraph#scan

Defined in:
lib/codegraph.rb

#scanObject



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/codegraph.rb', line 157

def scan
  jobqueue = JobQueue.new
  # scan functions fo all other function names
  names = @parser.funx.keys + @adds - @excludes
  @parser.funx.each_pair {|name,body|
    next unless names.include?(name)
    jobqueue.push {
      puts "Add func: #{name}" if @debug
      # Check if this body is in the funx DB
      bodyCk = hexencode(body)
      if @@funxDB.has_key?(bodyCk) and @@funxDB[name] == body
        edges = @@funxDB[bodyCk]
        edges.each {|edge| self.edge(*edge)}
      else
        edges = []
        self.node(name)
        (names - [name]).each { |func|
          if/#@@matchBeforFuncName#{Regexp.escape(func)}#@@matchAfterFuncName/.match(body)
            edge = ["#{name}","#{func}"]
            self.edge(*edge)
            edges << edge
          end
        }
        @@lock.synchronize {
          @@funxDB[bodyCk] = edges
          @@funxDB[name]   = body
        }
      end
    }
  }
  jobqueue.run

  updateFunxDB
end