rubysdl 1.3.1 → 2.0
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/MANIFEST +22 -2
- data/NEWS.en +80 -0
- data/NEWS.ja +83 -0
- data/README.en +2 -1
- data/README.ja +2 -2
- data/doc-en/Makefile +18 -0
- data/doc-en/cdrom.rsd +417 -0
- data/doc-en/collision.rsd +174 -0
- data/doc-en/event.rsd +1476 -0
- data/doc-en/font.rsd +811 -0
- data/doc-en/general.rsd +43 -0
- data/doc-en/init.rsd +168 -0
- data/doc-en/joystick.rsd +401 -0
- data/doc-en/mixer.rsd +869 -0
- data/doc-en/mpeg.rsd +585 -0
- data/doc-en/opengl.rsd +155 -0
- data/doc-en/sdlskk.rsd +472 -0
- data/doc-en/time.rsd +46 -0
- data/doc-en/video.rsd +2806 -0
- data/doc-en/wm.rsd +112 -0
- data/doc/Makefile +1 -1
- data/doc/cdrom.rsd +3 -3
- data/doc/event.rsd +178 -179
- data/doc/general.rsd +10 -0
- data/doc/init.rsd +2 -2
- data/doc/joystick.rsd +29 -5
- data/doc/mixer.rsd +20 -0
- data/doc/rsd.rb +42 -9
- data/doc/sdlskk.rsd +7 -7
- data/doc/video.rsd +461 -168
- data/doc/wm.rsd +2 -2
- data/extconf.rb +1 -8
- data/lib/rubysdl_aliases.rb +52 -190
- data/lib/rubysdl_compatible_ver1.rb +243 -0
- data/lib/sdl.rb +58 -92
- data/rubysdl.h +59 -68
- data/rubysdl_cdrom.c +125 -102
- data/{rubysdl_doc.en.rd → rubysdl_doc_old.en.rd} +3 -2
- data/rubysdl_event.c +318 -255
- data/rubysdl_event_key.c +299 -287
- data/rubysdl_image.c +37 -13
- data/rubysdl_joystick.c +180 -67
- data/rubysdl_kanji.c +61 -75
- data/rubysdl_main.c +65 -138
- data/rubysdl_mixer.c +339 -214
- data/rubysdl_mouse.c +50 -43
- data/rubysdl_opengl.c +31 -28
- data/rubysdl_pixel.c +17 -28
- data/rubysdl_ref.en.html +5658 -0
- data/rubysdl_ref.en.rd +6337 -0
- data/rubysdl_ref.html +2253 -1964
- data/rubysdl_ref.rd +823 -469
- data/rubysdl_rwops.c +9 -6
- data/rubysdl_sdlskk.c +137 -165
- data/rubysdl_sge_video.c +355 -469
- data/rubysdl_smpeg.c +189 -190
- data/rubysdl_time.c +1 -1
- data/rubysdl_ttf.c +147 -215
- data/rubysdl_video.c +486 -405
- data/rubysdl_wm.c +30 -30
- data/sample/aadraw.rb +9 -9
- data/sample/alpha.rb +12 -13
- data/sample/alphadraw.rb +10 -10
- data/sample/bfont.rb +4 -4
- data/sample/cdrom.rb +11 -4
- data/sample/collision.rb +20 -20
- data/sample/cursor.rb +5 -5
- data/sample/ellipses.rb +20 -16
- data/sample/event2.rb +11 -9
- data/sample/font.rb +4 -4
- data/sample/fpstimer.rb +3 -3
- data/sample/icon.bmp.gz +0 -0
- data/sample/icon.png +0 -0
- data/sample/joy2.rb +14 -14
- data/sample/kanji.rb +7 -7
- data/sample/load_from_io.rb +44 -0
- data/sample/movesp.rb +13 -12
- data/sample/playmod.rb +2 -3
- data/sample/plaympeg.rb +8 -8
- data/sample/playwave.rb +5 -6
- data/sample/sdlskk.rb +11 -11
- data/sample/sgetest.rb +14 -12
- data/sample/stetris.rb +12 -13
- data/sample/testgl.rb +13 -14
- data/sample/testsprite.rb +12 -11
- data/sample/transformblit.rb +23 -22
- metadata +62 -35
- data/rubysdl_event2.c +0 -417
data/rubysdl_rwops.c
CHANGED
@@ -26,8 +26,8 @@ static int rubyio_read(SDL_RWops* context, void* ptr, int size, int maxnum)
|
|
26
26
|
str = rb_funcall(io, rb_intern("read"), 1, INT2NUM(size*maxnum));
|
27
27
|
StringValue(str);
|
28
28
|
|
29
|
-
memcpy(ptr,
|
30
|
-
return
|
29
|
+
memcpy(ptr, RSTRING_PTR(str), RSTRING_LEN(str));
|
30
|
+
return RSTRING_LEN(str)/size;
|
31
31
|
}
|
32
32
|
|
33
33
|
static int rubyio_write(SDL_RWops* context, const void* ptr, int size, int num)
|
@@ -39,9 +39,6 @@ static int rubyio_pseudo_seek(SDL_RWops* context, int offset, int whence)
|
|
39
39
|
{
|
40
40
|
volatile VALUE io = (VALUE)context->hidden.unknown.data1;
|
41
41
|
volatile VALUE str;
|
42
|
-
if(offset < 0)
|
43
|
-
rb_raise(eSDLError, "cannot seek backward");
|
44
|
-
|
45
42
|
|
46
43
|
switch(whence){
|
47
44
|
case SEEK_SET:
|
@@ -49,7 +46,13 @@ static int rubyio_pseudo_seek(SDL_RWops* context, int offset, int whence)
|
|
49
46
|
rb_funcall(io, rb_intern("read"), 1, INT2NUM(offset));
|
50
47
|
break;
|
51
48
|
case SEEK_CUR:
|
52
|
-
|
49
|
+
if (offset >= 0) {
|
50
|
+
str = rb_funcall(io, rb_intern("read"), 1, INT2NUM(offset));
|
51
|
+
} else {
|
52
|
+
int d = NUM2INT(rb_funcall(io, rb_intern("tell"), 0)) + offset;
|
53
|
+
rb_funcall(io, rb_intern("rewind"), 0);
|
54
|
+
rb_funcall(io, rb_intern("read"), 1, INT2NUM(d));
|
55
|
+
}
|
53
56
|
break;
|
54
57
|
case SEEK_END:
|
55
58
|
rb_raise(eSDLError, "cannot seek SEEK_END");
|
data/rubysdl_sdlskk.c
CHANGED
@@ -22,6 +22,19 @@
|
|
22
22
|
#include <sdlskk.h>
|
23
23
|
#include <SDL_ttf.h>
|
24
24
|
|
25
|
+
static VALUE cEvent = Qnil;
|
26
|
+
static VALUE cKeyDownEvent = Qnil;
|
27
|
+
|
28
|
+
static VALUE cContext = Qnil;
|
29
|
+
static VALUE cDictionary = Qnil;
|
30
|
+
static VALUE cRomKanaRuleTable = Qnil;
|
31
|
+
static VALUE cKeybind = Qnil;
|
32
|
+
|
33
|
+
DEFINE_GET_STRUCT(SDLSKK_Context, Get_SDLSKK_Context, cContext, "SDL::SKK::Context");
|
34
|
+
DEFINE_GET_STRUCT(SDLSKK_Dictionary, Get_SDLSKK_Dictionary, cDictionary, "SDL::SKK::Dictionary");
|
35
|
+
DEFINE_GET_STRUCT(SDLSKK_RomKanaRuleTable, Get_SDLSKK_RomKanaRuleTable, cRomKanaRuleTable, "SDL::SKK::RomKanaRuleTable");
|
36
|
+
DEFINE_GET_STRUCT(SDLSKK_Keybind, Get_SDLSKK_Keybind, cKeybind, "SDL::SKK::Keybind");
|
37
|
+
|
25
38
|
typedef SDL_Surface* (*Renderer)(SDLSKK_Context*,TTF_Font*,SDL_Color);
|
26
39
|
|
27
40
|
static void skk_error_handler(SDLSKK_Error err)
|
@@ -34,279 +47,238 @@ static void skk_error_handler(SDLSKK_Error err)
|
|
34
47
|
}
|
35
48
|
}
|
36
49
|
|
37
|
-
static VALUE
|
50
|
+
static VALUE SKK_set_encoding(VALUE mod, VALUE encoding)
|
38
51
|
{
|
39
|
-
SDLSKK_set_encoding(
|
52
|
+
SDLSKK_set_encoding(NUM2INT(encoding));
|
40
53
|
return Qnil;
|
41
54
|
}
|
42
55
|
|
43
|
-
static VALUE
|
56
|
+
static VALUE SKK_get_encoding(VALUE mod)
|
44
57
|
{
|
45
58
|
return INT2FIX(SDLSKK_get_encoding());
|
46
59
|
}
|
47
60
|
|
48
|
-
|
49
|
-
|
50
|
-
VALUE keybind, VALUE use_minibuffer )
|
61
|
+
static VALUE Context_s_new(VALUE klass, VALUE dict, VALUE rule_table,
|
62
|
+
VALUE keybind, VALUE use_minibuffer)
|
51
63
|
{
|
52
64
|
SDLSKK_Context* c_context;
|
53
|
-
SDLSKK_RomKanaRuleTable* c_table;
|
54
|
-
SDLSKK_Dictionary* c_dict;
|
55
|
-
SDLSKK_Keybind* c_bind;
|
56
65
|
VALUE context;
|
57
66
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
if( !rb_obj_is_kind_of(keybind,cKeybind) )
|
63
|
-
rb_raise(rb_eArgError,"type mismatch(expect SDL::SKK::Keybind)");
|
64
|
-
|
65
|
-
Data_Get_Struct(dict,SDLSKK_Dictionary,c_dict);
|
66
|
-
Data_Get_Struct(rule_table,SDLSKK_RomKanaRuleTable,c_table);
|
67
|
-
Data_Get_Struct(keybind,SDLSKK_Keybind,c_bind);
|
67
|
+
c_context = SDLSKK_Context_new(Get_SDLSKK_Dictionary(dict),
|
68
|
+
Get_SDLSKK_RomKanaRuleTable(rule_table),
|
69
|
+
Get_SDLSKK_Keybind(keybind),
|
70
|
+
RTEST(use_minibuffer));
|
68
71
|
|
69
|
-
c_context
|
70
|
-
if( c_context == NULL )
|
72
|
+
if(c_context == NULL)
|
71
73
|
rb_raise(eSDLError,"Couldn't create Context");
|
72
74
|
|
73
|
-
context = Data_Wrap_Struct(
|
74
|
-
rb_iv_set(context,"dict",dict);
|
75
|
-
rb_iv_set(context,"rule_table",rule_table);
|
75
|
+
context = Data_Wrap_Struct(klass, 0, SDLSKK_Context_delete ,c_context);
|
76
|
+
rb_iv_set(context, "dict", dict);
|
77
|
+
rb_iv_set(context, "rule_table", rule_table);
|
76
78
|
|
77
79
|
return context;
|
78
80
|
}
|
79
81
|
|
80
|
-
static VALUE
|
82
|
+
static VALUE Context_input(VALUE self, VALUE event)
|
81
83
|
{
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
SDLSKK_Context_input_event(
|
84
|
+
if(rb_obj_is_kind_of(event, cKeyDownEvent)){
|
85
|
+
SDL_Event ev;
|
86
|
+
ev.type = SDL_KEYDOWN;
|
87
|
+
ev.key.keysym.sym = NUM2INT(rb_iv_get(event, "@sym"));
|
88
|
+
ev.key.keysym.unicode = NUM2UINT(rb_iv_get(event, "@unicode"));
|
89
|
+
ev.key.keysym.mod = NUM2INT(rb_iv_get(event, "@mod"));
|
90
|
+
SDLSKK_Context_input_event(Get_SDLSKK_Context(self), &ev);
|
89
91
|
return Qnil;
|
92
|
+
}else if(rb_obj_is_kind_of(event, cEvent)){
|
93
|
+
return Qnil;
|
94
|
+
}else{
|
95
|
+
rb_raise( rb_eArgError,"type mismatch(expect SDL::Event or SDL::Event2)");
|
90
96
|
}
|
91
|
-
|
92
|
-
#ifdef DEF_EVENT2
|
93
|
-
if( rb_obj_is_kind_of( event,cEvent2 ) ){
|
94
|
-
if( rb_obj_is_kind_of( event,cKeyDownEvent ) ){
|
95
|
-
SDL_Event ev2;
|
96
|
-
ev2.type = SDL_KEYDOWN;
|
97
|
-
ev2.key.keysym.sym = NUM2INT( rb_iv_get(event,"@sym") );
|
98
|
-
ev2.key.keysym.unicode = NUM2UINT( rb_iv_get(event,"@unicode") );
|
99
|
-
ev2.key.keysym.mod = NUM2INT( rb_iv_get(event,"@mod"));
|
100
|
-
SDLSKK_Context_input_event( context, &ev2 );
|
101
|
-
return Qnil;
|
102
|
-
}else{
|
103
|
-
return Qnil;
|
104
|
-
}
|
105
|
-
}
|
106
|
-
|
107
|
-
#endif
|
108
|
-
rb_raise( rb_eArgError,"type mismatch(expect SDL::Event or SDL::Event2)");
|
109
|
-
|
110
97
|
/* NOT REACHED */
|
111
98
|
}
|
112
99
|
|
113
|
-
static VALUE
|
100
|
+
static VALUE Context_str(VALUE self)
|
114
101
|
{
|
115
|
-
SDLSKK_Context* context;
|
116
102
|
char cstr[10000];
|
117
|
-
|
118
|
-
Data_Get_Struct(obj,SDLSKK_Context,context);
|
119
|
-
|
120
|
-
SDLSKK_Context_get_str(context,cstr,sizeof(cstr));
|
121
|
-
|
103
|
+
SDLSKK_Context_get_str(Get_SDLSKK_Context(self), cstr, sizeof(cstr));
|
122
104
|
return rb_str_new2(cstr);
|
123
105
|
}
|
124
106
|
|
125
|
-
static VALUE render_str(VALUE
|
126
|
-
|
107
|
+
static VALUE render_str(VALUE self, VALUE font, VALUE r, VALUE g, VALUE b,
|
108
|
+
Renderer func)
|
127
109
|
{
|
128
|
-
SDLSKK_Context* context;
|
129
110
|
SDL_Surface* surface;
|
130
|
-
TTF_Font* ttf_font;
|
131
111
|
SDL_Color color;
|
132
|
-
|
133
|
-
if( !rb_obj_is_kind_of(font,cTTF) )
|
134
|
-
rb_raise( rb_eArgError,"type mismatch(expect SDL::TTF)");
|
135
112
|
|
136
113
|
color.r = NUM2UINT(r);
|
137
114
|
color.g = NUM2UINT(g);
|
138
115
|
color.b = NUM2UINT(b);
|
139
116
|
|
140
|
-
|
141
|
-
Data_Get_Struct(font,TTF_Font,ttf_font);
|
142
|
-
|
143
|
-
surface = func(context,ttf_font,color);
|
117
|
+
surface = func(Get_SDLSKK_Context(self), Get_TTF_Font(font), color);
|
144
118
|
|
145
|
-
if(
|
119
|
+
if(surface == NULL)
|
146
120
|
return Qnil;
|
147
121
|
|
148
|
-
return
|
122
|
+
return Surface_create(surface);
|
149
123
|
}
|
150
124
|
|
151
|
-
static VALUE
|
152
|
-
|
125
|
+
static VALUE Context_render_str(VALUE self, VALUE font,
|
126
|
+
VALUE r, VALUE g, VALUE b)
|
127
|
+
|
153
128
|
{
|
154
|
-
return render_str(
|
129
|
+
return render_str(self, font, r, g, b, SDLSKK_Context_render_display_str);
|
155
130
|
}
|
156
131
|
|
157
|
-
static VALUE
|
158
|
-
|
132
|
+
static VALUE Context_render_minibuffer_str(VALUE self, VALUE font,
|
133
|
+
VALUE r, VALUE g,VALUE b)
|
159
134
|
{
|
160
|
-
return render_str(
|
135
|
+
return render_str(self, font, r, g, b, SDLSKK_Context_render_minibuffer_str);
|
161
136
|
}
|
162
137
|
|
163
|
-
static VALUE
|
138
|
+
static VALUE Context_get_basic_mode(VALUE self)
|
164
139
|
{
|
165
|
-
|
166
|
-
|
167
|
-
Data_Get_Struct(obj,SDLSKK_Context,context);
|
168
|
-
return BOOL(SDLSKK_Context_get_basic_mode(context));
|
140
|
+
return INT2BOOL(SDLSKK_Context_get_basic_mode(Get_SDLSKK_Context(self)));
|
169
141
|
}
|
170
142
|
|
171
|
-
static VALUE
|
143
|
+
static VALUE Context_clear(VALUE self)
|
172
144
|
{
|
173
|
-
|
174
|
-
|
175
|
-
Data_Get_Struct(obj,SDLSKK_Context,context);
|
176
|
-
SDLSKK_Context_clear(context);
|
145
|
+
SDLSKK_Context_clear(Get_SDLSKK_Context(self));
|
177
146
|
return Qnil;
|
178
147
|
}
|
179
148
|
|
180
|
-
static VALUE
|
149
|
+
static VALUE Context_clear_text(VALUE self)
|
181
150
|
{
|
182
|
-
|
183
|
-
|
184
|
-
Data_Get_Struct(obj,SDLSKK_Context,context);
|
185
|
-
SDLSKK_Context_clear_text(context);
|
151
|
+
SDLSKK_Context_clear_text(Get_SDLSKK_Context(self));
|
186
152
|
return Qnil;
|
187
153
|
}
|
188
154
|
|
189
|
-
static VALUE
|
155
|
+
static VALUE Dictionary_s_new(VALUE klass)
|
190
156
|
{
|
191
157
|
SDLSKK_Dictionary* dict;
|
192
158
|
|
193
159
|
dict = SDLSKK_Dict_new();
|
194
|
-
if(
|
195
|
-
rb_raise(eSDLError,"Couldn't create SDL::SKK::Dictionary"
|
160
|
+
if(dict == NULL)
|
161
|
+
rb_raise(eSDLError, "Couldn't create SDL::SKK::Dictionary");
|
196
162
|
|
197
|
-
return Data_Wrap_Struct(
|
163
|
+
return Data_Wrap_Struct(klass, 0, SDLSKK_Dict_delete, dict);
|
198
164
|
}
|
199
165
|
|
200
|
-
static VALUE
|
166
|
+
static VALUE Dictionary_load(VALUE self, VALUE filename, VALUE users)
|
201
167
|
{
|
202
|
-
SDLSKK_Dictionary* dict;
|
203
|
-
|
204
|
-
|
168
|
+
SDLSKK_Dictionary* dict = Get_SDLSKK_Dictionary(self);
|
169
|
+
rb_secure(4);
|
170
|
+
SafeStringValue(filename);
|
205
171
|
|
206
|
-
if(
|
207
|
-
rb_raise(eSDLError,"Couldn't load %s",
|
172
|
+
if(!SDLSKK_Dict_load(dict, RSTRING_PTR(filename), RTEST(users)))
|
173
|
+
rb_raise(eSDLError, "Couldn't load %s", RSTRING_PTR(filename));
|
208
174
|
|
209
175
|
return Qnil;
|
210
176
|
}
|
211
177
|
|
212
|
-
static VALUE
|
178
|
+
static VALUE Dictionary_save(VALUE self, VALUE filename)
|
213
179
|
{
|
214
|
-
SDLSKK_Dictionary* dict;
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
if( !SDLSKK_Dict_save_user_dict(dict,GETCSTR(filename)) )
|
219
|
-
rb_raise(eSDLError,"Couldn't save %s",GETCSTR(filename));
|
180
|
+
SDLSKK_Dictionary* dict = Get_SDLSKK_Dictionary(self);
|
181
|
+
rb_secure(4);
|
182
|
+
SafeStringValue(self);
|
220
183
|
|
184
|
+
if(!SDLSKK_Dict_save_user_dict(dict, RSTRING_PTR(filename)))
|
185
|
+
rb_raise(eSDLError, "Couldn't save %s", RSTRING_PTR(filename));
|
221
186
|
return Qnil;
|
222
187
|
}
|
223
188
|
|
224
|
-
static VALUE
|
189
|
+
static VALUE RomKanaRuleTable_s_new(VALUE klass, VALUE table_file)
|
225
190
|
{
|
226
191
|
SDLSKK_RomKanaRuleTable* rule_table;
|
192
|
+
rb_secure(4);
|
193
|
+
SafeStringValue(table_file);
|
194
|
+
|
195
|
+
rule_table = SDLSKK_RomKanaRuleTable_new(RSTRING_PTR(table_file));
|
227
196
|
|
228
|
-
rule_table
|
229
|
-
|
230
|
-
if( rule_table == NULL )
|
231
|
-
rb_raise(eSDLError,"Couldn't load %s",GETCSTR(table_file));
|
197
|
+
if(rule_table == NULL)
|
198
|
+
rb_raise(eSDLError, "Couldn't load %s", RSTRING_PTR(table_file));
|
232
199
|
|
233
|
-
return Data_Wrap_Struct(
|
200
|
+
return Data_Wrap_Struct(klass, 0, SDLSKK_RomKanaRuleTable_delete, rule_table);
|
234
201
|
}
|
235
202
|
|
236
|
-
static VALUE
|
203
|
+
static VALUE Keybind_s_new(VALUE klass)
|
237
204
|
{
|
238
|
-
return Data_Wrap_Struct(
|
205
|
+
return Data_Wrap_Struct(klass, 0, SDLSKK_Keybind_delete, SDLSKK_Keybind_new());
|
239
206
|
}
|
240
207
|
|
241
|
-
static VALUE
|
208
|
+
static VALUE Keybind_set_key(VALUE self, VALUE key_str, VALUE cmd_str)
|
242
209
|
{
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
SDLSKK_Keybind_set_key(keybind,GETCSTR(key_str),GETCSTR(cmd_str));
|
210
|
+
SDLSKK_Keybind_set_key(Get_SDLSKK_Keybind(self),
|
211
|
+
StringValuePtr(key_str),
|
212
|
+
StringValuePtr(cmd_str));
|
247
213
|
return Qnil;
|
248
214
|
}
|
249
215
|
|
250
|
-
static VALUE
|
216
|
+
static VALUE Keybind_set_default_key(VALUE self)
|
251
217
|
{
|
252
|
-
|
253
|
-
|
254
|
-
Data_Get_Struct(obj,SDLSKK_Keybind,keybind);
|
255
|
-
SDLSKK_Keybind_set_default_key(keybind);
|
218
|
+
SDLSKK_Keybind_set_default_key(Get_SDLSKK_Keybind(self));
|
256
219
|
return Qnil;
|
257
220
|
}
|
258
221
|
|
259
|
-
static VALUE
|
222
|
+
static VALUE Keybind_unset_key(VALUE self, VALUE key_str)
|
260
223
|
{
|
261
|
-
|
262
|
-
|
263
|
-
Data_Get_Struct(obj,SDLSKK_Keybind,keybind);
|
264
|
-
SDLSKK_Keybind_unset_key(keybind,GETCSTR(key_str));
|
224
|
+
SDLSKK_Keybind_unset_key(Get_SDLSKK_Keybind(self), StringValuePtr(key_str));
|
265
225
|
return Qnil;
|
266
226
|
}
|
267
227
|
|
268
|
-
|
228
|
+
void rubysdl_init_SKK(VALUE mSDL)
|
269
229
|
{
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
cDictionary = rb_define_class_under(mSDLSKK,"Dictionary",rb_cObject);
|
280
|
-
cRomKanaRuleTable = rb_define_class_under(mSDLSKK,"RomKanaRuleTable",
|
230
|
+
VALUE mSDLSKK;
|
231
|
+
|
232
|
+
cEvent = rb_const_get(mSDL, rb_intern("Event"));
|
233
|
+
cKeyDownEvent = rb_const_get(cEvent, rb_intern("KeyDown"));
|
234
|
+
|
235
|
+
mSDLSKK = rb_define_module_under(mSDL, "SKK");
|
236
|
+
cContext = rb_define_class_under(mSDLSKK, "Context", rb_cObject);
|
237
|
+
cDictionary = rb_define_class_under(mSDLSKK, "Dictionary", rb_cObject);
|
238
|
+
cRomKanaRuleTable = rb_define_class_under(mSDLSKK, "RomKanaRuleTable",
|
281
239
|
rb_cObject);
|
282
|
-
cKeybind = rb_define_class_under(mSDLSKK,"Keybind",rb_cObject);
|
240
|
+
cKeybind = rb_define_class_under(mSDLSKK, "Keybind", rb_cObject);
|
241
|
+
|
242
|
+
rb_undef_alloc_func(cContext);
|
243
|
+
rb_undef_alloc_func(cDictionary);
|
244
|
+
rb_undef_alloc_func(cRomKanaRuleTable);
|
245
|
+
rb_undef_alloc_func(cKeybind);
|
283
246
|
|
284
|
-
rb_define_module_function(mSDLSKK,"encoding=",
|
285
|
-
rb_define_module_function(mSDLSKK,"encoding",
|
247
|
+
rb_define_module_function(mSDLSKK, "encoding=", SKK_set_encoding, 1);
|
248
|
+
rb_define_module_function(mSDLSKK, "encoding", SKK_get_encoding, 0);
|
286
249
|
|
287
|
-
rb_define_singleton_method(cContext,"new",
|
288
|
-
rb_define_method(cContext,"input",
|
289
|
-
rb_define_method(cContext,"str",
|
290
|
-
rb_define_method(cContext,"render_str",
|
291
|
-
rb_define_method(cContext,"render_minibuffer_str",
|
292
|
-
|
293
|
-
rb_define_method(cContext,"
|
294
|
-
rb_define_method(cContext,"
|
250
|
+
rb_define_singleton_method(cContext, "new", Context_s_new, 4);
|
251
|
+
rb_define_method(cContext, "input", Context_input, 1);
|
252
|
+
rb_define_method(cContext, "str", Context_str, 0);
|
253
|
+
rb_define_method(cContext, "render_str", Context_render_str, 4);
|
254
|
+
rb_define_method(cContext, "render_minibuffer_str",
|
255
|
+
Context_render_minibuffer_str, 4);
|
256
|
+
rb_define_method(cContext, "get_basic_mode", Context_get_basic_mode, 0);
|
257
|
+
rb_define_method(cContext, "clear", Context_clear, 0);
|
258
|
+
rb_define_method(cContext, "clear_text", Context_clear_text, 0);
|
295
259
|
|
296
|
-
rb_define_singleton_method(cDictionary,"new",
|
297
|
-
rb_define_method(cDictionary,"load",
|
298
|
-
rb_define_method(cDictionary,"save",
|
260
|
+
rb_define_singleton_method(cDictionary, "new", Dictionary_s_new, 0);
|
261
|
+
rb_define_method(cDictionary, "load", Dictionary_load, 2);
|
262
|
+
rb_define_method(cDictionary, "save", Dictionary_save, 1);
|
299
263
|
|
300
|
-
rb_define_singleton_method(cRomKanaRuleTable,"new",
|
301
|
-
|
264
|
+
rb_define_singleton_method(cRomKanaRuleTable, "new",
|
265
|
+
RomKanaRuleTable_s_new, 1);
|
302
266
|
|
303
|
-
rb_define_singleton_method(cKeybind,"new",
|
304
|
-
rb_define_method(cKeybind,"set_key",
|
305
|
-
rb_define_method(cKeybind,"set_default_key",
|
306
|
-
rb_define_method(cKeybind,"unset_key",
|
267
|
+
rb_define_singleton_method(cKeybind, "new", Keybind_s_new, 0);
|
268
|
+
rb_define_method(cKeybind, "set_key", Keybind_set_key, 2);
|
269
|
+
rb_define_method(cKeybind, "set_default_key", Keybind_set_default_key, 0);
|
270
|
+
rb_define_method(cKeybind, "unset_key", Keybind_unset_key, 1);
|
307
271
|
|
308
272
|
SDLSKK_set_error_func(skk_error_handler);
|
273
|
+
|
309
274
|
|
310
|
-
|
275
|
+
rb_define_const(mSDLSKK, "EUCJP", INT2NUM(SDLSKK_EUCJP));
|
276
|
+
rb_define_const(mSDLSKK, "UTF8", INT2NUM(SDLSKK_UTF8));
|
277
|
+
rb_define_const(mSDLSKK, "SJIS", INT2NUM(SDLSKK_SJIS));
|
278
|
+
}
|
279
|
+
#else /* HAVE_SDLSKK */
|
280
|
+
#include "rubysdl.h"
|
281
|
+
void rubysdl_init_SKK(VALUE mSDL)
|
282
|
+
{
|
311
283
|
}
|
312
284
|
#endif /* HAVE_SDLSKK */
|