gogyou 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,52 @@
1
+ require "ffi"
2
+ require_relative "../gogyou"
3
+
4
+ module Gogyou
5
+ module Extensions
6
+ module FFI
7
+ module AbstractMemory
8
+ def to_address
9
+ to_i
10
+ end
11
+
12
+ alias to_ptr to_address
13
+
14
+ def bytesize
15
+ size
16
+ end
17
+
18
+ def setbinary(index, mem, offset = 0, size = mem.bytesize - offset)
19
+ offset = offset.to_i
20
+ size = size.to_i
21
+ size1 = mem.bytesize - offset
22
+ size = size1 if size > size1
23
+
24
+ if size > 0
25
+ put_bytes(index, mem.byteslice(offset, size))
26
+ end
27
+
28
+ self
29
+ end
30
+
31
+ def byteslice(index, size)
32
+ get_bytes(index, size)
33
+ end
34
+
35
+ def setbyte(o, n)
36
+ set_uint8(o, n)
37
+ end
38
+
39
+ def getbyte(o)
40
+ get_uint8(o)
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+
47
+ module FFI
48
+ class AbstractMemory
49
+ include Gogyou::Extensions::FFI::AbstractMemory
50
+ include Gogyou::Extensions::ByteArray
51
+ end
52
+ end
@@ -0,0 +1,53 @@
1
+ require "fiddle"
2
+ require_relative "../gogyou"
3
+
4
+ module Gogyou
5
+ module Extensions
6
+ module Fiddle
7
+ module Pointer
8
+ def to_address
9
+ to_i
10
+ end
11
+
12
+ alias to_ptr to_address
13
+
14
+ def bytesize
15
+ size
16
+ end
17
+
18
+ def setbinary(index, mem, offset = 0, size = mem.bytesize - offset)
19
+ offset = offset.to_i
20
+ size = size.to_i
21
+ size1 = mem.bytesize - offset
22
+ size = size1 if size > size1
23
+
24
+ if size > 0
25
+ self[index, size] = mem.byteslice(offset, size)
26
+ end
27
+
28
+ self
29
+ end
30
+
31
+ def byteslice(index, size)
32
+ return nil unless index < bytesize
33
+ self[index, size]
34
+ end
35
+
36
+ def setbyte(o, n)
37
+ self[o] = 0xff & n.to_i
38
+ end
39
+
40
+ def getbyte(o)
41
+ 0xff & self[o]
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ module Fiddle
49
+ class Pointer
50
+ include Gogyou::Extensions::Fiddle::Pointer
51
+ include Gogyou::Extensions::ByteArray
52
+ end
53
+ end
@@ -5,43 +5,43 @@
5
5
  require_relative "typespec"
6
6
 
7
7
  module Gogyou
8
- module Primitives
9
- class Primitive < ::Struct.new(:name, :bytesize, :bytealign)
10
- BasicStruct = superclass
8
+ class Primitive < ::Struct.new(:name, :bytesize, :bytealign)
9
+ BasicStruct = superclass
11
10
 
12
- undef :name=, :bytesize=, :bytealign=
11
+ undef :name=, :bytesize=, :bytealign=
13
12
 
14
- def initialize(name, bytesize, bytealign, aset, aref)
15
- super(name.intern, bytesize.to_i, bytealign.to_i)
16
- define_singleton_method(:aset, aset)
17
- define_singleton_method(:aref, aref)
18
- end
13
+ def initialize(name, bytesize, bytealign, aset, aref)
14
+ super(name.intern, bytesize.to_i, bytealign.to_i)
15
+ define_singleton_method(:aset, aset)
16
+ define_singleton_method(:aref, aref)
17
+ end
19
18
 
20
- def extensible?
21
- false
22
- end
19
+ def extensible?
20
+ false
21
+ end
23
22
 
24
- def to_s
25
- "\#<#{self.class}:#{name} bytesize=#{bytesize.inspect}, bytealign=#{bytealign.inspect}>"
26
- end
23
+ def to_s
24
+ "\#<#{self.class}:#{name} bytesize=#{bytesize.inspect}, bytealign=#{bytealign.inspect}>"
25
+ end
27
26
 
