rsruby 0.4.4 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -108,11 +108,11 @@ SEXP ruby_to_R(VALUE obj)
108
108
  }
109
109
 
110
110
  /* Make a R list or vector from a Ruby array */
111
- static SEXP array_to_R(VALUE obj)
111
+ SEXP array_to_R(VALUE obj)
112
112
  {
113
113
  VALUE it;
114
114
  SEXP robj, rit;
115
- int i, len, state;
115
+ int i, state;
116
116
 
117
117
  /* This matrix defines what mode a vector should take given what
118
118
  it already contains and a new item
@@ -187,19 +187,12 @@ exception:
187
187
  }
188
188
 
189
189
  /* Make a R named list or vector from a Ruby Hash */
190
- static SEXP
190
+ SEXP
191
191
  hash_to_R(VALUE obj)
192
192
  {
193
- int len;
194
193
  VALUE keys, values;
195
194
  SEXP robj, names;
196
195
 
197
- //TODO - Baffling. Not sure what's wrong with these functions?
198
- //rb_hash_keys(proc_table);
199
- //rb_hash_values(proc_table);
200
- //rb_hash_size(proc_table);
201
- //compiles, but complains they are undefined symbols when run...
202
-
203
196
  if (FIX2INT(rb_funcall(obj,rb_intern("size"),0)) == 0)
204
197
  return R_NilValue;
205
198
 
@@ -224,7 +217,7 @@ hash_to_R(VALUE obj)
224
217
  return NULL;
225
218
  }
226
219
 
227
- static int
220
+ int
228
221
  type_to_int(VALUE obj)
229
222
  {
230
223
  if (obj == Qtrue || obj == Qfalse)
@@ -253,8 +246,6 @@ VALUE to_ruby_with_mode(SEXP robj, int mode)
253
246
  VALUE obj;
254
247
  int i;
255
248
 
256
- int old_mode = mode;
257
-
258
249
  switch (mode)
259
250
  {
260
251
  case PROC_CONVERSION:
@@ -428,7 +419,7 @@ from_proc_table(SEXP robj, VALUE *fun)
428
419
  {
429
420
  VALUE proc_table, procs, proc, funs, res, obj, mode;
430
421
  VALUE args[2];
431
- int i, l, error, exception;
422
+ int i, l, error;
432
423
 
433
424
  proc_table = rb_cvar_get(rb_const_get(rb_cObject,
434
425
  rb_intern("RSRuby")),
@@ -436,11 +427,6 @@ from_proc_table(SEXP robj, VALUE *fun)
436
427
 
437
428
  proc = Qnil;
438
429
 
439
- //TODO - Baffling. Not sure what's wrong with these functions?
440
- //procs = rb_hash_keys(proc_table);
441
- //funs = rb_hash_values(proc_table);
442
- //l = FIX2INT(rb_hash_size(proc_table));
443
-
444
430
  procs = rb_funcall(proc_table,rb_intern("keys"),0);
445
431
  funs = rb_funcall(proc_table,rb_intern("values"),0);
446
432
  l = FIX2INT(rb_funcall(proc_table,rb_intern("size"),0));
@@ -609,7 +595,7 @@ to_ruby_class(SEXP robj, VALUE *obj)
609
595
  }
610
596
 
611
597
  /* Convert a R named vector or list to a Ruby Hash */
612
- static VALUE to_ruby_hash(VALUE obj, SEXP names)
598
+ VALUE to_ruby_hash(VALUE obj, SEXP names)
613
599
  {
614
600
  int len, i;
615
601
  VALUE it, hash;
@@ -630,7 +616,7 @@ static VALUE to_ruby_hash(VALUE obj, SEXP names)
630
616
 
631
617
  /* We need to transpose the list because R makes array by the
632
618
  * fastest index */
633
- static VALUE ltranspose(VALUE list, int *dims, int *strides,
619
+ VALUE ltranspose(VALUE list, int *dims, int *strides,
634
620
  int pos, int shift, int len)
635
621
  {
636
622
  VALUE nl, it;
@@ -660,7 +646,7 @@ static VALUE ltranspose(VALUE list, int *dims, int *strides,
660
646
 
661
647
  /* Convert a R Array to a Ruby Array (in the form of
662
648
  * array of arrays of ...) */
663
- static VALUE to_ruby_array(VALUE obj, int *dims, int l)
649
+ VALUE to_ruby_array(VALUE obj, int *dims, int l)
664
650
  {
665
651
  VALUE list;
666
652
  int i, c, *strides;
@@ -37,9 +37,9 @@
37
37
  //Converters for Ruby to R
38
38
  SEXP ruby_to_R(VALUE val);
39
39
 
40
- static SEXP array_to_R(VALUE obj);
41
- static SEXP hash_to_R(VALUE obj);
42
- static int type_to_int(VALUE obj);
40
+ SEXP array_to_R(VALUE obj);
41
+ SEXP hash_to_R(VALUE obj);
42
+ int type_to_int(VALUE obj);
43
43
 
44
44
  //Converters for R to Ruby
45
45
  VALUE to_ruby_with_mode(SEXP robj, int mode);
@@ -54,10 +54,10 @@ VALUE from_class_table(SEXP robj);
54
54
  VALUE call_proc(VALUE data);
55
55
  VALUE reset_mode(VALUE mode);
56
56
 
57
- static VALUE to_ruby_hash(VALUE obj, SEXP names);
58
- static VALUE to_ruby_array(VALUE obj, int *dims, int l);
57
+ VALUE to_ruby_hash(VALUE obj, SEXP names);
58
+ VALUE to_ruby_array(VALUE obj, int *dims, int l);
59
59
 
60
- static VALUE ltranspose(VALUE list, int *dims, int *strides,
60
+ VALUE ltranspose(VALUE list, int *dims, int *strides,
61
61
  int pos, int shift, int len);
62
62
 
63
63
  //Macros for quick checks
@@ -35,7 +35,7 @@
35
35
  /* This is inspired in $R_SRC/src/main/memory.c */
36
36
  static SEXP R_References;
37
37
 
38
- static SEXP
38
+ SEXP
39
39
  RecursiveRelease(SEXP obj, SEXP list)
40
40
  {
41
41
  if (!isNull(list)) {
@@ -48,7 +48,7 @@ RecursiveRelease(SEXP obj, SEXP list)
48
48
  }
49
49
 
50
50
  /* TODO: This needs implementing as a Ruby destructor for each RObj */
51
- static void
51
+ void
52
52
  Robj_dealloc(VALUE self)
53
53
  {
54
54
  /* Remove the object from the list of protected objects */
@@ -73,7 +73,7 @@ VALUE get_fun(VALUE self, VALUE name){
73
73
  int conversion=TOP_MODE;
74
74
  SEXP robj;
75
75
  VALUE rubyobj;
76
- VALUE params[2];
76
+ //VALUE params[2];
77
77
  char* cstr_name;
78
78
 
79
79
  str = StringValue(name);
@@ -144,10 +144,9 @@ VALUE rr_init(VALUE self){
144
144
  */
145
145
  void init_R(int argc, char **argv){
146
146
 
147
- int defaultArgc = 2;
148
147
  char *defaultArgv[] = {"rsruby","-q","--vanilla"};
149
148
 
150
- Rf_initEmbeddedR(defaultArgc, defaultArgv);
149
+ Rf_initEmbeddedR(sizeof(defaultArgv) / sizeof(defaultArgv[0]), defaultArgv);
151
150
  }
152
151
 
153
152
  /* Ruby code */
@@ -61,14 +61,15 @@ extern void CleanEd(void);
61
61
  extern int R_CollectWarnings;
62
62
  # define PrintWarnings Rf_PrintWarnings
63
63
  extern void PrintWarnings(void);
64
+ extern void Rf_initEmbeddedR(int argc, char **argv);
64
65
 
65
66
  void Init_rsruby();
66
67
 
67
68
  void init_R(int argc, char *argv[0]);
68
69
  void r_finalize(void);
69
70
 
70
- static SEXP RecursiveRelease(SEXP obj, SEXP list);
71
- static void Robj_dealloc(VALUE self);
71
+ SEXP RecursiveRelease(SEXP obj, SEXP list);
72
+ void Robj_dealloc(VALUE self);
72
73
 
73
74
  VALUE shutdown(VALUE self);
74
75
  VALUE get_fun(VALUE self, VALUE name);
@@ -76,5 +77,6 @@ VALUE rr_init(VALUE self);
76
77
 
77
78
  VALUE RObj_lcall(VALUE self, VALUE args);
78
79
  VALUE RObj_to_ruby(VALUE self, VALUE args);
80
+ int make_argl(VALUE args, SEXP *e);
79
81
 
80
82
  #endif
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: rsruby
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.4.4
7
- date: 2007-02-22 00:00:00 +09:00
6
+ version: 0.4.5
7
+ date: 2007-08-10 00:00:00 +09:00
8
8
  summary: RSRuby is a bridge library for Ruby giving Ruby developers access to the full R statistical programming environment. RSRuby embeds a full R interpreter inside the running Ruby script, allowing R methods to be called and data passed between the Ruby script and the R interpreter. Most data conversion is handled automatically, but user-definable conversion routines can also be written to handle any R or Ruby class.
9
9
  require_paths:
10
10
  - lib
@@ -69,10 +69,20 @@ files:
69
69
  - test/test_all.rb
70
70
  test_files:
71
71
  - test/test_all.rb
72
- rdoc_options: []
73
-
74
- extra_rdoc_files: []
75
-
72
+ rdoc_options:
73
+ - --exclude
74
+ - test/*
75
+ - --main
76
+ - README.txt
77
+ - --inline-source
78
+ extra_rdoc_files:
79
+ - README.txt
80
+ - History.txt
81
+ - License.txt
82
+ - examples/arrayfields.rb
83
+ - examples/bioc.rb
84
+ - examples/dataframe.rb
85
+ - examples/erobj.rb
76
86
  executables: []
77
87
 
78
88
  extensions: