RubyInline 3.13.0 → 3.14.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
2
  SHA256:
3
- metadata.gz: 6fb686fe259ea5574fa2a1f00e0a6d7dc4e1d8a7aa3c1ba44b5f2fd07951962c
4
- data.tar.gz: af619f2046cbbb045a242aa0b6292953e98cbb917244587e026d8a27e32fe9a5
3
+ metadata.gz: eadac7653c5cb624b0778ea6fabb5f5db8358785daf928d52137125547989542
4
+ data.tar.gz: 05f475f961350b3ae11b88de02d41646288a18ca1193446f915923cae2ba6150
5
5
  SHA512:
6
- metadata.gz: ab7bb820deb6412c42493a8efb50e60cdcb7d3bc5ce0c6f0918efeb253c6621f3b49eb9d325d90bc968ee9a98aa011346665a16785ad2a2f438e7eeddc894448
7
- data.tar.gz: f79d57058eef27a84ee713d108cff2acdb38b69a8a167825e673c773cc8a8cb20ad25b4c9b6af31574c16526d20870bf237eced0e0e35cd44da9ba373b16712b
6
+ metadata.gz: d377fec0166d04b22bd4ba0c283f0cb9c72d1f998d6651030dc7a897dc40a0bcab17497defc4d5fd0f87af6eb5e170bd5c34b8950780a4f32c4137c3d58fe6af
7
+ data.tar.gz: c59d0575650d5a607795a97f449679e7a7614fe0d827662603ea3d226912eebc81db35cdcf743c96f7e579086fd37472a33943f1caaba32116ffc8962deac2fc
checksums.yaml.gz.sig CHANGED
Binary file
data/History.txt CHANGED
@@ -1,3 +1,21 @@
1
+ === 3.14.1 / 2024-06-23
2
+
3
+ * 1 bug fix:
4
+
5
+ * Fix errors created when string literals are frozen.
6
+
7
+ === 3.14.0 / 2023-06-28
8
+
9
+ * 3 minor enhancements:
10
+
11
+ * Changed File.write_with_backup to write the content and return renamed path.
12
+ * Dropped #inline ancient options processing code. 2005, yo.
13
+ * Preemptively require language extension if not defined yet.
14
+
15
+ * 1 bug fix:
16
+
17
+ * Declare Init_* to be (void) to prevent some compilers from complaining.
18
+
1
19
  === 3.13.0 / 2023-01-31
2
20
 
3
21
  * 1 minor enhancement:
data/Rakefile CHANGED
@@ -16,6 +16,8 @@ Hoe.spec "RubyInline" do
16
16
  spec_extras[:requirements] =
17
17
  "A POSIX environment and a compiler for your language."
18
18
 
19
+ license "MIT"
20
+
19
21
  dependency "ZenTest", "~> 4.3" # for ZenTest mapping
20
22
  end
21
23
 
@@ -33,7 +35,7 @@ task :examples do
33
35
  end
34
36
 
35
37
  desc "run simple benchmarks"
36
- task :bench do
38
+ task :bench => [:clean, :isolate] do
37
39
  verbose(false) do
38
40
  ruby "-Ilib ./example.rb"
39
41
  ruby "-Ilib ./example.rb 1000000 12" # 12 is the bignum cutoff for factorial
data/lib/inline.rb CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/local/bin/ruby -w
1
+ # frozen_string_literal: true
2
2
 
3
3
  ##
4
4
  # Ruby Inline is a framework for writing ruby extensions in foreign
@@ -65,7 +65,7 @@ class CompilationError < RuntimeError; end
65
65
  # the current namespace.
66
66
 
67
67
  module Inline
68
- VERSION = "3.13.0"
68
+ VERSION = "3.14.1"
69
69
 
70
70
  WINDOZE = /mswin|mingw/ =~ RUBY_PLATFORM
71
71
  DEV_NULL = (WINDOZE ? 'nul' : '/dev/null')
@@ -74,12 +74,12 @@ module Inline
74
74
 
75
75
  warn "RubyInline v #{VERSION}" if $DEBUG
76
76
 
77
- def self.register cls
77
+ def self.register cls # for hoe/inline
78
78
  registered_inline_classes << cls
79
79
  registered_inline_classes.uniq!
80
80
  end
81
81
 
82
- def self.registered_inline_classes
82
+ def self.registered_inline_classes # for hoe/inline
83
83
  @@registered_inline_classes ||= []
84
84
  end
85
85
 
@@ -326,7 +326,7 @@ module Inline
326
326
  ext << "extern \"C\" {"
