rua 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/rua.c +25 -7
- data/ext/rua.h +4 -0
- metadata +3 -3
data/ext/rua.c
CHANGED
@@ -16,7 +16,7 @@ __declspec(dllexport) void Init_rua(void);
|
|
16
16
|
|
17
17
|
#include "rua.h"
|
18
18
|
|
19
|
-
#define VERSION "0.2.
|
19
|
+
#define VERSION "0.2.3"
|
20
20
|
#define REF_RBOBJ "self"
|
21
21
|
|
22
22
|
static const char *insecure_methods[] = {
|
@@ -121,9 +121,16 @@ void Init_rua() {
|
|
121
121
|
|
122
122
|
static VALUE rua_alloc(VALUE klass) {
|
123
123
|
struct rua *p = ALLOC(struct rua);
|
124
|
+
|
124
125
|
p->R = ALLOC(struct rua_state);
|
126
|
+
p->R->rua = Qnil;
|
127
|
+
p->R->error_handler = Qnil;
|
128
|
+
return Data_Wrap_Struct(klass, rua_mark, rua_free, p);
|
129
|
+
}
|
125
130
|
|
126
|
-
|
131
|
+
static void rua_mark(struct rua *p) {
|
132
|
+
rb_gc_mark(p->R->rua);
|
133
|
+
rb_gc_mark(p->R->error_handler);
|
127
134
|
}
|
128
135
|
|
129
136
|
static void rua_free(struct rua *p) {
|
@@ -146,8 +153,9 @@ static VALUE rua_initialize(int argc, VALUE *argv, VALUE self) {
|
|
146
153
|
|
147
154
|
Data_Get_Struct(self, struct rua, p);
|
148
155
|
p->L = lua_open();
|
149
|
-
p->R->
|
156
|
+
p->R->rua = self;
|
150
157
|
p->R->error_handler = Qnil;
|
158
|
+
p->R->secure = 1;
|
151
159
|
|
152
160
|
if (argc > 0) {
|
153
161
|
rua_openlibs(argc, argv, self);
|
@@ -293,7 +301,7 @@ static VALUE rua_set_secure(VALUE self, VALUE secure) {
|
|
293
301
|
|
294
302
|
|
295
303
|
/*
|
296
|
-
* get error handler
|
304
|
+
* get error handler.
|
297
305
|
*/
|
298
306
|
static VALUE rua_get_error_handler(VALUE self) {
|
299
307
|
struct rua *p;
|
@@ -303,7 +311,7 @@ static VALUE rua_get_error_handler(VALUE self) {
|
|
303
311
|
}
|
304
312
|
|
305
313
|
/*
|
306
|
-
* set error handler
|
314
|
+
* set error handler.
|
307
315
|
*/
|
308
316
|
static VALUE rua_set_error_handler(VALUE self, VALUE error_handler) {
|
309
317
|
struct rua *p;
|
@@ -347,7 +355,12 @@ static VALUE rua_method_missing(int argc, VALUE *argv, VALUE self) {
|
|
347
355
|
static VALUE rua_func_alloc(VALUE klass) {
|
348
356
|
struct rua_ref *p = ALLOC(struct rua_ref);
|
349
357
|
|
350
|
-
return Data_Wrap_Struct(klass,
|
358
|
+
return Data_Wrap_Struct(klass, rua_func_mark, -1, p);
|
359
|
+
}
|
360
|
+
|
361
|
+
static void rua_func_mark(struct rua_ref *p) {
|
362
|
+
rb_gc_mark(p->R->rua);
|
363
|
+
rb_gc_mark(p->R->error_handler);
|
351
364
|
}
|
352
365
|
|
353
366
|
/*
|
@@ -399,7 +412,12 @@ static VALUE rua_func_call(int argc, VALUE *argv, VALUE self) {
|
|
399
412
|
static VALUE rua_thread_alloc(VALUE klass) {
|
400
413
|
struct rua_ref *p = ALLOC(struct rua_ref);
|
401
414
|
|
402
|
-
return Data_Wrap_Struct(klass,
|
415
|
+
return Data_Wrap_Struct(klass, rua_thread_mark, -1, p);
|
416
|
+
}
|
417
|
+
|
418
|
+
static void rua_thread_mark(struct rua_ref *p) {
|
419
|
+
rb_gc_mark(p->R->rua);
|
420
|
+
rb_gc_mark(p->R->error_handler);
|
403
421
|
}
|
404
422
|
|
405
423
|
/*
|
data/ext/rua.h
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
#define __RUA_H__
|
3
3
|
|
4
4
|
struct rua_state {
|
5
|
+
VALUE rua;
|
5
6
|
VALUE error_handler;
|
6
7
|
int secure;
|
7
8
|
};
|
@@ -19,6 +20,7 @@ struct rua_ref {
|
|
19
20
|
|
20
21
|
void Init_rua();
|
21
22
|
static VALUE rua_alloc(VALUE klass);
|
23
|
+
static void rua_mark(struct rua *p);
|
22
24
|
static void rua_free(struct rua *p);
|
23
25
|
static VALUE rua_initialize(int argc, VALUE *argv, VALUE self);
|
24
26
|
static VALUE rua_openlibs(int argc, VALUE *argv, VALUE self);
|
@@ -32,12 +34,14 @@ static VALUE rua_set_error_handler(VALUE self, VALUE error_handler);
|
|
32
34
|
static VALUE rua_method_missing(int argc, VALUE *argv, VALUE self);
|
33
35
|
|
34
36
|
static VALUE rua_func_alloc(VALUE klass);
|
37
|
+
static void rua_func_mark(struct rua_ref *p);
|
35
38
|
static VALUE rua_func_initialize(VALUE self);
|
36
39
|
static VALUE rua_func_call(int argc, VALUE *argv, VALUE self);
|
37
40
|
//static VALUE rua_func_get(VALUE self, VALUE key);
|
38
41
|
//static VALUE rua_func_set(VALUE self, VALUE key, VALUE val);
|
39
42
|
|
40
43
|
static VALUE rua_thread_alloc(VALUE klass);
|
44
|
+
static void rua_thread_mark(struct rua_ref *p);
|
41
45
|
static VALUE rua_thread_initialize(VALUE self);
|
42
46
|
static VALUE rua_thread_resume(int argc, VALUE *argv, VALUE self);
|
43
47
|
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.2
|
3
3
|
specification_version: 1
|
4
4
|
name: rua
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.2.
|
7
|
-
date: 2007-11-
|
6
|
+
version: 0.2.3
|
7
|
+
date: 2007-11-20 00:00:00 +09:00
|
8
8
|
summary: Rua is a library for using Lua under Ruby.
|
9
9
|
require_paths:
|
10
10
|
- lib
|