rua 0.3.7-mswin32 → 0.3.9-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/README.txt +5 -0
 - data/ext/rua.c +40 -4
 - data/lib/i386-mswin32/rua.so +0 -0
 - metadata +3 -3
 
    
        data/README.txt
    CHANGED
    
    | 
         @@ -27,6 +27,8 @@ http://storehouse.sakura.ne.jp/rua/ 
     | 
|
| 
       27 
27 
     | 
    
         
             
                class MyClass
         
     | 
| 
       28 
28 
     | 
    
         
             
                  def val=(v); @val = v; end
         
     | 
| 
       29 
29 
     | 
    
         
             
                  def val; @val; end
         
     | 
| 
      
 30 
     | 
    
         
            +
                  def [](k); "#{k}->#{@val}"; end
         
     | 
| 
      
 31 
     | 
    
         
            +
                  def []=(k, v); @val = "#{k}:#{v}"; end
         
     | 
| 
       30 
32 
     | 
    
         
             
                end
         
     | 
| 
       31 
33 
     | 
    
         | 
| 
       32 
34 
     | 
    
         
             
                rua = Rua.new(:all)
         
     | 
| 
         @@ -65,6 +67,9 @@ http://storehouse.sakura.ne.jp/rua/ 
     | 
|
| 
       65 
67 
     | 
    
         
             
                  my_obj = MyClass.new()
         
     | 
| 
       66 
68 
     | 
    
         
             
                  my_obj.val = 'my_obj.val'
         
     | 
| 
       67 
69 
     | 
    
         
             
                  print(my_obj.val())
         
     | 
| 
      
 70 
     | 
    
         
            +
                  print(my_obj['foo'])
         
     | 
| 
      
 71 
     | 
    
         
            +
                  my_obj['bar'] = 'zoo'
         
     | 
| 
      
 72 
     | 
    
         
            +
                  print(my_obj.val())
         
     | 
| 
       68 
73 
     | 
    
         | 
| 
       69 
74 
     | 
    
         
             
                  f = function()
         
     | 
| 
       70 
75 
     | 
    
         
             
                    print('f() called.')
         
     | 
    
        data/ext/rua.c
    CHANGED
    
    | 
         @@ -21,7 +21,7 @@ __declspec(dllexport) void Init_rua(void); 
     | 
|
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
            #include "rua.h"
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
            #define VERSION   "0.3. 
     | 
| 
      
 24 
     | 
    
         
            +
            #define VERSION   "0.3.9"
         
     | 
| 
       25 
25 
     | 
    
         
             
            #define REF_RBOBJ "self"
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
       27 
27 
     | 
    
         
             
            #define ICONV_JIS   "ISO-2022-JP"
         
     | 
