rua 0.2.4-mswin32 → 0.2.5-mswin32
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/ext/rua.c +21 -20
- data/lib/i386-mswin32/rua.so +0 -0
- metadata +2 -2
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.5"
|
20
20
|
#define REF_RBOBJ "self"
|
21
21
|
|
22
22
|
static const char *insecure_methods[] = {
|
@@ -97,13 +97,13 @@ void Init_rua() {
|
|
97
97
|
rb_define_method(Rua, "error_handler=", rua_set_error_handler, 1);
|
98
98
|
rb_define_method(Rua, "method_missing", rua_method_missing, -1);
|
99
99
|
|
100
|
-
rb_define_alloc_func(RuaFunc,
|
100
|
+
rb_define_alloc_func(RuaFunc, rua_ref_alloc);
|
101
101
|
rb_define_private_method(RuaFunc, "initialize", rua_func_initialize, 0);
|
102
102
|
rb_define_method(RuaFunc, "call", rua_func_call, -1);
|
103
103
|
//rb_define_method(RuaFunc, "[]", rua_func_get, 1);
|
104
104
|
//rb_define_method(RuaFunc, "[]=", rua_func_set, 2);
|
105
105
|
|
106
|
-
rb_define_alloc_func(RuaThread,
|
106
|
+
rb_define_alloc_func(RuaThread, rua_ref_alloc);
|
107
107
|
rb_define_private_method(RuaThread, "initialize", rua_thread_initialize, 0);
|
108
108
|
rb_define_method(RuaThread, "resume", rua_thread_resume, -1);
|
109
109
|
|
@@ -352,17 +352,29 @@ static VALUE rua_method_missing(int argc, VALUE *argv, VALUE self) {
|
|
352
352
|
|
353
353
|
// ------------------------------------------------------------------
|
354
354
|
|
355
|
-
static VALUE
|
355
|
+
static VALUE rua_ref_alloc(VALUE klass) {
|
356
356
|
struct rua_ref *p = ALLOC(struct rua_ref);
|
357
357
|
|
358
|
-
return Data_Wrap_Struct(klass,
|
358
|
+
return Data_Wrap_Struct(klass, rua_ref_mark, rua_ref_free, p);
|
359
359
|
}
|
360
360
|
|
361
|
-
static void
|
361
|
+
static void rua_ref_mark(struct rua_ref *p) {
|
362
362
|
rb_gc_mark(p->R->rua);
|
363
363
|
rb_gc_mark(p->R->error_handler);
|
364
364
|
}
|
365
365
|
|
366
|
+
static void rua_ref_free(struct rua_ref *p) {
|
367
|
+
luaL_unref(p->L, LUA_REGISTRYINDEX, p->ref);
|
368
|
+
|
369
|
+
if (p->R) {
|
370
|
+
free(p->R);
|
371
|
+
}
|
372
|
+
|
373
|
+
free(p);
|
374
|
+
}
|
375
|
+
|
376
|
+
// ------------------------------------------------------------------
|
377
|
+
|
366
378
|
/*
|
367
379
|
* new RuaFunc instance.
|
368
380
|
*/
|
@@ -409,17 +421,6 @@ static VALUE rua_func_call(int argc, VALUE *argv, VALUE self) {
|
|
409
421
|
|
410
422
|
// ------------------------------------------------------------------
|
411
423
|
|
412
|
-
static VALUE rua_thread_alloc(VALUE klass) {
|
413
|
-
struct rua_ref *p = ALLOC(struct rua_ref);
|
414
|
-
|
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);
|
421
|
-
}
|
422
|
-
|
423
424
|
/*
|
424
425
|
* new RuaThread instance.
|
425
426
|
*/
|
@@ -606,7 +607,7 @@ static void rua_pushrbval(lua_State *L, VALUE rbval, struct rua_state *R) {
|
|
606
607
|
|
607
608
|
default:
|
608
609
|
if (R->secure && (rb_equal(rb_cModule, rbval) || rb_equal(rb_cClass, rbval))) {
|
609
|
-
|
610
|
+
rb_warn("warning: convert insecure value %s", rua_to_sptr(rbval));
|
610
611
|
lua_pushnil(L);
|
611
612
|
} else if (rb_obj_is_kind_of(rbval, RuaFunc)) {
|
612
613
|
Data_Get_Struct(rbval, struct rua_ref, p);
|
@@ -698,7 +699,7 @@ static int rua_proc_call(lua_State *L) {
|
|
698
699
|
rb_ary_push(args, rua_torbval(L, i + 1, R));
|
699
700
|
}
|
700
701
|
|
701
|
-
last =
|
702
|
+
last = rb_ary_entry(args, -1);
|
702
703
|
rb_ary_push(args, proc);
|
703
704
|
|
704
705
|
if (rb_obj_is_kind_of(last, RuaFunc)) {
|
@@ -715,7 +716,7 @@ static int rua_proc_call(lua_State *L) {
|
|
715
716
|
retval = rb_protect(_rua_proc_call, errargs, &status);
|
716
717
|
|
717
718
|
if (status != 0) {
|
718
|
-
|
719
|
+
rb_warn("%s\n", rua_to_sptr(ruby_errinfo));
|
719
720
|
}
|
720
721
|
} else {
|
721
722
|
retval = Qnil;
|
data/lib/i386-mswin32/rua.so
CHANGED
Binary file
|
metadata
CHANGED
@@ -3,8 +3,8 @@ 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.5
|
7
|
+
date: 2007-11-23 00:00:00 +09:00
|
8
8
|
summary: Rua is a library for using Lua under Ruby.
|
9
9
|
require_paths:
|
10
10
|
- lib/i386-mswin32
|