28
- alias inspect to_s
27
+ alias inspect to_s
29
28
 
30
- def pretty_print(q)
31
- #name, bytesize, bytealign
32
- q.group(1, "\#<#{self.class}:#{name}") do
33
- q.breakable " "
34
- q.text "bytesize="
35
- q.pp bytesize
36
- q.text ","
37
- q.breakable " "
38
- q.text "bytealign="
39
- q.pp bytealign
40
- end
41
- q.text ">"
29
+ def pretty_print(q)
30
+ #name, bytesize, bytealign
31
+ q.group(1, "\#<#{self.class}:#{name}") do
32
+ q.breakable " "
33
+ q.text "bytesize="
34
+ q.pp bytesize
35
+ q.text ","
36
+ q.breakable " "
37
+ q.text "bytealign="
38
+ q.pp bytealign
42
39
  end
40
+ q.text ">"
43
41
  end
42
+ end
44
43
 
44
+ module Primitives
45
45
  SIZE_T = Primitive[:size_t, TypeSpec::SIZEOF_SIZE_T, TypeSpec::SIZEOF_SIZE_T,
46
46
  ->(buf, offset, num) { buf.store_sizet(offset, num) },
47
47
  ->(buf, offset) { buf.load_sizet(offset) }].freeze
@@ -162,36 +162,36 @@ module Gogyou
162
162
  UCHAR = Primitive[:uchar, 1, 1,
163
163
  ->(buf, offset, num) { buf.store8(offset, num) },
164
164
  ->(buf, offset) { buf.loadu8(offset) }].freeze
165
- SHORT = Primitive[:short, 2, 2,
166
- ->(buf, offset, num) { buf.store16(offset, num) },
167
- ->(buf, offset) { buf.loadi16(offset) }].freeze
168
- USHORT = Primitive[:ushort, 2, 2,
169
- ->(buf, offset, num) { buf.store16(offset, num) },
170
- ->(buf, offset) { buf.loadu16(offset) }].freeze
171
- INT = Primitive[:int, 4, 4,
172
- ->(buf, offset, num) { buf.store32(offset, num) },
173
- ->(buf, offset) { buf.loadi32(offset) }].freeze
174
- UINT = Primitive[:uint, 4, 4,
175
- ->(buf, offset, num) { buf.store32(offset, num) },
176
- ->(buf, offset) { buf.loadu32(offset) }].freeze
165
+ SHORT = Primitive[:short, TypeSpec::SIZEOF_SHORT, TypeSpec::SIZEOF_SHORT,
166
+ ->(buf, offset, num) { buf.store_short(offset, num) },
167
+ ->(buf, offset) { buf.load_short(offset) }].freeze
168
+ USHORT = Primitive[:ushort, TypeSpec::SIZEOF_SHORT, TypeSpec::SIZEOF_SHORT,
169
+ ->(buf, offset, num) { buf.store_short(offset, num) },
170
+ ->(buf, offset) { buf.load_ushort(offset) }].freeze
171
+ INT = Primitive[:int, TypeSpec::SIZEOF_INT, TypeSpec::SIZEOF_INT,
172
+ ->(buf, offset, num) { buf.store_int(offset, num) },
173
+ ->(buf, offset) { buf.load_int(offset) }].freeze
174
+ UINT = Primitive[:uint, TypeSpec::SIZEOF_INT, TypeSpec::SIZEOF_INT,
175
+ ->(buf, offset, num) { buf.store_int(offset, num) },
176
+ ->(buf, offset) { buf.load_uint(offset) }].freeze
177
177
  LONG = Primitive[:long, TypeSpec::SIZEOF_LONG, TypeSpec::SIZEOF_LONG,
178
178
  ->(buf, offset, num) { buf.store_long(offset, num) },
179
179
  ->(buf, offset) { buf.load_long(offset) }].freeze
180
180
  ULONG = Primitive[:ulong, TypeSpec::SIZEOF_LONG, TypeSpec::SIZEOF_LONG,
181
181
  ->(buf, offset, num) { buf.store_long(offset, num) },
182
182
  ->(buf, offset) { buf.load_ulong(offset) }].freeze
