codegraph 0.7.20 → 0.7.21
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/codegraph.rb +15 -6
- metadata +4 -4
data/lib/codegraph.rb
CHANGED
@@ -7,10 +7,12 @@ require 'pp'
|
|
7
7
|
|
8
8
|
|
9
9
|
module Codegraph
|
10
|
-
VERSION = '0.7.
|
10
|
+
VERSION = '0.7.21'
|
11
11
|
end
|
12
12
|
|
13
13
|
class CodeParser
|
14
|
+
include Digest
|
15
|
+
|
14
16
|
attr_reader :funx,:files
|
15
17
|
attr_accessor :exclude
|
16
18
|
|
@@ -50,7 +52,7 @@ class CodeParser
|
|
50
52
|
puts "Processing #{file} ..." if @debug
|
51
53
|
end
|
52
54
|
|
53
|
-
checksum =
|
55
|
+
checksum = hexencode(file)
|
54
56
|
if @@filesDB.has_key?(checksum) and @@filesDB.has_key?(file)
|
55
57
|
code,funxLocations = @@filesDB[checksum]
|
56
58
|
@files[file] = @@filesDB[file]
|
@@ -61,7 +63,7 @@ class CodeParser
|
|
61
63
|
when '.c','.h'
|
62
64
|
cppCommand = "cpp -w -fpreprocessed -E -fdirectives-only #{file} -o #{@dir}/#{tempfile} 2>/dev/null"
|
63
65
|
cppCommand = "cpp -fpreprocessed #{file} -o #{@dir}/#{tempfile} 2>/dev/null"
|
64
|
-
grep = "grep -v -e '^$' #{@dir}/#{tempfile} | grep -v -e '^#' > #{@dir}/#{basefile}"
|
66
|
+
grep = "grep -v -e '^$' #{@dir}/#{tempfile} | grep -v -e '^#' | perl -pi -e " +'\'s/".[^"]*"//g\'' +" > #{@dir}/#{basefile}"
|
65
67
|
when '.f','.f77','.f90','.f95'
|
66
68
|
cppCommand = "cp #{file} #{@dir}/#{tempfile}"
|
67
69
|
grep = "grep -v -e '^$' #{@dir}/#{tempfile} | grep -v -e '^ *!' > #{@dir}/#{basefile}"
|
@@ -120,6 +122,8 @@ class Graph
|
|
120
122
|
end
|
121
123
|
|
122
124
|
class FunctionGraph < Graph
|
125
|
+
include Digest
|
126
|
+
|
123
127
|
attr_accessor :funx, :adds, :excludes, :debug
|
124
128
|
|
125
129
|
# internal database for former scans
|
@@ -128,6 +132,11 @@ class FunctionGraph < Graph
|
|
128
132
|
@@funxDB = File.exist?(@@funxDBfile) ? JSON.parse(File.open(@@funxDBfile).read) : Hash.new
|
129
133
|
@@lock = Mutex.new
|
130
134
|
|
135
|
+
@@match = {
|
136
|
+
:c => {},
|
137
|
+
:f => {}
|
138
|
+
}
|
139
|
+
|
131
140
|
def initialize(config)
|
132
141
|
super(self.class.to_s)
|
133
142
|
@config = config
|
@@ -140,7 +149,7 @@ class FunctionGraph < Graph
|
|
140
149
|
@adds = @config[:adds] || []
|
141
150
|
@excludes = @config[:excludes] || []
|
142
151
|
|
143
|
-
@parser = CodeParser.new
|
152
|
+
@parser = CodeParser.new(@debug)
|
144
153
|
@parser.read(*@config[:filelist])
|
145
154
|
@funx = @parser.funx
|
146
155
|
end
|
@@ -154,7 +163,7 @@ class FunctionGraph < Graph
|
|
154
163
|
jobqueue.push {
|
155
164
|
puts "Add func: #{name}" if @debug
|
156
165
|
# Check if this body is in the funx DB
|
157
|
-
bodyCk =
|
166
|
+
bodyCk = hexencode(body)
|
158
167
|
if @@funxDB.has_key?(bodyCk) and @@funxDB[name] == body
|
159
168
|
edges = @@funxDB[bodyCk]
|
160
169
|
edges.each {|edge| self.edge(*edge)}
|
@@ -217,7 +226,7 @@ class SingleFunctionGraph < FunctionGraph
|
|
217
226
|
end
|
218
227
|
@scannednames << f
|
219
228
|
body = graph.funx[f]
|
220
|
-
bodyCk =
|
229
|
+
bodyCk = hexencode(body)
|
221
230
|
if @@funxDB.has_key?(bodyCk) and @@funxDB[f] == body
|
222
231
|
edges = @@funxDB[bodyCk]
|
223
232
|
edges.each {|edge| graph.edge(*edge)}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codegraph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.21
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: graph
|
16
|
-
requirement: &
|
16
|
+
requirement: &7997580 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *7997580
|
25
25
|
description: ! 'Display functional dependencies in source code (C, Fortran, PHP, Perl).
|
26
26
|
|
27
27
|
'
|