327
327
  ext << "#endif"
328
328
  ext << " __declspec(dllexport)" if WINDOZE
329
- ext << " void Init_#{module_name}() {"
329
+ ext << " void Init_#{module_name}(void) {"
330
330
  ext << " VALUE c = rb_cObject;"
331
331
 
332
332
  # TODO: use rb_class2path
@@ -338,7 +338,7 @@ module Inline
338
338
  ext << nil
339
339
 
340
340
  @sig.keys.sort.each do |name|
341
- method = ''
341
+ method = []
342
342
  arity, singleton, method_name = @sig[name]
343
343
  if singleton then
344
344
  if method_name == 'allocate' then
@@ -351,7 +351,7 @@ module Inline
351
351
  method << " rb_define_method(c, \"#{method_name}\", "
352
352
  end
353
353
  method << "(VALUE(*)(ANYARGS))#{name}, #{arity});"
354
- ext << method
354
+ ext << method.join
355
355
  end
356
356
 
357
357
  ext << @init_extra.join("\n") unless @init_extra.empty?
@@ -449,7 +449,7 @@ module Inline
449
449
  @struct_name
450
450
 
451
451
  c <<-C
452
- VALUE #{method}() {
452
+ VALUE #{method}(void) {
453
453
  #{@struct_name} *pointer;
454
454
 