183
- LONGLONG = Primitive[:longlong, 8, 8,
184
- ->(buf, offset, num) { buf.store64(offset, num) },
185
- ->(buf, offset) { buf.loadi64(offset) }].freeze
186
- ULONGLONG = Primitive[:ulonglong, 8, 8,
187
- ->(buf, offset, num) { buf.store64(offset, num) },
188
- ->(buf, offset) { buf.loadu64(offset) }].freeze
189
- FLOAT = Primitive[:float, 4, 4,
190
- ->(buf, offset, num) { buf.storef32(offset, num) },
191
- ->(buf, offset) { buf.loadf32(offset) }].freeze
192
- DOUBLE = Primitive[:double, 8, 8,
193
- ->(buf, offset, num) { buf.storef64(offset, num) },
194
- ->(buf, offset) { buf.loadf64(offset) }].freeze
183
+ LONGLONG = Primitive[:longlong, TypeSpec::SIZEOF_LONGLONG, TypeSpec::SIZEOF_LONGLONG,
184
+ ->(buf, offset, num) { buf.store_longlong(offset, num) },
185
+ ->(buf, offset) { buf.load_longlong(offset) }].freeze
186
+ ULONGLONG = Primitive[:ulonglong, TypeSpec::SIZEOF_LONGLONG, TypeSpec::SIZEOF_LONGLONG,
187
+ ->(buf, offset, num) { buf.store_longlong(offset, num) },
188
+ ->(buf, offset) { buf.load_ulonglong(offset) }].freeze
189
+ FLOAT = Primitive[:float, TypeSpec::SIZEOF_FLOAT, TypeSpec::SIZEOF_FLOAT,
190
+ ->(buf, offset, num) { buf.store_float(offset, num) },
191
+ ->(buf, offset) { buf.load_float(offset) }].freeze
192
+ DOUBLE = Primitive[:double, TypeSpec::SIZEOF_DOUBLE, TypeSpec::SIZEOF_DOUBLE,
193
+ ->(buf, offset, num) { buf.store_double(offset, num) },
194
+ ->(buf, offset) { buf.load_double(offset) }].freeze
195
195
  FLOAT_BE = Primitive[:float_be, 4, 4,
196
196
  ->(buf, offset, num) { buf.storef32be(offset, num) },
197
197
  ->(buf, offset) { buf.loadf32be(offset) }].freeze
@@ -210,5 +210,113 @@ module Gogyou
210
210
  DOUBLE_SWAP = Primitive[:double_swap, 8, 8,
211
211
  ->(buf, offset, num) { buf.storef64swap(offset, num) },
212
212
  ->(buf, offset) { buf.loadf64swap(offset) }].freeze