| 
         @@ -87,6 +87,7 @@ static const char *insecure_methods[] = { 
     | 
|
| 
       87 
87 
     | 
    
         
             
            static const int insecure_method_num = sizeof(insecure_methods) / sizeof(char*);
         
     | 
| 
       88 
88 
     | 
    
         
             
            static VALUE Rua, RuaFunc, RuaThread, RuaError, RuaDebug;
         
     | 
| 
       89 
89 
     | 
    
         
             
            static VALUE s_all, s_base, s_package, s_string, s_table, s_math, s_io, s_debug;
         
     | 
| 
      
 90 
     | 
    
         
            +
            static VALUE m_method_unbound, m_methods_unbound;
         
     | 
| 
       90 
91 
     | 
    
         | 
| 
       91 
92 
     | 
    
         
             
            void Init_rua() {
         
     | 
| 
       92 
93 
     | 
    
         
             
              Rua = rb_define_class("Rua", rb_cObject);
         
     | 
| 
         @@ -118,6 +119,11 @@ void Init_rua() { 
     | 
|
| 
       118 
119 
     | 
    
         
             
              rb_define_method(Rua, "error_handler=", rua_set_error_handler, 1);
         
     | 
| 
       119 
120 
     | 
    
         
             
              rb_define_method(Rua, "method_missing", rua_method_missing, -1);
         
     | 
| 
       120 
121 
     | 
    
         | 
| 
      
 122 
     | 
    
         
            +
              m_method_unbound = rb_funcall(rb_cObject, rb_intern("instance_method"), 1, ID2SYM(rb_intern("method")));
         
     | 
| 
      
 123 
     | 
    
         
            +
              m_methods_unbound = rb_funcall(rb_cObject, rb_intern("instance_method"), 1, ID2SYM(rb_intern("methods")));
         
     | 
| 
      
 124 
     | 
    
         
            +
              rb_define_class_variable(Rua, "@@m_method_unbound", m_method_unbound);
         
     | 
| 
      
 125 
     | 
    
         
            +
              rb_define_class_variable(Rua, "@@m_methods_unbound", m_methods_unbound);
         
     | 
| 
      
 126 
     | 
    
         
            +
             
     | 
| 
       121 
127 
     | 
    
         
             
              rb_define_alloc_func(RuaFunc, rua_ref_alloc);
         
     | 
| 
       122 
128 
     | 
    
         
             
              rb_define_private_method(RuaFunc, "initialize", rua_func_initialize, 0);
         
     | 
| 
       123 
129 
     | 
    
         
             
              rb_define_method(RuaFunc, "call", rua_func_call, -1);
         
     | 
| 
         @@ -1022,13 +1028,17 @@ static void rua_newtable_from_hash(lua_State *L, VALUE hash, struct rua_state *R 
     | 
|
| 
       1022 
1028 
     | 
    
         | 
| 
       1023 
1029 
     | 
    
         
             
            static void rua_newtable_from_obj(lua_State *L, VALUE obj, struct rua_state *R) {
         
     | 
| 
       1024 
1030 
     | 
    
         
             
              VALUE methods, name, method;
         
     | 
| 
      
 1031 
     | 
    
         
            +
              VALUE m_method_bound, m_methods_bound;
         
     | 
| 
       1025 
1032 
     | 
    
         
             
              int i, tblidx, prxidx;
         
     | 
| 
       1026 
1033 
     | 
    
         | 
| 
       1027 
1034 
     | 
    
         
             
              lua_newtable(L);
         
     | 
| 
       1028 
1035 
     | 
    
         
             
              prxidx = lua_gettop(L);
         
     | 
| 
       1029 
1036 
     | 
    
         
             
              lua_newtable(L);
         
     | 
| 
       1030 
1037 
     | 
    
         
             
              tblidx = lua_gettop(L);
         
     | 
| 
       1031 
     | 
    
         
            -
             
     | 
| 
      
 1038 
     | 
    
         
            +
             
     | 
| 
      
 1039 
     | 
    
         
            +
              m_method_bound = rb_funcall(m_method_unbound, rb_intern("bind"), 1, obj);
         
     | 
| 
      
 1040 
     | 
    
         
            +
              m_methods_bound = rb_funcall(m_methods_unbound, rb_intern("bind"), 1, obj);
         
     | 
| 
      
 1041 
     | 
    
         
            +
              methods = rb_check_convert_type(m_methods_bound, T_ARRAY, "Array", "call");
         
     | 
| 
       1032 
1042 
     | 
    
         | 
| 
       1033 
1043 
     | 
    
         
             
              lua_pushstring(L, REF_RBOBJ);
         
     | 
| 
       1034 
1044 
     | 
    
         
             
              lua_pushlightuserdata(L, (void *) obj);
         
     | 
| 
         @@ -1038,7 +1048,7 @@ static void rua_newtable_from_obj(lua_State *L, VALUE obj, struct rua_state *R) 
     | 
|
| 
       1038 
1048 
     | 
    
         | 
| 
       1039 
1049 
     | 
    
         
             
              for (i = 0; i < RARRAY(methods)->len; i++) {
         
     | 
| 
       1040 
1050 
     | 
    
         
             
                name = rb_ary_entry(methods, i);
         
     | 
| 
       1041 
     | 
    
         
            -
                method = rb_funcall( 
     | 
| 
      
 1051 
     | 
    
         
            +
                method = rb_funcall(m_method_bound, rb_intern("call"), 1, name);
         
     | 
| 
       1042 
1052 
     | 
    
         
             
                rb_hash_aset(R->refs, method, Qtrue);
         
     | 
| 
       1043 
1053 
     | 
    
         | 
| 
       1044 
1054 
     | 
    
         
             
                if (R->secure && rua_name_is_insecure_method(StringValuePtr(name))) {
         
     | 
| 
         @@ -1059,7 +1069,23 @@ static int rua_getobject_event(lua_State *L) { 
     | 
|
| 
       1059 
1069 
     | 
    
         
             
              int tblidx;
         
     | 
| 
       1060 
1070 
     | 
    
         | 
| 
       1061 
1071 
     | 
    
         
             
              tblidx = lua_upvalueindex(1);
         
     | 
| 
      
 1072 
     | 
    
         
            +
              lua_pushvalue(L, -1);
         
     | 
| 
       1062 
1073 
     | 
    
         
             
              lua_rawget(L, tblidx);
         
     | 
| 
      
 1074 
     | 
    
         
            +
             
     | 
| 
      
 1075 
     | 
    
         
            +
              if (lua_isnil(L, -1)) {
         
     | 
| 
      
 1076 
     | 
    
         
            +
                lua_pop(L, 1);
         
     | 
| 
      
 1077 
     | 
    
         
            +
                lua_pushstring(L, "[]");
         
     | 
| 
      
 1078 
     | 
    
         
            +
                lua_rawget(L, tblidx);
         
     | 
| 
      
 1079 
     | 
    
         
            +
             
     | 
| 
      
 1080 
     | 
    
         
            +
                if (lua_isfunction(L, -1)) {
         
     | 
| 
      
 1081 
     | 
    
         
            +
                  lua_pushvalue(L, -2);
         
     | 
| 
      
 1082 
     | 
    
         
            +
                  lua_call(L, 1, 1);
         
     | 
| 
      
 1083 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 1084 
     | 
    
         
            +
                  lua_pop(L, 1);
         
     | 
| 
      
 1085 
     | 
    
         
            +
                  lua_pushnil(L);
         
     | 
| 
      
 1086 
     | 
    
         
            +
                }
         
     | 
| 
      
 1087 
     | 
    
         
            +
              }
         
     | 
| 
      
 1088 
     | 
    
         
            +
             
     | 
| 
       1063 
1089 
     | 
    
         
             
              return 1;
         
     | 
| 
       1064 
1090 
     | 
    
         
             
            }
         
     | 
| 
       1065 
1091 
     | 
    
         | 
| 
         @@ -1086,7 +1112,17 @@ static int rua_setobject_event(lua_State *L) { 
     | 
|
| 
       1086 
1112 
     | 
    
         
             
                lua_call(L, 1, 0);
         
     | 
| 
       1087 
1113 
     | 
    
         
             
              } else {
         
     | 
| 
       1088 
1114 
     | 
    
         
             
                lua_pop(L, 1);
         
     | 
| 
       1089 
     | 
    
         
            -
                 
     | 
| 
      
 1115 
     | 
    
         
            +
                lua_pushstring(L, "[]=");
         
     | 
| 
      
 1116 
     | 
    
         
            +
                lua_rawget(L, tblidx);
         
     | 
| 
      
 1117 
     | 
    
         
            +
             
     | 
| 
      
 1118 
     | 
    
         
            +
                if (lua_isfunction(L, -1)) {
         
     | 
| 
      
 1119 
     | 
    
         
            +
                  lua_pushvalue(L, -3);
         
     | 
| 
      
 1120 
     | 
    
         
            +
                  lua_pushvalue(L, -3);
         
     | 
| 
      
 1121 
     | 
    
         
            +
                  lua_call(L, 2, 0);
         
     | 
| 
      
 1122 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 1123 
     | 
    
         
            +
                  lua_pop(L, 1);
         
     | 
| 
      
 1124 
     | 
    
         
            +
                  lua_rawset(L, tblidx);
         
     | 
| 
      
 1125 
     | 
    
         
            +
                }
         
     | 
| 
       1090 
1126 
     | 
    
         
             
              }
         
     | 
| 
       1091 
1127 
     | 
    
         | 
| 
       1092 
1128 
     | 
    
         
             
              return 0;
         
     | 
    
        data/lib/i386-mswin32/rua.so
    CHANGED
    
    | 
         Binary file 
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: rua
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.3.9
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: mswin32
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors: 
         
     | 
| 
       7 
7 
     | 
    
         
             
            - winebarrel
         
     | 
| 
         @@ -9,7 +9,7 @@ autorequire: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
            date: 2007-12- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2007-12-28 00:00:00 +09:00
         
     | 
| 
       13 
13 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
         @@ -49,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       49 
49 
     | 
    
         
             
            requirements: []
         
     | 
| 
       50 
50 
     | 
    
         | 
| 
       51 
51 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       52 
     | 
    
         
            -
            rubygems_version: 0. 
     | 
| 
      
 52 
     | 
    
         
            +
            rubygems_version: 1.0.1
         
     | 
| 
       53 
53 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       54 
54 
     | 
    
         
             
            specification_version: 2
         
     | 
| 
       55 
55 
     | 
    
         
             
            summary: Rua is a library for using Lua under Ruby.
         
     |