ruby2c 1.0.0.9 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,117 +1,125 @@
1
1
  #!/usr/local/bin/ruby -w
2
2
 
3
3
  require 'minitest/autorun' if $0 == __FILE__
4
- require 'test_sexp'
4
+ require 'test_sexp' # from sexp_processor for TestSexp
5
5
  require 'typed_sexp'
6
6
 
7
7
  class TestTypedSexp < TestSexp
8
8
  def setup
9
9
  super
10
- @sexp.sexp_type = Type.str
10
+ @sexp.c_type = CType.str
11
11
  end
12
12
 
13
- def test__set_sexp_type
14
- assert_equal Type.str, @sexp.sexp_type
15
- @sexp._set_sexp_type Type.bool
16
- assert_equal Type.bool, @sexp.sexp_type
13
+ def test__set_c_type
14
+ assert_equal CType.str, @sexp.c_type
15
+ @sexp._set_c_type CType.bool
16
+ assert_equal CType.bool, @sexp.c_type
17
17
  end
18
18
 
19
19
  def test_equals2_tsexp
20
20
  sexp2 = s(1, 2, 3)
21
- sexp3 = t(1, 2, 3, Type.str)
21
+ sexp3 = t(1, 2, 3, CType.str)
22
22
  assert_equal(@sexp, sexp3)
23
23
  refute_equal(@sexp, sexp2)
24
24
  end
25
25
 
26
26
  def test_equals_array_typed
27
27
  # can't use assert_equals because it uses array as receiver
