jl4rb 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/ext/jl4rb/jl4rb.c +15 -11
  3. data/jl4rb.gemspec +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cee2b9429514424e01c99dcec41acf6066b5c399937723649159f411e714abfb
4
- data.tar.gz: 623f3df43750d4f369cd9b221f4d68df83e6d87739d98b48136479e532ecece1
3
+ metadata.gz: 2f7cae52ad265d312103b5315bfd6280f2eba84b7745890046d0b5fcd2ae839f
4
+ data.tar.gz: 60e322b9e4f36c971156a754750b9b0de176a71556f437e4c2d28fbb30d51108
5
5
  SHA512:
6
- metadata.gz: a440ce035beee6f21b263870cc3292fcc7ac54dd36778c743cdd30086d6952b1aae36e91bc1380734e63186bd90a81c6509115206292ca0111f79ed4a6d00215
7
- data.tar.gz: cc61b73afa390b9b189f0454b73de020c9614c7bdd382c01ea6d218f1ddca10f47b5b1c3a41b09789847d41978476ca7be515e526c408e0041b98c9180c57c64
6
+ metadata.gz: aa638b61bf3d4cb80caa430299c7add73f039b55e93c8ebd55bb4d00de4dfdf71bda3b3d08e20b971ba71bb7e7d0958bdb4266ed23b171071ef685f6342e6697
7
+ data.tar.gz: 77cc18725d48204aafcd6fea6b8a0b460c5f8e74eb0de206b2e659bcf4f936b6e1a91e98b5ba87e5cc10bc980a3bc54bd426b976cb6093a03b76b7bb4f4f206f
@@ -278,7 +278,7 @@ VALUE util_jl_value_to_VALUE(jl_value_t *ans)
278
278
  //-| Todo: when not a vector, avoid transform to vector first.
279
279
  jl_value_t* util_VALUE_to_jl_value(VALUE arr)
280
280
  {
281
- jl_value_t *ans,*elt;
281
+ jl_value_t *ans,*elt,*array_type;
282
282
  VALUE res,class,tmp;
283
283
  int i,n=0,vect=1;
284
284
 
@@ -293,39 +293,43 @@ jl_value_t* util_VALUE_to_jl_value(VALUE arr)
293
293
  }
294
294
 
295
295
  class=rb_class_of(rb_ary_entry(arr,0));
296
- ans=jl_alloc_cell_1d(n);
296
+
297
297
  if(class==rb_cFloat) {
298
298
  //-| This is maybe faster and can be developped in julia-api as jl_vector_float64(n) for example.
299
- //ans=jl_alloc_array_1d(jl_float64_type,n);
299
+ array_type=jl_apply_array_type((jl_value_t*)jl_float64_type, 1);
300
+ ans=(jl_value_t*)jl_alloc_array_1d(array_type,n);
300
301
  for(i=0;i<n;i++) {
301
302
  elt=jl_box_float64(NUM2DBL(rb_ary_entry(arr,i)));
302
- jl_arrayset(ans,elt,i);
303
+ jl_arrayset((jl_array_t*)ans,elt,i);
303
304
  }
304
305
  #if RUBY_API_VERSION_CODE >= 20400
305
306
  } else if(class==rb_cInteger) {
306
307
  #else
307
308
  } else if(class==rb_cFixnum || class==rb_cBignum) {
308
309
  #endif
309
- //ans=jl_alloc_array_1d(jl_long_type,n);
310
+ array_type=jl_apply_array_type((jl_value_t*)jl_long_type, 1);
311
+ ans=(jl_value_t*)jl_alloc_array_1d(array_type,n);
310
312
  for(i=0;i<n;i++) {
311
313
  elt=jl_box_long(NUM2INT(rb_ary_entry(arr,i)));
312
- jl_arrayset(ans,elt,i);
314
+ jl_arrayset((jl_array_t*)ans,elt,i);
313
315
  }
314
316
  } else if(class==rb_cTrueClass || class==rb_cFalseClass) {
315
- //ans=jl_alloc_array_1d(jl_bool_type,n);
317
+ array_type=jl_apply_array_type((jl_value_t*)jl_bool_type, 1);
318
+ ans=(jl_value_t*)jl_alloc_array_1d(array_type,n);
316
319
  for(i=0;i<n;i++) {
317
320
  elt=jl_box_bool(rb_class_of(rb_ary_entry(arr,i))==rb_cFalseClass ? 0 : 1);
318
- jl_arrayset(ans,elt,i);
321
+ jl_arrayset((jl_array_t*)ans,elt,i);
319
322
  }
320
323
  } else if(class==rb_cString) {
321
- //ans=jl_alloc_array_1d(jl_utf8_string_type,n);
324
+ array_type=jl_apply_array_type((jl_value_t*)jl_string_type, 1);
325
+ ans=(jl_value_t*)jl_alloc_array_1d(array_type,n);
322
326
  for(i=0;i<n;i++) {
323
327
  tmp=rb_ary_entry(arr,i);
324
328
  elt=jl_cstr_to_string(StringValuePtr(tmp));
325
- jl_arrayset(ans,elt,i);
329
+ jl_arrayset((jl_array_t*)ans,elt,i);
326
330
  }
327
331
  } else ans=NULL;
328
- if(!vect && ans) ans=jl_arrayref(ans,0);
332
+ if(!vect && ans) ans=jl_arrayref((jl_array_t*)ans,0);
329
333
  return ans;
330
334
  }
331
335
 
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rubygems/package_task'
3
3
 
4
4
  PKG_NAME='jl4rb'
5
- PKG_VERSION='0.2.2'
5
+ PKG_VERSION='0.2.3'
6
6
  PKG_FILES=FileList[
7
7
  'Rakefile','jl4rb.gemspec',
8
8
  'ext/jl4rb/*.c',
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jl4rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - CQLS