rua 0.4.3-mswin32 → 0.4.4-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/ext/rua.c +30 -16
  2. data/lib/i386-mswin32/rua.so +0 -0
  3. metadata +3 -3
data/ext/rua.c CHANGED
@@ -1,7 +1,5 @@
1
1
  /* */
2
2
  #ifdef _WIN32
3
- #pragma warning(disable:4311)
4
- #pragma warning(disable:4312)
5
3
  __declspec(dllexport) void Init_rua(void);
6
4
  #endif
7
5
 
@@ -21,7 +19,23 @@ __declspec(dllexport) void Init_rua(void);
21
19
 
22
20
  #include "rua.h"
23
21
 
24
- #define VERSION "0.4.3"
22
+ #ifndef RSTRING_PTR
23
+ #define RSTRING_PTR(s) (RSTRING(s)->ptr)
24
+ #endif
25
+
26
+ #ifndef RSTRING_LEN
27
+ #define RSTRING_LEN(s) (RSTRING(s)->len)
28
+ #endif
29
+
30
+ #ifndef RARRAY_PTR
31
+ #define RARRAY_PTR(s) (RARRAY(s)->ptr)
32
+ #endif
33
+
34
+ #ifndef RARRAY_LEN
35
+ #define RARRAY_LEN(s) (RARRAY(s)->len)
36
+ #endif
37
+
38
+ #define VERSION "0.4.4"
25
39
  #define REF_RBOBJ "self"
26
40
 
27
41
  #define ICONV_JIS "ISO-2022-JP"