28
- refute_equal(@sexp, [1, 2, 3, Type.str],
28
+ refute_equal(@sexp, [1, 2, 3, CType.str],
29
29
  "Sexp must not be equal to equivalent array")
30
30
  # both directions just in case
31
- refute_equal([1, 2, 3, Type.str], @sexp,
31
+ refute_equal([1, 2, 3, CType.str], @sexp,
32
32
  "Sexp must not be equal to equivalent array")
33
33
  end
34
34
 
35
35
  def test_equals_not_body_typed
36
36
  sexp2 = t(1, 2, 5)
37
- sexp2.sexp_type = Type.str
37
+ sexp2.c_type = CType.str
38
38
  refute_equal(@sexp, sexp2)
39
39
  end
40
40
 
41
41
  def test_equals_not_type
42
42
  sexp2 = t(1, 2, 3)
43
- sexp2.sexp_type = Type.long
43
+ sexp2.c_type = CType.long
44
44
  refute_equal(@sexp, sexp2)
45
45
  end
46
46
 
47
47
  def test_equals_sexp
48
- sexp2 = t(1, 2, 3, Type.str)
48
+ sexp2 = t(1, 2, 3, CType.str)
49
49
  assert_equal(@sexp, sexp2)
50
50
  end
51
51
 
52
- def test_equals_sexp_typed
52
+ def test_equals_c_typed
53
53
  sexp2 = t(1, 2, 3)
54
- sexp2.sexp_type = Type.str
54
+ sexp2.c_type = CType.str
55
55
  assert_equal(@sexp, sexp2)
56
56
  end
57
57
 
58
58
  def test_new_nested_typed
59
- @sexp = TypedSexp.new(:lasgn, "var", TypedSexp.new(:str, "foo", Type.str), Type.str)
59
+ @sexp = TypedSexp.new(:lasgn, "var", TypedSexp.new(:str, "foo", CType.str), CType.str)
60
60
  assert_equal('t(:lasgn, "var", t(:str, "foo", Type.str), Type.str)',
61
61
  @sexp.inspect)
62
62
  end
63
63
 
64
64
  def test_pretty_print_typed
65
- util_pretty_print("t(Type.str)",
66
- t(Type.str))
67
- util_pretty_print("t(:a, Type.long)",
68
- t(:a, Type.long))
69
- util_pretty_print("t(:a, :b, Type.long)",
70
- t(:a, :b, Type.long))
71
- util_pretty_print("t(:a, t(:b, Type.long), Type.str)",
72
- t(:a, t(:b, Type.long), Type.str))
65
+ assert_pretty_print("t(Type.str)",
66
+ t(CType.str))
67
+ assert_pretty_print("t(:a, Type.long)",
68
+ t(:a, CType.long))
69
+ assert_pretty_print("t(:a, :b, Type.long)",
70
+ t(:a, :b, CType.long))
71
+ assert_pretty_print("t(:a, t(:b, Type.long), Type.str)",
72
+ t(:a, t(:b, CType.long), CType.str))
73
73
  end
74
74
 
75
- def test_sexp_type
76
- assert_equal(Type.str, @sexp.sexp_type)
75
+ def test_c_type
76
+ assert_equal(CType.str, @sexp.c_type)
77
77
  end
78
78
 
79
- def test_sexp_type=
80
- assert_equal(Type.str, @sexp.sexp_type)
81
- # FIX: we can't set sexp_type a second time, please expand tests
82
- @sexp._set_sexp_type 24
83
- assert_equal(24, @sexp.sexp_type)
79
+ def test_c_type=
80
+ assert_equal(CType.str, @sexp.c_type)
81
+ # FIX: we can't set c_type a second time, please expand tests
82
+ @sexp._set_c_type 24
83
+ assert_equal(24, @sexp.c_type)
84
84
  end
85
85
 
86
- def test_sexp_type_array_hetero
87
- @sexp = t(:array, t(:lit, 1, Type.long),
88
- t(:str, "foo", Type.str))
89
- assert_equal(Type.hetero, @sexp.sexp_type)
90
- assert_equal([Type.long, Type.str], @sexp.sexp_types)
86
+ def test_c_type_array_hetero
87
+ @sexp = t(:array, t(:lit, 1, CType.long),
88
+ t(:str, "foo", CType.str))
89
+ assert_equal(CType.hetero, @sexp.c_type)
90
+ assert_equal([CType.long, CType.str], @sexp.c_types)
91
91
  end
92
92
 
93
- def test_sexp_type_array_homo
94
- @sexp = t(:array, t(:lit, 1, Type.long),
95
- t(:lit, 2, Type.long))
96
- assert_equal(Type.homo, @sexp.sexp_type)
97
- assert_equal([Type.long, Type.long], @sexp.sexp_types)
93
+ def test_c_type_array_homo
94
+ @sexp = t(:array, t(:lit, 1, CType.long),
95
+ t(:lit, 2, CType.long))
96
+ assert_equal(CType.homo, @sexp.c_type)
97
+ assert_equal([CType.long, CType.long], @sexp.c_types)
98
98
  end
99
99
 
100
- def test_sexp_type_array_nested
101
- @sexp = t(:array, t(:lit, 1, Type.long),
102
- t(:array, t(:lit, 1, Type.long)))
103
- assert_equal(Type.hetero, @sexp.sexp_type)
104
- assert_equal([Type.long, Type.homo], @sexp.sexp_types)
100
+ def test_c_type_array_nested
101
+ @sexp = t(:array, t(:lit, 1, CType.long),
102
+ t(:array, t(:lit, 1, CType.long)))
103
+ assert_equal(CType.hetero, @sexp.c_type)
104
+ assert_equal([CType.long, CType.homo], @sexp.c_types)
105
105
  end
106
106
 
107
- def test_sexp_types
107
+ def test_c_types
108
108
  assert_raises(RuntimeError) do
109
- @sexp.sexp_types
109
+ @sexp.c_types
110
110
  end
111
111
 
112
- @sexp = t(:array, t(:lit, 1, Type.long), t(:str, "blah", Type.str))
112
+ @sexp = t(:array, t(:lit, 1, CType.long), t(:str, "blah", CType.str))
113
113
 
114
- assert_equal([Type.long, Type.str], @sexp.sexp_types)
114
+ assert_equal([CType.long, CType.str], @sexp.c_types)
115
+ end
116
+
117
+ def test_sexp_body # override from TestSexp
118
+ assert_equal t(2, 3, CType.str), @sexp.sexp_body
119
+ assert_equal s(), s(:x).sexp_body
120
+ assert_equal s(), s().sexp_body
121
+
122
+ assert_instance_of Sexp, s().sexp_body
115
123
  end
116
124
 
117
125
  def test_to_a
@@ -120,19 +128,19 @@ class TestTypedSexp < TestSexp
120
128
  end
121
129
 
122
130
  def test_to_a_typed
123
- assert_equal([1, 2, 3, Type.str], @sexp.to_a)
131
+ assert_equal([1, 2, 3, CType.str], @sexp.to_a)
124
132
  end
125
133
 
126
134
  def test_to_s_typed
127
135
  k = @sexp_class
128
136
  n = k.name[0].chr.downcase
129
137
  assert_equal("#{n}(Type.long)",
130
- k.new(Type.long).inspect)
138
+ k.new(CType.long).inspect)
131
139
  assert_equal("#{n}(:a, Type.long)",
132
- k.new(:a, Type.long).inspect)
140
+ k.new(:a, CType.long).inspect)
133
141
  assert_equal("#{n}(:a, :b, Type.long)",
134
- k.new(:a, :b, Type.long).inspect)
142
+ k.new(:a, :b, CType.long).inspect)
135
143
  assert_equal("#{n}(:a, #{n}(:b, Type.long), Type.str)",
136
- k.new(:a, k.new(:b, Type.long), Type.str).inspect)
144
+ k.new(:a, k.new(:b, CType.long), CType.str).inspect)
137
145
  end
