RubyInline 3.9.0 → 3.10.0

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
@@ -1,3 +1,3 @@
1
- a0R6׉�����x����#ˬ��ڟ�w�2O&NH9VR"?�㖁��� r`{��Ha8�� ��di���\�s
2
- k+�|�L
3
- �A8O w��e'YSL�aC�Xz=i��?��Ɍh�eA:��ǎɈ�6�Ȼqd��:�.5 �a^[iU�+���9���y��o?�4�k���<w-�"4�����n\�g�ӡ��$�At1H��K�(�Ԭ��0XD}u���kAU�G<�31g��wŇ��*
1
+ � 1��e����}ӺE'��%��-OP�v"�,����'Z3W�q�.y�~�.����-� Jg�6��U( ��p6p5h6e k|���5M�����nNT}G^���y�.��ٌ��
2
+ ��b=�9$ %g�8�>)
3
+ r��(8d���ȕ(lv>w<+2M��~kgtZ�:F����y)���6��%34�����&Ǿ-���;���y4C��C��3�Nޏ�j�g�Q��{P���|��
data/History.txt CHANGED
@@ -1,3 +1,15 @@
1
+ === 3.10.0 / 2011-08-30
2
+
3
+ * 2 minor enhancements:
4
+
5
+ * Added engined/versioned subdir to .ruby_inline to help with multiple-ruby usage. (valodzka)
6
+ * Extended file/module naming to avoid hash collisions. (apohllo)
7
+
8
+ * 2 bug fixes:
9
+
10
+ * Fixed examples for 1.9 compatibility.
11
+ * Use RbConfig instead of Config. (apohllo)
12
+
1
13
  === 3.9.0 / 2011-02-18
2
14
 
3
15
  * 1 minor enhancement:
data/README.txt CHANGED
@@ -1,9 +1,8 @@
1
1
  = Ruby Inline
2
2
 
3
- * http://rubyforge.org/projects/rubyinline/
4
- * http://rubyinline.rubyforge.org/RubyInline/
5
- * http://www.zenspider.com/ZSS/Products/RubyInline/
6
- * mailto:ryand-ruby@zenspider.com
3
+ rdoc :: http://docs.seattlerb.org/RubyInline/
4
+ home :: http://www.zenspider.com/ZSS/Products/RubyInline/
5
+ repo :: https://github.com/seattlerb/rubyinline
7
6
 
8
7
  == DESCRIPTION:
9
8
 
@@ -33,14 +32,14 @@ See hoe for more details.
33
32
 
34
33
  == FEATURES/PROBLEMS:
35
34
 
36
- + Quick and easy inlining of your C or C++ code embedded in your ruby script.
37
- + Extendable to work with other languages.
38
- + Automatic conversion between ruby and C basic types
39
- + char, unsigned, unsigned int, char *, int, long, unsigned long
40
- + inline_c_raw exists for when the automatic conversion isn't sufficient.
41
- + Only recompiles if the inlined code has changed.
42
- + Pretends to be secure.
43
- + Only requires standard ruby libraries, nothing extra to download.
35
+ * Quick and easy inlining of your C or C++ code embedded in your ruby script.
36
+ * Extendable to work with other languages.
37
+ * Automatic conversion between ruby and C basic types
38
+ * char, unsigned, unsigned int, char *, int, long, unsigned long
39
+ * inline_c_raw exists for when the automatic conversion isn't sufficient.
40
+ * Only recompiles if the inlined code has changed.
41
+ * Pretends to be secure.
42
+ * Only requires standard ruby libraries, nothing extra to download.
44
43
 
45
44
  == SYNOPSYS:
46
45
 
@@ -103,21 +102,21 @@ See hoe for more details.
103
102
 
104
103
  == REQUIREMENTS:
105
104
 
106
- + Ruby - 1.8.2 has been used on FreeBSD 4.6+ and MacOSX.
107
- + POSIX compliant system (ie pretty much any UNIX, or Cygwin on MS platforms).
108
- + A C/C++ compiler (the same one that compiled your ruby interpreter).
109
- + test::unit for running tests ( http://testunit.talbott.ws/ ).
105
+ * Ruby - 1.8.2 has been used on FreeBSD 4.6+ and MacOSX.
106
+ * POSIX compliant system (ie pretty much any UNIX, or Cygwin on MS platforms).
107
+ * A C/C++ compiler (the same one that compiled your ruby interpreter).
108
+ * test::unit for running tests ( http://testunit.talbott.ws/ ).
110
109
 
111
110
  == INSTALL:
112
111
 
113
- + make test (optional)
114
- + make install
112
+ * make test (optional)
113
+ * make install
115
114
 
116
115
  == LICENSE:
117
116
 
118
117
  (The MIT License)
119
118
 
120
- Copyright (c) 2001-2007 Ryan Davis, Zen Spider Software
119
+ Copyright (c) Ryan Davis, seattle.rb
121
120
 
122
121
  Permission is hereby granted, free of charge, to any person obtaining
123
122
  a copy of this software and associated documentation files (the
data/Rakefile CHANGED
@@ -7,6 +7,7 @@ Hoe.add_include_dirs "../../ZenTest/dev/lib"
7
7
  Hoe.add_include_dirs "lib"
8
8
 
9
9
  Hoe.plugin :seattlerb
10
+ Hoe.plugin :isolate
10
11
 
11
12
  Hoe.spec "RubyInline" do
12
13
  developer 'Ryan Davis', 'ryand-ruby@zenspider.com'
@@ -14,7 +15,8 @@ Hoe.spec "RubyInline" do
14
15
  clean_globs << File.expand_path("~/.ruby_inline")
15
16
  spec_extras[:requirements] =
16
17
  "A POSIX environment and a compiler for your language."
17
- extra_deps << ['ZenTest', '~> 4.3'] # for ZenTest mapping
18
+
19
+ dependency "ZenTest", "~> 4.3" # for ZenTest mapping
18
20
  end
19
21
 
20
22
  task :test => :clean
data/example2.rb CHANGED
@@ -14,10 +14,9 @@ class MyTest
14
14
  builder.add_compile_flags %q(-x c++)
15
15
  builder.add_link_flags %q(-lstdc++)
16
16
 
17
+ builder.include "<iostream>"
18
+
17
19
  builder.c "
18
- // stupid c++ comment
19
- #include <iostream>
20
- /* stupid c comment */
21
20
  static
22
21
  void
23
22
  hello(int i) {
data/lib/inline.rb CHANGED
@@ -65,7 +65,7 @@ class CompilationError < RuntimeError; end
65
65
  # the current namespace.
66
66
 
67
67
  module Inline
68
- VERSION = '3.9.0'
68
+ VERSION = '3.10.0'
69
69
 
70
70
  WINDOZE = /mswin|mingw/ =~ RUBY_PLATFORM
71
71
  RUBINIUS = defined? RUBY_ENGINE
@@ -134,11 +134,14 @@ module Inline
134
134
  end
135
135
 
136
136
  def self.directory
137
- directory = File.join(rootdir, ".ruby_inline")
138
- unless defined? @@directory and directory == @@directory
139
- @@directory = File.join(self.rootdir, ".ruby_inline")
137
+ unless defined? @@directory then
138
+ version = "#{Gem.ruby_engine}-#{RbConfig::CONFIG['ruby_version']}"
139
+
140
+ @@directory = File.join(self.rootdir, ".ruby_inline", version)
140
141
  end
141
- Dir.assert_secure directory
142
+
143
+ Dir.assert_secure @@directory
144
+
142
145
  @@directory
143
146
  end
144
147
 
@@ -285,12 +288,14 @@ module Inline
285
288
  delta = if result =~ /\A(static.*?\{)/m then
286
289
  $1.split(/\n/).size
287
290
  else
288
- warn "WAR\NING: Can't find signature in #{result.inspect}\n" unless $TESTING
291
+ msg = "WAR\NING: Can't find signature in #{result.inspect}\n"
292
+ warn msg unless $TESTING
289
293
  0
290
294
  end
291
295
 
292
296
  file, line = caller[1].split(/:/)
293
- result = "# line #{line.to_i + delta} \"#{file}\"\n" + result unless $DEBUG and not $TESTING
297
+ result = "# line #{line.to_i + delta} \"#{file}\"\n" + result unless
298
+ $DEBUG and not $TESTING
294
299
 
295
300
  @src << result
296
301
  @sig[function_name] = [arity,singleton,method_name]
@@ -365,14 +370,14 @@ module Inline
365
370
  module_name = @mod.name.gsub('::','__')
366
371
  md5 = Digest::MD5.new
367
372
  @sig.keys.sort_by { |x| x.to_s }.each { |m| md5 << m.to_s }
368
- @module_name = "Inline_#{module_name}_#{md5.to_s[0,4]}"
373
+ @module_name = "Inline_#{module_name}_#{md5}"
369
374
  end
370
375
  @module_name
371
376
  end
372
377
 
373
378
  def so_name
374
379
  unless defined? @so_name then
375
- @so_name = "#{Inline.directory}/#{module_name}.#{Config::CONFIG["DLEXT"]}"
380
+ @so_name = "#{Inline.directory}/#{module_name}.#{RbConfig::CONFIG["DLEXT"]}"
376
381
  end
377
382
  @so_name
378
383
  end
@@ -523,7 +528,7 @@ VALUE #{method}_equals(VALUE value) {
523
528
 
524
529
  unless File.directory? Inline.directory then
525
530
  warn "NOTE: creating #{Inline.directory} for RubyInline" if $DEBUG
526
- Dir.mkdir Inline.directory, 0700
531
+ FileUtils.mkdir_p Inline.directory, :mode => 0700
527
532
  end
528
533
 
529
534
  src_name = "#{Inline.directory}/#{module_name}.c"
@@ -548,7 +553,7 @@ VALUE #{method}_equals(VALUE value) {
548
553
  if recompile then
549
554
 
550
555
  hdrdir = %w(srcdir archdir rubyhdrdir).map { |name|
551
- Config::CONFIG[name]
556
+ RbConfig::CONFIG[name]
552
557
  }.find { |dir|
553
558
  dir and File.exist? File.join(dir, "/ruby.h")
554
559
  } or abort "ERROR: Can't find header dir for ruby. Exiting..."
@@ -562,15 +567,15 @@ VALUE #{method}_equals(VALUE value) {
562
567
  nil
563
568
  end
564
569
 
565
- cmd = [ Config::CONFIG['LDSHARED'],
570
+ cmd = [ RbConfig::CONFIG['LDSHARED'],
566
571
  flags,
567
- Config::CONFIG['DLDFLAGS'],
568
- Config::CONFIG['CCDLFLAGS'],
569
- Config::CONFIG['CFLAGS'],
572
+ RbConfig::CONFIG['DLDFLAGS'],
573
+ RbConfig::CONFIG['CCDLFLAGS'],
574
+ RbConfig::CONFIG['CFLAGS'],
570
575
  '-I', hdrdir,
571
576
  config_hdrdir,
572
- '-I', Config::CONFIG['includedir'],
573
- "-L#{Config::CONFIG['libdir']}",
577
+ '-I', RbConfig::CONFIG['includedir'],
578
+ "-L#{RbConfig::CONFIG['libdir']}",
574
579
  '-o', so_name.inspect,
575
580
  File.expand_path(src_name).inspect,
576
581
  libs,
@@ -592,7 +597,7 @@ VALUE #{method}_equals(VALUE value) {
592
597
 
593
598
  # NOTE: manifest embedding is only required when using VC8 ruby
594
599
  # build or compiler.
595
- # Errors from this point should be ignored if Config::CONFIG['arch']
600
+ # Errors from this point should be ignored if RbConfig::CONFIG['arch']
596
601
  # (RUBY_PLATFORM) matches 'i386-mswin32_80'
597
602
  if WINDOZE and RUBY_PLATFORM =~ /_80$/ then
598
603
  Dir.chdir Inline.directory do
@@ -621,9 +626,9 @@ VALUE #{method}_equals(VALUE value) {
621
626
  # gawd windoze land sucks
622
627
  case RUBY_PLATFORM
623
628
  when /mswin32/ then
624
- " -link /LIBPATH:\"#{Config::CONFIG['libdir']}\" /DEFAULTLIB:\"#{Config::CONFIG['LIBRUBY']}\" /INCREMENTAL:no /EXPORT:Init_#{module_name}"
629
+ " -link /LIBPATH:\"#{RbConfig::CONFIG['libdir']}\" /DEFAULTLIB:\"#{RbConfig::CONFIG['LIBRUBY']}\" /INCREMENTAL:no /EXPORT:Init_#{module_name}"
625
630
  when /mingw32/ then
626
- " -Wl,--enable-auto-import -L#{Config::CONFIG['libdir']} -lmsvcrt-ruby18"
631
+ " -Wl,--enable-auto-import -L#{RbConfig::CONFIG['libdir']} -lmsvcrt-ruby18"
627
632
  when /i386-cygwin/ then
628
633
  ' -L/usr/local/lib -lruby.dll'
629
634
  else
data/test/test_inline.rb CHANGED
@@ -80,7 +80,8 @@ class TestInline < InlineTestCase
80
80
  end
81
81
 
82
82
  def test_directory
83
- inlinedir = File.join(@rootdir, ".ruby_inline")
83
+ version = "#{Gem.ruby_engine}-#{RbConfig::CONFIG['ruby_version']}"
84
+ inlinedir = File.join(@rootdir, ".ruby_inline", version)
84
85
  assert_equal(inlinedir, Inline.directory)
85
86
  end
86
87
 
@@ -412,8 +413,7 @@ static VALUE method_name_equals(VALUE self, VALUE _value) {
412
413
  md5 << signature.to_s
413
414
  end
414
415
 
415
- assert_equal("Inline_TestInline__TestC_#{md5.to_s[0,4]}",
416
- @builder.module_name)
416
+ assert_equal("Inline_TestInline__TestC_#{md5}", @builder.module_name)
417
417
  end
418
418
 
419
419
  def test_module_name_0_methods
@@ -774,7 +774,7 @@ static VALUE my_method(VALUE self) {
774
774
  #ifdef __cplusplus
775
775
  extern \"C\" {
776
776
  #endif#{windoze}
777
- void Init_Inline_TestInline__TestC_eba5() {
777
+ void Init_Inline_TestInline__TestC_eba5e5454322e22fe2310198ef14e43f() {
778
778
  VALUE c = rb_cObject;
779
779
  c = rb_const_get(c, rb_intern("TestInline"));
780
780
  c = rb_const_get(c, rb_intern("TestC"));
@@ -1033,7 +1033,7 @@ class TestModule < InlineTestCase
1033
1033
  "inline dir should have been created")
1034
1034
  matches = Dir[File.join(Inline.directory, "Inline_TestModule_*.c")]
1035
1035
  assert_equal(1, matches.length, "Source should have been created")
1036
- library_file = matches.first.gsub(/\.c$/) { "." + Config::CONFIG["DLEXT"] }
1036
+ library_file = matches.first.gsub(/\.c$/) { "." + RbConfig::CONFIG["DLEXT"] }
1037
1037
  assert(test(?f, library_file),
1038
1038
  "Library file should have been created")
1039
1039
  end
data/tutorial/example2.rb CHANGED
@@ -7,15 +7,15 @@ class Array
7
7
  inline do |builder|
8
8
  builder.c_raw "
9
9
  static VALUE average(int argc, VALUE *argv, VALUE self) {
10
- double result;
10
+ double result = 0;
11
11
  long i, len;
12
- VALUE *arr = RARRAY(self)->ptr;
13
- len = RARRAY(self)->len;
14
-
12
+ VALUE *arr = RARRAY_PTR(self);
13
+ len = RARRAY_LEN(self);
14
+
15
15
  for(i=0; i<len; i++) {
16
16
  result += NUM2DBL(arr[i]);
17
17
  }
18
-
18
+
19
19
  return rb_float_new(result/(double)len);
20
20
  }
21
21
  "
@@ -70,7 +70,7 @@ $stderr.puts ""
70
70
 
71
71
  # & time ruby ./example2.rb 5 100000
72
72
  # .....
73
- #
73
+ #
74
74
  # real 0m1.403s
75
75
  # user 0m1.120s
76
76
  # sys 0m0.070s
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: RubyInline
3
3
  version: !ruby/object:Gem::Version
4
- hash: 35
4
+ hash: 47
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
- - 9
8
+ - 10
9
9
  - 0
10
- version: 3.9.0
10
+ version: 3.10.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Davis
@@ -36,8 +36,7 @@ cert_chain:
36
36
  FBHgymkyj/AOSqKRIpXPhjC6
37
37
  -----END CERTIFICATE-----
38
38
 
39
- date: 2011-02-18 00:00:00 -08:00
40
- default_executable:
39
+ date: 2011-08-31 00:00:00 Z
41
40
  dependencies:
42
41
  - !ruby/object:Gem::Dependency
43
42
  name: ZenTest
@@ -60,14 +59,13 @@ dependencies:
60
59
  requirement: &id002 !ruby/object:Gem::Requirement
61
60
  none: false
62
61
  requirements:
63
- - - ">="
62
+ - - ~>
64
63
  - !ruby/object:Gem::Version
65
- hash: 11
64
+ hash: 9
66
65
  segments:
67
66
  - 2
68
- - 0
69
- - 2
70
- version: 2.0.2
67
+ - 5
68
+ version: "2.5"
71
69
  type: :development
72
70
  version_requirements: *id002
73
71
  - !ruby/object:Gem::Dependency
@@ -76,14 +74,13 @@ dependencies:
76
74
  requirement: &id003 !ruby/object:Gem::Requirement
77
75
  none: false
78
76
  requirements:
79
- - - ">="
77
+ - - ~>
80
78
  - !ruby/object:Gem::Version
81
- hash: 41
79
+ hash: 27
82
80
  segments:
83
81
  - 2
84
- - 9
85
- - 1
86
- version: 2.9.1
82
+ - 12
83
+ version: "2.12"
87
84
  type: :development
88
85
  version_requirements: *id003
89
86
  description: |-
@@ -119,8 +116,7 @@ files:
119
116
  - tutorial/example1.rb
120
117
  - tutorial/example2.rb
121
118
  - .gemtest
122
- has_rdoc: true
123
- homepage: http://rubyforge.org/projects/rubyinline/
119
+ homepage: http://www.zenspider.com/ZSS/Products/RubyInline/
124
120
  licenses: []
125
121
 
126
122
  post_install_message:
@@ -150,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
146
  requirements:
151
147
  - A POSIX environment and a compiler for your language.
152
148
  rubyforge_project: rubyinline
153
- rubygems_version: 1.4.2
149
+ rubygems_version: 1.8.9
154
150
  signing_key:
155
151
  specification_version: 3
156
152
  summary: Inline allows you to write foreign code within your ruby code
metadata.gz.sig CHANGED
Binary file