rbgccxml 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/gccxml.rb +45 -0
- data/lib/rbgccxml.rb +1 -0
- data/lib/rbgccxml/nodes/namespace_alias.rb +6 -0
- data/lib/rbgccxml/parser.rb +0 -1
- data/spec/namespaces_test.rb +6 -0
- data/spec/query_results_test.rb +2 -4
- data/spec/structs_test.rb +6 -7
- data/spec/types_test.rb +1 -3
- metadata +27 -33
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 699364de9e76fc6e26e91c47c8e643830951ce53
|
4
|
+
data.tar.gz: b399c4678cc389452d0b80ac6b413d9bd60e0ea3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 14d9c3f05f8add667664d04fa87407c4c79b53455e94bb1e8bad5c139ea2e49ff82dcdd15ff4ee96b1d19a2865ab197de75ef4ea42d58aa58116f2bada74b73e
|
7
|
+
data.tar.gz: 597c82458bb5fb5b5955a66b4d9f7d73b32636db7fd2e28a766ffe39542f5ab7d9ba8e5e1d81b302e58c6807a267190401907766d5e17802901997460604ccf7
|
data/lib/gccxml.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
class GCCXML
|
2
|
+
|
3
|
+
def initialize()
|
4
|
+
@exe = find_exe.strip.chomp
|
5
|
+
@includes = []
|
6
|
+
@flags = []
|
7
|
+
end
|
8
|
+
|
9
|
+
# Add an include path for parsing
|
10
|
+
def add_include(path)
|
11
|
+
@includes << path
|
12
|
+
end
|
13
|
+
|
14
|
+
# Add extra CXXFLAGS to the command line
|
15
|
+
def add_cxxflags(flags)
|
16
|
+
@flags << flags
|
17
|
+
end
|
18
|
+
|
19
|
+
# Run gccxml on the header file(s), sending the output to the passed in
|
20
|
+
# file.
|
21
|
+
def parse(header_file, to_file)
|
22
|
+
includes = @includes.flatten.uniq.map {|i| "-I#{i.chomp}"}.join(" ").chomp
|
23
|
+
flags = @flags.flatten.join(" ").chomp
|
24
|
+
cmd = "#{@exe} #{includes} #{flags} #{header_file} -fxml=#{to_file}"
|
25
|
+
raise "Error executing gccxml command line: #{cmd}" unless system(cmd)
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def windows?
|
31
|
+
RUBY_PLATFORM =~ /(mswin|cygwin)/
|
32
|
+
end
|
33
|
+
|
34
|
+
def find_exe
|
35
|
+
ext = windows? ? ".exe" : ""
|
36
|
+
binary = "gccxml#{ext}"
|
37
|
+
|
38
|
+
if `#{binary} --version 2>&1` =~ /GCC-XML/
|
39
|
+
binary
|
40
|
+
else
|
41
|
+
raise "Unable to find the gccxml executable on your PATH."
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
data/lib/rbgccxml.rb
CHANGED
@@ -27,6 +27,7 @@ module RbGCCXML
|
|
27
27
|
autoload :MethodType, "rbgccxml/nodes/method_type"
|
28
28
|
autoload :Method, "rbgccxml/nodes/method"
|
29
29
|
autoload :Namespace, "rbgccxml/nodes/namespace"
|
30
|
+
autoload :NamespaceAlias, "rbgccxml/nodes/namespace_alias"
|
30
31
|
autoload :Struct, "rbgccxml/nodes/struct"
|
31
32
|
autoload :Variable, "rbgccxml/nodes/variable"
|
32
33
|
|
data/lib/rbgccxml/parser.rb
CHANGED
data/spec/namespaces_test.rb
CHANGED
@@ -22,4 +22,10 @@ describe "Querying for namespaces" do
|
|
22
22
|
nested.should be_a_kind_of(RbGCCXML::Namespace)
|
23
23
|
nested.name.should == "nested"
|
24
24
|
end
|
25
|
+
|
26
|
+
specify "handles namespace aliases" do
|
27
|
+
takes_class = @source.functions.find(:name => "takes_class")
|
28
|
+
aliased_arg = takes_class.arguments.first
|
29
|
+
aliased_arg.cpp_type.to_cpp.should == "upper::inner2::NamespacedClass"
|
30
|
+
end
|
25
31
|
end
|
data/spec/query_results_test.rb
CHANGED
@@ -21,10 +21,8 @@ describe "Managing Query results" do
|
|
21
21
|
q = RbGCCXML::QueryResult.new
|
22
22
|
q << obj1 << obj2
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
q.other_thingy
|
27
|
-
end.should_not raise_error(NoMethodError)
|
24
|
+
q.call_me
|
25
|
+
q.other_thingy
|
28
26
|
|
29
27
|
obj1.call_me_called.should_not be_nil
|
30
28
|
obj1.other_thingy_called.should_not be_nil
|
data/spec/structs_test.rb
CHANGED
@@ -42,15 +42,14 @@ describe "Querying for struct constructors" do
|
|
42
42
|
specify "constructors should have arguments" do
|
43
43
|
test2 = @structs_source.structs.find(:name => "Test2")
|
44
44
|
|
45
|
-
# GCC generated copy
|
46
|
-
copy = test2.constructors
|
47
|
-
copy.
|
45
|
+
# GCC generated copy constructor
|
46
|
+
copy = test2.constructors.detect {|c| c.arguments.length == 1 && c.artificial? }
|
47
|
+
copy.should_not be_nil
|
48
48
|
|
49
|
-
default = test2.constructors
|
50
|
-
default.
|
49
|
+
default = test2.constructors.detect {|c| c.arguments.size == 0 }
|
50
|
+
default.should_not be_nil
|
51
51
|
|
52
|
-
specific = test2.constructors
|
53
|
-
specific.arguments.size.should == 1
|
52
|
+
specific = test2.constructors.detect {|c| c.arguments.size == 1 && !c.artificial? }
|
54
53
|
specific.arguments[0].cpp_type.name.should == "int"
|
55
54
|
end
|
56
55
|
end
|
data/spec/types_test.rb
CHANGED
@@ -10,11 +10,9 @@ describe "Proper Type handling" do
|
|
10
10
|
@types_source.functions.find(:returns => "int").length.should == 2
|
11
11
|
@types_source.functions.find(:returns => "float").name.should == "returnsFloat"
|
12
12
|
|
13
|
-
@types_source.functions("noReturnWithSizeT").arguments[0].to_cpp.should == "::size_t arg"
|
13
|
+
@types_source.functions("noReturnWithSizeT").arguments[0].to_cpp.should == "std::size_t arg"
|
14
14
|
end
|
15
15
|
|
16
|
-
specify "unsigned fundamental types"
|
17
|
-
|
18
16
|
specify "typedefs" do
|
19
17
|
@types_source.functions.find(:returns => "myLongType").name.should == "returnsLongType"
|
20
18
|
@types_source.functions.find(:returns => "myShortType").name.should == "returnsShortType"
|
metadata
CHANGED
@@ -1,54 +1,49 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbgccxml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.4
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jason Roelofs
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-05-05 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: nokogiri
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
19
|
+
version: 1.5.0
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.7.0
|
22
23
|
type: :runtime
|
23
24
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: gccxml_gem
|
27
|
-
requirement: &9647790 !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
29
26
|
requirements:
|
30
|
-
- -
|
27
|
+
- - ">="
|
31
28
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
description:
|
37
|
-
output
|
38
|
-
|
29
|
+
version: 1.5.0
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.7.0
|
33
|
+
description: |
|
34
|
+
Rbgccxml is a library that parses out GCCXML (http://www.gccxml.org) output
|
39
35
|
and provides a simple but very powerful querying API for finding exactly
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
'
|
44
|
-
email: jameskilton@gmail.com
|
36
|
+
what you want out of C++ source code.
|
37
|
+
email: jasongroelofs@gmail.com
|
45
38
|
executables: []
|
46
39
|
extensions: []
|
47
40
|
extra_rdoc_files: []
|
48
41
|
files:
|
49
|
-
- TODO
|
50
42
|
- Rakefile
|
43
|
+
- TODO
|
44
|
+
- lib/gccxml.rb
|
51
45
|
- lib/jamis.rb
|
46
|
+
- lib/rbgccxml.rb
|
52
47
|
- lib/rbgccxml/node.rb
|
53
48
|
- lib/rbgccxml/node_cache.rb
|
54
49
|
- lib/rbgccxml/nodes/argument.rb
|
@@ -65,6 +60,7 @@ files:
|
|
65
60
|
- lib/rbgccxml/nodes/method.rb
|
66
61
|
- lib/rbgccxml/nodes/method_type.rb
|
67
62
|
- lib/rbgccxml/nodes/namespace.rb
|
63
|
+
- lib/rbgccxml/nodes/namespace_alias.rb
|
68
64
|
- lib/rbgccxml/nodes/struct.rb
|
69
65
|
- lib/rbgccxml/nodes/type.rb
|
70
66
|
- lib/rbgccxml/nodes/types/array_type.rb
|
@@ -79,7 +75,6 @@ files:
|
|
79
75
|
- lib/rbgccxml/query_result.rb
|
80
76
|
- lib/rbgccxml/rbgccxml.rb
|
81
77
|
- lib/rbgccxml/sax_parser.rb
|
82
|
-
- lib/rbgccxml.rb
|
83
78
|
- lib/vendor/facets/once.rb
|
84
79
|
- spec/arguments_test.rb
|
85
80
|
- spec/classes_test.rb
|
@@ -98,27 +93,26 @@ files:
|
|
98
93
|
- spec/variables_test.rb
|
99
94
|
homepage: http://rbplusplus.rubyforge.org/rbgccxml
|
100
95
|
licenses: []
|
96
|
+
metadata: {}
|
101
97
|
post_install_message:
|
102
98
|
rdoc_options: []
|
103
99
|
require_paths:
|
104
100
|
- lib
|
105
101
|
required_ruby_version: !ruby/object:Gem::Requirement
|
106
|
-
none: false
|
107
102
|
requirements:
|
108
|
-
- -
|
103
|
+
- - ">="
|
109
104
|
- !ruby/object:Gem::Version
|
110
105
|
version: '0'
|
111
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
|
-
none: false
|
113
107
|
requirements:
|
114
|
-
- -
|
108
|
+
- - ">="
|
115
109
|
- !ruby/object:Gem::Version
|
116
110
|
version: '0'
|
117
111
|
requirements: []
|
118
112
|
rubyforge_project: rbplusplus
|
119
|
-
rubygems_version:
|
113
|
+
rubygems_version: 2.2.2
|
120
114
|
signing_key:
|
121
|
-
specification_version:
|
115
|
+
specification_version: 4
|
122
116
|
summary: Ruby interface to GCCXML
|
123
117
|
test_files:
|
124
118
|
- spec/arguments_test.rb
|