jl4rb 0.0.10 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/ext/jl4rb/extconf.rb +11 -8
- data/ext/jl4rb/jl4rb.c +18 -7
- data/jl4rb.gemspec +1 -1
- data/lib/jl4rb/jl2rb_init.rb +4 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2deb18c81ccd3f5a6392064cd109eebdd3d87280d78ac3a152e92b9668d6c2fe
|
4
|
+
data.tar.gz: 0c0818404e1d24520f7d598c16bb777b9e8d3173440be03bf63b141a02509169
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b152d43c269981d459c3182bb1860331d6ee998064cfbd3dc358f5bbaa7ce12fe88d3fae0ae2bf9de82a2d5c95ac467fb206b430bd8e9bb43ad07d3c475d055
|
7
|
+
data.tar.gz: 417e6fbafe4972a696860b9afa8a45defd190b84c67d1b5a6029d25db70c047f7c046aae7b33a40609aa25e1ec5da5b5fec9020f00369c5c731b2f6351260c1b
|
data/ext/jl4rb/extconf.rb
CHANGED
@@ -3,12 +3,12 @@ require 'fileutils' #if RUBY_VERSION < "1.9"
|
|
3
3
|
|
4
4
|
|
5
5
|
$prefix_include,$prefix_lib=[],[]
|
6
|
-
if RUBY_PLATFORM =~ /linux/
|
7
|
-
|
8
|
-
|
6
|
+
# if RUBY_PLATFORM =~ /linux/
|
7
|
+
# $prefix_include << "/usr/include/"+RUBY_PLATFORM+"/julia" if File.exists? "/usr/include/"+RUBY_PLATFORM+"/julia"
|
8
|
+
# $prefix_include << "/usr/include/julia" if File.exists? "/usr/include/julia"
|
9
9
|
|
10
|
-
|
11
|
-
else
|
10
|
+
# $prefix_lib << "/usr/lib/"+RUBY_PLATFORM+"/julia" if File.exists? "/usr/lib/"+RUBY_PLATFORM+"/julia"
|
11
|
+
# else
|
12
12
|
#$prefix=ENV["JLAPI_HOME"] || File.join(ENV["HOME"],".jlapi/julia") || ENV["JULIA_HOME"]
|
13
13
|
$prefix=ENV["JULIA_DIR"]
|
14
14
|
#p $prefix
|
@@ -19,7 +19,7 @@ else
|
|
19
19
|
([$prefix+"/lib/julia",$prefix+"/usr/lib",$prefix+"/lib"]+(RUBY_PLATFORM=~/(?:mingw|msys)/ ? [$prefix+"/bin"] : [])).each do |lib|
|
20
20
|
$prefix_lib << lib if File.exists? lib
|
21
21
|
end
|
22
|
-
end
|
22
|
+
# end
|
23
23
|
|
24
24
|
def jl4rb_makefile(incs,libs)
|
25
25
|
#$CFLAGS = "-I"+inc+" -I."
|
@@ -27,8 +27,10 @@ def jl4rb_makefile(incs,libs)
|
|
27
27
|
# $LDFLAGS = " -Wl,-rpath,"+lib+" -L"+lib if lib
|
28
28
|
# $libs = (enable_config("julia-release") ? " -ljulia-release" : " -ljulia-api" )
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
## TODO: utiliser julia-config
|
31
|
+
|
32
|
+
$CFLAGS = "-DJULIA_ENABLE_THREADING=1 -fPIC " + incs.map{|inc| "-I"+inc}.join(" ")+" -I."
|
33
|
+
$LDFLAGS = " "+libs.map{|lib| "-Wl,-rpath,'"+lib+"' -L'"+lib+"'"}.join(" ") if libs
|
32
34
|
$libs = " -ljulia"
|
33
35
|
|
34
36
|
|
@@ -38,6 +40,7 @@ def jl4rb_makefile(incs,libs)
|
|
38
40
|
$objs = [rb4r_name+".o"]
|
39
41
|
|
40
42
|
dir_config("R4rb")
|
43
|
+
p ( {:CFLAGS => $CFLAGS, :LDFLAGS => $LDFLAGS, :libs => $libs })
|
41
44
|
create_makefile(rb4r_name)
|
42
45
|
end
|
43
46
|
|
data/ext/jl4rb/jl4rb.c
CHANGED
@@ -9,6 +9,8 @@
|
|
9
9
|
#include <string.h>
|
10
10
|
#include <math.h>
|
11
11
|
|
12
|
+
JULIA_DEFINE_FAST_TLS()
|
13
|
+
|
12
14
|
//#define WITH_JULIA_RELEASE
|
13
15
|
|
14
16
|
//#ifdef WITH_JULIA_RELEASE
|
@@ -50,13 +52,14 @@ VALUE Julia_init(VALUE obj, VALUE args)
|
|
50
52
|
// printf("undefined \n");
|
51
53
|
// #endif
|
52
54
|
//#ifdef WITH_JULIA_RELEASE
|
53
|
-
if(strcmp(julia_home_dir,"")==0) {
|
54
|
-
|
55
|
-
|
56
|
-
} else {
|
55
|
+
// if(strcmp(julia_home_dir,"")==0) {
|
56
|
+
// jl_init(); //(NULL);
|
57
|
+
// //JL_SET_STACK_BASE;
|
58
|
+
// } else {
|
57
59
|
jl_init(); //(julia_home_dir);
|
58
|
-
//
|
59
|
-
|
60
|
+
//julia_init(JL_IMAGE_JULIA_HOME);
|
61
|
+
// //JL_SET_STACK_BASE;
|
62
|
+
// }
|
60
63
|
//#else
|
61
64
|
// jlapi_init(julia_home_dir,mode);
|
62
65
|
//#endif
|
@@ -64,6 +67,11 @@ VALUE Julia_init(VALUE obj, VALUE args)
|
|
64
67
|
return Qtrue;
|
65
68
|
}
|
66
69
|
|
70
|
+
VALUE Julia_exit(VALUE exitcode) {
|
71
|
+
jl_atexit_hook(exitcode);
|
72
|
+
return Qtrue;
|
73
|
+
}
|
74
|
+
|
67
75
|
//Maybe try to use cpp stuff to get the output inside julia system (ccall,cgen and cgutils)
|
68
76
|
//-| TODO: after adding in the jlapi.c jl_is_<C_type> functions replace the strcmp!
|
69
77
|
VALUE jl_value_to_VALUE(jl_value_t *res) {
|
@@ -212,7 +220,8 @@ VALUE Julia_eval(VALUE obj, VALUE cmd, VALUE print_stdout)
|
|
212
220
|
res=jl_eval_string(cmdString);
|
213
221
|
//printf("cmd=%s\n",cmdString);
|
214
222
|
if (jl_exception_occurred()) {
|
215
|
-
jl_show(jl_stderr_obj(), jl_exception_occurred());
|
223
|
+
//jl_show(jl_stderr_obj(), jl_exception_occurred());
|
224
|
+
jl_call2(jl_get_function(jl_base_module, "show"), jl_stderr_obj(), jl_exception_occurred());
|
216
225
|
jl_printf(jl_stderr_stream(), "\n");
|
217
226
|
resRb=Qnil;
|
218
227
|
} else {
|
@@ -528,6 +537,8 @@ Init_jl4rb()
|
|
528
537
|
|
529
538
|
rb_define_module_function(mJulia, "initJL", Julia_init, 1);
|
530
539
|
|
540
|
+
rb_define_module_function(mJulia, "exitJL", Julia_exit, 1);
|
541
|
+
|
531
542
|
rb_define_module_function(mJulia, "evalLine", Julia_eval, 2);
|
532
543
|
|
533
544
|
rb_define_module_function(mJulia, "execLine", Julia_exec, 2);
|
data/jl4rb.gemspec
CHANGED
data/lib/jl4rb/jl2rb_init.rb
CHANGED
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.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CQLS
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'R is embedded in ruby with some communication support .
|
14
14
|
|
@@ -53,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
53
|
requirements:
|
54
54
|
- none
|
55
55
|
rubyforge_project:
|
56
|
-
rubygems_version: 2.6
|
56
|
+
rubygems_version: 2.7.6
|
57
57
|
signing_key:
|
58
58
|
specification_version: 4
|
59
59
|
summary: Julia for ruby
|