@@ -284,11 +298,11 @@ static VALUE rua_eval(VALUE self, VALUE str) {
284
298
  Data_Get_Struct(self, struct rua, p);
285
299
 
286
300
  if (!NIL_P(p->R->external_charset)) {
287
- str = rua_iconv(ICONV_UTF8, StringValuePtr(p->R->external_charset), str);
301
+ str = rua_iconv(ICONV_UTF8, RSTRING_PTR(p->R->external_charset), str);
288
302
  }
289
303
 
290
304
  pretop = lua_gettop(p->L);
291
- luaL_loadstring(p->L, StringValuePtr(str));
305
+ luaL_loadstring(p->L, RSTRING_PTR(str));
292
306
 
293
307
  if (lua_pcall(p->L, 0, LUA_MULTRET, 0) != 0) {
294
308
  if (lua_islightuserdata(p->L, -1)) {
@@ -858,7 +872,7 @@ static VALUE rua_torbval(lua_State *L, int idx, struct rua_state *R) {
858
872
  rbval = rb_str_new2(lua_tostring(L, idx));
859
873
 
860
874
  if (!NIL_P(R->external_charset)) {
861
- rbval = rua_iconv(StringValuePtr(R->external_charset), ICONV_UTF8, rbval);
875
+ rbval = rua_iconv(RSTRING_PTR(R->external_charset), ICONV_UTF8, rbval);
862
876
  }
863
877
 
864
878
  break;
@@ -949,10 +963,10 @@ static void rua_pushrbval(lua_State *L, VALUE rbval, struct rua_state *R) {
949
963
 
950
964
  case T_STRING:
951
965
  if (!NIL_P(R->external_charset)) {
952
- rbval = rua_iconv(ICONV_UTF8, StringValuePtr(R->external_charset), rbval);
966
+ rbval = rua_iconv(ICONV_UTF8, RSTRING_PTR(R->external_charset), rbval);
953
967
  }
954
968
 
955
- lua_pushstring(L, StringValuePtr(rbval));
969
+ lua_pushstring(L, RSTRING_PTR(rbval));
956
970
  break;
957
971
 
958
972
  case T_TRUE:
@@ -1001,7 +1015,7 @@ static void rua_newtable_from_ary(lua_State *L, VALUE ary, struct rua_state *R)
1001
1015
  lua_newtable(L);
1002
1016
  tblidx = lua_gettop(L);
1003
1017
 
1004
- for (i = 0; i < RARRAY(ary)->len; i++) {
1018
+ for (i = 0; i < RARRAY_LEN(ary); i++) {
1005
1019
  entry = rb_ary_entry(ary, i);
1006
1020
  lua_pushnumber(L, i + 1);
1007
1021
  rua_pushrbval(L, entry, R);
@@ -1017,7 +1031,7 @@ static void rua_newtable_from_hash(lua_State *L, VALUE hash, struct rua_state *R
1017
1031
  tblidx = lua_gettop(L);
1018
1032
  keys = rb_check_convert_type(hash, T_ARRAY, "Array", "keys");
1019
1033
 
1020
- for (i = 0; i < RARRAY(keys)->len; i++) {
1034
+ for (i = 0; i < RARRAY_LEN(keys); i++) {
1021
1035
  key = rb_ary_entry(keys, i);
1022
1036
  val = rb_hash_aref(hash, key);
1023
1037
  rua_pushrbval(L, key, R);
@@ -1046,12 +1060,12 @@ static void rua_newtable_from_obj(lua_State *L, VALUE obj, struct rua_state *R)
1046
1060
  lua_rawset(L, tblidx);
1047
1061
  rb_hash_aset(R->refs, obj, Qtrue);
1048
1062
 
1049
- for (i = 0; i < RARRAY(methods)->len; i++) {
1063
+ for (i = 0; i < RARRAY_LEN(methods); i++) {
1050
1064
  name = rb_ary_entry(methods, i);
1051
1065
  method = rb_funcall(m_method_bound, rb_intern("call"), 1, name);
1052
1066
  rb_hash_aset(R->refs, method, Qtrue);
1053
1067
 
1054
- if (R->secure && rua_name_is_insecure_method(StringValuePtr(name))) {
1068
+ if (R->secure && rua_name_is_insecure_method(RSTRING_PTR(name))) {
1055
1069
  continue;
1056
1070
  }
1057
1071
 
@@ -1190,7 +1204,7 @@ static VALUE _rua_proc_call(VALUE args) {
1190
1204
  VALUE proc;
1191
1205
 
1192
1206
  proc = rb_ary_pop(args);
1193
- return rb_funcall2(proc, rb_intern("call"), RARRAY(args)->len, RARRAY(args)->ptr);
1207
+ return rb_funcall2(proc, rb_intern("call"), RARRAY_LEN(args), RARRAY_PTR(args));
1194
1208
  }
1195
1209
 
1196
1210
 
@@ -1278,7 +1292,7 @@ static VALUE rua_to_s(VALUE v) {
1278
1292
  static const char *rua_to_sptr(VALUE v) {
1279
1293
  VALUE str = rua_to_s(v);
1280
1294
 
1281
- return StringValuePtr(str);
1295
+ return RSTRING_PTR(str);
1282
1296
  }
1283
1297
 
1284
1298
  static VALUE rua_classname(VALUE v) {
@@ -1290,7 +1304,7 @@ static VALUE rua_classname(VALUE v) {
1290
1304
  static const char *rua_classname_ptr(VALUE v) {
1291
1305
  VALUE klassname = rua_classname(v);
1292
1306
 
1293
- return StringValuePtr(klassname);
1307
+ return RSTRING_PTR(klassname);
1294
1308
  }
1295
1309
 
1296
1310
  static void rua_setmeta(lua_State *L, int idx, const char *key, lua_CFunction f, int n) {
@@ -1369,7 +1383,7 @@ static VALUE rua_iconv(const char *to, const char *from, VALUE in) {
1369
1383
  return Qnil;
1370
1384
  }
1371
1385
 
1372
- cin = StringValuePtr(in);
1386
+ cin = RSTRING_PTR(in);
1373
1387
  cin_len = strlen(cin);
1374
1388
  cout_len = cin_len * 3 + 1;
1375
1389
  cout = pcout = alloca(sizeof(char) * cout_len);
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.4.3
4
+ version: 0.4.4
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: 2008-04-05 00:00:00 +09:00
12
+ date: 2008-08-09 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: rua
52
- rubygems_version: 1.0.1
52
+ rubygems_version: 1.1.1
53
53
  signing_key:
54
54
  specification_version: 2
55
55
  summary: Rua is a library for using Lua under Ruby.