213
+ FLOAT16_T = Primitive[:float16_t, 2, 2,
214
+ ->(buf, offset, num) { buf.storef16(offset, num) },
215
+ ->(buf, offset) { buf.loadf16(offset) }].freeze
216
+ FLOAT16_SWAP = Primitive[:float16_swap, 2, 2,
217
+ ->(buf, offset, num) { buf.storef16swap(offset, num) },
218
+ ->(buf, offset) { buf.loadf16swap(offset) }].freeze
219
+ FLOAT16_BE = Primitive[:float16_be, 2, 2,
220
+ ->(buf, offset, num) { buf.storef16be(offset, num) },
221
+ ->(buf, offset) { buf.loadf16be(offset) }].freeze
222
+ FLOAT16_LE = Primitive[:float16_le, 2, 2,
223
+ ->(buf, offset, num) { buf.storef16le(offset, num) },
224
+ ->(buf, offset) { buf.loadf16le(offset) }].freeze
225
+ FLOAT32_T = Primitive[:float32_t, 4, 4,
226
+ ->(buf, offset, num) { buf.storef32(offset, num) },
227
+ ->(buf, offset) { buf.loadf32(offset) }].freeze
228
+ FLOAT32_SWAP = Primitive[:float32_swap, 4, 4,
229
+ ->(buf, offset, num) { buf.storef32swap(offset, num) },
230
+ ->(buf, offset) { buf.loadf32swap(offset) }].freeze
231
+ FLOAT32_BE = Primitive[:float32_be, 4, 4,
232
+ ->(buf, offset, num) { buf.storef32be(offset, num) },
233
+ ->(buf, offset) { buf.loadf32be(offset) }].freeze
234
+ FLOAT32_LE = Primitive[:float32_le, 4, 4,
235
+ ->(buf, offset, num) { buf.storef32le(offset, num) },
236
+ ->(buf, offset) { buf.loadf32le(offset) }].freeze
237
+ FLOAT64_T = Primitive[:float64_t, 8, 8,
238
+ ->(buf, offset, num) { buf.storef64(offset, num) },
239
+ ->(buf, offset) { buf.loadf64(offset) }].freeze
240
+ FLOAT64_SWAP = Primitive[:float64_swap, 8, 8,
241
+ ->(buf, offset, num) { buf.storef64swap(offset, num) },
242
+ ->(buf, offset) { buf.loadf64swap(offset) }].freeze
243
+ FLOAT64_BE = Primitive[:float64_be, 8, 8,
244
+ ->(buf, offset, num) { buf.storef64be(offset, num) },
245
+ ->(buf, offset) { buf.loadf64be(offset) }].freeze
246
+ FLOAT64_LE = Primitive[:float64_le, 8, 8,
247
+ ->(buf, offset, num) { buf.storef64le(offset, num) },
248
+ ->(buf, offset) { buf.loadf64le(offset) }].freeze
249
+ FIXED16Q8_T = Primitive[:fixed16q8_t, 2, 2,
250
+ ->(buf, offset, num) { buf.store16q8(offset, num) },
251
+ ->(buf, offset) { buf.loadi16q8(offset) }].freeze
252
+ FIXED16Q8_SWAP = Primitive[:fixed16q8_swap, 2, 2,
253
+ ->(buf, offset, num) { buf.store16q8swap(offset, num) },
254
+ ->(buf, offset) { buf.loadi16q8swap(offset) }].freeze
255
+ FIXED16Q8_BE = Primitive[:fixed16q8_be, 2, 2,
256
+ ->(buf, offset, num) { buf.store16q8be(offset, num) },
257
+ ->(buf, offset) { buf.loadi16q8be(offset) }].freeze
258
+ FIXED16Q8_LE = Primitive[:fixed16q8_le, 2, 2,
259
+ ->(buf, offset, num) { buf.store16q8le(offset, num) },
260
+ ->(buf, offset) { buf.loadi16q8le(offset) }].freeze
261
+ FIXED32Q6_T = Primitive[:fixed32q6_t, 4, 4,
262
+ ->(buf, offset, num) { buf.store32q6(offset, num) },
263
+ ->(buf, offset) { buf.loadi32q6(offset) }].freeze
264
+ FIXED32Q6_SWAP = Primitive[:fixed32q6_swap, 4, 4,
265
+ ->(buf, offset, num) { buf.store32q6swap(offset, num) },
266
+ ->(buf, offset) { buf.loadi32q6swap(offset) }].freeze
267
+ FIXED32Q6_BE = Primitive[:fixed32q6_be, 4, 4,
268
+ ->(buf, offset, num) { buf.store32q6be(offset, num) },
269
+ ->(buf, offset) { buf.loadi32q6be(offset) }].freeze
270
+ FIXED32Q6_LE = Primitive[:fixed32q6_le, 4, 4,
271
+ ->(buf, offset, num) { buf.store32q6le(offset, num) },
272
+ ->(buf, offset) { buf.loadi32q6le(offset) }].freeze
273
+ FIXED32Q8_T = Primitive[:fixed32q8_t, 4, 4,
274
+ ->(buf, offset, num) { buf.store32q8(offset, num) },
275
+ ->(buf, offset) { buf.loadi32q8(offset) }].freeze
276
+ FIXED32Q8_SWAP = Primitive[:fixed32q8_swap, 4, 4,
277
+ ->(buf, offset, num) { buf.store32q8swap(offset, num) },
278
+ ->(buf, offset) { buf.loadi32q8swap(offset) }].freeze
279
+ FIXED32Q8_BE = Primitive[:fixed32q8_be, 4, 4,
280
+ ->(buf, offset, num) { buf.store32q8be(offset, num) },
281
+ ->(buf, offset) { buf.loadi32q8be(offset) }].freeze
282
+ FIXED32Q8_LE = Primitive[:fixed32q8_le, 4, 4,
283
+ ->(buf, offset, num) { buf.store32q8le(offset, num) },
284
+ ->(buf, offset) { buf.loadi32q8le(offset) }].freeze
285
+ FIXED32Q12_T = Primitive[:fixed32q12_t, 4, 4,
286
+ ->(buf, offset, num) { buf.store32q12(offset, num) },
287
+ ->(buf, offset) { buf.loadi32q12(offset) }].freeze
288
+ FIXED32Q12_SWAP = Primitive[:fixed32q12_swap, 4, 4,
289
+ ->(buf, offset, num) { buf.store32q12swap(offset, num) },
290
+ ->(buf, offset) { buf.loadi32q12swap(offset) }].freeze
291
+ FIXED32Q12_BE = Primitive[:fixed32q12_be, 4, 4,
292
+ ->(buf, offset, num) { buf.store32q12be(offset, num) },
293
+ ->(buf, offset) { buf.loadi32q12be(offset) }].freeze
294
+ FIXED32Q12_LE = Primitive[:fixed32q12_le, 4, 4,
295
+ ->(buf, offset, num) { buf.store32q12le(offset, num) },
296
+ ->(buf, offset) { buf.loadi32q12le(offset) }].freeze
297
+ FIXED32Q16_T = Primitive[:fixed32q16_t, 4, 4,
298
+ ->(buf, offset, num) { buf.store32q16(offset, num) },
299
+ ->(buf, offset) { buf.loadi32q16(offset) }].freeze
300
+ FIXED32Q16_SWAP = Primitive[:fixed32q16_swap, 4, 4,
301
+ ->(buf, offset, num) { buf.store32q16swap(offset, num) },
302
+ ->(buf, offset) { buf.loadi32q16swap(offset) }].freeze
303
+ FIXED32Q16_BE = Primitive[:fixed32q16_be, 4, 4,
304
+ ->(buf, offset, num) { buf.store32q16be(offset, num) },
305
+ ->(buf, offset) { buf.loadi32q16be(offset) }].freeze
306
+ FIXED32Q16_LE = Primitive[:fixed32q16_le, 4, 4,
307
+ ->(buf, offset, num) { buf.store32q16le(offset, num) },
308
+ ->(buf, offset) { buf.loadi32q16le(offset) }].freeze
309
+ FIXED32Q24_T = Primitive[:fixed32q24_t, 4, 4,
310
+ ->(buf, offset, num) { buf.store32q24(offset, num) },
311
+ ->(buf, offset) { buf.loadi32q24(offset) }].freeze
312
+ FIXED32Q24_SWAP = Primitive[:fixed32q24_swap, 4, 4,
313
+ ->(buf, offset, num) { buf.store32q24swap(offset, num) },
314
+ ->(buf, offset) { buf.loadi32q24swap(offset) }].freeze
315
+ FIXED32Q24_BE = Primitive[:fixed32q24_be, 4, 4,
316
+ ->(buf, offset, num) { buf.store32q24be(offset, num) },
317
+ ->(buf, offset) { buf.loadi32q24be(offset) }].freeze
318
+ FIXED32Q24_LE = Primitive[:fixed32q24_le, 4, 4,
319
+ ->(buf, offset, num) { buf.store32q24le(offset, num) },
320
+ ->(buf, offset) { buf.loadi32q24le(offset) }].freeze
213
321
  end
