ruby2c 1.1.0 → 1.1.2

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: f6ae2f91c8e5c83ab77b02d6e779b83aa749f4fe8799c1f875859844c2d0f7a6
4
- data.tar.gz: 145da4a50b73b15433695d7c1917412eb2da27ad8c954fc9c651ee71511a61e6
3
+ metadata.gz: edfaadeab8599e6487d84d804fea2cb404d6fb1230155dfa0214dab0ed7e780a
4
+ data.tar.gz: f5fa1639e67da38cbf1bc8bd30ce96639f22530d814d899040b958698408efcb
5
5
  SHA512:
6
- metadata.gz: af6b9e49cf2b1eb2cf456fde6faa184a2dca2fc0ed61232206aeea83cb8a2b2512aa30164b0dba5ea58005cb16c68516ec695b3b00fd950f695607147b1df0d5
7
- data.tar.gz: ad870dab2e1d50291e9855a53fae299c20733c11871d5de3f38da1341b82ed7e64dfd76d0d1d5e9c0fa700f2e52fdf87cb853e219f4f80d3ed20d51487b18e3e
6
+ metadata.gz: 58d332bc3da77815ddca5b070c31e4c259b2abf90248f19df8ab6fc1aca2968f1fd0468d767c1ed864510cb122c02915cde9b990ebe512783765ece55d96c757
7
+ data.tar.gz: b24c9fbe26bfec9816f2f5486aa20e095dfc9c86fa0f24144ba5b37980908b24fb20fc62d37a66cdd0e24a397bc486ce47134bca2fe6e70080b7d1d8812d67d2
checksums.yaml.gz.sig CHANGED
Binary file
data/History.txt CHANGED
@@ -1,3 +1,19 @@
1
+ === 1.1.2 / 2024-11-11
2
+
3
+ * 4 bug fixes:
4
+
5
+ * Added license declaration to gemspec.
6
+ * Added racc as development dependency + isolate plugin.
7
+ * Fix errors created when string literals are frozen (in 2.7 only??).
8
+ * Fix errors created when string literals are frozen.
9
+
10
+ === 1.1.1 / 2022-12-03
11
+
12
+ * 2 bug fixes:
13
+
14
+ * Added support for 3.0 parser
15
+ * Used ParseTreeTestCase#TEST_SUFFIX to make this always work when new versions added.
16
+
1
17
  === 1.1.0 / 2019-09-24
2
18
 
3
19
  * 4 minor enhancements:
data/Rakefile CHANGED
@@ -10,13 +10,17 @@ Hoe.add_include_dirs("../../ParseTree/dev/test",
10
10
  "lib")
11
11
 
12
12
  Hoe.plugin :seattlerb
13
+ Hoe.plugin :isolate
13
14
 
14
15
  Hoe.spec "ruby2c" do
15
16
  developer 'Ryan Davis', 'ryand-ruby@zenspider.com'
16
17
  developer 'Eric Hodel', 'drbrain@segment7.net'
17
18
 
19
+ license "MIT"
20
+
18
21
  dependency "ruby_parser", "~> 3.0"
19
22
  dependency "sexp_processor", "~> 4.1"
23
+ dependency "racc", ">0", :development
20
24
  end
21
25
 
22
26
  ENV["MT_NO_EXPECTATIONS"] = "1"
data/lib/crewriter.rb CHANGED
@@ -41,8 +41,8 @@ class CRewriter < SexpProcessor
41
41
  # result
42
42
  # end
43
43
 
44
- def process exp
45
- result = super
44
+ def process exp, _src = nil, _timeout = nil
45
+ result = super(exp)
46
46
  result.c_type ||= exp.c_type if Sexp === exp and exp.c_type
47
47
  result
48
48
  end
data/lib/rewriter.rb CHANGED
@@ -18,6 +18,10 @@ end
18
18
  # what it does.
19
19
 
20
20
  class Rewriter < SexpProcessor
21
+ def process exp, _src = nil, _timeout = nil
22
+ super(exp)
23
+ end
24
+
21
25
  def rewrite_defn(exp)
22
26
  case exp.last[0]
23
27
  when :ivar then
@@ -20,7 +20,7 @@ require 'r2cenvironment'
20
20
 
21
21
  class RubyToAnsiC < SexpProcessor
22
22
 
23
- VERSION = '1.1.0'
23
+ VERSION = '1.1.2'
24
24
 
25
25
  # TODO: remove me
26
26
  def no(exp) # :nodoc:
@@ -133,6 +133,10 @@ typedef char * str;
133
133
  @prototypes = []
134
134
  end
135
135
 
136
+ def process exp, _src = nil, _timeout = nil
137
+ super(exp)
138
+ end
139
+
136
140
  ##
