ray 0.0.0.pre2 → 0.0.1
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.
- data/.gitignore +1 -0
- data/.rspec +3 -0
- data/README.md +62 -0
- data/Rakefile +33 -23
- data/VERSION +1 -1
- data/ext/audio.c +473 -0
- data/ext/color.c +4 -4
- data/ext/event.c +25 -3
- data/ext/extconf.rb +35 -22
- data/ext/font.c +287 -0
- data/ext/image.c +682 -33
- data/ext/joystick.c +9 -9
- data/ext/ray.c +166 -55
- data/ext/ray.h +120 -9
- data/ext/ray_osx.m +161 -0
- data/ext/rect.c +31 -4
- data/lib/ray/audio.rb +52 -0
- data/lib/ray/color.rb +16 -0
- data/lib/ray/dsl.rb +1 -3
- data/lib/ray/dsl/event.rb +1 -39
- data/lib/ray/dsl/event_listener.rb +38 -0
- data/lib/ray/dsl/event_runner.rb +3 -1
- data/lib/ray/dsl/event_translator.rb +74 -8
- data/lib/ray/dsl/handler.rb +3 -33
- data/lib/ray/dsl/matcher.rb +129 -23
- data/lib/ray/font.rb +108 -0
- data/lib/ray/font_set.rb +37 -0
- data/lib/ray/game.rb +171 -34
- data/lib/ray/helper.rb +43 -5
- data/lib/ray/image.rb +90 -3
- data/lib/ray/image_set.rb +35 -0
- data/lib/ray/joystick.rb +30 -0
- data/lib/ray/music_set.rb +35 -0
- data/lib/ray/ray.rb +17 -9
- data/lib/ray/rect.rb +51 -0
- data/lib/ray/resource_set.rb +92 -0
- data/lib/ray/scene.rb +220 -51
- data/lib/ray/sound_set.rb +35 -0
- data/lib/ray/sprite.rb +184 -0
- data/psp/ext.c +4 -0
- data/samples/hello_world/hello.rb +35 -0
- data/samples/hello_world/hello_dsl.rb +24 -0
- data/samples/pong/pong.rb +128 -0
- data/samples/sokoban/level_1 +7 -0
- data/samples/sokoban/sokoban.rb +370 -0
- data/spec/ray/audio_spec.rb +146 -0
- data/spec/ray/color_spec.rb +13 -0
- data/spec/ray/event_spec.rb +57 -168
- data/spec/ray/font_spec.rb +93 -0
- data/spec/ray/image_set_spec.rb +48 -0
- data/spec/ray/image_spec.rb +130 -44
- data/spec/ray/joystick_spec.rb +13 -9
- data/spec/ray/matcher_spec.rb +32 -55
- data/spec/ray/ray_spec.rb +33 -31
- data/spec/ray/rect_spec.rb +80 -0
- data/spec/ray/resource_set_spec.rb +105 -0
- data/spec/ray/sprite_spec.rb +163 -0
- data/spec/res/VeraMono.ttf +0 -0
- data/spec/res/aqua2.bmp +0 -0
- data/spec/res/pop.wav +0 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +8 -0
- data/yard_ext.rb +91 -0
- metadata +104 -38
- data/bin/ray +0 -5
- data/bin/ray_irb +0 -4
- data/ext/SDLMain.h +0 -17
- data/ext/SDLMain.m +0 -381
- data/lib/ray/config.rb +0 -84
- data/lib/ray/dsl/converter.rb +0 -65
- data/lib/ray/dsl/listener.rb +0 -30
- data/lib/ray/dsl/type.rb +0 -58
- data/spec/ray/config_spec.rb +0 -90
- data/spec/ray/conversion_spec.rb +0 -43
- data/spec/ray/type_spec.rb +0 -17
- data/spec_runner.rb +0 -27
data/spec/ray/rect_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
1
3
|
describe Ray::Rect do
|
2
4
|
[:x, :y, :width, :height].each do |meth|
|
3
5
|
describe "##{meth}=" do
|
@@ -71,4 +73,82 @@ describe Ray::Rect do
|
|
71
73
|
end
|
72
74
|
end
|
73
75
|
end
|
76
|
+
|
77
|
+
describe "#inside?" do
|
78
|
+
it "should return true if the rect is the receiver itself" do
|
79
|
+
rect = Ray::Rect.new(10, 15, 20, 30)
|
80
|
+
rect.should be_inside(rect)
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should return true if the rect inside the receiver" do
|
84
|
+
rect = Ray::Rect.new(10, 15, 30, 40)
|
85
|
+
Ray::Rect.new(13, 17, 10, 20).should be_inside(rect)
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should return false if the rect only collides with the receiver" do
|
89
|
+
rect = Ray::Rect.new(10, 15, 30, 40)
|
90
|
+
|
91
|
+
Ray::Rect.new(5, 10, 20, 20).should_not be_inside(rect)
|
92
|
+
Ray::Rect.new(11, 16, 40, 50).should_not be_inside(rect)
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should return false if the rect is outside the receiver" do
|
96
|
+
rect = Ray::Rect.new(10, 15, 20, 30)
|
97
|
+
|
98
|
+
Ray::Rect.new(1, 2, 3, 5).should_not be_inside(rect)
|
99
|
+
Ray::Rect.new(100, 150, 350, 450).should_not be_inside(rect)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
describe "#outside?" do
|
104
|
+
it "should return false if the rect is the receiver itself" do
|
105
|
+
rect = Ray::Rect.new(10, 15, 20, 30)
|
106
|
+
rect.should_not be_outside(rect)
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should return true if the rect is outside the receiver" do
|
110
|
+
rect = Ray::Rect.new(10, 15, 20, 30)
|
111
|
+
|
112
|
+
Ray::Rect.new(1, 2, 3, 5).should be_outside(rect)
|
113
|
+
Ray::Rect.new(100, 150, 350, 450).should be_outside(rect)
|
114
|
+
end
|
115
|
+
|
116
|
+
it "should return false if the rect is inside the receiver" do
|
117
|
+
rect = Ray::Rect.new(10, 15, 30, 40)
|
118
|
+
Ray::Rect.new(13, 17, 10, 20).should_not be_outside(rect)
|
119
|
+
end
|
120
|
+
|
121
|
+
it "should return false if the rect collides with the receiver" do
|
122
|
+
rect = Ray::Rect.new(10, 15, 30, 40)
|
123
|
+
|
124
|
+
Ray::Rect.new(5, 10, 20, 20).should_not be_outside(rect)
|
125
|
+
Ray::Rect.new(11, 16, 40, 50).should_not be_outside(rect)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
describe "#colllide?" do
|
130
|
+
it "should return true if the rect is the receiver itself" do
|
131
|
+
rect = Ray::Rect.new(10, 15, 20, 30)
|
132
|
+
rect.collide?(rect).should be_true
|
133
|
+
end
|
134
|
+
|
135
|
+
it "should return false if the rect is outside the receiver" do
|
136
|
+
rect = Ray::Rect.new(10, 15, 20, 30)
|
137
|
+
|
138
|
+
Ray::Rect.new(1, 2, 3, 5).collide?(rect).should_not be_true
|
139
|
+
Ray::Rect.new(100, 150, 350, 450).collide?(rect).should_not be_true
|
140
|
+
end
|
141
|
+
|
142
|
+
it "should return true if the rect is inside the receiver" do
|
143
|
+
rect = Ray::Rect.new(10, 15, 30, 40)
|
144
|
+
Ray::Rect.new(13, 17, 10, 20).collide?(rect).should be_true
|
145
|
+
end
|
146
|
+
|
147
|
+
it "should return true if the rect collides with the receiver" do
|
148
|
+
rect = Ray::Rect.new(10, 15, 30, 40)
|
149
|
+
|
150
|
+
Ray::Rect.new(5, 10, 20, 20).collide?(rect).should be_true
|
151
|
+
Ray::Rect.new(11, 16, 40, 50).collide?(rect).should be_true
|
152
|
+
end
|
153
|
+
end
|
74
154
|
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
module TestSet
|
4
|
+
extend Ray::ResourceSet
|
5
|
+
|
6
|
+
def self.missing_pattern(string)
|
7
|
+
"unknown"
|
8
|
+
end
|
9
|
+
|
10
|
+
add_set(/^string:(.+)$/) do |str|
|
11
|
+
str
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module DefaultMissingPattern
|
16
|
+
extend Ray::ResourceSet
|
17
|
+
end
|
18
|
+
|
19
|
+
module MultipleArgumentsSet
|
20
|
+
extend Ray::ResourceSet
|
21
|
+
|
22
|
+
need_argument_count 1
|
23
|
+
|
24
|
+
add_set(/^string:(.+)$/) do |str, times|
|
25
|
+
str * times
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.missing_pattern(*args)
|
29
|
+
args
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
module CacheTestSet
|
34
|
+
extend Ray::ResourceSet
|
35
|
+
|
36
|
+
add_set(/(.+)/) { |str| str }
|
37
|
+
end
|
38
|
+
|
39
|
+
describe Ray::ResourceSet do
|
40
|
+
it "should use the block we passed to create a string" do
|
41
|
+
TestSet["string:test"].should == "test"
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should always return the same object for the same key" do
|
45
|
+
str = TestSet["string:my string"]
|
46
|
+
str.object_id.should == TestSet["string:my string"].object_id
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should call the missing_pattern method when a string isn't matched" do
|
50
|
+
TestSet["Hello world"].should == "unknown"
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should raise NoPatternError for unmatched string by default" do
|
54
|
+
lambda {
|
55
|
+
DefaultMissingPattern["unknown"]
|
56
|
+
}.should raise_exception(Ray::NoPatternError)
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should allow more arguments in []" do
|
60
|
+
lambda {
|
61
|
+
MultipleArgumentsSet["string:test", 3]
|
62
|
+
}.should_not raise_exception
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should raise an error when using an invalid argument count" do
|
66
|
+
lambda {
|
67
|
+
TestSet["string:foo", 3]
|
68
|
+
}.should raise_exception
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should provide user arguments at the end" do
|
72
|
+
MultipleArgumentsSet.add_set(/my_(.)/) do |char, times|
|
73
|
+
char.should == "a"
|
74
|
+
times.should == 3
|
75
|
+
|
76
|
+
true
|
77
|
+
end
|
78
|
+
|
79
|
+
MultipleArgumentsSet["my_a", 3]
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should be able to select objects from the cache" do
|
83
|
+
first = CacheTestSet["first"]
|
84
|
+
sec = CacheTestSet["sec"]
|
85
|
+
|
86
|
+
CacheTestSet.select! { |key, val| key == "first" }
|
87
|
+
|
88
|
+
first.object_id.should == CacheTestSet["first"].object_id
|
89
|
+
sec.object_id.should_not == CacheTestSet["sec"].object_id
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should be able to reject objects from the cache" do
|
93
|
+
first = CacheTestSet["first"]
|
94
|
+
sec = CacheTestSet["sec"]
|
95
|
+
|
96
|
+
CacheTestSet.reject! { |key, val| key == "first" }
|
97
|
+
|
98
|
+
first.object_id.should_not == CacheTestSet["first"].object_id
|
99
|
+
sec.object_id.should == CacheTestSet["sec"].object_id
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should pass all the arguments to missing_pattern" do
|
103
|
+
MultipleArgumentsSet["a", 3].should == ["a", 3]
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,163 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe Ray::Sprite do
|
4
|
+
before :all do
|
5
|
+
Ray.init
|
6
|
+
@win = Ray.create_window(:w => 100, :h => 100)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should wrap an image" do
|
10
|
+
image = Ray::Image.new(:w => 10, :h => 10)
|
11
|
+
|
12
|
+
sprite = Ray::Sprite.new(image)
|
13
|
+
sprite.image.should == image
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should convert strings to images" do
|
17
|
+
image = Ray::ImageSet[path_of("aqua.bmp")]
|
18
|
+
|
19
|
+
sprite = Ray::Sprite.new(path_of("aqua.bmp"))
|
20
|
+
sprite.image.should == image
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should blit its image when drawn" do
|
24
|
+
image = mock("image")
|
25
|
+
image.stub!(:to_image).and_return(image)
|
26
|
+
image.stub!(:is_a?).and_return(true)
|
27
|
+
image.should_receive(:blit).and_return(@win)
|
28
|
+
|
29
|
+
sprite = Ray::Sprite.new(image)
|
30
|
+
sprite.draw_on(@win)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should draw on the screen by default" do
|
34
|
+
image = mock("image")
|
35
|
+
image.stub!(:to_image).and_return(image)
|
36
|
+
image.stub!(:is_a?).and_return(true)
|
37
|
+
image.should_receive(:blit).with(hash_including(:on => @win)).and_return(@win)
|
38
|
+
|
39
|
+
sprite = Ray::Sprite.new(image)
|
40
|
+
sprite.draw
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should have a position" do
|
44
|
+
sprite = Ray::Sprite.new(@win, :at => [10, 15])
|
45
|
+
sprite.is_at?(10, 15).should be_true
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should not be at a position it wan't assigned to" do
|
49
|
+
sprite = Ray::Sprite.new(@win, :at => [13, 20])
|
50
|
+
sprite.is_at?(10, 15).should be_false
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should be at (0, 0) by default" do
|
54
|
+
sprite = Ray::Sprite.new(@win)
|
55
|
+
sprite.is_at?(0, 0).should be_true
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should draw the image at its position" do
|
59
|
+
image = mock("image")
|
60
|
+
image.stub!(:to_image).and_return(image)
|
61
|
+
image.stub!(:is_a?).and_return(true)
|
62
|
+
image.should_receive(:blit).with(hash_including(:at => [10, 15])).
|
63
|
+
and_return(@win)
|
64
|
+
|
65
|
+
sprite = Ray::Sprite.new(image, :at => [10, 15])
|
66
|
+
sprite.draw
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should allow to draw only a small rect of the image" do
|
70
|
+
image = mock("image")
|
71
|
+
image.stub!(:to_image).and_return(image)
|
72
|
+
image.stub!(:is_a?).and_return(true)
|
73
|
+
rect = Ray::Rect.new(50, 30, 100, 120)
|
74
|
+
image.should_receive(:blit).with(hash_including(:rect => rect)).
|
75
|
+
and_return(@win)
|
76
|
+
|
77
|
+
sprite = Ray::Sprite.new(image, :rect => [50, 30, 100, 120])
|
78
|
+
sprite.draw
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should default to an empty rect" do
|
82
|
+
sprite = Ray::Sprite.new(@win)
|
83
|
+
sprite.from_rect.should == Ray::Rect.new(0, 0, 0, 0)
|
84
|
+
end
|
85
|
+
|
86
|
+
describe "#rect" do
|
87
|
+
it "should return the rect where the image will be drawn" do
|
88
|
+
sprite = Ray::Sprite.new(@win, :rect => [70, 80, 80, 80],
|
89
|
+
:at => [50, 30])
|
90
|
+
sprite.rect.should == Ray::Rect.new(50, 30, 80, 80)
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should return the image size if the rect is not set" do
|
94
|
+
sprite = Ray::Sprite.new(@win)
|
95
|
+
sprite.rect.should == Ray::Rect.new(0, 0, 100, 100)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should allow to set an angle" do
|
100
|
+
sprite = Ray::Sprite.new(@win, :angle => 30)
|
101
|
+
sprite.angle.should == 30
|
102
|
+
end
|
103
|
+
|
104
|
+
it "should draw using its angle" do
|
105
|
+
image = mock("image")
|
106
|
+
image.stub!(:to_image).and_return(image)
|
107
|
+
image.stub!(:is_a?).and_return(true)
|
108
|
+
image.should_receive(:blit).with(hash_including(:angle => 40))
|
109
|
+
|
110
|
+
sprite = Ray::Sprite.new(image, :angle => 40)
|
111
|
+
sprite.draw
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should allow to zoom" do
|
115
|
+
sprite = Ray::Sprite.new(@win, :zoom => 3)
|
116
|
+
sprite.zoom.should == 3
|
117
|
+
end
|
118
|
+
|
119
|
+
it "should draw using its zoom level" do
|
120
|
+
image = mock("image")
|
121
|
+
image.stub!(:to_image).and_return(image)
|
122
|
+
image.stub!(:is_a?).and_return(true)
|
123
|
+
image.should_receive(:blit).with(hash_including(:zoom => 3))
|
124
|
+
|
125
|
+
sprite = Ray::Sprite.new(image, :zoom => 3)
|
126
|
+
sprite.draw
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should allow to set its position using an array" do
|
130
|
+
sprite = Ray::Sprite.new(@win)
|
131
|
+
sprite.pos = [10, 15]
|
132
|
+
sprite.pos.to_rect.should == Ray::Rect.new(10, 15)
|
133
|
+
end
|
134
|
+
|
135
|
+
it "should allow to use a sprite sheet" do
|
136
|
+
sprite = Ray::Sprite.new(@win)
|
137
|
+
sprite.sheet_size = [10, 10]
|
138
|
+
|
139
|
+
sprite.rect.w.should == (@win.w / 10)
|
140
|
+
sprite.rect.h.should == (@win.h / 10)
|
141
|
+
end
|
142
|
+
|
143
|
+
it "should allow to change the cell which will be drawn" do
|
144
|
+
sprite = Ray::Sprite.new(@win)
|
145
|
+
sprite.sheet_size = [10, 10]
|
146
|
+
sprite.sheet_pos = [3, 6]
|
147
|
+
|
148
|
+
sprite.from_rect.should == Ray::Rect.new((@win.w / 10) * 3,
|
149
|
+
(@win.h / 10) * 6,
|
150
|
+
@win.w / 10, @win.h / 10)
|
151
|
+
end
|
152
|
+
|
153
|
+
it "should allow to disable the use of a sprite sheet" do
|
154
|
+
sprite = Ray::Sprite.new(@win)
|
155
|
+
sprite.sheet_size = [10, 10]
|
156
|
+
sprite.disable_sprite_sheet
|
157
|
+
sprite.from_rect.should == Ray::Rect.new(0, 0, @win.w, @win.h)
|
158
|
+
end
|
159
|
+
|
160
|
+
after :all do
|
161
|
+
Ray.stop
|
162
|
+
end
|
163
|
+
end
|
Binary file
|
data/spec/res/aqua2.bmp
ADDED
Binary file
|
data/spec/res/pop.wav
ADDED
Binary file
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
data/yard_ext.rb
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'yard'
|
2
|
+
|
3
|
+
class MatcherHandler < YARD::Handlers::Ruby::Base
|
4
|
+
handles method_call(:describe_matcher)
|
5
|
+
|
6
|
+
def process
|
7
|
+
src = statement.parameters.children.first.source[1..-1]
|
8
|
+
MethodObject.new(P("Ray::Matchers"), src) do |o|
|
9
|
+
register(o)
|
10
|
+
|
11
|
+
args = statement.last.first
|
12
|
+
if args
|
13
|
+
o.parameters = [args.source]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class CustomCParser < YARD::Parser::CParser
|
20
|
+
include YARD
|
21
|
+
|
22
|
+
def parse
|
23
|
+
super
|
24
|
+
parse_constants
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def find_method_body(object, func_name, content = @content)
|
30
|
+
case content
|
31
|
+
when %r"((?>/\*.*?\*/\s*))(?:(?:static|SWIGINTERN)\s+)?(?:intern\s+)?VALUE\s+#{func_name}
|
32
|
+
\s*(\([^)]*\))([^;]|$)"xm
|
33
|
+
comment, params = $1, $2
|
34
|
+
body_text = $&
|
35
|
+
|
36
|
+
remove_private_comments(comment) if comment
|
37
|
+
|
38
|
+
# see if we can find the whole body
|
39
|
+
|
40
|
+
re = Regexp.escape(body_text.strip) + '[^(]*\{.*?^\}'
|
41
|
+
if /#{re}/m =~ content
|
42
|
+
body_text = $&
|
43
|
+
end
|
44
|
+
|
45
|
+
# The comment block may have been overridden with a 'Document-method'
|
46
|
+
# block. This happens in the interpreter when multiple methods are
|
47
|
+
# vectored through to the same C method but those methods are logically
|
48
|
+
# distinct (for example Kernel.hash and Kernel.object_id share the same
|
49
|
+
# implementation
|
50
|
+
|
51
|
+
# override_comment = find_override_comment(object)
|
52
|
+
# comment = override_comment if override_comment
|
53
|
+
|
54
|
+
object.docstring = parse_comments(object, comment) if comment
|
55
|
+
object.source = body_text
|
56
|
+
when %r{((?>/\*.*?\*/\s*))^\s*\#\s*define\s+#{func_name}\s+(\w+)}m
|
57
|
+
comment = $1
|
58
|
+
find_method_body(object, $2, content)
|
59
|
+
else
|
60
|
+
# No body, but might still have an override comment
|
61
|
+
# comment = find_override_comment(object)
|
62
|
+
comment = nil
|
63
|
+
object.docstring = parse_comments(object, comment) if comment
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def handle_constants(type, var_name, const_name, definition)
|
68
|
+
namespace = @namespaces[var_name]
|
69
|
+
obj = CodeObjects::ConstantObject.new(namespace, const_name)
|
70
|
+
obj.value = definition
|
71
|
+
end
|
72
|
+
|
73
|
+
def parse_constants
|
74
|
+
@content.scan(%r{\Wrb_define_
|
75
|
+
( variable |
|
76
|
+
readonly_variable |
|
77
|
+
const |
|
78
|
+
global_const | )
|
79
|
+
\s*\(
|
80
|
+
(?:\s*(\w+),)?
|
81
|
+
\s*"(\w+)",
|
82
|
+
\s*(.*?)\s*\)\s*;
|
83
|
+
}xm) do |type, var_name, const_name, definition|
|
84
|
+
var_name = "rb_cObject" if !var_name or var_name == "rb_mKernel"
|
85
|
+
handle_constants type, var_name, const_name, definition
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
YARD::Parser::SourceParser.register_parser_type(:c, CustomCParser,
|
91
|
+
['c', 'cc', 'cxx', 'cpp'])
|