214
322
  end
@@ -4,7 +4,7 @@ module Gogyou
4
4
  SIZEOF_SHORT = [0].pack("S!").bytesize
5
5
  SIZEOF_INT = [0].pack("I!").bytesize
6
6
  SIZEOF_LONG = [0].pack("L!").bytesize
7
- SIZEOF_LONGLONG = [0].pack("Q!").bytesize
7
+ SIZEOF_LONGLONG = [0].pack("Q").bytesize
8
8
  SIZEOF_SIZE_T = [nil].pack("P").bytesize
9
9
  SIZEOF_FLOAT = [0].pack("F").bytesize
10
10
  SIZEOF_DOUBLE = [0].pack("D").bytesize
@@ -1,3 +1,3 @@
1
1
  module Gogyou
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
data/mkprims.rb CHANGED
@@ -44,22 +44,58 @@ int64_swap 8 8 store64swap loadi64swap
44
44
  uint64_swap 8 8 store64swap loadu64swap
45
45
  char 1 1 store8 loadi8
46
46
  uchar 1 1 store8 loadu8
47
- short 2 2 store16 loadi16
48
- ushort 2 2 store16 loadu16
49
- int 4 4 store32 loadi32
50
- uint 4 4 store32 loadu32
51
- long TypeSpec::SIZEOF_LONG TypeSpec::SIZEOF_LONG store_long load_long
52
- ulong TypeSpec::SIZEOF_LONG TypeSpec::SIZEOF_LONG store_long load_ulong
53
- longlong 8 8 store64 loadi64
54
- ulonglong 8 8 store64 loadu64
55
- float 4 4 storef32 loadf32
56
- double 8 8 storef64 loadf64
47
+ short TypeSpec::SIZEOF_SHORT TypeSpec::SIZEOF_SHORT store_short load_short
48
+ ushort TypeSpec::SIZEOF_SHORT TypeSpec::SIZEOF_SHORT store_short load_ushort
49
+ int TypeSpec::SIZEOF_INT TypeSpec::SIZEOF_INT store_int load_int
50
+ uint TypeSpec::SIZEOF_INT TypeSpec::SIZEOF_INT store_int load_uint
51
+ long TypeSpec::SIZEOF_LONG TypeSpec::SIZEOF_LONG store_long load_long
52
+ ulong TypeSpec::SIZEOF_LONG TypeSpec::SIZEOF_LONG store_long load_ulong
53
+ longlong TypeSpec::SIZEOF_LONGLONG TypeSpec::SIZEOF_LONGLONG store_longlong load_longlong
54
+ ulonglong TypeSpec::SIZEOF_LONGLONG TypeSpec::SIZEOF_LONGLONG store_longlong load_ulonglong
55
+ float TypeSpec::SIZEOF_FLOAT TypeSpec::SIZEOF_FLOAT store_float load_float
56
+ double TypeSpec::SIZEOF_DOUBLE TypeSpec::SIZEOF_DOUBLE store_double load_double
57
57
  float_be 4 4 storef32be loadf32be
