jl4rb 0.2.2 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/jl4rb/extconf.rb +10 -8
- data/ext/jl4rb/jl4rb.c +25 -17
- data/jl4rb.gemspec +1 -1
- data/lib/jl4rb.rb +1 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8b8aade7e2cc0fc2991e6352b94f47a56c7683f818373036afe32b83bb52e28
|
4
|
+
data.tar.gz: 781b45f9522acb27f4422e7f6f1cc6879dda966b7f5fee0cd505d21891fd0e2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: daabc722567025b44d986a6f033b1de3ccd31dc16059b889b987eb6fa272d752a6b258eccbb5ce484110e06c2692522c7a7a6c68950da7590eed0bc49dd349e2
|
7
|
+
data.tar.gz: a4e322987a2d7f31c9bbb29353aecd0d5acdcda4ceaf11c7170b2aee892f3ec8e39d0265d93ffe345bd047d7c4cc754d3125cdfe43d71b880e401f8bf524314f
|
data/ext/jl4rb/extconf.rb
CHANGED
@@ -15,19 +15,21 @@ end
|
|
15
15
|
def jl4rb_makefile(incs,libs)
|
16
16
|
|
17
17
|
jl_share=`julia -e 'print(joinpath(Sys.BINDIR, Base.DATAROOTDIR, "julia"))'`
|
18
|
-
$CFLAGS =`julia #{jl_share}/julia-config.jl --cflags`.strip
|
18
|
+
$CFLAGS =`julia #{jl_share}/julia-config.jl --cflags`.strip + " -fdeclspec"
|
19
19
|
$LDFLAGS =`julia #{jl_share}/julia-config.jl --ldflags`.strip
|
20
|
-
$
|
20
|
+
$LIBS = `julia #{jl_share}/julia-config.jl --ldlibs`.strip
|
21
21
|
|
22
|
+
puts [$CFLAGS, $LDFLAGS, $LIBS]
|
22
23
|
|
23
24
|
header = nil
|
24
25
|
|
25
|
-
|
26
|
-
$objs = [
|
26
|
+
jl4r_name="jl4rb"
|
27
|
+
$objs = [jl4r_name+".o"]
|
27
28
|
|
28
|
-
dir_config("
|
29
|
-
|
30
|
-
|
29
|
+
dir_config("jl4rb")
|
30
|
+
#
|
31
|
+
p ( {:CFLAGS => $CFLAGS, :LDFLAGS => $LDFLAGS, :LIBS => $LIBS })
|
32
|
+
create_makefile(jl4r_name)
|
31
33
|
end
|
32
|
-
|
34
|
+
#p [$prefix_include,$prefix_lib]
|
33
35
|
jl4rb_makefile($prefix_include,$prefix_lib)
|
data/ext/jl4rb/jl4rb.c
CHANGED
@@ -4,7 +4,6 @@
|
|
4
4
|
|
5
5
|
**********************************************************************/
|
6
6
|
|
7
|
-
#include "julia.h"
|
8
7
|
#include <stdio.h>
|
9
8
|
#include <string.h>
|
10
9
|
#include <math.h>
|
@@ -17,23 +16,28 @@
|
|
17
16
|
//#endif
|
18
17
|
|
19
18
|
//-| next macros already exist in ruby and are undefined here
|
20
|
-
//#undef T_FLOAT
|
21
19
|
#undef NORETURN
|
22
20
|
#include "ruby.h"
|
23
21
|
#include "ruby/version.h"
|
22
|
+
#undef T_FLOAT
|
23
|
+
#undef NOINLINE
|
24
|
+
#include "julia.h"
|
24
25
|
|
25
26
|
#define length(a) jl_array_size(a,0)
|
26
27
|
|
27
28
|
/************* INIT *********************/
|
28
29
|
|
29
30
|
|
30
|
-
VALUE Julia_init()
|
31
|
+
VALUE Julia_init(VALUE obj)
|
31
32
|
{
|
32
|
-
jl_init();
|
33
|
+
//jl_init();
|
34
|
+
printf("%s %s\n", jl_get_libdir(), jl_get_default_sysimg_path());
|
35
|
+
jl_init(); //_with_image("/Applications/Julia-1.6.app/Contents/Resources/julia/bin", "../lib/sys.dylib");
|
36
|
+
printf("ok\n");
|
33
37
|
return Qtrue;
|
34
38
|
}
|
35
39
|
|
36
|
-
VALUE Julia_exit(VALUE exitcode) {
|
40
|
+
VALUE Julia_exit(VALUE obj, VALUE exitcode) {
|
37
41
|
jl_atexit_hook(exitcode);
|
38
42
|
return Qtrue;
|
39
43
|
}
|
@@ -278,7 +282,7 @@ VALUE util_jl_value_to_VALUE(jl_value_t *ans)
|
|
278
282
|
//-| Todo: when not a vector, avoid transform to vector first.
|
279
283
|
jl_value_t* util_VALUE_to_jl_value(VALUE arr)
|
280
284
|
{
|
281
|
-
jl_value_t *ans,*elt;
|
285
|
+
jl_value_t *ans,*elt,*array_type;
|
282
286
|
VALUE res,class,tmp;
|
283
287
|
int i,n=0,vect=1;
|
284
288
|
|
@@ -293,39 +297,43 @@ jl_value_t* util_VALUE_to_jl_value(VALUE arr)
|
|
293
297
|
}
|
294
298
|
|
295
299
|
class=rb_class_of(rb_ary_entry(arr,0));
|
296
|
-
|
300
|
+
|
297
301
|
if(class==rb_cFloat) {
|
298
302
|
//-| This is maybe faster and can be developped in julia-api as jl_vector_float64(n) for example.
|
299
|
-
|
303
|
+
array_type=jl_apply_array_type((jl_value_t*)jl_float64_type, 1);
|
304
|
+
ans=(jl_value_t*)jl_alloc_array_1d(array_type,n);
|
300
305
|
for(i=0;i<n;i++) {
|
301
306
|
elt=jl_box_float64(NUM2DBL(rb_ary_entry(arr,i)));
|
302
|
-
jl_arrayset(ans,elt,i);
|
307
|
+
jl_arrayset((jl_array_t*)ans,elt,i);
|
303
308
|
}
|
304
309
|
#if RUBY_API_VERSION_CODE >= 20400
|
305
310
|
} else if(class==rb_cInteger) {
|
306
311
|
#else
|
307
312
|
} else if(class==rb_cFixnum || class==rb_cBignum) {
|
308
313
|
#endif
|
309
|
-
|
314
|
+
array_type=jl_apply_array_type((jl_value_t*)jl_long_type, 1);
|
315
|
+
ans=(jl_value_t*)jl_alloc_array_1d(array_type,n);
|
310
316
|
for(i=0;i<n;i++) {
|
311
317
|
elt=jl_box_long(NUM2INT(rb_ary_entry(arr,i)));
|
312
|
-
jl_arrayset(ans,elt,i);
|
318
|
+
jl_arrayset((jl_array_t*)ans,elt,i);
|
313
319
|
}
|
314
320
|
} else if(class==rb_cTrueClass || class==rb_cFalseClass) {
|
315
|
-
|
321
|
+
array_type=jl_apply_array_type((jl_value_t*)jl_bool_type, 1);
|
322
|
+
ans=(jl_value_t*)jl_alloc_array_1d(array_type,n);
|
316
323
|
for(i=0;i<n;i++) {
|
317
324
|
elt=jl_box_bool(rb_class_of(rb_ary_entry(arr,i))==rb_cFalseClass ? 0 : 1);
|
318
|
-
jl_arrayset(ans,elt,i);
|
325
|
+
jl_arrayset((jl_array_t*)ans,elt,i);
|
319
326
|
}
|
320
327
|
} else if(class==rb_cString) {
|
321
|
-
|
328
|
+
array_type=jl_apply_array_type((jl_value_t*)jl_string_type, 1);
|
329
|
+
ans=(jl_value_t*)jl_alloc_array_1d(array_type,n);
|
322
330
|
for(i=0;i<n;i++) {
|
323
331
|
tmp=rb_ary_entry(arr,i);
|
324
332
|
elt=jl_cstr_to_string(StringValuePtr(tmp));
|
325
|
-
jl_arrayset(ans,elt,i);
|
333
|
+
jl_arrayset((jl_array_t*)ans,elt,i);
|
326
334
|
}
|
327
335
|
} else ans=NULL;
|
328
|
-
if(!vect && ans) ans=jl_arrayref(ans,0);
|
336
|
+
if(!vect && ans) ans=jl_arrayref((jl_array_t*)ans,0);
|
329
337
|
return ans;
|
330
338
|
}
|
331
339
|
|
@@ -502,7 +510,7 @@ Init_jl4rb()
|
|
502
510
|
mJulia = rb_define_module("Julia");
|
503
511
|
|
504
512
|
rb_define_module_function(mJulia, "initJL", Julia_init, 0);
|
505
|
-
|
513
|
+
|
506
514
|
rb_define_module_function(mJulia, "exitJL", Julia_exit, 1);
|
507
515
|
|
508
516
|
rb_define_module_function(mJulia, "evalLine", Julia_eval, 2);
|
data/jl4rb.gemspec
CHANGED
data/lib/jl4rb.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'jl4rb.bundle' if File.exists? File.join(File.dirname(__FILE__),'jl4rb.bundle')
|
2
2
|
require 'jl4rb.so' if File.exists? File.join(File.dirname(__FILE__),'jl4rb.so')
|
3
3
|
|
4
|
+
p [:dl, "jl4rb.DLL loaded" ]
|
4
5
|
# loading ruby files
|
5
6
|
require 'jl4rb/jl2rb_init'
|
6
7
|
require 'jl4rb/jl2rb_eval'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jl4rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CQLS
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'R is embedded in ruby with some communication support .
|
14
14
|
|
@@ -35,7 +35,7 @@ licenses:
|
|
35
35
|
- MIT
|
36
36
|
- GPL-2.0
|
37
37
|
metadata: {}
|
38
|
-
post_install_message:
|
38
|
+
post_install_message:
|
39
39
|
rdoc_options: []
|
40
40
|
require_paths:
|
41
41
|
- lib
|
@@ -52,8 +52,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
52
|
version: '0'
|
53
53
|
requirements:
|
54
54
|
- none
|
55
|
-
rubygems_version: 3.
|
56
|
-
signing_key:
|
55
|
+
rubygems_version: 3.3.7
|
56
|
+
signing_key:
|
57
57
|
specification_version: 4
|
58
58
|
summary: Julia for ruby
|
59
59
|
test_files: []
|