cstub 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cstub/version.rb +1 -1
  3. data/lib/cstub.rb +12 -8
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bf8996cf9356f4b4f6a9c967cb41ba62022aff66
4
- data.tar.gz: d5c2437f8f89298e523ffb649ec0dc183dfbfb03
3
+ metadata.gz: 809848477047017f310cfa958061f70a7c53a80d
4
+ data.tar.gz: f56bf9ba507e41c77c2bc500a9af03084410e747
5
5
  SHA512:
6
- metadata.gz: b7bddc30e9964b6c6ff11c554d90bfb62e647e753a19b22761e4cf137b957f814507999fd2fe6005060ef9b45c54d34d4fd618c35988fa4a92c80420e0861693
7
- data.tar.gz: 8e2d9a0e3037730ba840803554ebe20df541bf130b4d4738a49fb210983473f059ee3f4ea6528d67378ff25f4b289d997ac2487dc074bd2ee279cec995b69d62
6
+ metadata.gz: d0aab08aa3d3618755955af13aa5d9f9bed41be9300a79b9dc2d77a9ba2f98f1a5c2a10adee6b3af24ffa8130ef7c8400b9b3eb8f6ea5de5c042be5b88b8c977
7
+ data.tar.gz: f0f16dcd7ddc28c023116b05f63a1339d9cde58589a44fa8a49b2ff2068cea3706bb77585d982ab39004a931cc4e020fb0b5b0145e679b6a0da1b287067b85ca
data/lib/cstub/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cstub
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/cstub.rb CHANGED
@@ -53,6 +53,7 @@ module Cstub
53
53
  typelist = collect_types ast
54
54
  ast.entities.each do |node|
55
55
  node.Declaration? or next
56
+ next if not node.declarators
56
57
  node.declarators.each do |decl|
57
58
  if decl.type.Function?
58
59
  retval = ""
@@ -79,15 +80,17 @@ module Cstub
79
80
  sig = "#{node.type.to_s}#{decl.indirect_type.type.to_s} #{decl.name}("
80
81
  paramlist = []
81
82
  parnum = 0
82
- decl.indirect_type.params.each do |param|
83
- par = "#{param.type.to_s} "
84
- if param.name
85
- par << "#{param.name.to_s}"
86
- else
87
- par << "par" + parnum.to_s
88
- parnum = parnum + 1
83
+ if decl.indirect_type.params
84
+ decl.indirect_type.params.each do |param|
85
+ par = "#{param.type.to_s} "
86
+ if param.name
87
+ par << "#{param.name.to_s}"
88
+ else
89
+ par << "par" + parnum.to_s
90
+ parnum = parnum + 1
91
+ end
92
+ paramlist << par
89
93
  end
90
- paramlist << par
91
94
  end
92
95
  sig << paramlist.join(", ") << ")\n{\n"
93
96
  if retval == ""
@@ -123,6 +126,7 @@ module Cstub
123
126
  C::Preprocessor.command = cpp_command
124
127
  end
125
128
  source = cpp.preprocess(code)
129
+ source.gsub!(/^#.*/,'')
126
130
  C.parse(source)
127
131
  end
128
132
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cstub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - kunigaku
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-06 00:00:00.000000000 Z
11
+ date: 2014-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cast