58
58
  double_be 8 8 storef64be loadf64be
59
59
  float_le 4 4 storef32le loadf32le
60
60
  double_le 8 8 storef64le loadf64le
61
61
  float_swap 4 4 storef32swap loadf32swap
62
62
  double_swap 8 8 storef64swap loadf64swap
63
+ float16_t 2 2 storef16 loadf16
64
+ float16_swap 2 2 storef16swap loadf16swap
65
+ float16_be 2 2 storef16be loadf16be
66
+ float16_le 2 2 storef16le loadf16le
67
+ float32_t 4 4 storef32 loadf32
68
+ float32_swap 4 4 storef32swap loadf32swap
69
+ float32_be 4 4 storef32be loadf32be
70
+ float32_le 4 4 storef32le loadf32le
71
+ float64_t 8 8 storef64 loadf64
72
+ float64_swap 8 8 storef64swap loadf64swap
73
+ float64_be 8 8 storef64be loadf64be
74
+ float64_le 8 8 storef64le loadf64le
75
+ fixed16q8_t 2 2 store16q8 loadi16q8
76
+ fixed16q8_swap 2 2 store16q8swap loadi16q8swap
77
+ fixed16q8_be 2 2 store16q8be loadi16q8be
78
+ fixed16q8_le 2 2 store16q8le loadi16q8le
79
+ fixed32q6_t 4 4 store32q6 loadi32q6
80
+ fixed32q6_swap 4 4 store32q6swap loadi32q6swap
81
+ fixed32q6_be 4 4 store32q6be loadi32q6be
82
+ fixed32q6_le 4 4 store32q6le loadi32q6le
83
+ fixed32q8_t 4 4 store32q8 loadi32q8
84
+ fixed32q8_swap 4 4 store32q8swap loadi32q8swap
85
+ fixed32q8_be 4 4 store32q8be loadi32q8be
86
+ fixed32q8_le 4 4 store32q8le loadi32q8le
87
+ fixed32q12_t 4 4 store32q12 loadi32q12
88
+ fixed32q12_swap 4 4 store32q12swap loadi32q12swap
89
+ fixed32q12_be 4 4 store32q12be loadi32q12be
90
+ fixed32q12_le 4 4 store32q12le loadi32q12le
91
+ fixed32q16_t 4 4 store32q16 loadi32q16
92
+ fixed32q16_swap 4 4 store32q16swap loadi32q16swap
93
+ fixed32q16_be 4 4 store32q16be loadi32q16be
94
+ fixed32q16_le 4 4 store32q16le loadi32q16le
95
+ fixed32q24_t 4 4 store32q24 loadi32q24
96
+ fixed32q24_swap 4 4 store32q24swap loadi32q24swap
97
+ fixed32q24_be 4 4 store32q24be loadi32q24be
98
+ fixed32q24_le 4 4 store32q24le loadi32q24le
63
99
  EOS
