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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: aa762020a0d0b5213c4d62447f70eeeebb9b0739
4
- data.tar.gz: e671f5d40a569ee2c420bbcf0bda2100ae977ff8
2
+ SHA256:
3
+ metadata.gz: 2deb18c81ccd3f5a6392064cd109eebdd3d87280d78ac3a152e92b9668d6c2fe
4
+ data.tar.gz: 0c0818404e1d24520f7d598c16bb777b9e8d3173440be03bf63b141a02509169
5
5
  SHA512:
6
- metadata.gz: 9062b693634f2c18105ec3b44a92e640f1f5bf9932e36f52a8169f995d5759759cbea88e48030656c9af819af79e61b6ff433868de50b8b13ab423326ca0aea7
7
- data.tar.gz: 5ffec378260ad258b1d64bf3d2c1b97b878e4ad0e76f31e09d0dc70cfdde88ea147973fde518a0df2bb9318ee6c072391376790ddd95aae62e4c1f59e9b119ea
6
+ metadata.gz: 5b152d43c269981d459c3182bb1860331d6ee998064cfbd3dc358f5bbaa7ce12fe88d3fae0ae2bf9de82a2d5c95ac467fb206b430bd8e9bb43ad07d3c475d055
7
+ data.tar.gz: 417e6fbafe4972a696860b9afa8a45defd190b84c67d1b5a6029d25db70c047f7c046aae7b33a40609aa25e1ec5da5b5fec9020f00369c5c731b2f6351260c1b
@@ -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
- $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"
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
- $prefix_lib << "/usr/lib/"+RUBY_PLATFORM+"/julia" if File.exists? "/usr/lib/"+RUBY_PLATFORM+"/julia"
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
- $CFLAGS = incs.map{|inc| "-I"+inc}.join(" ")+" -I."
31
- $LDFLAGS = " "+libs.map{|lib| "-Wl,-rpath,"+lib+" -L"+lib}.join(" ") if libs
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
 
@@ -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
- jl_init(); //(NULL);
55
- //JL_SET_STACK_BASE;
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
- //JL_SET_STACK_BASE;
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);
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rubygems/package_task'
3
3
 
4
4
  PKG_NAME='jl4rb'
5
- PKG_VERSION='0.0.10'
5
+ PKG_VERSION='0.1.1'
6
6
  PKG_FILES=FileList[
7
7
  'Rakefile','jl4rb.gemspec',
8
8
  'ext/jl4rb/*.c',
@@ -13,4 +13,8 @@ module Julia
13
13
  defined? @@initJL
14
14
  end
15
15
 
16
+ def Julia.exit()
17
+ Julia.exitJL(0)
18
+ end
19
+
16
20
  end
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.0.10
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: 2017-10-11 00:00:00.000000000 Z
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.13
56
+ rubygems_version: 2.7.6
57
57
  signing_key:
58
58
  specification_version: 4
59
59
  summary: Julia for ruby