137
141
  # Logical And. Nothing exciting here
138
142
 
@@ -473,7 +477,7 @@ typedef char * str;
473
477
  # TODO: figure out array issues and clean up.
474
478
 
475
479
  def process_lasgn(exp) # TODO: audit against obfuscator
476
- out = ""
480
+ out = []
477
481
 
478
482
  var = exp.shift
479
483
  value = exp.shift
@@ -504,9 +508,7 @@ typedef char * str;
504
508
  out << "#{var} = #{process args}"
505
509
  end
506
510
 
507
- out.sub!(/;\n\Z/, '')
508
-
509
- return out
511
+ out.join.sub(/;\n\Z/, '')
510
512
  end
511
513
 
512
514
  ##
@@ -644,7 +646,7 @@ typedef char * str;
644
646
  result = yield
645
647
  @env.current.sort_by { |v,_| v.to_s }.each do |var, (type,val)|
646
648
  next if outer_scope.include? var
647
- decl = "#{self.class.c_type type} #{var}"
649
+ decl = ["#{self.class.c_type type} #{var}"]
648
650
  case val
649
651
  when nil then
650
652
  # do nothing
@@ -654,7 +656,7 @@ typedef char * str;
654
656
  decl << " = #{val}"
655
657
  end
656
658
  decl << ';'
657
- declarations << decl
659
+ declarations << decl.join
658
660
  end
659
661
  end
660
662
 
@@ -172,7 +172,7 @@ class RubyToRubyC < RubyToAnsiC
172
172
  # TODO: figure out array issues and clean up.
173
173
 
174
174
  def process_lasgn(exp) # TODO: audit against obfuscator
175
- out = ""
175
+ out = []
176
176
 
177
177
  var = exp.shift
178
178
  value = exp.shift
@@ -199,9 +199,7 @@ class RubyToRubyC < RubyToAnsiC
199
199
  out << "#{var} = #{process args}"
200
200
  end
201
201
 
202
- out.sub!(/;\n\Z/, '')
203
-
204
- return out
202
+ out.join.sub(/;\n\Z/, '')
205
203
  end
206
204
 
207
205
  ##
@@ -316,7 +314,7 @@ class RubyToRubyC < RubyToAnsiC
316
314
  if c_args == '()' then
317
315
  c_args = '(VALUE self)'
318
316
  else
319
- c_args.sub! '(', '(VALUE self, '
317
+ c_args = c_args.sub '(', '(VALUE self, '
320
318
  end
321
319
  end
322
320
 
data/lib/type.rb CHANGED
@@ -136,9 +136,9 @@ class CType
136
136
  end
137
137
 
138
138
  def to_s
139
- str = "Type.#{self.type.contents}"
139
+ str = ["Type.#{self.type.contents}"]
140
140
  str << "_list" if self.list?
141
- str
141
+ str.join
142
142
  end
143
143
 
144
144
  def inspect
data/lib/type_checker.rb CHANGED
@@ -119,6 +119,10 @@ class TypeChecker < SexpProcessor
119
119
  end
120
120
  end
121
121
 
122
+ def process exp, _src = nil, _timeout = nil
123
+ super(exp)
124
+ end
125
+
122
126
  ##
123
127
  # Logical and unifies its two arguments, then returns a bool sexp.
124
128
 
data/lib/typed_sexp.rb CHANGED
@@ -48,7 +48,7 @@ class TypedSexp < Sexp
48
48
  sexp_str = self.map {|x|x.inspect}.join(', ')
49
49
  c_type_str = (sexp_str.empty? ? "" : ", ") + "#{array_type? ? c_types.inspect : c_type}" unless c_type.nil?
50
50
  nnd = ")"
51
- nnd << ".line(#{line})" if line && ENV["VERBOSE"]
51
+ nnd += ".line(#{line})" if line && ENV["VERBOSE"]
52
52
  "t(#{sexp_str}#{c_type_str}#{nnd}"
53
53
  end
54
54
 
data/test/r2ctestcase.rb CHANGED
@@ -19,7 +19,7 @@ class R2CTestCase < ParseTreeTestCase
19
19
  end
20
20
 
21
21
  def self.add_skipped_tests19 *names
22
- add_skipped_tests names.map { |s| "#{s}__19_20_21_22_23_24_25_26" }
22
+ add_skipped_tests names.map { |s| "#{s}_#{TEST_SUFFIX}" }
23
23
  end
24
24
 
