ridl 2.9.0 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.rdoc +8 -7
- data/lib/ridl/delegate.rb +81 -4
- data/lib/ridl/expression.rb +3 -1
- data/lib/ridl/node.rb +285 -8
- data/lib/ridl/options.rb +1 -1
- data/lib/ridl/parser.rb +1922 -1446
- data/lib/ridl/parser.ry +66 -9
- data/lib/ridl/runner.rb +9 -2
- data/lib/ridl/scanner.rb +64 -63
- data/lib/ridl/type.rb +133 -2
- data/lib/ridl/version.rb +1 -1
- metadata +5 -6
- data/lib/ridl/parser.diff +0 -42
data/lib/ridl/parser.ry
CHANGED
@@ -521,6 +521,8 @@ rule
|
|
521
521
|
| union_forward_dcl
|
522
522
|
| enum_type
|
523
523
|
| "native" native_declarator
|
524
|
+
| bitmask_type
|
525
|
+
| bitset_type
|
524
526
|
|
525
527
|
type_declarator : type_spec declarators
|
526
528
|
{
|
@@ -551,10 +553,13 @@ rule
|
|
551
553
|
| string_type
|
552
554
|
| wide_string_type
|
553
555
|
| fixed_pt_type
|
556
|
+
| map_type
|
554
557
|
|
555
558
|
constr_type_spec : struct_type
|
556
559
|
| union_type
|
557
560
|
| enum_type
|
561
|
+
| bitmask_type
|
562
|
+
| bitset_type
|
558
563
|
|
559
564
|
declarators : declarator { [val[0]] }
|
560
565
|
| declarators "," declarator { val[0] << val[2] }
|
@@ -578,23 +583,34 @@ rule
|
|
578
583
|
signed_int : signed_short_int
|
579
584
|
| signed_long_int
|
580
585
|
| signed_longlong_int
|
586
|
+
| tiny_short_int
|
587
|
+
|
588
|
+
tiny_short_int : "int8" { if @idlversion < 4 then raise "int8 is only supported with IDL4 or newer" else ::IDL::Type::TinyShort.new end }
|
581
589
|
|
582
590
|
signed_short_int : "short" { ::IDL::Type::Short.new }
|
591
|
+
| "int16" { if @idlversion < 4 then raise "int16 is only supported with IDL4 or newer" else ::IDL::Type::Short.new end }
|
583
592
|
|
584
|
-
signed_long_int : "long"
|
593
|
+
signed_long_int : "long" { ::IDL::Type::Long.new }
|
594
|
+
| "int32" { if @idlversion < 4 then raise "int32 is only supported with IDL4 or newer" else ::IDL::Type::Long.new end }
|
585
595
|
|
586
596
|
signed_longlong_int : "long" "long" { ::IDL::Type::LongLong.new }
|
597
|
+
| "int64" { if @idlversion < 4 then raise "int64 is only supported with IDL4 or newer" else ::IDL::Type::LongLong.new end }
|
587
598
|
|
588
599
|
unsigned_int : unsigned_short_int
|
589
600
|
| unsigned_long_int
|
590
601
|
| unsigned_longlong_int
|
602
|
+
| unsigned_tiny_short_int
|
603
|
+
|
604
|
+
unsigned_tiny_short_int : "uint8" { if @idlversion < 4 then raise "uint8 is only supported with IDL4 or newer" else ::IDL::Type::UTinyShort.new end }
|
591
605
|
|
592
606
|
unsigned_short_int : "unsigned" "short" { ::IDL::Type::UShort.new }
|
607
|
+
| "uint16" { if @idlversion < 4 then raise "uint16 is only supported with IDL4 or newer" else ::IDL::Type::UShort.new end }
|
593
608
|
|
594
609
|
unsigned_long_int : "unsigned" "long" { ::IDL::Type::ULong.new }
|
610
|
+
| "uint32" { if @idlversion < 4 then raise "uint32 is only supported with IDL4 or newer" else ::IDL::Type::ULong.new end }
|
595
611
|
|
596
|
-
unsigned_longlong_int : "unsigned" "long" "long"
|
597
|
-
|
612
|
+
unsigned_longlong_int : "unsigned" "long" "long" { ::IDL::Type::ULongLong.new }
|
613
|
+
| "uint64" { if @idlversion < 4 then raise "uint64 is only supported with IDL4 or newer" else ::IDL::Type::ULongLong.new end }
|
598
614
|
|
599
615
|
char_type : "char" { ::IDL::Type::Char.new }
|
600
616
|
|
@@ -610,13 +626,15 @@ rule
|
|
610
626
|
|
611
627
|
struct_forward_dcl : struct_def identifier { @d.declare_struct(val[1]) }
|
612
628
|
|
613
|
-
struct_type : struct_header "{" member_list "}"
|
614
|
-
|
629
|
+
struct_type : struct_header "{" member_list "}" { @d.end_struct(val[0]) }
|
630
|
+
| struct_header "{" "}" { if @idlversion < 4 then raise "empty struct is only supported with IDL4 or newer" else @d.end_struct(val[0]) end }
|
615
631
|
|
616
|
-
struct_header : struct_def identifier
|
632
|
+
struct_header : struct_def identifier { @d.define_struct(val[1]) }
|
633
|
+
| struct_def identifier ":" struct_inheritance_spec { if @idlversion < 4 then raise "struct inheritance is only supported with IDL4 or newer" else @d.define_struct(val[1], val[3]) end }
|
617
634
|
|
618
635
|
struct_def : "struct" { nil }
|
619
636
|
|
637
|
+
struct_inheritance_spec : scoped_name
|
620
638
|
|
621
639
|
member_list : member
|
622
640
|
| member_list member
|
@@ -651,6 +669,8 @@ rule
|
|
651
669
|
| boolean_type
|
652
670
|
| enum_type
|
653
671
|
| scoped_name
|
672
|
+
| octet_type { if @idlversion < 4 then raise "union with octect discriminator type is only supported with IDL4 or newer" else ::IDL::Type::Octet.new end }
|
673
|
+
| wide_char_type { if @idlversion < 4 then raise "union with octect discriminator type is only supported with IDL4 or newer" else ::IDL::Type::WChar.new end }
|
654
674
|
|
655
675
|
union_body : union_case
|
656
676
|
| union_body union_case
|
@@ -672,14 +692,45 @@ rule
|
|
672
692
|
element_spec : type_spec declarator
|
673
693
|
{ val }
|
674
694
|
|
675
|
-
|
676
|
-
|
695
|
+
bitmask_type : bitmask_header bitmask_body { @d.end_bitmask(val[0]) }
|
696
|
+
|
697
|
+
bitmask_header : "bitmask" identifier { @d.define_bitmask(val[1]) }
|
698
|
+
|
699
|
+
bitmask_body : "{" bitmask_list "}"
|
700
|
+
|
701
|
+
bitmask_list : bit_value
|
702
|
+
| bitmask_list "," bit_value
|
703
|
+
|
704
|
+
bit_value : identifier { @d.declare_bitvalue (val[0]) }
|
705
|
+
|
706
|
+
bitset_type : bitset_header bitset_body { @d.end_bitset(val[0]) }
|
707
|
+
|
708
|
+
bitset_header : "bitset" identifier ":" bitset_inheritance_spec { @d.define_bitset(val[1], val[3]) }
|
709
|
+
| "bitset" identifier { @d.define_bitset(val[1]) }
|
710
|
+
|
711
|
+
bitset_inheritance_spec : scoped_name
|
712
|
+
|
713
|
+
bitset_body : "{" bitfield_list "}"
|
714
|
+
|
715
|
+
bitfield_list : bitset_field ";"
|
716
|
+
| bitfield_list bitset_field ";"
|
717
|
+
|
718
|
+
bitset_field : "bitfield" "<" positive_int_const ">" identifier { @d.declare_bitfield(val[4], val[2], nil) }
|
719
|
+
| "bitfield" "<" positive_int_const "," bitfield_destination_type ">" identifier { @d.declare_bitfield(val[6], val[2], val[4]) }
|
720
|
+
| "bitfield" "<" positive_int_const ">" { @d.declare_bitfield(nil, val[2], nil) }
|
721
|
+
| "bitfield" "<" positive_int_const "," bitfield_destination_type ">" { @d.declare_bitfield(nil, val[2], val[4]) }
|
722
|
+
|
723
|
+
bitfield_destination_type : boolean_type
|
724
|
+
| octet_type
|
725
|
+
| integer_type
|
726
|
+
|
727
|
+
enum_type : _enum_header _enum_body { @d.end_enum(val[0]) }
|
677
728
|
|
678
729
|
_enum_header : "enum" identifier { @d.define_enum(val[1]) }
|
679
730
|
_enum_body : "{" _enumerator_list "}"
|
680
731
|
|
681
732
|
_enumerator_list : enumerator
|
682
|
-
| _enumerator_list ","
|
733
|
+
| _enumerator_list "," enumerator
|
683
734
|
|
684
735
|
enumerator : identifier
|
685
736
|
{
|
@@ -691,6 +742,11 @@ rule
|
|
691
742
|
| "sequence" "<" simple_type_spec ">"
|
692
743
|
{ ::IDL::Type::Sequence.new(val[2], nil) }
|
693
744
|
|
745
|
+
map_type : "map" "<" simple_type_spec "," simple_type_spec "," positive_int_const ">"
|
746
|
+
{ if @idlversion < 4 then raise "int8 is only supported with IDL4 or newer" else ::IDL::Type::Map.new(val[2], val[4], val[6]) end }
|
747
|
+
| "map" "<" simple_type_spec "," simple_type_spec ">"
|
748
|
+
{ if @idlversion < 4 then raise "int8 is only supported with IDL4 or newer" else ::IDL::Type::Map.new(val[2], val[4], nil) end }
|
749
|
+
|
694
750
|
string_type : "string" "<" positive_int_const ">"
|
695
751
|
{ ::IDL::Type::String.new(val[2]) }
|
696
752
|
| "string"
|
@@ -849,6 +905,7 @@ attr_accessor :yydebug
|
|
849
905
|
def initialize(params = {})
|
850
906
|
@d = ::IDL::Delegator.new(params)
|
851
907
|
@params = params
|
908
|
+
@idlversion = params[:idlversion]
|
852
909
|
end
|
853
910
|
|
854
911
|
alias on_error0 on_error
|
data/lib/ridl/runner.rb
CHANGED
@@ -28,7 +28,8 @@ module IDL
|
|
28
28
|
search_incpath: false,
|
29
29
|
backend: nil,
|
30
30
|
macros: {
|
31
|
-
}
|
31
|
+
},
|
32
|
+
idlversion: 3
|
32
33
|
})
|
33
34
|
CORE_OPTIONS = OPTIONS.keys
|
34
35
|
|
@@ -91,7 +92,8 @@ module IDL
|
|
91
92
|
macros: options[:macros].merge({
|
92
93
|
__RIDL__: "#{RIDL_VERSION}",
|
93
94
|
__RIDLBE__: @backend.name.to_s,
|
94
|
-
__RIDLBE_VER__: @backend.version
|
95
|
+
__RIDLBE_VER__: @backend.version,
|
96
|
+
__RIDL_IDL_VERSION__: options[:idlversion].to_s
|
95
97
|
})
|
96
98
|
})
|
97
99
|
@optparser = init_optparser
|
@@ -365,6 +367,11 @@ module IDL
|
|
365
367
|
'Default: off') { |_|
|
366
368
|
self.options[:debug] = true
|
367
369
|
}
|
370
|
+
opts.on('--idl-version=VERSION', Integer,
|
371
|
+
'Set IDL version (3|4)',
|
372
|
+
'Default: 3') { |v|
|
373
|
+
self.options[:idlversion] = v
|
374
|
+
}
|
368
375
|
opts.on('--search-includepath',
|
369
376
|
'Use include paths to find main IDL source.',
|
370
377
|
'Default: off') { |_|
|
data/lib/ridl/scanner.rb
CHANGED
@@ -83,13 +83,6 @@ module IDL
|
|
83
83
|
else
|
84
84
|
@pos.column += 1
|
85
85
|
end
|
86
|
-
|
87
|
-
if false
|
88
|
-
if not @bwd.nil? or cur.nil? or @fwd.nil?
|
89
|
-
printf("%c(%02x), %c(%02x), %c(%02x) @(l:%d,c:%d)\n",
|
90
|
-
@bwd, @bwd, cur, cur, @fwd, @fwd, @pos.line, @pos.column)
|
91
|
-
end
|
92
|
-
end
|
93
86
|
@bwd = cur
|
94
87
|
end
|
95
88
|
|
@@ -221,10 +214,67 @@ module IDL
|
|
221
214
|
end
|
222
215
|
end
|
223
216
|
|
217
|
+
LFCR = [ ("\n"), ("\r") ]
|
218
|
+
SPACES = [ ("\ "), ("\t") ]
|
219
|
+
WHITESPACE = SPACES + LFCR
|
220
|
+
|
221
|
+
ANNOTATION = '@'
|
222
|
+
ANNOTATION_STR = '@'
|
223
|
+
|
224
|
+
BREAKCHARS = [
|
225
|
+
'(', ')', '[', ']', '{', '}',
|
226
|
+
'^', '~',
|
227
|
+
'*', '%', '&', '|',
|
228
|
+
'<', '=', '>',
|
229
|
+
',', ';' ]
|
230
|
+
|
231
|
+
SHIFTCHARS = [ '<', '>' ]
|
232
|
+
|
233
|
+
DIGITS = ('0'..'9').to_a
|
234
|
+
ALPHA_LC = ('a'..'z').to_a
|
235
|
+
ALPHA_UC = ('A'..'Z').to_a
|
236
|
+
OCTALS = ('0'..'7').to_a
|
237
|
+
HEXCHARS = DIGITS + ('a'..'f').to_a + ('A'..'F').to_a
|
238
|
+
SIGNS = ['-', '+']
|
239
|
+
DOT = '.'
|
240
|
+
|
241
|
+
IDCHARS = ['_' ] + ALPHA_LC + ALPHA_UC
|
242
|
+
FULL_IDCHARS = IDCHARS + DIGITS
|
243
|
+
|
244
|
+
ESCTBL = CharRegistry.new({
|
245
|
+
n: "\n", t: "\t", v: "\v", b: "\b",
|
246
|
+
r: "\r", f: "\f", a: "\a"
|
247
|
+
})
|
248
|
+
|
249
|
+
KEYWORDS = %w(
|
250
|
+
abstract alias any attribute boolean case char component connector const consumes context custom default double
|
251
|
+
exception emits enum eventtype factory FALSE finder fixed float getraises home import in inout interface local
|
252
|
+
long manages mirrorport module multiple native Object octet oneway out port porttype primarykey private provides
|
253
|
+
public publishes raises readonly setraises sequence short string struct supports switch TRUE truncatable typedef
|
254
|
+
typeid typename typeprefix unsigned union uses ValueBase valuetype void wchar wstring
|
255
|
+
).inject(TokenRegistry.new) { |h, a| h[a.downcase.to_sym] = a
|
256
|
+
h }
|
257
|
+
|
258
|
+
LITERALS = [
|
259
|
+
:integer_literal,
|
260
|
+
:string_literal,
|
261
|
+
# :wide_string_literal,
|
262
|
+
:character_literal,
|
263
|
+
# :wide_character_literal,
|
264
|
+
:fixed_pt_literal,
|
265
|
+
:floating_pt_literal,
|
266
|
+
:boolean_literal]
|
267
|
+
|
268
|
+
BOOL_LITERALS = {
|
269
|
+
false: false,
|
270
|
+
true: true
|
271
|
+
}
|
272
|
+
|
224
273
|
# Scanner
|
225
274
|
def initialize(src, directiver, params = {})
|
226
275
|
@includepaths = params[:includepaths] || []
|
227
276
|
@xincludepaths = params[:xincludepaths] || []
|
277
|
+
@idlversion = params[:idlversion]
|
228
278
|
@stack = []
|
229
279
|
@expansions = []
|
230
280
|
@prefix = nil
|
@@ -258,6 +308,13 @@ module IDL
|
|
258
308
|
@in = In.new(i, nm)
|
259
309
|
@scan_comment = false # true if parsing commented annotation
|
260
310
|
@in_annotation = false # true if parsing annotation
|
311
|
+
|
312
|
+
# Extend the IDL keywords with IDL4 when enabled
|
313
|
+
if @idlversion >= 4
|
314
|
+
%w(bitfield bitmask bitset map int8 int16 int32 int64 uint8 uint16 uint32 uint64
|
315
|
+
).inject(KEYWORDS) { |h, a| h[a.downcase.to_sym] = a
|
316
|
+
h }
|
317
|
+
end
|
261
318
|
end
|
262
319
|
|
263
320
|
def find_include(fname, all = true)
|
@@ -359,62 +416,6 @@ module IDL
|
|
359
416
|
raise e
|
360
417
|
end
|
361
418
|
|
362
|
-
LFCR = [ ("\n"), ("\r") ]
|
363
|
-
SPACES = [ ("\ "), ("\t") ]
|
364
|
-
WHITESPACE = SPACES + LFCR
|
365
|
-
|
366
|
-
ANNOTATION = '@'
|
367
|
-
ANNOTATION_STR = '@'
|
368
|
-
|
369
|
-
BREAKCHARS = [
|
370
|
-
'(', ')', '[', ']', '{', '}',
|
371
|
-
'^', '~',
|
372
|
-
'*', '%', '&', '|',
|
373
|
-
'<', '=', '>',
|
374
|
-
',', ';' ]
|
375
|
-
|
376
|
-
SHIFTCHARS = [ '<', '>' ]
|
377
|
-
|
378
|
-
DIGITS = ('0'..'9').to_a
|
379
|
-
ALPHA_LC = ('a'..'z').to_a
|
380
|
-
ALPHA_UC = ('A'..'Z').to_a
|
381
|
-
OCTALS = ('0'..'7').to_a
|
382
|
-
HEXCHARS = DIGITS + ('a'..'f').to_a + ('A'..'F').to_a
|
383
|
-
SIGNS = ['-', '+']
|
384
|
-
DOT = '.'
|
385
|
-
|
386
|
-
IDCHARS = ['_' ] + ALPHA_LC + ALPHA_UC
|
387
|
-
FULL_IDCHARS = IDCHARS + DIGITS
|
388
|
-
|
389
|
-
ESCTBL = CharRegistry.new({
|
390
|
-
n: "\n", t: "\t", v: "\v", b: "\b",
|
391
|
-
r: "\r", f: "\f", a: "\a"
|
392
|
-
})
|
393
|
-
|
394
|
-
KEYWORDS = %w(
|
395
|
-
abstract alias any attribute boolean case char component connector const consumes context custom default double
|
396
|
-
exception emits enum eventtype factory FALSE finder fixed float getraises home import in inout interface local
|
397
|
-
long manages mirrorport module multiple native Object octet oneway out port porttype primarykey private provides
|
398
|
-
public publishes raises readonly setraises sequence short string struct supports switch TRUE truncatable typedef
|
399
|
-
typeid typename typeprefix unsigned union uses ValueBase valuetype void wchar wstring
|
400
|
-
).inject(TokenRegistry.new) { |h, a| h[a.downcase.to_sym] = a
|
401
|
-
h }
|
402
|
-
|
403
|
-
LITERALS = [
|
404
|
-
:integer_literal,
|
405
|
-
:string_literal,
|
406
|
-
# :wide_string_literal,
|
407
|
-
:character_literal,
|
408
|
-
# :wide_character_literal,
|
409
|
-
:fixed_pt_literal,
|
410
|
-
:floating_pt_literal,
|
411
|
-
:boolean_literal]
|
412
|
-
|
413
|
-
BOOL_LITERALS = {
|
414
|
-
false: false,
|
415
|
-
true: true
|
416
|
-
}
|
417
|
-
|
418
419
|
def is_literal?(o)
|
419
420
|
LITERALS.include?(o)
|
420
421
|
end
|
data/lib/ridl/type.rb
CHANGED
@@ -176,6 +176,10 @@ module IDL
|
|
176
176
|
val < self.max ? val + 1 : self.min
|
177
177
|
end
|
178
178
|
|
179
|
+
def default
|
180
|
+
0
|
181
|
+
end
|
182
|
+
|
179
183
|
def Integer.newclass(range, bits)
|
180
184
|
k = Class.new(self)
|
181
185
|
k.const_set('Range', range)
|
@@ -184,9 +188,11 @@ module IDL
|
|
184
188
|
end
|
185
189
|
end
|
186
190
|
Octet = Integer.newclass(0..0xFF, 8)
|
191
|
+
UTinyShort = Integer.newclass(0..0xFF, 8)
|
187
192
|
UShort = Integer.newclass(0..0xFFFF, 16)
|
188
193
|
ULong = Integer.newclass(0..0xFFFFFFFF, 32)
|
189
194
|
ULongLong = Integer.newclass(0..0xFFFFFFFFFFFFFFFF, 64)
|
195
|
+
TinyShort = Integer.newclass(-0x80...0x800, 8)
|
190
196
|
Short = Integer.newclass(-0x8000...0x8000, 16)
|
191
197
|
Long = Integer.newclass(-0x80000000...0x80000000, 32)
|
192
198
|
LongLong = Integer.newclass(-0x8000000000000000...0x8000000000000000, 64)
|
@@ -214,6 +220,10 @@ module IDL
|
|
214
220
|
Range.include?(val)
|
215
221
|
end
|
216
222
|
|
223
|
+
def default
|
224
|
+
false
|
225
|
+
end
|
226
|
+
|
217
227
|
def next(val)
|
218
228
|
!val
|
219
229
|
end
|
@@ -261,10 +271,11 @@ module IDL
|
|
261
271
|
attr_reader :digits, :scale
|
262
272
|
|
263
273
|
def initialize(digits = nil, scale = nil)
|
274
|
+
raise "anonymous fixed definitions are not allowed!" if digits.nil? || scale.nil?
|
264
275
|
raise "significant digits for Fixed should be in the range 0-31" unless digits.nil? || (0..31) === digits.to_i
|
265
276
|
|
266
|
-
@digits = digits.
|
267
|
-
@scale = scale.
|
277
|
+
@digits = digits.to_i
|
278
|
+
@scale = scale.to_i
|
268
279
|
end
|
269
280
|
|
270
281
|
def narrow(obj)
|
@@ -387,6 +398,70 @@ module IDL
|
|
387
398
|
end
|
388
399
|
end
|
389
400
|
|
401
|
+
class Map < Type
|
402
|
+
attr_reader :size, :keytype, :valuetype
|
403
|
+
attr_accessor :recursive
|
404
|
+
|
405
|
+
def length
|
406
|
+
@size
|
407
|
+
end
|
408
|
+
|
409
|
+
def initialize(key, value, size)
|
410
|
+
raise "Anonymous type definitions are not allowed!" if key.is_anonymous? || value.is_anonymous?
|
411
|
+
|
412
|
+
@keytype = key
|
413
|
+
@valuetype = value
|
414
|
+
@size = size
|
415
|
+
@typename = format("map<%s,%s%s>", key.typename, value.typename,
|
416
|
+
if @size.nil? then
|
417
|
+
""
|
418
|
+
else
|
419
|
+
", #{IDL::Expression::ScopedName === size ? size.node.name : size.to_s}"
|
420
|
+
end)
|
421
|
+
@recursive = false
|
422
|
+
end
|
423
|
+
|
424
|
+
def typename
|
425
|
+
@typename
|
426
|
+
end
|
427
|
+
|
428
|
+
def narrow(obj)
|
429
|
+
typeerror(obj)
|
430
|
+
end
|
431
|
+
|
432
|
+
def is_complete?
|
433
|
+
@keytype.resolved_type.is_complete? && @valuetype.resolved_type.is_complete?
|
434
|
+
end
|
435
|
+
|
436
|
+
def is_local?(recurstk = [])
|
437
|
+
@keytype.resolved_type.is_local?(recurstk) && @valuetype.resolved_type.is_local?(recurstk)
|
438
|
+
end
|
439
|
+
|
440
|
+
def is_recursive?
|
441
|
+
@recursive
|
442
|
+
end
|
443
|
+
|
444
|
+
def is_anonymous?
|
445
|
+
true
|
446
|
+
end
|
447
|
+
|
448
|
+
def is_template?
|
449
|
+
(@size && @size.is_a?(IDL::Expression::ScopedName) && @size.node.is_a?(IDL::AST::TemplateParam)) || @basetype.is_template?
|
450
|
+
end
|
451
|
+
|
452
|
+
def matches?(idltype)
|
453
|
+
super && self.size == idltype.size && self.keytype.resolved_type.matches?(idltype.keytype.resolved_type) && self.valuetype.resolved_type.matches?(idltype.valuetype.resolved_type)
|
454
|
+
end
|
455
|
+
|
456
|
+
def instantiate(instantiation_context)
|
457
|
+
if self.is_template?
|
458
|
+
Type::Map.new(@keytype.instantiate(instantiation_context), @valuetype.instantiate(instantiation_context), @size ? @size.instantiate(instantiation_context).value : nil)
|
459
|
+
else
|
460
|
+
self
|
461
|
+
end
|
462
|
+
end
|
463
|
+
end
|
464
|
+
|
390
465
|
class Array < Type
|
391
466
|
attr_reader :basetype, :sizes
|
392
467
|
|
@@ -580,6 +655,62 @@ module IDL
|
|
580
655
|
end
|
581
656
|
end
|
582
657
|
|
658
|
+
class BitMask < NodeType
|
659
|
+
def narrow(obj)
|
660
|
+
typeerror(obj) unless ::Integer === obj
|
661
|
+
typeerror(obj) unless (0...@node.bitvalues.length) === obj
|
662
|
+
obj
|
663
|
+
end
|
664
|
+
|
665
|
+
def range_length
|
666
|
+
@node.bitvalues.length
|
667
|
+
end
|
668
|
+
|
669
|
+
def min
|
670
|
+
0
|
671
|
+
end
|
672
|
+
|
673
|
+
def max
|
674
|
+
@node.bitvalues.length - 1
|
675
|
+
end
|
676
|
+
|
677
|
+
def in_range?(val)
|
678
|
+
val >= self.min && val <= self.max
|
679
|
+
end
|
680
|
+
|
681
|
+
def next(val)
|
682
|
+
val < self.max ? val + 1 : self.min
|
683
|
+
end
|
684
|
+
end
|
685
|
+
|
686
|
+
class BitSet < NodeType
|
687
|
+
def narrow(obj)
|
688
|
+
typeerror(obj) unless ::Integer === obj
|
689
|
+
typeerror(obj) unless (0...@node.bitfields.length) === obj
|
690
|
+
obj
|
691
|
+
end
|
692
|
+
|
693
|
+
def range_length
|
694
|
+
@node.bitfields.length
|
695
|
+
end
|
696
|
+
|
697
|
+
def min
|
698
|
+
0
|
699
|
+
end
|
700
|
+
|
701
|
+
def max
|
702
|
+
@node.bitfields.length - 1
|
703
|
+
end
|
704
|
+
|
705
|
+
def in_range?(val)
|
706
|
+
val >= self.min && val <= self.max
|
707
|
+
end
|
708
|
+
|
709
|
+
def next(val)
|
710
|
+
val < self.max ? val + 1 : self.min
|
711
|
+
end
|
712
|
+
end
|
713
|
+
|
583
714
|
class Const < Type
|
584
715
|
attr_reader :type
|
585
716
|
|
data/lib/ridl/version.rb
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
module IDL
|
14
14
|
RIDL_VERSION_MAJOR = 2
|
15
|
-
RIDL_VERSION_MINOR =
|
15
|
+
RIDL_VERSION_MINOR = 10
|
16
16
|
RIDL_VERSION_RELEASE = 0
|
17
17
|
RIDL_VERSION = "#{RIDL_VERSION_MAJOR}.#{RIDL_VERSION_MINOR}.#{RIDL_VERSION_RELEASE}"
|
18
18
|
RIDL_COPYRIGHT = "Copyright (c) 2007-#{Time.now.year} Remedy IT Expertise BV, The Netherlands".freeze
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ridl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Corino
|
8
8
|
- Johnny Willemsen
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2025-09-11 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: OMG v3.3 compliant native Ruby IDL compiler frontend with support for
|
15
15
|
pluggable (and stackable) backends.
|
@@ -29,7 +29,6 @@ files:
|
|
29
29
|
- lib/ridl/node.rb
|
30
30
|
- lib/ridl/options.rb
|
31
31
|
- lib/ridl/optparse_ext.rb
|
32
|
-
- lib/ridl/parser.diff
|
33
32
|
- lib/ridl/parser.rb
|
34
33
|
- lib/ridl/parser.ry
|
35
34
|
- lib/ridl/require.rb
|
@@ -44,7 +43,7 @@ licenses:
|
|
44
43
|
metadata:
|
45
44
|
bug_tracker_uri: https://github.com/RemedyIT/ridl/issues
|
46
45
|
source_code_uri: https://github.com/RemedyIT/ridl
|
47
|
-
post_install_message:
|
46
|
+
post_install_message:
|
48
47
|
rdoc_options:
|
49
48
|
- "--main"
|
50
49
|
- README.rdoc
|
@@ -64,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
63
|
version: '0'
|
65
64
|
requirements: []
|
66
65
|
rubygems_version: 3.1.6
|
67
|
-
signing_key:
|
66
|
+
signing_key:
|
68
67
|
specification_version: 4
|
69
68
|
summary: Ruby OMG IDL compiler
|
70
69
|
test_files: []
|
data/lib/ridl/parser.diff
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
diff --git a/lib/ridl/parser.rb b/lib/ridl/parser.rb
|
2
|
-
index 0cc4f7f..a1a44ec 100644
|
3
|
-
--- a/lib/ridl/parser.rb
|
4
|
-
+++ b/lib/ridl/parser.rb
|
5
|
-
@@ -40,15 +40,15 @@ module Racc
|
6
|
-
|
7
|
-
class Parser
|
8
|
-
|
9
|
-
- Racc_Runtime_Version = '1.4.6'
|
10
|
-
- Racc_Runtime_Revision = '$Id$'
|
11
|
-
+ Racc_Runtime_Version = '1.4.6' unless defined?(Racc_Runtime_Version)
|
12
|
-
+ Racc_Runtime_Revision = '$Id$' unless defined?(Racc_Runtime_Revision)
|
13
|
-
|
14
|
-
- Racc_Runtime_Core_Version_R = '1.4.6'
|
15
|
-
- Racc_Runtime_Core_Revision_R = '$Id$'.split[1]
|
16
|
-
+ Racc_Runtime_Core_Version_R = '1.4.6' unless defined?(Racc_Runtime_Core_Version_R)
|
17
|
-
+ Racc_Runtime_Core_Revision_R = '$Id$'.split[1] unless defined?(Racc_Runtime_Core_Revision_R)
|
18
|
-
begin
|
19
|
-
require 'racc/cparse'
|
20
|
-
# Racc_Runtime_Core_Version_C = (defined in extention)
|
21
|
-
- Racc_Runtime_Core_Revision_C = Racc_Runtime_Core_Id_C.split[2]
|
22
|
-
+ Racc_Runtime_Core_Revision_C = Racc_Runtime_Core_Id_C.split[2] unless defined?(Racc_Runtime_Core_Revision_C)
|
23
|
-
unless new.respond_to?(:_racc_do_parse_c, true)
|
24
|
-
raise LoadError, 'old cparse.so'
|
25
|
-
end
|
26
|
-
@@ -56,11 +56,11 @@ module Racc
|
27
|
-
raise LoadError, 'selecting ruby version of racc runtime core'
|
28
|
-
end
|
29
|
-
|
30
|
-
- Racc_Main_Parsing_Routine = :_racc_do_parse_c
|
31
|
-
- Racc_YY_Parse_Method = :_racc_yyparse_c
|
32
|
-
- Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_C
|
33
|
-
- Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_C
|
34
|
-
- Racc_Runtime_Type = 'c'
|
35
|
-
+ Racc_Main_Parsing_Routine = :_racc_do_parse_c unless defined?(Racc_Main_Parsing_Routine)
|
36
|
-
+ Racc_YY_Parse_Method = :_racc_yyparse_c unless defined?(Racc_YY_Parse_Method)
|
37
|
-
+ Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_C unless defined?(Racc_Runtime_Core_Version)
|
38
|
-
+ Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_C unless defined?(Racc_Runtime_Core_Revision)
|
39
|
-
+ Racc_Runtime_Type = 'c' unless defined?(Racc_Runtime_Type)
|
40
|
-
rescue LoadError
|
41
|
-
Racc_Main_Parsing_Routine = :_racc_do_parse_rb
|
42
|
-
Racc_YY_Parse_Method = :_racc_yyparse_rb
|