rbgccxml 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -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
@@ -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
 
@@ -0,0 +1,6 @@
1
+ module RbGCCXML
2
+ # Represents the <NamespaceAlias> node, which is a rename of an existing
3
+ # namespace to a different name.
4
+ class NamespaceAlias < Namespace
5
+ end
6
+ end
@@ -10,7 +10,6 @@ module RbGCCXML
10
10
  if config[:pregenerated]
11
11
  @xml_file = config.delete(:pregenerated)
12
12
  else
13
- require 'gccxml'
14
13
  @gccxml = GCCXML.new
15
14
 
16
15
  if includes = config.delete(:includes)
@@ -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
@@ -21,10 +21,8 @@ describe "Managing Query results" do
21
21
  q = RbGCCXML::QueryResult.new
22
22
  q << obj1 << obj2
23
23
 
24
- lambda do
25
- q.call_me
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
@@ -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 constructors
46
- copy = test2.constructors[0]
47
- copy.artificial?.should be_true
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[1]
50
- default.arguments.size.should == 0
49
+ default = test2.constructors.detect {|c| c.arguments.size == 0 }
50
+ default.should_not be_nil
51
51
 
52
- specific = test2.constructors[2]
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
@@ -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.3
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: 2011-12-16 00:00:00.000000000Z
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: &9648030 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ~>
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
- version: 1.4.0
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: *9648030
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: '0.9'
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: *9647790
36
- description: ! 'Rbgccxml is a library that parses out GCCXML (http://www.gccxml.org)
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
- what you want out of the C++ source code
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: 1.8.6
113
+ rubygems_version: 2.2.2
120
114
  signing_key:
121
- specification_version: 3
115
+ specification_version: 4
122
116
  summary: Ruby interface to GCCXML
123
117
  test_files:
124
118
  - spec/arguments_test.rb