codegraph 0.7.4 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/gemspec +4 -2
  2. data/lib/codegraph.rb +12 -9
  3. metadata +19 -4
data/gemspec CHANGED
@@ -2,15 +2,17 @@ require 'rubygems'
2
2
 
3
3
  spec = Gem::Specification.new do |s|
4
4
  s.name = "codegraph"
5
- s.version = "0.7.4"
5
+ s.version = "0.7.5"
6
6
  s.date = Time.new.to_s
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.bindir = 'bin'
9
9
  s.files = ["lib/codegraph.rb","bin/codegraph"] + ["gemspec","LICENSE"]
10
10
  s.executables << 'codegraph'
11
11
  s.add_dependency('rgl')
12
+ s.add_dependency('asciify')
12
13
  s.rubyforge_project = "codegraph"
13
- s.description = "Display functional dependencies in source code (C, Fortran, PHP, Perl)."
14
+ s.description = "Display functional dependencies in source code (C, Fortran, PHP, Perl).\n" +
15
+ "Changes (#{s.version}): Use Asciify to get around non-ASCII chars"
14
16
  s.summary = "Display functional dependencies in source code (C, Fortran, PHP, Perl)"
15
17
  s.author = "Ralf Mueller"
16
18
  s.email = "stark.dreamdetective@gmail.com"
data/lib/codegraph.rb CHANGED
@@ -5,8 +5,10 @@ require 'rgl/dot'
5
5
  require 'rgl/rdot'
6
6
  require 'rgl/traversal'
7
7
  require 'thread'
8
+ require 'asciify'
8
9
 
9
- $KCODE="UTF8"
10
+
11
+ DEBUG = false
10
12
 
11
13
  class FunctionGraph < RGL::DirectedAdjacencyGraph
12
14
  attr_accessor :funx, :internal
@@ -40,6 +42,7 @@ class FunctionGraph < RGL::DirectedAdjacencyGraph
40
42
  @@internal_funx = []
41
43
  @@matchBeforFuncName = '[^A-z0-9_]\s*'
42
44
  @@matchAfterFuncName = ' *\('
45
+ @@map = Asciify::Mapping.new(:default)
43
46
 
44
47
  # Generate the codegraph storage directory
45
48
  if not FileTest.directory?(@@codehomedir)
@@ -68,7 +71,7 @@ class FunctionGraph < RGL::DirectedAdjacencyGraph
68
71
  funxFile = "funxnames"
69
72
  ctagsKinds = '--c-kinds=f --fortran-kinds=fsp --php-kinds=f --perl-kinds=f'
70
73
 
71
- puts "Processing #{file} ..." if false
74
+ puts "Processing #{file} ..." if DEBUG
72
75
  basefile = File.basename(file)
73
76
  temfile = "_" + basefile
74
77
  case File.extname(file)
@@ -86,14 +89,14 @@ class FunctionGraph < RGL::DirectedAdjacencyGraph
86
89
  gen4ctags = "ctags -x #{ctagsKinds} #{codehomedir}/#{basefile} | sort -n -k 3"
87
90
  command = [cppCommand,grep].join(";")
88
91
 
89
- puts command if false
92
+ puts command if DEBUG
90
93
  system(command)
91
94
 
92
95
  code = open(codehomedir+'/'+ File.basename(file)).readlines
93
96
  funxLocations = IO.popen(gen4ctags).readlines.map {|l| l.split[0,4]}
94
97
  funxLocations.each_with_index {|ary,i|
95
98
  name, kind, line, file = ary
96
- puts name if false
99
+ puts name if DEBUG
97
100
  line = line.to_i
98
101
  startLineIndex = line - 1
99
102
  endLineIndex = (i+1 < funxLocations.size) ? funxLocations[i+1][2].to_i - 2 : -1
@@ -123,10 +126,10 @@ class FunctionGraph < RGL::DirectedAdjacencyGraph
123
126
  names = @funx.keys
124
127
  @funx.each_pair {|name,body|
125
128
  # threads << Threads.new(name,body,names) {|name,body|
126
- puts "Add func: #{name}" if false
129
+ puts "Add func: #{name}" if DEBUG
127
130
  add_vertex(name)
128
131
  (names - [name] + @@internal_funx).each { |func|
129
- puts body if true
132
+ puts body if DEBUG
130
133
  add_edge("#{name}","#{func}") if/#@@matchBeforFuncName#{func}#@@matchAfterFuncName/.match(body)
131
134
  }
132
135
  }
@@ -243,8 +246,9 @@ class UpperFunctionGraph < SingleFunctionGraph
243
246
  graph.funx.each_pair {|g,gbody|
244
247
  # dont scan a function for itself
245
248
  next if g == func
246
-
247
- if/#@@matchBeforFuncName#{func}#@@matchAfterFuncName/.match(gbody)
249
+ puts g if DEBUG
250
+ puts gbody if DEBUG
251
+ if/#@@matchBeforFuncName#{func}#@@matchAfterFuncName/.match(Asciify.new(@@map).convert(gbody))
248
252
  graph.add_edge(g,func)
249
253
  scan(graph,g)
250
254
  end
@@ -274,4 +278,3 @@ class EightFunctionGraph < FunctionGraph
274
278
  end
275
279
  end
276
280
  end
277
-
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 7
8
- - 4
9
- version: 0.7.4
8
+ - 5
9
+ version: 0.7.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ralf Mueller
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-10 16:45:59 +01:00
17
+ date: 2011-01-11 14:26:53 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -30,7 +30,22 @@ dependencies:
30
30
  version: "0"
31
31
  type: :runtime
32
32
  version_requirements: *id001
33
- description: Display functional dependencies in source code (C, Fortran, PHP, Perl).
33
+ - !ruby/object:Gem::Dependency
34
+ name: asciify
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ version: "0"
44
+ type: :runtime
45
+ version_requirements: *id002
46
+ description: |-
47
+ Display functional dependencies in source code (C, Fortran, PHP, Perl).
48
+ Changes (0.7.5): Use Asciify to get around non-ASCII chars
34
49
  email: stark.dreamdetective@gmail.com
35
50
  executables:
36
51
  - codegraph