455
455
  Data_Get_Struct(self, #{@struct_name}, pointer);
@@ -535,14 +535,11 @@ VALUE #{method}_equals(VALUE value) {
535
535
  end
536
536
 
537
537
  src_name = "#{Inline.directory}/#{module_name}.c"
538
- old_src_name = "#{src_name}.old"
539
- should_compare = File.write_with_backup(src_name) do |io|
540
- io.puts generate_ext
541
- end
538
+ old_src_name = File.write_with_backup src_name, generate_ext
542
539
 
543
540
  # recompile only if the files are different
544
541
  recompile = true
545
- if so_exists and should_compare and
542
+ if so_exists and old_src_name and
546
543
  FileUtils.compare_file(old_src_name, src_name) then
547
544
  recompile = false
548
545
 
@@ -834,22 +831,9 @@ class Module
834
831
  def inline(lang = :C, options={})
835
832
  Inline.register self
836
833
 
837
- case options
838
- when TrueClass, FalseClass then
839
- warn "WAR\NING: 2nd argument to inline is now a hash, changing to {:testing=>#{options}}" unless options
840
- options = { :testing => options }
841
- when Hash
842
- options[:testing] ||= false
843
- else
844
- raise ArgumentError, "BLAH"
845
- end
834
+ require "inline/#{lang}" unless Inline.const_defined? lang
846
835
 
847
- builder_class = begin
848
- Inline.const_get(lang)
849
- rescue NameError
850
- require "inline/#{lang}"
851
- Inline.const_get(lang)
852
- end
836
+ builder_class = Inline.const_get lang
853
837
 
854
838
  builder = builder_class.new self
855
839
 
@@ -869,25 +853,24 @@ class File
869
853
  ##
870
854
  # Equivalent to +File::open+ with an associated block, but moves
871
855
  # any existing file with the same name to the side first.
856
+ # Returns renamed path or false if none.
872
857
 
873
- def self.write_with_backup(path) # returns true if file already existed
874
-
875
- # move previous version to the side if it exists
858
+ def self.write_with_backup(path, content)
876
859
  renamed = false
860
+
877
861
  if File.file? path then
862
+ renamed = "#{path}.old"
863
+
878
864
  begin
879
- File.rename path, path + ".old"
880
- renamed = true
881
- rescue SystemCallError
865
+ File.rename path, renamed
866
+ rescue SystemCallError # in case of race condition
882
867
  # do nothing
883
868
  end
884
869
  end
885
870
 
886
- File.open(path, "w") do |io|
887
- yield(io)
888
- end
871
+ File.write path, content
889
872
 
890
- return renamed
873
+ renamed
891
874
  end
892
875
  end # class File
893
876
 
@@ -901,7 +884,7 @@ class Dir
901
884
 
902
885
  def self.assert_secure(path)
903
886
  mode = File.stat(path).mode
904
- unless ((mode % 01000) & 0022) == 0 then
887
+ unless mode % 01000 & 0022 == 0 then
905
888
  if $TESTING then
906
889
  raise SecurityError, "Directory #{path} is insecure"
907
890
  else
data/test/test_inline.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  $TESTING = true
2
4
 
3
5
  $0 = __FILE__ if $0 =~ /-e|\(eval\)|^$/
@@ -769,7 +771,7 @@ static VALUE my_method(VALUE self) {
769
771
  #ifdef __cplusplus
770
772
  extern \"C\" {
771
773
  #endif#{windoze}
772
- void Init_Inline_TestInline__TestC_3ab8c09639e499394bb1f0a0194a839f() {
774
+ void Init_Inline_TestInline__TestC_3ab8c09639e499394bb1f0a0194a839f(void) {
773
775
  VALUE c = rb_cObject;
774
776
  c = rb_const_get(c, rb_intern("TestInline"));
775
777
  c = rb_const_get(c, rb_intern("TestC"));
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: RubyInline
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.13.0
4
+ version: 3.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -10,9 +10,9 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDPjCCAiagAwIBAgIBBzANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
13
+ MIIDPjCCAiagAwIBAgIBCDANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
14
14
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
- GRYDY29tMB4XDTIzMDEwMTA3NTExN1oXDTI0MDEwMTA3NTExN1owRTETMBEGA1UE
15
+ GRYDY29tMB4XDTI0MDEwMjIxMjEyM1oXDTI1MDEwMTIxMjEyM1owRTETMBEGA1UE
16
16
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
17
17
  JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
18
18
  b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
@@ -22,14 +22,14 @@ cert_chain:
22
22
  qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
23
23
  gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
24
24
  HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBCwUAA4IB
25
- AQAkg3y+PBnBAPWdxxITm5sPHqdWQgSyCpRA20o4LTuWr8BWhSXBkfQNa7cY6fOn
26
- xyM34VPzBFbExv6XOGDfOMFBVaYTHuN9peC/5/umL7kLl+nflXzL2QA7K6LYj5Bg
27
- sM574Onr0dZDM6Vn69bzQ7rBIFDfK/OhlPzqKZad4nsdcsVH8ODCiT+ATMIZyz5K
28
- WCnNtqlyiWXI8tdTpahDgcUwfcN/oN7v4K8iU5IbLJX6HQ5DKgmKjfb6XyMth16k
29
- ROfWo9Uyp8ba/j9eVG14KkYRaLydAY1MNQk2yd3R5CGfeOpD1kttxjoypoUJ2dOG
30
- nsNBRuQJ1UfiCG97a6DNm+Fr
25
+ AQCygvpmncmkiSs9r/Kceo4bBPDszhTv6iBi4LwMReqnFrpNLMOWJw7xi8x+3eL2
26
+ XS09ZPNOt2zm70KmFouBMgOysnDY4k2dE8uF6B8JbZOO8QfalW+CoNBliefOTcn2
27
+ bg5IOP7UoGM5lC174/cbDJrJnRG9bzig5FAP0mvsgA8zgTRXQzIUAZEo92D5K7p4
28
+ B4/O998ho6BSOgYBI9Yk1ttdCtti6Y+8N9+fZESsjtWMykA+WXWeGUScHqiU+gH8
29
+ S7043fq9EbQdBr2AXdj92+CDwuTfHI6/Hj5FVBDULufrJaan4xUgL70Hvc6pTTeW
30
+ deKfBjgVAq7EYHu1AczzlUly
31
31
  -----END CERTIFICATE-----
32
- date: 2023-02-01 00:00:00.000000000 Z
32
+ date: 2024-06-23 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: ZenTest
@@ -71,14 +71,14 @@ dependencies:
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '4.0'
74
+ version: '4.2'
75
75
  type: :development
76
76
  prerelease: false
77
77
  version_requirements: !ruby/object:Gem::Requirement
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '4.0'
81
+ version: '4.2'
82
82
  description: |-
83
83
  Inline allows you to write foreign code within your ruby code. It
84
84
  automatically determines if the code in question has changed and
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  version: '0'
134
134
  requirements:
135
135
  - A POSIX environment and a compiler for your language.
136
- rubygems_version: 3.4.3
136
+ rubygems_version: 3.5.14
137
137
  signing_key:
138
138
  specification_version: 4
139
139
  summary: Inline allows you to write foreign code within your ruby code
metadata.gz.sig CHANGED
@@ -1,2 +1 @@
1
- �^�����AV?���������"I:YZHvp*������������J�=� D� �–2A��F"��kS��H(9X��Ikt0M
2
- �J��������N��Zu����x�T�1LG�&�
1
+ I�>nG�i]�XJ�8�`Bf���߿�liŽ���c�����y�~=�2.����L�#�w��%ة|N���������'��P0)������?u|/ԙ�VOb��%����z Ր��