codegraph 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/gemspec +1 -1
- data/lib/codegraph.rb +7 -5
- metadata +2 -2
data/gemspec
CHANGED
data/lib/codegraph.rb
CHANGED
@@ -28,13 +28,13 @@ class FunctionGraph < RGL::DirectedAdjacencyGraph
|
|
28
28
|
Funx = {"php" => "function",
|
29
29
|
"perl" => "subroutine",
|
30
30
|
"c" => "function",
|
31
|
-
"f"
|
31
|
+
"f" => "subroutine",
|
32
32
|
"sh" => "function"}
|
33
33
|
|
34
34
|
@@home = `echo $HOME`.chomp
|
35
35
|
@@codehomedir = "#{@@home}/.codegraph"
|
36
36
|
@@internal_funx = []
|
37
|
-
@@matchBeforFuncName = '[^A-z0-9_]'
|
37
|
+
@@matchBeforFuncName = '[^A-z0-9_]\s*'
|
38
38
|
@@matchAfterFuncName = '\('
|
39
39
|
|
40
40
|
# Generate the codegraph storage directory
|
@@ -67,7 +67,8 @@ class FunctionGraph < RGL::DirectedAdjacencyGraph
|
|
67
67
|
temfile = "_" + basefile
|
68
68
|
case File.extname(file)
|
69
69
|
when '.c','.h'
|
70
|
-
cppCommand = "cpp -w -fpreprocessed -E -fdirectives-only #{file} -o #{@@codehomedir}/#{temfile}"
|
70
|
+
cppCommand = "cpp -w -fpreprocessed -E -fdirectives-only #{file} -o #{@@codehomedir}/#{temfile} 2>/dev/null"
|
71
|
+
cppCommand = "cpp -fpreprocessed #{file} -o #{@@codehomedir}/#{temfile} 2>/dev/null"
|
71
72
|
grep = "grep -v -e '^$' #{temfile} | grep -v -e '^#' > #{basefile}"
|
72
73
|
when '.f','.f77','.f90','.f95'
|
73
74
|
cppCommand = "cp #{file} #{@@codehomedir}/#{temfile}"
|
@@ -80,7 +81,7 @@ class FunctionGraph < RGL::DirectedAdjacencyGraph
|
|
80
81
|
gen4ctags = "ctags -x #{ctagsKinds} #{basefile} | sort -n -k 3 > " + funxFile
|
81
82
|
command = [cppCommand,cd,grep,gen4ctags].join(";")
|
82
83
|
|
83
|
-
puts command
|
84
|
+
puts command if false
|
84
85
|
system(command)
|
85
86
|
|
86
87
|
open(@@codehomedir+'/'+funxFile).readlines.each {|line|
|
@@ -130,9 +131,10 @@ class FunctionGraph < RGL::DirectedAdjacencyGraph
|
|
130
131
|
# scan functions for the function names
|
131
132
|
names = @funx.keys
|
132
133
|
@funx.each_pair {|name,body|
|
134
|
+
puts "Add func: #{name}" if true
|
133
135
|
add_vertex(name)
|
134
136
|
(names - [name] + @@internal_funx).each { |func|
|
135
|
-
add_edge("#{name}","#{func}") if
|
137
|
+
add_edge("#{name}","#{func}") if/#@@matchBeforFuncName#{func}#@@matchAfterFuncName/.match(gbody)
|
136
138
|
}
|
137
139
|
}
|
138
140
|
end
|