25
25
  testcase_order.push(*%w(Ruby ParseTree Rewriter TypeChecker
data.tar.gz.sig CHANGED
@@ -1 +1,2 @@
1
- v��`����͉��G�I!������@8s�y_��a��@EOu` �������=x_!⏆�� ��7�!r{M
1
+ �� �v�*Aq��t?!n��!#~TK��>��}@�����%�� �;�e��nttm
2
+ ��-�_������{Mgts<����Y�܏�p��B�;jY�G?�w6P"&�W�2����@3.�at�;��fȝX�zf�oQQ;ߜH���.�Z�9�Ȏ
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby2c
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
8
8
  - Eric Hodel
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain:
12
12
  - |
13
13
  -----BEGIN CERTIFICATE-----
14
- MIIDPjCCAiagAwIBAgIBAzANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
14
+ MIIDPjCCAiagAwIBAgIBCDANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
15
15
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
16
- GRYDY29tMB4XDTE4MTIwNDIxMzAxNFoXDTE5MTIwNDIxMzAxNFowRTETMBEGA1UE
16
+ GRYDY29tMB4XDTI0MDEwMjIxMjEyM1oXDTI1MDEwMTIxMjEyM1owRTETMBEGA1UE
17
17
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
18
18
  JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
19
19
  b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
@@ -23,14 +23,14 @@ cert_chain:
23
23
  qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
24
24
  gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
25
25
  HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBCwUAA4IB
26
- AQCbJwLmpJR2PomLU+Zzw3KRzH/hbyUWc/ftru71AopZ1fy4iY9J/BW5QYKVYwbP
27
- V0FSBWtvfI/RdwfKGtuGhPKECZgmLieGuZ3XCc09qPu1bdg7i/tu1p0t0c6163ku
28
- nDMDIC/t/DAFK0TY9I3HswuyZGbLW7rgF0DmiuZdN/RPhHq2pOLMLXJmFclCb/im
29
- 9yToml/06TJdUJ5p64mkBs0TzaK66DIB1Smd3PdtfZqoRV+EwaXMdx0Hb3zdR1JR
30
- Em82dBUFsipwMLCYj39kcyHWAxyl6Ae1Cn9r/ItVBCxoeFdrHjfavnrIEoXUt4bU
31
- UfBugfLD19bu3nvL+zTAGx/U
26
+ AQCygvpmncmkiSs9r/Kceo4bBPDszhTv6iBi4LwMReqnFrpNLMOWJw7xi8x+3eL2
27
+ XS09ZPNOt2zm70KmFouBMgOysnDY4k2dE8uF6B8JbZOO8QfalW+CoNBliefOTcn2
28
+ bg5IOP7UoGM5lC174/cbDJrJnRG9bzig5FAP0mvsgA8zgTRXQzIUAZEo92D5K7p4
29
+ B4/O998ho6BSOgYBI9Yk1ttdCtti6Y+8N9+fZESsjtWMykA+WXWeGUScHqiU+gH8
30
+ S7043fq9EbQdBr2AXdj92+CDwuTfHI6/Hj5FVBDULufrJaan4xUgL70Hvc6pTTeW
31
+ deKfBjgVAq7EYHu1AczzlUly
32
32
  -----END CERTIFICATE-----
33
- date: 2019-09-25 00:00:00.000000000 Z
33
+ date: 2024-11-11 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: ruby_parser
@@ -60,6 +60,20 @@ dependencies:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
62
  version: '4.1'
63
+ - !ruby/object:Gem::Dependency
64
+ name: racc
65
+ requirement: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">"
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">"
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
63
77
  - !ruby/object:Gem::Dependency
64
78
  name: rdoc
65
79
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +100,14 @@ dependencies:
86
100
  requirements:
87
101
  - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: '3.18'
103
+ version: '4.2'
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: '3.18'
110
+ version: '4.2'
97
111
  description: "ruby_to_c translates a static ruby subset to C. Hopefully it works.\n\n
98
112
  \ NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE\n \n THIS
99
113
  IS BETA SOFTWARE!\n \n NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE !
@@ -149,8 +163,9 @@ files:
149
163
  homepage: https://github.com/seattlerb/ruby_to_c
150
164
  licenses:
151
165
  - MIT
152
- metadata: {}
153
- post_install_message:
166
+ metadata:
167
+ homepage_uri: https://github.com/seattlerb/ruby_to_c
168
+ post_install_message:
154
169
  rdoc_options:
155
170
  - "--main"
156
171
  - README.txt
@@ -167,8 +182,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
182
  - !ruby/object:Gem::Version
168
183
  version: '0'
169
184
  requirements: []
170
- rubygems_version: 3.0.6
171
- signing_key:
185
+ rubygems_version: 3.5.18
186
+ signing_key:
172
187
  specification_version: 4
173
188
  summary: ruby_to_c translates a static ruby subset to C
174
189
  test_files: []
metadata.gz.sig CHANGED
Binary file