64
100
 
65
101
  File.open(path, "wb") do |f|
@@ -71,43 +107,43 @@ File.open(path, "wb") do |f|
71
107
  require_relative "typespec"
72
108
 
73
109
  module Gogyou
74
- module Primitives
75
- class Primitive < ::Struct.new(:name, :bytesize, :bytealign)
76
- BasicStruct = superclass
110
+ class Primitive < ::Struct.new(:name, :bytesize, :bytealign)
111
+ BasicStruct = superclass
77
112
 
78
- undef :name=, :bytesize=, :bytealign=
113
+ undef :name=, :bytesize=, :bytealign=
79
114
 
80
- def initialize(name, bytesize, bytealign, aset, aref)
81
- super(name.intern, bytesize.to_i, bytealign.to_i)
82
- define_singleton_method(:aset, aset)
83
- define_singleton_method(:aref, aref)
84
- end
115
+ def initialize(name, bytesize, bytealign, aset, aref)
116
+ super(name.intern, bytesize.to_i, bytealign.to_i)
117
+ define_singleton_method(:aset, aset)
118
+ define_singleton_method(:aref, aref)
119
+ end
85
120
 
86
- def extensible?
87
- false
88
- end
121
+ def extensible?
122
+ false
123
+ end
89
124
 
90
- def to_s
91
- "\\\#<\#{self.class}:\#{name} bytesize=\#{bytesize.inspect}, bytealign=\#{bytealign.inspect}>"
92
- end
125
+ def to_s
126
+ "\\\#<\#{self.class}:\#{name} bytesize=\#{bytesize.inspect}, bytealign=\#{bytealign.inspect}>"
127
+ end
93
128
 
94
- alias inspect to_s
129
+ alias inspect to_s
95
130
 
96
- def pretty_print(q)
97
- #name, bytesize, bytealign
98
- q.group(1, "\\\#<\#{self.class}:\#{name}") do
99
- q.breakable " "
100
- q.text "bytesize="
101
- q.pp bytesize
102
- q.text ","
103
- q.breakable " "
104
- q.text "bytealign="
105
- q.pp bytealign
106
- end
107
- q.text ">"
131
+ def pretty_print(q)
132
+ #name, bytesize, bytealign
133
+ q.group(1, "\\\#<\#{self.class}:\#{name}") do
134
+ q.breakable " "
135
+ q.text "bytesize="
136
+ q.pp bytesize
137
+ q.text ","
138
+ q.breakable " "
139
+ q.text "bytealign="
140
+ q.pp bytealign
108
141
  end
142
+ q.text ">"
109
143
  end
144
+ end
110
145
 
146
+ module Primitives
111
147
  EOS
112
148
 
113
149
  records = records.split(/\n/)