138
146
  end
data.tar.gz.sig CHANGED
@@ -1 +1,2 @@
1
- ���[�v@S��u��X)��0�����"Z�K4H,���!/�5�×с���|��� DX0�F�Ӫ�����`"2���);p������Cbx�K�T�j�ȴ,����.Sn*�7���y���{�|5t�"��E��P''a����U���+�ʮ��sޖFl��4I�����B�[� �qw�_������
1
+ j�� k���ƣ�lM���ֶv�_MŖ.�|$����r������C��4N%4�C48@���7Wa�������d��[ Pq #O֊,}���%�F�����'%�@��h"�4���u"Vw��Ŧ���T��^����]
2
+ ��|ʽ��u�0��}����V��g>�C��|1ΩGEx�0l�{bT�bqF�̋꘠i���~@L�$I�&�(i�L`�RGn�.��� KZ�P�`f�1��[jprCY�f�y
metadata CHANGED
@@ -1,26 +1,19 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ruby2c
3
- version: !ruby/object:Gem::Version
4
- hash: 77
5
- prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 0
10
- - 9
11
- version: 1.0.0.9
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.1
12
5
  platform: ruby
13
- authors:
6
+ authors:
14
7
  - Ryan Davis
15
8
  - Eric Hodel
16
- autorequire:
9
+ autorequire:
17
10
  bindir: bin
18
- cert_chain:
11
+ cert_chain:
19
12
  - |
20
13
  -----BEGIN CERTIFICATE-----
21
- MIIDPjCCAiagAwIBAgIBADANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
14
+ MIIDPjCCAiagAwIBAgIBBjANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
22
15
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
23
- GRYDY29tMB4XDTA5MDMwNjE4NTMxNVoXDTEwMDMwNjE4NTMxNVowRTETMBEGA1UE
16
+ GRYDY29tMB4XDTIxMTIyMzIzMTkwNFoXDTIyMTIyMzIzMTkwNFowRTETMBEGA1UE
24
17
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
25
18
  JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
26
19
  b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
@@ -29,120 +22,96 @@ cert_chain:
29
22
  GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9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:00:00 Z
42
- dependencies:
43
- - !ruby/object:Gem::Dependency
33
+ date: 2022-12-03 00:00:00.000000000 Z
34
+ dependencies:
35
+ - !ruby/object:Gem::Dependency
44
36
  name: ruby_parser
45
- prerelease: false
46
- requirement: &id001 !ruby/object:Gem::Requirement
47
- none: false
48
- requirements:
49
- - - ~>
50
- - !ruby/object:Gem::Version
51
- hash: 7
52
- segments:
53
- - 3
54
- - 0
55
- version: "3.0"
37
+ requirement: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '3.0'
56
42
  type: :runtime
57
- version_requirements: *id001
58
- - !ruby/object:Gem::Dependency
59
- name: sexp_processor
60
43
  prerelease: false
61
- requirement: &id002 !ruby/object:Gem::Requirement
62
- none: false
63
- requirements:
64
- - - ~>
65
- - !ruby/object:Gem::Version
66
- hash: 25
67
- segments:
68
- - 4
69
- - 1
70
- version: "4.1"
44
+ version_requirements: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '3.0'
49
+ - !ruby/object:Gem::Dependency
50
+ name: sexp_processor
51
+ requirement: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '4.1'
71
56
  type: :runtime
72
- version_requirements: *id002
73
- - !ruby/object:Gem::Dependency
74
- name: minitest
75
57
  prerelease: false
76
- requirement: &id003 !ruby/object:Gem::Requirement
77
- none: false
78
- requirements:
79
- - - ~>
80
- - !ruby/object:Gem::Version
81
- hash: 31
82
- segments:
83
- - 4
84
- - 2
85
- version: "4.2"
86
- type: :development
87
- version_requirements: *id003
88
- - !ruby/object:Gem::Dependency
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '4.1'
63
+ - !ruby/object:Gem::Dependency
89
64
  name: rdoc
90
- prerelease: false
91
- requirement: &id004 !ruby/object:Gem::Requirement
92
- none: false
93
- requirements:
94
- - - ~>
95
- - !ruby/object:Gem::Version
96
- hash: 19
97
- segments:
98
- - 3
99
- - 10
100
- version: "3.10"
65
+ requirement: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '4.0'
70
+ - - "<"
71
+ - !ruby/object:Gem::Version
72
+ version: '7'
101
73
  type: :development
102
- version_requirements: *id004
103
- - !ruby/object:Gem::Dependency
104
- name: hoe
105
74
  prerelease: false
106
- requirement: &id005 !ruby/object:Gem::Requirement
107
- none: false
108
- requirements:
109
- - - ~>
110
- - !ruby/object:Gem::Version
111
- hash: 3
112
- segments:
113
- - 3
114
- - 2
115
- version: "3.2"
75
+ version_requirements: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '4.0'
80
+ - - "<"
81
+ - !ruby/object:Gem::Version
82
+ version: '7'
83
+ - !ruby/object:Gem::Dependency
84
+ name: hoe
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.25'
116
90
  type: :development
117
- version_requirements: *id005
118
- description: |-
119
- ruby_to_c translates a static ruby subset to C. Hopefully it works.
120
-
121
- NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE
122
-
123
- THIS IS BETA SOFTWARE!
124
-
125
- NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE
126
-
127
- RubyToC has the following modules:
128
-
129
- * Rewriter - massages the sexp into a more consistent form.
130
- * TypeChecker - type inferencer for the above sexps.
131
- * RubyToRubyC - converts a ruby (subset) sexp to ruby interals C.
132
- * RubyToAnsiC - converts a ruby (subset) sexp to ANSI C.
133
- email:
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.25'
97
+ description: "ruby_to_c translates a static ruby subset to C. Hopefully it works.\n\n
98
+ \ NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE\n \n THIS
99
+ IS BETA SOFTWARE!\n \n NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE !
100
+ NOTE\n\nRubyToC has the following modules:\n\n* Rewriter - massages the sexp
101
+ into a more consistent form.\n* TypeChecker - type inferencer for the above sexps.\n*
102
+ RubyToRubyC - converts a ruby (subset) sexp to ruby interals C.\n* RubyToAnsiC
103
+ \ - converts a ruby (subset) sexp to ANSI C."
104
+ email:
134
105
  - ryand-ruby@zenspider.com
135
106
  - drbrain@segment7.net
136
107
  executables: []
137
-
138
108
  extensions: []
139
-
140
- extra_rdoc_files:
109
+ extra_rdoc_files:
141
110
  - History.txt
142
111
  - Manifest.txt
143
112
  - README.txt
144
- files:
145
- - .autotest
113
+ files:
114
+ - ".autotest"
146
115
  - History.txt
147
116
  - Manifest.txt
148
117
  - README.txt
@@ -177,51 +146,30 @@ files:
177
146
  - test/test_type.rb
178
147
  - test/test_type_checker.rb
179
148
  - test/test_typed_sexp.rb
180
- - .gemtest
181
149
  homepage: https://github.com/seattlerb/ruby_to_c
182
- licenses: []
183
-
184
- post_install_message:
185
- rdoc_options:
186
- - --main
150
+ licenses:
151
+ - MIT
152
+ metadata:
153
+ homepage_uri: https://github.com/seattlerb/ruby_to_c
154
+ post_install_message:
155
+ rdoc_options:
156
+ - "--main"
187
157
  - README.txt
188
- require_paths:
158
+ require_paths:
189
159
  - lib
190
- required_ruby_version: !ruby/object:Gem::Requirement
191
- none: false
192
- requirements:
160
+ required_ruby_version: !ruby/object:Gem::Requirement
161
+ requirements:
193
162
  - - ">="
194
- - !ruby/object:Gem::Version
195
- hash: 3
196
- segments:
197
- - 0
198
- version: "0"
199
- required_rubygems_version: !ruby/object:Gem::Requirement
200
- none: false
201
- requirements:
163
+ - !ruby/object:Gem::Version
164
+ version: '0'
165
+ required_rubygems_version: !ruby/object:Gem::Requirement
166
+ requirements:
202
167
  - - ">="
203
- - !ruby/object:Gem::Version
204
- hash: 3
205
- segments:
206
- - 0
207
- version: "0"
168
+ - !ruby/object:Gem::Version
169
+ version: '0'
208
170
  requirements: []
209
-
210
- rubyforge_project: ruby2c
211
- rubygems_version: 1.8.24
212
- signing_key:
213
- specification_version: 3
171
+ rubygems_version: 3.3.12
172
+ signing_key:
173
+ specification_version: 4
214
174
  summary: ruby_to_c translates a static ruby subset to C
215
- test_files:
216
- - test/test_crewriter.rb
217
- - test/test_extras.rb
218
- - test/test_function_table.rb
219
- - test/test_function_type.rb
220
- - test/test_handle.rb
221
- - test/test_r2cenvironment.rb
222
- - test/test_rewriter.rb
223
- - test/test_ruby_to_ansi_c.rb
224
- - test/test_ruby_to_ruby_c.rb
225
- - test/test_type.rb
226
- - test/test_type_checker.rb
227
- - test/test_typed_sexp.rb
175
+ test_files: []
metadata.gz.sig CHANGED
Binary file
data/.gemtest DELETED
File without changes