reflexion 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.doc/ext/reflex/application.cpp +35 -76
- data/.doc/ext/reflex/defs.cpp +8 -0
- data/.doc/ext/reflex/key.cpp +38 -43
- data/.doc/ext/reflex/native.cpp +6 -4
- data/.doc/ext/reflex/points.cpp +47 -52
- data/.doc/ext/reflex/reflex.cpp +12 -13
- data/.doc/ext/reflex/view.cpp +242 -0
- data/.doc/ext/reflex/window.cpp +87 -178
- data/.gitignore +14 -0
- data/Rakefile +6 -31
- data/VERSION +1 -1
- data/examples/hello/.gitignore +2 -0
- data/examples/ruby/app.rb +2 -2
- data/examples/ruby/checker.rb +3 -3
- data/examples/ruby/fps.rb +14 -14
- data/examples/ruby/grid.rb +65 -0
- data/examples/ruby/hello.rb +19 -7
- data/examples/ruby/key.rb +4 -4
- data/examples/ruby/shapes.rb +6 -6
- data/examples/ruby/text.rb +20 -17
- data/examples/ruby/views.rb +88 -0
- data/examples/ruby/visuals.rb +27 -0
- data/ext/reflex/application.cpp +36 -76
- data/ext/reflex/defs.cpp +8 -0
- data/ext/reflex/defs.h +1 -18
- data/ext/reflex/extconf.rb +16 -8
- data/ext/reflex/key.cpp +39 -43
- data/ext/reflex/native.cpp +6 -4
- data/ext/reflex/points.cpp +48 -52
- data/ext/reflex/reflex.cpp +12 -13
- data/ext/reflex/view.cpp +260 -0
- data/ext/reflex/window.cpp +89 -178
- data/include/reflex/application.h +14 -7
- data/include/reflex/defs.h +8 -6
- data/include/reflex/exception.h +1 -1
- data/include/reflex/ruby/application.h +31 -10
- data/include/reflex/ruby/key.h +3 -3
- data/include/reflex/ruby/points.h +3 -3
- data/include/reflex/ruby/view.h +106 -0
- data/include/reflex/ruby/window.h +83 -12
- data/include/reflex/ruby.h +3 -2
- data/include/reflex/view.h +103 -0
- data/include/reflex/window.h +43 -18
- data/include/reflex.h +2 -1
- data/lib/reflex/application.rb +8 -7
- data/lib/reflex/autoinit.rb +1 -1
- data/lib/reflex/bitmap.rb +13 -0
- data/lib/reflex/bounds.rb +2 -122
- data/lib/reflex/ext.rb +5 -0
- data/lib/reflex/helpers.rb +36 -31
- data/lib/reflex/image.rb +13 -0
- data/lib/reflex/module.rb +9 -2
- data/lib/reflex/painter.rb +13 -0
- data/lib/reflex/point.rb +3 -59
- data/lib/reflex/reflex.rb +1 -1
- data/lib/reflex/texture.rb +13 -0
- data/lib/reflex/view.rb +33 -0
- data/lib/reflex/visuals/string.rb +53 -0
- data/lib/reflex/window.rb +18 -43
- data/lib/reflex.rb +3 -3
- data/reflex.gemspec +16 -42
- data/src/cocoa/application.mm +17 -23
- data/src/cocoa/applicationdata.h +3 -9
- data/src/cocoa/cocoaapplication.h +6 -4
- data/src/cocoa/cocoaapplication.mm +61 -19
- data/src/cocoa/cocoawindow.h +7 -5
- data/src/cocoa/cocoawindow.mm +109 -50
- data/src/cocoa/defs.mm +5 -2
- data/src/cocoa/window.mm +71 -41
- data/src/cocoa/windowdata.h +14 -9
- data/src/defs.cpp +1 -1
- data/src/exception.cpp +3 -18
- data/src/helpers.h +12 -0
- data/src/reflex.cpp +11 -5
- data/src/view.cpp +326 -0
- data/src/win32/application.cpp +7 -8
- data/src/win32/defs.h +1 -1
- data/src/win32/window.cpp +137 -41
- data/src/window.cpp +38 -1
- data/test/helpers.rb +2 -5
- data/test/test_application.rb +17 -0
- data/test/test_reflex.rb +4 -2
- data/test/test_view.rb +74 -0
- data/test/test_window.rb +33 -2
- metadata +157 -97
- data/include/reflex/helpers.h +0 -32
- data/test/test_bounds.rb +0 -163
- data/test/test_point.rb +0 -81
data/ext/reflex/defs.h
CHANGED
@@ -7,24 +7,7 @@
|
|
7
7
|
#include <reflex/exception.h>
|
8
8
|
|
9
9
|
|
10
|
-
using Reflex::
|
11
|
-
|
12
|
-
|
13
|
-
#define CHECK_OBJ(obj, type, klass) \
|
14
|
-
do \
|
15
|
-
{ \
|
16
|
-
type* p = Rucy::get_type<type>(obj, klass); \
|
17
|
-
if (!p) Rucy::invalid_object_error(); \
|
18
|
-
} \
|
19
|
-
while(0)
|
20
|
-
|
21
|
-
#define CHECK_OBJECT(obj, type, klass) \
|
22
|
-
do \
|
23
|
-
{ \
|
24
|
-
type* p = Rucy::get_type<type>(obj, klass); \
|
25
|
-
if (!p || !*p) Rucy::invalid_object_error(); \
|
26
|
-
} \
|
27
|
-
while(0)
|
10
|
+
using Reflex::reflex_error;
|
28
11
|
|
29
12
|
|
30
13
|
#endif//EOH
|
data/ext/reflex/extconf.rb
CHANGED
@@ -1,21 +1,19 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
3
|
|
4
|
-
|
5
|
-
$: << File.expand_path(File.join File.dirname(__FILE__), *path.split('/'))
|
6
|
-
end
|
7
|
-
|
8
|
-
require 'rubygems'
|
4
|
+
require 'bundler/setup'
|
9
5
|
require 'mkmf'
|
10
6
|
require 'xot/rake/helpers'
|
11
7
|
require 'xot/module'
|
12
8
|
require 'rucy/module'
|
9
|
+
require 'rays/module'
|
13
10
|
require 'reflex/module'
|
14
11
|
|
15
12
|
include Xot::Rake
|
16
13
|
|
17
14
|
|
18
|
-
|
15
|
+
debug = env :DEBUG, false
|
16
|
+
|
19
17
|
|
20
18
|
DEFS = []
|
21
19
|
INCDIRS = %w[
|
@@ -30,19 +28,24 @@ HEADERS = %w[
|
|
30
28
|
ruby.h
|
31
29
|
xot.h
|
32
30
|
rucy.h
|
31
|
+
rays.h
|
33
32
|
reflex.h
|
34
33
|
]
|
35
34
|
LIBS = %w[
|
36
35
|
stdc++
|
37
36
|
xot
|
38
37
|
rucy
|
38
|
+
rays
|
39
39
|
reflex
|
40
40
|
]
|
41
41
|
FRAMEWORKS = []
|
42
42
|
|
43
43
|
|
44
|
-
DEFS << '_DEBUG' if
|
44
|
+
DEFS << '_DEBUG' if debug
|
45
|
+
DEFS << 'NDEBUG' unless debug
|
45
46
|
DEFS << $~[0].upcase if RUBY_PLATFORM =~ /mswin|ming|cygwin|darwin/i
|
47
|
+
LIBDIRS.concat Rays.library_dirs
|
48
|
+
LIBS << 'rays/native' unless cocoa?
|
46
49
|
if win32?
|
47
50
|
DEFS << 'WINDOWS' << 'WIN32'
|
48
51
|
LIBS.unshift 'gdi32', 'opengl32'
|
@@ -55,14 +58,19 @@ $CPPFLAGS << DEFS.map {|s| " -D#{s}"}.join
|
|
55
58
|
$CPPFLAGS << INCDIRS.map {|s| " -I#{s}"}.join
|
56
59
|
$LDFLAGS << LIBDIRS.map {|s| " -L#{s}"}.join
|
57
60
|
$LDFLAGS << FRAMEWORKS.map {|s| " -framework #{s}"}.join
|
61
|
+
$LDFLAGS << ' -Wl,--out-implib=native.dll.a' if cygwin?
|
62
|
+
$CFLAGS << ' --stdlib=libc++' if clang?
|
58
63
|
$LOCAL_LIBS << ' -lrucy'
|
59
64
|
|
60
|
-
|
65
|
+
RbConfig::CONFIG.each do |key, val|
|
66
|
+
{'gcc' => 'g++', 'clang' => 'clang++'}.each {|from, to| val.gsub! from, to}
|
67
|
+
end
|
61
68
|
|
62
69
|
|
63
70
|
dir_config 'boost'
|
64
71
|
dir_config 'xot', Xot.root_dir
|
65
72
|
dir_config 'rucy', Rucy.root_dir
|
73
|
+
dir_config 'rays', Rays.root_dir
|
66
74
|
dir_config 'reflex', Reflex.root_dir
|
67
75
|
|
68
76
|
exit 1 unless HEADERS.all? {|s| have_header(s)}
|
data/ext/reflex/key.cpp
CHANGED
@@ -8,12 +8,13 @@
|
|
8
8
|
using namespace Rucy;
|
9
9
|
|
10
10
|
|
11
|
+
static Class cKey;
|
12
|
+
|
13
|
+
|
11
14
|
namespace Reflex
|
12
15
|
{
|
13
16
|
|
14
17
|
|
15
|
-
static Class cKey;
|
16
|
-
|
17
18
|
Class
|
18
19
|
key_class ()
|
19
20
|
{
|
@@ -31,63 +32,59 @@ namespace Rucy
|
|
31
32
|
Value
|
32
33
|
value (const Reflex::Key& key)
|
33
34
|
{
|
34
|
-
return new_type
|
35
|
-
Reflex::key_class(), new Reflex::Key(key));
|
35
|
+
return new_type(cKey, new Reflex::Key(key));
|
36
36
|
}
|
37
37
|
|
38
38
|
|
39
39
|
}// Rucy
|
40
40
|
|
41
41
|
|
42
|
-
|
43
|
-
{
|
44
|
-
|
45
|
-
operator bool () const
|
46
|
-
{
|
47
|
-
return true;
|
48
|
-
}
|
49
|
-
|
50
|
-
bool operator ! () const
|
51
|
-
{
|
52
|
-
return !operator bool();
|
53
|
-
}
|
54
|
-
|
55
|
-
};// RubyKey
|
56
|
-
|
42
|
+
#define THIS to<Reflex::Key*>(self)
|
57
43
|
|
58
|
-
#define
|
59
|
-
|
60
|
-
#define CHECK CHECK_OBJECT(self, RubyKey, Reflex::key_class())
|
44
|
+
#define CHECK RUCY_CHECK_OBJ(self, Reflex::Key, cKey)
|
61
45
|
|
62
46
|
|
63
47
|
static
|
64
48
|
RUBY_DEF_ALLOC(alloc, klass)
|
65
49
|
{
|
66
|
-
return new_type<
|
50
|
+
return new_type<Reflex::Key>(klass);
|
67
51
|
}
|
68
52
|
RUBY_END
|
69
53
|
|
70
54
|
static
|
71
55
|
RUBY_DEFN(initialize)
|
72
56
|
{
|
73
|
-
|
57
|
+
RUCY_CHECK_OBJ(self, Reflex::Key, cKey);
|
74
58
|
if (argc < 0 || 4 < argc)
|
75
59
|
argument_error("Key#initialize", argc, 0, 1, 2);
|
76
60
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
61
|
+
THIS->chars = (argc >= 1) ? argv[0].c_str() : NULL;
|
62
|
+
THIS->code = (argc >= 2) ? to<int>(argv[1]) : Reflex::KEY_NONE;
|
63
|
+
THIS->repeat = (argc >= 3) ? to<int>(argv[2]) : 1;
|
64
|
+
THIS->modifiers = (argc >= 4) ? to<uint>(argv[3]) : (uint) Reflex::MOD_NONE;
|
81
65
|
|
82
66
|
return self;
|
83
67
|
}
|
84
68
|
RUBY_END
|
85
69
|
|
70
|
+
static
|
71
|
+
RUBY_DEF1(initialize_copy, obj)
|
72
|
+
{
|
73
|
+
RUCY_CHECK_OBJ(self, Reflex::Key, cKey);
|
74
|
+
|
75
|
+
Reflex::Key* key = to<Reflex::Key*>(obj);
|
76
|
+
if (!key) argument_error();
|
77
|
+
|
78
|
+
*THIS = *key;
|
79
|
+
return self;
|
80
|
+
}
|
81
|
+
RUBY_END
|
82
|
+
|
86
83
|
static
|
87
84
|
RUBY_DEF0(chars)
|
88
85
|
{
|
89
86
|
CHECK;
|
90
|
-
return value(
|
87
|
+
return value(THIS->chars.c_str());
|
91
88
|
}
|
92
89
|
RUBY_END
|
93
90
|
|
@@ -95,7 +92,7 @@ static
|
|
95
92
|
RUBY_DEF0(code)
|
96
93
|
{
|
97
94
|
CHECK;
|
98
|
-
return value(
|
95
|
+
return value(THIS->code);
|
99
96
|
}
|
100
97
|
RUBY_END
|
101
98
|
|
@@ -103,7 +100,7 @@ static
|
|
103
100
|
RUBY_DEF0(repeat)
|
104
101
|
{
|
105
102
|
CHECK;
|
106
|
-
return value(
|
103
|
+
return value(THIS->repeat);
|
107
104
|
}
|
108
105
|
RUBY_END
|
109
106
|
|
@@ -111,7 +108,7 @@ static
|
|
111
108
|
RUBY_DEF0(modifiers)
|
112
109
|
{
|
113
110
|
CHECK;
|
114
|
-
return value(
|
111
|
+
return value(THIS->modifiers);
|
115
112
|
}
|
116
113
|
RUBY_END
|
117
114
|
|
@@ -119,15 +116,14 @@ RUBY_END
|
|
119
116
|
void
|
120
117
|
Init_key ()
|
121
118
|
{
|
122
|
-
Module
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
c.define_method("modifiers", modifiers);
|
119
|
+
Module mReflex = define_module("Reflex");
|
120
|
+
|
121
|
+
cKey = mReflex.define_class("Key");
|
122
|
+
cKey.define_alloc_func(alloc);
|
123
|
+
cKey.define_private_method("initialize", initialize);
|
124
|
+
cKey.define_private_method("initialize_copy", initialize_copy);
|
125
|
+
cKey.define_method("chars", chars);
|
126
|
+
cKey.define_method("code", code);
|
127
|
+
cKey.define_method("repeat", repeat);
|
128
|
+
cKey.define_method("modifiers", modifiers);
|
133
129
|
}
|
data/ext/reflex/native.cpp
CHANGED
@@ -6,10 +6,11 @@ using namespace Rucy;
|
|
6
6
|
|
7
7
|
|
8
8
|
void Init_reflex ();
|
9
|
-
void Init_application ();
|
10
|
-
void Init_window ();
|
11
9
|
void Init_key ();
|
12
10
|
void Init_points ();
|
11
|
+
void Init_application ();
|
12
|
+
void Init_window ();
|
13
|
+
void Init_view ();
|
13
14
|
|
14
15
|
|
15
16
|
extern "C" void
|
@@ -19,8 +20,9 @@ Init_native ()
|
|
19
20
|
raise(rb_eLoadError, "Rucy::init() failed.");
|
20
21
|
|
21
22
|
Init_reflex();
|
22
|
-
Init_application();
|
23
|
-
Init_window();
|
24
23
|
Init_key();
|
25
24
|
Init_points();
|
25
|
+
Init_application();
|
26
|
+
Init_window();
|
27
|
+
Init_view();
|
26
28
|
}
|
data/ext/reflex/points.cpp
CHANGED
@@ -10,12 +10,13 @@ using namespace Rucy;
|
|
10
10
|
using Reflex::coord;
|
11
11
|
|
12
12
|
|
13
|
+
static Class cPoints;
|
14
|
+
|
15
|
+
|
13
16
|
namespace Reflex
|
14
17
|
{
|
15
18
|
|
16
19
|
|
17
|
-
static Class cPoints;
|
18
|
-
|
19
20
|
Class
|
20
21
|
points_class ()
|
21
22
|
{
|
@@ -33,57 +34,53 @@ namespace Rucy
|
|
33
34
|
Value
|
34
35
|
value (const Reflex::Points& points)
|
35
36
|
{
|
36
|
-
return new_type
|
37
|
-
Reflex::points_class(), new Reflex::Points(points));
|
37
|
+
return new_type(cPoints, new Reflex::Points(points));
|
38
38
|
}
|
39
39
|
|
40
40
|
|
41
41
|
}// Rucy
|
42
42
|
|
43
43
|
|
44
|
-
|
45
|
-
{
|
46
|
-
|
47
|
-
operator bool () const
|
48
|
-
{
|
49
|
-
return true;
|
50
|
-
}
|
51
|
-
|
52
|
-
bool operator ! () const
|
53
|
-
{
|
54
|
-
return !operator bool();
|
55
|
-
}
|
56
|
-
|
57
|
-
};// RubyPoints
|
44
|
+
#define THIS to<Reflex::Points*>(self)
|
58
45
|
|
59
|
-
|
60
|
-
#define this ((RubyPoints*) to<Reflex::Points*>(self))
|
61
|
-
|
62
|
-
#define CHECK CHECK_OBJECT(self, RubyPoints, Reflex::points_class())
|
46
|
+
#define CHECK RUCY_CHECK_OBJ(self, Reflex::Points, cPoints)
|
63
47
|
|
64
48
|
|
65
49
|
static
|
66
50
|
RUBY_DEF_ALLOC(alloc, klass)
|
67
51
|
{
|
68
|
-
return new_type<
|
52
|
+
return new_type<Reflex::Points>(klass);
|
69
53
|
}
|
70
54
|
RUBY_END
|
71
55
|
|
72
56
|
static
|
73
57
|
RUBY_DEFN(initialize)
|
74
58
|
{
|
75
|
-
|
59
|
+
RUCY_CHECK_OBJ(self, Reflex::Points, cPoints);
|
76
60
|
if (argc < 0 || 6 < argc)
|
77
61
|
arg_count_error("Points#initialize", argc, 0, 1, 2, 3, 4, 5, 6);
|
78
62
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
63
|
+
THIS->type = (argc >= 1) ? to<int>(argv[0]) : Reflex::POINT_NONE;
|
64
|
+
THIS->x = (argc >= 2) ? to<coord>(argv[1]) : 0;
|
65
|
+
THIS->y = (argc >= 3) ? to<coord>(argv[2]) : 0;
|
66
|
+
THIS->size = 1;
|
67
|
+
THIS->modifiers = (argc >= 4) ? to<uint>(argv[3]) : (uint) Reflex::MOD_NONE;
|
68
|
+
THIS->count = (argc >= 5) ? to<uint>(argv[4]) : 0;
|
69
|
+
THIS->drag = (argc >= 6) ? to<bool>(argv[5]) : false;
|
70
|
+
|
71
|
+
return self;
|
72
|
+
}
|
73
|
+
RUBY_END
|
74
|
+
|
75
|
+
static
|
76
|
+
RUBY_DEF1(initialize_copy, obj)
|
77
|
+
{
|
78
|
+
RUCY_CHECK_OBJ(self, Reflex::Points, cPoints);
|
79
|
+
|
80
|
+
Reflex::Points* points = to<Reflex::Points*>(obj);
|
81
|
+
if (!points) argument_error();
|
86
82
|
|
83
|
+
*THIS = *points;
|
87
84
|
return self;
|
88
85
|
}
|
89
86
|
RUBY_END
|
@@ -92,7 +89,7 @@ static
|
|
92
89
|
RUBY_DEF0(type)
|
93
90
|
{
|
94
91
|
CHECK;
|
95
|
-
return value(
|
92
|
+
return value(THIS->type);
|
96
93
|
}
|
97
94
|
RUBY_END
|
98
95
|
|
@@ -100,7 +97,7 @@ static
|
|
100
97
|
RUBY_DEF0(x)
|
101
98
|
{
|
102
99
|
CHECK;
|
103
|
-
return value(
|
100
|
+
return value(THIS->x);
|
104
101
|
}
|
105
102
|
RUBY_END
|
106
103
|
|
@@ -108,7 +105,7 @@ static
|
|
108
105
|
RUBY_DEF0(y)
|
109
106
|
{
|
110
107
|
CHECK;
|
111
|
-
return value(
|
108
|
+
return value(THIS->y);
|
112
109
|
}
|
113
110
|
RUBY_END
|
114
111
|
|
@@ -116,7 +113,7 @@ static
|
|
116
113
|
RUBY_DEF0(size)
|
117
114
|
{
|
118
115
|
CHECK;
|
119
|
-
return value(
|
116
|
+
return value(THIS->size);
|
120
117
|
}
|
121
118
|
RUBY_END
|
122
119
|
|
@@ -124,7 +121,7 @@ static
|
|
124
121
|
RUBY_DEF0(modifiers)
|
125
122
|
{
|
126
123
|
CHECK;
|
127
|
-
return value(
|
124
|
+
return value(THIS->modifiers);
|
128
125
|
}
|
129
126
|
RUBY_END
|
130
127
|
|
@@ -132,7 +129,7 @@ static
|
|
132
129
|
RUBY_DEF0(count)
|
133
130
|
{
|
134
131
|
CHECK;
|
135
|
-
return value(
|
132
|
+
return value(THIS->count);
|
136
133
|
}
|
137
134
|
RUBY_END
|
138
135
|
|
@@ -140,7 +137,7 @@ static
|
|
140
137
|
RUBY_DEF0(drag)
|
141
138
|
{
|
142
139
|
CHECK;
|
143
|
-
return value(
|
140
|
+
return value(THIS->drag);
|
144
141
|
}
|
145
142
|
RUBY_END
|
146
143
|
|
@@ -148,18 +145,17 @@ RUBY_END
|
|
148
145
|
void
|
149
146
|
Init_points ()
|
150
147
|
{
|
151
|
-
Module
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
c.define_method("drag", drag);
|
148
|
+
Module mReflex = define_module("Reflex");
|
149
|
+
|
150
|
+
cPoints = mReflex.define_class("Points");
|
151
|
+
cPoints.define_alloc_func(alloc);
|
152
|
+
cPoints.define_private_method("initialize", initialize);
|
153
|
+
cPoints.define_private_method("initialize_copy", initialize_copy);
|
154
|
+
cPoints.define_method("type", type);
|
155
|
+
cPoints.define_method("x", x);
|
156
|
+
cPoints.define_method("y", y);
|
157
|
+
cPoints.define_method("size", size);
|
158
|
+
cPoints.define_method("modifiers", modifiers);
|
159
|
+
cPoints.define_method("count", count);
|
160
|
+
cPoints.define_method("drag", drag);
|
165
161
|
}
|
data/ext/reflex/reflex.cpp
CHANGED
@@ -6,12 +6,13 @@
|
|
6
6
|
using namespace Rucy;
|
7
7
|
|
8
8
|
|
9
|
+
static Module mReflex;
|
10
|
+
|
11
|
+
|
9
12
|
namespace Reflex
|
10
13
|
{
|
11
14
|
|
12
15
|
|
13
|
-
static Module mReflex;
|
14
|
-
|
15
16
|
Module
|
16
17
|
reflex_module ()
|
17
18
|
{
|
@@ -26,7 +27,7 @@ static
|
|
26
27
|
RUBY_DEF0(init)
|
27
28
|
{
|
28
29
|
if (!Reflex::init())
|
29
|
-
|
30
|
+
reflex_error("Reflex::init() failed.");
|
30
31
|
|
31
32
|
return self;
|
32
33
|
}
|
@@ -36,7 +37,7 @@ static
|
|
36
37
|
RUBY_DEF0(fin)
|
37
38
|
{
|
38
39
|
if (!Reflex::fin())
|
39
|
-
|
40
|
+
reflex_error("Reflex::fin() failed.");
|
40
41
|
|
41
42
|
return self;
|
42
43
|
}
|
@@ -46,7 +47,7 @@ static
|
|
46
47
|
RUBY_DEF1(run, name)
|
47
48
|
{
|
48
49
|
if (!Reflex::run(name ? name.c_str() : NULL))
|
49
|
-
|
50
|
+
reflex_error("Reflex::run() failed.");
|
50
51
|
|
51
52
|
return self;
|
52
53
|
}
|
@@ -56,7 +57,7 @@ static
|
|
56
57
|
RUBY_DEF0(quit)
|
57
58
|
{
|
58
59
|
if (!Reflex::quit())
|
59
|
-
|
60
|
+
reflex_error("Reflex::quit() failed.");
|
60
61
|
|
61
62
|
return self;
|
62
63
|
}
|
@@ -66,11 +67,9 @@ RUBY_END
|
|
66
67
|
void
|
67
68
|
Init_reflex ()
|
68
69
|
{
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
m.define_singleton_method("run!", run);
|
75
|
-
m.define_singleton_method("quit", quit);
|
70
|
+
mReflex = define_module("Reflex");
|
71
|
+
mReflex.define_singleton_method("init!", init);
|
72
|
+
mReflex.define_singleton_method("fin!", fin);
|
73
|
+
mReflex.define_singleton_method("run!", run);
|
74
|
+
mReflex.define_singleton_method("quit", quit);
|
76
75
|
}
|